feat:定时任务,JHA,SCL bug修复

wuyanfu
kongyeqing 2023-06-30 17:34:13 +08:00
parent b42a97172f
commit 1462d94ea8
23 changed files with 1736 additions and 818 deletions

View File

@ -11,11 +11,11 @@
<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">
<TableComponent :tableData="currentMeasureData.datas" :tableColumn="triTableColumn" <TableComponent :tableData="analysisUpdateParams.measures" :tableColumn="triTableColumn"
@actionCallback="measureCallback($event)" :actions="analyIsReadonly ? [] : triTableActions" @actionCallback="measureCallback($event)" :actions="analyIsReadonly ? [] : triTableActions"
actionPosition="flex-start" :showFooter="false" style="margin-bottom: 20px;"> actionPosition="flex-start" :showFooter="false" style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="currentMeasureData.datas" tooltip-effect="dark" height="250" border <el-table ref="multipleTable" :data="analysisUpdateParams.measures" tooltip-effect="dark" height="500"
row-key="checked" @selection-change="handleSelectionChange" style="width: 100%"> border row-key="checked" @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40"> <el-table-column type="selection" label="全选" width="40">
</el-table-column> </el-table-column>
<template v-for="item in triTableColumn"> <template v-for="item in triTableColumn">
@ -30,12 +30,12 @@
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showMeasureModel(scope.row, true)">查看</el-button> <el-button type="text" @click="showMeasureModel(scope.row, true)">查看</el-button>
<el-button type="text" @click="showMeasureModel(scope.row)"></el-button> <el-button v-if="!analyIsReadonly" type="text"
<el-button type="text" @click="deleteMeasure(scope.row)"></el-button> @click="showMeasureModel(scope.row)">编辑</el-button>
<el-button v-if="!analyIsReadonly" type="text" @click="deleteMeasure(scope.row)"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</TableComponent> </TableComponent>
</FormComponent> </FormComponent>
<div class="sub-title">残余风险评估</div> <div class="sub-title">残余风险评估</div>
@ -67,7 +67,7 @@
actionPosition="flex-start" :showFooter="false" style="margin-bottom: 20px;" actionPosition="flex-start" :showFooter="false" style="margin-bottom: 20px;"
:data.sync="methodUpdateParams"> :data.sync="methodUpdateParams">
<el-table ref="singleTable" :data="riskTableData" tooltip-effect="dark" border row-key="checked" <el-table ref="singleTable" :data="riskTableData" tooltip-effect="dark" border row-key="checked"
highlight-current-row @current-change="handleCurrentChange" style="width: 100%"> @current-change="handleCurrentChange" style="width: 100%" highlight-current-row>
<template v-for="item in riskTableColumn"> <template v-for="item in riskTableColumn">
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key">
<div slot-scope="scope" style="pointer-events: none;" v-html="item.render(scope.row)"></div> <div slot-scope="scope" style="pointer-events: none;" v-html="item.render(scope.row)"></div>
@ -85,7 +85,7 @@
<el-dialog :close-on-click-modal="false" :title="'管控措施制定'" :visible.sync="subUpdate" width="750px" <el-dialog :close-on-click-modal="false" :title="'管控措施制定'" :visible.sync="subUpdate" width="750px"
:before-close="handleMeasureClose"> :before-close="handleMeasureClose">
<MeasureComponent @actionCallback="dataCallback" :data.sync="measuresData" :show.sync="subUpdate" <MeasureComponent @actionCallback="dataCallback" :data.sync="measuresData" :show.sync="subUpdate"
:tabledata.sync="currentMeasureData" :isReadonly="measureIsReadonly"> :tabledata.sync="analysisUpdateParams" :isReadonly="measureIsReadonly">
</MeasureComponent> </MeasureComponent>
</el-dialog> </el-dialog>
@ -108,6 +108,7 @@ import ButtonListComponent from "hbt-common/components/common/buttonList.compone
import { L_COLUMN, L_VALUE, S_COLUMN, S_VALUE } from '@/mock/lsRisk'; import { L_COLUMN, L_VALUE, S_COLUMN, S_VALUE } from '@/mock/lsRisk';
import { L_LECCOLUMN, L_LECVALUE, E_COLUMN, E_VALUE, C_COLUMN, C_VALUE } from '@/mock/lecRisk'; import { L_LECCOLUMN, L_LECVALUE, E_COLUMN, E_VALUE, C_COLUMN, C_VALUE } from '@/mock/lecRisk';
import MeasureComponent from '@/components/measure.component.vue' import MeasureComponent from '@/components/measure.component.vue'
import moment from 'moment';
@Component({ @Component({
components: { components: {
@ -128,12 +129,10 @@ export default class AnalEvaluationComponent extends Vue {
// datas: [] // datas: []
// } as any; // } as any;
public currentMeasureData = {
datas: [],
deleteIds: [],
} as any;//
public measuresData = {} as any; public measuresData = {} as any;
public dictData = { public dictData = {
riskControlLevel: [], riskControlLevel: [],
identifier: [], identifier: [],
@ -164,12 +163,7 @@ export default class AnalEvaluationComponent extends Vue {
public selectedArrData = []; public selectedArrData = [];
//
public checkRiskType = {
risk: [],
remain: [],
type: null,
} as any;
// //
public methodUpdateParams = { public methodUpdateParams = {
lslvalue: null, lslvalue: null,
@ -190,8 +184,10 @@ export default class AnalEvaluationComponent extends Vue {
@Prop() @Prop()
public isReadonly: boolean; public isReadonly: boolean;
@Prop() @Prop()
public type: any; public type: any;
@Watch("isReadonly", { immediate: true, deep: true }) @Watch("isReadonly", { immediate: true, deep: true })
onCountValueChange() { onCountValueChange() {
this.analyIsReadonly = this.isReadonly this.analyIsReadonly = this.isReadonly
@ -212,11 +208,12 @@ export default class AnalEvaluationComponent extends Vue {
}) })
public updateParams: any; public updateParams: any;
@Prop() @Prop()
public areaList: any; public areaList: any;
@Prop()
//
public checkRiskType = {} as any;
// //
public subBasicOptions: FormOption<BtnOption>[] = []; public subBasicOptions: FormOption<BtnOption>[] = [];
@ -579,22 +576,13 @@ export default class AnalEvaluationComponent extends Vue {
},]; },];
created() { created() {
if (this.analysisUpdateParams.measures && this.analysisUpdateParams.measures.length > 0) {
this.currentMeasureData.datas = this.analysisUpdateParams.measures
this.currentMeasureData.datas.forEach((item, index) => {
item.index = index + 1
return item
})
}
this.$store.state.prevention_measures_sort.map((item) => { this.$store.state.prevention_measures_sort.map((item) => {
this.measuresSelectData[item.value] = this.treeSelectData(item.children) this.measuresSelectData[item.value] = this.treeSelectData(item.children)
}) })
this.subBasicForm() this.subBasicForm()
this.riskUpdateForm() this.riskUpdateForm()
this.remainUpdateForm() this.remainUpdateForm()
this.triTableColumn = []
this.buildTable() this.buildTable()
} }
@ -603,6 +591,7 @@ export default class AnalEvaluationComponent extends Vue {
this.showSubUpdate = false; this.showSubUpdate = false;
this.analyIsReadonly = true; this.analyIsReadonly = true;
} }
public callback(data) { public callback(data) {
// //
@ -638,7 +627,9 @@ export default class AnalEvaluationComponent extends Vue {
this.triTableColumn.push({ name: '管控措施', key: "description" }); this.triTableColumn.push({ name: '管控措施', key: "description" });
this.triTableColumn.push({ this.triTableColumn.push({
name: '排查任务', key: "tasksNum", render: (data) => { name: '排查任务', key: "tasksNum", render: (data) => {
if (data.tasks && data.tasks.length > 0) { if (data.tasksNum) {
return data.tasksNum
} else if (data.tasks && data.tasks.length > 0) {
return data.tasks.length return data.tasks.length
} }
} }
@ -657,7 +648,6 @@ export default class AnalEvaluationComponent extends Vue {
} }
public selectName(selectGroup, data) { public selectName(selectGroup, data) {
if (selectGroup && selectGroup.length > 0) { if (selectGroup && selectGroup.length > 0) {
const map = {}; const map = {};
selectGroup.forEach((item: any) => { selectGroup.forEach((item: any) => {
@ -676,7 +666,9 @@ export default class AnalEvaluationComponent extends Vue {
if (data && data.value === "triSubAdd") { if (data && data.value === "triSubAdd") {
this.subUpdate = true; this.subUpdate = true;
this.measureIsReadonly = false; this.measureIsReadonly = false;
this.measuresData = {}; this.measuresData = {
tasks: []
};
} else if (data && data.value === 'cancel') { } else if (data && data.value === 'cancel') {
this.visible = false; this.visible = false;
} else if (data && data.value.indexOf("save") >= 0) { } else if (data && data.value.indexOf("save") >= 0) {
@ -714,11 +706,35 @@ export default class AnalEvaluationComponent extends Vue {
this.methodUpdateParams = JSON.parse(this.analysisUpdateParams.riskLecValue) this.methodUpdateParams = JSON.parse(this.analysisUpdateParams.riskLecValue)
} }
} }
} else {
let filterdata = this.checkRiskType.risk.filter(subItem => !data.includes(subItem))
if (filterdata.includes('LS')) {
this.riskType = 'ls'
if (this.analysisUpdateParams.riskLsValue) {
this.analysisUpdateParams.riskLsValue = null
this.analysisUpdateParams.riskLsLevel = null
}
if (this.analysisUpdateParams.riskLecValue) {
this.analysisUpdateParams.riskLevel = JSON.parse(this.analysisUpdateParams.riskLecValue).lecgrade
}
} else if (filterdata.includes('LEC')) {
this.riskType = 'lec'
if (this.analysisUpdateParams.riskLecValue) {
this.analysisUpdateParams.riskLecValue = null
this.analysisUpdateParams.riskLecLevel = null
}
if (this.analysisUpdateParams.riskLsValue) {
this.analysisUpdateParams.riskLevel = JSON.parse(this.analysisUpdateParams.riskLsValue).lsgrade
}
}
this.compareRiskLevel()
} }
this.checkRiskType.risk = data this.checkRiskType.risk = data
this.checkRiskType.type = 'risk' this.checkRiskType.type = 'risk'
this.analysisUpdateParams.riskLevel = null
this.compareRiskLevel()
} }
@ -740,29 +756,72 @@ export default class AnalEvaluationComponent extends Vue {
this.methodUpdateParams = JSON.parse(this.analysisUpdateParams.remainLecValue) this.methodUpdateParams = JSON.parse(this.analysisUpdateParams.remainLecValue)
} }
} }
} else {
let filterdata = this.checkRiskType.remain.filter(subItem => !data.includes(subItem))
if (filterdata.includes('LS')) {
this.riskType = 'ls'
if (this.analysisUpdateParams.remainLsValue) {
this.analysisUpdateParams.remainLsValue = null
this.analysisUpdateParams.remainLsLevel = null
}
if (this.analysisUpdateParams.remainLecValue) {
this.analysisUpdateParams.remainLevel = JSON.parse(this.analysisUpdateParams.remainLecValue).lecgrade
}
} else if (filterdata.includes('LEC')) {
this.riskType = 'lec'
if (this.analysisUpdateParams.riskLecValue) {
this.analysisUpdateParams.riskLecValue = null
this.analysisUpdateParams.riskLecLevel = null
}
if (this.analysisUpdateParams.remainLsValue) {
this.analysisUpdateParams.remainLevel = JSON.parse(this.analysisUpdateParams.remainLsValue).lsgrade
}
}
this.compareRiskLevel()
} }
this.checkRiskType.remain = data this.checkRiskType.remain = data
this.checkRiskType.type = 'subRisk' this.checkRiskType.type = 'subRisk'
this.analysisUpdateParams.remainLevel = null
this.compareRiskLevel()
} }
// -- // --
public compareRiskLevel() { public compareRiskLevel() {
const riskChoose = this.analysisUpdateParams.riskChoose const tmpUpdateParams = JSON.parse(JSON.stringify(this.analysisUpdateParams))
const remainChoose = this.analysisUpdateParams.remainChoose const riskChoose = tmpUpdateParams.riskChoose
if (riskChoose.includes('LS')) { const remainChoose = tmpUpdateParams.remainChoose
this.analysisUpdateParams.riskLevel = this.analysisUpdateParams.riskLevel > this.analysisUpdateParams.riskLsLevel ? this.analysisUpdateParams.riskLevel : this.analysisUpdateParams.riskLsLevel if (riskChoose.length === 0) {
this.analysisUpdateParams.riskLevel = null
} else {
if (riskChoose.includes('LS')) {
if (tmpUpdateParams.riskLsLevel) {
this.analysisUpdateParams.riskLevel = tmpUpdateParams.riskLevel > tmpUpdateParams.riskLsLevel ? tmpUpdateParams.riskLevel : tmpUpdateParams.riskLsLevel
}
}
if (riskChoose.includes('LEC')) {
if (tmpUpdateParams.riskLecLevel) {
this.analysisUpdateParams.riskLevel = tmpUpdateParams.riskLevel > tmpUpdateParams.riskLecLevel ? tmpUpdateParams.riskLevel : tmpUpdateParams.riskLecLevel
}
}
} }
if (riskChoose.includes('LEC')) {
this.analysisUpdateParams.riskLevel = this.analysisUpdateParams.riskLevel > this.analysisUpdateParams.riskLecLevel ? this.analysisUpdateParams.riskLevel : this.analysisUpdateParams.riskLecLevel if (remainChoose.length === 0) {
} this.analysisUpdateParams.remainLevel = null
if (remainChoose.includes('LS')) { } else {
this.analysisUpdateParams.remainLevel = this.analysisUpdateParams.remainLevel > this.analysisUpdateParams.remainLsLevel ? this.analysisUpdateParams.remainLevel : this.analysisUpdateParams.remainLsLevel if (remainChoose.includes('LS')) {
} if (tmpUpdateParams.remainLsLevel) {
if (remainChoose.includes('LEC')) { this.analysisUpdateParams.remainLevel = tmpUpdateParams.remainLevel > tmpUpdateParams.remainLsLevel ? tmpUpdateParams.remainLevel : tmpUpdateParams.remainLsLevel
this.analysisUpdateParams.remainLevel = this.analysisUpdateParams.remainLevel > this.analysisUpdateParams.remainLecLevel ? this.analysisUpdateParams.remainLevel : this.analysisUpdateParams.remainLecLevel }
}
if (remainChoose.includes('LEC')) {
if (tmpUpdateParams.remainLecLevel) {
this.analysisUpdateParams.remainLevel = tmpUpdateParams.remainLevel > tmpUpdateParams.remainLecLevel ? tmpUpdateParams.remainLevel : tmpUpdateParams.remainLecLevel
}
}
} }
this.riskUpdateForm() this.riskUpdateForm()
this.remainUpdateForm() this.remainUpdateForm()
} }
@ -781,22 +840,34 @@ export default class AnalEvaluationComponent extends Vue {
this.measuresData.secondTypeName = this.selectName(secondTypeItem, row.secondType) this.measuresData.secondTypeName = this.selectName(secondTypeItem, row.secondType)
} else if (!isReadonly) { } else if (!isReadonly) {
this.measureIsReadonly = false this.measureIsReadonly = false
this.measuresData = row this.measuresData = Object.assign({ tasks: [] }, row)
this.measuresData.tasks.forEach((item, index) => {
item.index = index + 1
return item
})
} }
this.subUpdate = true this.subUpdate = true
} }
// //
public deleteMeasure(row) { public deleteMeasure(row) {
this.currentMeasureData.datas.splice(this.currentMeasureData.datas.findIndex(item => item.index === this.analysisUpdateParams.index), 1) this.$confirm('确认删除所选数据', '确认数据', {
if (row.id) { confirmButtonText: '确定',
if (!this.currentMeasureData.deleteIds) { cancelButtonText: '取消',
this.currentMeasureData.deleteIds = [] type: 'warning'
}).then(() => {
this.analysisUpdateParams.measures.splice(this.analysisUpdateParams.measures.findIndex(item => item.index === row.index), 1)
if (row.id) {
if (!this.analysisUpdateParams.deleteIds) {
this.analysisUpdateParams.deleteIds = []
}
this.analysisUpdateParams.deleteIds.push(row.id)
} }
this.currentMeasureData.deleteIds.push(row.id) this.analysisUpdateParams.datas.forEach((item, i) => {
} item.index = i + 1
this.currentMeasureData.datas.forEach((item, i) => { })
item.index = i + 1 }).catch(() => {
}) //
});
} }
// -- btn // -- btn
@ -813,6 +884,7 @@ export default class AnalEvaluationComponent extends Vue {
} as any;// } as any;//
this.showRiskUpdate = false this.showRiskUpdate = false
if (this.riskType === 'ls') { if (this.riskType === 'ls') {
if (this.checkRiskType.type === 'subRisk') { if (this.checkRiskType.type === 'subRisk') {
this.analysisUpdateParams.remainChoose.splice(this.analysisUpdateParams.remainChoose.findIndex(item => item === 'LS'), 1) this.analysisUpdateParams.remainChoose.splice(this.analysisUpdateParams.remainChoose.findIndex(item => item === 'LS'), 1)
@ -826,6 +898,7 @@ export default class AnalEvaluationComponent extends Vue {
this.analysisUpdateParams.riskChoose.splice(this.analysisUpdateParams.riskChoose.findIndex(item => item === 'LEC'), 1) this.analysisUpdateParams.riskChoose.splice(this.analysisUpdateParams.riskChoose.findIndex(item => item === 'LEC'), 1)
} }
} }
this.compareRiskLevel() this.compareRiskLevel()
} else if (data.value === 'lslvalue') { } else if (data.value === 'lslvalue') {
this.showRiskValueModal = 'lslvalue' this.showRiskValueModal = 'lslvalue'
@ -937,10 +1010,19 @@ export default class AnalEvaluationComponent extends Vue {
// this.isModifyonly = false; // this.isModifyonly = false;
} }
public handleChange(data) { public handleChange(data, item) {
this.subBasicForm() this.subBasicForm()
if (item.key === "reviewStartTime") {
let diff = moment(data).diff(moment().subtract(1, 'day'), "months")
if (diff < 1) {
this.$message.error("请选择 " + moment().add(1, 'month').format('YYYY-MM-DD') + ' 之后的日期');
this.analysisUpdateParams.reviewStartTime = null
return
}
}
} }
// //
public handleCurrentChange(data) { public handleCurrentChange(data) {
this.currentRow = data; this.currentRow = data;
@ -988,12 +1070,16 @@ export default class AnalEvaluationComponent extends Vue {
} else if (data.value === "save") { } else if (data.value === "save") {
const tmpUpdateParams = JSON.parse(JSON.stringify(this.updateParams)) const tmpUpdateParams = JSON.parse(JSON.stringify(this.updateParams))
this.analysisUpdateParams.measures = this.currentMeasureData.datas // this.analysisUpdateParams.measures = this.currentMeasureData.datas
this.analysisUpdateParams.measuresNum = this.currentMeasureData.datas.length this.analysisUpdateParams.measuresNum = this.analysisUpdateParams.measures.length
this.analysisUpdateParams.seriousResult = this.analysisUpdateParams.seriousResult.join(";") this.analysisUpdateParams.seriousResult = this.analysisUpdateParams.seriousResult.join(";")
this.analysisUpdateParams.safetySign = this.analysisUpdateParams.safetySign.join(";") this.analysisUpdateParams.safetySign = this.analysisUpdateParams.safetySign.join(";")
this.analysisUpdateParams.riskChoose = this.analysisUpdateParams.riskChoose.join(";") this.analysisUpdateParams.riskChoose = this.analysisUpdateParams.riskChoose.join(";")
this.analysisUpdateParams.remainChoose = this.analysisUpdateParams.remainChoose.join(";") this.analysisUpdateParams.remainChoose = this.analysisUpdateParams.remainChoose.join(";")
let diff = moment(this.analysisUpdateParams.reviewStartTime).diff(moment().subtract(1, 'day'), "months")
if (diff > 0) {
this.analysisUpdateParams.status = 2
}
if (this.analysisUpdateParams.riskChoose.indexOf('LS') === -1) { if (this.analysisUpdateParams.riskChoose.indexOf('LS') === -1) {
this.analysisUpdateParams.riskLsValue = null this.analysisUpdateParams.riskLsValue = null
} }
@ -1041,4 +1127,31 @@ export default class AnalEvaluationComponent extends Vue {
} }
</script> </script>
<style lang="scss" scoped src="../views/common.component.scss"></style> <style lang="scss" scoped src="../views/common.component.scss"></style>
<style lang="scss" scoped>
::v-deep {
.el-table__body {
tr {
&.current-row {
&>td {
background-color: #68C23A !important;
color: #fff;
}
}
}
}
.el-table--enable-row-hover {
.el-table__body {
tr {
&:hover {
&>td {
cursor: pointer;
}
}
}
}
}
}
</style>

View File

@ -8,7 +8,7 @@
<TableComponent :tableData="updataParams.tasks" :tableColumn="tableColumn" @actionCallback="taskAdd($event)" <TableComponent :tableData="updataParams.tasks" :tableColumn="tableColumn" @actionCallback="taskAdd($event)"
:actions="!isReadonly ? tableActions : []" actionPosition="flex-start" :showFooter="false" :actions="!isReadonly ? tableActions : []" actionPosition="flex-start" :showFooter="false"
style="margin-bottom: 20px;"> style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="updataParams.tasks" tooltip-effect="dark" height="250" border <el-table ref="multipleTable" :data="updataParams.tasks" tooltip-effect="dark" height="500" border
row-key="checked" @selection-change="handleSelectionChange" style="width: 100%"> row-key="checked" @selection-change="handleSelectionChange" style="width: 100%">
<template v-for="item in tableColumn"> <template v-for="item in tableColumn">
<el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name" <el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name"
@ -22,8 +22,8 @@
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showTaskModel(scope.row, true)">查看</el-button> <el-button type="text" @click="showTaskModel(scope.row, true)">查看</el-button>
<el-button :v-if="!isReadonly" type="text" @click="showTaskModel(scope.row)"></el-button> <el-button v-if="!isReadonly" type="text" @click="showTaskModel(scope.row)"></el-button>
<el-button :v-if="!isReadonly" type="text" @click="deleteTask(scope.row)"></el-button> <el-button v-if="!isReadonly" type="text" @click="deleteTask(scope.row)"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -193,7 +193,7 @@ export default class MeasureComponent extends Vue {
key: "taskItem", key: "taskItem",
format: "taskItemName", format: "taskItemName",
type: "treeSelect", type: "treeSelect",
width: "calc(50% - 20px)", width: "100%",
require: true, require: true,
expandLevel: Infinity, expandLevel: Infinity,
showError: false, showError: false,
@ -223,9 +223,9 @@ export default class MeasureComponent extends Vue {
require: true, require: true,
datas: this.$store.state.userList, datas: this.$store.state.userList,
}, { }, {
name: "排查周期", name: "排查周期 每隔",
key: "reviewCycleValue", key: "reviewCycleValue",
type: "text", type: "number",
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
require: true, require: true,
}, { }, {
@ -233,7 +233,14 @@ export default class MeasureComponent extends Vue {
type: "select", type: "select",
require: true, require: true,
format: 'reviewCycleValueName', format: 'reviewCycleValueName',
datas: this.$store.state.prevention_cycle_unit datas: this.$store.state.prevention_cycle_unit,
width: "calc(30% - 20px)",
}, {
name: "1次",
key: "times",
type: 'null',
width: "30px",
labelWidth: "10px"
}, { }, {
name: "工作开始时间", name: "工作开始时间",
key: "startTime", key: "startTime",
@ -272,21 +279,19 @@ export default class MeasureComponent extends Vue {
@Prop() @Prop()
public isReadonly: boolean; public isReadonly: boolean;
@PropSync("show", { @PropSync("show", {
required: true, required: true,
default: true default: true
}) })
public visible: boolean; public visible: boolean;
@PropSync("data", { @PropSync("data", {
required: true, required: true,
}) })
public updataParams!: any; public updataParams!: any;
@PropSync("tabledata", { @Watch("data", { immediate: true, deep: true })
required: true, onParamsValueChange() {
})
public measureData!: any;
created() {
this.dictData.measuresSort = this.$store.state.prevention_measures_sort.map((item) => { this.dictData.measuresSort = this.$store.state.prevention_measures_sort.map((item) => {
this.measuresSelectData[item.value] = this.treeSelectData(item.children) this.measuresSelectData[item.value] = this.treeSelectData(item.children)
return { return {
@ -295,14 +300,23 @@ export default class MeasureComponent extends Vue {
} }
}) })
this.secondTypeItem = this.measuresSelectData[this.updataParams.firstType] this.secondTypeItem = this.measuresSelectData[this.updataParams.firstType]
if (this.updataParams.tasks && this.updataParams.tasks.length > 0) { // if (this.updataParams.tasks && this.updataParams.tasks.length > 0) {
this.updataParams.tasks.forEach((item, index) => { // this.updataParams.tasks.forEach((item, index) => {
item.index = index + 1 // item.index = index + 1
return item // return item
}) // })
} // }
this.measuresUpdateForm() this.measuresUpdateForm()
this.taskUpdateForm() this.taskUpdateForm()
}
@PropSync("tabledata", {
required: true,
})
public measureData!: any;
created() {
this.buildTable() this.buildTable()
} }
@ -451,16 +465,24 @@ export default class MeasureComponent extends Vue {
} }
public deleteTask(row) { public deleteTask(row) {
this.updataParams.tasks.splice(this.updataParams.tasks.findIndex(item => item.index === row.index), 1) this.$confirm('确认删除所选数据', '确认数据', {
if (row.id) { confirmButtonText: '确定',
if (!this.updataParams.deleteIds) { cancelButtonText: '取消',
this.updataParams.deleteIds = [] type: 'warning'
}).then(() => {
this.updataParams.tasks.splice(this.updataParams.tasks.findIndex(item => item.index === row.index), 1)
if (row.id) {
if (!this.updataParams.deleteIds) {
this.updataParams.deleteIds = []
}
this.updataParams.deleteIds.push(row.id)
} }
this.updataParams.deleteIds.push(row.id) this.updataParams.tasks.forEach((item, i) => {
} item.index = i + 1
this.updataParams.tasks.forEach((item, i) => { })
item.index = i + 1 }).catch(() => {
}) //
});
} }
// -- // --
@ -525,19 +547,14 @@ export default class MeasureComponent extends Vue {
this.updataParams.tasks = [] this.updataParams.tasks = []
} }
if (!this.updataParams.index) { if (!this.updataParams.index) {
this.updataParams.index = this.currentMeasureData.datas.length + 1; this.updataParams.index = this.measureData.measures.length + 1;
this.updataParams.tasksNum = this.updataParams.tasks.length this.updataParams.tasksNum = this.updataParams.tasks.length
this.currentMeasureData.datas.push(this.updataParams); this.measureData.measures.push(this.updataParams);
} else { } else {
this.updataParams.tasksNum = this.updataParams.tasks.length this.updataParams.tasksNum = this.updataParams.tasks.length
this.currentMeasureData.datas.splice(this.currentMeasureData.datas.findIndex(item => item.index === this.updataParams.index), 1, this.updataParams) this.measureData.measures.splice(this.measureData.measures.findIndex(item => item.index === this.updataParams.index), 1, this.updataParams)
} }
this.currentMeasureData.datas.forEach((item, i) => {
item.index = i + 1
})
this.updataParams = {} as any; this.updataParams = {} as any;
this.measureData = this.currentMeasureData;
this.visible = !!goOn; this.visible = !!goOn;
} }
// //
@ -548,4 +565,9 @@ export default class MeasureComponent extends Vue {
} }
</script> </script>
<style lang="scss" scoped src="../views/common.component.scss"></style> <style lang="scss" scoped src="../views/common.component.scss"></style>
<style lang="scss" scoped>
::v-deep .vue-treeselect__label {
white-space: break-spaces;
}
</style>

View File

@ -36,4 +36,10 @@ export default class DeviceService extends BaseService<any>{
const url = this.prefix.prevention+'/device/anal/addDraft'; const url = this.prefix.prevention+'/device/anal/addDraft';
return this.post(url,params,{},showLoading) return this.post(url,params,{},showLoading)
} }
//查询设备
public selectDeviceByUnit(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/device/inventory/filter/list';
return this.post(url,params,{},true)
}
} }

View File

@ -6,11 +6,22 @@ export default class DutyService extends BaseService<any>{
super() super()
} }
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{ public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.system+'/user/list'; const url = this.prefix.prevention+'/risk/task/list';
return this.get(url,params,true) return this.get(url,params,true)
} }
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{ public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.system+'/user/list'; const url = this.prefix.system+'/user/list';
return this.deleteBatch(url,params,{},true) return this.deleteBatch(url,params,{},true)
} }
// 更新
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/risk/task';
return this.put(url,params,{},showLoading)
}
public getFileUrls(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.file+'/getSysFiles';
return this.get(url,params,false)
}
} }

View File

@ -38,4 +38,10 @@ export default class JobHazardService extends BaseService<any>{
const url = this.prefix.prevention+'/job/anal/addDraft'; const url = this.prefix.prevention+'/job/anal/addDraft';
return this.post(url,params,{},showLoading) return this.post(url,params,{},showLoading)
} }
//查询作业活动
public selectWorkByUnit(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/job/inventory/filter/list';
return this.post(url,params,{},true)
}
} }

