|
@@ -3,21 +3,17 @@
|
|
|
<SearchForm :fields="fields" :params="params"></SearchForm>
|
|
|
<div class="flex-1 page-wrap">
|
|
|
<div class="btn-group">
|
|
|
+ <t-button theme="success" @click="handleAdd">新增</t-button>
|
|
|
<t-button
|
|
|
theme="success"
|
|
|
- @click="
|
|
|
- curRow = null;
|
|
|
- showAddDispatchDialog = true;
|
|
|
- "
|
|
|
- >新增</t-button
|
|
|
- >
|
|
|
- <t-button theme="success" :disabled="!selectedRowKeys.length"
|
|
|
+ :disabled="!selectedRowKeys.length"
|
|
|
+ @click="handleBatchDisable"
|
|
|
>作废</t-button
|
|
|
>
|
|
|
<t-button
|
|
|
theme="success"
|
|
|
:disabled="!selectedRowKeys.length"
|
|
|
- @click="multDelineationHandle"
|
|
|
+ @click="handleMultDelineation"
|
|
|
>批量划定</t-button
|
|
|
>
|
|
|
</div>
|
|
@@ -32,145 +28,188 @@
|
|
|
defaultPageSize: 10,
|
|
|
onChange,
|
|
|
total: pagination.total,
|
|
|
+ current: pagination.pageNumber,
|
|
|
}"
|
|
|
+ v-loading="tableLoading"
|
|
|
:selected-row-keys="selectedRowKeys"
|
|
|
select-on-row-click
|
|
|
@select-change="selectChange"
|
|
|
>
|
|
|
+ <template #type="{ col, row }">
|
|
|
+ {{ customerTypeFilter(row[col.colKey]) }}
|
|
|
+ </template>
|
|
|
+ <template #begin-time="{ col, row }">
|
|
|
+ {{ timestampFilter(row[col.colKey]) }}
|
|
|
+ </template>
|
|
|
+ <template #start-time="{ col, row }">
|
|
|
+ {{ timestampFilter(row[col.colKey]) }}
|
|
|
+ </template>
|
|
|
+ <template #end-time="{ col, row }">
|
|
|
+ {{ timestampFilter(row[col.colKey]) }}
|
|
|
+ </template>
|
|
|
+ <template #create-time="{ col, row }">
|
|
|
+ {{ timestampFilter(row[col.colKey]) }}
|
|
|
+ </template>
|
|
|
+ <template #operate="{ row }">
|
|
|
+ <div class="table-operations" @click.stop>
|
|
|
+ <t-link
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ @click="handleDelineation(row)"
|
|
|
+ >
|
|
|
+ {{ row.serviceId ? '重新划定' : '划定' }}
|
|
|
+ </t-link>
|
|
|
+ <t-link theme="primary" hover="color" @click="handleEdit(row)">
|
|
|
+ 修改
|
|
|
+ </t-link>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</t-table>
|
|
|
</div>
|
|
|
|
|
|
<AddDispatchDialog
|
|
|
v-model:visible="showAddDispatchDialog"
|
|
|
:curRow="curRow"
|
|
|
+ @success="fetchData"
|
|
|
></AddDispatchDialog>
|
|
|
- <DelineationDialog v-model:visible="showDelineationDialog" :curRow="curRow">
|
|
|
- </DelineationDialog>
|
|
|
- <MultDelineationDialog
|
|
|
+ <!-- DelineationDialog -->
|
|
|
+ <mult-delineation-dialog
|
|
|
v-model:visible="showMultDelineationDialog"
|
|
|
- :selectedRowKeys="selectedRowKeys"
|
|
|
+ :crm-ids="curCrmIds"
|
|
|
+ :dialog-width="curRow ? 1100 : 600"
|
|
|
+ @success="refresh"
|
|
|
>
|
|
|
- </MultDelineationDialog>
|
|
|
+ <div v-if="curRow">
|
|
|
+ <t-divider align="left" dashed>
|
|
|
+ <span>派单信息</span>
|
|
|
+ </t-divider>
|
|
|
+ <t-form label-width="140px">
|
|
|
+ <t-row :gutter="[0, 0]">
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="项目单号:">
|
|
|
+ {{ curRow.crmNo }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="项目名称:">
|
|
|
+ {{ curRow.name }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="派单时间:">
|
|
|
+ {{ timestampFilter(curRow.beginTime) }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="派单人:">
|
|
|
+ {{ curRow.crmUserName }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="客户类型:">
|
|
|
+ {{ customerTypeFilter(curRow.customType) }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="客户名称:">
|
|
|
+ {{ curRow.custom }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="考试开始时间:">
|
|
|
+ {{ timestampFilter(curRow.examStartTime) }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="考试结束时间:">
|
|
|
+ {{ timestampFilter(curRow.examEndTime) }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ <t-col :span="4">
|
|
|
+ <t-form-item label="实施产品:">
|
|
|
+ {{ curRow.product }}
|
|
|
+ </t-form-item>
|
|
|
+ </t-col>
|
|
|
+ </t-row>
|
|
|
+ </t-form>
|
|
|
+ <t-divider align="left" dashed>
|
|
|
+ <span>划定派单</span>
|
|
|
+ </t-divider>
|
|
|
+ </div>
|
|
|
+ </mult-delineation-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="jsx" name="DispatchManage">
|
|
|
-import { reactive, ref } from 'vue';
|
|
|
-import { useRequest } from 'vue-request';
|
|
|
-import { getTableData } from '@/api/test';
|
|
|
+import { reactive, ref, computed, onMounted } from 'vue';
|
|
|
+import { omit } from 'lodash';
|
|
|
+import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
|
|
|
+
|
|
|
+import {
|
|
|
+ dispatchQueryApi,
|
|
|
+ dispatchBatchDisableApi,
|
|
|
+ dispatchCountWaitZoneApi,
|
|
|
+} from '@/api/service-unit';
|
|
|
import useFetchTable from '@/hooks/useFetchTable';
|
|
|
import AddDispatchDialog from './add-dispatch-dialog.vue';
|
|
|
-import DelineationDialog from './delineation-dialog.vue';
|
|
|
import MultDelineationDialog from './mult-delineation-dialog.vue';
|
|
|
|
|
|
-const showDelineationDialog = ref(false);
|
|
|
+import { CUSTOMER_TYPE } from '@/config/constants';
|
|
|
+import { dictToOptionList } from '@/utils/tool';
|
|
|
+import { timestampFilter, customerTypeFilter } from '@/utils/filter';
|
|
|
+
|
|
|
const showMultDelineationDialog = ref(false);
|
|
|
const curRow = ref(null);
|
|
|
+const curCrmIds = ref([]);
|
|
|
const showAddDispatchDialog = ref(false);
|
|
|
+let waitCount = ref(0);
|
|
|
+
|
|
|
const selectedRowKeys = ref([]);
|
|
|
-const selectChange = (value, { selectedRowData }) => {
|
|
|
+const selectChange = (value) => {
|
|
|
selectedRowKeys.value = value;
|
|
|
};
|
|
|
-const multDelineationHandle = () => {
|
|
|
- showMultDelineationDialog.value = true;
|
|
|
-};
|
|
|
-const handleDelineation = (row) => {
|
|
|
- curRow.value = row;
|
|
|
- showDelineationDialog.value = true;
|
|
|
-};
|
|
|
-const columns = [
|
|
|
- {
|
|
|
- colKey: 'row-select',
|
|
|
- type: 'multiple',
|
|
|
- width: 50,
|
|
|
- fixed: 'left',
|
|
|
- },
|
|
|
- { colKey: 'a', title: '服务单元' },
|
|
|
- { colKey: 'b', title: '项目单号' },
|
|
|
- { colKey: 'c', title: '派单时间' },
|
|
|
- { colKey: 'd', title: '派单人' },
|
|
|
- { colKey: 'e', title: '客户类型' },
|
|
|
- { colKey: 'f', title: '客户名称' },
|
|
|
- { colKey: 'g', title: '项目名称' },
|
|
|
- { colKey: 'h', title: '实施产品' },
|
|
|
- { colKey: 'i', title: '考试开始时间' },
|
|
|
- { colKey: 'j', title: '考试结束时间' },
|
|
|
- { colKey: 'k', title: '大区经理' },
|
|
|
- { colKey: 'l', title: '提交人' },
|
|
|
- { colKey: 'm', title: '提交时间' },
|
|
|
- {
|
|
|
- title: '操作',
|
|
|
- colKey: 'operate',
|
|
|
- fixed: 'right',
|
|
|
- width: 200,
|
|
|
- cell: (h, { row }) => {
|
|
|
- return (
|
|
|
- <div class="table-operations">
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- handleDelineation(row);
|
|
|
- }}
|
|
|
- >
|
|
|
- 划定
|
|
|
- </t-link>
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- curRow.value = row;
|
|
|
- showAddDispatchDialog.value = true;
|
|
|
- }}
|
|
|
- >
|
|
|
- 修改
|
|
|
- </t-link>
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- handleDelineation(row);
|
|
|
- }}
|
|
|
- >
|
|
|
- 重新划定
|
|
|
- </t-link>
|
|
|
- </div>
|
|
|
- );
|
|
|
- },
|
|
|
- },
|
|
|
-];
|
|
|
|
|
|
const fields = ref([
|
|
|
{
|
|
|
- prop: 'a',
|
|
|
+ prop: 'serviceId',
|
|
|
label: '服务单元',
|
|
|
type: 'select',
|
|
|
labelWidth: 80,
|
|
|
colSpan: 5,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'b',
|
|
|
+ prop: 'leadId',
|
|
|
label: '大区经理',
|
|
|
type: 'select',
|
|
|
labelWidth: 80,
|
|
|
colSpan: 5,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'c',
|
|
|
+ prop: 'crmUserId',
|
|
|
label: '派单人',
|
|
|
type: 'select',
|
|
|
labelWidth: 80,
|
|
|
colSpan: 5,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'd',
|
|
|
+ prop: 'type',
|
|
|
label: '客户类型',
|
|
|
type: 'select',
|
|
|
labelWidth: 80,
|
|
|
colSpan: 5,
|
|
|
+ options: dictToOptionList(CUSTOMER_TYPE),
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
type: 'buttons',
|
|
@@ -179,48 +218,182 @@ const fields = ref([
|
|
|
{
|
|
|
type: 'button',
|
|
|
text: '查询',
|
|
|
+ onClick: () => {
|
|
|
+ refresh();
|
|
|
+ },
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
{
|
|
|
- prop: 'e',
|
|
|
+ prop: 'custom',
|
|
|
label: '客户名称',
|
|
|
labelWidth: 80,
|
|
|
colSpan: 5,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'f',
|
|
|
+ prop: 'crmNo',
|
|
|
label: '项目单号',
|
|
|
labelWidth: 80,
|
|
|
colSpan: 5,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'g',
|
|
|
+ prop: 'beginTime',
|
|
|
label: '派单时间',
|
|
|
type: 'daterange',
|
|
|
labelWidth: 80,
|
|
|
colSpan: 10,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
]);
|
|
|
const params = reactive({
|
|
|
- a: '',
|
|
|
- b: '',
|
|
|
- c: '',
|
|
|
- d: '',
|
|
|
- e: '',
|
|
|
- f: '',
|
|
|
- g: [],
|
|
|
+ serviceId: '',
|
|
|
+ leadId: '',
|
|
|
+ crmUserId: '',
|
|
|
+ type: '',
|
|
|
+ custom: '',
|
|
|
+ crmNo: '',
|
|
|
+ beginTime: [],
|
|
|
});
|
|
|
|
|
|
+const computedParams = computed(() => {
|
|
|
+ let data = omit(params, ['beginTime']);
|
|
|
+ data.startTime = params.beginTime[0];
|
|
|
+ data.endTime = params.beginTime[1];
|
|
|
+ return data;
|
|
|
+});
|
|
|
+
|
|
|
+const columns = [
|
|
|
+ {
|
|
|
+ colKey: 'row-select',
|
|
|
+ type: 'multiple',
|
|
|
+ width: 50,
|
|
|
+ fixed: 'left',
|
|
|
+ },
|
|
|
+ { colKey: 'service', title: '服务单元' },
|
|
|
+ { colKey: 'crmNo', title: '项目单号' },
|
|
|
+ { colKey: 'beginTime', title: '派单时间', cell: 'begin-time', width: 170 },
|
|
|
+ { colKey: 'crmUserName', title: '派单人' },
|
|
|
+ { colKey: 'customType', title: '客户类型', cell: 'type', width: 100 },
|
|
|
+ { colKey: 'custom', title: '客户名称' },
|
|
|
+ { colKey: 'name', title: '项目名称' },
|
|
|
+ { colKey: 'product', title: '实施产品' },
|
|
|
+ {
|
|
|
+ colKey: 'examStartTime',
|
|
|
+ title: '考试开始时间',
|
|
|
+ cell: 'start-time',
|
|
|
+ width: 170,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ colKey: 'examEndTime',
|
|
|
+ title: '考试结束时间',
|
|
|
+ cell: 'end-time',
|
|
|
+ width: 170,
|
|
|
+ },
|
|
|
+ { colKey: 'leadName', title: '大区经理' },
|
|
|
+ { colKey: 'createName', title: '提交人' },
|
|
|
+ { colKey: 'createTime', title: '提交时间', cell: 'create-time', width: 170 },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ colKey: 'operate',
|
|
|
+ fixed: 'right',
|
|
|
+ width: 140,
|
|
|
+ cell: 'operate',
|
|
|
+ },
|
|
|
+];
|
|
|
+
|
|
|
const {
|
|
|
loading: tableLoading,
|
|
|
pagination,
|
|
|
tableData,
|
|
|
+ search,
|
|
|
fetchData,
|
|
|
onChange,
|
|
|
-} = useFetchTable(getTableData);
|
|
|
+} = useFetchTable(dispatchQueryApi, {
|
|
|
+ fetchDataHandle: () => {
|
|
|
+ selectedRowKeys.value = [];
|
|
|
+ },
|
|
|
+ params: computedParams,
|
|
|
+});
|
|
|
|
|
|
-const refresh = async () => {};
|
|
|
-</script>
|
|
|
+const refresh = () => {
|
|
|
+ search();
|
|
|
+ getWaitCount();
|
|
|
+};
|
|
|
+
|
|
|
+const getWaitCount = async () => {
|
|
|
+ const res = await dispatchCountWaitZoneApi();
|
|
|
+ waitCount.value = res || 0;
|
|
|
+};
|
|
|
+
|
|
|
+const handleMultDelineation = () => {
|
|
|
+ if (!selectedRowKeys.value.length) {
|
|
|
+ MessagePlugin.error('请选择要划定的记录');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ curRow.value = null;
|
|
|
+ curCrmIds.value = selectedRowKeys.value;
|
|
|
+ showMultDelineationDialog.value = true;
|
|
|
+};
|
|
|
+const handleDelineation = (row) => {
|
|
|
+ if (row.serviceId) {
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
+ header: '操作提示',
|
|
|
+ body: `重新划定到新的服务单元后,相关大区负责人信息、SOP信息将全部被清空,确定要操作吗?`,
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ onConfirm: () => {
|
|
|
+ confirmDia.hide();
|
|
|
+ curRow.value = row;
|
|
|
+ curCrmIds.value = [curRow.value.id];
|
|
|
+ showMultDelineationDialog.value = true;
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ curRow.value = row;
|
|
|
+ curCrmIds.value = [curRow.value.id];
|
|
|
+ showMultDelineationDialog.value = true;
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
-<style></style>
|
|
|
+const handleAdd = () => {
|
|
|
+ curRow.value = null;
|
|
|
+ showAddDispatchDialog.value = true;
|
|
|
+};
|
|
|
+const handleEdit = (row) => {
|
|
|
+ curRow.value = row;
|
|
|
+ showAddDispatchDialog.value = true;
|
|
|
+};
|
|
|
+const handleBatchDisable = () => {
|
|
|
+ if (!selectedRowKeys.value.length) {
|
|
|
+ MessagePlugin.error('请选择要作废的记录');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
+ header: '作废提示',
|
|
|
+ body: `您确定要将所选的派单作废吗?`,
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ onConfirm: async () => {
|
|
|
+ confirmDia.hide();
|
|
|
+ const res = await dispatchBatchDisableApi(selectedRowKeys.value).catch(
|
|
|
+ () => {}
|
|
|
+ );
|
|
|
+ if (!res) return;
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
+ refresh();
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getWaitCount();
|
|
|
+});
|
|
|
+</script>
|