| | |
| | | <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> |
| | | <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> |
| | | <el-tab-pane label="应急队伍人员" name="first" > |
| | | <el-button type="primary" size="default" @click="onAddEmergencyPersonnel" :disabled="disabled">新增 |
| | | <el-button type="primary" size="default" @click="onAddEmergencyPersonnel(ruleFormRef)" :disabled="disabled">新增 |
| | | </el-button> |
| | | <el-table |
| | | :data="tableData" |
| | |
| | | }); |
| | | const titles = ref(); |
| | | const disabled = ref(); |
| | | const peopleInsertBtn = ref(false) |
| | | const teamId = ref() |
| | | // 打开弹窗 |
| | | const openDialog = (title: string, id: number, type: boolean) => { |
| | |
| | | titles.value = title; |
| | | disabled.value = type; |
| | | teamId.value = id |
| | | //如果是新增 无法添加人员 |
| | | if(title == '新建应急队伍管理'){ |
| | | peopleInsertBtn.value = true |
| | | }else{ |
| | | peopleInsertBtn.value = false |
| | | } |
| | | if (title == '查看应急队伍管理' || title == '修改应急队伍管理') { |
| | | contingencyApi() |
| | | .seeEmergencyTeam(id) |
| | |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | isShowDialog.value = false; |
| | | contingencyApi() |
| | | .addEmergencyTeam(ruleForm.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | emit('myAdd', true); |
| | | } else { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'error', |
| | | }); |
| | | emit('myAdd', true); |
| | | } |
| | | formEl.resetFields(); |
| | | if(teamId.value==null||teamId.value==''){ |
| | | contingencyApi() |
| | | .addEmergencyTeam(ruleForm.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | emit('myAdd', true); |
| | | } else { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'error', |
| | | }); |
| | | emit('myAdd', true); |
| | | } |
| | | formEl.resetFields(); |
| | | }); |
| | | }else { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: '添加成功', |
| | | type: 'success', |
| | | }); |
| | | emit('myAdd', true); |
| | | } |
| | | } else { |
| | | console.log('error submit!', fields); |
| | | } |
| | |
| | | const tableData = ref([]); |
| | | //添加队伍负责人弹窗 |
| | | const addRef = ref(); |
| | | const onAddEmergencyPersonnel = () => { |
| | | //未添加队伍 无法修改人员 |
| | | if(peopleInsertBtn.value == true){ |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: '请先添加应急队伍', |
| | | type: 'warning', |
| | | }); |
| | | }else { |
| | | addRef.value.openDialog('新建应急队伍人员','',teamId.value); |
| | | const onAddEmergencyPersonnel = async (formEl: FormInstance | undefined) => { |
| | | if(!ruleForm.value.fileList){ |
| | | ruleForm.value.fileList = [] |
| | | } |
| | | if (!formEl) return; |
| | | await formEl.validate((valid, fields) => { |
| | | if (valid) { |
| | | // isShowDialog.value = false; |
| | | if(teamId.value == ''||teamId.value==null){ |
| | | ElMessageBox.confirm('确认添加此应急队伍?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | contingencyApi() |
| | | .addEmergencyTeam(ruleForm.value) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | teamId.value = res.data.data.id |
| | | addRef.value.openDialog('新建应急队伍人员','',teamId.value); |
| | | } else { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'error', |
| | | }); |
| | | } |
| | | }); |
| | | }) |
| | | .catch(() => {}); |
| | | |
| | | }else { |
| | | addRef.value.openDialog('新建应急队伍人员','',teamId.value); |
| | | } |
| | | |
| | | |
| | | } else { |
| | | console.log('error submit!', fields); |
| | | } |
| | | }); |
| | | }; |
| | | // 请求列表数据 |
| | | const listApi = async () => { |
| | |
| | | onEdit, |
| | | onRowDel, |
| | | department, |
| | | peopleInsertBtn, |
| | | teamId, |
| | | newTreeList, |
| | | successUploader, |