View File

@ -18,4 +18,10 @@ export default class MeasuresReportService extends BaseService<any>{
const url = this.prefix.prevention+'/risk/task/list'; const url = this.prefix.prevention+'/risk/task/list';
return this.get(url,params,true) return this.get(url,params,true)
} }
// 更新
public addOrUpdate(params: any,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/risk/control/batch';
return this.put(url,params,{},showLoading)
}
} }

View File

@ -29,7 +29,9 @@ export default new Vuex.Store({
prevention_measure_type:[], prevention_measure_type:[],
prevention_measures_sort:[], prevention_measures_sort:[],
prevention_task_type:[], prevention_task_type:[],
prevention_evaluate_status:[] prevention_evaluate_status:[],
prevention_task_status:[],
prevention_hazard_category:[]
}, },
getters: { getters: {
dept_map:(state)=>{ dept_map:(state)=>{
@ -200,7 +202,20 @@ export default new Vuex.Store({
}) })
return map return map
}, },
prevention_task_status_map:(state)=>{
const map = {};
state.prevention_task_status.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_hazard_category_map:(state)=>{
const map = {};
state.prevention_hazard_category.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
}, },
mutations: { mutations: {
setAnalCntrol(state,data){ setAnalCntrol(state,data){
@ -279,6 +294,12 @@ export default new Vuex.Store({
set_prevention_evaluate_status(state,data){ set_prevention_evaluate_status(state,data){
state.prevention_evaluate_status = data state.prevention_evaluate_status = data
}, },
set_prevention_task_status(state,data){
state.prevention_task_status = data
},
set_prevention_hazard_category(state,data){
state.prevention_hazard_category = data
},
}, },
actions: { actions: {
}, },

View File

@ -38,6 +38,8 @@ export default class BlankComponent extends Vue {
this.systemService.getDictData("prevention_task_type"), this.systemService.getDictData("prevention_task_type"),
this.systemService.getDictData("prevention_evaluate_status"), this.systemService.getDictData("prevention_evaluate_status"),
this.areaService.getAnalControls(), this.areaService.getAnalControls(),
this.systemService.getDictData("prevention_task_status"),
this.systemService.getDictData("prevention_hazard_category"),
]).then(((results: any) => { ]).then(((results: any) => {
this.$store.commit("setDeptTreeList", results[0].data); this.$store.commit("setDeptTreeList", results[0].data);
this.$store.commit("setUserList", results[2].data.datas.map((item) => { this.$store.commit("setUserList", results[2].data.datas.map((item) => {
@ -185,7 +187,24 @@ export default class BlankComponent extends Vue {
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue, value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue,
} }
})) }))
this.$store.commit("setAnalCntrol",results[24].data) this.$store.commit("setAnalCntrol", results[24].data)
this.$store.commit("set_prevention_task_status", results[25].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue,
}
}))
console.log('results[26]',results[26]);
this.$store.commit("set_prevention_hazard_category", results[26].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue,
}
}))
this.$store.commit("setDeptList", results[1].data.map((item) => { this.$store.commit("setDeptList", results[1].data.map((item) => {
return { return {

View File

@ -248,4 +248,4 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
} }
</script> </script>
<style lang="scss" scoped src="../../../common.component.scss"> <style lang="scss" scoped src="../../../common.component.scss">
</style> </style>

View File

@ -64,7 +64,7 @@
:label="item.name" :width="item.width" :key="item.key"> :label="item.name" :width="item.width" :key="item.key">
</el-table-column> </el-table-column>
</template> </template>
<el-table-column label="操作" width="100" v-if="!isReadonly"> <el-table-column label="操作" width="200" v-if="!isReadonly">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showSubmodal(scope.row,true)">查看</el-button> <el-button type="text" @click="showSubmodal(scope.row,true)">查看</el-button>
<el-button type="text" @click="showSubmodal(scope.row)">修改</el-button> <el-button type="text" @click="showSubmodal(scope.row)">修改</el-button>
@ -97,7 +97,7 @@
</template> </template>
</el-table> </el-table>
</TableComponent> </TableComponent>
</el-dialog> </el-dialog>
</div> </div>

View File

@ -12,6 +12,7 @@ import UnitTreeComponent from '@/components/tree.component.vue';
import DeviceService from '@/service/device.service'; import DeviceService from '@/service/device.service';
import UnitService from '@/service/unit.service'; import UnitService from '@/service/unit.service';
import AreaService from '@/service/area.service'; import AreaService from '@/service/area.service';
import moment from "moment";
@Component({ @Component({
template, template,
@ -43,12 +44,27 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
public subTableColumn = [] as any; public subTableColumn = [] as any;
// //
public showProject = false; public showProject = false;
public account = JSON.parse(localStorage.getItem("account") as any);
public updateProParams = {} as any; public updateProParams = {} as any;
public proIsReadonly = false; public proIsReadonly = false;
public showProtable = false; public showProtable = false;
public currentProTableData = { public currentProTableData = {
datas: [] datas: []
} as any; } as any;
public showUpdate = false;
public updateParams = {
items: [],
identifyUserId: this.account.userId,
identifyTime: moment().format('YYYY-MM-DD'),
} as any;
public selectData = [];
public formActions = [{ public formActions = [{
name: "查询", name: "查询",
value: "search", value: "search",
@ -88,18 +104,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
key: "unitName", key: "unitName",
type: "text", type: "text",
}]; }];
public updateActions = [{
name: "取消",
value: "cancel"
}, {
name: "保存并继续添加",
value: "saveAndContinue",
type: "primary"
}, {
name: "保存",
value: "save",
type: "primary"
}];
public updateOptions: FormOption<BtnOption>[] = [] as any; public updateOptions: FormOption<BtnOption>[] = [] as any;
public buildUpdateForm() { public buildUpdateForm() {
@ -196,6 +201,23 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
] ]
} }
public updateActions = [] as any;
public buildActionsForm(){
this.updateActions = [{
name: "取消",
value: "cancel"
}, {
name: "保存并继续添加",
value: "saveAndContinue",
type: "primary",
hide:this.updateParams.id
}, {
name: "保存",
value: "save",
type: "primary"
}];
}
public projectOptions: FormOption<BtnOption>[] = [ public projectOptions: FormOption<BtnOption>[] = [
{ {
name: "检查项目", name: "检查项目",
@ -214,11 +236,6 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
]; ];
public showUpdate = false;
public updateParams = {
items: [],
} as any;
public selectData = [];
@Watch("$store.state.deptList", { immediate: true, deep: true }) @Watch("$store.state.deptList", { immediate: true, deep: true })
onChanges() { onChanges() {
@ -248,7 +265,11 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
this.unitList = res.data.datas.map(item => { this.unitList = res.data.datas.map(item => {
return { return {
name: item.name, name: item.name,
value: item.id value: item.id,
deptId: item.chargeDeptId,
userId: item.chargeUserId,
deptName: item.chargeDeptName,
userName: item.chargeUserName,
} }
}); });
this.buildUpdateForm() this.buildUpdateForm()
@ -262,7 +283,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
if (data.areaId) { if (data.areaId) {
this.params.unitName = data.name this.params.unitName = data.name
} else { } else {
this.params.areaName = data.name==="全部"?"":data.name this.params.areaName = data.name === "全部" ? "" : data.name
} }
this.getTableData() this.getTableData()
} }
@ -309,6 +330,15 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} }
public changes(data, item) { public changes(data, item) {
//
if (item && item.key === 'unitId') {
const unitData = this.unitList.find((itm: any) => itm.value === data) as any;
this.updateParams.chargeDeptName = unitData.deptName;
this.updateParams.chargeUserId = unitData.userId;
this.updateParams.chargeUserName = unitData.userName;
this.updateParams.chargeDeptId = unitData.deptId;
}
// //
if (item && item.key === "chargeDeptId") { if (item && item.key === "chargeDeptId") {
this.updateParams.chargeDeptName = this.$store.getters.dept_map[data]; this.updateParams.chargeDeptName = this.$store.getters.dept_map[data];
@ -348,7 +378,11 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} else if (data.value === "add") { } else if (data.value === "add") {
this.isReadonly = false; this.isReadonly = false;
this.currentId = -1; this.currentId = -1;
this.updateParams = { items: [], } as any; this.updateParams = {
items: [], identifyUserId: this.account.userId,
identifyTime: moment().format('YYYY-MM-DD'),
} as any;
this.buildActionsForm()
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")
@ -388,6 +422,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
item.index = i + 1 item.index = i + 1
}) })
this.buildUpdateForm() this.buildUpdateForm()
this.buildActionsForm()
this.showUpdate = true; this.showUpdate = true;
}) })
} }

View File

@ -53,7 +53,7 @@
<TableComponent :tableData="currentStepTableData" :tableColumn="subTableColumn" <TableComponent :tableData="currentStepTableData" :tableColumn="subTableColumn"
@actionCallback="callback($event)" :actions="isReadonly? []:subTableActions" actionPosition="flex-start" @actionCallback="callback($event)" :actions="isReadonly? []:subTableActions" actionPosition="flex-start"
:showFooter="false" style="margin-bottom: 20px;"> :showFooter="false" style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="updateParams.items" tooltip-effect="dark" height="250" border <el-table ref="multipleTable" :data="updateParams.items" tooltip-effect="dark" height="500" border
row-key="checked" @selection-change="handleSubSelectionChange" style="width: 100%"> row-key="checked" @selection-change="handleSubSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40"> <el-table-column type="selection" label="全选" width="40">
</el-table-column> </el-table-column>
@ -84,15 +84,15 @@
</FormComponent> </FormComponent>
</el-dialog> </el-dialog>
<!-- 评估矩阵 --> <!-- 评估矩阵 -->
<el-dialog :close-on-click-modal="false" :visible.sync="showMatrixModal" :title="'区域风险等级判定准则'"> <el-dialog :close-on-click-modal="false" width="600px" :visible.sync="showMatrixModal" :title="'区域风险等级判定准则'">
<img style="width:100%" src="../../../../assets/images/5.png" alt=""> <img style="width:90%" src="../../../../assets/images/5.png" alt="">
</el-dialog> </el-dialog>
<!-- 评价 --> <!-- 评价 -->
<el-dialog :close-on-click-modal="false" :visible.sync="showSubUpdate" width="880px" <el-dialog :close-on-click-modal="false" :visible.sync="showSubUpdate" width="880px"
:before-close="handleAnalyClose"> :before-close="handleAnalyClose">
<AnalEvaluationComponent :isReadonly="analyIsReadonly" :data.sync="analysisUpdateParams" <AnalEvaluationComponent :isReadonly="analyIsReadonly" :data.sync="analysisUpdateParams"
:show.sync="showSubUpdate" @actionCallback="analyCallback" :tabledata.sync="updateParams" :show.sync="showSubUpdate" @actionCallback="analyCallback" :tabledata.sync="updateParams"
:areaList="areaList" :type="'device'"></AnalEvaluationComponent> :areaList="areaList" :type="'device'" :checkRiskType="checkRiskType" ></AnalEvaluationComponent>
</el-dialog> </el-dialog>
<!-- 检查项目 --> <!-- 检查项目 -->
<el-dialog :close-on-click-modal="false" title="检查项目" :show-close="false" :visible.sync="showProtable" <el-dialog :close-on-click-modal="false" title="检查项目" :show-close="false" :visible.sync="showProtable"

View File

@ -43,7 +43,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
public treeData = [] as any; public treeData = [] as any;
public areaList = []; public areaList = [] as any;
public unitList = []; public unitList = [];
public diviceList = []; public diviceList = [];
public isReadonly = false; public isReadonly = false;
@ -99,6 +99,14 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
datas: [] datas: []
} as any; } as any;
//
public checkRiskType = {
risk: [],
remain: [],
type: null,
} as any;
public formActions = [{ public formActions = [{
name: "查询", name: "查询",
value: "search", value: "search",
@ -129,22 +137,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
name: "反向选择", name: "反向选择",
value: "reverse" value: "reverse"
}]; }];
public updateActions = [{
name: "取消",
value: "cancel"
}, {
name: '存草稿',
value: 'addDraft',
type: "primay"
}, {
name: "保存并继续添加",
value: "saveAndContinue",
type: "primary"
}, {
name: "保存",
value: "save",
type: "primary"
}];
public formOptions: FormOption<BtnOption>[] = [{ public formOptions: FormOption<BtnOption>[] = [{
name: "区域名称", name: "区域名称",
key: "areaName", key: "areaName",
@ -254,6 +247,16 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
require: true, require: true,
showError: false, showError: false,
format: "yyyy-MM-dd" format: "yyyy-MM-dd"
}, {
name: "区域固有风险等级",
key: "analRiskLevel",
format: "analRiskLevelName",
require: true,
width: "calc(50% - 20px)",
type: "select",
showError: false,
disable: true,
datas: this.$store.state.prevention_risk_level
}, { }, {
name: "是否为两大一重", name: "是否为两大一重",
key: "majorSign", key: "majorSign",
@ -265,7 +268,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
}, { }, {
name: "重大危险源", name: "重大危险源",
key: "majorHazard", key: "majorHazard",
hide: !this.updateParams.majorSign.includes(1) || this.updateParams.majorSign.includes(0), hide: !this.updateParams.majorSign || this.updateParams.majorSign.length === 0 || (!this.updateParams.majorSign.includes(1) || this.updateParams.majorSign.includes(0)),
type: "select", type: "select",
format: "majorHazardName", format: "majorHazardName",
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
@ -277,7 +280,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
name: "重点监管工艺", name: "重点监管工艺",
key: "regulatoryProcess", key: "regulatoryProcess",
format: "regulatoryProcessName", format: "regulatoryProcessName",
hide: !this.updateParams.majorSign.includes(2) || this.updateParams.majorSign.includes(0), hide: !this.updateParams.majorSign || this.updateParams.majorSign.length === 0 || !this.updateParams.majorSign.includes(2) || this.updateParams.majorSign.includes(0),
type: "select", type: "select",
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
require: true, require: true,
@ -287,7 +290,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
name: "重点监管化学品", name: "重点监管化学品",
key: "regulatoryChemical", key: "regulatoryChemical",
format: "regulatoryChemicalName", format: "regulatoryChemicalName",
hide: !this.updateParams.majorSign.includes(3) || this.updateParams.majorSign.includes(0), hide: !this.updateParams.majorSign || this.updateParams.majorSign.length === 0 || !this.updateParams.majorSign.includes(3) || this.updateParams.majorSign.includes(0),
type: "select", type: "select",
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
require: true, require: true,
@ -327,6 +330,29 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
}] }]
} }
public updateActions = [] as any;
public buildActionsForm() {
this.updateActions = [{
name: "取消",
value: "cancel"
}, {
name: '存草稿',
value: 'addDraft',
type: "primay",
hide: !this.updateParams.status || this.updateParams.status === 1 ? false : true
}, {
name: "保存并继续添加",
value: "saveAndContinue",
type: "primary",
hide: this.updateParams.id ? true : false
}, {
name: "保存",
value: "save",
type: "primary"
}];
}
@Watch("$store.state.deptList", { immediate: true, deep: true }) @Watch("$store.state.deptList", { immediate: true, deep: true })
onChanges() { onChanges() {
this.loadAreaData() this.loadAreaData()
@ -378,7 +404,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
return { return {
name: item.name, name: item.name,
value: item.id, value: item.id,
analRiskLevel: item.analRiskLevel ? item.analRiskLevel : 0, analRiskLevel: item.analRiskLevel ? item.analRiskLevel : null,
} }
}); });
this.buildUpdateForm() this.buildUpdateForm()
@ -407,10 +433,9 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
if (data.areaId) { if (data.areaId) {
this.params.unitName = data.name this.params.unitName = data.name
} else { } else {
this.params.areaName = data.name==="全部"?"":data.name this.params.areaName = data.name === "全部" ? "" : data.name
} }
this.getTableData() this.getTableData()
} }
public buildTable() { public buildTable() {
@ -451,21 +476,48 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '状态', key: "status", render: (data) => { name: '状态', key: "status", render: (data) => {
if (data.status) { let tmpstatus: any = data.status
return "<span class='color_" + data.status + "'>" + (data.status ? (this.$store.getters.prevention_evaluate_status_map[data.status]) : '') + "</span>" if (data.status === 1) {
tmpstatus = 2
} else if (data.status === 2) {
tmpstatus = 1
} }
if (data.status) {
return "<span class='color_" + tmpstatus + "'>" + (data.status ? (this.$store.getters.prevention_evaluate_status_map[data.status]) : '') + "</span>"
}
},
filters: this.$store.state.prevention_evaluate_status.map(item => {
return {
text: item.name,
value: item.value,
}
}), filterMethod: (data, row) => {
return row.status === data;
} }
}); });
// //
this.subTableColumn.push({ name: '序号', key: "index" }); this.subTableColumn.push({ name: '序号', key: "index", with: "50px" });
this.subTableColumn.push({
name: '状态', key: "status", render: (data) => {
if (data.status && data.status !== 1) {
let tmpstatus: any = data.status
if (data.status === 2) {
tmpstatus = 1
}
if (data.status) {
return "<span class='color_" + tmpstatus + "'>" + (data.status ? (this.$store.getters.prevention_evaluate_status_map[data.status]) : '') + "</span>"
}
}
}
});
this.subTableColumn.push({ name: '检查项目', key: "itemName" }); this.subTableColumn.push({ name: '检查项目', key: "itemName" });
this.subTableColumn.push({ name: '检查标准', key: "itemStandard", showTip: true, width: "200px" }); this.subTableColumn.push({ name: '检查标准', key: "itemStandard", showTip: true, width: "100px" });
this.subTableColumn.push({ name: '风险源', key: "riskSource" }); this.subTableColumn.push({ name: '风险源', key: "riskSource" });
this.subTableColumn.push({ name: '危害分析', key: "hazardAnalysis" }); this.subTableColumn.push({ name: '危害分析', key: "hazardAnalysis" });
this.subTableColumn.push({ this.subTableColumn.push({
name: '最严重后果', key: "seriousResult", width: "200px", render: (data) => { name: '最严重后果', key: "seriousResult", width: "100px", render: (data) => {
if (data.seriousResult) { if (data.seriousResult) {
return data.seriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";") return data.seriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";")
} }
@ -480,7 +532,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
}); });
this.subTableColumn.push({ name: '评估方法', key: "riskChoose", }); this.subTableColumn.push({ name: '评估方法', key: "riskChoose", });
this.subTableColumn.push({ this.subTableColumn.push({
name: '残余风险等级', key: "remainLevel", width: "200px", render: (data) => { name: '残余风险等级', key: "remainLevel", width: "120px", render: (data) => {
if (data.remainLevel) { if (data.remainLevel) {
return this.$store.getters.prevention_risk_level_map[data.remainLevel] return this.$store.getters.prevention_risk_level_map[data.remainLevel]
} }
@ -545,7 +597,10 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.deleteData(this.selectData.map((item: any) => item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} else if (data.value === "add") { } else if (data.value === "add") {
this.isReadonly = false; this.isReadonly = false;
this.isModifyonly = false;
this.showUpdate = true this.showUpdate = true
this.diviceList = []
this.unitList = []
this.updateParams = { this.updateParams = {
majorSign: [], majorSign: [],
items: [], items: [],
@ -553,6 +608,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
evaluateUserId: this.account.userId, evaluateUserId: this.account.userId,
evaluateUserName: this.account.nickName, evaluateUserName: this.account.nickName,
} as any } as any
this.buildActionsForm()
} else if (data.value === "cancel") { } else if (data.value === "cancel") {
this.handleClose() this.handleClose()
} else if (data.value === "estimateMatrix") { } else if (data.value === "estimateMatrix") {
@ -565,18 +621,27 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.isReadonly = false; this.isReadonly = false;
} else if (data && data.value === "subDelete") { } else if (data && data.value === "subDelete") {
if (this.subSelectData.length > 0) { if (this.subSelectData.length > 0) {
if (!this.updateParams.deleteIds) {
this.updateParams.deleteIds = [] this.$confirm('确认删除所选数据', '确认数据', {
} confirmButtonText: '确定',
this.subSelectData.map((itemData: any) => { cancelButtonText: '取消',
this.updateParams.deleteIds.push(itemData.id) type: 'warning'
this.updateParams.items.splice(this.updateParams.items.findIndex(item => item.index === itemData.index), 1) }).then(() => {
}) if (!this.updateParams.deleteIds) {
this.updateParams.items.forEach((item, index) => { this.updateParams.deleteIds = []
item.index = index + 1 }
return item this.subSelectData.map((itemData: any) => {
}) this.updateParams.deleteIds.push(itemData.id)
this.updateParams.itemNum = this.updateParams.items.length this.updateParams.items.splice(this.updateParams.items.findIndex(item => item.index === itemData.index), 1)
})
this.updateParams.items.forEach((item, index) => {
item.index = index + 1
return item
})
this.updateParams.itemNum = this.updateParams.items.length
}).catch(() => {
//
});
} }
} }
} }
@ -598,7 +663,6 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
const areaData = this.areaList.find((itm: any) => itm.value === data) as any; const areaData = this.areaList.find((itm: any) => itm.value === data) as any;
this.updateParams.analRiskLevel = areaData.analRiskLevel this.updateParams.analRiskLevel = areaData.analRiskLevel
this.updateParams.analRiskLevel = areaData.analRiskLevel
this.updateParams.chargeDeptName = null; this.updateParams.chargeDeptName = null;
this.updateParams.chargeUserId = null; this.updateParams.chargeUserId = null;
this.updateParams.chargeUserName = null; this.updateParams.chargeUserName = null;
@ -652,17 +716,23 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
} }
// //
if (item && item.key === 'majorSign') { if (item && item.key === 'majorSign') {
if (!data) {
data = []
}
if (data.includes(0)) { if (data.includes(0)) {
data.splice(0, data.length) if (data.length.length > 0) {
data.splice(0, data.length)
}
data.push(0) data.push(0)
} }
this.buildUpdateForm() this.buildUpdateForm()
} }
} }
// //
public loadJobData(id?) { public loadJobData(unitId) {
this.diviceService.selectByPage({ pageSize: 1000, unitId: id }).then((res: any) => { this.tableService.selectDeviceByUnit({ unitId: unitId, id: this.updateParams.id ? this.updateParams.id : null }).then((res: any) => {
this.diviceList = res.data.datas.map(item => { this.diviceList = res.data.map(item => {
return { return {
name: item.name, name: item.name,
value: item.id, value: item.id,
@ -695,6 +765,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
// //
public showUpdateModel(row, isReadonly, isModifyonly) { public showUpdateModel(row, isReadonly, isModifyonly) {
this.updateParams = { number: null, tableItems: [] } as any; this.updateParams = { number: null, tableItems: [] } as any;
if (!row) { if (!row) {
this.currentId = -1; this.currentId = -1;
this.showUpdate = true; this.showUpdate = true;
@ -702,6 +773,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.currentId = row.id; this.currentId = row.id;
this.tableService.selectById(this.currentId).then((res: any) => { this.tableService.selectById(this.currentId).then((res: any) => {
if (isReadonly) { if (isReadonly) {
const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel']
this.updateParams = Object.assign({ this.updateParams = Object.assign({
majorHazardName: !res.data.majorHazard ? null : res.data.majorHazard.split(";").map(item => this.sourceMap[item]).join(";"), majorHazardName: !res.data.majorHazard ? null : res.data.majorHazard.split(";").map(item => this.sourceMap[item]).join(";"),
regulatoryProcessName: !res.data.regulatoryProcess ? null : res.data.regulatoryProcess.split(";").map(item => this.craftMap[item]).join(";"), regulatoryProcessName: !res.data.regulatoryProcess ? null : res.data.regulatoryProcess.split(";").map(item => this.craftMap[item]).join(";"),
@ -709,9 +781,10 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
majorSignName: !res.data.majorSign ? null : res.data.majorSign.split(";").map(item => this.$store.getters.prevention_majorsign_map[item]).join(";"), majorSignName: !res.data.majorSign ? null : res.data.majorSign.split(";").map(item => this.$store.getters.prevention_majorsign_map[item]).join(";"),
riskLevelName: this.$store.getters.prevention_risk_level_map[res.data.riskLevel], riskLevelName: this.$store.getters.prevention_risk_level_map[res.data.riskLevel],
remainRiskLevelName: this.$store.getters.prevention_risk_level_map[res.data.remainRiskLevel], remainRiskLevelName: this.$store.getters.prevention_risk_level_map[res.data.remainRiskLevel],
typeName: this.$store.getters.prevention_device_type_map[res.data.type] typeName: this.$store.getters.prevention_device_type_map[res.data.type],
analRiskLevelName: this.$store.getters.prevention_risk_level_map[areaAnalRiskLevel]
}, res.data) }, res.data)
this.updateParams.majorSign = this.stringChangeArray(res.data.majorSign) this.updateParams.majorSign = res.data.majorSign ? this.stringChangeArray(res.data.majorSign) : null
this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard) this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard)
this.updateParams.regulatoryProcess = this.stringChangeArray(res.data.regulatoryProcess) this.updateParams.regulatoryProcess = this.stringChangeArray(res.data.regulatoryProcess)
this.updateParams.regulatoryChemical = this.stringChangeArray(res.data.regulatoryChemical) this.updateParams.regulatoryChemical = this.stringChangeArray(res.data.regulatoryChemical)
@ -724,11 +797,13 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.isReadonly = false this.isReadonly = false
this.isModifyonly = true this.isModifyonly = true
this.updateParams = res.data; this.updateParams = res.data;
this.updateParams.majorSign = this.stringChangeArray(res.data.majorSign) this.updateParams.majorSign = res.data.majorSign ? this.stringChangeArray(res.data.majorSign) : []
this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard) this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard)
this.updateParams.regulatoryProcess = this.stringChangeArray(res.data.regulatoryProcess) this.updateParams.regulatoryProcess = this.stringChangeArray(res.data.regulatoryProcess)
this.updateParams.regulatoryChemical = this.stringChangeArray(res.data.regulatoryChemical) this.updateParams.regulatoryChemical = this.stringChangeArray(res.data.regulatoryChemical)
this.loadUnitData(res.data.areas) const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel']
this.updateParams.analRiskLevel = areaAnalRiskLevel
this.loadUnitData(res.data.areaId)
this.loadJobData(res.data.unitId) this.loadJobData(res.data.unitId)
this.updateParams.items.forEach((item, i) => { this.updateParams.items.forEach((item, i) => {
item.index = i + 1 item.index = i + 1
@ -736,6 +811,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
} }
this.buildUpdateForm() this.buildUpdateForm()
this.buildActionsForm()
this.showUpdate = true; this.showUpdate = true;
}) })
} }
@ -761,7 +837,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.updateParams.itemNum = this.updateParams.items.length this.updateParams.itemNum = this.updateParams.items.length
} }
} }
this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id ? true : false).then((res) => { this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id || this.updateParams.status === 1 ? true : false).then((res) => {
this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!"); this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!");
this.showUpdate = !!goOn; this.showUpdate = !!goOn;
this.getTableData(); this.getTableData();
@ -816,20 +892,25 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.analysisUpdateParams = { this.analysisUpdateParams = {
riskChoose: [], riskChoose: [],
remainChoose: [], remainChoose: [],
measures: [],
} as any; } as any;
if (row) { if (row) {
if (isReadonly) { if (isReadonly) {
this.analyIsReadonly = true; this.analyIsReadonly = true;
this.analysisUpdateParams = Object.assign({ this.analysisUpdateParams = Object.assign({
seriousResultName: row.seriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";"), seriousResultName: !row.seriousResult ? null : row.seriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";"),
safetySignName: row.safetySign.split(";").map(item => this.$store.getters.prevention_security_identifier_map[item]).join(";"), safetySignName: !row.safetySign ? null : row.safetySign.split(";").map(item => this.$store.getters.prevention_security_identifier_map[item]).join(";"),
riskLevelName: this.$store.getters.prevention_risk_level_map[row.riskLevel], riskLevelName: this.$store.getters.prevention_risk_level_map[row.riskLevel],
remainLevelName: this.$store.getters.prevention_risk_level_map[row.remainLevel], remainLevelName: this.$store.getters.prevention_risk_level_map[row.remainLevel],
riskControlLevelName: this.$store.getters.prevention_control_level_map[row.riskControlLevel], riskControlLevelName: this.$store.getters.prevention_control_level_map[row.riskControlLevel],
typeName: this.$store.getters.prevention_device_type_map[row.deviceType] typeName: this.$store.getters.prevention_device_type_map[row.deviceType]
}, row) }, row)
this.analysisUpdateParams = { ...this.analysisUpdateParams, ...JSON.parse(JSON.stringify(row)) }; this.analysisUpdateParams = { ...this.analysisUpdateParams, ...JSON.parse(JSON.stringify(row)) };
console.log('this.analysisUpdateParams', this.analysisUpdateParams);
this.analysisUpdateParams.measures.forEach((item, index) => {
item.index = index + 1
return item
})
} else { } else {
this.analyIsReadonly = false this.analyIsReadonly = false
// //
@ -841,6 +922,14 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.analysisUpdateParams.chargeUserName = this.updateParams.chargeUserName this.analysisUpdateParams.chargeUserName = this.updateParams.chargeUserName
this.analysisUpdateParams.deviceName = this.updateParams.name this.analysisUpdateParams.deviceName = this.updateParams.name
this.analysisUpdateParams.deviceType = this.updateParams.type this.analysisUpdateParams.deviceType = this.updateParams.type
this.checkRiskType.risk = this.analysisUpdateParams.riskChoose
this.checkRiskType.remain = this.analysisUpdateParams.remainChoose
this.analysisUpdateParams.measures.forEach((item, index) => {
item.index = index + 1
return item
})
} }
} }
this.showSubUpdate = true this.showSubUpdate = true

View File

@ -12,9 +12,11 @@ import UnitTreeComponent from '@/components/tree.component.vue';
import WorkService from '@/service/work.service'; import WorkService from '@/service/work.service';
import UnitService from '@/service/unit.service'; import UnitService from '@/service/unit.service';
import AreaService from '@/service/area.service'; import AreaService from '@/service/area.service';
import moment from "moment";
@Component({ @Component({
template, template,
components:{ components: {
FormComponent, FormComponent,
TableComponent, TableComponent,
DrawComponent, DrawComponent,
@ -27,16 +29,16 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
public areaService = new AreaService() public areaService = new AreaService()
public params = { public params = {
areaName:"", areaName: "",
unitName:"", unitName: "",
name:"" name: ""
} as any; } as any;
public subTableColumn = [] as any; public subTableColumn = [] as any;
public currentStepTableData = { public currentStepTableData = {
datas:[] datas: []
} as any; } as any;
public stepUpdateParams = {} as any; public stepUpdateParams = {} as any;
@ -46,52 +48,59 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
public treeData = [] as any; public treeData = [] as any;
public formActions = [{ public formActions = [{
name:"查询", name: "查询",
value:"search", value: "search",
icon:"el-icon-search", icon: "el-icon-search",
type:"primary" type: "primary"
},{ }, {
name:"清空", name: "清空",
icon:"el-icon-tickets", icon: "el-icon-tickets",
value:"reset" value: "reset"
}]; }];
public tableActions = [{ public tableActions = [{
name:"添加", name: "添加",
value:"add", value: "add",
icon:"el-icon-plus", icon: "el-icon-plus",
type:"primary" type: "primary"
},{ }, {
name:"批量删除", name: "批量删除",
value:"delete", value: "delete",
plain:true, plain: true,
icon:"el-icon-delete", icon: "el-icon-delete",
type:"danger" type: "danger"
}]; }];
public subTableActions:BtnOption[] = []; public subTableActions: BtnOption[] = [];
public footerActions = [{ public footerActions = [{
name:"选择全部", name: "选择全部",
value:"selectAll", value: "selectAll",
type:"primary" type: "primary"
},{ }, {
name:"反向选择", name: "反向选择",
value:"reverse" value: "reverse"
}]; }];
public formOptions:FormOption<BtnOption>[] = [{ public formOptions: FormOption<BtnOption>[] = [{
name:"区域名称", name: "区域名称",
key:"areaName", key: "areaName",
type:"text", type: "text",
},{ }, {
name:"单元名称", name: "单元名称",
key:"unitName", key: "unitName",
type:"text", type: "text",
},{ }, {
name:"作业活动", name: "作业活动",
key:"name", key: "name",
type:"text", type: "text",
}]; }];
public showUpdate = false; public showUpdate = false;
public updateParams = {} as any;
public account = JSON.parse(localStorage.getItem("account") as any);
public updateParams = {
identifyTime: moment().format('YYYY-MM-DD'),
identifyUserId: this.account.userId,
} as any;
public selectData = []; public selectData = [];
public areaList = []; public areaList = [];
@ -100,402 +109,419 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
public isReadonly = false; public isReadonly = false;
public updateOptions:FormOption<BtnOption>[] = []; public updateOptions: FormOption<BtnOption>[] = [];
public updateActions = [{ public updateActions = [{
name:"取消", name: "取消",
value:"cancel" value: "cancel"
},{ }, {
name:"保存并继续添加", name: "保存并继续添加",
value:"saveAndContinue", value: "saveAndContinue",
type:"primary" type: "primary"
},{ }, {
name:"保存", name: "保存",
value:"save", value: "save",
type:"primary" type: "primary"
}]; }];
public showSubUpdate = false; public showSubUpdate = false;
public showSteptable = false; public showSteptable = false;
public subUpdateOptions:FormOption<BtnOption>[] = []; public subUpdateOptions: FormOption<BtnOption>[] = [];
@Watch("$store.state.deptList",{immediate:true,deep:true}) @Watch("$store.state.deptList", { immediate: true, deep: true })
onChanges(){ onChanges() {
this.loadAreaData() this.loadAreaData()
} }
created(){ created() {
} }
public buildUpdateForm(){ public buildUpdateForm() {
this.updateOptions=[{ this.updateOptions = [{
name:"选择区域", name: "选择区域",
key:"areaId", key: "areaId",
type:"select", type: "select",
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
format:"areaName", format: "areaName",
showError:false, showError: false,
datas:this.areaList datas: this.areaList
},{ }, {
name:"选择单元", name: "选择单元",
key:"unitId", key: "unitId",
type:"select", type: "select",
format:"unitName", format: "unitName",
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
showError:false, showError: false,
datas:this.unitList datas: this.unitList
},{ }, {
name:"责任部门", name: "责任部门",
key:"chargeDeptId", key: "chargeDeptId",
format:"chargeDeptName", format: "chargeDeptName",
type:"treeSelect", type: "treeSelect",
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
expandLevel:Infinity, expandLevel: Infinity,
showError:false, showError: false,
datas:this.$store.state.deptTreeList datas: this.$store.state.deptTreeList
},{ }, {
name:"责任人", name: "责任人",
key:"chargeUserId", key: "chargeUserId",
format:"chargeUserName", format: "chargeUserName",
type:"select", type: "select",
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
showError:false, showError: false,
datas:this.$store.state.userList datas: this.$store.state.userList
},{ }, {
name:"作业名称", name: "作业名称",
key:"name", key: "name",
type:"text", type: "text",
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
showError:false, showError: false,
},{ }, {
name:"作业地点", name: "作业地点",
key:"location", key: "location",
type:"text", type: "text",
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
showError:false, showError: false,
},{ }, {
showError:false, showError: false,
name:"涉及岗位", name: "涉及岗位",
key:"postCode", key: "postCode",
format:"postName", format: "postName",
type:"select", type: "select",
multiple:true, multiple: true,
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
datas:this.$store.state.postList datas: this.$store.state.postList
},{ }, {
name:"安全因素", name: "安全因素",
key:"safetyFactor", key: "safetyFactor",
format:"safetyFactorName", format: "safetyFactorName",
type:"select", type: "select",
multiple:true, multiple: true,
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
showError:false, showError: false,
datas:this.$store.state.prevention_safe_reason datas: this.$store.state.prevention_safe_reason
},{ }, {
name:"辨识人", name: "辨识人",
key:"identifyUserId", key: "identifyUserId",
format:"identifyUserName", format: "identifyUserName",
type:"select", type: "select",
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
showError:false, showError: false,
datas:this.$store.state.userList datas: this.$store.state.userList
},{ }, {
name:"辨识时间", name: "辨识时间",
key:"identifyTime", key: "identifyTime",
type:"date", type: "date",
subType:"date", subType: "date",
width:"calc(50% - 20px)", width: "calc(50% - 20px)",
require:true, require: true,
showError:false, showError: false,
format:"yyyy-MM-dd" format: "yyyy-MM-dd"
}]; }];
this.subTableActions = [{ this.subTableActions = [{
name:"添加", name: "添加",
value:"subAdd", value: "subAdd",
icon:"el-icon-plus", icon: "el-icon-plus",
hide:this.isReadonly, hide: this.isReadonly,
type:"primary" type: "primary"
},{ }, {
name:"批量删除", name: "批量删除",
value:"subDelete", value: "subDelete",
plain:true, plain: true,
hide:this.isReadonly, hide: this.isReadonly,
icon:"el-icon-delete", icon: "el-icon-delete",
type:"danger" type: "danger"
}]; }];
this.subUpdateOptions=[{ this.subUpdateOptions = [{
name:"步骤名称", name: "步骤名称",
key:"name", key: "name",
type:"text", type: "text",
width:"100%", width: "100%",
require:true, require: true,
showError:false, showError: false,
},{ }, {
name:"作业步骤描述", name: "作业步骤描述",
key:"description", key: "description",
type:"textarea", type: "textarea",
width:"100%", width: "100%",
require:true, require: true,
showError:false, showError: false,
},{ }, {
name:"作业地点", name: "作业地点",
key:"location", key: "location",
type:"text", type: "text",
width:"100%", width: "100%",
require:true, require: true,
showError:false, showError: false,
},{ }, {
name:"责任人", name: "责任人",
key:"chargeUserId", key: "chargeUserId",
type:"select", type: "select",
width:"100%", width: "100%",
require:true, require: true,
showError:false, showError: false,
datas:this.$store.state.userList datas: this.$store.state.userList
},{ }, {
name:"作业人", name: "作业人",
key:"workerId", key: "workerId",
type:"select", type: "select",
width:"100%", width: "100%",
require:true, require: true,
showError:false, showError: false,
datas:this.$store.state.userList datas: this.$store.state.userList
}] }]
} }
// //
public loadAreaData(){ public loadAreaData() {
this.areaService.selectByPage({pageSize:1000}).then((res:any)=>{ this.areaService.selectByPage({ pageSize: 1000 }).then((res: any) => {
this.areaList = res.data.datas.map(item=>{ this.areaList = res.data.datas.map(item => {
return { return {
name:item.name, name: item.name,
value:item.id value: item.id
} }
}); });
this.buildUpdateForm() this.buildUpdateForm()
}) })
} }
// //
public loadUnitData(id?){ public loadUnitData(id?) {
this.unitService.selectByPage({pageSize:1000,areaId:id},false).then((res:any)=>{ this.unitService.selectByPage({ pageSize: 1000, areaId: id }, false).then((res: any) => {
this.unitList = res.data.datas.map(item=>{ this.unitList = res.data.datas.map(item => {
return { return {
name:item.name, name: item.name,
value:item.id value: item.id,
deptId: item.chargeDeptId,
userId: item.chargeUserId,
deptName: item.chargeDeptName,
userName: item.chargeUserName,
} }
}); });
this.buildUpdateForm() this.buildUpdateForm()
}) })
} }
// //
public handleNodeClick(data){ public handleNodeClick(data) {
this.params.unitName=""; this.params.unitName = "";
this.params.areaName=""; this.params.areaName = "";
if(data.areaId){ if (data.areaId) {
this.params.unitName = data.name this.params.unitName = data.name
}else{ } else {
this.params.areaName = data.name==="全部"?"":data.name this.params.areaName = data.name === "全部" ? "" : data.name
} }
this.getTableData() this.getTableData()
} }
public buildTable(){ public buildTable() {
this.tableColumn.push({name:'区域名称',key:"areaName",width:"200px"}); this.tableColumn.push({ name: '区域名称', key: "areaName", width: "200px" });
this.tableColumn.push({name:'风险分析单元',key:"unitName",width:"200px"}); this.tableColumn.push({ name: '风险分析单元', key: "unitName", width: "200px" });
this.tableColumn.push({name:'作业活动',key:"name",showTip:true}); this.tableColumn.push({ name: '作业活动', key: "name", showTip: true });
this.tableColumn.push({name:'作业步骤',key:"stepNum",render:(data)=>{ this.tableColumn.push({
return "<span class='link'>"+(data.stepNum?data.stepNum:0)+"</span>" name: '作业步骤', key: "stepNum", render: (data) => {
}}); return "<span class='link'>" + (data.stepNum ? data.stepNum : 0) + "</span>"
this.tableColumn.push({name:'责任部门',key:"chargeDeptName"}); }
this.tableColumn.push({name:'责任人',key:"chargeUserName"}); });
this.tableColumn.push({name:'作业地点',key:"location",showTip:true}); this.tableColumn.push({ name: '责任部门', key: "chargeDeptName" });
this.tableColumn.push({name:'涉及岗位',key:"postName",width:"200px",showTip:true}); this.tableColumn.push({ name: '责任人', key: "chargeUserName" });
this.tableColumn.push({ name: '作业地点', key: "location", showTip: true });
this.tableColumn.push({ name: '涉及岗位', key: "postName", width: "200px", showTip: true });
this.subTableColumn.push({name:'序号',key:"index",width:"60"}); this.subTableColumn.push({ name: '序号', key: "index", width: "60" });
this.subTableColumn.push({name:'步骤名称',key:"name"}); this.subTableColumn.push({ name: '步骤名称', key: "name" });
this.subTableColumn.push({name:'作业步骤描述',key:"description",showTip:true,}); this.subTableColumn.push({ name: '作业步骤描述', key: "description", showTip: true, });
this.subTableColumn.push({name:'作业地点',key:"location",showTip:true}); this.subTableColumn.push({ name: '作业地点', key: "location", showTip: true });
this.subTableColumn.push({name:'责任人',key:"chargeUserName"}); this.subTableColumn.push({ name: '责任人', key: "chargeUserName" });
this.subTableColumn.push({name:'作业人',key:"workerName"}); this.subTableColumn.push({ name: '作业人', key: "workerName" });
} }
public showSteps(el,data){ public showSteps(el, data) {
const isTarget = el.target.classList.contains("link"); const isTarget = el.target.classList.contains("link");
if(isTarget){ if (isTarget) {
this.showSteptable = true; this.showSteptable = true;
this.currentStepTableData.datas = data.steps.map((item,index)=>{ this.currentStepTableData.datas = data.steps.map((item, index) => {
item.index=index+1; item.index = index + 1;
return item return item
}) })
} }
} }
public changes(data,item){ public changes(data, item) {
//
if (item && item.key === 'unitId') {
const unitData = this.unitList.find((itm: any) => itm.value === data) as any;
this.updateParams.chargeDeptName = unitData.deptName;
this.updateParams.chargeUserId = unitData.userId;
this.updateParams.chargeUserName = unitData.userName;
this.updateParams.chargeDeptId = unitData.deptId;
}
// //
if(item && item.key === "chargeDeptId"){ if (item && item.key === "chargeDeptId") {
this.updateParams.chargeDeptName = this.$store.getters.dept_map[data]; this.updateParams.chargeDeptName = this.$store.getters.dept_map[data];
} }
// //
if(item && item.key === "chargeUserId"){ if (item && item.key === "chargeUserId") {
if(this.showSubUpdate){ if (this.showSubUpdate) {
this.stepUpdateParams.chargeUserName = this.$store.getters.user_map[data]; this.stepUpdateParams.chargeUserName = this.$store.getters.user_map[data];
return return
} }
this.updateParams.chargeUserName = this.$store.getters.user_map[data]; this.updateParams.chargeUserName = this.$store.getters.user_map[data];
} }
// //
if(item && item.key === "workerId"){ if (item && item.key === "workerId") {
this.stepUpdateParams.workerName = this.$store.getters.user_map[data]; this.stepUpdateParams.workerName = this.$store.getters.user_map[data];
} }
// //
if(item && item.key === "identifyUserId"){ if (item && item.key === "identifyUserId") {
this.updateParams.identifyUserName = this.$store.getters.user_map[data]; this.updateParams.identifyUserName = this.$store.getters.user_map[data];
} }
// //
if(item && item.key==="areaId"){ if (item && item.key === "areaId") {
if(this.updateParams.unitId){ if (this.updateParams.unitId) {
this.updateParams.unitId = null; this.updateParams.unitId = null;
} }
this.loadUnitData(data) this.loadUnitData(data)
} }
// //
if(item && item.key==="postCode"){ if (item && item.key === "postCode") {
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?){ public callback(data, type?) {
if(type){ if (type) {
this.params[type] = data; this.params[type] = data;
this.getTableData(); this.getTableData();
return return
} }
// //
if(data && data.value==="search"){ if (data && data.value === "search") {
this.getTableData() this.getTableData()
// //
}else if(data && data.value === "reset"){ } else if (data && data.value === "reset") {
this.reset() this.reset()
// //
}else if(data && data.value === "reverse"){ } else if (data && data.value === "reverse") {
this.toggleAll() this.toggleAll()
// //
}else if(data && data.value === "selectAll"){ } else if (data && data.value === "selectAll") {
this.selectAll() this.selectAll()
}else if(data && data.value === "add"){ } else if (data && data.value === "add") {
this.showUpdateModel(); this.showUpdateModel();
}else if(data && data.value === "delete"){ } else if (data && data.value === "delete") {
this.deleteData(this.selectData.map((itm:any)=>itm.id)) this.deleteData(this.selectData.map((itm: any) => itm.id))
}else if(data && data.value === "subAdd"){ } else if (data && data.value === "subAdd") {
this.showSubUpdateModel() this.showSubUpdateModel()
}else if(data && data.value === "subDelete"){ } else if (data && data.value === "subDelete") {
// //
this.doSubDelete(this.selectData.map((itm:any)=>itm.index - 1)) this.doSubDelete(this.selectData.map((itm: any) => itm.index - 1))
}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")
}else if(data && data.value === "cancel"){ } else if (data && data.value === "cancel") {
this.handleClose() this.handleClose()
} }
} }
public showSubUpdateModel(row?){ public showSubUpdateModel(row?) {
this.stepUpdateParams = {} as any; this.stepUpdateParams = {} as any;
if(row){ if (row) {
this.stepUpdateParams = JSON.parse(JSON.stringify(row)); this.stepUpdateParams = JSON.parse(JSON.stringify(row));
} }
this.showSubUpdate = true; this.showSubUpdate = true;
} }
public doSubDelete(indexs){ public doSubDelete(indexs) {
for(let i = this.updateParams.steps.length-1;i>=0;i--){ for (let i = this.updateParams.steps.length - 1; i >= 0; i--) {
if(indexs.includes(i)){ if (indexs.includes(i)) {
this.updateParams.steps.splice(i,1) this.updateParams.steps.splice(i, 1)
} }
} }
this.updateParams.steps.forEach((item,index)=>{ this.updateParams.steps.forEach((item, index) => {
item.index = index+1; item.index = index + 1;
}); });
} }
public doSave(goOn?){ public doSave(goOn?) {
// //
if(this.showSubUpdate){ if (this.showSubUpdate) {
// //
if(!this.stepUpdateParams.index){ if (!this.stepUpdateParams.index) {
this.stepUpdateParams.index = this.updateParams.steps.length+1; this.stepUpdateParams.index = this.updateParams.steps.length + 1;
this.updateParams.steps.push(this.stepUpdateParams); this.updateParams.steps.push(this.stepUpdateParams);
}else{ } else {
this.updateParams.steps.splice(this.updateParams.steps.findIndex(item=>item.index ===this.stepUpdateParams.index),1,this.stepUpdateParams) this.updateParams.steps.splice(this.updateParams.steps.findIndex(item => item.index === this.stepUpdateParams.index), 1, this.stepUpdateParams)
} }
this.stepUpdateParams = {} as any; this.stepUpdateParams = {} as any;
this.showSubUpdate=!!goOn; this.showSubUpdate = !!goOn;
return 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;
this.updateParams.postCode = this.updateParams.postCode.join(";") this.updateParams.postCode = this.updateParams.postCode.join(";")
this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{ this.tableService.addOrUpdate(this.updateParams, this.currentId === -1).then((res) => {
this.$message.success(this.currentId===-1?"新增成功!":"编辑成功!"); this.$message.success(this.currentId === -1 ? "新增成功!" : "编辑成功!");
this.updateParams = { this.updateParams = {
postCode:[], postCode: [],
safetyFactor:[] safetyFactor: []
} as any } as any
this.showUpdate = !!goOn; this.showUpdate = !!goOn;
this.getTableData(); this.getTableData();
}) })
} }
// //
public reset(){ public reset() {
this.params = { this.params = {
areaName:"", areaName: "",
unitName:"", unitName: "",
name:"", name: "",
pageNum:1, pageNum: 1,
pageSize:20, pageSize: 20,
} as any; } as any;
} }
public showUpdateModel(row?,isRead?){ public showUpdateModel(row?, isRead?) {
this.isReadonly = !!isRead; this.isReadonly = !!isRead;
if(!row){ if (!row) {
this.currentId = -1; this.currentId = -1;
this.updateParams = {steps:[]} as any; this.updateParams = {
}else{ steps: [], identifyTime: moment().format('YYYY-MM-DD'),
identifyUserId: this.account.userId,
} as any;
} else {
this.currentId = row.id; this.currentId = row.id;
this.updateParams = JSON.parse(JSON.stringify(row)); this.updateParams = JSON.parse(JSON.stringify(row));
if(!this.updateParams.steps){ if (!this.updateParams.steps) {
this.updateParams.steps = []; this.updateParams.steps = [];
} }
this.updateParams.steps.forEach((item,index)=>{ this.updateParams.steps.forEach((item, index) => {
item.index = index+1; item.index = index + 1;
}); });
this.currentStepTableData.datas = this.updateParams.steps; this.currentStepTableData.datas = this.updateParams.steps;
if(!isRead){ if (!isRead) {
this.updateParams.postCode = this.updateParams.postCode.split(";").map(item=>+item); this.updateParams.postCode = this.updateParams.postCode.split(";").map(item => +item);
this.updateParams.safetyFactor = this.updateParams.safetyFactor.split(",").map(item=>+item); this.updateParams.safetyFactor = this.updateParams.safetyFactor.split(",").map(item => +item);
}else{ } else {
this.updateParams.safetyFactor = this.updateParams.safetyFactor.split(",").map(item=>+item); this.updateParams.safetyFactor = this.updateParams.safetyFactor.split(",").map(item => +item);
this.updateParams.safetyFactorName = this.updateParams.safetyFactor.map(item=>this.$store.getters.prevention_safe_reason_map[item]).join(",") this.updateParams.safetyFactorName = this.updateParams.safetyFactor.map(item => this.$store.getters.prevention_safe_reason_map[item]).join(",")
this.buildUpdateForm() this.buildUpdateForm()
} }
} }
@ -504,8 +530,8 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
this.showUpdate = true this.showUpdate = true
} }
public handleClose(){ public handleClose() {
if(this.showSubUpdate){ if (this.showSubUpdate) {
this.showSubUpdate = false; this.showSubUpdate = false;
this.stepUpdateParams = {} as any; this.stepUpdateParams = {} as any;
return return
@ -519,27 +545,27 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
public toggleAll() { public toggleAll() {
(this.$refs.multipleTable as any).toggleAllSelection(); (this.$refs.multipleTable as any).toggleAllSelection();
} }
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.userId === item.userId);
if(!find){ if (!find) {
(this.$refs.multipleTable as any).toggleRowSelection(item); (this.$refs.multipleTable as any).toggleRowSelection(item);
} }
}) })
} }
} }
public handleSelectionChange(data){ public handleSelectionChange(data) {
this.selectData = data; this.selectData = data;
} }
} }
</script> </script>
<style lang="scss" scoped src="../../../common.component.scss"> <style lang="scss" scoped src="../../../common.component.scss">
::v-deep{ ::v-deep {
.el-dialog__body .common-btn-box{ .el-dialog__body .common-btn-box {
justify-content: flex-start !important; justify-content: flex-start !important;
} }
} }

View File

@ -54,7 +54,7 @@
@actionCallback="callback($event)" :actions="isReadonly? []:subTableActions" actionPosition="flex-start" @actionCallback="callback($event)" :actions="isReadonly? []:subTableActions" actionPosition="flex-start"
:showFooter="false" style="margin-bottom: 20px;"> :showFooter="false" style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="updateParams.steps" tooltip-effect="dark" height="250" border <el-table ref="multipleTable" :data="updateParams.steps" tooltip-effect="dark" height="500" border
row-key="checked" @selection-change="handleSubSelectionChange" style="width: 100%"> row-key="checked" @selection-change="handleSubSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40"> <el-table-column type="selection" label="全选" width="40">
</el-table-column> </el-table-column>
@ -70,10 +70,10 @@
</template> </template>
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="isReadonly" type="text" <el-button v-if="isReadonly || isModifyonly" type="text"
@click="showSubModel(scope.row,isReadonly)">查看</el-button> @click="showSubModel(scope.row,isReadonly)">查看</el-button>
<el-button v-if="isModifyonly" type="text" @click="showSubModel(scope.row)">修改</el-button> <el-button v-if="isModifyonly" type="text" @click="showSubModel(scope.row)">修改</el-button>
<el-button v-if="!isReadonly" type="text" @click="showSubModel(scope.row)">评价</el-button> <el-button v-if="!isReadonly && !isModifyonly" type="text" @click="showSubModel(scope.row)">评价</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -86,18 +86,18 @@
</el-dialog> </el-dialog>
<!-- 评估矩阵 --> <!-- 评估矩阵 -->
<el-dialog :close-on-click-modal="false" :visible.sync="showMatrixModal" width="500px" :title="'区域风险等级判定准则'"> <el-dialog :close-on-click-modal="false" :visible.sync="showMatrixModal" width="600px" :title="'区域风险等级判定准则'">
<img style="width:100%" src="../../../../assets/images/5.png" alt=""> <img style="width:90%" src="../../../../assets/images/5.png" alt="">
</el-dialog> </el-dialog>
<!-- 危害分析评价 --> <!-- 危害分析评价 -->
<el-dialog :close-on-click-modal="false" :visible.sync="showSubUpdate" width="880px" <el-dialog :close-on-click-modal="false" :visible.sync="showSubUpdate" width="880px"
:before-close="handleAnalyClose"> :before-close="handleAnalyClose">
<AnalEvaluationComponent :isReadonly="analyIsReadonly" :data.sync="analysisUpdateParams" <AnalEvaluationComponent :isReadonly="analyIsReadonly" :data.sync="analysisUpdateParams"
:show.sync="showSubUpdate" @actionCallback="analyCallback" :tabledata.sync="updateParams" :show.sync="showSubUpdate" @actionCallback="analyCallback" :tabledata.sync="updateParams"
:areaList="areaList" :type="'work'"></AnalEvaluationComponent> :areaList="areaList" :type="'work'" :checkRiskType="checkRiskType"></AnalEvaluationComponent>
</el-dialog> </el-dialog>
<!-- 检查项目 --> <!-- 检查项目 -->
<el-dialog :close-on-click-modal="false" title="检查项目" :show-close="false" :visible.sync="showProtable" <el-dialog :close-on-click-modal="false" title="作业步骤" :show-close="false" :visible.sync="showProtable"
width="940px"> width="940px">
<FormComponent labelWidth="110px" labelAlign="right" :actions="proActions" @actionCallback="proCallback" <FormComponent labelWidth="110px" labelAlign="right" :actions="proActions" @actionCallback="proCallback"
:full-btn="true" btnPosition="center"> :full-btn="true" btnPosition="center">

View File

@ -16,7 +16,7 @@ import AreaService from '@/service/area.service';
import SystemService from "hbt-common/service/system.service" import SystemService from "hbt-common/service/system.service"
import JobHazardService from '@/service/jobHazard.service'; import JobHazardService from '@/service/jobHazard.service';
import ButtonListComponent from "hbt-common/components/common/buttonList.component.vue"; import ButtonListComponent from "hbt-common/components/common/buttonList.component.vue";
import moment from "moment" import moment from "moment";
@Component({ @Component({
template, template,
@ -44,7 +44,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
public treeData = [] as any; public treeData = [] as any;
public areaList = []; public areaList = [] as any;
public unitList = []; public unitList = [];
public jobList = []; public jobList = [];
public isReadonly = false; public isReadonly = false;
@ -100,6 +100,14 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
datas: [] datas: []
} as any; } as any;
//
public checkRiskType = {
risk: [],
remain: [],
type: null,
} as any;
public formActions = [{ public formActions = [{
name: "查询", name: "查询",
value: "search", value: "search",
@ -130,22 +138,6 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
name: "反向选择", name: "反向选择",
value: "reverse" value: "reverse"
}]; }];
public updateActions = [{
name: "取消",
value: "cancel"
}, {
name: '存草稿',
value: 'addDraft',
type: "primay"
}, {
name: "保存并继续添加",
value: "saveAndContinue",
type: "primary"
}, {
name: "保存",
value: "save",
type: "primary"
}];
public formOptions: FormOption<BtnOption>[] = [{ public formOptions: FormOption<BtnOption>[] = [{
name: "区域名称", name: "区域名称",
key: "areaName", key: "areaName",
@ -253,6 +245,16 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
require: true, require: true,
showError: false, showError: false,
format: "yyyy-MM-dd" format: "yyyy-MM-dd"
}, {
name: "区域固有风险等级",
key: "analRiskLevel",
format: "analRiskLevelName",
require: true,
width: "calc(50% - 20px)",
type: "select",
showError: false,
disable: true,
datas: this.$store.state.prevention_risk_level
}, { }, {
name: "是否为两大一重", name: "是否为两大一重",
key: "majorSign", key: "majorSign",
@ -264,7 +266,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
}, { }, {
name: "重大危险源", name: "重大危险源",
key: "majorHazard", key: "majorHazard",
hide: !this.updateParams.majorSign.includes(1) || this.updateParams.majorSign.includes(0), hide: !this.updateParams.majorSign || this.updateParams.majorSign.length === 0 || !this.updateParams.majorSign.includes(1) || this.updateParams.majorSign.includes(0),
type: "select", type: "select",
format: "majorHazardName", format: "majorHazardName",
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
@ -276,7 +278,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
name: "重点监管工艺", name: "重点监管工艺",
key: "regulatoryProcess", key: "regulatoryProcess",
format: "regulatoryProcessName", format: "regulatoryProcessName",
hide: !this.updateParams.majorSign.includes(2) || this.updateParams.majorSign.includes(0), hide: !this.updateParams.majorSign || this.updateParams.majorSign.length === 0 || !this.updateParams.majorSign.includes(2) || this.updateParams.majorSign.includes(0),
type: "select", type: "select",
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
require: true, require: true,
@ -286,7 +288,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
name: "重点监管化学品", name: "重点监管化学品",
key: "regulatoryChemical", key: "regulatoryChemical",
format: "regulatoryChemicalName", format: "regulatoryChemicalName",
hide: !this.updateParams.majorSign.includes(3) || this.updateParams.majorSign.includes(0), hide: !this.updateParams.majorSign || this.updateParams.majorSign.length === 0 || !this.updateParams.majorSign.includes(3) || this.updateParams.majorSign.includes(0),
type: "select", type: "select",
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
require: true, require: true,
@ -326,6 +328,29 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
}] }]
} }
public updateActions = [] as any;
public buildActionsForm() {
this.updateActions = [{
name: "取消",
value: "cancel"
}, {
name: '存草稿',
value: 'addDraft',
type: "primay",
hide: !this.updateParams.status || this.updateParams.status === 1 ? false : true
}, {
name: "保存并继续添加",
value: "saveAndContinue",
type: "primary",
hide: this.updateParams.id ? true : false
}, {
name: "保存",
value: "save",
type: "primary"
}];
}
@Watch("$store.state.deptList", { immediate: true, deep: true }) @Watch("$store.state.deptList", { immediate: true, deep: true })
onChanges() { onChanges() {
this.loadAreaData() this.loadAreaData()
@ -377,7 +402,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
return { return {
name: item.name, name: item.name,
value: item.id, value: item.id,
analRiskLevel: item.analRiskLevel ? item.analRiskLevel : 0, analRiskLevel: item.analRiskLevel ? item.analRiskLevel : null,
} }
}); });
this.buildUpdateForm() this.buildUpdateForm()
@ -406,7 +431,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
if (data.areaId) { if (data.areaId) {
this.params.unitName = data.name this.params.unitName = data.name
} else { } else {
this.params.areaName = data.name==="全部"?"":data.name this.params.areaName = data.name === "全部" ? "" : data.name
} }
this.getTableData() this.getTableData()
@ -444,14 +469,41 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
this.tableColumn.push({ this.tableColumn.push({
name: '状态', key: "status", render: (data) => { name: '状态', key: "status", render: (data) => {
if (data.status) { if (data.status) {
return "<span class='color_" + data.status + "'>" + (data.status ? (this.$store.getters.prevention_evaluate_status_map[data.status]) : '') + "</span>" let tmpstatus: any = data.status
if (data.status === 1) {
tmpstatus = 2
} else if (data.status === 2) {
tmpstatus = 1
}
return "<span class='color_" + tmpstatus + "'>" + (data.status ? (this.$store.getters.prevention_evaluate_status_map[data.status]) : '') + "</span>"
} }
},
filters: this.$store.state.prevention_evaluate_status.map(item => {
return {
text: item.name,
value: item.value,
}
}), filterMethod: (data, row) => {
return row.status === data;
} }
}); });
// //
this.subTableColumn.push({ name: '序号', key: "index" }); this.subTableColumn.push({ name: '序号', key: "index" });
this.subTableColumn.push({
name: '状态', key: "status", render: (data) => {
if (data.status && data.status !== 1) {
let tmpstatus: any = data.status
if (data.status === 2) {
tmpstatus = 1
}
if (data.status) {
return "<span class='color_" + tmpstatus + "'>" + (data.status ? (this.$store.getters.prevention_evaluate_status_map[data.status]) : '') + "</span>"
}
}
}
});
this.subTableColumn.push({ name: '步骤名称', key: "name" }); this.subTableColumn.push({ name: '步骤名称', key: "name" });
this.subTableColumn.push({ name: '作业步骤描述', key: "description", showTip: true, width: "200px" }); this.subTableColumn.push({ name: '作业步骤描述', key: "description", showTip: true, width: "200px" });
this.subTableColumn.push({ name: '作业地点', key: "location" }); this.subTableColumn.push({ name: '风险源', key: "riskSource" }); this.subTableColumn.push({ name: '作业地点', key: "location" }); this.subTableColumn.push({ name: '风险源', key: "riskSource" });
@ -474,7 +526,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
this.subTableColumn.push({ this.subTableColumn.push({
name: '残余风险等级', key: "remainLevel", width: "200px", render: (data) => { name: '残余风险等级', key: "remainLevel", width: "200px", render: (data) => {
if (data.remainLevel) { if (data.remainLevel) {
return this.$store.getters.prevention_risk_level_map[data.remainRiskLevel] return this.$store.getters.prevention_risk_level_map[data.remainLevel]
} }
} }
}); });
@ -538,7 +590,10 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
this.deleteData(this.selectData.map((item: any) => item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} else if (data.value === "add") { } else if (data.value === "add") {
this.isReadonly = false; this.isReadonly = false;
this.isModifyonly = false;
this.showUpdate = true this.showUpdate = true
this.jobList = []
this.unitList = []
this.updateParams = { this.updateParams = {
majorSign: [], majorSign: [],
items: [], items: [],
@ -546,6 +601,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
evaluateUserId: this.account.userId, evaluateUserId: this.account.userId,
evaluateUserName: this.account.nickName, evaluateUserName: this.account.nickName,
} as any } as any
this.buildActionsForm()
} else if (data.value === "cancel") { } else if (data.value === "cancel") {
this.handleClose() this.handleClose()
} else if (data.value === "estimateMatrix") { } else if (data.value === "estimateMatrix") {
@ -558,18 +614,26 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
this.isReadonly = false; this.isReadonly = false;
} else if (data && data.value === "subDelete") { } else if (data && data.value === "subDelete") {
if (this.subSelectData.length > 0) { if (this.subSelectData.length > 0) {
if (!this.updateParams.deleteIds) { this.$confirm('确认删除所选数据', '确认数据', {
this.updateParams.deleteIds = [] confirmButtonText: '确定',
} cancelButtonText: '取消',
this.subSelectData.map((itemData: any) => { type: 'warning'
this.updateParams.deleteIds.push(itemData.id) }).then(() => {
this.updateParams.steps.splice(this.updateParams.steps.findIndex(item => item.index === itemData.index), 1) if (!this.updateParams.deleteIds) {
}) this.updateParams.deleteIds = []
this.updateParams.steps.forEach((item, index) => { }
item.index = index + 1 this.subSelectData.map((itemData: any) => {
return item this.updateParams.deleteIds.push(itemData.id)
}) this.updateParams.steps.splice(this.updateParams.steps.findIndex(item => item.index === itemData.index), 1)
this.updateParams.stepNum = this.updateParams.steps.length })
this.updateParams.steps.forEach((item, index) => {
item.index = index + 1
return item
})
this.updateParams.stepNum = this.updateParams.steps.length
}).catch(() => {
//
});
} }
} }
} }
@ -591,7 +655,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
const areaData = this.areaList.find((itm: any) => itm.value === data) as any; const areaData = this.areaList.find((itm: any) => itm.value === data) as any;
this.updateParams.analRiskLevel = areaData.analRiskLevel this.updateParams.analRiskLevel = areaData.analRiskLevel
this.updateParams.analRiskLevel = areaData.analRiskLevel // this.updateParams.analRiskLevel = areaData.analRiskLevel
this.updateParams.chargeDeptName = null; this.updateParams.chargeDeptName = null;
this.updateParams.chargeUserId = null; this.updateParams.chargeUserId = null;
this.updateParams.chargeUserName = null; this.updateParams.chargeUserName = null;
@ -643,8 +707,14 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
} }
// //
if (item && item.key === 'majorSign') { if (item && item.key === 'majorSign') {
if (!data) {
data = []
}
if (data.includes(0)) { if (data.includes(0)) {
data.splice(0, data.length) if (data.length.length > 0) {
data.splice(0, data.length)
}
data.push(0) data.push(0)
} }
this.buildUpdateForm() this.buildUpdateForm()
@ -652,8 +722,8 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
} }
// //
public loadJobData(id?) { public loadJobData(id?) {
this.workService.selectByPage({ pageSize: 1000, unitId: id }).then((res: any) => { this.tableService.selectWorkByUnit({ unitId: id }).then((res: any) => {
this.jobList = res.data.datas.map(item => { this.jobList = res.data.map(item => {
return { return {
name: item.name, name: item.name,
value: item.id, value: item.id,
@ -693,6 +763,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
this.currentId = row.id; this.currentId = row.id;
this.tableService.selectById(this.currentId).then((res: any) => { this.tableService.selectById(this.currentId).then((res: any) => {
if (isReadonly) { if (isReadonly) {
const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel']
this.updateParams = Object.assign({ this.updateParams = Object.assign({
majorHazardName: !res.data.majorHazard ? null : res.data.majorHazard.split(";").map(item => this.sourceMap[item]).join(";"), majorHazardName: !res.data.majorHazard ? null : res.data.majorHazard.split(";").map(item => this.sourceMap[item]).join(";"),
regulatoryProcessName: !res.data.regulatoryProcess ? null : res.data.regulatoryProcess.split(";").map(item => this.craftMap[item]).join(";"), regulatoryProcessName: !res.data.regulatoryProcess ? null : res.data.regulatoryProcess.split(";").map(item => this.craftMap[item]).join(";"),
@ -700,7 +771,8 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
majorSignName: !res.data.majorSign ? null : res.data.majorSign.split(";").map(item => this.$store.getters.prevention_majorsign_map[item]).join(";"), majorSignName: !res.data.majorSign ? null : res.data.majorSign.split(";").map(item => this.$store.getters.prevention_majorsign_map[item]).join(";"),
riskLevelName: this.$store.getters.prevention_risk_level_map[res.data.riskLevel], riskLevelName: this.$store.getters.prevention_risk_level_map[res.data.riskLevel],
remainRiskLevelName: this.$store.getters.prevention_risk_level_map[res.data.remainRiskLevel], remainRiskLevelName: this.$store.getters.prevention_risk_level_map[res.data.remainRiskLevel],
typeName: this.$store.getters.prevention_device_type_map[res.data.type] typeName: this.$store.getters.prevention_device_type_map[res.data.type],
analRiskLevelName: this.$store.getters.prevention_risk_level_map[areaAnalRiskLevel]
}, res.data) }, res.data)
this.updateParams.majorSign = this.stringChangeArray(res.data.majorSign) this.updateParams.majorSign = this.stringChangeArray(res.data.majorSign)
this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard) this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard)
@ -710,23 +782,27 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
item.index = index + 1; item.index = index + 1;
return item return item
}) })
this.isReadonly = true this.isReadonly = true;
this.isModifyonly = false
} else { } else {
this.isReadonly = false this.isReadonly = false
this.isModifyonly = true this.isModifyonly = true
this.updateParams = res.data; this.updateParams = res.data;
this.updateParams.majorSign = this.stringChangeArray(res.data.majorSign) this.updateParams.majorSign = res.data.majorSign ? this.stringChangeArray(res.data.majorSign) : []
this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard) this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard)
this.updateParams.regulatoryProcess = this.stringChangeArray(res.data.regulatoryProcess) this.updateParams.regulatoryProcess = this.stringChangeArray(res.data.regulatoryProcess)
this.updateParams.regulatoryChemical = this.stringChangeArray(res.data.regulatoryChemical) this.updateParams.regulatoryChemical = this.stringChangeArray(res.data.regulatoryChemical)
this.loadUnitData(res.data.areas) const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel']
this.updateParams.analRiskLevel = areaAnalRiskLevel
this.loadUnitData(res.data.areaId)
this.loadJobData(res.data.unitId) this.loadJobData(res.data.unitId)
this.updateParams.steps.forEach((item, i) => { this.updateParams.steps.forEach((item, i) => {
item.index = i + 1 item.index = i + 1
}) })
} }
this.buildUpdateForm() this.buildUpdateForm();
this.buildActionsForm();
this.showUpdate = true; this.showUpdate = true;
}) })
} }
@ -744,7 +820,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
this.updateParams.regulatoryChemical = this.arrayChangeString(this.updateParams.regulatoryChemical) this.updateParams.regulatoryChemical = this.arrayChangeString(this.updateParams.regulatoryChemical)
this.updateParams.majorHazard = this.arrayChangeString(this.updateParams.majorHazard) this.updateParams.majorHazard = this.arrayChangeString(this.updateParams.majorHazard)
this.updateParams.safetyFactor = this.arrayChangeString(this.updateParams.safetyFactor) this.updateParams.safetyFactor = this.arrayChangeString(this.updateParams.safetyFactor)
this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id ? true : false).then((res) => { this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id || this.updateParams.status === 1 ? true : false).then((res) => {
this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!"); this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!");
this.showUpdate = !!goOn; this.showUpdate = !!goOn;
this.getTableData(); this.getTableData();
@ -804,7 +880,13 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
riskControlLevelName: this.$store.getters.prevention_control_level_map[row.riskControlLevel], riskControlLevelName: this.$store.getters.prevention_control_level_map[row.riskControlLevel],
}, row) }, row)
this.analysisUpdateParams = { ...this.analysisUpdateParams, ...JSON.parse(JSON.stringify(row)) }; this.analysisUpdateParams = { ...this.analysisUpdateParams, ...JSON.parse(JSON.stringify(row)) };
if (!this.analysisUpdateParams.measures) {
this.analysisUpdateParams.measures = []
}
this.analysisUpdateParams.measures.forEach((item, index) => {
item.index = index + 1
return item
})
} else { } else {
this.analyIsReadonly = false this.analyIsReadonly = false
// //
@ -814,6 +896,16 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
this.analysisUpdateParams.riskChoose = row.riskChoose ? row.riskChoose.split(";") : [] this.analysisUpdateParams.riskChoose = row.riskChoose ? row.riskChoose.split(";") : []
this.analysisUpdateParams.remainChoose = row.remainChoose ? row.remainChoose.split(";") : [] this.analysisUpdateParams.remainChoose = row.remainChoose ? row.remainChoose.split(";") : []
this.analysisUpdateParams.chargeUserName = this.updateParams.chargeUserName this.analysisUpdateParams.chargeUserName = this.updateParams.chargeUserName
this.checkRiskType.risk = this.analysisUpdateParams.riskChoose
this.checkRiskType.remain = this.analysisUpdateParams.remainChoose
if (!this.analysisUpdateParams.measures) {
this.analysisUpdateParams.measures = []
}
this.analysisUpdateParams.measures.forEach((item, index) => {
item.index = index + 1
return item
})
} }
} }
this.showSubUpdate = true this.showSubUpdate = true

