diff --git a/src/components/analEvaluation.component.vue b/src/components/analEvaluation.component.vue index 79f0ca0..7f53ee0 100644 --- a/src/components/analEvaluation.component.vue +++ b/src/components/analEvaluation.component.vue @@ -7,7 +7,9 @@
风险评估
+ *注:当评估结果为最高级时,必须由公司级管控 +
管控措施
@@ -83,7 +85,7 @@ + :before-close="handleMeasureClose" destroy-on-close> @@ -298,7 +300,7 @@ export default class AnalEvaluationComponent extends Vue { type: "select", require: true, multiple: true, - width: "calc(50% - 20px)", + width: "100%", datas: this.$store.state.prevention_security_identifier, filterable: true, showError: false, @@ -396,7 +398,7 @@ export default class AnalEvaluationComponent extends Vue { type: "select", require: true, multiple: true, - width: "calc(50% - 20px)", + width: "100%", datas: this.$store.state.prevention_security_identifier, filterable: true, showError: false, @@ -516,6 +518,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, unit: { type: "btn", name: "选择", @@ -530,6 +533,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, unit: { type: "btn", name: "选择", @@ -544,6 +548,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, }, { name: "风险等级", key: "lsgrade", @@ -551,6 +556,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, datas: this.$store.state.prevention_risk_level },]; //LEC @@ -561,6 +567,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, unit: { type: "btn", name: "选择", @@ -575,6 +582,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, unit: { type: "btn", name: "选择", @@ -589,6 +597,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, unit: { type: "btn", name: "选择", @@ -603,6 +612,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, }, { name: "风险等级", key: "lecgrade", @@ -610,6 +620,7 @@ export default class AnalEvaluationComponent extends Vue { require: true, width: "calc(50% - 20px)", disable: true, + showError: false, datas: this.$store.state.prevention_risk_level },]; @@ -905,7 +916,7 @@ export default class AnalEvaluationComponent extends Vue { } this.analysisUpdateParams.deleteIds.push(row.id) } - this.analysisUpdateParams.datas.forEach((item, i) => { + this.analysisUpdateParams.measures.forEach((item, i) => { item.index = i + 1 }) }).catch(() => { @@ -1029,6 +1040,8 @@ export default class AnalEvaluationComponent extends Vue { let lsdata = this.countLS(this.methodUpdateParams.lslvalue, this.methodUpdateParams.lssvalue) this.methodUpdateParams.lsrvalue = lsdata.rvalue this.methodUpdateParams.lsgrade = lsdata.lsgrade + //清除必填提示 + this.clearShowError(this.methodUpdateParams, this.riskLSUpdateOptions) } else if (this.showRiskValueModal.indexOf('lec') !== -1) { //LEC 计算 if (this.showRiskValueModal === 'leclvalue') { @@ -1041,9 +1054,25 @@ export default class AnalEvaluationComponent extends Vue { let lecdata = this.contLEC(this.methodUpdateParams.leclvalue, this.methodUpdateParams.lecevalue, this.methodUpdateParams.leccvalue) this.methodUpdateParams.lecdvalue = lecdata.dvalue this.methodUpdateParams.lecgrade = lecdata.lecgrade + //清除必填提示 + this.clearShowError(this.methodUpdateParams, this.riskLECUpdateOptions) } - this.showRiskValueUpdate = false + this.showRiskValueUpdate = false; + console.log('methodUpdateParams', this.methodUpdateParams); + } + } + /** + * 清除必填提示 + * @param methodUpdateParams 输入的数据 + * @param updateOPtion 需要清除的form + */ + public clearShowError(methodUpdateParams: any, updateOPtion: any) { + for (let i in methodUpdateParams) { + if (methodUpdateParams[i]) { + const option = updateOPtion.find(item => item.key === i) as any; + option.showError = false + } } } @@ -1227,4 +1256,14 @@ export default class AnalEvaluationComponent extends Vue { } } } + +.measure-tips { + width: 100%; + color: #F56C6C; + margin-left: -100px; + margin-bottom: 20px; + margin-top: -10px; + font-size: 20px; + scale: 0.5; +} \ No newline at end of file diff --git a/src/components/measure.component.vue b/src/components/measure.component.vue index e7c8a8b..e6b9a1e 100644 --- a/src/components/measure.component.vue +++ b/src/components/measure.component.vue @@ -100,6 +100,7 @@ export default class MeasureComponent extends Vue { type: "select", width: "100%", require: true, + showError: false, datas: this.$store.state.prevention_measure_type }, { name: "管控措施分类", @@ -133,7 +134,8 @@ export default class MeasureComponent extends Vue { key: "description", type: "textarea", require: true, - width: "100%" + width: "100%", + showError: false, }]; } @@ -273,14 +275,15 @@ export default class MeasureComponent extends Vue { width: "calc(50% - 20px)", require: true, showError: false, + pickerOptions: this.getPickerOptions() },] } public subActions = [] as any; //排查任务按钮 public taskActions = [] as any; - public buildTaskAction(){ - this.taskActions= [{ + public buildTaskAction() { + this.taskActions = [{ name: "取消", value: "cancel" }, { @@ -320,22 +323,6 @@ export default class MeasureComponent extends Vue { public updataParams!: any; @Watch("data", { immediate: true, deep: true }) onParamsValueChange() { - this.dictData.measuresSort = this.$store.state.prevention_measures_sort.map((item) => { - this.measuresSelectData[item.value] = this.treeSelectData(item.children) - return { - label: item.name, - id: item.value, - } - }) - this.secondTypeItem = this.measuresSelectData[this.updataParams.firstType] - // if (this.updataParams.tasks && this.updataParams.tasks.length > 0) { - // this.updataParams.tasks.forEach((item, index) => { - // item.index = index + 1 - // return item - // }) - // } - this.measuresUpdateForm() - this.taskUpdateForm() this.buildActions() } @@ -362,9 +349,15 @@ export default class MeasureComponent extends Vue { created() { this.buildTable(); - console.log('measureData', this.measureData); - - + this.dictData.measuresSort = this.$store.state.prevention_measures_sort.map((item) => { + this.measuresSelectData[item.value] = this.treeSelectData(item.children) + return { + label: item.name, + id: item.value, + } + }) + this.secondTypeItem = this.measuresSelectData[this.updataParams.firstType] + this.measuresUpdateForm() } @@ -388,14 +381,31 @@ export default class MeasureComponent extends Vue { } //措施一 if (item && item.key === "firstType") { - this.updataParams.firstTypeName = this.selectName(this.dictData.measuresSort, data) - this.secondTypeItem = this.measuresSelectData[data] + this.changeFirstTypeMethod(data); } //措施二 if (item && item.key === 'secondType') { this.updataParams.secondTypeName = this.selectName(this.secondTypeItem, data) } - this.measuresUpdateForm() + //措施描述 + if (item && item.key === 'description') { + const options = this.triUpdateOptions.find(item => item.key === "description") as any; + options.showError = false + } + // this.measuresUpdateForm() + } + /** + * 管控措施类型一 + * @param data 措施一数据 + */ + public changeFirstTypeMethod(data: any) { + this.updataParams.firstTypeName = this.selectName(this.dictData.measuresSort, data); + this.secondTypeItem = this.measuresSelectData[data]; + const option = this.triUpdateOptions.find(item => item.key === "firstType") as any; + option.showError = false; + const suboption = this.triUpdateOptions.find(item => item.key === "secondType") as any; + suboption.datas = this.secondTypeItem; + this.updataParams.secondType = null; } public selectName(selectGroup, data) { @@ -556,20 +566,14 @@ export default class MeasureComponent extends Vue { public taskSelectChange(data, item) { if (data !== null && data !== undefined) { if (item && item.key === 'insuranceDutyFlag') { - this.taskType = this.taskItemSelect() - if (data === 0) { - this.taskUpdataParams.taskType = 0 - this.taskUpdataParams.insuranceDutyFlagName = '否' - this.taskUpdataParams.taskTypeName = '日常任务' - } else if (data === 1) { - this.taskType = this.taskType.filter(item => item.id !== 0) - this.taskUpdataParams.taskType = null - this.taskUpdataParams.insuranceDutyFlagName = "是" - } + //是否是包保责任制履职 + this.changeInsuranceDutyFlagMethod(data); } if (item && item.key === "taskType") { this.taskItem = this.tasksSelectData[data] + const suboptions = this.taskUpdateOptions.find(item => item.key === "taskItem") as any; + suboptions.datas = this.taskItem; } // 岗位 if (item && item.key === "executePostCode") { @@ -599,12 +603,72 @@ export default class MeasureComponent extends Vue { if (item && item.key === 'executeStartTime') { const now = moment().format("YYYY-MM-DD HH:mm"); if (now > data) { - this.$message.error("开始执行时间不能早于当前时间") + this.$message.warning("开始执行时间不能早于当前时间") this.taskUpdataParams.executeStartTime = null; return } } - this.taskUpdateForm() + //开始时间 + if (item && item.key === 'startTime') { + if (data > this.taskUpdataParams.endTime) { + this.$message.warning("结束时间不能早于开始时间!") + this.taskUpdataParams.endTime = null; + return + } + } + //结束时间 + if (item && item.key === 'endTime') { + if (data < this.taskUpdataParams.startTime) { + this.$message.warning("结束时间不能早于开始时间!") + this.taskUpdataParams.endTime = null; + return + } + } + + // this.taskUpdateForm() + } + } + /** + * 是否是包保责任制履职情况改变 + * @param data + */ + public changeInsuranceDutyFlagMethod(data: any) { + this.taskType = this.taskItemSelect(); + const options = this.taskUpdateOptions.find(item => item.key === "taskType") as any; + const suboptions = this.taskUpdateOptions.find(item => item.key === "taskItem") as any; + if (data === 0) { + this.taskUpdataParams.taskType = 0; + this.taskUpdataParams.insuranceDutyFlagName = '否'; + this.taskUpdataParams.taskTypeName = '日常任务'; + options.disable = true; + options.datas = this.taskType; + suboptions.hide = true; + } else if (data === 1) { + this.taskType = this.taskType.filter(item => item.id !== 0); + this.taskUpdataParams.taskType = null; + this.taskUpdataParams.insuranceDutyFlagName = "是"; + options.disable = false; + options.datas = this.taskType; + suboptions.hide = false; + } + } + /** + * 时间选择限制 + * @param start 开始时间 + * @param end 结束时间 + */ + public getPickerOptions(start?, end?) { + if (!start) { + start = new Date(); + } + return { + disabledDate(time) { + if (!end) { + return time.getTime() < moment(start).subtract(1, 'day').toDate().getTime(); + } else { + return time.getTime() < moment(start).subtract(1, 'day').toDate().getTime() || time.getTime() > moment(end).toDate().getTime(); + } + } } } diff --git a/src/views/reward/selfAssessment/selfAssessment.component.html b/src/views/reward/selfAssessment/selfAssessment.component.html index 0f677d1..28c954f 100644 --- a/src/views/reward/selfAssessment/selfAssessment.component.html +++ b/src/views/reward/selfAssessment/selfAssessment.component.html @@ -2,7 +2,7 @@
{ pageNum: 1, pageSize: 20, } as any; + this.getTableData() } public handleClose() { @@ -294,7 +295,7 @@ export default class SelfAssessment extends BaseRecordComponent { this.toggleAll() } else { this.tableData.datas.forEach((item, index) => { - const find = this.selectData.find((data: any) => data.userId === item.userId); + const find = this.selectData.find((data: any) => data.id === item.id); if (!find) { (this.$refs.multipleTable as any).toggleRowSelection(item); } diff --git a/src/views/risk/assessment/device/device.component.html b/src/views/risk/assessment/device/device.component.html index c69ee7f..0c794a8 100644 --- a/src/views/risk/assessment/device/device.component.html +++ b/src/views/risk/assessment/device/device.component.html @@ -47,7 +47,7 @@ width="952px" :before-close="handleClose" destroy-on-close> + :full-btn="true" btnPosition="center" ref="basicForm">
检查项目
@@ -98,7 +98,5 @@ - -
\ No newline at end of file diff --git a/src/views/risk/assessment/device/device.component.vue b/src/views/risk/assessment/device/device.component.vue index 86f1d26..bd3eca2 100644 --- a/src/views/risk/assessment/device/device.component.vue +++ b/src/views/risk/assessment/device/device.component.vue @@ -151,6 +151,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent { type: "text", require: true, width: "calc(50% - 20px)", + showError: false, }, { name: "设备类型", key: "type", @@ -158,6 +159,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent { type: "select", require: true, width: "calc(50% - 20px)", + showError: false, datas: this.$store.state.prevention_device_type }, { name: "涉及岗位", @@ -165,8 +167,9 @@ export default class DeviceManagerComponent extends BaseRecordComponent { format: "postName", multiple: true, require: true, + showError: false, type: "select", - width: "calc(50% - 20px)", + width: "100%", datas: this.$store.state.postList }, { name: "安全因素", @@ -217,25 +220,41 @@ export default class DeviceManagerComponent extends BaseRecordComponent { type: "primary" }]; } - - public projectOptions: FormOption[] = [ - { - name: "检查项目", - key: "name", - type: "textarea", - require: true, - width: "100%", - }, - { - name: "检查标准", - key: "standard", - type: "textarea", - require: true, - width: "100%", - }, - ]; - - + public projectOptions: FormOption[] = []; + public subUpdateActions = [] as any; + public buildSubActionsForm() { + this.projectOptions = [ + { + name: "检查项目", + key: "name", + type: "textarea", + require: true, + width: "100%", + showError: false, + }, + { + name: "检查标准", + key: "standard", + type: "textarea", + require: true, + width: "100%", + showError: false, + }, + ]; + this.subUpdateActions = [{ + name: "取消", + value: "cancel" + }, { + name: "保存并继续添加", + value: "saveAndContinue", + type: "primary", + hide: this.updateProParams.index + }, { + name: "保存", + value: "save", + type: "primary" + }]; + } @Watch("$store.state.deptList", { immediate: true, deep: true }) onChanges() { @@ -392,7 +411,8 @@ export default class DeviceManagerComponent extends BaseRecordComponent { items: [], identifyUserId: this.account.userId, identifyTime: moment().format('YYYY-MM-DD'), } as any; - this.buildActionsForm() + this.buildActionsForm(); + this.buildUpdateForm(); this.showUpdate = true } else if (data && data.value.indexOf("save") >= 0) { this.doSave(data.value !== "save") @@ -443,18 +463,20 @@ export default class DeviceManagerComponent extends BaseRecordComponent { } public doSave(goOn?) { - // 新增 - this.updateParams.itemNum = this.updateParams.items.length; - this.updateParams.postCode = this.updateParams.postCode.join(",") - this.updateParams.safetyFactor = this.updateParams.safetyFactor.join(",") - this.tableService.addOrUpdate(this.updateParams, this.updateParams.id ? false : true).then((res) => { - this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!"); - this.updateParams = { - items: [], - } as any - this.showUpdate = !!goOn; - this.getTableData(); - }) + if ((this.$refs.basicForm as any).vaildParams()) { + // 新增 + this.updateParams.itemNum = this.updateParams.items.length; + this.updateParams.postCode = this.updateParams.postCode.join(",") + this.updateParams.safetyFactor = this.updateParams.safetyFactor.join(",") + this.tableService.addOrUpdate(this.updateParams, this.updateParams.id ? false : true).then((res) => { + this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!"); + this.updateParams = { + items: [], + } as any + this.showUpdate = !!goOn; + this.getTableData(); + }) + } } public handleClose() { @@ -463,17 +485,17 @@ export default class DeviceManagerComponent extends BaseRecordComponent { public toggleAll() { - this.tableData.datas.forEach((item, index) => { (this.$refs.multipleTable as any).toggleRowSelection(item); }) } + public selectAll() { if (!this.selectData.length) { this.toggleAll() } else { this.tableData.datas.forEach((item, index) => { - const find = this.selectData.find((data: any) => data.userId === item.userId); + const find = this.selectData.find((data: any) => data.id === item.id); if (!find) { (this.$refs.multipleTable as any).toggleRowSelection(item); } @@ -488,7 +510,10 @@ export default class DeviceManagerComponent extends BaseRecordComponent { //检查项目 public projectCallback(data) { if (data && data.value === 'add') { - this.showProject = true + this.proIsReadonly = false; + this.buildSubActionsForm() + this.showProject = true; + } else if (data && data.value === 'delete') { // 批量删除步骤 this.deleteProData(this.selectData.map((itm: any) => itm.index - 1)) @@ -504,6 +529,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent { } else { this.updateProParams = JSON.parse(JSON.stringify(row)); } + this.buildSubActionsForm() } //删除 public deleteProData(indexs) { diff --git a/src/views/risk/assessment/work/work.component.html b/src/views/risk/assessment/work/work.component.html index 712f323..4d917da 100644 --- a/src/views/risk/assessment/work/work.component.html +++ b/src/views/risk/assessment/work/work.component.html @@ -96,7 +96,7 @@ diff --git a/src/views/risk/assessment/work/work.component.vue b/src/views/risk/assessment/work/work.component.vue index 7cf91bf..4a5188c 100644 --- a/src/views/risk/assessment/work/work.component.vue +++ b/src/views/risk/assessment/work/work.component.vue @@ -332,7 +332,8 @@ export default class WorkManagerComponent extends BaseRecordComponent { userName: item.chargeUserName, } }); - this.buildUpdateForm() + const option = this.updateOptions.find(item => item.key === "unitId") as any; + option.datas = this.unitList }) } // 树点击 @@ -395,6 +396,8 @@ export default class WorkManagerComponent extends BaseRecordComponent { this.updateParams.chargeUserId = unitData.userId; this.updateParams.chargeUserName = unitData.userName; this.updateParams.chargeDeptId = unitData.deptId; + const option = this.updateOptions.find(item => item.key === "chargeUserId") as any; + option.showError = false } // 部门 if (item && item.key === "chargeDeptId") { @@ -428,8 +431,12 @@ export default class WorkManagerComponent extends BaseRecordComponent { this.updateParams.postName = data.map(itm => this.$store.getters.post_map[itm]).join(","); } } - - public callback(data, type?) { + /** + * 按钮操作函数 + * @param data + * @param type + */ + public callback(data: any, type?) { if (type) { this.params[type] = data; this.getTableData(); @@ -463,6 +470,14 @@ export default class WorkManagerComponent extends BaseRecordComponent { } } + public subCallback(data: any, type: any) { + if (data && data.value.indexOf("save") >= 0) { + this.doSubSave(data.value !== "save") + } else if (data && data.value === "cancel") { + this.handleClose() + } + } + public showSubUpdateModel(row?) { this.stepUpdateParams = {} as any; if (row) { @@ -485,25 +500,15 @@ export default class WorkManagerComponent extends BaseRecordComponent { } - + /** + * 保存数据 + * @param goOn + */ public doSave(goOn?) { if (this.updateParams.steps.length === 0) { this.$message.warning("请您至少添加一条作业步骤!"); return } - // 如果是新增步骤 - if (this.showSubUpdate) { - // 新增 - if (!this.stepUpdateParams.index) { - this.stepUpdateParams.index = this.updateParams.steps.length + 1; - this.updateParams.steps.push(this.stepUpdateParams); - } else { - this.updateParams.steps.splice(this.updateParams.steps.findIndex(item => item.index === this.stepUpdateParams.index), 1, this.stepUpdateParams) - } - this.stepUpdateParams = {} as any; - this.showSubUpdate = !!goOn; - return - } // 新增清单 this.updateParams.safetyFactor = this.updateParams.safetyFactor.join(","); this.updateParams.stepNum = this.updateParams.steps.length; @@ -521,6 +526,20 @@ export default class WorkManagerComponent extends BaseRecordComponent { this.getTableData(); }) } + /** + * 保存步骤数据 + */ + public doSubSave(goOn?) { + if (!this.stepUpdateParams.index) { + this.stepUpdateParams.index = this.updateParams.steps.length + 1; + this.updateParams.steps.push(this.stepUpdateParams); + } else { + this.updateParams.steps.splice(this.updateParams.steps.findIndex(item => item.index === this.stepUpdateParams.index), 1, this.stepUpdateParams) + } + this.stepUpdateParams = {} as any; + this.showSubUpdate = !!goOn; + return + } // 重置数据 public reset() { this.params = { diff --git a/src/views/risk/assessment/work/workAnal.component.vue b/src/views/risk/assessment/work/workAnal.component.vue index 9695d3c..fe8ef89 100644 --- a/src/views/risk/assessment/work/workAnal.component.vue +++ b/src/views/risk/assessment/work/workAnal.component.vue @@ -166,8 +166,6 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { public riskLevelMap = {} as any; public buildUpdateForm() { - console.log(this.updateParams.id && this.updateParams.status !== 1,); - this.updateOptions = [{ name: "选择区域", key: "areaId", diff --git a/src/views/threecards/common.component.html b/src/views/threecards/common.component.html index 6ca0393..c1edcc1 100644 --- a/src/views/threecards/common.component.html +++ b/src/views/threecards/common.component.html @@ -47,7 +47,7 @@ + :isReadonly="isReadonly" ref="basicForm">
处置步骤
@@ -85,9 +85,11 @@
+ :isReadonly="isReadonly" @actionCallback="subCallback" @change="changes" :actions="[]" :full-btn="true" + btnPosition="center" ref="stepForm"> + +
{ @@ -58,7 +60,7 @@ export default class EmergencyCard extends BaseRecordComponent { public subShowUpdate = false; - + public showFileModal = false; public showFileList = [] as any; @@ -508,6 +510,16 @@ export default class EmergencyCard extends BaseRecordComponent { public doSave(goOn?) { + let vaildParams = true + if (!((this.$refs.basicForm as any).vaildParams())) { + vaildParams = false + } + if (!((this.$refs.stepForm as any).vaildParams())) { + vaildParams = false + } + if (vaildParams === false) { + return + } // 新增清单 if (this.fileList.length > 0) { let resourceId = this.fileList.map((item) => { @@ -537,6 +549,7 @@ export default class EmergencyCard extends BaseRecordComponent { this.getNumber() } }) + } public showModal(row, isReadonly) { diff --git a/src/views/threecards/safeCard.component.vue b/src/views/threecards/safeCard.component.vue index 1d65bf5..bdc94d4 100644 --- a/src/views/threecards/safeCard.component.vue +++ b/src/views/threecards/safeCard.component.vue @@ -180,7 +180,6 @@ export default class SafeCard extends BaseRecordComponent { showError: false, labelWidth: "130px", rules: [ - { required: true, message: '请输入手机号' }, { pattern: /^1[3|5|7|8|9]\d{9}$/, message: '请输入正确的号码格式', } ] },