|
@@ -1,16 +1,13 @@
|
|
|
<template>
|
|
|
<div class="unit-manage flex flex-col h-full">
|
|
|
- <SearchForm :fields="fields" :params="params"></SearchForm>
|
|
|
+ <SearchForm :fields="fields" :params="params">
|
|
|
+ <template #leader="{ item, params }">
|
|
|
+ <select-user v-model="params[item.prop]" clearable></select-user>
|
|
|
+ </template>
|
|
|
+ </SearchForm>
|
|
|
<div class="flex-1 page-wrap">
|
|
|
<div class="btn-group">
|
|
|
- <t-button
|
|
|
- theme="success"
|
|
|
- @click="
|
|
|
- curRow = null;
|
|
|
- showAddUnitDialog = true;
|
|
|
- "
|
|
|
- >新增</t-button
|
|
|
- >
|
|
|
+ <t-button theme="success" @click="handleAdd">新增</t-button>
|
|
|
</div>
|
|
|
<t-table
|
|
|
size="small"
|
|
@@ -23,110 +20,154 @@
|
|
|
defaultPageSize: 10,
|
|
|
onChange,
|
|
|
total: pagination.total,
|
|
|
+ current: pagination.page,
|
|
|
}"
|
|
|
+ v-loading="tableLoading"
|
|
|
>
|
|
|
+ <template #type="{ col, row }">
|
|
|
+ {{ customerTypeFilter(row[col.colKey]) }}
|
|
|
+ </template>
|
|
|
+ <template #status="{ col, row }">
|
|
|
+ {{ serviceUnitStatusFilter(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">
|
|
|
+ <t-link
|
|
|
+ v-if="row.status !== 'FINISH'"
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ @click="handleEdit(row)"
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </t-link>
|
|
|
+ <t-link
|
|
|
+ v-if="row.status === 'NEW'"
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ @click="handlePublish(row)"
|
|
|
+ >
|
|
|
+ 发布
|
|
|
+ </t-link>
|
|
|
+ <t-link
|
|
|
+ v-if="row.status === 'NEW'"
|
|
|
+ theme="danger"
|
|
|
+ hover="color"
|
|
|
+ @click="handleDestroy(row)"
|
|
|
+ >
|
|
|
+ 作废
|
|
|
+ </t-link>
|
|
|
+ <t-link
|
|
|
+ v-if="row.status === 'FINISH'"
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ @click="handleRestart(row)"
|
|
|
+ >
|
|
|
+ 重启
|
|
|
+ </t-link>
|
|
|
+ <t-link
|
|
|
+ v-if="row.status === 'PUBLISH'"
|
|
|
+ theme="danger"
|
|
|
+ hover="color"
|
|
|
+ @click="handleCloze(row)"
|
|
|
+ >
|
|
|
+ 关闭
|
|
|
+ </t-link>
|
|
|
+ <t-link
|
|
|
+ v-if="row.status === 'NEW'"
|
|
|
+ theme="primary"
|
|
|
+ hover="color"
|
|
|
+ @click="handleSetGroup(row)"
|
|
|
+ >
|
|
|
+ 设置考勤组
|
|
|
+ </t-link>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</t-table>
|
|
|
</div>
|
|
|
|
|
|
<AddUnitDialog
|
|
|
v-model:visible="showAddUnitDialog"
|
|
|
:curRow="curRow"
|
|
|
+ @success="fetchData"
|
|
|
></AddUnitDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="jsx" name="UnitManage">
|
|
|
-import { ref, reactive } from 'vue';
|
|
|
-import { getTableData } from '@/api/test';
|
|
|
+import { ref, reactive, computed } from 'vue';
|
|
|
+import { omit } from 'lodash';
|
|
|
+import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
|
|
|
import useFetchTable from '@/hooks/useFetchTable';
|
|
|
import AddUnitDialog from './add-unit-dialog.vue';
|
|
|
+import {
|
|
|
+ timestampFilter,
|
|
|
+ customerTypeFilter,
|
|
|
+ serviceUnitStatusFilter,
|
|
|
+} from '@/utils/filter';
|
|
|
+import { SERVICE_UNIT_STATUS, CUSTOMER_TYPE } from '@/config/constants';
|
|
|
+import { dictToOptionList } from '@/utils/tool';
|
|
|
+import {
|
|
|
+ serviceUnitQueryApi,
|
|
|
+ serviceUnitCancelApi,
|
|
|
+ serviceUnitClozeApi,
|
|
|
+ serviceUnitRestartApi,
|
|
|
+ serviceUnitPublishApi,
|
|
|
+} from '@/api/service-unit';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+
|
|
|
const showAddUnitDialog = ref(false);
|
|
|
const curRow = ref(null);
|
|
|
-
|
|
|
-const columns = [
|
|
|
- { 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: '创建时间' },
|
|
|
- {
|
|
|
- title: '操作',
|
|
|
- colKey: 'operate',
|
|
|
- fixed: 'right',
|
|
|
- width: 260,
|
|
|
- cell: (h, { row }) => {
|
|
|
- return (
|
|
|
- <div class="table-operations">
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- curRow.value = row;
|
|
|
- showAddUnitDialog.value = true;
|
|
|
- }}
|
|
|
- >
|
|
|
- 修改
|
|
|
- </t-link>
|
|
|
- <t-link theme="primary" hover="color">
|
|
|
- 作废
|
|
|
- </t-link>
|
|
|
- <t-link theme="primary" hover="color">
|
|
|
- 重启
|
|
|
- </t-link>
|
|
|
- <t-link theme="primary" hover="color">
|
|
|
- 关闭
|
|
|
- </t-link>
|
|
|
- <t-link theme="primary" hover="color">
|
|
|
- 设置考勤组
|
|
|
- </t-link>
|
|
|
- </div>
|
|
|
- );
|
|
|
- },
|
|
|
- },
|
|
|
-];
|
|
|
-const {
|
|
|
- loading: tableLoading,
|
|
|
- pagination,
|
|
|
- tableData,
|
|
|
- fetchData,
|
|
|
- onChange,
|
|
|
-} = useFetchTable(getTableData);
|
|
|
-
|
|
|
-const refresh = async () => {};
|
|
|
+const router = useRouter();
|
|
|
|
|
|
const fields = ref([
|
|
|
{
|
|
|
- prop: 'a',
|
|
|
+ prop: 'type',
|
|
|
label: '业务类型',
|
|
|
type: 'select',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 5,
|
|
|
+ options: dictToOptionList(CUSTOMER_TYPE),
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'b',
|
|
|
+ prop: 'serviceLeadId',
|
|
|
label: '负责人',
|
|
|
type: 'select',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 5,
|
|
|
+ cell: 'leader',
|
|
|
},
|
|
|
{
|
|
|
- prop: 'c',
|
|
|
+ prop: 'status',
|
|
|
label: '当前状态',
|
|
|
type: 'select',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 5,
|
|
|
+ options: dictToOptionList(SERVICE_UNIT_STATUS),
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
- prop: 'd',
|
|
|
+ prop: 'createTime',
|
|
|
label: '创建时间',
|
|
|
type: 'daterange',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 7,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
type: 'buttons',
|
|
@@ -135,23 +176,143 @@ const fields = ref([
|
|
|
{
|
|
|
type: 'button',
|
|
|
text: '查询',
|
|
|
+ onClick: () => {
|
|
|
+ search();
|
|
|
+ },
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
{
|
|
|
- prop: 'e',
|
|
|
+ prop: 'serviceUnitName',
|
|
|
label: '服务单元名称',
|
|
|
labelWidth: 100,
|
|
|
colSpan: 5,
|
|
|
+ attrs: {
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
},
|
|
|
]);
|
|
|
const params = reactive({
|
|
|
- a: '',
|
|
|
- b: '',
|
|
|
- c: '',
|
|
|
- d: [],
|
|
|
- e: '',
|
|
|
+ type: '',
|
|
|
+ serviceLeadId: '',
|
|
|
+ status: '',
|
|
|
+ createTime: [],
|
|
|
+ serviceUnitName: '',
|
|
|
+});
|
|
|
+
|
|
|
+const computedParams = computed(() => {
|
|
|
+ let data = omit(params, ['createTime']);
|
|
|
+ data.createStartTime = params.createTime[0];
|
|
|
+ data.createEndTime = params.createTime[1];
|
|
|
+ return data;
|
|
|
});
|
|
|
-</script>
|
|
|
|
|
|
-<style></style>
|
|
|
+const columns = [
|
|
|
+ { colKey: 'name', title: '服务单元名称' },
|
|
|
+ {
|
|
|
+ colKey: 'startTime',
|
|
|
+ title: '服务开始时间',
|
|
|
+ cell: 'start-time',
|
|
|
+ width: 170,
|
|
|
+ },
|
|
|
+ { colKey: 'endTime', title: '服务截止时间', cell: 'end-time', width: 170 },
|
|
|
+ { colKey: 'type', title: '业务类型', cell: 'type', width: 100 },
|
|
|
+ { colKey: 'serviceLeadName', title: '负责人' },
|
|
|
+ { colKey: 'rate', title: '区域配比', width: 80 },
|
|
|
+ { colKey: 'status', title: '当前状态', cell: 'status', width: 80 },
|
|
|
+ { colKey: 'creatorName', title: '创建人' },
|
|
|
+ { colKey: 'createTime', title: '创建时间', cell: 'create-time', width: 170 },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ colKey: 'operate',
|
|
|
+ fixed: 'right',
|
|
|
+ width: 240,
|
|
|
+ cell: 'operate',
|
|
|
+ },
|
|
|
+];
|
|
|
+const {
|
|
|
+ loading: tableLoading,
|
|
|
+ pagination,
|
|
|
+ tableData,
|
|
|
+ search,
|
|
|
+ fetchData,
|
|
|
+ onChange,
|
|
|
+} = useFetchTable(serviceUnitQueryApi, { params: computedParams });
|
|
|
+
|
|
|
+const handleAdd = () => {
|
|
|
+ curRow.value = null;
|
|
|
+ showAddUnitDialog.value = true;
|
|
|
+};
|
|
|
+const handleEdit = (row) => {
|
|
|
+ curRow.value = row;
|
|
|
+ showAddUnitDialog.value = true;
|
|
|
+};
|
|
|
+const handleDestroy = (row) => {
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
+ header: '作废提示',
|
|
|
+ body: `您确定要作废当前服务单元吗?`,
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ onConfirm: async () => {
|
|
|
+ confirmDia.hide();
|
|
|
+ const res = await serviceUnitCancelApi(row.id).catch(() => {});
|
|
|
+ if (!res) return;
|
|
|
+ MessagePlugin.success('删除成功');
|
|
|
+ fetchData();
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+const handlePublish = (row) => {
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
+ header: '发布提示',
|
|
|
+ body: `您确定要发布当前服务单元吗?`,
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ onConfirm: async () => {
|
|
|
+ confirmDia.hide();
|
|
|
+ const res = await serviceUnitPublishApi(row.id).catch(() => {});
|
|
|
+ if (!res) return;
|
|
|
+ MessagePlugin.success('删除成功');
|
|
|
+ fetchData();
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+const handleRestart = (row) => {
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
+ header: '重启提示',
|
|
|
+ body: `您确定要重启当前服务单元吗?`,
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ onConfirm: async () => {
|
|
|
+ confirmDia.hide();
|
|
|
+ const res = await serviceUnitRestartApi(row.id).catch(() => {});
|
|
|
+ if (!res) return;
|
|
|
+ MessagePlugin.success('删除成功');
|
|
|
+ fetchData();
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+const handleCloze = (row) => {
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
+ header: '关闭提示',
|
|
|
+ body: `您确定要关闭当前服务单元吗?`,
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ onConfirm: async () => {
|
|
|
+ confirmDia.hide();
|
|
|
+ const res = await serviceUnitClozeApi(row.id).catch(() => {});
|
|
|
+ if (!res) return;
|
|
|
+ MessagePlugin.success('删除成功');
|
|
|
+ fetchData();
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+const handleSetGroup = (row) => {
|
|
|
+ router.push({
|
|
|
+ name: 'CheckinManage',
|
|
|
+ query: {
|
|
|
+ serviceId: row.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+</script>
|