View File

@ -1,7 +1,6 @@
<div class="common-box dis-flex " > <div class="common-box dis-flex ">
<div class="common-tree-box" v-if="treeData"> <div class="common-tree-box">
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current @node-click="handleNodeClick"> <UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
</el-tree>
</div> </div>
<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">
@ -10,33 +9,44 @@
</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)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @pageSizeChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event)"
:footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="60"> <el-table-column type="selection" label="全选" width="60">
</el-table-column> </el-table-column>
<el-table-column label="序号" width="60">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<template v-for="item in tableColumn"> <template v-for="item in tableColumn">
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key">
<div slot-scope="scope" v-html="item.render(scope.row)"></div> <div slot-scope="scope" v-html="item.render(scope.row)" :filters="item.filters"
:filter-method="item.filterMethod" :show-overflow-tooltip="item.showTip"></div>
</el-table-column> </el-table-column>
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key"
:filters="item.filters" :filter-method="item.filterMethod"
:show-overflow-tooltip="item.showTip">
</el-table-column> </el-table-column>
</template> </template>
<el-table-column label="操作" width="100"> <el-table-column label="操作" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="deleteData([scope.row])">排查</el-button> <el-button v-if="scope.row.status===2" type="text"
@click="showSubModal(scope.row)">排查</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</TableComponent> </TableComponent>
</div> </div>
</div> </div>
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'" :visible.sync="showUpdate" width="952px" <el-dialog :close-on-click-modal="false" :title="'排查信息'" :visible.sync="showUpdate" width="800px"
:before-close="handleClose"> :before-close="handleClose">
<FormComponent :options="updateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right" :data.sync="updateParams"></FormComponent> <FormComponent :options="subUpdateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
:actions="subActions" @actionCallback="subActionCallback" @change="changes" :full-btn="true" btnPosition="center">
</FormComponent>
</el-dialog> </el-dialog>
</div> </div>

View File

@ -9,12 +9,16 @@ import DutyService from "@/service/duty.service"
import FormOption from "hbt-common/models/formOptions" import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions" import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue'; import DrawComponent from '@/components/draw.component.vue';
import UnitTreeComponent from '@/components/tree.component.vue';
import moment from 'moment';
@Component({ @Component({
template, template,
components:{ components: {
FormComponent, FormComponent,
TableComponent, TableComponent,
DrawComponent, DrawComponent,
UnitTreeComponent,
}, },
}) })
export default class DutyManagerComponent extends BaseRecordComponent<any> { export default class DutyManagerComponent extends BaseRecordComponent<any> {
@ -22,140 +26,322 @@ export default class DutyManagerComponent extends BaseRecordComponent<any> {
public params = {} as any; public params = {} as any;
public treeData = [{
label: '一级 1',
children: [{
label: '二级 1-1',
children: [{
label: '三级 1-1-1'
}]
}]
}, {
label: '一级 2',
children: [{
label: '二级 2-1',
children: [{
label: '三级 2-1-1'
}]
}, {
label: '二级 2-2',
children: [{
label: '三级 2-2-1'
}]
}]
}, {
label: '一级 3',
children: [{
label: '二级 3-1',
children: [{
label: '三级 3-1-1'
}]
}, {
label: '二级 3-2',
children: [{
label: '三级 3-2-1'
}]
}]
}]
public formActions = [{ public formActions = [{
name:"查询", name: "查询",
value:"search", value: "search",
icon:"el-icon-search", icon: "el-icon-search",
type:"primary" type: "primary"
},{ }, {
name:"清空", name: "清空",
icon:"el-icon-tickets", icon: "el-icon-tickets",
value:"reset" value: "reset"
}]; }];
public tableActions = [{ public tableActions = [{
name:"批量删除", name: "批量删除",
value:"delete", value: "delete",
plain:true, plain: true,
icon:"el-icon-delete", icon: "el-icon-delete",
type:"danger" type: "danger"
}]; }];
public footerActions = [{ public footerActions = [{
name:"选择全部", name: "选择全部",
value:"selectAll", value: "selectAll",
type:"primary" type: "primary"
},{ }, {
name:"反向选择", name: "反向选择",
value:"reverse" value: "reverse"
}]; }];
public formOptions:FormOption<BtnOption>[] = [{ public formOptions: FormOption<BtnOption>[] = [{
name:"区域名称", name: "管控对象",
key:"areaId", key: "analControlName",
type:"text", type: "text",
},{ }, {
name:"单元名称", name: "分析对象",
key:"unitId", key: "itemName",
type:"text", type: "text",
}]; }];
public showUpdate = false; public showUpdate = false;
public updateParams = {} as any; public updateParams = {} as any;
public selectData = []; public selectData = [];
created(){ public fileList = [] as any;
public photoList = [] as any;
public showFile = false;
public currentUrl = null;
public account = JSON.parse(localStorage.getItem("account") as any);
public userListName = {} as any;
public subUpdateOptions = [] as any;
public subUpdateForm() {
this.subUpdateOptions = [{
name: "是否包保责任人任务",
key: "insuranceDutyFlag",
format: "insuranceDutyFlagName",
type: "radio",
width: "100%",
labelWidth: 'auto',
require: true,
disable: true,
datas: [
{
name: "否",
value: 0
},
{
name: "是",
value: 1
}
]
}, {
name: "隐患排查任务",
key: "taskName",
type: "text",
width: "100%",
require: true,
disable: true,
}, {
name: "排查结果",
key: "result",
type: "radio",
width: "100%",
require: true,
datas: [
{
name: "正常",
value: 1
},
{
name: "异常",
value: 2
}
]
}, {
name: "是否为隐患",
key: "dangerFlag",
format: "dangerFlagName",
type: "radio",
width: "100%",
labelWidth: 'auto',
require: true,
disable: this.updateParams.result === 2,
datas: [
{
name: "否",
value: 0
},
{
name: "是",
value: 1
}
]
}, {
name: "问题描述",
key: "taskName",
type: "textarea",
width: "100%",
require: true,
}, {
name: "隐患类别",
key: "taskType",
format: "taskTypeName",
type: "select",
width: "100%",
require: true,
datas: this.$store.state.prevention_hazard_category,
}, {
name: "隐患归属人",
key: "ownerId",
type: "select",
width: "100%",
require: true,
datas: this.$store.state.userList,
},
{
name: "IMEI码",
key: "imeiCode",
type: "text",
width: "100%",
require: true,
disable: true,
},
{
name: " 排查人",
key: "checkUserId",
type: "select",
width: "100%",
require: true,
disable: true,
datas: this.$store.state.userList,
},
{
name: " 排查时间",
key: "checkTime",
type: "text",
width: "100%",
require: true,
disable: true,
}, {
name: "附件",
key: "resourceId",
ref: "file",
type: "upload",
width: "calc(50% - 20px)",
showError: false,
onSucess: this.onSuccess2,
onMove: this.onRemove2,
onPreview: this.onPreview,
autoUpload: true,
accept: "image/png, image/jpeg,.doc,.docx,.xls,.xlsx,.pdf",
listType: "text",
tip: "请上传.pdf,.png,.jpg,.doc.docx,.xls,.xlsx格式文件",
fileList: this.fileList,
btn: [{
name: "点击上传",
value: "upload",
size: "small",
type: "primary"
}]
}
]
}
public subActions = [{
name: "取消",
value: "cancel"
}, {
name: "保存并提交",
value: "save",
type: "primary"
}]
created() {
this.subUpdateForm()
} }
// //
public handleNodeClick(data){ public handleNodeClick(data) {
console.log(data) this.params.unitName = "";
this.params.areaName = "";
if (data.areaId) {
this.params.unitName = data.name
} else {
this.params.areaName = data.name === "全部" ? "" : data.name
}
this.getTableData()
} }
public buildTable(){ public buildTable() {
this.tableColumn.push({name:'序号',key:"index"}); this.tableColumn.push({ name: '管控对象', key: "analControlName" });
this.tableColumn.push({name:'管控对象',key:"deptName"}); this.tableColumn.push({ name: '分析对象', key: "itemName" });
this.tableColumn.push({name:'分析对象',key:"deptName"}); this.tableColumn.push({ name: '管控措施', key: "measureDescription" });
this.tableColumn.push({name:'管控措施',key:"deptName"}); this.tableColumn.push({ name: '隐患排查任务', key: "taskName" });
this.tableColumn.push({name:'隐患排查任务',key:"person"}); this.tableColumn.push({ name: '结束时间', key: "endTime" });
this.tableColumn.push({name:'结束时间',key:"person"}); this.tableColumn.push({ name: '责任人', key: "taskChargeUserName" });
this.tableColumn.push({name:'责任人',key:"person"}); this.tableColumn.push({ name: '生成时间', key: "generateTime" });
this.tableColumn.push({name:'生成时间',key:"person"}); this.tableColumn.push({
this.tableColumn.push({name:'任务状态', width:"110px",key:"status",render:(data)=>{ name: '任务状态', width: "110px", key: "status", render: (data) => {
if(data.status==0){ if (data.status == 2) {
return "<span class='noDraw'>未绘制</span>" return "<span class='noDraw'>待排查</span>"
}else{ } else if (data.status == 1) {
return "<span>已绘制</span>" return "<span>已排查</span>"
} else if (data.status == 3) {
return "<span class='noDraw'>超期未排查</span>"
}
},
filters: this.$store.state.prevention_task_status.map(item => {
return {
text: item.name,
value: item.value,
}
}), filterMethod: (data, row) => {
return row.status === data;
} }
}}); });
} }
public callback(data){ public callback(data) {
// //
if(data.value==="search"){ if (data.value === "search") {
this.getTableData() this.getTableData()
// //
}else if(data.value === "reset"){ } else if (data.value === "reset") {
this.reset() this.reset()
// //
}else if(data.value === "reverse"){ } else if (data.value === "reverse") {
this.toggleAll() this.toggleAll()
// //
}else if(data.value === "selectAll"){ } else if (data.value === "selectAll") {
this.selectAll() this.selectAll()
}else if(data.value === "delete"){ } else if (data.value === "delete") {
this.deleteData(this.selectData.map((item:any)=>item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} }
} }
public subActionCallback(data) {
if (data.value === "cancel") {
this.showUpdate = false
this.updateParams = {} as any;
} else if (data.value === "save") {
this.doSave()
}
}
public doSave() {
if (this.fileList.length > 0) {
let resourceId = this.fileList.map((item) => {
return item.id
})
this.updateParams.resourceId = resourceId.join(";")
}
this.$store.state.userList.map((item) => {
this.userListName[item.value] = item.name
})
this.updateParams.taskChargeUserName = this.userListName[this.updateParams.checkUserId]
this.updateParams.ownerName = this.userListName[this.updateParams.ownerId]
this.tableService.addOrUpdate(this.updateParams, this.updateParams.id).then((res) => {
this.$message.success("编辑成功!");
this.showUpdate = false
this.getTableData();
})
}
public changes(data, item) {
if (item && item.key === "result") {
if (data === 2) {
this.updateParams.dangerFlag = 1
}
this.subUpdateForm()
}
}
// //
public reset(){ public reset() {
this.params = { this.params = {
pageNum:1, pageNum: 1,
pageSize:20, pageSize: 20,
} as any; } as any;
} }
// //
public showUpdateModel(id){ public showUpdateModel(id) {
this.showUpdate = true this.showUpdate = true
} }
public handleClose(){ public handleClose() {
this.showUpdate = false; this.showUpdate = false;
} }
@ -163,22 +349,76 @@ export default class DutyManagerComponent extends BaseRecordComponent<any> {
public toggleAll() { public toggleAll() {
(this.$refs.multipleTable as any).toggleAllSelection(); (this.$refs.multipleTable as any).toggleAllSelection();
} }
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.userId === item.userId);
if(!find){ if (!find) {
(this.$refs.multipleTable as any).toggleRowSelection(item); (this.$refs.multipleTable as any).toggleRowSelection(item);
} }
}) })
} }
} }
public handleSelectionChange(data){ public handleSelectionChange(data) {
this.selectData = data; this.selectData = data;
} }
public onSuccess(res, file, fileList) {
if (res.code === 200) {
this.photoList.push({
name: res.data.originalName,
url: res.data.url,
type: res.data.type,
id: res.data.id
});
this.updateParams.photo = this.photoList.length || null
}
}
public onSuccess2(res, file, fileList) {
if (res.code === 200) {
this.fileList.push({
name: res.data.originalName,
url: res.data.url,
type: res.data.type,
id: res.data.id
})
}
}
public onRemove(file, fileList) {
this.photoList.splice(this.photoList.findIndex(item => item.id === file.response.data.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)
}
public onPreview(file) {
if (file.type.indexOf("png") >= 0 || file.type.indexOf("jp") >= 0) {
this.currentUrl = file.url;
this.showFile = true;
} else {
window.open(file.url, "_blank")
}
}
//
public showSubModal(row) {
const mathData = Math.floor(Math.random() * 1000);
this.updateParams = Object.assign({
checkUserId: this.account.userId,
checkTime: moment().format('YYYY-MM-DD HH:mm'),
imeiCode: moment().format('DDHHmm') + mathData,
}, row)
this.updateParams.status = 1
this.updateParams.endTime = moment().format('YYYY-MM-DD HH:mm:ss')
this.subUpdateForm()
this.showUpdate = true
}
} }
</script> </script>
<style lang="scss" scoped src="../../common.component.scss"></style> <style lang="scss" scoped src="../../common.component.scss"></style>

View File

@ -1,7 +1,6 @@
<div class="common-box dis-flex " > <div class="common-box dis-flex " >
<div class="common-tree-box" v-if="treeData"> <div class="common-tree-box">
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current @node-click="handleNodeClick"> <UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
</el-tree>
</div> </div>
<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">
@ -17,6 +16,11 @@
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="60"> <el-table-column type="selection" label="全选" width="60">
</el-table-column> </el-table-column>
<el-table-column label="序号" width="60">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<template v-for="item in tableColumn"> <template v-for="item in tableColumn">
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key">
<div slot-scope="scope" v-html="item.render(scope.row)"></div> <div slot-scope="scope" v-html="item.render(scope.row)"></div>
@ -26,7 +30,7 @@
</template> </template>
<el-table-column label="操作" width="100"> <el-table-column label="操作" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="deleteData([scope.row])">查看</el-button> <el-button type="text" @click="showSubModal(scope.row)">查看</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -35,8 +39,10 @@
</div> </div>
</div> </div>
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'" :visible.sync="showUpdate" width="952px" <el-dialog :close-on-click-modal="false" :title="'排查信息'" :visible.sync="showUpdate" width="800px"
:before-close="handleClose"> :before-close="handleClose">
<FormComponent :options="updateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right" :data.sync="updateParams"></FormComponent> <FormComponent :options="subUpdateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
:actions="subActions" @actionCallback="subActionCallback" @change="changes" :full-btn="true" btnPosition="center">
</FormComponent>
</el-dialog> </el-dialog>
</div> </div>

