faet:修复测试bug

dev
kongyeqing 2023-09-11 09:14:57 +08:00
parent 521b6b409a
commit 969e3d2127
12 changed files with 268 additions and 109 deletions

View File

@ -7,7 +7,9 @@
<div class="sub-title">风险评估</div> <div class="sub-title">风险评估</div>
<FormComponent :options="subRiskOptions" labelWidth="110px" labelAlign="right" :data.sync="analysisUpdateParams" <FormComponent :options="subRiskOptions" labelWidth="110px" labelAlign="right" :data.sync="analysisUpdateParams"
@actionCallback="callback" @change="handleRiskChange" :isReadonly="analyIsReadonly" ref="riskForm"> @actionCallback="callback" @change="handleRiskChange" :isReadonly="analyIsReadonly" ref="riskForm">
<span class="measure-tips">*当评估结果为最高级时必须由公司级管控</span>
</FormComponent> </FormComponent>
<div class="sub-title">管控措施</div> <div class="sub-title">管控措施</div>
<FormComponent labelWidth="110px" labelAlign="right" :data.sync="analysisUpdateParams" <FormComponent labelWidth="110px" labelAlign="right" :data.sync="analysisUpdateParams"
@actionCallback="measureCallback" :isReadonly="analyIsReadonly"> @actionCallback="measureCallback" :isReadonly="analyIsReadonly">
@ -83,7 +85,7 @@
</div> </div>
<el-dialog :close-on-click-modal="false" :title="'管控措施制定'" :visible.sync="subUpdate" width="952px" <el-dialog :close-on-click-modal="false" :title="'管控措施制定'" :visible.sync="subUpdate" width="952px"
:before-close="handleMeasureClose"> :before-close="handleMeasureClose" destroy-on-close>
<MeasureComponent @actionCallback="dataCallback" :data.sync="measuresData" :show.sync="subUpdate" <MeasureComponent @actionCallback="dataCallback" :data.sync="measuresData" :show.sync="subUpdate"
:tabledata.sync="analysisUpdateParams" :isReadonly="measureIsReadonly" :outermostData="updateParams"> :tabledata.sync="analysisUpdateParams" :isReadonly="measureIsReadonly" :outermostData="updateParams">
</MeasureComponent> </MeasureComponent>
@ -298,7 +300,7 @@ export default class AnalEvaluationComponent extends Vue {
type: "select", type: "select",
require: true, require: true,
multiple: true, multiple: true,
width: "calc(50% - 20px)", width: "100%",
datas: this.$store.state.prevention_security_identifier, datas: this.$store.state.prevention_security_identifier,
filterable: true, filterable: true,
showError: false, showError: false,
@ -396,7 +398,7 @@ export default class AnalEvaluationComponent extends Vue {
type: "select", type: "select",
require: true, require: true,
multiple: true, multiple: true,
width: "calc(50% - 20px)", width: "100%",
datas: this.$store.state.prevention_security_identifier, datas: this.$store.state.prevention_security_identifier,
filterable: true, filterable: true,
showError: false, showError: false,
@ -516,6 +518,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
unit: { unit: {
type: "btn", type: "btn",
name: "选择", name: "选择",
@ -530,6 +533,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
unit: { unit: {
type: "btn", type: "btn",
name: "选择", name: "选择",
@ -544,6 +548,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
}, { }, {
name: "风险等级", name: "风险等级",
key: "lsgrade", key: "lsgrade",
@ -551,6 +556,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
datas: this.$store.state.prevention_risk_level datas: this.$store.state.prevention_risk_level
},]; },];
//LEC //LEC
@ -561,6 +567,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
unit: { unit: {
type: "btn", type: "btn",
name: "选择", name: "选择",
@ -575,6 +582,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
unit: { unit: {
type: "btn", type: "btn",
name: "选择", name: "选择",
@ -589,6 +597,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
unit: { unit: {
type: "btn", type: "btn",
name: "选择", name: "选择",
@ -603,6 +612,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
}, { }, {
name: "风险等级", name: "风险等级",
key: "lecgrade", key: "lecgrade",
@ -610,6 +620,7 @@ export default class AnalEvaluationComponent extends Vue {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
datas: this.$store.state.prevention_risk_level 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.deleteIds.push(row.id)
} }
this.analysisUpdateParams.datas.forEach((item, i) => { this.analysisUpdateParams.measures.forEach((item, i) => {
item.index = i + 1 item.index = i + 1
}) })
}).catch(() => { }).catch(() => {
@ -1029,6 +1040,8 @@ export default class AnalEvaluationComponent extends Vue {
let lsdata = this.countLS(this.methodUpdateParams.lslvalue, this.methodUpdateParams.lssvalue) let lsdata = this.countLS(this.methodUpdateParams.lslvalue, this.methodUpdateParams.lssvalue)
this.methodUpdateParams.lsrvalue = lsdata.rvalue this.methodUpdateParams.lsrvalue = lsdata.rvalue
this.methodUpdateParams.lsgrade = lsdata.lsgrade this.methodUpdateParams.lsgrade = lsdata.lsgrade
//
this.clearShowError(this.methodUpdateParams, this.riskLSUpdateOptions)
} else if (this.showRiskValueModal.indexOf('lec') !== -1) { } else if (this.showRiskValueModal.indexOf('lec') !== -1) {
//LEC //LEC
if (this.showRiskValueModal === 'leclvalue') { 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) let lecdata = this.contLEC(this.methodUpdateParams.leclvalue, this.methodUpdateParams.lecevalue, this.methodUpdateParams.leccvalue)
this.methodUpdateParams.lecdvalue = lecdata.dvalue this.methodUpdateParams.lecdvalue = lecdata.dvalue
this.methodUpdateParams.lecgrade = lecdata.lecgrade 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;
}
</style> </style>

View File

@ -100,6 +100,7 @@ export default class MeasureComponent extends Vue {
type: "select", type: "select",
width: "100%", width: "100%",
require: true, require: true,
showError: false,
datas: this.$store.state.prevention_measure_type datas: this.$store.state.prevention_measure_type
}, { }, {
name: "管控措施分类", name: "管控措施分类",
@ -133,7 +134,8 @@ export default class MeasureComponent extends Vue {
key: "description", key: "description",
type: "textarea", type: "textarea",
require: true, require: true,
width: "100%" width: "100%",
showError: false,
}]; }];
} }
@ -273,14 +275,15 @@ export default class MeasureComponent extends Vue {
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
require: true, require: true,
showError: false, showError: false,
pickerOptions: this.getPickerOptions()
},] },]
} }
public subActions = [] as any; public subActions = [] as any;
// //
public taskActions = [] as any; public taskActions = [] as any;
public buildTaskAction(){ public buildTaskAction() {
this.taskActions= [{ this.taskActions = [{
name: "取消", name: "取消",
value: "cancel" value: "cancel"
}, { }, {
@ -320,22 +323,6 @@ export default class MeasureComponent extends Vue {
public updataParams!: any; public updataParams!: any;
@Watch("data", { immediate: true, deep: true }) @Watch("data", { immediate: true, deep: true })
onParamsValueChange() { 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() this.buildActions()
} }
@ -362,9 +349,15 @@ export default class MeasureComponent extends Vue {
created() { created() {
this.buildTable(); 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") { if (item && item.key === "firstType") {
this.updataParams.firstTypeName = this.selectName(this.dictData.measuresSort, data) this.changeFirstTypeMethod(data);
this.secondTypeItem = this.measuresSelectData[data]
} }
// //
if (item && item.key === 'secondType') { if (item && item.key === 'secondType') {
this.updataParams.secondTypeName = this.selectName(this.secondTypeItem, data) 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) { public selectName(selectGroup, data) {
@ -556,20 +566,14 @@ export default class MeasureComponent extends Vue {
public taskSelectChange(data, item) { public taskSelectChange(data, item) {
if (data !== null && data !== undefined) { if (data !== null && data !== undefined) {
if (item && item.key === 'insuranceDutyFlag') { if (item && item.key === 'insuranceDutyFlag') {
this.taskType = this.taskItemSelect() //
if (data === 0) { this.changeInsuranceDutyFlagMethod(data);
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 = "是"
}
} }
if (item && item.key === "taskType") { if (item && item.key === "taskType") {
this.taskItem = this.tasksSelectData[data] 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") { if (item && item.key === "executePostCode") {
@ -599,12 +603,72 @@ export default class MeasureComponent extends Vue {
if (item && item.key === 'executeStartTime') { if (item && item.key === 'executeStartTime') {
const now = moment().format("YYYY-MM-DD HH:mm"); const now = moment().format("YYYY-MM-DD HH:mm");
if (now > data) { if (now > data) {
this.$message.error("开始执行时间不能早于当前时间") this.$message.warning("开始执行时间不能早于当前时间")
this.taskUpdataParams.executeStartTime = null; this.taskUpdataParams.executeStartTime = null;
return 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();
}
}
} }
} }

View File

@ -2,7 +2,7 @@
<div class="common-content-box dis-flex flex-col flex-1"> <div class="common-content-box dis-flex flex-col flex-1">
<div class="search-box"> <div class="search-box">
<FormComponent :options="formOptions" :data.sync="params" @actionCallback="callback" :actions="formActions" <FormComponent :options="formOptions" :data.sync="params" @actionCallback="callback" :actions="formActions"
:full-btn="false" @change="callback($event)" btn-position="end"></FormComponent> :full-btn="false" @change="callback" btn-position="end"></FormComponent>
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"

View File

@ -277,6 +277,7 @@ export default class SelfAssessment extends BaseRecordComponent<any> {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
} as any; } as any;
this.getTableData()
} }
public handleClose() { public handleClose() {
@ -294,7 +295,7 @@ export default class SelfAssessment extends BaseRecordComponent<any> {
this.toggleAll() this.toggleAll()
} else { } else {
this.tableData.datas.forEach((item, index) => { 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) { if (!find) {
(this.$refs.multipleTable as any).toggleRowSelection(item); (this.$refs.multipleTable as any).toggleRowSelection(item);
} }

View File

@ -47,7 +47,7 @@
width="952px" :before-close="handleClose" destroy-on-close> width="952px" :before-close="handleClose" destroy-on-close>
<FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" <FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right"
:data.sync="updateParams" @change="changes" :actions="updateActions" @actionCallback="callback" :data.sync="updateParams" @change="changes" :actions="updateActions" @actionCallback="callback"
:full-btn="true" btnPosition="center"> :full-btn="true" btnPosition="center" ref="basicForm">
<div class="sub-title">检查项目</div> <div class="sub-title">检查项目</div>
<TableComponent :tableData="tableData" :tableColumn="subTableColumn" <TableComponent :tableData="tableData" :tableColumn="subTableColumn"
@actionCallback="projectCallback($event)" :actions="!isReadonly?tableActions:[]" @actionCallback="projectCallback($event)" :actions="!isReadonly?tableActions:[]"
@ -80,7 +80,7 @@
<el-dialog :close-on-click-modal="false" :title="proIsReadonly?'详情':updateProParams.index ?'编辑' :'新增'" <el-dialog :close-on-click-modal="false" :title="proIsReadonly?'详情':updateProParams.index ?'编辑' :'新增'"
:visible.sync="showProject" width="952px" :before-close="handleProClose" destroy-on-close> :visible.sync="showProject" width="952px" :before-close="handleProClose" destroy-on-close>
<FormComponent :options="projectOptions" :isReadonly="proIsReadonly" labelWidth="110px" labelAlign="right" <FormComponent :options="projectOptions" :isReadonly="proIsReadonly" labelWidth="110px" labelAlign="right"
:data.sync="updateProParams" :actions="proIsReadonly ? [] :updateActions" @actionCallback="subCallback" :data.sync="updateProParams" :actions="proIsReadonly ? [] :subUpdateActions" @actionCallback="subCallback"
:full-btn="true" btnPosition="center"> :full-btn="true" btnPosition="center">
</FormComponent> </FormComponent>
</el-dialog> </el-dialog>
@ -98,7 +98,5 @@
</template> </template>
</el-table> </el-table>
</TableComponent> </TableComponent>
</el-dialog> </el-dialog>
</div> </div>

View File

@ -151,6 +151,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
type: "text", type: "text",
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
showError: false,
}, { }, {
name: "设备类型", name: "设备类型",
key: "type", key: "type",
@ -158,6 +159,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
type: "select", type: "select",
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
showError: false,
datas: this.$store.state.prevention_device_type datas: this.$store.state.prevention_device_type
}, { }, {
name: "涉及岗位", name: "涉及岗位",
@ -165,8 +167,9 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
format: "postName", format: "postName",
multiple: true, multiple: true,
require: true, require: true,
showError: false,
type: "select", type: "select",
width: "calc(50% - 20px)", width: "100%",
datas: this.$store.state.postList datas: this.$store.state.postList
}, { }, {
name: "安全因素", name: "安全因素",
@ -217,25 +220,41 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
type: "primary" type: "primary"
}]; }];
} }
public projectOptions: FormOption<BtnOption>[] = [];
public projectOptions: FormOption<BtnOption>[] = [ public subUpdateActions = [] as any;
{ public buildSubActionsForm() {
name: "检查项目", this.projectOptions = [
key: "name", {
type: "textarea", name: "检查项目",
require: true, key: "name",
width: "100%", type: "textarea",
}, require: true,
{ width: "100%",
name: "检查标准", showError: false,
key: "standard", },
type: "textarea", {
require: true, name: "检查标准",
width: "100%", 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 }) @Watch("$store.state.deptList", { immediate: true, deep: true })
onChanges() { onChanges() {
@ -392,7 +411,8 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
items: [], identifyUserId: this.account.userId, items: [], identifyUserId: this.account.userId,
identifyTime: moment().format('YYYY-MM-DD'), identifyTime: moment().format('YYYY-MM-DD'),
} as any; } as any;
this.buildActionsForm() this.buildActionsForm();
this.buildUpdateForm();
this.showUpdate = true this.showUpdate = true
} else if (data && data.value.indexOf("save") >= 0) { } else if (data && data.value.indexOf("save") >= 0) {
this.doSave(data.value !== "save") this.doSave(data.value !== "save")
@ -443,18 +463,20 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} }
public doSave(goOn?) { public doSave(goOn?) {
// if ((this.$refs.basicForm as any).vaildParams()) {
this.updateParams.itemNum = this.updateParams.items.length; //
this.updateParams.postCode = this.updateParams.postCode.join(",") this.updateParams.itemNum = this.updateParams.items.length;
this.updateParams.safetyFactor = this.updateParams.safetyFactor.join(",") this.updateParams.postCode = this.updateParams.postCode.join(",")
this.tableService.addOrUpdate(this.updateParams, this.updateParams.id ? false : true).then((res) => { this.updateParams.safetyFactor = this.updateParams.safetyFactor.join(",")
this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!"); this.tableService.addOrUpdate(this.updateParams, this.updateParams.id ? false : true).then((res) => {
this.updateParams = { this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!");
items: [], this.updateParams = {
} as any items: [],
this.showUpdate = !!goOn; } as any
this.getTableData(); this.showUpdate = !!goOn;
}) this.getTableData();
})
}
} }
public handleClose() { public handleClose() {
@ -463,17 +485,17 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
public toggleAll() { public toggleAll() {
this.tableData.datas.forEach((item, index) => { this.tableData.datas.forEach((item, index) => {
(this.$refs.multipleTable as any).toggleRowSelection(item); (this.$refs.multipleTable as any).toggleRowSelection(item);
}) })
} }
public selectAll() { public selectAll() {
if (!this.selectData.length) { if (!this.selectData.length) {
this.toggleAll() this.toggleAll()
} else { } else {
this.tableData.datas.forEach((item, index) => { 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) { if (!find) {
(this.$refs.multipleTable as any).toggleRowSelection(item); (this.$refs.multipleTable as any).toggleRowSelection(item);
} }
@ -488,7 +510,10 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
// //
public projectCallback(data) { public projectCallback(data) {
if (data && data.value === 'add') { if (data && data.value === 'add') {
this.showProject = true this.proIsReadonly = false;
this.buildSubActionsForm()
this.showProject = true;
} else if (data && data.value === 'delete') { } else if (data && data.value === 'delete') {
// //
this.deleteProData(this.selectData.map((itm: any) => itm.index - 1)) this.deleteProData(this.selectData.map((itm: any) => itm.index - 1))
@ -504,6 +529,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} else { } else {
this.updateProParams = JSON.parse(JSON.stringify(row)); this.updateProParams = JSON.parse(JSON.stringify(row));
} }
this.buildSubActionsForm()
} }
// //
public deleteProData(indexs) { public deleteProData(indexs) {

View File

@ -96,7 +96,7 @@
<el-dialog :close-on-click-modal="false" :title="!stepUpdateParams.id?'新增':'编辑'" :visible.sync="showSubUpdate" <el-dialog :close-on-click-modal="false" :title="!stepUpdateParams.id?'新增':'编辑'" :visible.sync="showSubUpdate"
width="500" :before-close="handleClose" destroy-on-close> width="500" :before-close="handleClose" destroy-on-close>
<FormComponent :options="subUpdateOptions" labelWidth="110px" @change="changes" labelAlign="right" <FormComponent :options="subUpdateOptions" labelWidth="110px" @change="changes" labelAlign="right"
:data.sync="stepUpdateParams" :full-btn="true" btnPosition="center" @actionCallback="callback" :data.sync="stepUpdateParams" :full-btn="true" btnPosition="center" @actionCallback="subCallback"
:actions="subUpdateActions"></FormComponent> :actions="subUpdateActions"></FormComponent>
</el-dialog> </el-dialog>

View File

@ -332,7 +332,8 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
userName: item.chargeUserName, 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<any> {
this.updateParams.chargeUserId = unitData.userId; this.updateParams.chargeUserId = unitData.userId;
this.updateParams.chargeUserName = unitData.userName; this.updateParams.chargeUserName = unitData.userName;
this.updateParams.chargeDeptId = unitData.deptId; this.updateParams.chargeDeptId = unitData.deptId;
const option = this.updateOptions.find(item => item.key === "chargeUserId") as any;
option.showError = false
} }
// //
if (item && item.key === "chargeDeptId") { if (item && item.key === "chargeDeptId") {
@ -428,8 +431,12 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
this.updateParams.postName = data.map(itm => this.$store.getters.post_map[itm]).join(","); 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) { if (type) {
this.params[type] = data; this.params[type] = data;
this.getTableData(); this.getTableData();
@ -463,6 +470,14 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
} }
} }
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?) { public showSubUpdateModel(row?) {
this.stepUpdateParams = {} as any; this.stepUpdateParams = {} as any;
if (row) { if (row) {
@ -485,25 +500,15 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
} }
/**
* 保存数据
* @param goOn
*/
public doSave(goOn?) { public doSave(goOn?) {
if (this.updateParams.steps.length === 0) { if (this.updateParams.steps.length === 0) {
this.$message.warning("请您至少添加一条作业步骤!"); this.$message.warning("请您至少添加一条作业步骤!");
return 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.safetyFactor = this.updateParams.safetyFactor.join(",");
this.updateParams.stepNum = this.updateParams.steps.length; this.updateParams.stepNum = this.updateParams.steps.length;
@ -521,6 +526,20 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
this.getTableData(); 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() { public reset() {
this.params = { this.params = {

View File

@ -166,8 +166,6 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
public riskLevelMap = {} as any; public riskLevelMap = {} as any;
public buildUpdateForm() { public buildUpdateForm() {
console.log(this.updateParams.id && this.updateParams.status !== 1,);
this.updateOptions = [{ this.updateOptions = [{
name: "选择区域", name: "选择区域",
key: "areaId", key: "areaId",

View File

@ -47,7 +47,7 @@
<el-dialog :close-on-click-modal="false" :title="isReadonly?'详情':updateParams.id ?'编辑': '新增'" <el-dialog :close-on-click-modal="false" :title="isReadonly?'详情':updateParams.id ?'编辑': '新增'"
:visible.sync="showUpdate" width="952px" :before-close="handleClose" destroy-on-close> :visible.sync="showUpdate" width="952px" :before-close="handleClose" destroy-on-close>
<FormComponent :options="updateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent :options="updateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
:isReadonly="isReadonly"> :isReadonly="isReadonly" ref="basicForm">
</FormComponent> </FormComponent>
<div class="sub-title">处置步骤</div> <div class="sub-title">处置步骤</div>
<el-form class="step-form" v-if="!isReadonly" ref="setpsOptions" label-width="100px"> <el-form class="step-form" v-if="!isReadonly" ref="setpsOptions" label-width="100px">
@ -85,9 +85,11 @@
</template> </template>
</div> </div>
<FormComponent :options="updateStepsOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent :options="updateStepsOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
:isReadonly="isReadonly" @actionCallback="subCallback" @change="changes" :actions="updateActions" :isReadonly="isReadonly" @actionCallback="subCallback" @change="changes" :actions="[]" :full-btn="true"
:full-btn="true" btnPosition="center"> btnPosition="center" ref="stepForm">
</FormComponent> </FormComponent>
<ButtonListComponent :actions="updateActions" @callback="subCallback" btn-position="center" :full-btn="true">
</ButtonListComponent>
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false" <el-dialog :close-on-click-modal="false"

View File

@ -11,6 +11,7 @@ import BtnOption from "hbt-common/models/btnOptions";
import AreaService from '@/service/area.service'; import AreaService from '@/service/area.service';
import TinyEditor from "@/components/tinyEditor.component.vue"; import TinyEditor from "@/components/tinyEditor.component.vue";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
import ButtonListComponent from "hbt-common/components/common/buttonList.component.vue"
@Component({ @Component({
template, template,
@ -18,6 +19,7 @@ import { Base64 } from 'js-base64';
FormComponent, FormComponent,
TableComponent, TableComponent,
TinyEditor, TinyEditor,
ButtonListComponent
}, },
}) })
export default class EmergencyCard extends BaseRecordComponent<any> { export default class EmergencyCard extends BaseRecordComponent<any> {
@ -58,7 +60,7 @@ export default class EmergencyCard extends BaseRecordComponent<any> {
public subShowUpdate = false; public subShowUpdate = false;
public showFileModal = false; public showFileModal = false;
public showFileList = [] as any; public showFileList = [] as any;
@ -508,6 +510,16 @@ export default class EmergencyCard extends BaseRecordComponent<any> {
public doSave(goOn?) { 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) { if (this.fileList.length > 0) {
let resourceId = this.fileList.map((item) => { let resourceId = this.fileList.map((item) => {
@ -537,6 +549,7 @@ export default class EmergencyCard extends BaseRecordComponent<any> {
this.getNumber() this.getNumber()
} }
}) })
} }
public showModal(row, isReadonly) { public showModal(row, isReadonly) {

View File

@ -180,7 +180,6 @@ export default class SafeCard extends BaseRecordComponent<any> {
showError: false, showError: false,
labelWidth: "130px", labelWidth: "130px",
rules: [ rules: [
{ required: true, message: '请输入手机号' },
{ pattern: /^1[3|5|7|8|9]\d{9}$/, message: '请输入正确的号码格式', } { pattern: /^1[3|5|7|8|9]\d{9}$/, message: '请输入正确的号码格式', }
] ]
}, },