| | |
| | | <template> |
| | | <div class="system-edit-user-container"> |
| | | <el-dialog :title="titles" v-model="isShowDialog" width="50%" draggable :fullscreen="full" :close-on-click-modal="false"> |
| | | <el-dialog |
| | | :title="titles" |
| | | v-model="isShowDialog" |
| | | width="50%" |
| | | draggable |
| | | :fullscreen="full" |
| | | :close-on-click-modal="false" |
| | | @close="resetForm(ruleFormRef)" |
| | | > |
| | | <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> |
| | | <el-form ref="ruleFormRef" :model="ruleForm" size="default" label-width="120px" :disabled="disabled"> |
| | | <el-row :gutter="35"> |
| | |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="适用部门" prop="responsibleDepartment"> |
| | | <el-tree-select |
| | | v-model="ruleForm.responsibleDepartment" |
| | | :data="data" |
| | | v-model="responsibleDepartment" |
| | | :data="newTreeList" |
| | | class="w100" |
| | | clearable |
| | | :props="propse" |
| | | multiple |
| | | :render-after-expand="false" |
| | | :props="propse" |
| | | clearable |
| | | show-checkbox |
| | | check-strictly |
| | | check-on-click-node |
| | | placeholder="请选择" |
| | | check-strictly |
| | | check-on-click-node |
| | | placeholder="请选择" |
| | | @change="changeDepartment" |
| | | /> |
| | | <el-divider /> |
| | | </el-form-item> |
| | |
| | | <el-form-item label="编写部门" prop="authorDeptId"> |
| | | <el-tree-select |
| | | v-model="ruleForm.authorDeptId" |
| | | check-strictly |
| | | :data="data" |
| | | :data="newTreeList" |
| | | class="w100" |
| | | :props="propse" |
| | | clearable |
| | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="应急队伍" prop="emergencyTeam"> |
| | | <el-input v-model="ruleForm.emergencyTeam" placeholder="请选择" class="input-with-select"> |
| | | <el-input v-model="ruleForm.teamName" placeholder="请选择" class="input-with-select"> |
| | | <template #append> |
| | | <el-button :icon="Search" @click="daiInpt(0)" /> |
| | | </template> |
| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <CheckTemplate ref="Shows" @SearchUser="SearchUser" /> |
| | | <CheckTemplate ref="Shows" @SearchUser="SearchUser" /> |
| | | <DailogSearchUserManger ref="userRef" @SearchUser="onUser" /> |
| | | <RegionsDialog ref="openRef" /> |
| | | </div> |
| | |
| | | authorName: '', |
| | | authorDeptId: '', // 编写部门 |
| | | releaseDate: '', // 发布实施日期 |
| | | fileList: [ |
| | | // { |
| | | // fileUrl: 'url', |
| | | // fileName: 'name', |
| | | // }, |
| | | ], |
| | | emergencyTeam: '', //应急队伍 |
| | | fileList: [], |
| | | areaList: [], //区域列表 |
| | | teamList: [], |
| | | // teamId: '', //应急队伍 |
| | | deptList: [], |
| | | abolishStatus: false, |
| | | }); |
| | | const titles = ref(); |
| | | const disabled = ref(); |
| | |
| | | .seeEmergencyTeam(id) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ruleForm.value = res.data.data; |
| | | let arr = []; |
| | | for (let i = 0; i < ruleForm.value.teamList.length; i++) { |
| | | arr.push(ruleForm.value.teamList[i].emergencyTeam); |
| | | } |
| | | ruleForm.value.emergencyTeam = arr.toString(); |
| | | ruleForm.value = res.data.data; |
| | | ruleForm.value.teamName = '' |
| | | responsibleDepartment.value = [] |
| | | if(res.data.data.teamList){ |
| | | for(var a = 0;a<res.data.data.teamList.length;a++){ |
| | | ruleForm.value.teamName+=res.data.data.teamList[a].teamName+';' |
| | | } |
| | | } |
| | | if(res.data.data.deptList){ |
| | | for(var a = 0;a<res.data.data.deptList.length;a++){ |
| | | |
| | | responsibleDepartment.value.push(res.data.data.deptList[a].departmentId) |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | } |
| | |
| | | const releaseDate = ref(''); |
| | | // 上传附件 |
| | | const fileList = ref<UploadUserFile[]>([]); |
| | | //部门树 |
| | | const department = () => { |
| | | goalManagementApi() |
| | | //el-tree-select回显 |
| | | const propse = { |
| | | label: 'depName', |
| | | children: 'children', |
| | | }; |
| | | const newTreeList = []; |
| | | //得到部门树 |
| | | const department = async () => { |
| | | await goalManagementApi() |
| | | .getTreedepartment() |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | data.value = res.data.data; |
| | | data.value = res.data.data; |
| | | getTreeList(res.data.data, newTreeList); |
| | | } else { |
| | | ElMessage.error(res.data.msg); |
| | | } |
| | | }); |
| | | }; |
| | | const treeSelect = ref(); |
| | | // const trees = ref(); |
| | | const propse = { |
| | | label: 'depName', |
| | | children: 'children', |
| | | value: 'depId', |
| | | // 递归树状数据且修改字段名 |
| | | const getTreeList = (treeList, newTreeList) => { |
| | | treeList.map((c) => { |
| | | let tempData = { |
| | | depName: c.depName, |
| | | value: c.depId, |
| | | children: [], |
| | | }; |
| | | if (c.children && c.children.length > 0) { |
| | | tempData.children = []; |
| | | getTreeList(c.children, tempData.children); |
| | | } |
| | | newTreeList.push(tempData); |
| | | }); |
| | | }; |
| | | onMounted(() => { |
| | | department(); |
| | | }); |
| | | const changeDepartment = (e) => { |
| | | var temList = []; |
| | | for (var a = 0; a < e.length; a++) { |
| | | temList.push({ |
| | | departmentId: e[a], |
| | | }); |
| | | } |
| | | ruleForm.value.deptList = temList; |
| | | console.log(ruleForm); |
| | | }; |
| | | //定义树形下拉框 |
| | | const responsibleDepartment = ref(); |
| | | const responsibleDepartment = ref([]); |
| | | const data = ref(); |
| | | |
| | | const submitForm = async (title: string, formEl: FormInstance | undefined) => { |
| | |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | isShowDialog.value = false; |
| | | delete ruleForm.value.teamName |
| | | emergencyPlanApi() |
| | | .addEmergencyPlan(ruleForm.value) |
| | | .then((res) => { |
| | |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | isShowDialog.value = false; |
| | | emergencyPlanApi() |
| | | ruleForm.value.fileList=[] |
| | | isShowDialog.value = false; |
| | | delete ruleForm.value.teamName |
| | | emergencyPlanApi() |
| | | .editEmergencyTeam(ruleForm.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | |
| | | authorName: '', |
| | | authorDeptId: '', // 编写部门 |
| | | releaseDate: '', // 发布实施日期 |
| | | fileList: [ |
| | | // { |
| | | // fileUrl: 'url', |
| | | // fileName: 'name', |
| | | // }, |
| | | ], |
| | | emergencyTeam: '', //应急队伍 |
| | | fileList: [], |
| | | // teamId: '', //应急队伍ID |
| | | areaList: [], //区域列表 |
| | | teamList: [ |
| | | ], |
| | | teamList: [], |
| | | deptList: [], |
| | | abolishStatus: false, |
| | | }; |
| | | } |
| | | }; |
| | |
| | | isShowDialog.value = false; |
| | | if (!formEl) return; |
| | | formEl.resetFields(); |
| | | ruleForm.value = {}; |
| | | }; |
| | | // 应急队伍弹窗 |
| | | const Shows = ref(); |
| | | const daiInpt = (data: any) => { |
| | | Shows.value.openDailog(data); |
| | | Shows.value.openDailog(data); |
| | | }; |
| | | const SearchUser = (val: any) => { |
| | | let arr = []; |
| | | for (let i = 0; i < val.length; i++) { |
| | | arr.push(val[i].teamName); |
| | | ruleForm.value.teamList.push({ |
| | | userUid: val[i].uid, |
| | | emergencyTeam: val[i].teamName, |
| | | }); |
| | | } |
| | | ruleForm.value.emergencyTeam = arr.toString(); |
| | | }; |
| | | const SearchUser = (val: any) => { |
| | | let arr = []; |
| | | ruleForm.value.teamList = []; |
| | | for (let i = 0; i < val.length; i++) { |
| | | arr.push(val[i].teamName); |
| | | ruleForm.value.teamList.push({ |
| | | teamId: val[i].id, |
| | | }); |
| | | } |
| | | ruleForm.value.teamName = arr.toString(); |
| | | }; |
| | | // 选择区域弹窗 |
| | | const openRef = ref(); |
| | | const regionsDialog = () => { |
| | |
| | | data, |
| | | Search, |
| | | releaseDate, |
| | | treeSelect, |
| | | // treeSelect, |
| | | // trees, |
| | | propse, |
| | | department, |
| | | daiInpt, |
| | | Shows, |
| | | SearchUser, |
| | | SearchUser, |
| | | submitForm, |
| | | openUser, |
| | | userRef, |
| | |
| | | ruleForm, |
| | | resetForm, |
| | | onUser, |
| | | newTreeList, |
| | | changeDepartment, |
| | | }; |
| | | }, |
| | | }); |