View File

@ -9,166 +9,254 @@ import DutyService from "@/service/duty.service"
import FormOption from "hbt-common/models/formOptions" import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions" import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue'; import DrawComponent from '@/components/draw.component.vue';
import UnitTreeComponent from '@/components/tree.component.vue';
@Component({ @Component({
template, template,
components:{ components: {
FormComponent, FormComponent,
TableComponent, TableComponent,
DrawComponent, DrawComponent,
UnitTreeComponent,
}, },
}) })
export default class DutyRecordsManagerComponent extends BaseRecordComponent<any> { export default class DutyRecordsManagerComponent extends BaseRecordComponent<any> {
public tableService = new DutyService(); public tableService = new DutyService();
public params = {} as any; public params = {} as any;
public treeData = [{
label: '一级 1',
children: [{
label: '二级 1-1',
children: [{
label: '三级 1-1-1'
}]
}]
}, {
label: '一级 2',
children: [{
label: '二级 2-1',
children: [{
label: '三级 2-1-1'
}]
}, {
label: '二级 2-2',
children: [{
label: '三级 2-2-1'
}]
}]
}, {
label: '一级 3',
children: [{
label: '二级 3-1',
children: [{
label: '三级 3-1-1'
}]
}, {
label: '二级 3-2',
children: [{
label: '三级 3-2-1'
}]
}]
}]
public formActions = [{ public formActions = [{
name:"查询", name: "查询",
value:"search", value: "search",
icon:"el-icon-search", icon: "el-icon-search",
type:"primary" type: "primary"
},{ }, {
name:"清空", name: "清空",
icon:"el-icon-tickets", icon: "el-icon-tickets",
value:"reset" value: "reset"
}]; }];
public tableActions = [{ public tableActions = [{
name:"批量删除", name: "批量删除",
value:"delete", value: "delete",
plain:true, plain: true,
icon:"el-icon-delete", icon: "el-icon-delete",
type:"danger" type: "danger"
}]; }];
public footerActions = [{ public footerActions = [{
name:"选择全部", name: "选择全部",
value:"selectAll", value: "selectAll",
type:"primary" type: "primary"
},{ }, {
name:"反向选择", name: "反向选择",
value:"reverse" value: "reverse"
}]; }];
public formOptions:FormOption<BtnOption>[] = [{ public formOptions: FormOption<BtnOption>[] = [{
name:"排查结果", name: "排查结果",
key:"areaId", key: "result",
type:"select", type: "select",
datas:[{ datas: [{
name:"部门1", name: "正常",
value:0 value: 1
},{ }, {
name:"部门2", name: "异常",
value:1 value: 2
}] }]
},{ }, {
name:"是否为隐患", name: "是否为隐患",
key:"unitId", key: "dangerFlag",
type:"select", type: "select",
datas:[{ datas: [{
name:"单元1", name: "否",
value:0 value: 0
},{ }, {
name:"单元2", name: "是",
value:1 value: 1
}] }]
}]; }];
public showUpdate = false; public showUpdate = false;
public updateParams = {} as any;
public updateParams = {} as any;
public selectData = []; public selectData = [];
created(){ public fileList = [] as any;
public photoList = [] as any;
public showFile = false;
public currentUrl = null;
public subUpdateOptions = [] as any;
public subUpdateForm() {
this.subUpdateOptions = [{
name: "是否包保责任人任务",
key: "insuranceDutyFlag",
format: "insuranceDutyFlagName",
type: "text",
labelWidth: 'auto',
require: true,
with: "100%"
}, {
name: "隐患排查任务",
key: "taskName",
type: "text",
require: true,
with: "calc(50% - 20px)"
}, {
name: "排查结果",
key: "result",
format: "resultName",
type: "radio",
require: true,
with: "calc(50% - 20px)"
}, {
name: "是否为隐患",
key: "dangerFlag",
format: "dangerFlagName",
type: "radio",
labelWidth: 'auto',
require: true,
width: "calc(50% - 20px)",
}, {
name: "问题描述",
key: "taskName",
type: "textarea",
require: true,
width: "calc(50% - 20px)",
}, {
name: "隐患类别",
key: "dangerType",
format: "taskTypeName",
type: "select",
require: true,
width: "calc(50% - 20px)",
}, {
name: "隐患归属人",
key: "ownerId",
format: "ownerName",
require: true,
width: "calc(50% - 20px)",
},
{
name: "IMEI码",
key: "imeiCode",
type: "text",
width: "calc(50% - 20px)",
require: true,
},
{
name: " 排查人",
key: "checkUserId",
type: "text",
width: "calc(50% - 20px)",
require: true,
},
{
name: " 排查时间",
key: "checkTime",
type: "text",
width: "100%",
require: true,
}, {
name: "附件",
key: "resourceId",
ref: "file",
format: "resourceIdName",
type: "upload",
width: "calc(50% - 20px)",
showError: false,
onSucess: this.onSuccess2,
onMove: this.onRemove2,
onPreview: this.onPreview,
autoUpload: true,
accept: "image/png, image/jpeg",
listType: "picture-card",
fileList: this.photoList,
}
]
}
created() {
} }
// //
public handleNodeClick(data){ public handleNodeClick(data) {
console.log(data) this.params.unitId = "";
this.params.areaId = "";
if (data.areaId) {
this.params.unitId = data.id
} else {
this.params.areaId = data.id
}
this.getTableData()
} }
public buildTable(){ public buildTable() {
this.tableColumn.push({name:'序号',key:"index"}); this.tableColumn.push({ name: '隐患排查任务', key: "taskName", with: "250px" });
this.tableColumn.push({name:'隐患排查任务',key:"deptName"}); this.tableColumn.push({
this.tableColumn.push({name:'排查结果', width:"110px",key:"status",render:(data)=>{ name: '排查结果', width: "110px", key: "result", render: (data) => {
if(data.status==0){ if (data.status == 0) {
return "<span class='noDraw'>未绘制</span>" return "<span class='noDraw'>异常</span>"
}else{ } else if (data.status == 1) {
return "<span>已绘制</span>" return "<span>正常</span>"
}
} }
}}); });
this.tableColumn.push({name:'问题描述',key:"deptName"}); this.tableColumn.push({ name: '问题描述', key: "description" });
this.tableColumn.push({name:'排查人',key:"deptName"}); this.tableColumn.push({ name: '排查人', key: "checkUserId" });
this.tableColumn.push({name:'排查时间',key:"person"}); this.tableColumn.push({ name: '排查时间', key: "checkTime" });
this.tableColumn.push({name:'是否为隐患',key:"person"}); this.tableColumn.push({
this.tableColumn.push({name:'隐患归属人',key:"person"}); name: '是否为隐患', key: "dangerFlag", render: (data) => {
if (data.status == 1) {
return "<span class='noDraw'>是</span>"
} else if (data.status == 0) {
return "<span>否</span>"
}
}
});
this.tableColumn.push({ name: '隐患归属人', key: "ownerName" });
} }
public callback(data){ public callback(data) {
// //
if(data.value==="search"){ if (data.value === "search") {
this.getTableData() this.getTableData()
// //
}else if(data.value === "reset"){ } else if (data.value === "reset") {
this.reset() this.reset()
// //
}else if(data.value === "reverse"){ } else if (data.value === "reverse") {
this.toggleAll() this.toggleAll()
// //
}else if(data.value === "selectAll"){ } else if (data.value === "selectAll") {
this.selectAll() this.selectAll()
}else if(data.value === "delete"){ } else if (data.value === "delete") {
this.deleteData(this.selectData.map((item:any)=>item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} }
} }
// //
public reset(){ public reset() {
this.params = { this.params = {
pageNum:1, pageNum: 1,
pageSize:20, pageSize: 20,
} as any; } as any;
} }
// //
public showUpdateModel(id){ public showUpdateModel(id) {
this.showUpdate = true this.showUpdate = true
} }
public handleClose(){ public handleClose() {
this.showUpdate = false; this.showUpdate = false;
} }
@ -176,22 +264,91 @@ export default class DutyRecordsManagerComponent extends BaseRecordComponent<any
public toggleAll() { public toggleAll() {
(this.$refs.multipleTable as any).toggleAllSelection(); (this.$refs.multipleTable as any).toggleAllSelection();
} }
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.userId === item.userId);
if(!find){ if (!find) {
(this.$refs.multipleTable as any).toggleRowSelection(item); (this.$refs.multipleTable as any).toggleRowSelection(item);
} }
}) })
} }
} }
public handleSelectionChange(data){ public handleSelectionChange(data) {
this.selectData = data; this.selectData = data;
} }
public onSuccess(res, file, fileList) {
if (res.code === 200) {
this.photoList.push({
name: res.data.originalName,
url: res.data.url,
type: res.data.type,
id: res.data.id
});
this.updateParams.photo = this.photoList.length || null
}
}
public onSuccess2(res, file, fileList) {
if (res.code === 200) {
this.fileList.push({
name: res.data.originalName,
url: res.data.url,
type: res.data.type,
id: res.data.id
})
}
}
public onRemove(file, fileList) {
this.photoList.splice(this.photoList.findIndex(item => item.id === file.response.data.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)
}
public onPreview(file) {
if (file.type.indexOf("png") >= 0 || file.type.indexOf("jp") >= 0) {
this.currentUrl = file.url;
this.showFile = true;
} else {
window.open(file.url, "_blank")
}
}
public showSubModal(row) {
this.photoList = []
if (row.resourceId) {
this.tableService.getFileUrls({ ids: row.resourceId.split(";") }).then((photos: any) => {
this.photoList = photos.data.map(item => {
return {
name: item.originalName,
url: item.url,
type: item.type,
id: item.id
}
})
this.subUpdateForm()
})
}
this.updateParams = Object.assign({
insuranceDutyFlagName: row.insuranceDutyFlag === 0 ? '否' : '是',
resultName: row.result === 1 ? '正常' : '异常',
dangerFlagName: row.dangerFlag === 0 ? '否' : '是',
taskTypeName: this.$store.getters.prevention_hazard_category_map[row.dangerType]
}, row)
this.showUpdate = true
this.updateParams.resourceId= null
this.subUpdateForm()
}
} }
</script> </script>
<style lang="scss" scoped src="../../common.component.scss"></style> <style lang="scss" scoped src="../../common.component.scss"></style>

View File

@ -129,7 +129,7 @@ export default class MeasuresManagerComponent extends BaseRecordComponent<any> {
return "<span class='link'>" + (data.details ? data.details.length : 0) + "</span>" return "<span class='link'>" + (data.details ? data.details.length : 0) + "</span>"
} }
}); });
this.tableColumn.push({ name: '涉及岗位', key: "postName", width: "200px" }); this.tableColumn.push({ name: '涉及岗位', key: "postName" });
// //

View File

@ -13,24 +13,24 @@
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%" highlight-current-row>
<el-table-column type="selection" label="全选" width="60"> <el-table-column type="selection" label="全选" width="60">
</el-table-column> </el-table-column>
<template v-for="item in tableColumn"> <template v-for="item in tableColumn">
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key" <el-table-column class="cursor td-content" v-if="item.render" :label="item.name"
:filters="item.filters" :filter-method="item.filterMethod" :width="item.width" :key="item.key" :filters="item.filters" :filter-multiple="false"
:show-overflow-tooltip="item.showTip"> :filter-method="item.filterMethod" :show-overflow-tooltip="item.showTip">
<div slot-scope="scope" v-html="item.render(scope.row)"></div> <div slot-scope="scope" v-html="item.render(scope.row)"></div>
</el-table-column> </el-table-column>
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key" <el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key"
:filters="item.filters" :filter-method="item.filterMethod" :filters="item.filters" :filter-method="item.filterMethod" :filter-multiple="false"
:show-overflow-tooltip="item.showTip"> :show-overflow-tooltip="item.showTip" class="cursor td-content">
</el-table-column> </el-table-column>
</template> </template>
<el-table-column label="操作" width="160"> <el-table-column label="操作" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="deleteData([scope.row])">删除</el-button> <el-button type="text" @click="deleteData([scope.row])">删除</el-button>
<el-button type="text" @click="showSubModal(scope.row.id)">查看执行纪</el-button> <el-button type="text" @click="showSubModal(scope.row.id)">查看执行纪</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -58,4 +58,5 @@
<ButtonListComponent :actions="subActions" @callback="subCallback" btn-position="center" :full-btn="true"> <ButtonListComponent :actions="subActions" @callback="subCallback" btn-position="center" :full-btn="true">
</ButtonListComponent> </ButtonListComponent>
</el-dialog> </el-dialog>
</div> </div>

View File

@ -49,11 +49,21 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
public currentProTableData = { datas: [] } as any; public currentProTableData = { datas: [] } as any;
public filterStatusData: any;
public subActions = [{ public subActions = [{
name: "取消", name: "取消",
value: "cancel" value: "cancel"
}]; }];
public filters = [{
text: "已发布",
value: 0
}, {
text: "未发布",
value: 1
}]
public formActions = [{ public formActions = [{
name: "查询", name: "查询",
value: "search", value: "search",
@ -95,7 +105,7 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
public showUpdate = false; public showUpdate = false;
public updateParams = {} as any; public updateParams = {} as any;
public selectData = []; public selectData = [] as any;
created() { created() {
this.$store.state.prevention_measures_sort.map((item) => { this.$store.state.prevention_measures_sort.map((item) => {
@ -119,25 +129,34 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
public buildTable() { public buildTable() {
this.tableColumn.push({ this.tableColumn.push({
name: '状态', key: "status", render: (data) => { name: '状态', key: "status", width: "80px", render: (data) => {
if (data.status == 1) { if (data.status == 0) {
return "<span class='noDraw'>未发布</span>" return "<span class='noDraw'>未发布</span>"
} else { } else if (data.status == 1) {
return "<span>已发布</span>" return "<span>已发布</span>"
} }
},
filters: this.filters.map(item => {
return {
text: item.text,
value: item.value,
}
}), filterMethod: (data, row) => {
this.filterStatusData = data
return row.status === data;
} }
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '区域名称', key: "areaName", width: "200px", name: '区域名称', key: "areaName", width: "130px",
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '单元名称', key: "unitName", width: "200px", name: '单元名称', key: "unitName", width: "130px",
}); });
this.tableColumn.push({ name: '管控对象', key: "analControlName", width: "200px" }); this.tableColumn.push({ name: '管控对象', key: "analControlName", width: "200px" });
this.tableColumn.push({ name: '分析对象', key: "itemName", width: "200px" }); this.tableColumn.push({ name: '分析对象', key: "itemName", width: "100px" });
this.tableColumn.push({ name: '风险源', key: "itemRiskSource", width: "200px" }); this.tableColumn.push({ name: '风险源', key: "itemRiskSource", width: "120px" });
this.tableColumn.push({ this.tableColumn.push({
name: '事故后果', key: "itemSeriousResult", width: "250px", name: '事故后果', key: "itemSeriousResult", width: "100px",
render: (data) => { render: (data) => {
if (data.itemSeriousResult) { if (data.itemSeriousResult) {
return data.itemSeriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";") return data.itemSeriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";")
@ -145,7 +164,7 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
} }
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '风险等级', key: "itemRiskLevel",width:"150px", render: (data) => { name: '风险等级', key: "itemRiskLevel", width: "100px", render: (data) => {
return "<span class='color_" + data.itemRiskLevel + "'>" + (data.itemRiskLevel ? (this.$store.getters.prevention_risk_level_map[data.itemRiskLevel]) : '') + "</span>" return "<span class='color_" + data.itemRiskLevel + "'>" + (data.itemRiskLevel ? (this.$store.getters.prevention_risk_level_map[data.itemRiskLevel]) : '') + "</span>"
}, },
filters: this.$store.state.prevention_risk_level.map(item => { filters: this.$store.state.prevention_risk_level.map(item => {
@ -158,14 +177,14 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
} }
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '管控措施分类', key: "measureFirstType", width: "200px", render: (data) => { name: '管控措施分类', key: "measureFirstType", width: "120px", render: (data) => {
if (data.measureFirstType) { if (data.measureFirstType) {
return this.$store.getters.prevention_measures_sort_map[data.measureFirstType] return this.$store.getters.prevention_measures_sort_map[data.measureFirstType]
} }
} }
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '管控措施分类',width:"200px", key: "measureSecondType", name: '管控措施分类', width: "120px", key: "measureSecondType",
render: (data) => { render: (data) => {
if (data.measureFirstType) { if (data.measureFirstType) {
const secondTypeItem = this.measuresSelectData[data.measureFirstType] const secondTypeItem = this.measuresSelectData[data.measureFirstType]
@ -173,11 +192,11 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
} }
} }
}); });
this.tableColumn.push({ name: '管控措施分类',width:"200px", key: "measureThirdType" }); this.tableColumn.push({ name: '管控措施分类', width: "120px", key: "measureThirdType" });
this.tableColumn.push({ name: '管控措施', key: "measureDescription" }); this.tableColumn.push({ name: '管控措施', key: "measureDescription", width: "250px" });
this.tableColumn.push({ this.tableColumn.push({
name: '是否包保责任人任务',width:"200px", key: "insuranceDutyFlag", render: (data) => { name: '是否包保责任人任务', width: "150px", key: "insuranceDutyFlag", render: (data) => {
if (data.taskItem) { if (data.taskItem) {
return '是' return '是'
} else { } else {
@ -186,14 +205,22 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
} }
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '任务类型', key: "taskType", render: (data) => { name: '任务类型', key: "taskType", width: "130px", render: (data) => {
if (data.taskType || data.taskType === 0) { if (data.taskType || data.taskType === 0) {
return this.$store.getters.prevention_task_type_map[data.taskType] return this.$store.getters.prevention_task_type_map[data.taskType]
} }
},
filters: this.$store.state.prevention_task_type.map(item => {
return {
text: item.name,
value: item.value,
}
}), filterMethod: (data, row) => {
return row.taskType === data;
} }
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '包保任务对应项', key: "taskItem", width: "200px", render: (data) => { name: '包保任务对应项', key: "taskItem", width: "250px", render: (data) => {
if (data.taskItem) { if (data.taskItem) {
if (!this.tasksSelectData[data.taskType] || this.tasksSelectData[data.taskType].length === 0) { if (!this.tasksSelectData[data.taskType] || this.tasksSelectData[data.taskType].length === 0) {
this.$store.state.prevention_task_type.map((item) => { this.$store.state.prevention_task_type.map((item) => {
@ -208,8 +235,8 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
} }
} }
}); });
this.tableColumn.push({ name: '隐患排查任务', key: "taskName", width: "150px" }); this.tableColumn.push({ name: '隐患排查任务', key: "taskName", width: "250px" });
this.tableColumn.push({ name: '隐患责任人', key: "taskChargeUserName" ,width:"200px"}); this.tableColumn.push({ name: '隐患责任人', key: "taskChargeUserName", width: "100px" });
this.tableColumn.push({ name: '岗位', key: "taskExecutePostName" }); this.tableColumn.push({ name: '岗位', key: "taskExecutePostName" });
this.tableColumn.push({ name: '排查周期', key: "taskReviewCycleValue" }); this.tableColumn.push({ name: '排查周期', key: "taskReviewCycleValue" });
this.tableColumn.push({ this.tableColumn.push({
@ -261,8 +288,39 @@ export default class MeasuresReportManagerComponent extends BaseRecordComponent<
this.selectAll() this.selectAll()
} else if (data.value === "delete") { } else if (data.value === "delete") {
this.deleteData(this.selectData.map((item: any) => item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} else if (data.value === "doUpdate") {
//--
this.doUpdate()
} }
} }
//--
public doUpdate() {
if (this.selectData && this.selectData.length > 0) {
this.filterStatusData = this.selectData[0]['status']
const tmpSelectData = this.selectData.filter((item) => item.status !== this.filterStatusData)
if (tmpSelectData.length === 0) {
const statusName = this.filterStatusData === 1 ? '终止' : '发布'
this.$confirm('确认' + statusName + '所选数据', '确认数据', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const updateParams = JSON.parse(JSON.stringify(this.selectData))
updateParams.map((item) => {
item.status = this.filterStatusData === 0 ? 1 : 0
return item
})
this.tableService.addOrUpdate(updateParams).then((res) => {
this.$message.success(statusName + "成功!");
this.getTableData();
})
}).catch(() => {
//
});
}
}
}
// //
public reset() { public reset() {
this.params = { this.params = {