소스 검색

rector:重复性事件新增编辑组件抽离,工单列表新增创建重复性事件;

zhangchong 1 년 전
부모
커밋
2299a71fc2

+ 1 - 1
src/views/business/followUp/component/Assign-return-visitors.vue

@@ -71,7 +71,7 @@ const remoteMethod = (query: string) => {
       const newUsers = res.result.map((item: any) => {
         return {
           ...item,
-          name: !item.name.includes('-') ? item.name + '-' + item.organization.name : item.name,
+          name: !item.name.includes('-') ? item.name + '-' + item.organization?.name : item.name,
         };
       });
       userList.value = removeDuplicate([...newUsers, ...userList.value], 'id');

+ 14 - 313
src/views/business/order/accept/Repeat-event.vue

@@ -30,7 +30,7 @@
 				<SvgIcon name="ele-Plus" class="mr5" />创建重复事件
 			</el-button>
 		</div>
-		<el-table :data="tableData" v-loading="state.loading" max-height="300">
+		<el-table :data="state.tableData" v-loading="state.loading" max-height="300">
 			<el-table-column label="操作" width="80" fixed="left" align="center">
 				<template #default="{ row }">
 					<el-button @click="onAdd(row)" link type="primary" :title="`将当前工单${row.isDeleted ? '移除' : '添加'}重复性事件`">
@@ -57,177 +57,22 @@
 			</el-table-column>
 		</el-table>
 		<pagination :total="state.total" v-model:page="state.queryParams.PageIndex" v-model:limit="state.queryParams.PageSize" @pagination="queryList" />
-		<!--  添加重复性事件  -->
-		<el-dialog v-model="state.dialogVisible" width="50%" draggable title="新增重复性事件" @close="close" append-to-body destroy-on-close>
-			<el-form :model="state.ruleForm" label-width="80px" ref="ruleFormRef" @submit.native.prevent>
-				<el-row :gutter="10">
-					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-						<el-form-item label="标题" prop="title" :rules="[{ required: true, message: '请输入标题', trigger: 'blur' }]">
-							<el-input v-model="state.ruleForm.title" placeholder="请输入标题" clearable show-word-limit maxlength="200"></el-input>
-						</el-form-item>
-					</el-col>
-					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-						<el-form-item label="关键词" prop="dynamicTags" :rules="[{ required: true, message: '请添加关键词', trigger: 'blur' }]">
-							<el-tag
-								v-for="tag in state.ruleForm.dynamicTags"
-								:key="tag"
-								class="mr10 mb10"
-								size="large"
-								closable
-								:disable-transitions="false"
-								@close="handleClose(tag)"
-							>
-								{{ tag }}
-							</el-tag>
-							<el-input
-								v-if="inputVisible"
-								ref="InputRef"
-								v-model="inputValue"
-								@keyup.enter="handleInputConfirm"
-								@blur="handleInputConfirm"
-								style="max-width: 200px"
-								class="mb10"
-                placeholder="关键词内容"
-							/>
-							<el-button v-else @click="showInput" class="mb10"> 添加关键词 </el-button>
-						</el-form-item>
-					</el-col>
-				</el-row>
-			</el-form>
-			<el-divider content-position="left"><span class="font16"> 重复事件工单 </span></el-divider>
-			<div class="mb10">
-				<el-button type="primary" @click="onAddRepeatTable">添加 </el-button>
-				<el-button type="primary" @click="onRemoveRepeatTable" :disabled="!multipleSelection.length">移除 </el-button>
-			</div>
-			<el-table :data="state.repeatTable" v-loading="state.loading" row-key="id" @selection-change="handleSelectionChange" ref="multipleTableRef">
-				<el-table-column type="selection" label="" width="55" :reserve-selection="true" />
-				<el-table-column prop="no" label="工单编码" show-overflow-tooltip width="150"></el-table-column>
-				<el-table-column width="100" label="省/市工单" prop="isProvince">
-					<template #default="{ row }">
-						<span>{{ row.isProvince ? '省工单' : '市工单' }}</span>
-					</template>
-				</el-table-column>
-				<el-table-column prop="currentStepName" label="当前办理节点" show-overflow-tooltip width="150"></el-table-column>
-				<el-table-column label="工单状态" show-overflow-tooltip width="100" prop="statusText"></el-table-column>
-				<el-table-column label="标题" show-overflow-tooltip width="300">
-					<template #default="{ row }">
-						<span class="color-primary">{{ row.title }}</span>
-					</template>
-				</el-table-column>
-				<el-table-column prop="startTime" label="受理时间" show-overflow-tooltip width="170">
-					<template #default="{ row }">
-						<span>{{ formatDate(row.startTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
-					</template>
-				</el-table-column>
-				<el-table-column prop="expiredTime" label="工单期满时间" show-overflow-tooltip width="170">
-					<template #default="{ row }">
-						<span>{{ formatDate(row.expiredTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
-					</template>
-				</el-table-column>
-				<el-table-column prop="actualHandleOrgName" label="接办部门" show-overflow-tooltip width="170"></el-table-column>
-				<el-table-column prop="acceptType" label="受理类型" show-overflow-tooltip width="150"></el-table-column>
-				<el-table-column label="紧急程度" show-overflow-tooltip prop="emergencyLevelText" width="100"></el-table-column>
-				<el-table-column prop="sourceChannel" label="来源方式" show-overflow-tooltip></el-table-column>
-				<el-table-column prop="employeeName" label="受理人" show-overflow-tooltip width="120">
-					<template #default="{ row }">
-						<span
-							>{{ row.acceptorName }} <span v-if="row.acceptorStaffNo">[{{ row.acceptorStaffNo }}]</span>
-						</span>
-					</template>
-				</el-table-column>
-			</el-table>
-
-			<!--   从所有工单重选择重复   -->
-			<el-dialog v-model="state.dialogVisibleAllTable" width="50%" draggable title="选择重复事件工单" append-to-body destroy-on-close>
-				<el-form :model="state.queryParamsAll" ref="queryParamsAllRef" :inline="true" @submit.native.prevent>
-					<el-form-item label="关键词" prop="Keyword">
-						<el-input v-model="state.queryParamsAll.Keyword" placeholder="工单标题/工单编码" clearable @keyup.enter="queryListAll" />
-					</el-form-item>
-					<el-form-item>
-						<el-button type="primary" @click="queryListAll" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
-						<el-button @click="resetQueryAll(queryParamsAllRef)" :loading="state.loading" class="default-button">
-							<SvgIcon name="ele-Refresh" class="mr5" />重置
-						</el-button>
-					</el-form-item>
-				</el-form>
-				<el-table
-					:data="state.allTable"
-					v-loading="state.loading"
-					row-key="id"
-					@selection-change="handleSelectionChangeAll"
-					ref="multipleTableAllRef"
-				>
-					<el-table-column type="selection" label="" width="55" :reserve-selection="true" />
-					<el-table-column prop="no" label="工单编码" show-overflow-tooltip width="150"></el-table-column>
-					<el-table-column width="100" label="省/市工单" prop="isProvince">
-						<template #default="{ row }">
-							<span>{{ row.isProvince ? '省工单' : '市工单' }}</span>
-						</template>
-					</el-table-column>
-					<el-table-column prop="currentStepName" label="当前办理节点" show-overflow-tooltip width="150"></el-table-column>
-					<el-table-column label="工单状态" show-overflow-tooltip width="100" prop="statusText"></el-table-column>
-					<el-table-column label="标题" show-overflow-tooltip width="300">
-						<template #default="{ row }">
-							<span class="color-primary">{{ row.title }}</span>
-						</template>
-					</el-table-column>
-					<el-table-column prop="startTime" label="受理时间" show-overflow-tooltip width="170">
-						<template #default="{ row }">
-							<span>{{ formatDate(row.startTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
-						</template>
-					</el-table-column>
-					<el-table-column prop="expiredTime" label="工单期满时间" show-overflow-tooltip width="170">
-						<template #default="{ row }">
-							<span>{{ formatDate(row.expiredTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
-						</template>
-					</el-table-column>
-					<el-table-column prop="actualHandleOrgName" label="接办部门" show-overflow-tooltip width="170"></el-table-column>
-					<el-table-column prop="acceptType" label="受理类型" show-overflow-tooltip width="150"></el-table-column>
-					<el-table-column label="紧急程度" show-overflow-tooltip prop="emergencyLevelText" width="100"></el-table-column>
-					<el-table-column prop="sourceChannel" label="来源方式" show-overflow-tooltip></el-table-column>
-					<el-table-column prop="employeeName" label="受理人" show-overflow-tooltip width="120">
-						<template #default="{ row }">
-							<span
-								>{{ row.acceptorName }} <span v-if="row.acceptorStaffNo">[{{ row.acceptorStaffNo }}]</span>
-							</span>
-						</template>
-					</el-table-column>
-				</el-table>
-				<!-- 分页 -->
-				<pagination
-					:total="state.totalAll"
-					v-model:page="state.queryParamsAll.PageIndex"
-					v-model:limit="state.queryParamsAll.PageSize"
-					@pagination="queryListAll"
-				/>
-				<template #footer>
-					<span class="dialog-footer">
-						<el-button @click="state.dialogVisibleAllTable = false" class="default-button">取 消</el-button>
-						<el-button type="primary" @click="onSubmitAll" :loading="state.loading" :disabled="!multipleSelectionAll.length">确 定</el-button>
-					</span>
-				</template>
-			</el-dialog>
-			<template #footer>
-				<span class="dialog-footer">
-					<el-button @click="state.dialogVisible = false" class="default-button">取 消</el-button>
-					<el-button type="primary" @click="onSubmit(ruleFormRef)" :loading="state.loading">确 定</el-button>
-				</span>
-			</template>
-		</el-dialog>
+    <!-- 编辑重复性事件 -->
+    <repeat-event-edit ref="repeatEventEditRef" @updateList="queryList" />
 	</div>
 </template>
 <script setup lang="ts" name="orderAcceptRepeatEvent">
-import {nextTick, onMounted, reactive, ref, watch, watchEffect} from 'vue';
-import { ElButton, ElInput, ElMessage, ElMessageBox, FormInstance } from 'element-plus';
+import {defineAsyncComponent, onMounted, reactive, ref, watch} from 'vue';
+import { ElButton, ElInput, ElMessage, FormInstance } from 'element-plus';
 import { shortcuts } from '/@/utils/constants';
 import { throttle } from '/@/utils/tools';
 import dayjs from 'dayjs';
-import { repeatEventAdd, repeatEventList } from '/@/api/business/repeatEvent';
+import { repeatEventList } from '/@/api/business/repeatEvent';
 import { auth } from '/@/utils/authFunction';
 import { formatDate } from '/@/utils/formatTime';
-import { orderList } from '/@/api/business/order';
-import { removeDuplicate } from '/@/utils/arrayOperation';
-import other from "/@/utils/other";
+// 引入组件
+const RepeatEventEdit = defineAsyncComponent(() => import('/@/views/business/repeatEvent/components/Repeat-event-edit.vue')); // 编辑重复性事件
+
 const emit = defineEmits(['orderAddRepeat']);
 const props = defineProps({
   repeatIds: {
@@ -246,45 +91,9 @@ const state = reactive<any>({
 		exTime: [dayjs().startOf('day').format('YYYY-MM-DD[T]HH:mm:ss'), dayjs().endOf('day').format('YYYY-MM-DD[T]HH:mm:ss')], // 创建时间
 	},
 	loading: false, // 加载
+  tableData:<EmptyArrayType>[],
 	total: 0, // 总数
-	dialogVisible: false, // 弹窗
-	ruleForm: {
-    dynamicTags:<EmptyArrayType>[]
-  },
-	repeatTable: [], // 重复事件工单
-	dialogVisibleAllTable: false, // 全部工单 重复事件工单弹窗
-	allTable: [], // 全部工单
-	totalAll: 0,
-	queryParamsAll: {
-		PageIndex: 1,
-		PageSize: 10,
-		Keyword: '', // 关键字
-	},
 });
-const tableData = ref<EmptyArrayType>([]);
-
-const inputValue = ref('');
-const inputVisible = ref(false);
-const InputRef = ref<InstanceType<typeof ElInput>>();
-// 删除同义词
-const handleClose = (tag: string) => {
-	state.ruleForm.dynamicTags.splice(state.ruleForm.dynamicTags.indexOf(tag), 1);
-};
-// 展示输入框
-const showInput = () => {
-	inputVisible.value = true;
-	nextTick(() => {
-		InputRef.value!.input!.focus();
-	});
-};
-// 确定添加
-const handleInputConfirm = () => {
-	if (inputValue.value) {
-    state.ruleForm.dynamicTags.push(inputValue.value);
-	}
-	inputVisible.value = false;
-	inputValue.value = '';
-};
 
 const queryParamsRef = ref<RefType>(); // 查询参数
 const handleTimeChange = (val: string[], startKey: string, endKey: string) => {
@@ -322,7 +131,7 @@ const queryList = () => {
 		repeatEventList(request)
 			.then((res: any) => {
 				state.loading = false;
-        tableData.value = res.result.items ?? [];
+        state.tableData = res.result.items ?? [];
 				state.total = res.result.total ?? 0;
 			})
 			.finally(() => {
@@ -336,123 +145,15 @@ const onAdd = (row: any) => {
 	emit('orderAddRepeat', row);
 };
 // 创建重复事件
+const repeatEventEditRef = ref<RefType>();
 const onCreate = () => {
-	state.dialogVisible = true;
+  repeatEventEditRef.value.openDialog();
 };
-// 打开所有工单列表选择重复工单
-const onAddRepeatTable = () => {
-	queryListAll();
-	state.dialogVisibleAllTable = true;
-};
-// 获取所有工单列表
-const queryListAll = async () => {
-	try {
-		state.loading = true;
-		const res = await orderList(state.queryParamsAll);
-		state.allTable = res.result.items ?? [];
-		state.totalAll = res.result.total ?? 0;
-		state.loading = false;
-	} catch (e) {
-		console.log(e);
-		state.loading = false;
-	}
-};
-// 重置所有工单列表
-const queryParamsAllRef = ref<RefType>();
-const resetQueryAll = (formEl: FormInstance | undefined) => {
-	if (!formEl) return;
-	formEl.resetFields();
-	queryListAll();
-};
-const multipleSelection = ref<EmptyArrayType>([]); // 重复件表格选中项
-const multipleTableRef = ref<RefType>(); // 重复件表格ref
-const handleSelectionChange = (row: any) => {
-	multipleSelection.value = row;
-};
-const multipleSelectionAll = ref<EmptyArrayType>([]); // 所有工单表格选中项
-const multipleTableAllRef = ref<RefType>(); // 所有工单表格ref
-const handleSelectionChangeAll = (row: any) => {
-	multipleSelectionAll.value = row;
-};
-// 确定选择所有工单到重复工单
-const onSubmitAll = () => {
-	state.dialogVisibleAllTable = false;
-	state.repeatTable = removeDuplicate([...state.repeatTable, ...multipleSelectionAll.value], 'id'); // 添加时去重
-	multipleSelectionAll.value = [];
-	multipleTableAllRef.value!.clearSelection();
-};
-// 删除重复工单
-const onRemoveRepeatTable = () => {
-	const title = multipleSelection.value.map((item: any) => item.title);
-	ElMessageBox.confirm(`您确定要删除:【${title}】,是否继续?`, '提示', {
-		confirmButtonText: '确认',
-		cancelButtonText: '取消',
-		type: 'warning',
-		draggable: true,
-		cancelButtonClass: 'default-button',
-		autofocus: false,
-	})
-		.then(() => {
-			multipleSelection.value.forEach((item1: any) => {
-				state.repeatTable.forEach((item: any, index: number) => {
-					if (item.id === item1.id) {
-						multipleTableRef.value!.toggleRowSelection(item, undefined);
-						state.repeatTable.splice(index, 1);
-					}
-				});
-			});
-		})
-		.catch(() => {});
-};
-const ruleFormRef = ref<RefType>();
-const close = () => {
-	ruleFormRef.value.clearValidate();
-	ruleFormRef.value.resetFields();
-	state.repeatTable = [];
-	multipleSelection.value = [];
-};
-// 创建重复性事件保存
-const onSubmit = throttle(async (formEl: FormInstance | undefined) => {
-	if (!formEl) return;
-	await formEl.validate((valid: boolean) => {
-		if (!valid) return;
-    if(state.repeatTable.length === 0){
-      ElMessage.warning('请选择重复事件工单!');
-      return;
-    }
-		state.loading = true;
-		const details = state.repeatTable.map((item: any) => {
-			return {
-				orderNo: item.no,
-				orderId: item.id,
-			};
-		});
-		const request = {
-			...state.ruleForm,
-			keyWords: state.ruleForm.dynamicTags.join(','),
-			details,
-		};
-		repeatEventAdd(request)
-			.then(() => {
-				ElMessage({
-					message: '操作成功',
-					type: 'success',
-				});
-				queryList();
-				state.dialogVisible = false;
-			})
-			.catch((error) => {})
-			.finally(() => {
-				state.loading = false;
-				state.dialogVisible = false;
-			});
-	});
-}, 300);
 onMounted(()=>{
   queryList();
 })
 const stopWatch = watch(()=>props.repeatIds,(newVal:any)=>{
-  tableData.value.forEach((item:any)=>{
+  state.tableData.forEach((item:any)=>{
     newVal.forEach((_:any)=>{
       if(_.repeatableId === item.id){
         item.isDeleted = true;// 检测是否已经添加了重复事件

+ 16 - 5
src/views/business/order/index.vue

@@ -174,6 +174,9 @@
 			<!-- 功能按钮 -->
 			<div class="mb20">
 				<el-button type="primary" @click="onAddWorkOrder" v-auth="'business:order:add'"> <SvgIcon name="ele-Plus" class="mr5" />新建工单 </el-button>
+				<el-button type="primary" @click="onCreateRepeatEvent" v-auth="'business:repeatEvent:add'">
+					<SvgIcon name="ele-Plus" class="mr5" /> 创建重复性事件
+				</el-button>
 				<el-button type="primary" @click="onExport" v-auth="'business:order:export'" :disabled="!multipleSelection.length">
 					<SvgIcon name="iconfont icon-daochu" class="mr5" />导出
 				</el-button>
@@ -261,6 +264,8 @@
 		</el-card>
 		<!-- 工单详情 -->
 		<order-detail ref="OrderDetailRef" @updateList="queryList" />
+    <!-- 编辑重复性事件 -->
+    <repeat-event-edit ref="repeatEventEditRef" @updateList="queryList" />
 	</div>
 </template>
 <script setup lang="ts" name="order">
@@ -277,6 +282,7 @@ import { listBaseData, orderList, hotSpotType } from '/@/api/business/order';
 
 // 引入组件
 const OrderDetail = defineAsyncComponent(() => import('/@/views/business/order/components/Order-detail.vue')); // 工单详情
+const RepeatEventEdit = defineAsyncComponent(() => import('/@/views/business/repeatEvent/components/Repeat-event-edit.vue')); // 编辑重复性事件
 
 // 定义变量内容
 const state = reactive(<any>{
@@ -407,11 +413,6 @@ const resetQuery = throttle((formEl: FormInstance | undefined) => {
 	state.queryParams.ExpiredTimeStart = '';
 	queryList();
 }, 300);
-// 新增工单
-const onAddWorkOrder = () => {
-	// 跳转到录入工单页面
-	router.push('/business/order/accept');
-};
 // 表格多选
 const multipleTableRef = ref<RefType>();
 const multipleSelection = ref<any>([]);
@@ -427,6 +428,16 @@ const OrderDetailRef = ref<RefType>();
 const onOrderDetail = (row: any) => {
 	OrderDetailRef.value.openDialog(row);
 };
+// 新增工单
+const onAddWorkOrder = () => {
+  // 跳转到录入工单页面
+  router.push('/business/order/accept');
+};
+// 创建重复性事件
+const repeatEventEditRef = ref<RefType>();
+const onCreateRepeatEvent = ()=>{
+  repeatEventEditRef.value.openDialog();
+}
 // 编辑工单
 const onOrderEdit = (row: any) => {
 	router.push({

+ 30 - 32
src/views/business/publish/component/Order-publish-edit.vue

@@ -87,13 +87,13 @@
 					</el-col>
 					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
 						<el-form-item label="实际办理部门">
-              {{ state.publishDetail.actualHandleOrgName?.value }}
+							{{ state.publishDetail.actualHandleOrgName?.value }}
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" v-if="idNamesArray.length">
 						<el-form-item label="需回访部门" prop="checkList" :rules="[{ required: false, message: '请选择需回访部门', trigger: 'blur' }]">
 							<el-checkbox-group v-model="state.ruleForm.idNames" disabled>
-                <el-checkbox :label="item" v-for="item in idNamesArray" :key="item.id">{{ item.name }}</el-checkbox>
+								<el-checkbox :label="item" v-for="item in idNamesArray" :key="item.id">{{ item.name }}</el-checkbox>
 							</el-checkbox-group>
 						</el-form-item>
 					</el-col>
@@ -120,7 +120,7 @@ const state = reactive<any>({
 	dialogVisible: false, // 是否显示弹窗
 	loading: false, // 是否显示加载
 	ruleForm: {
-    arrangeTitle: '', // 整改后标题
+		arrangeTitle: '', // 整改后标题
 		arrangeContent: '', // 整改后内容
 		arrangeOpinion: '', // 整改后结果
 	},
@@ -130,27 +130,25 @@ const state = reactive<any>({
 const ruleFormRef = ref<RefType>(); // 表单ref
 const idNamesArray = ref<EmptyArrayType>(); // 部门列表
 const dialogTitle = ref<string>('发布详情'); // 弹窗标题
-const getBaseData = async (id: string) => {
-	try {
-		const res = await baseData(id);
-		state.publishDetail = res.result ?? {};
-    idNamesArray.value = res.result?.idNames ?? [];
-	} catch (error) {
-		console.log(error);
-	}
-};
 /*
  * @param row 工单详情
  * @description 打开弹窗
  * */
 const openDialog = async (row: any) => {
-	state.orderDetail = row.order ?? {};
-	await getBaseData(state.orderDetail.id);
-	const response = await publishOrderDetail(row.id);
-  idNamesArray.value = response.result?.idNames ?? [];
-	state.ruleForm = response.result ?? {};
-	state.loading = false;
-	state.dialogVisible = true;
+	state.loading = true;
+	try {
+		state.orderDetail = row.order ?? {};
+		const [res, response] = await Promise.all([baseData(row.order.id), publishOrderDetail(row.id)]);
+		state.ruleForm = response.result ?? {};
+
+		state.publishDetail = res.result ?? {};
+		idNamesArray.value = res.result?.idNames ?? [];
+		state.loading = false;
+		state.dialogVisible = true;
+	} catch (e) {
+		state.loading = false;
+		console.log(e);
+	}
 };
 // 关闭弹窗
 const closeDialog = () => {
@@ -164,19 +162,19 @@ const close = () => {
 const onPublish = (formEl: FormInstance | undefined) => {
 	if (!formEl) return;
 	formEl.validate((valid: boolean) => {
-			if (!valid) return;
-			state.loading = true;
-			publishOrderUpdate(state.ruleForm)
-				.then((res: any) => {
-					ElMessage.success('操作成功');
-					state.loading = false;
-					closeDialog();
-					emit('updateList');
-				})
-				.catch(() => {
-					state.loading = false;
-				});
-		})
+		if (!valid) return;
+		state.loading = true;
+		publishOrderUpdate(state.ruleForm)
+			.then((res: any) => {
+				ElMessage.success('操作成功');
+				state.loading = false;
+				closeDialog();
+				emit('updateList');
+			})
+			.catch(() => {
+				state.loading = false;
+			});
+	});
 };
 defineExpose({
 	openDialog,

+ 44 - 41
src/views/business/publish/component/Order-publish.vue

@@ -90,7 +90,7 @@
 					</el-col>
 					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
 						<el-form-item label="实际办理部门">
-              <el-checkbox :label="state.publishDetail.actualHandleOrgName">{{ state.publishDetail.actualHandleOrgName?.value }}</el-checkbox>
+							<el-checkbox :label="state.publishDetail.actualHandleOrgName">{{ state.publishDetail.actualHandleOrgName?.value }}</el-checkbox>
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
@@ -143,15 +143,6 @@ const ruleFormRef = ref<RefType>(); // 表单ref
 const idNames = ref<EmptyArrayType>(); // 部门列表
 const disabled = ref<boolean>(false); //是否查看详情
 const dialogTitle = ref<string>('发布详情'); // 弹窗标题
-const getBaseData = async (id: string) => {
-	try {
-		const res = await baseData(id);
-		state.publishDetail = res.result ?? {};
-		idNames.value = res.result?.idNames ?? [];
-	} catch (error) {
-		console.log(error);
-	}
-};
 /*
  * @param row 工单详情
  * @param isDisabled 是否查看详情
@@ -159,20 +150,32 @@ const getBaseData = async (id: string) => {
  * */
 const openDialog = async (row: any, isDisabled: boolean = false) => {
 	disabled.value = isDisabled;
-	if (isDisabled) {
-		state.orderDetail = row.order ?? {};
-		await getBaseData(state.orderDetail.id);
-		const response = await publishOrderDetail(row.id);
-    idNames.value = response.result?.idNames ?? [];
-		state.ruleForm = response.result ?? {};
-		dialogTitle.value = '发布详情';
-	} else {
-		state.orderDetail = row ?? {};
-		await getBaseData(state.orderDetail.id);
-		dialogTitle.value = '工单发布';
+	state.loading = true;
+	try {
+		if (isDisabled) {
+			state.orderDetail = row.order ?? {};
+			const [response, res] = await Promise.all([publishOrderDetail(row.id), baseData(state.orderDetail.id)]);
+			state.ruleForm = response.result ?? {};
+
+			state.publishDetail = res.result ?? {};
+			idNames.value = res.result?.idNames ?? [];
+
+			dialogTitle.value = '发布详情';
+			state.loading = false;
+			state.dialogVisible = true;
+		} else {
+			state.orderDetail = row ?? {};
+			const res = await baseData(state.orderDetail.id);
+			state.publishDetail = res.result ?? {};
+			idNames.value = res.result?.idNames ?? [];
+			dialogTitle.value = '工单发布';
+			state.loading = false;
+			state.dialogVisible = true;
+		}
+	} catch (e) {
+		console.log(e);
+    state.loading = false;
 	}
-	state.loading = false;
-	state.dialogVisible = true;
 };
 // 关闭弹窗
 const closeDialog = () => {
@@ -186,24 +189,24 @@ const close = () => {
 const onPublish = (formEl: FormInstance | undefined) => {
 	if (!formEl) return;
 	formEl.validate((valid: boolean) => {
-    if (!valid) return;
-			state.loading = true;
-			let request = {
-				...state.ruleForm,
-        idNames:[...state.ruleForm.idNames,{id:state.publishDetail.actualHandleOrgName.id,name:state.publishDetail.actualHandleOrgName.name}],
-				id: state.orderDetail.id,
-			};
-			publishOrder(request)
-				.then((res: any) => {
-					ElMessage.success('操作成功');
-					state.loading = false;
-					closeDialog();
-					emit('updateList');
-				})
-				.catch(() => {
-					state.loading = false;
-				});
-		})
+		if (!valid) return;
+		state.loading = true;
+		let request = {
+			...state.ruleForm,
+			idNames: [...state.ruleForm.idNames, { id: state.publishDetail.actualHandleOrgName.id, name: state.publishDetail.actualHandleOrgName.name }],
+			id: state.orderDetail.id,
+		};
+		publishOrder(request)
+			.then((res: any) => {
+				ElMessage.success('操作成功');
+				state.loading = false;
+				closeDialog();
+				emit('updateList');
+			})
+			.catch(() => {
+				state.loading = false;
+			});
+	});
 };
 defineExpose({
 	openDialog,

+ 41 - 19
src/views/business/repeatEvent/components/Repeat-event-edit.vue

@@ -1,7 +1,5 @@
-
-
 <template>
-  <el-dialog v-model="state.dialogVisible" width="50%" draggable title="新增重复性事件" @close="close" append-to-body destroy-on-close>
+  <el-dialog v-model="state.dialogVisible" width="50%" draggable :title="dialogTitle" @close="close" append-to-body destroy-on-close>
     <el-form :model="state.ruleForm" label-width="80px" ref="ruleFormRef">
       <el-row :gutter="10">
         <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
@@ -164,7 +162,7 @@ import dayjs from "dayjs";
 import {ElInput, ElMessage, FormInstance ,ElMessageBox} from "element-plus";
 import { removeDuplicate } from '/@/utils/arrayOperation';
 import { orderList } from '/@/api/business/order';
-import {repeatEventDetail, repeatEventUpdate} from "/@/api/business/repeatEvent";
+import {repeatEventAdd, repeatEventDetail, repeatEventUpdate} from "/@/api/business/repeatEvent";
 import { throttle } from '/@/utils/tools';
 
 const emit = defineEmits(['updateList']);
@@ -218,8 +216,15 @@ const handleInputConfirm = () => {
   inputValue.value = '';
 };
 // 创建重复事件
-const openDialog = (row:any) => {
-  getDetail(row)
+const dialogTitle = ref<String>('创建重复性事件');
+const openDialog = (row?:any) => {
+  if(row) {
+    dialogTitle.value = '编辑重复性事件';
+    getDetail(row)
+  }else{
+    dialogTitle.value = '创建重复性事件';
+    state.dialogVisible = true;
+  }
 };
 // 查询详情
 const getDetail = async (row:any)=>{
@@ -324,20 +329,37 @@ const onSubmit = throttle(async (formEl: FormInstance | undefined) => {
       keyWords: dynamicTags.value.join(','),
       details,
     };
-    repeatEventUpdate(request)
-        .then(() => {
-          ElMessage({
-            message: '操作成功',
-            type: 'success',
+    if(dialogTitle.value === '创建重复性事件'){
+      repeatEventAdd(request)
+          .then(() => {
+            ElMessage({
+              message: '操作成功',
+              type: 'success',
+            });
+            emit('updateList')
+            state.dialogVisible = false;
+          })
+          .catch((error) => {})
+          .finally(() => {
+            state.loading = false;
+            state.dialogVisible = false;
           });
-          emit('updateList')
-          state.dialogVisible = false;
-        })
-        .catch((error) => {})
-        .finally(() => {
-          state.loading = false;
-          state.dialogVisible = false;
-        });
+    }else{
+      repeatEventUpdate(request)
+          .then(() => {
+            ElMessage({
+              message: '操作成功',
+              type: 'success',
+            });
+            emit('updateList')
+            state.dialogVisible = false;
+          })
+          .catch((error) => {})
+          .finally(() => {
+            state.loading = false;
+            state.dialogVisible = false;
+          });
+    }
   });
 }, 300);
 defineExpose({