123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <template>
- <PageWrapper contentBackground>
- <template #footer>
- <a-tabs v-model:activeKey="tableType" @change="changeTable">
- <a-tab-pane :key="0" :tab="t('routes.spares.tableType.0')" />
- <a-tab-pane :key="1" :tab="t('routes.spares.tableType.21')" />
- <a-tab-pane :key="2" :tab="t('routes.spares.tableType.22')" />
- </a-tabs></template
- >
- <div class="desc-wrap-BasicTable">
- <BasicTable @register="registerTable">
- <template #action="{ record }">
- <TableAction
- stopButtonPropagation
- :actions="[
- {
- label: '详情',
- onClick: handleDetail.bind(null, record),
- },
- {
- label: '添加备件',
- ifShow:tableType == 1,
- onClick: handleAdd.bind(null, record),
- },
- {
- label: '完成维修',
- ifShow:tableType == 1,
- onClick: handleOut.bind(null, record),
- },
- {
- label: '检测登记',
- ifShow:tableType == 0,
- onClick: handleRecover.bind(null, record),
- },
- ]"
- />
- </template>
- </BasicTable>
- <checkModel @update="reload" @register="registerRecovery" />
- <addAccessoryModel @update="reload" @register="registerAdd" />
- <outModal @update="reload" @register="registerOut" />
-
- <!-- ifShow: getCheckPerm('device-out') && !Boolean(record.outType), -->
- </div>
- </PageWrapper>
- </template>
- <script lang="ts">
- import { defineComponent, onMounted, ref } from 'vue';
- import { PageWrapper } from '/@/components/Page';
- import {
- BasicTable,
- useTable,
- TableAction,
- BasicColumn,
- TableImg,
- FormProps,
- } from '/@/components/Table';
- import { Tabs } from 'ant-design-vue';
- import { operateSceneList } from '/@/api/operate';
- import { useI18n } from '/@/hooks/web/useI18n';
- import { usePermissionStore } from '/@/store/modules/permission';
- import checkModel from './checkModel.vue';
- import outModal from './outModal.vue';
- import addAccessoryModel from './addAccessoryModel.vue';
- import { useModal } from '/@/components/Modal';
- import { useRouter } from 'vue-router'
- import { saleOrderList, repairOrderList } from '/@/api/spares';
- export default defineComponent({
- components: {
- BasicTable,
- TableAction,
- TableImg,
- checkModel,
- outModal,
- PageWrapper,
- addAccessoryModel,
- [Tabs.name]: Tabs,
- [Tabs.TabPane.name]: Tabs.TabPane,
- },
- setup() {
- const { t } = useI18n();
- const permissionStore = usePermissionStore();
- const router = useRouter()
- const { getCheckPerm } = permissionStore;
- const tableType = ref<number>(0); //0 待接单,1待跟进,2已完结
- onMounted(() => {
- // console.log(router.currentRoute.value.params.id);
- });
- const columns: BasicColumn[] = [
- {
- title: '报修日期',
- dataIndex: 'createTime',
- width: 180,
- },
- {
- title: '客户名称',
- dataIndex: 'addrId',
- width: 80,
- },
- {
- title: '产品类型',
- dataIndex: 'cameraType',
- width: 80,
- customRender: ({ record }) => {
- return t(`routes.device.type.${record.operationType || 1}`);
- },
- },
- {
- title: '产品SN码',
- dataIndex: 'cameraSnCode',
- width: 100,
- },
- {
- title: '故障描述',
- dataIndex: 'faultMsg',
- width: 100,
- },
- {
- title: '售后工程师',
- dataIndex: 'saleName',
- width: 100,
- },
- {
- title: '接单日期',
- dataIndex: 'orderReceivingTime',
- width: 100,
- },
- {
- title: '状态',
- dataIndex: 'status',
- width: 100,
- customRender: ({ record }) => {
- return t(`routes.spares.tableType.${record.status || 0}`);
- },
- },
- {
- title: '工单号',
- dataIndex: 'repairId',
- width: 100,
- },
- {
- title: t('common.operating'),
- dataIndex: 'action',
- slots: { customRender: 'action' },
- ifShow: true,
- fixed: 'right',
- flag: 'ACTION',
- width: 200,
- },
- ];
- const searchForm: Partial<FormProps> = {
- labelWidth: 120,
- schemas: [
- {
- field: 'type',
- label: '设备类型',
- component: 'Select',
- componentProps: {
- options: [
- {
- label: t('routes.scene.tableType.0'),
- value: '0',
- },{
- label: t('routes.scene.tableType.1'),
- value: '1',
- },{
- label: t('routes.scene.tableType.2'),
- value: '2',
- },
- ],
- },
- colProps: {
- xl: 6,
- xxl: 6,
- },
- },
- {
- field: 'cameraSnCode',
- component: 'Input',
- label: t('routes.device.snCode'),
- colProps: {
- xl: 7,
- xxl: 7,
- },
- },
- ],
- };
-
- const [registerRecovery, { openModal }] = useModal();
- const [registerOut, { openModal:openOutModal }] = useModal();
- const [registerAdd, { openModal:openAddModal }] = useModal();
- const [registerTable, { reload }] = useTable({
- api: repairOrderList,
- columns: columns,
- useSearchForm: true,
- searchInfo: { statusParam: tableType },
- formConfig: searchForm,
- showTableSetting: true,
- showIndexColumn: false,
- fetchSetting: {
- pageField: 'pageNum',
- sizeField: 'pageSize',
- listField: 'list',
- totalField: 'total',
- },
- canResize: false,
- });
- async function handleDetail(record: Recordable) {
- console.log('record', record);
- router.push({path:`detail/${record.id||'20230215174919387'}`})
- }
- async function handleRecover(record: Recordable) {
- openModal(true, record);
- }
- function handleAdd(record: Recordable) {
- openAddModal(true,record);
- }
- function handleOut(record: Recordable) {
- openOutModal(true,record);
- }
- function handleOrder() {
- openModal(true);
- }
- function changeTable(val: string) {
- tableType.value = val;
- reload();
- }
- return {
- registerTable,
- reload,
- t,
- tableType,
- openAddModal,
- registerOut,
- registerAdd,
- changeTable,
- handleOrder,
- getCheckPerm,
- handleDetail,
- handleAdd,
- handleOut,
- handleRecover,
- registerRecovery,
- };
- },
- });
- </script>
- <style lang="less" scoped>
- .desc-wrap-BasicTable {
- background-color: #f0f2f5;
- .vben-basic-table-form-container {
- padding: 0;
- }
- }
- </style>
|