Эх сурвалжийг харах

reactor:智能回访和明细新增导出;智能外呼任务和短信任务事件选择至少今天;

zhangchong 10 сар өмнө
parent
commit
d8c1b7e032

+ 28 - 0
src/api/smartVisit/index.ts

@@ -26,6 +26,20 @@ export const  getSmartVisitList = (params:object) => {
         params
     });
 }
+/**
+ * @description 智能回访列表导出
+ * @param {object} data
+ */
+export const  getSmartVisitExport = (data:object) => {
+    return request({
+        url: `/api/v1/Ai/aivisit/taskexport`,
+        method: 'post',
+        data,
+        responseType: 'blob',
+    },{
+        reduce_data_format:false
+    });
+}
 /**
  * @description 智能回访明细
  * @param {object} params
@@ -37,6 +51,20 @@ export const  getSmartVisitDetail = (params:object) => {
         params
     });
 }
+/**
+ * @description 智能回访明细导出
+ * @param {object} data
+ */
+export const  getSmartVisitDetailExport = (data:object) => {
+    return request({
+        url: `/api/v1/Ai/aivisit/taskdetailexport`,
+        method: 'post',
+        data,
+        responseType: 'blob',
+    },{
+        reduce_data_format:false
+    });
+}
 /**
  * @description 可进行智能回访记录
  * @param {object} params

+ 4 - 0
src/views/auxiliary/smartCallOut/components/Create-task.vue

@@ -18,6 +18,7 @@
 							end-placeholder="结束时间"
 							:shortcuts="shortcuts"
 							value-format="YYYY-MM-DD[T]HH:mm:ss"
+              :disabled-date="disabledDate"
               :default-time="defaultTimeStartEnd"
 						/>
 					</el-form-item>
@@ -116,6 +117,9 @@ const state = reactive<any>({
 	},
 	tableData: [], // 表格内容
 });
+const disabledDate = (time: Date) => {
+  return time.getTime() < Date.now() - 8.64e7// - 8.64e7是今天可以选
+}
 let loading = ref<boolean>(false); // 加载状态
 // 打开弹窗
 const ruleFormRef = ref<RefType>();

+ 4 - 0
src/views/auxiliary/smsTask/components/Create-task.vue

@@ -15,6 +15,7 @@
 							placeholder="请选择计划发送时间"
 							class="w100"
 							value-format="YYYY-MM-DD[T]HH:mm:ss"
+              :disabled-date="disabledDate"
 						/>
 					</el-form-item>
 				</el-col>
@@ -95,6 +96,9 @@ const state = reactive<any>({
 	},
 	tableData: [], // 表格内容
 });
+const disabledDate = (time: Date) => {
+  return time.getTime() < Date.now() - 8.64e7// - 8.64e7是今天可以选
+}
 let loading = ref<boolean>(false); // 加载状态
 // 打开弹窗
 const ruleFormRef = ref<RefType>();

+ 16 - 8
src/views/business/visit/component/Smart-visit-Detail.vue

@@ -16,10 +16,18 @@
 				</el-button>
 			</el-form-item>
 		</el-form>
-		<!--    	:toolButton="['refresh', 'setting', 'exportCurrent', 'exportAll']"
+
+		<ProTable
+			ref="proTableRef"
+			:columns="columns"
+			:data="state.tableData"
+			@updateTable="queryList"
+			:loading="state.loading"
+			:pagination="false"
+			:toolButton="['refresh', 'setting', 'exportCurrent', 'exportAll']"
 			@export-current="exportTable($event)"
-			@export-all="exportTable($event, true)"-->
-		<ProTable ref="proTableRef" :columns="columns" :data="state.tableData" @updateTable="queryList" :loading="state.loading" :pagination="false">
+			@export-all="exportTable($event, true)"
+		>
 			<template #title="{ row }">
 				<order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
 			</template>
@@ -70,7 +78,7 @@
 import { formatDate } from '@/utils/formatTime';
 import { FormInstance } from 'element-plus';
 import { defineAsyncComponent, reactive, ref } from 'vue';
-import { getSmartVisitBaseData, getSmartVisitDetail } from '@/api/smartVisit';
+import { getSmartVisitBaseData, getSmartVisitDetail, getSmartVisitDetailExport } from "@/api/smartVisit";
 import { downloadFileByStream } from '@/utils/tools';
 import { exportOrder } from '@/api/business/order';
 
@@ -94,7 +102,7 @@ const columns = ref<any[]>([
 	{ prop: 'order.no', label: '工单编码', width: 150 },
 	{
 		label: '标题',
-		prop: 'title',
+		prop: 'row.title',
 		width: 300,
 	},
 	{ prop: 'aiOrderVisitStateText', label: '外呼状态', width: 150 },
@@ -186,8 +194,8 @@ const queryList = async () => {
 	}
 };
 const close = () => {
-  queryParamsRef.value?.resetFields();
-  queryParamsRef.value?.resetFields();
+	queryParamsRef.value?.resetFields();
+	queryParamsRef.value?.resetFields();
 };
 // 重置所有工单列表
 const queryParamsRef = ref<RefType>();
@@ -210,7 +218,7 @@ const exportTable = (val: any, isExportAll = false) => {
 		isExportAll,
 	};
 	state.loading = true;
-	exportOrder(req)
+  getSmartVisitDetailExport(req)
 		.then((res: any) => {
 			state.loading = false;
 			downloadFileByStream(res);

+ 139 - 138
src/views/business/visit/smart.vue

@@ -5,25 +5,25 @@
 				<el-form-item label="任务名称" prop="Keyword">
 					<el-input v-model="state.queryParams.Keyword" placeholder="回访任务名称" clearable @keyup.enter="handleQuery" class="keyword-input" />
 				</el-form-item>
-        <el-form-item label="任务状态" prop="AiOrderVisitTaskState">
-          <el-select v-model="state.queryParams.AiOrderVisitTaskState" placeholder="请选择任务状态" @change="handleQuery" clearable>
-            <el-option v-for="item in aiOrderVisitTaskState" :value="item.key" :key="item.key" :label="item.value" />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="创建时间" prop="crTime">
-          <el-date-picker
-            v-model="state.queryParams.crTime"
-            type="datetimerange"
-            unlink-panels
-            range-separator="至"
-            start-placeholder="开始时间"
-            end-placeholder="结束时间"
-            :shortcuts="shortcuts"
-            @change="handleQuery"
-            value-format="YYYY-MM-DD[T]HH:mm:ss"
-            :default-time="defaultTimeStartEnd"
-          />
-        </el-form-item>
+				<el-form-item label="任务状态" prop="AiOrderVisitTaskState">
+					<el-select v-model="state.queryParams.AiOrderVisitTaskState" placeholder="请选择任务状态" @change="handleQuery" clearable>
+						<el-option v-for="item in aiOrderVisitTaskState" :value="item.key" :key="item.key" :label="item.value" />
+					</el-select>
+				</el-form-item>
+				<el-form-item label="创建时间" prop="crTime">
+					<el-date-picker
+						v-model="state.queryParams.crTime"
+						type="datetimerange"
+						unlink-panels
+						range-separator="至"
+						start-placeholder="开始时间"
+						end-placeholder="结束时间"
+						:shortcuts="shortcuts"
+						@change="handleQuery"
+						value-format="YYYY-MM-DD[T]HH:mm:ss"
+						:default-time="defaultTimeStartEnd"
+					/>
+				</el-form-item>
 				<el-form-item>
 					<el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
 					<el-button @click="resetQuery(ruleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
@@ -31,9 +31,6 @@
 			</el-form>
 		</el-card>
 		<el-card shadow="never">
-<!--       :toolButton="['refresh', 'setting', 'exportCurrent', 'exportAll']"
-        @export-current="exportTable($event)"
-        @export-all="exportTable($event, true)"-->
 			<ProTable
 				ref="proTableRef"
 				:columns="columns"
@@ -43,7 +40,9 @@
 				:total="state.total"
 				v-model:page-index="state.queryParams.PageIndex"
 				v-model:page-size="state.queryParams.PageSize"
-
+				:toolButton="['refresh', 'setting', 'exportCurrent', 'exportAll']"
+				@export-current="exportTable($event)"
+				@export-all="exportTable($event, true)"
 			>
 				<template #tableHeader="scope">
 					<el-button type="primary" @click="onAddVisit" v-auth="'business:visit:smart:add'">
@@ -63,26 +62,26 @@
 					>
 						终止任务
 					</el-button>
-          <el-button
-            link
-            type="primary"
-            v-if="[5].includes(row.taskState)"
-            @click="onStart(row)"
-            title="启动任务"
-            v-auth="'business:visit:smart:start'"
-          >
-            启动
-          </el-button>
-          <el-button
-            link
-            type="primary"
-            v-if="[1, 2].includes(row.taskState)"
-            @click="onPause(row)"
-            title="暂停任务"
-            v-auth="'business:visit:smart:pause'"
-          >
-            暂停
-          </el-button>
+					<el-button
+						link
+						type="primary"
+						v-if="[5].includes(row.taskState)"
+						@click="onStart(row)"
+						title="启动任务"
+						v-auth="'business:visit:smart:start'"
+					>
+						启动
+					</el-button>
+					<el-button
+						link
+						type="primary"
+						v-if="[1, 2].includes(row.taskState)"
+						@click="onPause(row)"
+						title="暂停任务"
+						v-auth="'business:visit:smart:pause'"
+					>
+						暂停
+					</el-button>
 				</template>
 			</ProTable>
 		</el-card>
@@ -97,12 +96,12 @@
 import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
 import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
 import { formatDate } from '@/utils/formatTime';
-import { getSmartVisitBaseData, getSmartVisitList } from "@/api/smartVisit";
-import { smartCallOutTaskPause, smartCallOutTaskStart, smartCallOutTaskStop } from "@/api/auxiliary/smartCallOut";
-import { defaultTimeStartEnd, shortcuts } from "@/utils/constants";
-import Other from "@/utils/other";
-import { downloadFileByStream } from "@/utils/tools";
-import { exportOrder } from "@/api/business/order";
+import { getSmartVisitBaseData, getSmartVisitExport, getSmartVisitList } from "@/api/smartVisit";
+import { smartCallOutTaskExport, smartCallOutTaskPause, smartCallOutTaskStart, smartCallOutTaskStop } from "@/api/auxiliary/smartCallOut";
+import { defaultTimeStartEnd, shortcuts } from '@/utils/constants';
+import Other from '@/utils/other';
+import { downloadFileByStream } from '@/utils/tools';
+import { exportOrder } from '@/api/business/order';
 
 // 引入组件
 const SmartVisitAdd = defineAsyncComponent(() => import('@/views/business/visit/component/Smart-visit-add.vue')); // 选择需要智能回访的工单
@@ -134,11 +133,11 @@ const state = reactive<any>({
 		// 查询参数
 		PageIndex: 1,
 		PageSize: 10,
-    Keyword: null,
-    AiOrderVisitTaskState:null,
-    crTime:[],
-    StartTime:null,
-    EndTime:null
+		Keyword: null,
+		AiOrderVisitTaskState: null,
+		crTime: [],
+		StartTime: null,
+		EndTime: null,
 	},
 	total: 0, // 总条数
 	tableData: [], // 表格数据
@@ -152,10 +151,10 @@ const handleQuery = () => {
 // 获取参数列表
 const queryList = () => {
 	state.loading = true;
-  let request = Other.deepClone(state.queryParams);
-  request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
-  request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
-  Reflect.deleteProperty(request, 'crTime');
+	let request = Other.deepClone(state.queryParams);
+	request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
+	request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
+	Reflect.deleteProperty(request, 'crTime');
 	getSmartVisitList(request)
 		.then((res) => {
 			state.loading = false;
@@ -169,12 +168,12 @@ const queryList = () => {
 // 页面基础数据
 const aiOrderVisitTaskState = ref([]);
 const getBaseData = async () => {
-  try {
-    const {result} = await getSmartVisitBaseData();
-    aiOrderVisitTaskState.value = result.aiOrderVisitTaskState;
-  }catch (e){
-    console.log(e);
-  }
+	try {
+		const { result } = await getSmartVisitBaseData();
+		aiOrderVisitTaskState.value = result.aiOrderVisitTaskState;
+	} catch (e) {
+		console.log(e);
+	}
 };
 // 重置表单
 const resetQuery = (formEl: FormInstance | undefined) => {
@@ -224,88 +223,90 @@ const onTermination = (row: any) => {
 };
 // 启动任务
 const onStart = (row: any) => {
-  ElMessageBox.confirm(`您确定要启动回访任务【${row.name}】吗?`, '提示', {
-    confirmButtonText: '确定',
-    cancelButtonText: '取消',
-    type: 'warning',
-    draggable: true,
-    cancelButtonClass: 'default-button',
-    autofocus: false,
-  })
-    .then(() => {
-      smartCallOutTaskStart({ id: row.id, typeId: 1 }).then(() => {
-        ElMessage({
-          type: 'success',
-          message: '启动任务成功',
-        });
-        queryList();
-        state.loading = false;
-      })
-        .catch(() => {
-          state.loading = false;
-        });
-    })
-    .catch(() => {
-      // 取消
-    });
+	ElMessageBox.confirm(`您确定要启动回访任务【${row.name}】吗?`, '提示', {
+		confirmButtonText: '确定',
+		cancelButtonText: '取消',
+		type: 'warning',
+		draggable: true,
+		cancelButtonClass: 'default-button',
+		autofocus: false,
+	})
+		.then(() => {
+			smartCallOutTaskStart({ id: row.id, typeId: 1 })
+				.then(() => {
+					ElMessage({
+						type: 'success',
+						message: '启动任务成功',
+					});
+					queryList();
+					state.loading = false;
+				})
+				.catch(() => {
+					state.loading = false;
+				});
+		})
+		.catch(() => {
+			// 取消
+		});
 };
 // 暂停任务
 const onPause = (row: any) => {
-  ElMessageBox.confirm(`您确定要暂停回访任务【${row.name}】吗?`, '提示', {
-    confirmButtonText: '确定',
-    cancelButtonText: '取消',
-    type: 'warning',
-    draggable: true,
-    cancelButtonClass: 'default-button',
-    autofocus: false,
-  })
-    .then(() => {
-      smartCallOutTaskPause({ id: row.id, typeId: 1 }).then(() => {
-        ElMessage({
-          type: 'success',
-          message: '暂停任务成功',
-        });
-        queryList();
-        state.loading = false;
-      })
-        .catch(() => {
-          state.loading = false;
-        });
-    })
-    .catch(() => {
-      // 取消
-    });
+	ElMessageBox.confirm(`您确定要暂停回访任务【${row.name}】吗?`, '提示', {
+		confirmButtonText: '确定',
+		cancelButtonText: '取消',
+		type: 'warning',
+		draggable: true,
+		cancelButtonClass: 'default-button',
+		autofocus: false,
+	})
+		.then(() => {
+			smartCallOutTaskPause({ id: row.id, typeId: 1 })
+				.then(() => {
+					ElMessage({
+						type: 'success',
+						message: '暂停任务成功',
+					});
+					queryList();
+					state.loading = false;
+				})
+				.catch(() => {
+					state.loading = false;
+				});
+		})
+		.catch(() => {
+			// 取消
+		});
 };
 // 表格导出
 const exportTable = (val: any, isExportAll = false) => {
-  let request = Other.deepClone(state.queryParams);
-  request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
-  request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
-  Reflect.deleteProperty(request, 'crTime');
-  const columnInfos = val.map((item: any) => {
-    return {
-      prop: item.prop,
-      name: item.label,
-    };
-  });
-  const req = {
-    queryDto: request,
-    columnInfos,
-    isExportAll,
-  };
-  state.loading = true;
-  exportOrder(req)
-    .then((res: any) => {
-      state.loading = false;
-      downloadFileByStream(res);
-    })
-    .catch(() => {
-      state.loading = false;
-    });
+	let request = Other.deepClone(state.queryParams);
+	request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
+	request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
+	Reflect.deleteProperty(request, 'crTime');
+	const columnInfos = val.map((item: any) => {
+		return {
+			prop: item.prop,
+			name: item.label,
+		};
+	});
+	const req = {
+		queryDto: request,
+		columnInfos,
+		isExportAll,
+	};
+	state.loading = true;
+  getSmartVisitExport(req)
+		.then((res: any) => {
+			state.loading = false;
+			downloadFileByStream(res);
+		})
+		.catch(() => {
+			state.loading = false;
+		});
 };
 // 页面加载时
 onMounted(() => {
-  getBaseData();
+	getBaseData();
 	queryList();
 });
-</script>
+</script>