query.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <PageWrapper contentBackground>
  3. <template #footer>
  4. <a-tabs v-model:activeKey="tableType" @change="changeTable">
  5. <a-tab-pane :key="null" :tab="t('routes.spares.tableType.-1')" />
  6. <a-tab-pane :key="0" :tab="t('routes.spares.tableType.0')" />
  7. <a-tab-pane :key="1" :tab="t('routes.spares.tableType.1')" />
  8. <a-tab-pane :key="2" :tab="t('routes.spares.tableType.2')" />
  9. <a-tab-pane :key="3" :tab="t('routes.spares.tableType.3')" />
  10. <a-tab-pane :key="4" :tab="t('routes.spares.tableType.4')" />
  11. <a-tab-pane :key="5" :tab="t('routes.spares.tableType.5')" />
  12. <a-tab-pane :key="6" :tab="t('routes.spares.tableType.6')" />
  13. <a-tab-pane :key="7" :tab="t('routes.spares.tableType.7')" />
  14. <a-tab-pane :key="8" :tab="t('routes.spares.tableType.8')" />
  15. <a-tab-pane :key="9" :tab="t('routes.spares.tableType.9')" />
  16. <a-tab-pane :key="10" :tab="t('routes.spares.tableType.10')" />
  17. </a-tabs></template
  18. >
  19. <div class="desc-wrap-BasicTable">
  20. <BasicTable @register="registerTable">
  21. <template #action="{ record }">
  22. <TableAction
  23. stopButtonPropagation
  24. :actions="[
  25. {
  26. label: '详情',
  27. //ifShow:getCheckPerm('work_detail'),
  28. onClick: handleDetail.bind(null, record),
  29. },
  30. ]"
  31. />
  32. </template>
  33. </BasicTable>
  34. <recoveryModal @update="reload" @register="registerRecovery" />
  35. <!-- ifShow: getCheckPerm('device-out') && !Boolean(record.outType), -->
  36. </div>
  37. </PageWrapper>
  38. </template>
  39. <script lang="ts">
  40. import { defineComponent, onMounted, ref, onActivated } from 'vue';
  41. import { PageWrapper } from '/@/components/Page';
  42. import {
  43. BasicTable,
  44. useTable,
  45. TableAction,
  46. BasicColumn,
  47. TableImg,
  48. FormProps,
  49. } from '/@/components/Table';
  50. import { Tabs } from 'ant-design-vue';
  51. import { operateSceneList } from '/@/api/operate';
  52. import { useI18n } from '/@/hooks/web/useI18n';
  53. import { usePermissionStore } from '/@/store/modules/permission';
  54. import recoveryModal from './recoveryModal.vue';
  55. import { useModal } from '/@/components/Modal';
  56. import { useRouter } from 'vue-router'
  57. import { queryList, faultAllList, getByRoleType } from '/@/api/spares';
  58. export default defineComponent({
  59. name:'工单查询',
  60. components: {
  61. BasicTable,
  62. TableAction,
  63. TableImg,
  64. recoveryModal,
  65. PageWrapper,
  66. [Tabs.name]: Tabs,
  67. [Tabs.TabPane.name]: Tabs.TabPane,
  68. },
  69. setup() {
  70. const { t } = useI18n();
  71. const permissionStore = usePermissionStore();
  72. const router = useRouter()
  73. const { getCheckPerm } = permissionStore;
  74. const tableType = ref<Recordable>(0); //0看看 、1看见、2深时
  75. onMounted(() => {
  76. // console.log(router.currentRoute.value.params.id);
  77. });
  78. const columns: BasicColumn[] = [
  79. {
  80. title: '报修日期',
  81. dataIndex: 'createTime',
  82. width: 180,
  83. },
  84. {
  85. title: '客户名称',
  86. dataIndex: 'customerName',
  87. width: 80,
  88. // customRender: ({ record }) => {
  89. // return t(`routes.equity.operation.${record.operationType || 0}`);
  90. // },
  91. },
  92. {
  93. title: '产品类型',
  94. dataIndex: 'cameraType',
  95. width: 80,
  96. customRender: ({ record }) => {
  97. return t(`routes.scene.tableType.${record.cameraType || 0}`);
  98. },
  99. },
  100. {
  101. title: '产品SN码',
  102. dataIndex: 'cameraSnCode',
  103. width: 100,
  104. },
  105. {
  106. title: '报修方式',
  107. dataIndex: 'receiverType',
  108. width: 100,
  109. customRender: ({ record }) => {
  110. return record.receiverType == 0 ? '系统录单' : '公众号报修';
  111. },
  112. },
  113. {
  114. title: '保修类型',
  115. dataIndex: 'warrantyType',
  116. width: 100,
  117. customRender: ({ record }) => {
  118. return record.warrantyType == 0 ? '保修期内' : record.warrantyType == 1 ? '保修期外' : '非保修项目';
  119. },
  120. },{
  121. title: '售后工程师',
  122. dataIndex: 'saleName',
  123. width: 100,
  124. },{
  125. title: '接单日期',
  126. dataIndex: 'orderReceivingTime',
  127. width: 150,
  128. },
  129. {
  130. title: '故障分析',
  131. dataIndex: 'checkResult',
  132. width: 100,
  133. },
  134. {
  135. title: '维修工程师',
  136. dataIndex: 'repairManName',
  137. width: 100,
  138. },{
  139. title: '维修完成日期',
  140. dataIndex: 'repairOverTime',
  141. width: 150,
  142. },
  143. {
  144. title: '状态',
  145. dataIndex: 'status',
  146. width: 100,
  147. customRender: ({ record }) => {
  148. return t(`routes.spares.tableType.${record.status || 0}`);
  149. },
  150. },
  151. {
  152. title: '维修单号',
  153. dataIndex: 'repairId',
  154. width: 180,
  155. },
  156. {
  157. title: t('common.operating'),
  158. dataIndex: 'action',
  159. slots: { customRender: 'action' },
  160. ifShow: true,
  161. fixed: 'right',
  162. flag: 'ACTION',
  163. width: 120,
  164. },
  165. ];
  166. const searchForm: Partial<FormProps> = {
  167. labelWidth: 120,
  168. autoAdvancedLine: 1,
  169. actionColOptions: {
  170. span: 24,
  171. },
  172. schemas: [
  173. {
  174. field: 'type',
  175. component: 'Select',
  176. label: t('routes.device.deviceType'),
  177. colProps: {
  178. span: 7,
  179. },
  180. componentProps: {
  181. options: [
  182. {
  183. label: '公众号保修',
  184. value: 0,
  185. key: '0',
  186. },{
  187. label: '后台录单',
  188. value: 1,
  189. key: '1',
  190. },
  191. ],
  192. },
  193. },{
  194. field: 'type',
  195. component: 'Select',
  196. label: t('routes.device.deviceType'),
  197. colProps: {
  198. span: 7,
  199. },
  200. componentProps: {
  201. options: [
  202. {
  203. label: t('routes.device.type.1'),
  204. value: 0,
  205. key: '0',
  206. },
  207. {
  208. label: t('routes.device.type.2'),
  209. value: 1,
  210. key: '1',
  211. },
  212. {
  213. label: t('routes.device.type.3'),
  214. value: 2,
  215. key: '2',
  216. },
  217. ],
  218. },
  219. },{
  220. field: 'cameraSnCode',
  221. component: 'Input',
  222. label: 'SN码',
  223. colProps: {
  224. span: 7,
  225. },
  226. },{
  227. field: 'customerName',
  228. component: 'Input',
  229. label: '客户名称',
  230. colProps: {
  231. span: 7,
  232. },
  233. },{
  234. field: 'warrantyType',
  235. component: 'Select',
  236. label: '保修类型',
  237. colProps: {
  238. span: 7,
  239. },
  240. componentProps: {
  241. options: [
  242. {
  243. label: '保修期内',
  244. value: 0,
  245. key: '0',
  246. },{
  247. label: '保修期外',
  248. value: 1,
  249. key: '1',
  250. },{
  251. label: '非保修项目',
  252. value: 2,
  253. key: '2',
  254. },
  255. ],
  256. },
  257. },{
  258. field: 'faultId',
  259. component: 'ApiSelect',
  260. label: '故障类型',
  261. componentProps: {
  262. maxLength: 50,
  263. api: faultAllList,
  264. numberToString: true,
  265. labelField: 'faultMsg',
  266. valueField: 'faultId',
  267. immediate: true,
  268. },
  269. colProps: {
  270. span: 7,
  271. },
  272. },{
  273. field: 'saleId',
  274. label: '售后工程师',
  275. component: 'ApiSelect',
  276. componentProps: {
  277. api: getByRoleType,
  278. numberToString: true,
  279. labelField: 'nickName',
  280. valueField: 'id',
  281. immediate: true,
  282. params: {
  283. roleType: 2,
  284. },
  285. },
  286. colProps: {
  287. span: 7,
  288. },
  289. },{
  290. field: 'repairManId',
  291. label: '维修工程师',
  292. component: 'ApiSelect',
  293. componentProps: {
  294. api: getByRoleType,
  295. numberToString: true,
  296. labelField: 'nickName',
  297. valueField: 'id',
  298. immediate: true,
  299. params: {
  300. roleType: 3,
  301. },
  302. },
  303. colProps: {
  304. span: 7,
  305. },
  306. },{
  307. field: 'payStatus',
  308. component: 'Select',
  309. label: '支付状态',
  310. colProps: {
  311. span: 7,
  312. },
  313. componentProps: {
  314. options: [
  315. {
  316. label: '待支付',
  317. value: 0,
  318. key: '0',
  319. },{
  320. label: '已支付',
  321. value: 1,
  322. key: '1',
  323. },
  324. ],
  325. },
  326. },{
  327. field: 'commentStatus',
  328. component: 'Select',
  329. label: '支付状态',
  330. colProps: {
  331. span: 7,
  332. },
  333. componentProps: {
  334. options: [
  335. {
  336. label: '未评论',
  337. value: 0,
  338. key: '0',
  339. },{
  340. label: '已评论',
  341. value: 1,
  342. key: '1',
  343. },
  344. ],
  345. },
  346. },
  347. {
  348. field: 'timeList',
  349. label: '报修日期',
  350. component: 'RangePicker',
  351. componentProps: {
  352. maxLength: 100,
  353. format: 'YYYY-MM-DD',
  354. valueFormat: 'YYYY-MM-DD',
  355. showTime: true,
  356. },
  357. colProps: {
  358. span: 7,
  359. },
  360. },
  361. ],
  362. };
  363. const [registerRecovery, { openModal }] = useModal();
  364. const [registerTable, { reload }] = useTable({
  365. api: queryList,
  366. columns: columns,
  367. useSearchForm: true,
  368. searchInfo: { status: tableType },
  369. formConfig: searchForm,
  370. showTableSetting: true,
  371. showIndexColumn: false,
  372. fetchSetting: {
  373. pageField: 'pageNum',
  374. sizeField: 'pageSize',
  375. listField: 'list',
  376. totalField: 'total',
  377. },
  378. canResize: false,
  379. });
  380. onActivated(()=>{
  381. reload();
  382. })
  383. async function handleDetail(record: Recordable) {
  384. console.log('record', record);
  385. router.push({path:`detail/${record.repairId||'20230215174919387'}`})
  386. }
  387. async function handleRecover(record: Recordable) {
  388. openModal(true, {
  389. ...record,
  390. });
  391. }
  392. function changeTable(val: string) {
  393. tableType.value = val;
  394. reload();
  395. }
  396. return {
  397. registerTable,
  398. reload,
  399. t,
  400. tableType,
  401. changeTable,
  402. getCheckPerm,
  403. handleDetail,
  404. handleRecover,
  405. registerRecovery,
  406. };
  407. },
  408. });
  409. </script>
  410. <style lang="less" scoped>
  411. .desc-wrap-BasicTable {
  412. background-color: #f0f2f5;
  413. .vben-basic-table-form-container {
  414. padding: 0;
  415. }
  416. }
  417. </style>