123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <my-drawer
- :visible="visible"
- size="80%"
- :header="false"
- :footer="false"
- attach="body"
- class="add-range-dialog"
- >
- <div class="add-range">
- <div class="page-action">
- <t-button
- theme="primary"
- :disabled="!selectedRowKeys.length"
- @click="handlerBatchBind"
- >
- <template #icon><SaveIcon /></template>
- 批量划定
- </t-button>
- <t-button variant="text" @click="handleClose">
- <template #icon><CloseIcon /></template>
- </t-button>
- </div>
- <SearchForm :fields="fields" :params="params">
- <template #user="{ item, params }">
- <select-type-user
- v-model="params[item.prop]"
- type="ACCOUNT_MANAGER"
- ></select-type-user>
- </template>
- </SearchForm>
- <div class="flex-1 page-wrap">
- <div class="btn-group"> </div>
- <t-table
- size="small"
- row-key="crmId"
- :columns="columns"
- :data="tableData"
- bordered
- :pagination="{
- defaultCurrent: 1,
- defaultPageSize: 10,
- onChange,
- showJumper: true,
- showPageSize: false,
- current: pagination.pageNumber,
- }"
- v-loading="tableLoading"
- :selected-row-keys="selectedRowKeys"
- @select-change="selectChange"
- >
- <template #type="{ col, row }">
- {{ customerTypeFilter(row[col.colKey]) }}
- </template>
- <template #begin-time="{ col, row }">
- {{ timestampFilter(row[col.colKey]) }}
- </template>
- <template #exam-start-time="{ col, row }">
- {{ timestampFilter(row[col.colKey]) }}
- </template>
- <template #exam-end-time="{ col, row }">
- {{ timestampFilter(row[col.colKey]) }}
- </template>
- <template #create-time="{ col, row }">
- {{ timestampFilter(row[col.colKey]) }}
- </template>
- </t-table>
- </div>
- </div>
- </my-drawer>
- <!-- MultDelineationDialog -->
- <mult-delineation-dialog
- v-model:visible="showMultDelineationDialog"
- :crm-ids="selectedRowKeys"
- dialog-title="保存划定"
- @success="search"
- >
- <p style="color: #595959; margin-bottom: 28px"
- >请选择您要需要将这些派单划定的服务单元!</p
- >
- </mult-delineation-dialog>
- </template>
- <script setup name="AddRangeDialog">
- import { reactive, ref, computed } from 'vue';
- import { omit } from 'lodash';
- import { MessagePlugin } from 'tdesign-vue-next';
- import { SaveIcon, CloseIcon } from 'tdesign-icons-vue-next';
- import { serviceScopeUnbindCrmQueryApi } from '@/api/service-unit';
- import useFetchTable from '@/hooks/useFetchTable';
- import { CUSTOMER_TYPE } from '@/config/constants';
- import { customerTypeFilter, timestampFilter } from '@/utils/filter';
- import MultDelineationDialog from '../../dispatch/dispatch-manage/mult-delineation-dialog.vue';
- import { dictToOptionList } from '@/utils/tool';
- const emit = defineEmits(['update:visible', 'success']);
- const props = defineProps({
- visible: Boolean,
- });
- let showMultDelineationDialog = ref(false);
- const fields = ref([
- {
- prop: 'crmUserId',
- label: '客户经理',
- type: 'select',
- labelWidth: 80,
- colSpan: 5,
- cell: 'user',
- },
- {
- prop: 'productType',
- label: '客户类型',
- type: 'select',
- labelWidth: 80,
- colSpan: 5,
- attrs: {
- clearable: true,
- },
- },
- {
- prop: 'customName',
- label: '客户名称',
- labelWidth: 80,
- colSpan: 5,
- options: dictToOptionList(CUSTOMER_TYPE),
- attrs: {
- clearable: true,
- },
- },
- {
- prop: 'crmNo',
- label: '项目单号',
- labelWidth: 80,
- colSpan: 5,
- attrs: {
- clearable: true,
- },
- },
- {
- type: 'buttons',
- colSpan: 2,
- children: [
- {
- type: 'button',
- text: '搜索',
- onClick: () => {
- search();
- },
- },
- ],
- },
- {
- prop: 'crmTime',
- label: '派单时间',
- type: 'daterange',
- labelWidth: 80,
- colSpan: 10,
- attrs: {
- clearable: true,
- valueType: 'time-stamp',
- },
- },
- ]);
- const params = reactive({
- crmUserId: '',
- productType: '',
- customName: '',
- crmNo: '',
- crmTime: [],
- });
- const computedParams = computed(() => {
- let data = omit(params, ['crmTime']);
- data.startTime = params.crmTime[0];
- data.endTime = params.crmTime[1];
- return data;
- });
- const selectedRowKeys = ref([]);
- const selectChange = (value) => {
- selectedRowKeys.value = value;
- };
- const columns = [
- {
- colKey: 'row-select',
- type: 'multiple',
- width: 50,
- fixed: 'left',
- },
- { colKey: 'crmNo', title: '项目单号', minWidth: 80 },
- { colKey: 'beginTime', title: '派单时间', width: 180, cell: 'begin-time' },
- { colKey: 'crmUserName', title: '客户经理', minWidth: 80 },
- { colKey: 'productType', title: '客户类型', width: 90, cell: 'type' },
- { colKey: 'customName', title: '客户名称', minWidth: 100 },
- { colKey: 'productName', title: '项目名称', minWidth: 80 },
- { colKey: 'productName', title: '实施产品', minWidth: 80 },
- {
- colKey: 'examStartTime',
- title: '考试开始时间',
- width: 180,
- cell: 'exam-start-time',
- },
- {
- colKey: 'examEndTime',
- title: '考试结束时间',
- width: 180,
- cell: 'exam-end-time',
- },
- { colKey: 'creatorName', title: '提交人', minWidth: 80 },
- { colKey: 'createTime', title: '提交时间', width: 180, cell: 'create-time' },
- ];
- const {
- loading: tableLoading,
- pagination,
- tableData,
- search,
- onChange,
- } = useFetchTable(serviceScopeUnbindCrmQueryApi, {
- fetchDataHandle: () => {
- selectedRowKeys.value = [];
- },
- params: computedParams,
- });
- const handlerBatchBind = () => {
- if (!selectedRowKeys.value.length) {
- MessagePlugin.error('您还没有选择任何派单!');
- return;
- }
- showMultDelineationDialog.value = true;
- };
- const handleClose = () => {
- emit('update:visible', false);
- };
- </script>
- <style lang="less">
- .add-range-dialog {
- .t-drawer__body {
- background-color: #f2f3f5;
- padding: 0;
- }
- .page-action {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- }
- </style>
|