From 17600f41d7c3f6c28cc5393dbb4d3d7e82eccad6 Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期四, 25 八月 2022 09:54:47 +0800
Subject: [PATCH] conflict
---
src/views/contingencyManagement/contingency/component/openAdd.vue | 112 +++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 74 insertions(+), 38 deletions(-)
diff --git a/src/views/contingencyManagement/contingency/component/openAdd.vue b/src/views/contingencyManagement/contingency/component/openAdd.vue
index a36d5c7..2d9e986 100644
--- a/src/views/contingencyManagement/contingency/component/openAdd.vue
+++ b/src/views/contingencyManagement/contingency/component/openAdd.vue
@@ -62,7 +62,7 @@
<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"
@@ -161,7 +161,6 @@
});
const titles = ref();
const disabled = ref();
- const peopleInsertBtn = ref(false)
const teamId = ref()
// 打开弹窗
const openDialog = (title: string, id: number, type: boolean) => {
@@ -169,12 +168,6 @@
titles.value = title;
disabled.value = type;
teamId.value = id
- //如果是新增 无法添加人员
- if(title == '新建应急队伍管理'){
- peopleInsertBtn.value = true
- }else{
- peopleInsertBtn.value = false
- }
if (title == '查看应急队伍管理' || title == '修改应急队伍管理') {
contingencyApi()
.seeEmergencyTeam(id)
@@ -334,26 +327,35 @@
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);
}
@@ -413,17 +415,52 @@
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 () => {
@@ -508,7 +545,6 @@
onEdit,
onRowDel,
department,
- peopleInsertBtn,
teamId,
newTreeList,
successUploader,
--
Gitblit v1.9.2