|
@@ -0,0 +1,212 @@
|
|
|
+<template>
|
|
|
+ <el-dialog v-model="state.dialogVisible" width="60%" draggable title="新增推送" @close="close" append-to-body destroy-on-close>
|
|
|
+ <el-form :model="state.ruleForm" label-width="110px" ref="ruleFormRef" :disabled="loading">
|
|
|
+ <p class="border-title mb10">基本信息</p>
|
|
|
+ <el-form-item label="推送报告名称" prop="earlyWarningPushName" :rules="[{ required: true, message: '请填预推送报告名称', trigger: 'blur' }]">
|
|
|
+ <el-input v-model="state.ruleForm.earlyWarningPushName" placeholder="请填写推送报告名称" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="推送部门" prop="pushOrgs" :rules="[{ required: true, message: '请选择推送部门', trigger: 'change' }]">
|
|
|
+ <div class="w100">
|
|
|
+ <VTreeDrop
|
|
|
+ :data="orgsOptions"
|
|
|
+ checkable
|
|
|
+ keyField="id"
|
|
|
+ titleField="name"
|
|
|
+ v-model="state.ruleForm.pushOrgs"
|
|
|
+ :dropHeight="250"
|
|
|
+ dropPlaceholder="推送部门"
|
|
|
+ dropdownWidthFixed
|
|
|
+ clearable
|
|
|
+ searchPlaceholder="推送部门名称"
|
|
|
+ checkedButtonText="查看已选"
|
|
|
+ :show-footer="false"
|
|
|
+ :cascade="false"
|
|
|
+ >
|
|
|
+ </VTreeDrop>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <p class="border-title mb10 mt20">推送工单</p>
|
|
|
+ <el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent>
|
|
|
+ <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>
|
|
|
+ <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>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <vxe-table
|
|
|
+ border
|
|
|
+ :loading="state.loading"
|
|
|
+ :data="state.tableData"
|
|
|
+ :column-config="{ resizable: true }"
|
|
|
+ :row-config="{ isCurrent: true, isHover: true, height: 30, useKey: true, keyField: 'id' }"
|
|
|
+ ref="tableRef"
|
|
|
+ show-overflow
|
|
|
+ :scrollY="{ enabled: true, gt: 100 }"
|
|
|
+ showHeaderOverflow
|
|
|
+ @checkbox-all="selectAllChangeEvent"
|
|
|
+ @checkbox-change="selectChangeEvent"
|
|
|
+ max-height="500"
|
|
|
+ >
|
|
|
+ <vxe-column type="checkbox" width="60" align="center"></vxe-column>
|
|
|
+ <vxe-column field="title" title="工单标题" min-width="200">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <order-detail :order="row" @updateList="queryList">{{ row.title }}</order-detail>
|
|
|
+ </template>
|
|
|
+ </vxe-column>
|
|
|
+ <vxe-column field="no" title="工单编码"></vxe-column>
|
|
|
+ <vxe-column field="hotspotName" title="热点分类"></vxe-column>
|
|
|
+ <vxe-column field="currentStepName" title="当前节点"></vxe-column>
|
|
|
+ <vxe-column field="statusText" title="工单状态" width="160">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-text type="danger" tag="b" v-if="[1, 2, 3, 9, 101, 102, 103, 104, 105, 200].includes(row.status)">{{ row.statusText }}</el-text>
|
|
|
+ <span v-else>{{ row.statusText }}</span>
|
|
|
+ </template>
|
|
|
+ </vxe-column>
|
|
|
+ </vxe-table>
|
|
|
+ <pagination
|
|
|
+ @pagination="queryList"
|
|
|
+ :total="state.total"
|
|
|
+ v-model:current-page="state.queryParams.PageIndex"
|
|
|
+ v-model:page-size="state.queryParams.PageSize"
|
|
|
+ :disabled="state.loading"
|
|
|
+ />
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="closeDialog" class="default-button">取 消</el-button>
|
|
|
+ <el-button type="warning" @click="onSubmit(ruleFormRef, 1)" :loading="loading">暂存</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit(ruleFormRef, 3)" :loading="loading">生成报告并推送</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit(ruleFormRef, 2)" :loading="loading">推 送</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { computed, defineAsyncComponent, reactive, ref } from 'vue';
|
|
|
+import { ElMessage, FormInstance } from 'element-plus';
|
|
|
+import { throttle } from '@/utils/tools';
|
|
|
+import { addEarlySetting, getEarlySettingBaseData } from '@/api/early/setting';
|
|
|
+import { VTreeDrop } from '@wsfe/vue-tree';
|
|
|
+import { getCanUseOrg } from '@/api/system/user';
|
|
|
+
|
|
|
+// 定义子组件向父组件传值/事件
|
|
|
+const emit = defineEmits(['updateList']);
|
|
|
+
|
|
|
+const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
|
|
|
+const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
|
|
|
+
|
|
|
+// 定义变量内容
|
|
|
+const state = reactive<any>({
|
|
|
+ dialogVisible: false,
|
|
|
+ ruleForm: {
|
|
|
+ earlyWarningName: null, // 预警名称
|
|
|
+ earlyWarningLevelName: null, // 预警级别
|
|
|
+ earlyWarningLevelValue: null, // 预警级别
|
|
|
+ earlyWarningTypeName: null, // 预警类型
|
|
|
+ earlyWarningTypeValue: null, // 预警类型
|
|
|
+ frequency: null, // 频率
|
|
|
+ isEnable: true, // 是否启用
|
|
|
+ earlyWarningRemark: null, // 预警原因
|
|
|
+ },
|
|
|
+ queryParams: {
|
|
|
+ PageIndex: 1, // 当前页
|
|
|
+ PageSize: 10, // 每页条数
|
|
|
+ Keyword: null, // 关键字
|
|
|
+ },
|
|
|
+ tableData: [], // 表格数据
|
|
|
+ total: 0, // 总条数
|
|
|
+});
|
|
|
+let loading = ref<boolean>(false); // 加载状态
|
|
|
+// 打开弹窗
|
|
|
+const ruleFormRef = ref<RefType>();
|
|
|
+const openDialog = async () => {
|
|
|
+ ruleFormRef.value?.resetFields();
|
|
|
+ try {
|
|
|
+ state.dialogVisible = true;
|
|
|
+ queryBaseInfo();
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+};
|
|
|
+/** 搜索按钮操作 */
|
|
|
+const handleQuery = () => {
|
|
|
+ state.queryParams.PageIndex = 1;
|
|
|
+ queryList();
|
|
|
+};
|
|
|
+/** 重置按钮操作 */
|
|
|
+const resetQuery = (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ formEl.resetFields();
|
|
|
+ handleQuery();
|
|
|
+};
|
|
|
+const queryList = () => {};
|
|
|
+// 获取基础信息
|
|
|
+const orgsOptions = ref<EmptyArrayType>([]); // 来源单位
|
|
|
+const queryBaseInfo = () => {
|
|
|
+ getCanUseOrg().then((res: any) => {
|
|
|
+ orgsOptions.value = res.result ?? [];
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+// 关闭弹窗
|
|
|
+const closeDialog = () => {
|
|
|
+ state.dialogVisible = false;
|
|
|
+};
|
|
|
+const close = () => {
|
|
|
+ ruleFormRef.value?.resetFields();
|
|
|
+ ruleFormRef.value?.resetFields();
|
|
|
+};
|
|
|
+const tableRef = ref<RefType>();
|
|
|
+const checkTable = ref<EmptyArrayType>([]);
|
|
|
+const selectAllChangeEvent = ({ checked }) => {
|
|
|
+ if (tableRef.value) {
|
|
|
+ const records = tableRef.value.getCheckboxRecords();
|
|
|
+ checkTable.value = records;
|
|
|
+ console.log(checked ? '所有勾选事件' : '所有取消事件', records);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const selectChangeEvent = ({ checked }) => {
|
|
|
+ if (tableRef.value) {
|
|
|
+ const records = tableRef.value.getCheckboxRecords();
|
|
|
+ checkTable.value = records;
|
|
|
+ console.log(checked ? '勾选事件' : '取消事件', records);
|
|
|
+ }
|
|
|
+};
|
|
|
+const isChecked = computed(() => {
|
|
|
+ return !Boolean(checkTable.value.length);
|
|
|
+});
|
|
|
+// 新增
|
|
|
+// operateModel 操作方式 1:暂存 2:推送 3:推送并生成报告
|
|
|
+const onSubmit = throttle(async (formEl: FormInstance | undefined, operateModel: number) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ await formEl.validate((valid: boolean) => {
|
|
|
+ if (!valid) return;
|
|
|
+ loading.value = true;
|
|
|
+ const request = {
|
|
|
+ ...state.ruleForm,
|
|
|
+ };
|
|
|
+ addEarlySetting(request)
|
|
|
+ .then(() => {
|
|
|
+ ElMessage({
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ emit('updateList');
|
|
|
+ })
|
|
|
+ .catch((error) => {})
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ closeDialog();
|
|
|
+ });
|
|
|
+ });
|
|
|
+}, 300);
|
|
|
+// 暴露变量
|
|
|
+defineExpose({
|
|
|
+ openDialog,
|
|
|
+ closeDialog,
|
|
|
+});
|
|
|
+</script>
|