|
@@ -1,6 +1,6 @@
|
|
|
<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">
|
|
|
+ <el-form :model="state.ruleForm" label-width="110px" ref="ruleFormRef" :disabled="gridOptions.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>
|
|
@@ -25,67 +25,28 @@
|
|
|
</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>
|
|
|
+ <p class="border-title mb10 mt20">推送工单</p>
|
|
|
+ <vxe-grid v-bind="gridOptions">
|
|
|
+ <template #toolbar_buttons>
|
|
|
+ <el-button type="primary" @click="selectOrders">选择工单</el-button>
|
|
|
+ </template>
|
|
|
+ </vxe-grid>
|
|
|
<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>
|
|
|
+ <el-button type="warning" @click="onSubmit(ruleFormRef, 1)" :loading="gridOptions.loading">暂存</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit(ruleFormRef, 3)" :loading="gridOptions.loading">生成报告并推送</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit(ruleFormRef, 2)" :loading="gridOptions.loading">推 送</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
+ <!-- 选择工单 -->
|
|
|
+ <push-select ref="pushSelectRef" />
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
-<script setup lang="ts">
|
|
|
-import { computed, defineAsyncComponent, reactive, ref } from 'vue';
|
|
|
+<script setup lang="tsx">
|
|
|
+import { defineAsyncComponent, reactive, ref } from 'vue';
|
|
|
import { ElMessage, FormInstance } from 'element-plus';
|
|
|
import { throttle } from '@/utils/tools';
|
|
|
import { addEarlySetting, getEarlySettingBaseData } from '@/api/early/setting';
|
|
@@ -96,7 +57,7 @@ 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 PushSelect = defineAsyncComponent(() => import('@/views/early/push/components/Push-select.vue')); // 选择工单
|
|
|
|
|
|
// 定义变量内容
|
|
|
const state = reactive<any>({
|
|
@@ -116,14 +77,98 @@ const state = reactive<any>({
|
|
|
PageSize: 10, // 每页条数
|
|
|
Keyword: null, // 关键字
|
|
|
},
|
|
|
- tableData: [], // 表格数据
|
|
|
total: 0, // 总条数
|
|
|
});
|
|
|
-let loading = ref<boolean>(false); // 加载状态
|
|
|
+const gridOptions = reactive<any>({
|
|
|
+ loading: false,
|
|
|
+ border: true,
|
|
|
+ showOverflow: true,
|
|
|
+ columnConfig: {
|
|
|
+ resizable: true,
|
|
|
+ },
|
|
|
+ scrollY: {
|
|
|
+ enabled: true,
|
|
|
+ gt: 100,
|
|
|
+ },
|
|
|
+ toolbarConfig: {
|
|
|
+ slots: {
|
|
|
+ buttons: 'toolbar_buttons',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
|
|
|
+ minHeight: 300,
|
|
|
+ maxHeight: 500,
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ field: 'flag2',
|
|
|
+ title: '是否展示附件',
|
|
|
+ width: 120,
|
|
|
+ slots: {
|
|
|
+ default: ({ row }) => {
|
|
|
+ return <el-checkbox v-model={row.flag2}></el-checkbox>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'title',
|
|
|
+ title: '工单标题',
|
|
|
+ minWidth: 200,
|
|
|
+ slots: {
|
|
|
+ default: ({ row }) => {
|
|
|
+ return (
|
|
|
+ <order-detail order={row} onUpdateList={queryList}>
|
|
|
+ {row.title}
|
|
|
+ </order-detail>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'no',
|
|
|
+ title: '工单编码',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'hotspotName',
|
|
|
+ title: '热点分类',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'currentStepName',
|
|
|
+ title: '当前节点',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'statusText',
|
|
|
+ title: '工单状态',
|
|
|
+ width: 160,
|
|
|
+ slots: {
|
|
|
+ default: ({ row }) => {
|
|
|
+ return (
|
|
|
+ <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>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ width: 90,
|
|
|
+ align: 'center',
|
|
|
+ slots: {
|
|
|
+ default: ({ row }) => {
|
|
|
+ return (
|
|
|
+ <el-button link type="danger" onClick={() => onDelete(row)}>
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ data: [],
|
|
|
+});
|
|
|
// 打开弹窗
|
|
|
const ruleFormRef = ref<RefType>();
|
|
|
const openDialog = async () => {
|
|
|
- ruleFormRef.value?.resetFields();
|
|
|
try {
|
|
|
state.dialogVisible = true;
|
|
|
queryBaseInfo();
|
|
@@ -131,17 +176,6 @@ const openDialog = async () => {
|
|
|
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>([]); // 来源单位
|
|
@@ -150,7 +184,6 @@ const queryBaseInfo = () => {
|
|
|
orgsOptions.value = res.result ?? [];
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
// 关闭弹窗
|
|
|
const closeDialog = () => {
|
|
|
state.dialogVisible = false;
|
|
@@ -159,33 +192,23 @@ 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 pushSelectRef = ref<RefType>();
|
|
|
+const selectOrders = () => {
|
|
|
+ pushSelectRef.value.openDialog();
|
|
|
};
|
|
|
-
|
|
|
-const selectChangeEvent = ({ checked }) => {
|
|
|
- if (tableRef.value) {
|
|
|
- const records = tableRef.value.getCheckboxRecords();
|
|
|
- checkTable.value = records;
|
|
|
- console.log(checked ? '勾选事件' : '取消事件', records);
|
|
|
- }
|
|
|
+// 删除工单
|
|
|
+const onDelete = (row: any) => {
|
|
|
+ const index = gridOptions.data.findIndex((item: any) => item.no === row.no);
|
|
|
+ gridOptions.data.splice(index, 1);
|
|
|
};
|
|
|
-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;
|
|
|
+ gridOptions.loading = true;
|
|
|
const request = {
|
|
|
...state.ruleForm,
|
|
|
};
|
|
@@ -199,7 +222,7 @@ const onSubmit = throttle(async (formEl: FormInstance | undefined, operateModel:
|
|
|
})
|
|
|
.catch((error) => {})
|
|
|
.finally(() => {
|
|
|
- loading.value = false;
|
|
|
+ gridOptions.loading = false;
|
|
|
closeDialog();
|
|
|
});
|
|
|
});
|