forked from xxhjsb/hbt-prevention-ui
1257 lines
43 KiB
Vue
1257 lines
43 KiB
Vue
|
|
<script lang="ts">
|
|
import { Component } from 'vue-property-decorator';
|
|
import template from "./common.component.html"
|
|
import BaseRecordComponent from "hbt-common/components/common/baseRecord.component.vue"
|
|
import FormComponent from "hbt-common/components/common/form.component.vue"
|
|
import TableComponent from "hbt-common/components/common/table.component.vue"
|
|
import WorkFlowService from "@/service/workFlow.service"
|
|
import FormOption from "hbt-common/models/formOptions"
|
|
import BtnOption from "hbt-common/models/btnOptions"
|
|
import MapComponent from "@/components/map.component.vue"
|
|
import ManagerService from '@/service/manager.service';
|
|
import mapboxgl from "mapbox-gl";
|
|
import moment from 'moment';
|
|
@Component({
|
|
template,
|
|
components: {
|
|
FormComponent,
|
|
TableComponent,
|
|
MapComponent
|
|
},
|
|
} as any)
|
|
export default class HiddenDangerManagerComponent extends BaseRecordComponent<any> {
|
|
public tableService = new ManagerService();
|
|
public workFlowService = new WorkFlowService()
|
|
// 是否显示删改查按钮
|
|
public isBase = false;
|
|
// 显示治理列表按钮
|
|
public isManager = true;
|
|
|
|
public tableActionWidth = "150";
|
|
|
|
public isReadonly = false;
|
|
public account = JSON.parse(localStorage.getItem("account") as string);
|
|
|
|
public isAction = false;
|
|
|
|
public isPlan = false;
|
|
|
|
public isClap = false;
|
|
|
|
public isFile = false;
|
|
|
|
public riskSource = [] as any;
|
|
|
|
public params = {
|
|
type: 1,
|
|
bpmSchemeCode: "prevention-yhzl"
|
|
} as any;
|
|
|
|
public formActions = [{
|
|
name: "查询",
|
|
value: "search",
|
|
icon: "el-icon-search",
|
|
type: "primary"
|
|
}, {
|
|
name: "清空",
|
|
icon: "el-icon-tickets",
|
|
value: "reset"
|
|
}];
|
|
public tableActions = [] as any;
|
|
public footerActions = [] as any;
|
|
|
|
public isSure = [{
|
|
name: "确认",
|
|
value: 1
|
|
}, {
|
|
name: "未确认",
|
|
value: 0
|
|
}]
|
|
public isSureMap = ["未确认", "确认"];
|
|
|
|
public isPass = [{
|
|
name: "通过",
|
|
value: 1
|
|
}, {
|
|
name: "不通过",
|
|
value: 0
|
|
}]
|
|
public isPassMap = ["不通过", "通过"];
|
|
|
|
public isAccept = [{
|
|
name: "接受",
|
|
value: 1
|
|
}, {
|
|
name: "不接受",
|
|
value: 0
|
|
}]
|
|
public isAcceptMap = ["不接受", "接受"];
|
|
public formOptions: FormOption<BtnOption>[] = [];
|
|
|
|
public showUpdate = false;
|
|
public currentId = -1;
|
|
public updateParams = {} as any;
|
|
public updateOptions: FormOption<BtnOption>[] = [];
|
|
public updateOptions2: FormOption<BtnOption>[] = [];
|
|
public updateOptions3: FormOption<BtnOption>[] = [];
|
|
public updateOptions4: FormOption<BtnOption>[] = [];
|
|
|
|
public fileList = [] as any;
|
|
public photoList = [] as any;
|
|
|
|
public fileList2 = [] as any;
|
|
public photoList2 = [] as any;
|
|
public showFile = false;
|
|
public currentUrl = null;
|
|
public center = [118.751353, 31.969568];
|
|
public marker: any = null;
|
|
public map: any = null;
|
|
public showMap = false;
|
|
|
|
//排序属性转换
|
|
public sortAttribute = {
|
|
updateTime: "update_time",
|
|
} as any;
|
|
|
|
public statusMap = { 0: "草稿", 1: "隐患上报", 2: "隐患确认", 3: "隐患治理", 4: "隐患验收", 5: "已闭环", 6: "流程中断", 7: "已作废" };
|
|
public tabs = [{
|
|
name: "草稿",
|
|
value: 1
|
|
}, {
|
|
name: "待办",
|
|
value: 2
|
|
}, {
|
|
name: "已办",
|
|
value: 3
|
|
}, {
|
|
name: "我发起的",
|
|
value: 4
|
|
}, { name: "作废", value: 5 }]
|
|
|
|
|
|
public updateActions = [] as any;
|
|
|
|
public selectData = [];
|
|
|
|
public levelMap = ["", "一般隐患", "重大隐患"]
|
|
public reformModeMap = ["", "即查即改", "限期整改"];
|
|
public executeResultMap = ["", "完成", "降低标准完成", "未完成", "延期完成", "延期未完成"];
|
|
public executeResultList = [{
|
|
name: "完成",
|
|
value: 1
|
|
}, {
|
|
name: "降低标准完成",
|
|
value: 2
|
|
}, {
|
|
name: "未完成",
|
|
value: 3
|
|
}, {
|
|
name: "延期完成",
|
|
value: 4,
|
|
}, {
|
|
name: "延期未完成",
|
|
value: 5
|
|
}];
|
|
|
|
|
|
created() {
|
|
//重大危险源
|
|
this.initRiskSource()
|
|
}
|
|
public tabTableChange(type) {
|
|
this.params.pageNum = 1;
|
|
if (type === 4) {
|
|
this.tableActionWidth = "250"
|
|
} else {
|
|
this.tableActionWidth = "150"
|
|
}
|
|
this.getTableData()
|
|
}
|
|
|
|
|
|
public getTableCallback() {
|
|
this.tableActions = [{
|
|
name: "添加",
|
|
value: "add",
|
|
icon: "el-icon-plus",
|
|
type: "primary"
|
|
}, {
|
|
name: "批量删除",
|
|
value: "delete",
|
|
plain: true,
|
|
hide: this.params.type !== 1,
|
|
icon: "el-icon-delete",
|
|
type: "danger"
|
|
}] as any
|
|
this.footerActions = [{
|
|
name: "选择全部",
|
|
value: "selectAll",
|
|
hide: this.params.type !== 1,
|
|
type: "primary"
|
|
}, {
|
|
name: "反向选择",
|
|
hide: this.params.type !== 1,
|
|
value: "reverse"
|
|
}];
|
|
this.updateActions = [{
|
|
name: "取消",
|
|
value: "cancel"
|
|
}, {
|
|
name: "保存",
|
|
value: "draft",
|
|
hide: this.updateParams.status > 0,
|
|
type: "primary"
|
|
}, {
|
|
name: "提交",
|
|
value: "submit",
|
|
type: "primary"
|
|
}];
|
|
this.formOptions = [{
|
|
name: "隐患等级",
|
|
key: "level",
|
|
type: "select",
|
|
datas: [{
|
|
name: "一般隐患",
|
|
value: 1
|
|
}, {
|
|
name: "重大隐患",
|
|
value: 2
|
|
}]
|
|
}, {
|
|
name: "隐患分类",
|
|
key: "classify",
|
|
type: "select",
|
|
datas: this.$store.state.prevention_dangrous_type
|
|
}, {
|
|
name: "整改方式",
|
|
key: "reformMode",
|
|
type: "select",
|
|
datas: [{
|
|
name: "即查即改",
|
|
value: 1
|
|
}, {
|
|
name: "限期整改",
|
|
value: 2
|
|
}]
|
|
}];
|
|
|
|
this.updateOptions = [{
|
|
name: "隐患编号",
|
|
key: "number",
|
|
disable: true,
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
type: "text"
|
|
}, {
|
|
name: "隐患来源",
|
|
key: "source",
|
|
format: "sourceName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.$store.state.prevention_danger_resource
|
|
}, {
|
|
name: "隐患标题",
|
|
key: "title",
|
|
width: "100%",
|
|
require: true,
|
|
showError: false,
|
|
type: "text"
|
|
}, {
|
|
name: "隐患描述",
|
|
width: "100%",
|
|
key: "description",
|
|
require: true,
|
|
showError: false,
|
|
type: "text"
|
|
}, {
|
|
name: "隐患级别",
|
|
key: "level",
|
|
format: "levelName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: [{
|
|
name: "一般隐患",
|
|
value: 1
|
|
}, {
|
|
name: "重大隐患",
|
|
value: 2
|
|
}]
|
|
}, {
|
|
name: "整改方式",
|
|
key: "reformMode",
|
|
format: "reformModeName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: [{
|
|
name: "即查即改",
|
|
value: 1
|
|
}, {
|
|
name: "限期整改",
|
|
value: 2
|
|
}]
|
|
}, {
|
|
name: "隐患位置",
|
|
key: "locationName",
|
|
type: "text",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
unit: {
|
|
type: "btn",
|
|
name: (this.updateParams.status > 1 || this.isReadonly) ? "查看定位" : "点击定位",
|
|
value: "fixed",
|
|
btnType: "primary"
|
|
}
|
|
}, {
|
|
name: "隐患分类",
|
|
key: "classify",
|
|
format: "classifyName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.$store.state.prevention_dangrous_type
|
|
}, {
|
|
name: "整改部门",
|
|
key: "reformDeptId",
|
|
format: "reformDeptName",
|
|
type: "treeSelect",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
expandLevel: Infinity,
|
|
showError: false,
|
|
datas: this.$store.state.deptTreeList
|
|
}, {
|
|
name: "整改责任人",
|
|
key: "reformUserId",
|
|
format: "reformUserName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.$store.state.userList,
|
|
}, {
|
|
name: "验证人",
|
|
key: "verifyUserId",
|
|
format: "verifyUserName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.$store.state.userList,
|
|
}, {
|
|
name: "整改时限",
|
|
key: "reformDeadline",
|
|
type: "date",
|
|
subType: "datetime",
|
|
format: "yyyy-MM-dd HH",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
pickerOptions: this.getPickerOptions(),
|
|
}, {
|
|
name: "隐患照片",
|
|
key: "photo",
|
|
ref: "photo",
|
|
type: "upload",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
onSucess: this.onSuccess,
|
|
onMove: this.onRemove,
|
|
showError: false,
|
|
autoUpload: true,
|
|
onPreview: this.onPreview,
|
|
accept: "image/png, image/jpeg",
|
|
listType: "picture-card",
|
|
fileList: this.photoList,
|
|
icon: "el-icon-plus",
|
|
}, {
|
|
name: "相关附件",
|
|
key: "file",
|
|
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: this.isReadonly ? "" : "请上传.pdf,.png,.jpg,.doc.docx,.xls,.xlsx格式文件",
|
|
fileList: this.fileList,
|
|
btn: [{
|
|
name: "上传",
|
|
value: "upload",
|
|
hide: this.isReadonly,
|
|
size: "small",
|
|
type: "primary"
|
|
}]
|
|
}, {
|
|
name: "隐患类别",
|
|
key: "dangerType",
|
|
format: "dangerTypeName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.$store.state.prevention_danger_type,
|
|
}, {
|
|
name: "检查类型",
|
|
key: "inspectType",
|
|
format: "inspectTypeName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.$store.state.prevention_danger_check_type,
|
|
}, {
|
|
name: "违章人数",
|
|
key: "violateNumber",
|
|
type: "number",
|
|
width: "calc(50% - 20px)",
|
|
showError: false,
|
|
}, {
|
|
name: "专业分类",
|
|
key: "professionClassify",
|
|
format: "professionClassifyName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
showError: false,
|
|
datas: this.$store.state.prevention_major_type,
|
|
}, {
|
|
name: "属性分类",
|
|
key: "attributeClassify",
|
|
format: "attributeClassifyName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
showError: false,
|
|
datas: this.$store.state.prevention_safe_reason,
|
|
}, {
|
|
name: "发生环节",
|
|
key: "occurNode",
|
|
format: "occurNodeName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
showError: false,
|
|
datas: this.$store.state.prevention_occur_step,
|
|
}, {
|
|
name: "违反规定条款",
|
|
key: "violateTerm",
|
|
type: "textarea",
|
|
width: "100%",
|
|
showError: false,
|
|
}, {
|
|
name: "隐患整改要求",
|
|
key: "reformDemand",
|
|
type: "textarea",
|
|
width: "100%",
|
|
showError: false,
|
|
}, {
|
|
name: "重大危险源名称",
|
|
key: "majorHazard",
|
|
format: "majorHazardName",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.riskSource
|
|
},]
|
|
if (this.params)
|
|
this.updateOptions2 = [{
|
|
name: "隐患确认",
|
|
key: "reformConfirmFlag",
|
|
format: "reformConfirmFlagName",
|
|
type: "radio",
|
|
width: "100%",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.isSure
|
|
}, {
|
|
name: "原因说明",
|
|
type: "textarea",
|
|
width: "100%",
|
|
key: "reformReasonDescription",
|
|
require: true,
|
|
hide: this.updateParams.reformConfirmFlag,
|
|
showError: false,
|
|
placeholder: "请输入未确认原因"
|
|
}, {
|
|
name: "治理人",
|
|
type: "select",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
key: "executeUserId",
|
|
format: "executeUserName",
|
|
showError: false,
|
|
hide: this.updateParams.reformConfirmFlag === 0,
|
|
datas: this.$store.state.userList
|
|
}, {
|
|
name: "治理时限",
|
|
type: "date",
|
|
subType: "datetime",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
key: "executeDeadline",
|
|
format: "yyyy-MM-dd HH:mm",
|
|
showError: false,
|
|
hide: this.updateParams.reformConfirmFlag === 0,
|
|
pickerOptions: this.getPickerOptions(this.updateParams.createTime, this.updateParams.reformDeadline)
|
|
}, {
|
|
name: "治理措施及要求",
|
|
type: "textarea",
|
|
width: "100%",
|
|
key: "executeMeasure",
|
|
require: true,
|
|
hide: this.updateParams.reformConfirmFlag === 0,
|
|
showError: false,
|
|
placeholder: "请输入治理措施与要求"
|
|
}, {
|
|
name: "治理资金",
|
|
type: "number",
|
|
width: "35%",
|
|
key: "executeMoney",
|
|
require: true,
|
|
hide: this.updateParams.reformConfirmFlag === 0,
|
|
showError: false,
|
|
unit: {
|
|
name: "元",
|
|
type: "text"
|
|
}
|
|
}, {
|
|
name: "",
|
|
type: "textarea",
|
|
width: "calc(65% - 40px)",
|
|
key: "executeMoneySource",
|
|
hide: this.updateParams.reformConfirmFlag === 0,
|
|
placeholder: "请输入资金来源"
|
|
}, {
|
|
name: "确认人",
|
|
type: "text",
|
|
width: "calc(50% - 20px)",
|
|
key: "realConfirmUserName",
|
|
require: true,
|
|
disable: true,
|
|
}, {
|
|
name: "确认时间",
|
|
type: "date",
|
|
subType: "datetime",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
key: "realConfirmTime",
|
|
format: "yyyy-MM-dd HH:mm",
|
|
showError: false,
|
|
pickerOptions: this.getPickerOptions(this.updateParams.createTime),
|
|
}]
|
|
this.updateOptions3 = [{
|
|
name: "接受确认",
|
|
key: "executeConfirmFlag",
|
|
format: "executeConfirmFlagName",
|
|
type: "radio",
|
|
width: "100%",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.isAccept
|
|
}, {
|
|
name: "整改结果",
|
|
key: "executeResult",
|
|
format: "executeResultName",
|
|
type: "radio",
|
|
hide: this.updateParams.executeConfirmFlag === 0,
|
|
width: "100%",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.executeResultList
|
|
}, {
|
|
name: "治理情况汇报",
|
|
type: "textarea",
|
|
width: "100%",
|
|
key: "executeSituation",
|
|
require: true,
|
|
hide: this.updateParams.executeConfirmFlag === 0,
|
|
showError: false,
|
|
placeholder: "请输入治理措施与要求"
|
|
}, {
|
|
name: "原因说明",
|
|
type: "textarea",
|
|
width: "100%",
|
|
key: "executeReasonDescription",
|
|
require: true,
|
|
hide: this.updateParams.executeConfirmFlag,
|
|
showError: false,
|
|
placeholder: "请输入未确认原因"
|
|
}, {
|
|
name: "照片及相关附件",
|
|
key: "file2",
|
|
type: "upload",
|
|
hide: this.updateParams.executeConfirmFlag === 0,
|
|
width: "100%",
|
|
showError: false,
|
|
onSucess: this.onSuccess3,
|
|
onMove: this.onRemove3,
|
|
onPreview: this.onPreview,
|
|
autoUpload: true,
|
|
accept: "image/png, image/jpeg,.doc,.docx,.xls,.xlsx,.pdf",
|
|
listType: "text",
|
|
tip: this.isReadonly ? "" : "请上传.pdf,.png,.jpg,.doc.docx,.xls,.xlsx格式文件",
|
|
fileList: this.fileList2,
|
|
btn: [{
|
|
name: "点击上传附件",
|
|
value: "upload",
|
|
hide: this.isReadonly,
|
|
size: "small",
|
|
type: "primary"
|
|
}]
|
|
}, {
|
|
name: "整改人",
|
|
type: "text",
|
|
width: "calc(50% - 20px)",
|
|
key: "realExecuteUserName",
|
|
require: true,
|
|
disable: true,
|
|
}, {
|
|
name: "整改时间",
|
|
type: "date",
|
|
subType: "datetime",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
key: "realExecuteTime",
|
|
format: "yyyy-MM-dd HH:mm",
|
|
showError: false,
|
|
pickerOptions: this.getPickerOptions(this.updateParams.realConfirmTime),
|
|
}]
|
|
this.updateOptions4 = [{
|
|
name: "验证结果",
|
|
key: "verifyConfirmFlag",
|
|
format: "verifyConfirmFlagName",
|
|
type: "radio",
|
|
width: "100%",
|
|
require: true,
|
|
showError: false,
|
|
datas: this.isPass
|
|
}, {
|
|
name: "验证情况",
|
|
type: "textarea",
|
|
width: "100%",
|
|
key: "verifySituation",
|
|
placeholder: "请输入验证情况"
|
|
}, {
|
|
name: "照片",
|
|
key: "photo2",
|
|
type: "upload",
|
|
width: "100%",
|
|
onSucess: this.onSuccess4,
|
|
onMove: this.onRemove4,
|
|
autoUpload: true,
|
|
onPreview: this.onPreview,
|
|
accept: "image/png, image/jpeg",
|
|
listType: "picture-card",
|
|
fileList: this.photoList2,
|
|
icon: "el-icon-plus",
|
|
}, {
|
|
name: "验证人",
|
|
type: "text",
|
|
width: "calc(50% - 20px)",
|
|
key: "realVerifyUserName",
|
|
require: true,
|
|
disable: true,
|
|
}, {
|
|
name: "验证时间",
|
|
type: "date",
|
|
subType: "datetime",
|
|
width: "calc(50% - 20px)",
|
|
require: true,
|
|
key: "realVerifyTime",
|
|
format: "yyyy-MM-dd HH:mm",
|
|
showError: false,
|
|
pickerOptions: this.getPickerOptions(this.updateParams.realExecuteTime),
|
|
}]
|
|
}
|
|
|
|
|
|
//重大危险源
|
|
public initRiskSource() {
|
|
this.riskSource = [] as any;
|
|
this.riskSource = JSON.parse(JSON.stringify(this.$store.state.prevention_risk_source));
|
|
this.riskSource.unshift({
|
|
name: '不涉及',
|
|
value: 0,
|
|
})
|
|
this.getTableCallback()
|
|
}
|
|
|
|
public buildTable() {
|
|
this.tableColumn.push({
|
|
name: '状态', render: (data) => {
|
|
if (data.status === 5) {
|
|
return `<span class="color_1">${this.statusMap[data.status]}</span>`
|
|
} else if (data.status > 60) {
|
|
return `<span class="color_0">中断</span></span>`
|
|
} else if (data.status === 0 || data.status === 7) {
|
|
return `<span>${this.statusMap[data.status]}</span>`
|
|
} else {
|
|
return `<span class="color_2">${this.statusMap[data.status]}</span>`
|
|
}
|
|
}
|
|
});
|
|
this.tableColumn.push({ name: '当前执行人', width: "100", key: "executor", render: (data) => data.taskInfo.executor || "--" });
|
|
this.tableColumn.push({ name: '最新提交时间', width: "180", key: "updateTime", sortable: 'custom' });
|
|
this.tableColumn.push({ name: '隐患来源', width: "150", render: (data) => this.$store.getters.prevention_danger_resource_map[data.source] });
|
|
this.tableColumn.push({ name: '上报人', width: "100", key: "reportUserName", render: (data) => data.reportUserName || "--" });
|
|
this.tableColumn.push({ name: '上报时间', width: "120", key: "reportTime", render: (data) => data.reportTime || "--" });
|
|
this.tableColumn.push({
|
|
name: '隐患标题', width: "150", render: (data) => {
|
|
if (this.params.type === 1 || this.params.type === 2) {
|
|
return `<span class="link">${data.title || '未命名'}</span>`
|
|
} else {
|
|
return data.title
|
|
}
|
|
}
|
|
});
|
|
this.tableColumn.push({ name: '隐患描述', key: "description", width: "300" });
|
|
this.tableColumn.push({ name: '隐患等级', render: (data) => this.levelMap[data.level] });
|
|
this.tableColumn.push({ name: '隐患分类', render: (data) => this.$store.getters.prevention_dangrous_type_map[data.dangerType] });
|
|
this.tableColumn.push({ name: '整改方式', render: (data) => this.reformModeMap[data.reformMode] });
|
|
this.tableColumn.push({ name: '隐患位置', width: "150", key: "locationName" });
|
|
this.tableColumn.push({ name: '治理责任人', width: "100", key: "executeUserName" });
|
|
this.tableColumn.push({ name: '整改结果', width: "100", render: (data) => this.executeResultMap[data.executeResult] });
|
|
this.tableColumn.push({ name: '整改时限', width: "120", key: "reformDeadline" });
|
|
}
|
|
|
|
public rowCallback(el, data) {
|
|
const isTarget = el.target.classList.contains("link");
|
|
if (isTarget) {
|
|
if (data.status === 2) {
|
|
data = Object.assign({
|
|
realConfirmUserId: this.account.userId,
|
|
realConfirmUserName: this.account.nickName,
|
|
realConfirmTime: moment().format("YYYY-MM-DD HH:mm"),
|
|
reformConfirmFlag: 1
|
|
}, data)
|
|
}
|
|
if (data.status === 3) {
|
|
data = Object.assign({
|
|
realExecuteUserId: this.account.userId,
|
|
realExecuteUserName: this.account.nickName,
|
|
realExecuteTime: moment().format("YYYY-MM-DD HH:mm"),
|
|
executeConfirmFlag: 1
|
|
}, data)
|
|
}
|
|
if (data.status === 4) {
|
|
data = Object.assign({
|
|
realVerifyUserId: this.account.userId,
|
|
realVerifyUserName: this.account.nickName,
|
|
realVerifyTime: moment().format("YYYY-MM-DD HH:mm"),
|
|
verifyConfirmFlag: 1
|
|
}, data)
|
|
}
|
|
this.showUpdateModel(data)
|
|
this.getTableCallback()
|
|
}
|
|
|
|
}
|
|
|
|
public changeStatus(data, newStatus) {
|
|
this.$confirm("确认要" + (newStatus > 60 ? "中断数据?" : newStatus === 7 ? "作废数据?" : "恢复数据"), "操作确认", {
|
|
type: 'warning'
|
|
}).then(() => {
|
|
data.status = newStatus;
|
|
this.tableService.addOrUpdate(data, false).then(res => {
|
|
this.$message.success(newStatus > 60 ? "中断成功" : "作废成功");
|
|
this.getTableData()
|
|
})
|
|
})
|
|
|
|
}
|
|
|
|
public change(data, item) {
|
|
if (item && (item.key === "reformConfirmFlag" || item.key === "executeConfirmFlag")) {
|
|
this.getTableCallback()
|
|
return
|
|
}
|
|
if (item && item.key === "reformDeadline") {
|
|
const now = moment().format("YYYY-MM-DD HH");
|
|
if (now > data) {
|
|
this.$message.error("整改时限不能早于当前时间")
|
|
this.updateParams.reformDeadline = null;
|
|
return
|
|
}
|
|
}
|
|
if (item && item.key === "executeDeadline") {
|
|
const now = this.updateParams.createTime;
|
|
if (now > data) {
|
|
this.$message.error("治理时限不能早于创建时间")
|
|
this.updateParams.executeDeadline = null;
|
|
return
|
|
}
|
|
|
|
const reform = this.updateParams.reformDeadline
|
|
if (data > reform) {
|
|
this.$message.error("治理时限不能超过整改时限")
|
|
this.updateParams.executeDeadline = null;
|
|
return
|
|
}
|
|
}
|
|
if (item && item.key === "realConfirmTime") {
|
|
const now = this.updateParams.createTime;
|
|
if (now > data) {
|
|
this.$message.error("确认时间不能早于创建时间")
|
|
this.updateParams.realConfirmTime = null;
|
|
return
|
|
}
|
|
}
|
|
if (item && item.key === "realExecuteTime") {
|
|
const now = this.updateParams.realConfirmTime;
|
|
if (now > data) {
|
|
this.$message.error("整改时间不能早于确认时间")
|
|
this.updateParams.realExecuteTime = null;
|
|
return
|
|
}
|
|
}
|
|
if (item && item.key === "realVerifyTime") {
|
|
const now = this.updateParams.realExecuteTime;
|
|
if (now > data) {
|
|
this.$message.error("验证时间不能早于整改时间")
|
|
this.updateParams.realVerifyTime = null;
|
|
return
|
|
}
|
|
}
|
|
if (item && item.key === "inspectUserId") {
|
|
this.updateParams.inspectUserName = this.$store.getters.user_map[data]
|
|
return
|
|
}
|
|
if (item && item.key === "executeUserId") {
|
|
this.updateParams.executeUserName = this.$store.getters.user_map[data]
|
|
return
|
|
}
|
|
if (item && item.key === "reformDeptId") {
|
|
this.updateParams.reformDeptName = this.$store.getters.dept_map[data]
|
|
return
|
|
}
|
|
if (item && item.key === "reformUserId") {
|
|
this.updateParams.reformUserName = this.$store.getters.user_map[data]
|
|
return
|
|
}
|
|
if (item && item.key === "verifyUserId") {
|
|
this.updateParams.verifyUserName = this.$store.getters.user_map[data]
|
|
return
|
|
}
|
|
//
|
|
}
|
|
|
|
public getPickerOptions(start?, end?) {
|
|
if (!start) {
|
|
start = new Date();
|
|
}
|
|
return {
|
|
disabledDate(time) {
|
|
if (!end) {
|
|
return time.getTime() < moment(start).subtract(1, 'day').toDate().getTime();
|
|
} else {
|
|
return time.getTime() < moment(start).subtract(1, 'day').toDate().getTime() || time.getTime() > moment(end).toDate().getTime();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public callback(data, type?) {
|
|
if (type) {
|
|
this.params[type] = data;
|
|
this.getTableData();
|
|
return
|
|
}
|
|
// 查询
|
|
if (data.value === "search") {
|
|
this.getTableData()
|
|
// 重置
|
|
} else if (data.value === "reset") {
|
|
this.reset()
|
|
// 反选
|
|
} else if (data.value === "reverse") {
|
|
this.toggleAll()
|
|
// 全选
|
|
} else if (data.value === "selectAll") {
|
|
this.selectAll()
|
|
} else if (data.value === "add") {
|
|
this.showUpdateModel()
|
|
} else if (data.value === "delete") {
|
|
this.deleteData(this.selectData.map((item: any) => item.id))
|
|
} else if (data.value === "fixed") {
|
|
this.showMap = true
|
|
|
|
} else if (data.value === "cancel") {
|
|
this.handleClose()
|
|
|
|
} else if (data.value === "draft" || data.value === "submit") {
|
|
this.doSave(data.value === "submit");
|
|
|
|
}
|
|
}
|
|
// 重置数据
|
|
public reset() {
|
|
this.params = {
|
|
type: this.params.type,
|
|
pageNum: 1,
|
|
pageSize: 20,
|
|
bpmSchemeCode: "prevention-yhzl"
|
|
} as any;
|
|
this.getTableData()
|
|
}
|
|
|
|
|
|
|
|
public showUpdateModel(row?, isRead?) {
|
|
this.initRiskSource()
|
|
this.isReadonly = !!isRead
|
|
this.updateParams = { status: 0, source: 9, dangerType: 4, photo: null } as any;
|
|
if (!row) {
|
|
this.tableService.getNumber().then(res => {
|
|
this.updateParams.number = res.data
|
|
this.getTableCallback();
|
|
this.showUpdate = true
|
|
})
|
|
} else {
|
|
this.updateParams = Object.assign({
|
|
verifyConfirmFlagName: this.isPassMap[row.verifyConfirmFlag],
|
|
executeConfirmFlagName: this.isAcceptMap[row.executeConfirmFlag],
|
|
reformConfirmFlagName: this.isSureMap[row.reformConfirmFlag],
|
|
executeResultName: this.executeResultMap[row.executeResult],
|
|
sourceName: this.$store.getters.prevention_danger_resource_map[row.source],
|
|
attributeClassifyName: this.$store.getters.prevention_safe_reason_map[row.attributeClassify],
|
|
classifyName: this.$store.getters.prevention_dangrous_type_map[row.classify],
|
|
dangerTypeName: this.$store.getters.prevention_danger_type_map[row.dangerType],
|
|
inspectTypeName: this.$store.getters.prevention_danger_check_type_map[row.inspectType],
|
|
levelName: this.levelMap[row.level],
|
|
occurNodeName: this.$store.getters.prevention_occur_step_map[row.occurNode],
|
|
professionClassifyName: this.$store.getters.prevention_major_type_map[row.professionClassify],
|
|
reformModeName: this.reformModeMap[row.reformMode],
|
|
}, row);
|
|
this.updateParams.majorHazard = +this.updateParams.majorHazard
|
|
this.updateParams.majorHazardName = !this.updateParams.majorHazard ? '不涉及' : this.$store.getters.prevention_risk_source_map[this.updateParams.majorHazard]
|
|
this.getTableCallback()
|
|
// 获取url
|
|
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
|
|
}
|
|
})
|
|
if (!this.isReadonly && this.updateParams.status < 2) {
|
|
this.updateParams.photo = this.photoList.length
|
|
}
|
|
|
|
this.getTableCallback()
|
|
})
|
|
}
|
|
if (row.resourceOtherId) {
|
|
this.tableService.getFileUrls({ ids: row.resourceOtherId.split(",") }).then((files: any) => {
|
|
this.fileList = files.data.map(item => {
|
|
return {
|
|
name: item.originalName,
|
|
url: item.url,
|
|
type: item.type,
|
|
id: item.id
|
|
}
|
|
})
|
|
this.getTableCallback()
|
|
})
|
|
}
|
|
if (row.executeResourceId) {
|
|
this.tableService.getFileUrls({ ids: row.executeResourceId.split(",") }).then((files: any) => {
|
|
this.fileList2 = files.data.map(item => {
|
|
return {
|
|
name: item.originalName,
|
|
url: item.url,
|
|
type: item.type,
|
|
id: item.id
|
|
}
|
|
})
|
|
this.getTableCallback()
|
|
})
|
|
}
|
|
if (row.verifyResourceId) {
|
|
this.tableService.getFileUrls({ ids: row.verifyResourceId.split(",") }).then((files: any) => {
|
|
this.photoList2 = files.data.map(item => {
|
|
return {
|
|
name: item.originalName,
|
|
url: item.url,
|
|
type: item.type,
|
|
id: item.id
|
|
}
|
|
})
|
|
this.getTableCallback()
|
|
})
|
|
}
|
|
this.showUpdate = true
|
|
}
|
|
}
|
|
|
|
public doSave(isSubmit) {
|
|
// 如果是提交 状态直接改成2变成代办 防止隐患确认退回变成草稿
|
|
// 从草稿或者新创建的 要记住 走startWorkFlow
|
|
// 从状态1 上报来不走startWorkFlow
|
|
let preStatus = this.updateParams.status;
|
|
const handleParams = {
|
|
"taskId": this.updateParams.taskInfo?.taskId ?? "",
|
|
"type": "agree",
|
|
"bizData": [{
|
|
"bizId": this.updateParams.id,
|
|
"data": JSON.stringify(this.updateParams)
|
|
}]
|
|
}
|
|
let userIds = [] as any;
|
|
if (!preStatus || preStatus === 1) {
|
|
if (isSubmit) {
|
|
this.updateParams.status = 2;
|
|
}
|
|
userIds = [this.updateParams.reformUserId]
|
|
} else if (preStatus === 2) {
|
|
// 确认下一步 退回上一步
|
|
if (this.updateParams.reformConfirmFlag) {
|
|
this.updateParams.status += 1;
|
|
userIds = [this.updateParams.executeUserId]
|
|
} else {
|
|
this.updateParams.status -= 1;
|
|
handleParams.type = "reject"
|
|
}
|
|
} else if (preStatus === 3) {
|
|
// 确认下一步 退回上一步
|
|
if (this.updateParams.executeConfirmFlag) {
|
|
this.updateParams.status += 1
|
|
userIds = [this.updateParams.verifyUserId]
|
|
} else {
|
|
this.updateParams.status -= 1
|
|
handleParams.type = "reject"
|
|
}
|
|
} else if (preStatus === 4) {
|
|
// 确认下一步 退回上一步
|
|
if (this.updateParams.verifyConfirmFlag) {
|
|
this.updateParams.status += 1
|
|
} else {
|
|
this.updateParams.status -= 1
|
|
handleParams.type = "reject"
|
|
}
|
|
}
|
|
this.updateParams.resourceId = this.photoList.map(item => item.id).join(",")
|
|
this.updateParams.resourceName = this.photoList.map(item => item.name).join(",")
|
|
this.updateParams.resourceOtherId = this.fileList.map(item => item.id).join(",")
|
|
this.updateParams.resourceOtherName = this.fileList.map(item => item.name).join(",")
|
|
this.updateParams.executeResourceId = this.fileList2.map(item => item.id).join(",")
|
|
this.updateParams.executeResourceName = this.fileList2.map(item => item.name).join(",")
|
|
this.updateParams.verifyResourceId = this.photoList2.map(item => item.id).join(",")
|
|
this.updateParams.verifyResourceName = this.photoList2.map(item => item.name).join(",")
|
|
this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id).then(res => {
|
|
this.$message.success(!this.updateParams.id ? "新增成功" : "编辑成功");
|
|
if (!preStatus) {
|
|
if (isSubmit) {
|
|
this.startWorkFlow(this.updateParams.id || res.data, [this.updateParams.reformUserId])
|
|
} else {
|
|
this.getTableData()
|
|
}
|
|
} else {
|
|
this.workFlowService.taskHandle(handleParams).then((data: any) => {
|
|
// 验证不需要走下一步
|
|
if (data.code === 200) {
|
|
if (data.data.code === 1) {
|
|
this.doAgain(data.data, userIds)
|
|
} else {
|
|
this.getTableData()
|
|
}
|
|
}
|
|
|
|
})
|
|
}
|
|
this.handleClose();
|
|
})
|
|
}
|
|
|
|
public startWorkFlow(ids, userIds) {
|
|
this.workFlowService.startWorkFlow({
|
|
"bpmSchemeCode": "prevention-yhzl",
|
|
"userList": userIds,
|
|
"bizData": [{
|
|
"bizId": ids,
|
|
"data": JSON.stringify(this.updateParams)
|
|
}]
|
|
}).then((res: any) => {
|
|
this.getTableData()
|
|
// 发起工作流成功
|
|
})
|
|
}
|
|
|
|
public doAgain(data, userIds) {
|
|
let candidateInfos = data.candidateInfos[0]
|
|
candidateInfos.userList = [...candidateInfos.userList, ...userIds]
|
|
this.workFlowService.again({ candidateInfos: [candidateInfos] }).then(() => {
|
|
this.getTableData()
|
|
// 发起工作流成功
|
|
})
|
|
|
|
}
|
|
|
|
public getMap(map) {
|
|
this.map = map;
|
|
this.addMarker();
|
|
}
|
|
public addMarker() {
|
|
this.marker = new mapboxgl.Marker({ draggable: !this.isReadonly && this.updateParams.status < 2 })
|
|
.setLngLat(this.center)
|
|
.addTo(this.map);
|
|
this.map.flyTo({ center: this.center })
|
|
}
|
|
|
|
public onDragEnd() {
|
|
const lngLat = this.marker.getLngLat();
|
|
this.updateParams.locationLng = lngLat.lng;
|
|
this.updateParams.locationLat = lngLat.lat;
|
|
this.center = [lngLat.lng, lngLat.lat]
|
|
// this.updateParams.locationName = lngLat.lng+","+lngLat.lat;
|
|
this.handleClose()
|
|
}
|
|
|
|
|
|
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;
|
|
const option = this.updateOptions.find(item => item.key === "photo") as any;
|
|
option.showError = false
|
|
}
|
|
}
|
|
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 onSuccess3(res, file, fileList) {
|
|
if (res.code === 200) {
|
|
this.fileList2.push({
|
|
name: res.data.originalName,
|
|
url: res.data.url,
|
|
type: res.data.type,
|
|
id: res.data.id
|
|
})
|
|
}
|
|
}
|
|
public onSuccess4(res, file, fileList) {
|
|
if (res.code === 200) {
|
|
this.photoList2.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 onRemove3(file, fileList) {
|
|
this.fileList2.splice(this.fileList2.findIndex(item => item.id === file.response.data.id), 1)
|
|
}
|
|
public onRemove4(file, fileList) {
|
|
this.photoList2.splice(this.photoList2.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 handleClose() {
|
|
if (this.showMap) {
|
|
this.showMap = false;
|
|
this.marker.remove();
|
|
this.marker = null;
|
|
return
|
|
}
|
|
this.photoList = [];
|
|
this.photoList2 = [];
|
|
this.fileList2 = [];
|
|
this.fileList = [];
|
|
this.showUpdate = false;
|
|
}
|
|
|
|
|
|
public toggleAll() {
|
|
this.tableData.datas.forEach((item, index) => {
|
|
(this.$refs.multipleTable as any).toggleRowSelection(item);
|
|
})
|
|
}
|
|
|
|
public selectable(row) {
|
|
return row
|
|
}
|
|
|
|
public selectAll() {
|
|
if (!this.selectData.length) {
|
|
this.toggleAll()
|
|
} else {
|
|
this.tableData.datas.forEach((item, index) => {
|
|
const find = this.selectData.find((data: any) => data.id === item.id);
|
|
if (!find) {
|
|
(this.$refs.multipleTable as any).toggleRowSelection(item);
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
public handleSelectionChange(data) {
|
|
this.selectData = data;
|
|
}
|
|
|
|
//排序事件
|
|
public sortChange(column) {
|
|
if (column.order) {
|
|
this.params.isAsc = column.order == "descending" ? 'desc' : 'asc'
|
|
this.params.orderByColumn = this.sortAttribute[column.prop]
|
|
} else {
|
|
this.params.isAsc = null
|
|
this.params.orderByColumn = null
|
|
}
|
|
this.getTableData()
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped src="../common.component.scss"></style>
|
|
<style>
|
|
.el-radio-button__inner {
|
|
border: none !important;
|
|
}
|
|
|
|
.el-radio-button__orig-radio:checked+.el-radio-button__inner {
|
|
border-bottom: 2px solid #409EFF !important;
|
|
}
|
|
</style>
|