| | |
| | | <template> |
| | | <div class="system-add-menu-container"> |
| | | <el-dialog :title="title" v-model="isSafetyRiskAnalyseUnitDialog" width="600px"> |
| | | <el-form :model="safetyRiskAnalyseUnitForm" :rules="safetyRiskAnalyseUnitFormRules" ref="safetyRiskAnalyseUnitFormRef" size="default" label-width="180px"> |
| | | <el-form |
| | | :model="safetyRiskAnalyseUnitForm" |
| | | :rules="safetyRiskAnalyseUnitFormRules" |
| | | ref="safetyRiskAnalyseUnitFormRef" |
| | | size="default" |
| | | label-width="180px" |
| | | > |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="安全风险分析对象编码" prop="riskCode"> |
| | | <el-input class="input-length" v-model="safetyRiskAnalyseUnitForm.riskCode" placeholder="请输入安全风险分析对象编码"></el-input> |
| | | <el-input |
| | | class="input-length" |
| | | v-model="safetyRiskAnalyseUnitForm.riskCode" |
| | | placeholder="请输入安全风险分析对象编码" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="安全风险分析单元名称" prop="riskUnitName"> |
| | | <el-input class="input-length" v-model="safetyRiskAnalyseUnitForm.riskUnitName" placeholder="请输入安全风险分析单元名称"></el-input> |
| | | <el-input |
| | | class="input-length" |
| | | v-model="safetyRiskAnalyseUnitForm.riskUnitName" |
| | | placeholder="请输入安全风险分析单元名称" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="生产装置名称" prop="produceDeviceId"> |
| | | <el-select class="input-length" v-model="safetyRiskAnalyseUnitForm.produceDeviceId" placeholder="请输入生产装置名称" clearable> |
| | | <el-select |
| | | class="input-length" |
| | | v-model="safetyRiskAnalyseUnitForm.produceDeviceId" |
| | | placeholder="请输入生产装置名称" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in allProduceDeviceData" |
| | | :key="item.id" |
| | |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="责任部门" prop="liableDepId"> |
| | | <el-cascader |
| | | @change="achiveUserList" |
| | | @change="achieveUserList" |
| | | :options="departmentList" |
| | | :props="{ emitPath: false, checkStrictly: true, value: 'id', label: 'name' }" |
| | | placeholder="请选择部门" |
| | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-form-item label="责任人" prop="liablePersonId"> |
| | | <el-select class="input-length" v-model="safetyRiskAnalyseUnitForm.liablePersonId" placeholder="请选择责任人" clearable filterable> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.uid" |
| | | :label="item.realName" |
| | | :value="item.uid" |
| | | ></el-option> |
| | | <el-select |
| | | class="input-length" |
| | | v-model="safetyRiskAnalyseUnitForm.liablePersonId" |
| | | placeholder="请选择责任人" |
| | | clearable |
| | | filterable |
| | | > |
| | | <el-option v-for="item in userList" :key="item.uid" :label="item.realName" :value="item.uid"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="isSafetyRiskAnalyseUnitDialog = !isSafetyRiskAnalyseUnitDialog" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="submitSafetyRiskAnalyseUnitDialog" size="default">确 实</el-button> |
| | | <el-button type="primary" @click="submitSafetyRiskAnalyseUnitDialog" v-throttle size="default">确 实</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | |
| | | <script lang="ts"> |
| | | interface stateType{ |
| | | isSafetyRiskAnalyseUnitDialog:Boolean, |
| | | isSafetyRiskAnalyseUnitDialog: Boolean; |
| | | safetyRiskAnalyseUnitForm:{ |
| | | riskCode: string | null, |
| | | riskUnitName: string | null, |
| | | liablePersonId: number | null, |
| | | liableDepId: number | null, |
| | | produceDeviceId: number | null, |
| | | }, |
| | | title: string, |
| | | userList:[], |
| | | departmentList: [], |
| | | allProduceDeviceData: [], |
| | | safetyRiskAnalyseUnitFormRules:{} |
| | | riskCode: string | null; |
| | | riskUnitName: string | null; |
| | | liablePersonId: number | null; |
| | | liableDepId: number | null; |
| | | produceDeviceId: number | null; |
| | | }; |
| | | title: string; |
| | | userList: []; |
| | | departmentList: []; |
| | | allProduceDeviceData: []; |
| | | safetyRiskAnalyseUnitFormRules: {}; |
| | | } |
| | | interface levelListState { |
| | | |
| | | } |
| | | import { reactive, toRefs, ref} from 'vue' |
| | | import { reactive, toRefs, ref } from 'vue'; |
| | | import { safetyRiskAnalyseUnitApi } from '/@/api/doublePreventSystem/safetyRiskAnalyseUnit'; |
| | | import { ElMessage } from 'element-plus'; |
| | | import { userApi } from '/@/api/user'; |
| | | export default { |
| | | name: "productionDeviceDialog", |
| | | setup(props, context) { |
| | | name: 'productionDeviceDialog', |
| | | setup(props: any, context: any) { |
| | | const safetyRiskAnalyseUnitFormRef = ref(); |
| | | const state = reactive<stateType>({ |
| | | title:'', |
| | |
| | | riskUnitName: null, |
| | | liablePersonId: null, |
| | | liableDepId: null, |
| | | produceDeviceId: null, |
| | | produceDeviceId: null |
| | | }, |
| | | safetyRiskAnalyseUnitFormRules:{ |
| | | riskCode: [ |
| | | { required: true, message: '请填写安全风险分析对象编码', trigger: 'blur' }, |
| | | ], |
| | | riskUnitName: [ |
| | | { required: true, message: '请填写安全风险分析单元名称', trigger: 'blur' }, |
| | | ], |
| | | liableDepId: [ |
| | | { required: true, message: '请选择责任部门', trigger: 'change' }, |
| | | ], |
| | | liablePersonId: [ |
| | | { required: true, message: '请选择责任人', trigger: 'change' }, |
| | | ], |
| | | produceDeviceId: [ |
| | | { required: true, message: '请选择生产装置', trigger: 'change' }, |
| | | ], |
| | | riskCode: [{ required: true, message: '请填写安全风险分析对象编码', trigger: 'blur' }], |
| | | riskUnitName: [{ required: true, message: '请填写安全风险分析单元名称', trigger: 'blur' }], |
| | | liableDepId: [{ required: true, message: '请选择责任部门', trigger: 'change' }], |
| | | liablePersonId: [{ required: true, message: '请选择责任人', trigger: 'change' }], |
| | | produceDeviceId: [{ required: true, message: '请选择生产装置', trigger: 'change' }] |
| | | } |
| | | |
| | | }); |
| | | |
| | | //打开模态框 |
| | |
| | | state.allProduceDeviceData = JSON.parse(JSON.stringify(allProduceDeviceData)); |
| | | state.departmentList = department; |
| | | setTimeout(() => { |
| | | safetyRiskAnalyseUnitFormRef.value.clearValidate() |
| | | }) |
| | | safetyRiskAnalyseUnitFormRef.value.clearValidate(); |
| | | }); |
| | | if(type === '新增'){ |
| | | state.title = '新增风险分析单元'; |
| | | state.safetyRiskAnalyseUnitForm = { |
| | |
| | | riskUnitName: null, |
| | | liablePersonId: null, |
| | | liableDepId: null, |
| | | produceDeviceId: null, |
| | | produceDeviceId: null |
| | | }; |
| | | }else{ |
| | | state.title = '修改风险分析单元'; |
| | |
| | | }else{ |
| | | ElMessage({ |
| | | type:'warning', |
| | | message:'请完善基本信息', |
| | | message: '请完善基本信息' |
| | | }); |
| | | } |
| | | }) |
| | | }); |
| | | }; |
| | | |
| | | const achiveUserList = () => { |
| | | const achieveUserList = () => { |
| | | state.safetyRiskAnalyseUnitForm.liablePersonId = null; |
| | | state.userList = []; |
| | | getUserData(); |
| | |
| | | message:res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | return{ |
| | | ...toRefs(state), |
| | | achiveUserList, |
| | | achieveUserList, |
| | | safetyRiskAnalyseUnitFormRef, |
| | | submitSafetyRiskAnalyseUnitDialog, |
| | | openSafetyRiskAnalyseUnitDialog, |
| | | openSafetyRiskAnalyseUnitDialog |
| | | }; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |