From 6be98c69626e003417ab960b6ca84476ddf3b30e Mon Sep 17 00:00:00 2001 From: kongyeqing <2697454777@qq.com> Date: Tue, 12 Sep 2023 18:08:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=9A=90=E6=82=A3=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/analEvaluation.component.vue | 6 +- src/service/area.service.ts | 2 +- src/service/unit.service.ts | 2 +- src/views/hiddenDanger/clap.component.vue | 29 +- src/views/hiddenDanger/common.component.html | 4 +- src/views/hiddenDanger/files.component.vue | 1 + src/views/hiddenDanger/manager.component.vue | 27 +- .../hiddenDanger/rules/rules.component.html | 9 +- .../hiddenDanger/rules/rules.component.vue | 2 + .../rules/rulesManager.component.vue | 647 +++++++++--------- .../rewardsRecord.component.html | 10 +- .../rewardsRecord/rewardsRecord.component.vue | 95 ++- .../selfAssessment.component.html | 8 +- .../selfAssessment.component.vue | 131 ++-- .../assessment/device/device.component.html | 6 +- src/views/threecards/common.component.html | 2 +- .../threecards/emergencyCard.component.vue | 23 +- src/views/threecards/riskCard.component.vue | 26 +- src/views/threecards/safeCard.component.vue | 26 +- src/views/workprogress/common.component.html | 4 +- src/views/workprogress/leader.component.vue | 43 +- .../managementSystem.component.vue | 18 +- .../workprogress/programme.component.vue | 4 +- .../workprogress/trainRecords.component.vue | 12 +- 24 files changed, 694 insertions(+), 443 deletions(-) diff --git a/src/components/analEvaluation.component.vue b/src/components/analEvaluation.component.vue index 7f53ee0..0ff30e4 100644 --- a/src/components/analEvaluation.component.vue +++ b/src/components/analEvaluation.component.vue @@ -227,7 +227,7 @@ export default class AnalEvaluationComponent extends Vue { key: "name", type: "text", require: true, - width: "calc(50% - 20px)", + width: "100%", disable: true, showError: false, }, { @@ -259,9 +259,9 @@ export default class AnalEvaluationComponent extends Vue { { name: "作业步骤描述", key: "description", - type: "text", + type: "textarea", require: true, - width: "calc(100% - 20px)", + width: "100%", disable: true, showError: false, }, diff --git a/src/service/area.service.ts b/src/service/area.service.ts index f112dd6..3ed21b0 100644 --- a/src/service/area.service.ts +++ b/src/service/area.service.ts @@ -7,7 +7,7 @@ export default class AreaService extends BaseService{ } // 查询列表 public selectByPage(params: any):Promise>>{ - const url = this.prefix.prevention+'/risk/area/list'; + const url = this.prefix.prevention+'/risk/area/analList'; return this.get(url,params,true) } // 批量删除 diff --git a/src/service/unit.service.ts b/src/service/unit.service.ts index c327016..3afb334 100644 --- a/src/service/unit.service.ts +++ b/src/service/unit.service.ts @@ -6,7 +6,7 @@ export default class UnitService extends BaseService{ super() } public selectByPage(params: any,showLoading?):Promise>>{ - const url = this.prefix.prevention+'/risk/unit/list'; + const url = this.prefix.prevention+'/risk/unit/listAll'; return this.get(url,params,showLoading) } diff --git a/src/views/hiddenDanger/clap.component.vue b/src/views/hiddenDanger/clap.component.vue index dad184b..6bc7e9d 100644 --- a/src/views/hiddenDanger/clap.component.vue +++ b/src/views/hiddenDanger/clap.component.vue @@ -137,7 +137,6 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent value: item.id } }); - this.buildUpdateForm() }) } // 加载单元列表 @@ -149,7 +148,8 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent value: item.id } }); - this.buildUpdateForm() + const option = this.updateOptions.find(item => item.key === "unitId") as any; + option.datas = this.unitList }) } @@ -293,6 +293,7 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent require: true, expandLevel: Infinity, showError: false, + clearable: true, datas: this.$store.state.deptTreeList }, { name: "整改人员", @@ -321,6 +322,11 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent width: "calc(50% - 20px)", require: true, showError: false, + pickerOptions: { + disabledDate(time) { + return time.getTime() < moment(new Date()).subtract(1, 'day').toDate().getTime(); + } + } }, { name: "问题描述", key: "description", @@ -477,6 +483,14 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent if (item && item.key === "verifyUserId") { this.updateParams.verifyUserName = this.$store.getters.user_map[data] } + if (item && item.key === 'reformDeadline') { + const now = moment().format("YYYY-MM-DD HH"); + if (now > data) { + this.$message.error("要求整改日期不能早于当前时间") + this.updateParams.reformDeadline = null; + return + } + } // } @@ -517,6 +531,7 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent pageNum: 1, pageSize: 20, } as any; + this.getTableData() } @@ -533,7 +548,8 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent inspectUserName: this.account.nickName, number: null, photo: null, - inspectTime: moment().format("YYYY-MM-DD HH:mm") + inspectTime: moment().format("YYYY-MM-DD HH:mm"), + dangerType: 4 } if (!row) { this.tableService.getNumber().then(res => { @@ -558,8 +574,7 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent type: "随手拍", }, res.data) this.updateParams.majorHazard = +this.updateParams.majorHazard - this.updateParams.majorHazardName = !this.updateParams.majorHazard ? '不涉及' : this.$store.getters.prevention_risk_source_map[this.updateParams.majorHazard] - + this.updateParams.majorHazardName = !this.updateParams.majorHazard ? '不涉及' : this.$store.getters.prevention_risk_source_map[this.updateParams.majorHazard] // 地图定位 this.center = [res.data.locationLng, res.data.locationLat]; this.buildUpdateForm() @@ -651,7 +666,6 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent } public onPreview(file) { - console.log(file) if (file.type.indexOf("png") >= 0 || file.type.indexOf("jp") >= 0) { this.currentUrl = file.url; this.showFile = true; @@ -669,8 +683,7 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent this.updateParams.resourceName = this.photoList.map(item => item.name).join(",") this.updateParams.resourceOtherId = this.fileList.map(item => item.id).join(",") this.updateParams.resourceOtherName = this.fileList.map(item => item.name).join(",") - - this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id).then(res => { + this.tableService.addOrUpdate(JSON.parse(JSON.stringify(this.updateParams)), !this.updateParams.id).then(res => { this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功"); if (isSubmit) { this.startWorkFlow(res.data, [this.updateParams.reformUserId]) diff --git a/src/views/hiddenDanger/common.component.html b/src/views/hiddenDanger/common.component.html index 9195122..4590782 100644 --- a/src/views/hiddenDanger/common.component.html +++ b/src/views/hiddenDanger/common.component.html @@ -2,7 +2,7 @@
@@ -42,7 +42,7 @@ @click="showUpdateModel(scope.row,true)">查看 修改 - 删除 + 删除 pageNum: 1, pageSize: 20, } as any; + this.getTableData() } diff --git a/src/views/hiddenDanger/manager.component.vue b/src/views/hiddenDanger/manager.component.vue index abf1a1a..421e0bb 100644 --- a/src/views/hiddenDanger/manager.component.vue +++ b/src/views/hiddenDanger/manager.component.vue @@ -426,6 +426,7 @@ export default class HiddenDangerManagerComponent extends BaseRecordComponent { + this.updateParams.executeMoney = +data.toFixed(2) + }, 0) + } if (item && item.key === "reformDeadline") { const now = moment().format("YYYY-MM-DD HH"); if (now > data) { @@ -1053,7 +1064,7 @@ export default class HiddenDangerManagerComponent extends BaseRecordComponent item.id).join(",") this.updateParams.verifyResourceName = this.photoList2.map(item => item.name).join(",") this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id).then(res => { - this.$message.success(!this.updateParams.id ? "新增成功" : "编辑成功"); + this.$message.success(!this.updateParams.id ? "新增成功" : "提交成功"); if (!preStatus) { if (isSubmit) { this.startWorkFlow(this.updateParams.id || res.data, [this.updateParams.reformUserId]) @@ -1167,17 +1178,17 @@ export default class HiddenDangerManagerComponent extends BaseRecordComponent item.id === file.response.data.id), 1) + this.photoList.splice(this.photoList.findIndex(item => item.id === file.id), 1) this.updateParams.photo = this.photoList.length || null } public onRemove2(file, fileList) { - this.fileList.splice(this.fileList.findIndex(item => item.id === file.response.data.id), 1) + this.fileList.splice(this.fileList.findIndex(item => item.id === file.id), 1) } public onRemove3(file, fileList) { - this.fileList2.splice(this.fileList2.findIndex(item => item.id === file.response.data.id), 1) + this.fileList2.splice(this.fileList2.findIndex(item => item.id === file.id), 1) } public onRemove4(file, fileList) { - this.photoList2.splice(this.photoList2.findIndex(item => item.id === file.response.data.id), 1) + this.photoList2.splice(this.photoList2.findIndex(item => item.id === file.id), 1) } public onPreview(file) { diff --git a/src/views/hiddenDanger/rules/rules.component.html b/src/views/hiddenDanger/rules/rules.component.html index be2cf6e..5c2e0fb 100644 --- a/src/views/hiddenDanger/rules/rules.component.html +++ b/src/views/hiddenDanger/rules/rules.component.html @@ -51,7 +51,7 @@ - @@ -80,9 +80,9 @@ + :visible.sync="showSubUpdate" :before-close="handleClose" destroy-on-close> @@ -93,8 +93,7 @@ - - diff --git a/src/views/hiddenDanger/rules/rules.component.vue b/src/views/hiddenDanger/rules/rules.component.vue index 51680dc..ebea7a8 100644 --- a/src/views/hiddenDanger/rules/rules.component.vue +++ b/src/views/hiddenDanger/rules/rules.component.vue @@ -122,6 +122,7 @@ export default class RulesComponent extends BaseRecordComponent { require: true, multiple: true, showError: false, + clearable: true, datas: this.$store.state.prevention_dangrous_type }] this.updateActions = [{ @@ -193,6 +194,7 @@ export default class RulesComponent extends BaseRecordComponent { pageNum: 1, pageSize: 20, } as any; + this.getTableData() } /** * 数据保存 diff --git a/src/views/hiddenDanger/rules/rulesManager.component.vue b/src/views/hiddenDanger/rules/rulesManager.component.vue index caa4e70..a8413f2 100644 --- a/src/views/hiddenDanger/rules/rulesManager.component.vue +++ b/src/views/hiddenDanger/rules/rulesManager.component.vue @@ -14,7 +14,7 @@ import AreaService from '@/service/area.service'; import RuleService from '@/service/rule.service'; @Component({ template, - components:{ + components: { FormComponent, TableComponent, DrawComponent, @@ -38,10 +38,10 @@ export default class RulesManagerComponent extends BaseRecordComponent { public unitList = []; public formActions = [{ - name:"查询", - value:"search", - icon:"el-icon-search", - type:"primary" + name: "查询", + value: "search", + icon: "el-icon-search", + type: "primary" }, { name: "清空", icon: "el-icon-tickets", @@ -49,482 +49,517 @@ export default class RulesManagerComponent extends BaseRecordComponent { }]; public tableActions = [{ - name:"添加", - value:"add", - icon:"el-icon-plus", - type:"primary" - },{ - name:"批量删除", - value:"delete", - plain:true, - icon:"el-icon-delete", - type:"danger" + name: "添加", + value: "add", + icon: "el-icon-plus", + type: "primary" + }, { + name: "批量删除", + value: "delete", + plain: true, + icon: "el-icon-delete", + type: "danger" }]; public updateTableActions = [{ - name:"添加", - value:"subAdd", - plain:true, - icon:"el-icon-plus", - type:"success" - },{ - name:"批量删除", - value:"subDelete", - plain:true, - icon:"el-icon-delete", - type:"danger" - },{ - name:"批量添加", - value:"subMutilAdd", - icon:"el-icon-plus", - type:"primary" + name: "添加", + value: "subAdd", + plain: true, + icon: "el-icon-plus", + type: "success" + }, { + name: "批量删除", + value: "subDelete", + plain: true, + icon: "el-icon-delete", + type: "danger" + }, { + name: "批量添加", + value: "subMutilAdd", + icon: "el-icon-plus", + type: "primary" }]; public footerActions = [{ - name:"选择全部", - value:"selectAll", - type:"primary" - },{ - name:"反向选择", - value:"reverse" + name: "选择全部", + value: "selectAll", + type: "primary" + }, { + name: "反向选择", + value: "reverse" }]; - public formOptions:FormOption[] = [{ - name:"检查表名称", - key:"name", - type:"text" + public formOptions: FormOption[] = [{ + name: "检查表名称", + key: "name", + type: "text" }]; - public mutilAddOptions:FormOption[] = []; + public mutilAddOptions: FormOption[] = []; public showUpdate = false; public currentId = -1; - public updateParams = {} as any; - public subUpdateParams = {} as any; - public updateOptions:FormOption[] = []; - public updateTableData = {datas:[]}; - public updateTableColumn = [] as any; + public updateParams = {} as any; + public subUpdateParams = {} as any; + public updateOptions: FormOption[] = []; + public updateTableData = { datas: [] }; + public updateTableColumn = [] as any; public showSubUpdate = false; public showSubMutilUpdate = false; public ruleParams = { - pageSize:10, - pageNum:1 + pageSize: 10, + pageNum: 1 } - public updateActions = [{ - name:"取消", - value:"cancel" - },{ - name:"保存并继续添加", - value:"saveAndContinue", - type:"primary" - },{ - name:"保存", - value:"save", - type:"primary" - }]; + public updateActions = [] as any; - public subUpdateOptions = [{ - name:"检查项目", - type:"text", - require:true, - showError:false, - width:"100%", - key:"name", - },{ - name:"检查内容", - type:"textarea", - require:true, - width:"100%", - showError:false, - key:"content", - },{ - name:"检查依据", - type:"textarea", - require:true, - width:"100%", - showError:false, - key:"reason", - }] + public checkUpdateActions = [] as any; + + public subUpdateOptions = [] as any; public subUpdateActions = [{ - name:"取消", - value:"cancelSub" - },{ - name:"确定", - value:"saveSub", - type:"primary" + name: "取消", + value: "cancel" + }, { + name: "确定", + value: "saveSub", + type: "primary" }]; public selectData = []; - - created(){ + + created() { this.loadAreaData(); this.loadRuleTable(); } - public loadRuleTable(num?,type?){ - if(type && num){ + public loadRuleTable(num?, type?) { + if (type && num) { this.ruleParams[type] = num - }else{ + } else { this.ruleParams = { - pageSize:10, - pageNum:1 + pageSize: 10, + pageNum: 1 } } - this.ruleService.selectByPage(this.ruleParams).then((res:any)=>{ + this.ruleService.selectByPage(this.ruleParams).then((res: any) => { this.updateTableData = res.data; - this.updateTableData.datas.forEach((item:any,index)=>{ - item.index = index+1; + this.updateTableData.datas.forEach((item: any, index) => { + item.index = index + 1; }) }) } - public buildUpdateForm(){ + public buildUpdateForm() { this.mutilAddOptions = [{ - name:"检查项目", - key:"name", - type:"text" - },{ - name:"类型", - key:"type", - clearable:true, - type:"select", - datas:this.$store.state.prevention_dangrous_type + name: "检查项目", + key: "name", + type: "text" + }, { + name: "类型", + key: "type", + clearable: true, + type: "select", + datas: this.$store.state.prevention_dangrous_type }] this.updateOptions = [{ - name:"检查表编号", - key:"number", - type:"text", - width:"calc(50% - 20px)", - require:true, - disable:true, - },{ - name:"检查表名称", - key:"name", - type:"text", - width:"calc(50% - 20px)", - require:true, - showError:false, - },{ - name:"适用区域", - key:"areas", - type:"select", - multiple:true, - width:"calc(50% - 20px)", - require:true, - showError:false, - datas:this.areaList - },{ - name:"适用单元", - key:"units", - type:"select", - multiple:true, - width:"calc(50% - 20px)", - require:true, - showError:false, - datas:this.unitList - },{ - name:"适用对象", - key:"targets", - type:"select", - multiple:true, - width:"calc(50% - 20px)", - require:true, - showError:false, - datas:this.$store.state.analControlList, - },{ - name:"适用部门", - key:"depts", - multiple:true, - type:"select", - width:"calc(50% - 20px)", - require:true, - showError:false, - datas:this.$store.state.deptList - },{ - name:"适用类型", - key:"types", - type:"select", - width:"calc(50% - 20px)", - require:true, - multiple:true, - showError:false, - datas:this.$store.state.prevention_dangrous_type + name: "检查表编号", + key: "number", + type: "text", + width: "calc(50% - 20px)", + require: true, + disable: true, + }, { + name: "检查表名称", + key: "name", + type: "text", + width: "calc(50% - 20px)", + require: true, + showError: false, + }, { + name: "适用区域", + key: "areas", + type: "select", + multiple: true, + width: "calc(50% - 20px)", + require: true, + showError: false, + datas: this.areaList + }, { + name: "适用单元", + key: "units", + type: "select", + multiple: true, + width: "calc(50% - 20px)", + require: true, + showError: false, + datas: this.unitList + }, { + name: "适用对象", + key: "targets", + type: "select", + multiple: true, + width: "calc(50% - 20px)", + require: true, + showError: false, + datas: this.$store.state.analControlList, + }, { + name: "适用部门", + key: "depts", + multiple: true, + type: "select", + width: "calc(50% - 20px)", + require: true, + showError: false, + datas: this.$store.state.deptList + }, { + name: "适用类型", + key: "types", + type: "select", + width: "calc(50% - 20px)", + require: true, + multiple: true, + showError: false, + datas: this.$store.state.prevention_dangrous_type }] + this.updateActions = [{ + name: "取消", + value: "cancel" + }, { + name: "保存并继续添加", + value: "saveAndContinue", + type: "primary", + hide: this.updateParams.id + }, { + name: "保存", + value: "save", + type: "primary" + }]; } - // 加载区域列表 - public loadAreaData(){ - this.areaService.selectByPage({pageSize:1000}).then((res:any)=>{ - this.areaList = res.data.datas.map(item=>{ + public subBuildUpdateForm() { + this.subUpdateOptions = [{ + name: "检查项目", + type: "text", + require: true, + showError: false, + width: "100%", + key: "name", + }, { + name: "检查内容", + type: "textarea", + require: true, + width: "100%", + showError: false, + key: "content", + }, { + name: "检查依据", + type: "textarea", + require: true, + width: "100%", + showError: false, + key: "reason", + }] + this.checkUpdateActions = [{ + name: "取消", + value: "cancel" + }, { + name: "保存并继续添加", + value: "saveAndContinue", + type: "primary", + hide: this.subUpdateParams.index + }, { + name: "保存", + value: "save", + type: "primary" + }]; + } + + // 加载区域列表 + public loadAreaData() { + this.areaService.selectByPage({ pageSize: 1000 }).then((res: any) => { + this.areaList = res.data.datas.map(item => { return { - name:item.name, - value:item.id + name: item.name, + value: item.id } }); - this.loadUnitData() }) } // 加载单元列表 - public loadUnitData(ids?){ - this.unitService.getListByIds({areaIds:ids},false).then((res:any)=>{ - this.unitList = res.data.map(item=>{ + public loadUnitData(ids?) { + this.unitService.getListByIds({ areaIds: ids }, false).then((res: any) => { + this.unitList = res.data.map(item => { return { - name:item.name, - value:item.id + name: item.name, + value: item.id } }); - this.buildUpdateForm() + const option = this.updateOptions.find(item => item.key === "units") as any; + option.datas = this.unitList }) } - public getNumber(){ - this.tableService.getNumber().then(res=>{ + public getNumber() { + this.tableService.getNumber().then(res => { this.updateParams.number = res.data }) } - public buildTable(){ + public buildTable() { this.tableColumn = []; - this.tableColumn.push({name:'检查表名称',key:"name"}); - this.tableColumn.push({name:'区域名称',key:"areas"}); - this.tableColumn.push({name:'单元名称',key:"units"}); - this.tableColumn.push({name:'对象名称',key:"targets"}); - this.tableColumn.push({name:'适用部门',key:"depts"}); - this.tableColumn.push({name:'适用类型',key:"types",filters:this.$store.state.prevention_dangrous_type.map(item=>{ - return { - text:item.name, - value:item.name, - } - }),filterMethod:(data,row)=>{ - return row.types.indexOf(data)>=0; - }, render: (data) => { + this.tableColumn.push({ name: '检查表名称', key: "name" }); + this.tableColumn.push({ name: '区域名称', key: "areas" }); + this.tableColumn.push({ name: '单元名称', key: "units" }); + this.tableColumn.push({ name: '对象名称', key: "targets" }); + this.tableColumn.push({ name: '适用部门', key: "depts" }); + this.tableColumn.push({ + name: '适用类型', key: "types", filters: this.$store.state.prevention_dangrous_type.map(item => { + return { + text: item.name, + value: item.name, + } + }), filterMethod: (data, row) => { + return row.types.indexOf(data) >= 0; + }, render: (data) => { return data.types.split(',').map(item => { return this.$store.getters.prevention_dangrous_type_map[item] }).join(",") - }}); - this.tableColumn.push({name:'编制人',key:"createName"}); - this.tableColumn.push({name:'编制时间',key:"createTime"}); + } + }); + this.tableColumn.push({ name: '编制人', key: "createName" }); + this.tableColumn.push({ name: '编制时间', key: "createTime" }); this.updateTableColumn = []; - this.updateTableColumn.push({name:'序号',key:"index",width:"60px"}); - this.updateTableColumn.push({name:'检查项目',key:"name",showTip:true}); - this.updateTableColumn.push({name:'检查内容',key:"content",showTip:true}); - this.updateTableColumn.push({name:'检查依据',key:"reason",showTip:true}); - if(this.showSubMutilUpdate){ - this.updateTableColumn.push({name:'检查类型',key:"reason",render:(data)=>{ - return this.$store.getters.prevention_dangrous_type_map[data.type] - }}); + this.updateTableColumn.push({ name: '序号', key: "index", width: "60px" }); + this.updateTableColumn.push({ name: '检查项目', key: "name", showTip: true }); + this.updateTableColumn.push({ name: '检查内容', key: "content", showTip: true }); + this.updateTableColumn.push({ name: '检查依据', key: "reason", showTip: true }); + if (this.showSubMutilUpdate) { + this.updateTableColumn.push({ + name: '检查类型', key: "type", render: (data) => { + return this.$store.getters.prevention_dangrous_type_map[data.type] + } + }); } } - public change(data,item){ - + public change(data, item) { + // 区域 - if(item && item.key==="areas"){ - if(this.updateParams.units.length){ + if (item && item.key === "areas") { + if (this.updateParams.units.length) { this.updateParams.units = []; } this.loadUnitData(data) } } - public callback(data,type?){ - if(type){ + public callback(data, type?) { + if (type) { this.params[type] = data; this.getTableData(); return } // 查询 - if(data && data.value==="search"){ + if (data && data.value === "search") { this.getTableData() - // 重置 - }else if(data &&data.value === "reset"){ + // 重置 + } else if (data && data.value === "reset") { this.reset() - // 反选 - }else if(data &&data.value === "reverse"){ + // 反选 + } else if (data && data.value === "reverse") { this.toggleAll() - // 全选 - }else if(data && data.value === "selectAll"){ + // 全选 + } else if (data && data.value === "selectAll") { this.selectAll() - }else if(data && data.value === "add"){ + } else if (data && data.value === "add") { this.showUpdateModel() - }else if(data && data.value === "delete"){ - this.deleteData(this.selectData.map((item:any)=>item.id)) - }else if(data && data.value.indexOf("save")>=0){ - this.doSave(data.value!=="save") - }else if(data && data.value === "cancel"){ + } else if (data && data.value === "delete") { + this.deleteData(this.selectData.map((item: any) => item.id)) + } else if (data && data.value.indexOf("save") >= 0) { + this.doSave(data.value !== "save") + } else if (data && data.value === "cancel") { this.handleClose() } } - public subChange(data,item){ + public subChange(data, item) { // } - public subCallback(data){ - if(data && data.value==="subAdd"){ + public subCallback(data) { + if (data && data.value === "subAdd") { this.showSubUpdateModel() - }else if(data && data.value.indexOf("save")>=0){ - this.doSubSave(data.value!=="save") - }else if(data && data.value==="cancel"){ + } else if (data && data.value.indexOf("save") >= 0) { + this.doSubSave(data.value !== "save") + } else if (data && data.value === "cancel") { this.handleClose() - }else if(data && data.value==="subDelete"){ - this.doSubDelete(this.selectData.map((item:any)=>item.index -1)) - }else if(data && data.value==="subMutilAdd"){ + } else if (data && data.value === "subDelete") { + this.doSubDelete(this.selectData.map((item: any) => item.index - 1)) + } else if (data && data.value === "subMutilAdd") { this.showSubMutilUpdate = true; this.buildTable() this.clearSelect() + this.loadRuleTable(); } } - public doMutilAdd(){ - this.selectData.forEach((item:any)=>{ - if(!this.updateParams.tableItems.find(itm=>itm.id===item.id)){ + public doMutilAdd() { + this.selectData.forEach((item: any) => { + if (!this.updateParams.tableItems.find(itm => itm.id === item.id)) { const data = JSON.parse(JSON.stringify(item)) delete data.id; this.updateParams.tableItems.push(data) } }) - this.updateParams.tableItems.forEach((item,i)=>{ - item.index = i+1 + this.updateParams.tableItems.forEach((item, i) => { + item.index = i + 1 }) this.clearSelect() - this.showSubMutilUpdate=false; + this.ruleParams = { + pageSize: 10, + pageNum: 1 + } + this.showSubMutilUpdate = false; this.buildTable(); } - public cancelMutilAdd(){ + public cancelMutilAdd() { this.clearSelect(); this.ruleParams = { - pageNum:1, - pageSize:10, + pageNum: 1, + pageSize: 10, } - this.showSubMutilUpdate=false; + this.showSubMutilUpdate = false; this.buildTable(); } - public clearSelect(){ + public clearSelect() { (this.$refs.multipleTable as any).clearSelection(); this.selectData = []; } // 重置数据 - public reset(){ + public reset() { this.params = { - name:"", - pageNum:1, - pageSize:20, + name: "", + pageNum: 1, + pageSize: 20, } as any; this.ruleParams = { - pageNum:1, - pageSize:10, + pageNum: 1, + pageSize: 10, } + this.getTableData() } - public showSubUpdateModel(row?,isRead?){ + public showSubUpdateModel(row?, isRead?) { this.subUpdateParams = {} as any; this.subIsReadonly = !!isRead; - if(row){ + if (row) { this.subUpdateParams = JSON.parse(JSON.stringify(row)) } + this.subBuildUpdateForm() this.showSubUpdate = true; } - public showUpdateModel(row?,isRead?){ - this.updateParams = {number:null,tableItems:[]} as any; + public showUpdateModel(row?, isRead?) { + this.updateParams = { number: null, tableItems: [] } as any; this.isReadonly = !!isRead; this.clearSelect() - - this.buildUpdateForm(); - if(!row){ + if (!row) { this.currentId = -1; this.getNumber(); + this.buildUpdateForm(); this.showUpdate = true; - }else{ + } else { this.currentId = row.id; - this.tableService.selectById(this.currentId,true).then((res:any)=>{ - if(isRead){ - this.updateParams = Object.assign(res.data,row) - }else{ + this.tableService.selectById(this.currentId, true).then((res: any) => { + if (isRead) { + this.updateParams = Object.assign(res.data, row) + } else { this.updateParams = res.data; this.loadUnitData(res.data.areas) } - this.updateParams.tableItems.forEach((item,i)=>{ - item.index = i+1 + this.updateParams.tableItems.forEach((item, i) => { + item.index = i + 1 }) + this.buildUpdateForm(); this.showUpdate = true; }) } + + + } - public doSubSave(goOn?){ - if(!this.subUpdateParams.index){ - this.subUpdateParams.index = this.updateParams.tableItems.length+1; + public doSubSave(goOn?) { + if (!this.subUpdateParams.index) { + this.subUpdateParams.index = this.updateParams.tableItems.length + 1; this.updateParams.tableItems.push(this.subUpdateParams); - }else{ - this.updateParams.tableItems.splice(this.updateParams.tableItems.findIndex(item=>item.index ===this.subUpdateParams.index),1,this.subUpdateParams) + } else { + this.updateParams.tableItems.splice(this.updateParams.tableItems.findIndex(item => item.index === this.subUpdateParams.index), 1, this.subUpdateParams) } - this.updateParams.tableItems.forEach((item,i)=>{ - item.index = i+1 + this.updateParams.tableItems.forEach((item, i) => { + item.index = i + 1 }) this.subUpdateParams = {} as any; - this.showSubUpdate = !!goOn + this.showSubUpdate = false; } - public doSubDelete(indexs){ - for(let i = this.updateParams.tableItems.length-1;i>=0;i--){ - if(indexs.includes(i)){ - this.updateParams.tableItems.splice(i,1) + public doSubDelete(indexs) { + for (let i = this.updateParams.tableItems.length - 1; i >= 0; i--) { + if (indexs.includes(i)) { + this.updateParams.tableItems.splice(i, 1) } } - this.updateParams.tableItems.forEach((item,i)=>{ - item.index = i+1 + this.updateParams.tableItems.forEach((item, i) => { + item.index = i + 1 }) this.clearSelect() } - public doSave(goOn?){ - this.updateParams.depts = this.updateParams.depts.map(item=>{ + public doSave(goOn?) { + this.updateParams.depts = this.updateParams.depts.map(item => { return { - id:item, - name:this.$store.getters.dept_map[item] + id: item, + name: this.$store.getters.dept_map[item] } }) - this.updateParams.targets = this.updateParams.targets.map(item=>{ + this.updateParams.targets = this.updateParams.targets.map(item => { return { - id:item, - name:this.$store.getters.prevention_anal_control_map[item] + id: item, + name: this.$store.getters.prevention_anal_control_map[item] } }) - this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then(res=>{ - this.$message.success(this.currentId===-1?"新增成功!":"编辑成功"); + this.tableService.addOrUpdate(this.updateParams, this.currentId === -1).then(res => { + this.$message.success(this.currentId === -1 ? "新增成功!" : "编辑成功"); this.getTableData(); this.showUpdate = !!goOn; - this.updateParams = {areas:[],depts:[],units:[],types:[],targets:[],number:null,tableItems:[]} as any; - if(!!goOn){ + this.updateParams = { areas: [], depts: [], units: [], types: [], targets: [], number: null, tableItems: [] } as any; + if (!!goOn) { this.getNumber(); } - }).catch(()=>{ - this.updateParams.depts = this.updateParams.depts.map(item=>item.id) + }).catch(() => { + this.updateParams.depts = this.updateParams.depts.map(item => item.id) - this.updateParams.targets = this.updateParams.targets.map(item=>item.id) + this.updateParams.targets = this.updateParams.targets.map(item => item.id) }) } - public handleClose(){ - if(this.showSubMutilUpdate){ + public handleClose() { + if (this.showSubMutilUpdate) { this.showSubMutilUpdate = false; this.buildTable(); return } - if(this.showSubUpdate){ + if (this.showSubUpdate) { this.showSubUpdate = false; return } @@ -533,25 +568,25 @@ export default class RulesManagerComponent extends BaseRecordComponent { public toggleAll() { - - this.tableData.datas.forEach((item,index)=>{ + + this.tableData.datas.forEach((item, index) => { (this.$refs.multipleTable as any).toggleRowSelection(item); }) } - public selectAll(){ - if(!this.selectData.length){ + public selectAll() { + if (!this.selectData.length) { this.toggleAll() - }else{ - this.tableData.datas.forEach((item,index)=>{ - const find = this.selectData.find((data:any)=>data.id === item.id); - if(!find){ + } else { + this.tableData.datas.forEach((item, index) => { + const find = this.selectData.find((data: any) => data.id === item.id); + if (!find) { (this.$refs.multipleTable as any).toggleRowSelection(item); } }) } } - public handleSelectionChange(data){ + public handleSelectionChange(data) { this.selectData = data; } } diff --git a/src/views/reward/rewardsRecord/rewardsRecord.component.html b/src/views/reward/rewardsRecord/rewardsRecord.component.html index c4e2496..2d19c8b 100644 --- a/src/views/reward/rewardsRecord/rewardsRecord.component.html +++ b/src/views/reward/rewardsRecord/rewardsRecord.component.html @@ -43,7 +43,7 @@ + :visible.sync="showUpdate" width="952px" :before-close="handleClose" destroy-on-close> @@ -51,7 +51,7 @@ - @@ -80,10 +80,10 @@ + width="952px" destroy-on-close> + @actionCallback="triCallback" :isReadonly="subIsReadonly" :actions="subUpdateActions" :full-btn="true" @change="changes" + btnPosition="center">
\ No newline at end of file diff --git a/src/views/reward/rewardsRecord/rewardsRecord.component.vue b/src/views/reward/rewardsRecord/rewardsRecord.component.vue index d215a10..0c134d8 100644 --- a/src/views/reward/rewardsRecord/rewardsRecord.component.vue +++ b/src/views/reward/rewardsRecord/rewardsRecord.component.vue @@ -120,6 +120,7 @@ export default class RewardsRecord extends BaseRecordComponent { public updateActions = [] as any; + public subUpdateActions = [] as any; public rewardsType = [{ name: "不涉及", @@ -178,6 +179,22 @@ export default class RewardsRecord extends BaseRecordComponent { showError: false, }, ]; + this.updateActions = [{ + name: "取消", + value: "cancel" + }, { + name: "保存并继续添加", + value: "saveAndContinue", + type: "primary", + hide: this.updateParams.id + }, { + name: "保存", + value: "save", + type: "primary" + }]; + } + + public buildSubUpdateForm() { this.subUpdateOptions = [{ name: "奖惩日期", type: "date", @@ -202,6 +219,10 @@ export default class RewardsRecord extends BaseRecordComponent { require: true, width: "calc(50% - 20px)", showError: false, + hide: !(this.subUpdateParams.type && this.subUpdateParams.type !== 1), + rules: [ + { pattern: /^[1-9]\d{0,7}(\.\d{1,3})?$/, message: '不超过八位的整数', }, + ] }, { name: "奖惩事由", type: "textarea", @@ -229,14 +250,14 @@ export default class RewardsRecord extends BaseRecordComponent { expandLevel: Infinity, datas: this.$store.state.deptTreeList },]; - this.updateActions = [{ + this.subUpdateActions = [{ name: "取消", value: "cancel" }, { name: "保存并继续添加", value: "saveAndContinue", type: "primary", - hide: this.updateParams.id + hide: this.subUpdateParams.index }, { name: "保存", value: "save", @@ -266,6 +287,22 @@ export default class RewardsRecord extends BaseRecordComponent { } }) } + if (item && item.key === 'type') { + if (data === 1) { + const option = this.subUpdateOptions.find(item => item.key === "money") as any; + option.hide = true; + this.subUpdateParams.money = null + } else { + const option = this.subUpdateOptions.find(item => item.key === "money") as any; + option.hide = false + } + } + if (item && item.key === 'money') { + this.subUpdateParams.money = null; + setTimeout(() => { + this.subUpdateParams.money = +data.toFixed(2) + }, 0) + } } public buildTable() { @@ -350,8 +387,8 @@ export default class RewardsRecord extends BaseRecordComponent { } // 分页数据 public getTableData() { - if(this.params.postName){ - this.params.postName = this.$store.state.postList.find((item: any) => item.value === this.params.postName)?.name??"" + if (this.params.postName) { + this.params.postName = this.$store.state.postList.find((item: any) => item.value === this.params.postName)?.name ?? "" } this.tableService.selectByPage(this.params).then(res => { this.tableData = res.data as any; @@ -375,7 +412,6 @@ export default class RewardsRecord extends BaseRecordComponent { public toggleAll() { - this.tableData.datas.forEach((item, index) => { (this.$refs.multipleTable as any).toggleRowSelection(item); }) @@ -410,7 +446,6 @@ export default class RewardsRecord extends BaseRecordComponent { this.isReadonly = false this.subIsReadonly = false } - this.tableService.getListDetail({ id: row.id }).then((res: any) => { if (res.code === 200) { this.updateParams = res.data @@ -431,7 +466,8 @@ export default class RewardsRecord extends BaseRecordComponent { if (data.value === "add") { this.subUpdateParams = {} as any; this.subIsReadonly = false; - this.subShowUpdate = true + this.buildSubUpdateForm() + this.subShowUpdate = true; } else if (data.value === "cancel") { this.showUpdate = false } else if (data && data.value.indexOf("save") >= 0) { @@ -441,6 +477,10 @@ export default class RewardsRecord extends BaseRecordComponent { this.deleteSubData(this.subSelectData.map((itm: any) => itm.index - 1)) } } + /** + * 保存数据 + * @param goOn + */ public doSave(goOn?) { this.tableService.addOrUpdate(this.updateParams, this.updateParams.id ? false : true).then((res) => { this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!"); @@ -455,12 +495,15 @@ export default class RewardsRecord extends BaseRecordComponent { public triCallback(data) { if (data.value === "cancel") { - this.subShowUpdate = false + this.subShowUpdate = false; } else if (data && data.value.indexOf("save") >= 0) { this.doSubSave(data.value !== "save") } } - + /** + * 新增奖惩记录 + * @param goOn + */ public doSubSave(goOn) { // 如果是新增步骤 if (this.subShowUpdate) { @@ -474,27 +517,31 @@ export default class RewardsRecord extends BaseRecordComponent { this.updateParams.details.splice(this.updateParams.details.findIndex(item => item.index === this.subUpdateParams.index), 1, this.subUpdateParams) } this.subUpdateParams = {} as any; + this.buildSubUpdateForm() this.subShowUpdate = !!goOn; return } } - //查看或者修改 - public showSubModal(row, isReadonly) { - if (isReadonly) { - this.subIsReadonly = true - this.subUpdateParams = Object.assign({ - typeName: this.rewardsTypeName[row.type] - }, row) - } else { - this.subIsReadonly = false - this.subUpdateParams = row - } - this.subShowUpdate = true - this.buildUpdateForm() - } + /** + * 奖惩记录查看或者修改 + * @param row 当前行数据 + * @param isReadonly 是否是查看 + */ + public showSubModal(row: any, isReadonly = false) { + this.subIsReadonly = isReadonly + this.subUpdateParams = Object.assign({ + typeName: this.rewardsTypeName[row.type] + }, row) - //删除成员 + this.buildSubUpdateForm() + this.subShowUpdate = true + + } + /** + * 删除奖惩记录 + * @param indexs + */ public deleteSubData(indexs) { this.$confirm('确认删除所选数据', '确认数据', { confirmButtonText: '确定', diff --git a/src/views/reward/selfAssessment/selfAssessment.component.html b/src/views/reward/selfAssessment/selfAssessment.component.html index 28c954f..9339c3c 100644 --- a/src/views/reward/selfAssessment/selfAssessment.component.html +++ b/src/views/reward/selfAssessment/selfAssessment.component.html @@ -90,7 +90,7 @@
{{scope.row.deductPoints}} @@ -104,10 +104,12 @@ - + diff --git a/src/views/threecards/common.component.html b/src/views/threecards/common.component.html index c1edcc1..99f7ae5 100644 --- a/src/views/threecards/common.component.html +++ b/src/views/threecards/common.component.html @@ -94,7 +94,7 @@ + width="952px" :before-close="handleClose" destroy-on-close> diff --git a/src/views/threecards/emergencyCard.component.vue b/src/views/threecards/emergencyCard.component.vue index 80d03e3..64aa3bd 100644 --- a/src/views/threecards/emergencyCard.component.vue +++ b/src/views/threecards/emergencyCard.component.vue @@ -376,7 +376,8 @@ export default class EmergencyCard extends BaseRecordComponent { this.updateParams = {} as any; this.setpsOptions = [] as any; this.isReadonly = false; - + //清除附件缓存数据 + this.clearFileListMethod() this.getNumber() } } @@ -414,6 +415,7 @@ export default class EmergencyCard extends BaseRecordComponent { pageNum: 1, pageSize: 20, } as any; + this.getTableData() } public showUpdateModel(id) { @@ -422,6 +424,8 @@ export default class EmergencyCard extends BaseRecordComponent { public handleClose() { this.showUpdate = false; + //清除附件缓存数据 + this.clearFileListMethod() } @@ -477,7 +481,9 @@ export default class EmergencyCard extends BaseRecordComponent { public subCallback(data) { if (data.value === "cancel") { - this.showUpdate = false + this.showUpdate = false; + //清除附件缓存数据 + this.clearFileListMethod() } else if (data && data.value.indexOf("save") >= 0) { this.doSave(data.value !== "save") } @@ -544,7 +550,8 @@ export default class EmergencyCard extends BaseRecordComponent { this.updateParams = {} as any this.showUpdate = !!goOn; this.getTableData(); - + //清除附件缓存数据 + this.clearFileListMethod() if (goOn === true) { this.getNumber() } @@ -599,6 +606,16 @@ export default class EmergencyCard extends BaseRecordComponent { // } + /** + * 清除附件数据 + */ + public clearFileListMethod() { + this.fileList = []; + const option = this.updateStepsOptions.find(item => item.key === "resourceId") as any; + option.fileList = []; + } + + } diff --git a/src/views/threecards/riskCard.component.vue b/src/views/threecards/riskCard.component.vue index 891be6b..f0ebf78 100644 --- a/src/views/threecards/riskCard.component.vue +++ b/src/views/threecards/riskCard.component.vue @@ -270,6 +270,7 @@ export default class RiskCard extends BaseRecordComponent { } created() { + this.buildUpdateForm() } @@ -284,7 +285,9 @@ export default class RiskCard extends BaseRecordComponent { analRiskLevel: item.analRiskLevel ? item.analRiskLevel : null, } }); - this.buildUpdateForm() + // this.buildUpdateForm() + const option = this.subUpdateOptions.find(item => item.key === "areaId") as any; + option.datas = this.areaList; }) } // 加载单元列表 @@ -300,7 +303,9 @@ export default class RiskCard extends BaseRecordComponent { userName: item.chargeUserName, } }); - this.buildUpdateForm() + // this.buildUpdateForm() + const option = this.subUpdateOptions.find(item => item.key === "unitId") as any; + option.datas = this.unitList; }) } @@ -407,15 +412,17 @@ export default class RiskCard extends BaseRecordComponent { public handleClose() { this.subShowUpdate = false; + //清除附件数据 + this.clearFileListMethod(); } public toggleAll() { - this.tableData.datas.forEach((item, index) => { (this.$refs.multipleTable as any).toggleRowSelection(item); }) } + public selectAll() { if (!this.selectData.length) { this.toggleAll() @@ -468,10 +475,20 @@ export default class RiskCard extends BaseRecordComponent { public triCallback(data) { if (data.value === "cancel") { this.subShowUpdate = false + //清除附件数据 + this.clearFileListMethod(); } else if (data && data.value.indexOf("save") >= 0) { this.doSave(data.value !== "save") } } + /** + * 清除附件数据 + */ + public clearFileListMethod() { + this.fileList = []; + const option = this.subUpdateOptions.find(item => item.key === "resourceId") as any; + option.fileList = []; + } public doSave(goOn?) { // 新增清单 @@ -492,7 +509,8 @@ export default class RiskCard extends BaseRecordComponent { this.subUpdateParams = {} as any this.subShowUpdate = !!goOn; this.getTableData(); - + //清除文件缓存 + this.clearFileListMethod() if (goOn === true) { this.getNumber() } diff --git a/src/views/threecards/safeCard.component.vue b/src/views/threecards/safeCard.component.vue index bdc94d4..7ac439e 100644 --- a/src/views/threecards/safeCard.component.vue +++ b/src/views/threecards/safeCard.component.vue @@ -301,6 +301,8 @@ export default class SafeCard extends BaseRecordComponent { this.subUpdateParams = {} as any; this.subIsReadonly = false; this.fileList = [] as any; + //清除文件缓存 + this.clearFileListMethod() this.getNumber() } } @@ -340,6 +342,8 @@ export default class SafeCard extends BaseRecordComponent { public handleClose() { this.subShowUpdate = false; + //清除文件缓存 + this.clearFileListMethod() } @@ -399,7 +403,9 @@ export default class SafeCard extends BaseRecordComponent { public triCallback(data) { if (data.value === "cancel") { - this.subShowUpdate = false + this.subShowUpdate = false; + //清除文件缓存 + this.clearFileListMethod() } else if (data && data.value.indexOf("save") >= 0) { this.doSave(data.value !== "save") } @@ -427,7 +433,8 @@ export default class SafeCard extends BaseRecordComponent { this.subUpdateParams = {} as any this.subShowUpdate = !!goOn; this.getTableData(); - + //清除文件缓存 + this.clearFileListMethod() if (goOn === true) { this.getNumber() } @@ -512,7 +519,11 @@ export default class SafeCard extends BaseRecordComponent { } } - //下载附件 + /** + * 下载附件 + * @param url 下载url + * @param file 文件信息 + */ public downLoadFile(url, file) { let DownUrl = url; fetch(DownUrl) @@ -535,6 +546,15 @@ export default class SafeCard extends BaseRecordComponent { window.URL.revokeObjectURL(href); // 释放掉blob对象 }); } + + /** + * 清除附件数据 + */ + public clearFileListMethod() { + this.fileList = []; + const option = this.subUpdateOptions.find(item => item.key === "resourceId") as any; + option.fileList = []; + } } diff --git a/src/views/workprogress/common.component.html b/src/views/workprogress/common.component.html index 3bd6f16..d156872 100644 --- a/src/views/workprogress/common.component.html +++ b/src/views/workprogress/common.component.html @@ -52,7 +52,7 @@ - @@ -93,7 +93,7 @@ :before-close="handleTableClose" destroy-on-close> -