Commit 80bfbece authored by danfuman's avatar danfuman

Merge branch 'V20231129-中建一局二公司' of http://192.168.60.201/root/dsk-operate-sys...

Merge branch 'V20231129-中建一局二公司' of http://192.168.60.201/root/dsk-operate-sys into V20231129-中建一局二公司
parents fe7f1feb 6a7365db
.el-dialog__header {
padding: 0px 20px;
height: 56px;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #eeeeee;
.el-dialog__title {
color: #232323;
font-size: 16px;
font-weight: bold;
}
.el-dialog__headerbtn {
position: static;
height: 16px;
width: 16px;
}
}
.el-dialog {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
margin: 0px;
margin-top: 0px !important;
.el-dialog__body {
padding: 24px 20px;
box-sizing: border-box;
.el-table {
th {
height: 40px;
padding: 9px 0px;
box-sizing: border-box;
font-size: 12px;
font-weight: 400;
color: #232323;
}
.cell {
display: block;
line-height: 22px;
}
}
.el-image {
width: 100%;
.el-image__error {
height: 300px;
}
}
.el-pagination {
margin-top: 16px;
padding: 0px;
display: flex;
align-items: center;
justify-content: flex-end;
.el-pager {
height: 28px;
}
}
}
}
<template> <template>
<div class="dsk-email-input-container"> <div class="dsk-email-input-container">
<el-autocomplete :popper-class="popperClass" v-model="comEmailValue" :clearable="clearable" :fetch-suggestions="searchQuery" <el-autocomplete :popper-class="popperClass" v-model="comEmailValue" :clearable="clearable" :fetch-suggestions="searchQuery"
:placeholder="placeholder" @select="handleSelect" @input="valueChange"> :placeholder="placeholder" @select="handleSelect" @input="valueChange" :disabled="disabled">
<template slot-scope="{ item }"> <template slot-scope="{ item }">
<slot :optionData="item"> <slot :optionData="item">
<div class="email-type-option"> <div class="email-type-option">
......
<template>
<div class="dsk-file-input-container" :class="{'upload-is-disabled' : disabled}">
<div class="dsk-photo-input-inner" @click.stop="uploadFile" v-if="!comFileList.length">
<i class="el-icon-plus"></i>
<span>上传文件</span>
</div>
<el-badge :value="comFileList.length" class="item" type="primary" v-if="comFileList.length" @click.native="showFileListDialog">
<div class="dsk-photo-input-inner" @click.stop="uploadFile">
<i class="el-icon-plus"></i>
<span>上传文件</span>
</div>
</el-badge>
<el-upload :on-change="handleChange" action="#" :accept="allowTypes.join(',')" :auto-upload="false" :show-file-list="false"
ref="elUploadDskUploadIns" class="el-upload-dsk-upload-ins"></el-upload>
<el-dialog title="已上传文件" :visible.sync="fileListDialog" width="800px" @close="fileListDialogClose" :close-on-click-modal="false"
class="dsk-upload-dialog">
<el-table :data="comFileList.slice((pageInfo.currentPage -1) * pageInfo.pageSize, pageInfo.pageSize * pageInfo.currentPage)" border stripe>
<el-table-column prop="fileName" label="文件名称"></el-table-column>
<el-table-column prop="type" label="文件类型"></el-table-column>
<el-table-column prop="url" label="文件地址" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span style="color:#0081ff;cursor: pointer;" @click="viewFile(scope.row)">{{scope.row.url}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="90" v-if="!disabled">
<template slot-scope="scope">
<span style="color:#F56C6C;cursor: pointer;" @click="removeImg(scope.row)">删除</span>
</template>
</el-table-column>
</el-table>
<el-pagination background layout="prev, pager, next" :total="comFileList.length" @current-change="currentChange"
v-if="comFileList.length > 10"></el-pagination>
</el-dialog>
</div>
</template>
<script>
import { uploadFileToOssApi } from "@/api/consultingOrgManagement";
import { elementMessageSingleton } from "@/utils";
export default {
name: "dskFileInput",
props: {
limit: {
type: [String, Number]
},
disabled: {
type: Boolean,
default: false
},
fileList: {
type: Array,
default: () => []
}
},
model: {
prop: "fileList",
event: "update:fileList"
},
data() {
return {
allowTypes: [".docx", ".pdf", ".doc", ".xlsx", ".xls", ".xlt", ".xlsm", ".txt", ".xltm"],
comFileList: [],
fileListDialog: false,
pageInfo: {
pageSize: 10,
currentPage: 1
}
};
},
//可访问data属性
created() {
},
//计算集
computed: {
limitRestrict() {
return this.limit === -1 ? true : this.comFileList.length >= this.limit ? false : true;
}
},
//方法集
methods: {
async handleChange(file, fileList) {
try {
/**
* @type {string}
*/
let fileName = file.name;
let fileType = "";
const index = fileName.lastIndexOf(".");
if (index) fileType = fileName.slice(index);
if (!this.allowTypes.includes(fileType.toLowerCase())) {
return this.$message.warning(`只支持上传${this.allowTypes.join(" , ")}类型文件`);
}
// 验证通过进行上传
await this.uploadHandle(file.raw, fileType);
this.$message.success("上传成功");
} catch (error) {
console.log(error);
} finally {
this.$refs["elUploadDskUploadIns"].clearFiles();
}
},
uploadFile() {
// 禁用状态
if (this.disabled) return;
// 超出个数限制
if (!this.limitRestrict) return elementMessageSingleton("warning", `文件限制上传${this.limit}个,已上传${this.comFileList.length}个文件`);
this.$refs["elUploadDskUploadIns"].$el.querySelector(".el-upload__input").click();
},
async uploadHandle(file, fileType) {
try {
const formData = new FormData();
formData.append("file", file);
const result = await uploadFileToOssApi(formData);
if (result.code == 200 && result.data) {
this.comFileList.push({
url: result.data.url,
type: fileType,
id: result.data.ossId,
fileName: result.data.fileName
});
this.$emit("update:fileList", this.comFileList);
}
} catch (error) {
}
},
showFileListDialog() {
this.fileListDialog = true;
},
fileListDialogClose() {
this.pageInfo = this.$options.data.call(this).pageInfo;
},
viewFile(row) {
this.$download.saveAs(row.url, row.fileName);
},
currentChange(current) {
this.pageInfo.currentPage = current;
},
removeImg(row) {
if (row.id) {
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.comFileList.findIndex(item => item.id == row.id);
if (index > -1) {
this.comFileList.splice(index, 1);
this.$emit("update:fileList", this.comFileList);
this.$message({
type: 'success',
message: '删除成功!'
});
}
}).catch(() => { });
}
}
},
}
</script>
<style lang="scss" scoped>
.dsk-file-input-container {
width: 100%;
height: 32px;
&.upload-is-disabled {
.dsk-photo-input-inner {
cursor: not-allowed;
&:hover {
color: rgba(35, 35, 35, 0.8);
border-color: #dcdfe6;
}
}
}
.dsk-photo-input-inner {
width: 106px;
height: 32px;
background: #ffffff;
border: 1px solid #dcdfe6;
display: flex;
align-items: center;
justify-content: center;
padding: 0px 16px;
box-sizing: border-box;
color: rgba(35, 35, 35, 0.8);
font-size: 14px;
font-weight: 400;
cursor: pointer;
&:hover {
color: #0081ff;
border-color: #0081ff;
}
}
::v-deep .el-upload-dsk-upload-ins {
width: 0px;
height: 0px;
opacity: 0;
position: relative;
z-index: -999;
}
::v-deep .el-badge__content {
background: #0081ff;
cursor: pointer;
border-color: #0081ff;
}
::v-deep .dsk-upload-dialog {
@import "@/assets/styles/dsk-upload-dialog.scss";
}
}
</style>
<template> <template>
<div class="dsk-photo-input-container"> <div class="dsk-photo-input-container" :class="{'upload-is-disabled' : disabled}">
<el-badge :value="0" class="item" type="primary"> <div class="dsk-photo-input-inner" @click.stop="uploadFile" v-if="!comFileList.length">
<i class="el-icon-plus"></i>
<span>上传图片</span>
</div>
<el-badge :value="comFileList.length" class="item" type="primary" v-if="comFileList.length" @click.native="showFileListDialog">
<div class="dsk-photo-input-inner" @click.stop="uploadFile"> <div class="dsk-photo-input-inner" @click.stop="uploadFile">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<span>上传图片</span> <span>上传图片</span>
</div> </div>
</el-badge> </el-badge>
<el-upload :on-change="handleChange" action="#" :accept="allowTypes.join(',')" :auto-upload="false" :show-file-list="false" :limit="limit" <el-upload :on-change="handleChange" action="#" :accept="allowTypes.join(',')" :auto-upload="false" :show-file-list="false"
ref="elUploadDskUploadIns" class="el-upload-dsk-upload-ins"></el-upload> ref="elUploadDskUploadIns" class="el-upload-dsk-upload-ins"></el-upload>
<el-dialog title="已上传图片" :visible.sync="fileListDialog" width="800px" @close="fileListDialogClose" :close-on-click-modal="false"
class="dsk-upload-dialog">
<el-table :data="comFileList.slice((pageInfo.currentPage -1) * pageInfo.pageSize, pageInfo.pageSize * pageInfo.currentPage)" border stripe>
<el-table-column prop="fileName" label="图片名称"></el-table-column>
<el-table-column prop="type" label="图片类型"></el-table-column>
<el-table-column prop="url" label="图片地址" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span style="color:#0081ff;cursor: pointer;" @click="viewPhoto(scope.row)">{{scope.row.url}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="90" v-if="!disabled">
<template slot-scope="scope">
<span style="color:#F56C6C;cursor: pointer;" @click="removeImg(scope.row)">删除</span>
</template>
</el-table-column>
</el-table>
<el-pagination background layout="prev, pager, next" :total="comFileList.length" @current-change="currentChange"
v-if="comFileList.length > 10"></el-pagination>
</el-dialog>
<el-dialog title="图片预览" :visible.sync="photoViewDialog" width="800px" @close="photoViewDialogClose" :close-on-click-modal="false"
class="dsk-upload-dialog">
<el-image :src="viewTemp.url" fit="fill"></el-image>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { uploadFileToOssApi } from "@/api/consultingOrgManagement"; import { uploadFileToOssApi } from "@/api/consultingOrgManagement";
import { elementMessageSingleton } from "@/utils";
export default { export default {
name: "dskPhotoInput", name: "dskPhotoInput",
props: { props: {
limit: { limit: {
type: [String, Number], type: [String, Number]
default: 1 },
disabled: {
type: Boolean,
default: false
},
fileList: {
type: Array,
default: () => []
} }
}, },
// watch: {
// fileList: {
// handler(newValue) {
// this.comFileList = newValue;
// },
// deep: true
// }
// },
model: {
prop: "fileList",
event: "update:fileList"
},
data() { data() {
return { return {
allowTypes: [".jpg", ".png", ".svg", ".gif", ".jpeg"], allowTypes: [".jpg", ".png", ".svg", ".gif", ".jpeg"],
comFileList: [] comFileList: [],
fileListDialog: false,
photoViewDialog: false,
viewTemp: {},
pageInfo: {
pageSize: 10,
currentPage: 1
}
}; };
}, },
//可访问data属性 //可访问data属性
...@@ -32,7 +89,9 @@ export default { ...@@ -32,7 +89,9 @@ export default {
}, },
//计算集 //计算集
computed: { computed: {
limitRestrict() {
return this.limit === -1 ? true : this.comFileList.length >= this.limit ? false : true;
}
}, },
//方法集 //方法集
methods: { methods: {
...@@ -50,12 +109,19 @@ export default { ...@@ -50,12 +109,19 @@ export default {
return this.$message.warning(`只支持上传${this.allowTypes.join(" , ")}类型图片`); return this.$message.warning(`只支持上传${this.allowTypes.join(" , ")}类型图片`);
} }
// 验证通过进行上传 // 验证通过进行上传
const result = this.uploadHandle(file.raw, fileType); await this.uploadHandle(file.raw, fileType);
this.$message.success("上传成功");
} catch (error) { } catch (error) {
console.log(error);
} finally {
this.$refs["elUploadDskUploadIns"].clearFiles();
} }
}, },
uploadFile() { uploadFile() {
// 禁用状态
if (this.disabled) return;
// 超出个数限制
if (!this.limitRestrict) return elementMessageSingleton("warning", `图片限制上传${this.limit}张,已上传${this.comFileList.length}张图片`);
this.$refs["elUploadDskUploadIns"].$el.querySelector(".el-upload__input").click(); this.$refs["elUploadDskUploadIns"].$el.querySelector(".el-upload__input").click();
}, },
async uploadHandle(file, fileType) { async uploadHandle(file, fileType) {
...@@ -67,12 +133,49 @@ export default { ...@@ -67,12 +133,49 @@ export default {
this.comFileList.push({ this.comFileList.push({
url: result.data.url, url: result.data.url,
type: fileType, type: fileType,
fileName: "" id: result.data.ossId,
fileName: result.data.fileName
}); });
this.$emit("update:fileList", this.comFileList);
} }
} catch (error) { } catch (error) {
} }
},
showFileListDialog() {
this.fileListDialog = true;
},
fileListDialogClose() {
this.pageInfo = this.$options.data.call(this).pageInfo;
},
viewPhoto(row) {
this.viewTemp = row;
this.photoViewDialog = true;
},
photoViewDialogClose() {
this.viewTemp = {};
},
currentChange(current) {
this.pageInfo.currentPage = current;
},
removeImg(row) {
if (row.id) {
this.$confirm('此操作将永久删除该图片, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const index = this.comFileList.findIndex(item => item.id == row.id);
if (index > -1) {
this.comFileList.splice(index, 1);
this.$emit("update:fileList", this.comFileList);
this.$message({
type: 'success',
message: '删除成功!'
});
}
}).catch(() => { });
}
} }
}, },
} }
...@@ -82,6 +185,16 @@ export default { ...@@ -82,6 +185,16 @@ export default {
width: 100%; width: 100%;
height: 32px; height: 32px;
&.upload-is-disabled {
.dsk-photo-input-inner {
cursor: not-allowed;
&:hover {
color: rgba(35, 35, 35, 0.8);
border-color: #dcdfe6;
}
}
}
.dsk-photo-input-inner { .dsk-photo-input-inner {
width: 106px; width: 106px;
height: 32px; height: 32px;
...@@ -111,5 +224,15 @@ export default { ...@@ -111,5 +224,15 @@ export default {
position: relative; position: relative;
z-index: -999; z-index: -999;
} }
::v-deep .el-badge__content {
background: #0081ff;
cursor: pointer;
border-color: #0081ff;
}
::v-deep .dsk-upload-dialog {
@import "@/assets/styles/dsk-upload-dialog.scss";
}
} }
</style> </style>
...@@ -273,13 +273,12 @@ export const defaultComOptions = [ ...@@ -273,13 +273,12 @@ export const defaultComOptions = [
width: 100, width: 100,
limit: -1, limit: -1,
astrict: false, astrict: false,
fileList: [],
isError: false isError: false
}, },
// 组件属性 // 组件属性
componentAttribute: { componentAttribute: {
// 绑定的值 // 绑定的值
value: "", value: [],
// 输入值为空提示 // 输入值为空提示
placeholder: "请选择" placeholder: "请选择"
} }
...@@ -305,13 +304,12 @@ export const defaultComOptions = [ ...@@ -305,13 +304,12 @@ export const defaultComOptions = [
width: 100, width: 100,
limit: -1, limit: -1,
astrict: false, astrict: false,
fileList: [],
isError: false isError: false
}, },
// 组件属性 // 组件属性
componentAttribute: { componentAttribute: {
// 绑定的值 // 绑定的值
value: "", value: [],
// 输入值为空提示 // 输入值为空提示
placeholder: "请选择" placeholder: "请选择"
} }
......
...@@ -28,7 +28,11 @@ ...@@ -28,7 +28,11 @@
<dsk-email-input v-model="comChildModuleInfo.componentAttribute.value" :placeholder="comChildModuleInfo.componentAttribute.placeholder" <dsk-email-input v-model="comChildModuleInfo.componentAttribute.value" :placeholder="comChildModuleInfo.componentAttribute.placeholder"
:clearable="true" :disabled="isDisabled" v-if="comChildModuleInfo.comType == 'email'"></dsk-email-input> :clearable="true" :disabled="isDisabled" v-if="comChildModuleInfo.comType == 'email'"></dsk-email-input>
<!-- 图片类型 --> <!-- 图片类型 -->
<dsk-photo-input v-if="comChildModuleInfo.comType == 'photo'"></dsk-photo-input> <dsk-photo-input v-model="comChildModuleInfo.componentAttribute.value" :disabled="isDisabled" v-if="comChildModuleInfo.comType == 'photo'"
:limit="comChildModuleInfo.formAttribute.limit"></dsk-photo-input>
<!-- 文件类型 -->
<dsk-file-input v-model="comChildModuleInfo.componentAttribute.value" :disabled="isDisabled" v-if="comChildModuleInfo.comType == 'file'"
:limit="comChildModuleInfo.formAttribute.limit"></dsk-file-input>
</el-form-item> </el-form-item>
<img src="@/assets/images/consultingAgencyManagement/customForm/icon_delete@2x.png" alt="" class="remove-subfield-item-icon" <img src="@/assets/images/consultingAgencyManagement/customForm/icon_delete@2x.png" alt="" class="remove-subfield-item-icon"
...@@ -40,11 +44,13 @@ import { cloneDeep } from "lodash-es"; ...@@ -40,11 +44,13 @@ import { cloneDeep } from "lodash-es";
import Schema from "async-validator"; import Schema from "async-validator";
import DskEmailInput from "@/components/DskEmailInput"; import DskEmailInput from "@/components/DskEmailInput";
import DskPhotoInput from "@/components/DskPhotoInput"; import DskPhotoInput from "@/components/DskPhotoInput";
import DskFileInput from "@/components/DskFileInput";
export default { export default {
name: "subfieldItem", name: "subfieldItem",
components: { components: {
DskEmailInput, DskEmailInput,
DskPhotoInput DskPhotoInput,
DskFileInput
}, },
props: { props: {
childModuleInfo: Object, childModuleInfo: Object,
......
...@@ -146,6 +146,10 @@ export default { ...@@ -146,6 +146,10 @@ export default {
isModify: { isModify: {
type: Boolean, type: Boolean,
default: false default: false
},
projectKey: {
type: String,
default: ""
} }
}, },
directives: { directives: {
...@@ -330,7 +334,7 @@ export default { ...@@ -330,7 +334,7 @@ export default {
const _temp = JSON.parse(JSON.stringify(this.comProjectDetailInfo)); const _temp = JSON.parse(JSON.stringify(this.comProjectDetailInfo));
const paramsData = { const paramsData = {
isNewAdvisoryBody: _temp.isNewAdvisoryBody ? _temp.isNewAdvisoryBody : result.isNewAdvisoryBody, isNewAdvisoryBody: _temp.isNewAdvisoryBody ? _temp.isNewAdvisoryBody : result.isNewAdvisoryBody,
projectKey: _temp.projectKey, projectKey: this.projectKey,
advisoryBodyCid: _temp.advisoryBody.advisoryBodyCid, advisoryBodyCid: _temp.advisoryBody.advisoryBodyCid,
advisoryBodyName: _temp.advisoryBody.advisoryBodyName ?? "", advisoryBodyName: _temp.advisoryBody.advisoryBodyName ?? "",
businessScope: _temp.advisoryBody.businessScope ?? "", businessScope: _temp.advisoryBody.businessScope ?? "",
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<!-- 工程基本信息 --> <!-- 工程基本信息 -->
<basic-engineering-information v-if="currentList === 'project'" :projectDetailInfo="projectDetailInfo"></basic-engineering-information> <basic-engineering-information v-if="currentList === 'project'" :projectDetailInfo="projectDetailInfo"></basic-engineering-information>
<!-- 咨询机构结算信息 --> <!-- 咨询机构结算信息 -->
<consulting-agency v-if="currentList === 'consultingAgency'" :projectDetailInfo="projectDetailInfo" :isModify="isModify" <consulting-agency v-if="currentList === 'consultingAgency'" :projectKey="projectKey" :projectDetailInfo="projectDetailInfo" :isModify="isModify"
ref="consultingAgency" @editComProjectDetailSuccess="editComProjectDetailSuccess" ref="consultingAgency" @editComProjectDetailSuccess="editComProjectDetailSuccess"
@searchLoadingChange="searchLoadingChange"></consulting-agency> @searchLoadingChange="searchLoadingChange"></consulting-agency>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment