testList.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <PageWrapper contentBackground>
  3. <template #footer>
  4. <a-tabs v-model:activeKey="tableType" @change="changeTable">
  5. <a-tab-pane :key="0" :tab="t('routes.spares.tableType.26')" />
  6. <a-tab-pane :key="1" :tab="t('routes.spares.tableType.27')" />
  7. </a-tabs></template
  8. >
  9. <div class="desc-wrap-BasicTable">
  10. <BasicTable @register="registerTable">
  11. <!-- <template #toolbar>
  12. <a-button type="primary" @click="handleOrder" v-if="getCheckPerm('invoice-export')"> 录单</a-button>
  13. </template> -->
  14. <template #action="{ record }">
  15. <TableAction
  16. stopButtonPropagation
  17. :actions="[
  18. {
  19. label: '详情',
  20. ifShow:getCheckPerm('work_detail'),
  21. onClick: handleDetail.bind(null, record),
  22. },
  23. {
  24. label: '测试登记',
  25. ifShow: getCheckPerm('repair_test') && tableType == 0,
  26. onClick: handleRecover.bind(null, record),
  27. },
  28. ]"
  29. />
  30. </template>
  31. </BasicTable>
  32. <reviewModal @update="reload" @register="registerRecovery" />
  33. <!-- ifShow: getCheckPerm('device-out') && !Boolean(record.outType), -->
  34. </div>
  35. </PageWrapper>
  36. </template>
  37. <script lang="ts">
  38. import { defineComponent, onMounted, ref, onActivated } from 'vue';
  39. import { PageWrapper } from '/@/components/Page';
  40. import {
  41. BasicTable,
  42. useTable,
  43. TableAction,
  44. BasicColumn,
  45. TableImg,
  46. FormProps,
  47. } from '/@/components/Table';
  48. import { Tabs } from 'ant-design-vue';
  49. import { operateSceneList } from '/@/api/operate';
  50. import { useI18n } from '/@/hooks/web/useI18n';
  51. import { usePermissionStore } from '/@/store/modules/permission';
  52. import reviewModal from './reviewModal.vue';
  53. import { useModal } from '/@/components/Modal';
  54. import { useRouter } from 'vue-router'
  55. import { repairTesterList } from '/@/api/spares';
  56. export default defineComponent({
  57. name:'维修测试',
  58. components: {
  59. BasicTable,
  60. TableAction,
  61. TableImg,
  62. reviewModal,
  63. PageWrapper,
  64. [Tabs.name]: Tabs,
  65. [Tabs.TabPane.name]: Tabs.TabPane,
  66. },
  67. setup() {
  68. const { t } = useI18n();
  69. const permissionStore = usePermissionStore();
  70. const router = useRouter()
  71. const { getCheckPerm } = permissionStore;
  72. const tableType = ref<Recordable>(0); //0看看 、1看见、2深时
  73. onMounted(() => {
  74. // console.log(router.currentRoute.value.params.id);
  75. });
  76. const columns: BasicColumn[] = [
  77. {
  78. title: '报修日期',
  79. dataIndex: 'createTime',
  80. width: 180,
  81. },
  82. {
  83. title: '客户名称',
  84. dataIndex: 'customerName',
  85. width: 80,
  86. // customRender: ({ record }) => {
  87. // return t(`routes.equity.operation.${record.operationType || 0}`);
  88. // },
  89. },
  90. {
  91. title: '产品类型',
  92. dataIndex: 'cameraType',
  93. width: 80,
  94. customRender: ({ record }) => {
  95. return t(`routes.scene.tableType.${record.cameraType || 0}`);
  96. },
  97. },
  98. {
  99. title: '产品SN码',
  100. dataIndex: 'cameraSnCode',
  101. width: 100,
  102. },
  103. {
  104. title: '售后工程师',
  105. dataIndex: 'saleName',
  106. width: 100,
  107. },
  108. {
  109. title: '接单日期',
  110. dataIndex: 'orderReceivingTime',
  111. width: 100,
  112. },
  113. {
  114. title: '故障分析',
  115. dataIndex: 'checkResult',
  116. width: 150,
  117. },
  118. {
  119. title: '维修工程师',
  120. dataIndex: 'repairManName',
  121. width: 100,
  122. },
  123. {
  124. title: '状态',
  125. dataIndex: 'status',
  126. width: 100,
  127. customRender: ({ record }) => {
  128. return t(`routes.spares.tableType.${record.status || 0}`);
  129. },
  130. },
  131. {
  132. title: '工单号',
  133. dataIndex: 'repairId',
  134. width: 150,
  135. },
  136. {
  137. title: t('common.operating'),
  138. dataIndex: 'action',
  139. slots: { customRender: 'action' },
  140. ifShow: true,
  141. fixed: 'right',
  142. flag: 'ACTION',
  143. width: 120,
  144. },
  145. ];
  146. const searchForm: Partial<FormProps> = {
  147. labelWidth: 120,
  148. autoAdvancedLine: 1,
  149. actionColOptions: {
  150. span: 24,
  151. },
  152. schemas: [
  153. {
  154. field: 'cameraType',
  155. component: 'Select',
  156. label: '产品类型',
  157. colProps: {
  158. xl: 7,
  159. xxl: 7,
  160. },
  161. componentProps: {
  162. options: [
  163. {
  164. label: t('routes.device.type.1'),
  165. value: 0,
  166. key: '0',
  167. },
  168. {
  169. label: t('routes.device.type.2'),
  170. value: 1,
  171. key: '1',
  172. },
  173. {
  174. label: t('routes.device.type.3'),
  175. value: 2,
  176. key: '2',
  177. },
  178. ],
  179. },
  180. },
  181. {
  182. field: 'cameraSnCode',
  183. component: 'Input',
  184. label: t('routes.device.snCode'),
  185. colProps: {
  186. xl: 7,
  187. xxl: 7,
  188. },
  189. },
  190. {
  191. field: 'repairId',
  192. component: 'Input',
  193. label: '工单号',
  194. colProps: {
  195. xl: 7,
  196. xxl: 7,
  197. },
  198. },
  199. ],
  200. };
  201. const [registerRecovery, { openModal }] = useModal();
  202. const [registerTable, { reload }] = useTable({
  203. api: repairTesterList,
  204. columns: columns,
  205. useSearchForm: true,
  206. searchInfo: { statusParam: tableType },
  207. formConfig: searchForm,
  208. showTableSetting: true,
  209. showIndexColumn: false,
  210. fetchSetting: {
  211. pageField: 'pageNum',
  212. sizeField: 'pageSize',
  213. listField: 'list',
  214. totalField: 'total',
  215. },
  216. canResize: false,
  217. });
  218. async function handleDetail(record: Recordable) {
  219. console.log('record', record);
  220. router.push({path:`detail/${record.repairId||'20230215174919387'}`})
  221. }
  222. async function handleRecover(record: Recordable) {
  223. openModal(true, {
  224. tableType:tableType.value,
  225. ...record,
  226. });
  227. }
  228. function handleOrder() {
  229. openModal(true);
  230. }
  231. onActivated(()=>{
  232. reload();
  233. })
  234. function changeTable(val: string) {
  235. tableType.value = val;
  236. reload();
  237. }
  238. return {
  239. registerTable,
  240. reload,
  241. t,
  242. tableType,
  243. changeTable,
  244. handleOrder,
  245. getCheckPerm,
  246. handleDetail,
  247. handleRecover,
  248. registerRecovery,
  249. };
  250. },
  251. });
  252. </script>
  253. <style lang="less" scoped>
  254. .desc-wrap-BasicTable {
  255. background-color: #f0f2f5;
  256. .vben-basic-table-form-container {
  257. padding: 0;
  258. }
  259. }
  260. </style>