diff --git a/.env.production b/.env.production index 6f8604e..5bd67a0 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,7 @@ ENV = 'production' # base api -VUE_APP_BASE_API='https://cz-hjjc.115.langye.net' -VUE_APP_UPLOAD_API='https://cz-hjjc.115.langye.net/api/upload-file' +VUE_APP_BASE_API='http://192.168.16.110:8080' +VUE_APP_UPLOAD_API='http://192.168.16.110:8080/api/upload-file' VUE_APP_PREVIEW=//view.langye.net/preview/onlinePreview VUE_APP_MODULE_NAME=oa diff --git a/src/utils/formBuilder.js b/src/utils/formBuilder.js index afa26fa..cc49d9d 100644 --- a/src/utils/formBuilder.js +++ b/src/utils/formBuilder.js @@ -256,9 +256,10 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab props: { value: row[info.name], 'progress-text': "{percent}%", - 'more-config': {maxCount: 1, layout: 'horizontal'}, + 'more-config': { maxCount: 1, layout: 'horizontal' }, 'show-button-text': false, 'limit-size': 20, + 'limit-count': info.multiple ? 20 : 1, multiple: !!info.multiple, readonly: pReadable, 'upload-method': ({ file }) => { @@ -274,9 +275,10 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab row[info.name] = [] } row[info.name].push({ - ...response.data.data, + response: response.data.data, name: response.data.data.original_name, url: response.data.data.url, + TYPE_FILE: 1 }) } else { this.$message.error("上传失败") @@ -297,7 +299,8 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab accept: "application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", multiple: !!info.multiple, - fileList: this.file[info.name], + limit: info.multiple ? 20 : 1, + fileList: this.form[info.name], beforeUpload: (file) => { if (file.size / 1024 / 1024 > 20) { this.$message({ @@ -313,13 +316,22 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab file.response = file.response.data; } }); - this.file[info.name] = fileList; + this.form[info.name] = fileList.map(i => ({ + ...i, + TYPE_FILE: 1 + })); }, onRemove: (file, fileList) => { - this.file[info.name] = fileList; + this.form[info.name] = fileList.map(i => ({ + ...i, + TYPE_FILE: 1 + })); }, onError: (err, file, fileList) => { - this.file[info.name] = fileList; + this.form[info.name] = fileList.map(i => ({ + ...i, + TYPE_FILE: 1 + })); this.$message({ type: "warning", message: err, @@ -362,13 +374,8 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab class: "el-icon-close", on: { ["click"]: () => { - this.$set( - this.file, - info.field, - this.file[info.field].filter( - (item) => item !== file - ) - ); + if (file.status === "uploading") return + this.form[info.name].splice(this.form[info.name].indexOf(file), 1) }, }, }), @@ -504,10 +511,13 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab formBuilderMap(device).get(info.type), { props: { - value: row ? (row[info.name] ? row[info.name].split(',').map(i => Number(i)) : []) : (this.form[info.name] ? this.form[info.name].split('|').map(i => Number(i)) : []), + value: row ? (row[info.name] ? row[info.name].split(',').map(i => Number(i)) : []) : (this.form[info.name] ? this.form[info.name].split(',').map(i => Number(i)) : []), clearable: true, placeholder: info.help_text, multiple: true, + filterable: true, + 'reserve-keyword': true, + loading: this.flowSelectLoading }, attrs: { placeholder: info.help_text, @@ -521,6 +531,23 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab ? this.$set(row, info.name, e.toString()) : this.$set(this.form, info.name, e.toString()); }, + ['visible-change']:e => { + if (e) { + if (this.nowSelectId === info.stub && this.flows.length > 0) return + this.flowSelectLoading = true + flowList('all', { + page: 1, + page_size: 9999, + custom_model_id: info.stub + }).then(res => { + this.nowSelectId = info.stub + this.flows = res.data.data + this.flowSelectLoading = false + }).catch(err => { + this.flowSelectLoading = false + }) + } + } }, }, this.flows.map((option) => @@ -600,6 +627,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab this.$refs[`subForm-${info.name}`]; if ($table) { await $table.remove(row); + this.form[info.name] = $table.getTableData()?.tableData } }, }, @@ -647,22 +675,22 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab "edit-render": {}, }, scopedSlots: { - edit: ({ row }) => { + edit: ({ row: myrow }) => { return formBuilder.bind(this)( device, subField, h, - row, + myrow, info._writeable, false, ); }, - [subField.type === 'file' ? 'default' : false]: ({ row }) => { + [subField.type === 'file' ? 'default' : false]: ({ row: myrow }) => { return formBuilder.bind(this)( device, subField, h, - row, + myrow, info._writeable, true, ); @@ -674,7 +702,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab ); break; } - } else if (info._readable) { + } else if (info._readable || pReadable) { switch (info.type) { case "date": formItem = h( @@ -771,7 +799,22 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab ); break; case "file": - formItem = h( + formItem = row ? + h( + 'vxe-upload', + { + props: { + value: row[info.name], + 'progress-text': "{percent}%", + 'more-config': { maxCount: 1, layout: 'horizontal' }, + 'show-button-text': false, + 'limit-size': 20, + 'limit-count': info.multiple ? 20 : 1, + readonly: true + } + } + ) : + h( formBuilderMap(device).get(info.type), { props: { @@ -783,7 +826,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab accept: "application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", multiple: true, - fileList: this.file[info.name], + fileList: (this.form[info.name] instanceof Array) ? this.form[info.name] : [], }, scopedSlots: { file: (scope) => { @@ -824,7 +867,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab { slot: "trigger", }, - `数量:${this.file[info.name].length}` + `数量:${(this.form[info.name] instanceof Array) ? this.form[info.name]?.length : 0}` ), ] ); @@ -860,7 +903,29 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab "grid-row-end": info.gs_y + 1 + (info.name === 'flow_title' ? 0 : 1) + info.gs_height, }, }, - [formItem] + [formItem,(() => { + if (info.is_sign) { + let log = this.logs.find(log => log.node?.fields?.findIndex(field => field?.field?.name === info.name) !== -1) + if (log) { + return h('div',[ + h('el-image',{ + style: { + 'max-height': '80px' + }, + props: { + src: log.user.sign_file?.url, + fit: 'contain', + alt: log.user.sign_id + }, + attrs: { + src: log.user.sign_file?.url, + alt: log.user.sign_id + } + }) + ]) + } + } + })()] ); } } @@ -1021,8 +1086,8 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab }, accept: "application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", - multiple: true, - fileList: this.file[info.name], + multiple: !!info.multiple, + fileList: row ? row[info.name] : this.form[info.name], beforeUpload: (file) => { if (file.size / 1024 / 1024 > 20) { this.$message({ @@ -1038,13 +1103,13 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab file.response = file.response.data; } }); - this.file[info.name] = fileList; + row ? row[info.name] = fileList : this.form[info.name] = fileList; }, onRemove: (file, fileList) => { - this.file[info.name] = fileList; + row ? row[info.name] = fileList : this.form[info.name] = fileList; }, onError: (err, file, fileList) => { - this.file[info.name] = fileList; + row ? row[info.name] = fileList : this.form[info.name] = fileList; this.$message({ type: "warning", message: err, @@ -1291,7 +1356,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab title: info.label, } }, - this.file[info.name].map(file => h("div", {}, [ + (row ? row[info.name] : this.form[info.name]).map(file => h("div", {}, [ h( "a", { diff --git a/src/utils/print.js b/src/utils/print.js index be380be..42135ab 100644 --- a/src/utils/print.js +++ b/src/utils/print.js @@ -22,15 +22,24 @@ export function print(printJs, isLog, form, logContent) { while ((match = regexField.exec(printJs)) !== null) { fieldMaths.push(match[0]); // 提取 之间的内容 } - fieldMaths.forEach(fieldMath => { + fieldMaths.forEach(async fieldMath => { const matchName = fieldMath.match(/name="([^"]+)"/); if (matchName) { const nameValue = matchName[1]; if (Array.from(staticMap.keys()).indexOf(nameValue) !== -1) { printStr = printStr.replace(fieldMath, staticMap.get(nameValue)) } else { - const value = store.getters.device === 'desktop' ? document.querySelector(`[for=${nameValue}]+div`).innerHTML : document.querySelector(`[for=${nameValue}] > div:nth-child(2)`).innerHTML - printStr = printStr.replace(fieldMath,`${value}`) + let value = store.getters.device === 'desktop' ? (document.querySelector(`[for="${nameValue}"]+div`) ? document.querySelector(`[for="${nameValue}"]+div`).innerHTML : '') : (document.querySelector(`[for="${nameValue}"] > div:nth-child(2)`) ? document.querySelector(`[for="${nameValue}"] > div:nth-child(2)`).innerHTML : '') + if (//g)[0] + printStr = printStr.replace(fieldMath,subFormBody) + } else { + printStr = printStr.replace(fieldMath,`${value}`) + } } } else { console.log('未找到name属性'); @@ -42,7 +51,7 @@ export function print(printJs, isLog, form, logContent) { logStyle.forEach(item => { totalLogStyle += item }) - printStr = printStr.replace('',`${totalLogStyle}`) + printStr = printStr.replace('',`${totalLogStyle}`) const logBody = logContent.match(//g)[0] printStr = printStr.replace('
',`${logBody}`) } diff --git a/src/views/BeOnDuty/components/AddBeOnDuty.vue b/src/views/BeOnDuty/components/AddBeOnDuty.vue index 7ab55e5..93c39f5 100644 --- a/src/views/BeOnDuty/components/AddBeOnDuty.vue +++ b/src/views/BeOnDuty/components/AddBeOnDuty.vue @@ -13,12 +13,13 @@ > - + @@ -27,18 +28,19 @@ - + - + @@ -76,8 +78,8 @@ export default { date: '', user_id: '', leader_id: '', - leader_status: 1, - status: 1, + leader_status: 0, + status: 0, remark: '' }, rules: { diff --git a/src/views/BeOnDuty/index.vue b/src/views/BeOnDuty/index.vue index 0fbfd4d..e4e2eb1 100644 --- a/src/views/BeOnDuty/index.vue +++ b/src/views/BeOnDuty/index.vue @@ -29,6 +29,7 @@