GoodsEntry.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104
  1. <template>
  2. <cacp-search-layout>
  3. <template #search>
  4. <cacp-search-panel-layout
  5. :model="state.queryData"
  6. ref="formRef"
  7. :rules="rules"
  8. label-position="left"
  9. label-width="auto"
  10. :gutter="30"
  11. :colSpan="6"
  12. >
  13. <el-form-item label="报关单号" prop="entryId">
  14. <el-input v-model="state.queryData.entryId" clearable />
  15. </el-form-item>
  16. <el-form-item label="通关模式" prop="passMode">
  17. <el-select v-model="state.queryData.passMode" clearable>
  18. <el-option
  19. v-for="item in dict.pass_mode"
  20. :key="item.dictValue"
  21. :label="item.dictLabel"
  22. :value="item.dictValue"
  23. />
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="运输方式" prop="trafMode">
  27. <el-select v-model="state.queryData.trafMode" filterable clearable>
  28. <el-option
  29. v-for="item in trafMode"
  30. :key="item.value"
  31. :label="item.label"
  32. :value="item.value">
  33. <span style="float: left">{{ item.label }}</span>
  34. <span style="float: right;color: var(--el-text-color-secondary);font-size: 13px;">
  35. {{ item.value }}
  36. </span>
  37. </el-option>
  38. </el-select>
  39. </el-form-item>
  40. <el-form-item label="进出口标识" prop="ieFlag">
  41. <el-select v-model="state.queryData.ieFlag" clearable>
  42. <el-option
  43. v-for="item in dict.ie_flag"
  44. :key="item.dictValue"
  45. :label="item.dictLabel"
  46. :value="item.dictValue"
  47. />
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="进出境口岸" prop="iePort">
  51. <el-select v-model="state.queryData.iePort" filterable
  52. clearable>
  53. <el-option
  54. v-for="item in iePort"
  55. :key="item.value"
  56. :label="item.label"
  57. :value="item.value"
  58. >
  59. <span style="float: left">{{ item.label }}</span>
  60. <span style="float: right;color: var(--el-text-color-secondary);font-size: 13px;">
  61. {{ item.value }}
  62. </span>
  63. </el-option>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item label="隶属海关" prop="customsCode" v-show="state.isSelect">
  67. <el-select v-model="state.queryData.customsCode"
  68. clearable>
  69. <el-option
  70. v-for="item in dict.affiliation_customs_info"
  71. :key="item.dictValue"
  72. :label="item.dictLabel"
  73. :value="item.dictValue"
  74. />
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="监管方式" prop="tradeMode">
  78. <el-select v-model="state.queryData.tradeMode" clearable>
  79. <el-option
  80. v-for="item in tradeMode"
  81. :key="item.value"
  82. :label="item.label"
  83. :value="item.value">
  84. <span style="float: left">{{ item.label }}</span>
  85. <span style="float: right;color: var(--el-text-color-secondary);font-size: 13px;">
  86. {{ item.value }}
  87. </span>
  88. </el-option>
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item label="报关模式" prop="declMode">
  92. <el-select v-model="state.queryData.declMode"
  93. clearable>
  94. <el-option
  95. v-for="item in dict.decl_mode"
  96. :key="item.dictValue"
  97. :label="item.dictLabel"
  98. :value="item.dictValue"
  99. />
  100. </el-select>
  101. </el-form-item>
  102. <el-form-item label="是否查验" prop="checkFlag">
  103. <el-select v-model="state.queryData.checkFlag"
  104. clearable>
  105. <el-option
  106. v-for="item in dict.yes_no"
  107. :key="item.dictValue"
  108. :label="item.dictLabel"
  109. :value="item.dictValue"
  110. />
  111. </el-select>
  112. </el-form-item>
  113. <el-form-item label="结关开始时间" prop="beginReleaseDate">
  114. <el-date-picker type="date" value-format="YYYY-MM-DD" v-model="state.queryData.beginReleaseDate"
  115. :disabled-date="beginDatePickerOptions" clearable />
  116. </el-form-item>
  117. <el-form-item label="结关结束时间" prop="endReleaseDate">
  118. <el-date-picker type="date" value-format="YYYY-MM-DD" v-model="state.queryData.endReleaseDate"
  119. :disabled-date="endDatePickerOptions" clearable />
  120. </el-form-item>
  121. <template #buttonGroup>
  122. <el-button type="primary" @click="onSearch">查询</el-button>
  123. <el-button type="info" @click="onReset">重置</el-button>
  124. </template>
  125. </cacp-search-panel-layout>
  126. </template>
  127. <cacp-complex-table
  128. :actions="actions"
  129. :data="tableData"
  130. :pagination="tablePagination"
  131. :actionsWidth="50"
  132. @on-page-change="onPageChange"
  133. @on-size-change="onSizeChange"
  134. :loading="loading"
  135. >
  136. <!-- 动态渲染所有列 -->
  137. <template v-for="column in dynamicColumns.visibleColumns.value" :key="column.key">
  138. <el-table-column v-bind="getColumnProps(column)">
  139. <template #default="scope">
  140. <template v-if="column.isDict">
  141. <dict-tag
  142. :options="getDictOptions(column.dictKey!)"
  143. :dictValue="scope.row[column.property!]"
  144. :whole-match="column.key === 'goodsType'"
  145. />
  146. </template>
  147. <template v-else-if="column.isDate">
  148. {{ scope.row[column.property!] ? dayjs(scope.row[column.property!]).format('YYYY-MM-DD HH:mm:ss'):'' }}
  149. </template>
  150. <template v-else-if="getFormatter(column.key)">
  151. {{ getFormatter(column.key)!(scope.row[column.property!]) }}
  152. </template>
  153. <template v-else>
  154. {{ scope.row[column.property!] }}
  155. </template>
  156. </template>
  157. </el-table-column>
  158. </template>
  159. </cacp-complex-table>
  160. <!-- 动态列设置对话框 -->
  161. <DynamicColumnDialog
  162. v-model="showColumnDialog"
  163. :width="'70%'"
  164. :columns="allColumnConfigs"
  165. :selected-keys="dynamicColumns.selectedKeys.value"
  166. @update:selected-keys="dynamicColumns.updateSelectedKeys"
  167. />
  168. </cacp-search-layout>
  169. </template>
  170. <script setup lang="ts">
  171. import { useLoading } from '@cacp/ui'
  172. import { exportList, getList} from '@/apis/analyze/goodsEntry'
  173. import type {EntryQuery, Entry} from '@/types/analyze/goodsEntry'
  174. import config from '@/config'
  175. import { getBaseCodeList } from '@/apis/base/baseCode'
  176. import dayjs from 'dayjs'
  177. import {
  178. SuccessResultCode,
  179. useComplexTable,
  180. type SearchPanelLayoutInstance,
  181. type TableAction
  182. } from '@cacp/ui'
  183. import type { FormRules } from 'element-plus'
  184. import { ref, reactive, onBeforeMount } from 'vue'
  185. import { useRouter } from 'vue-router'
  186. import { permissionStatus } from '@/utils/globalPermission'
  187. import { useDictType } from '@/components/useDict'
  188. import { useCoreStore } from '@/stores'
  189. import DictTag from "@/components/DictTag/dictTag.vue";
  190. import DynamicColumnDialog, { type ColumnConfig } from '@/components/DynamicColumnSelector/DynamicColumnDialog.vue'
  191. import { useDynamicColumns } from '@/hooks/useDynamicColumns'
  192. const coreStore = useCoreStore()
  193. interface State {
  194. queryData: EntryQuery
  195. isSelect: boolean
  196. }
  197. const { loading, setLoading } = useLoading()
  198. const { dict } = useDictType('affiliation_customs_info', 'proc_idea', 'proc_result', 'yes_no', 'decl_mode', 'pass_mode', 'ie_flag','goods_type')
  199. const tableHooks = useComplexTable<Entry>(config)
  200. const { tableData, tablePagination, setPagination, setPageIndex, setPageSizes } = tableHooks
  201. const router = useRouter()
  202. const formRef = ref<SearchPanelLayoutInstance>()
  203. //基础数据返回jsonObject
  204. const iePort = ref([]);
  205. const trafMode = ref([]);
  206. const tradeMode = ref([]);
  207. const tradeCountry = ref([]);
  208. const countryIso = ref([]);
  209. const now = dayjs();
  210. const endDatePickerOptions = (time:Date) => {
  211. if (!state.queryData.beginReleaseDate) return false // 如果没有选择开始日期,结束日期不受限制
  212. return time.getTime() < new Date(state.queryData.beginReleaseDate).getTime() - 8.64e7;//如果没有后面的-8.64e7就是不可以选择今天的
  213. }
  214. const beginDatePickerOptions = (time:Date) => {
  215. if (!state.queryData.endReleaseDate) return false // 如果没有选择开始日期,结束日期不受限制
  216. return time.getTime() > new Date(state.queryData.endReleaseDate).getTime() - 8.64e6;//如果没有后面的-8.64e6就是不可以选择今天的
  217. }
  218. // 定义所有列的配置
  219. const allColumnConfigs: ColumnConfig[] = [
  220. {
  221. key: 'entryId',
  222. property: 'entryId',
  223. label: '报关单号',
  224. width: 160,
  225. sortable: true,
  226. groupKey: 'entry',
  227. groupTitle: '报关单信息',
  228. defaultVisible: true
  229. },
  230. {
  231. key: 'passMode',
  232. property: 'passMode',
  233. label: '通关模式',
  234. width: 80,
  235. groupKey: 'entry',
  236. groupTitle: '报关单信息',
  237. defaultVisible: true,
  238. isDict: true,
  239. dictKey: 'pass_mode'
  240. },
  241. {
  242. key: 'trafMode',
  243. property: 'trafMode',
  244. label: '运输方式',
  245. width: 80,
  246. groupKey: 'entry',
  247. groupTitle: '报关单信息',
  248. defaultVisible: true
  249. },
  250. {
  251. key: 'ieFlag',
  252. property: 'ieFlag',
  253. label: '出入境标志',
  254. width: 90,
  255. groupKey: 'entry',
  256. groupTitle: '报关单信息',
  257. defaultVisible: true,
  258. isDict: true,
  259. dictKey: 'ie_flag'
  260. },
  261. {
  262. key: 'iePort',
  263. property: 'iePort',
  264. label: '进出境口岸',
  265. width: 100,
  266. groupKey: 'entry',
  267. groupTitle: '报关单信息',
  268. defaultVisible: true
  269. },
  270. {
  271. key: 'customsCode',
  272. property: 'customsCode',
  273. label: '隶属海关',
  274. width: 100,
  275. groupKey: 'entry',
  276. groupTitle: '报关单信息',
  277. defaultVisible: true,
  278. isDict: true,
  279. dictKey: 'affiliation_customs_info'
  280. },
  281. {
  282. key: 'tradeMode',
  283. property: 'tradeMode',
  284. label: '监管方式',
  285. width: 80,
  286. groupKey: 'entry',
  287. groupTitle: '报关单信息',
  288. defaultVisible: true
  289. },
  290. {
  291. key: 'declMode',
  292. property: 'declMode',
  293. label: '报关模式',
  294. width: 80,
  295. groupKey: 'entry',
  296. groupTitle: '报关单信息',
  297. defaultVisible: true,
  298. isDict: true,
  299. dictKey: 'decl_mode'
  300. },
  301. {
  302. key: 'tradeCountry',
  303. property: 'tradeCountry',
  304. label: '贸易国别',
  305. width: 80,
  306. groupKey: 'entry',
  307. groupTitle: '报关单信息',
  308. defaultVisible: true
  309. },
  310. {
  311. key: 'ieDate',
  312. property: 'ieDate',
  313. label: '进出口时间',
  314. width: 150,
  315. sortable: true,
  316. groupKey: 'entry',
  317. groupTitle: '报关单信息',
  318. defaultVisible: true,
  319. isDate: true
  320. },
  321. {
  322. key: 'declDate',
  323. property: 'declDate',
  324. label: '申报时间',
  325. width: 150,
  326. sortable: true,
  327. groupKey: 'entry',
  328. groupTitle: '报关单信息',
  329. defaultVisible: true,
  330. isDate: true
  331. },
  332. {
  333. key: 'releaseDate',
  334. property: 'releaseDate',
  335. label: '结关时间',
  336. width: 150,
  337. sortable: true,
  338. groupKey: 'entry',
  339. groupTitle: '报关单信息',
  340. defaultVisible: true,
  341. isDate: true
  342. },
  343. {
  344. key: 'declAdvanceFlag',
  345. property: 'declAdvanceFlag',
  346. label: '是否提前申报',
  347. width: 110,
  348. groupKey: 'entry',
  349. groupTitle: '报关单信息',
  350. defaultVisible: false,
  351. isDict: true,
  352. dictKey: 'yes_no'
  353. },
  354. {
  355. key: 'acceptDate',
  356. property: 'acceptDate',
  357. label: '自动受理时间',
  358. width: 150,
  359. groupKey: 'entry',
  360. groupTitle: '报关单信息',
  361. defaultVisible: false,
  362. isDate: true
  363. },
  364. {
  365. key: 'exInPortDate',
  366. property: 'exInPortDate',
  367. label: '货物进港时间',
  368. width: 150,
  369. groupKey: 'entry',
  370. groupTitle: '报关单信息',
  371. defaultVisible: false,
  372. isDate: true
  373. },
  374. {
  375. key: 'orderReceiveDate',
  376. property: 'orderReceiveDate',
  377. label: '现场接单时间',
  378. width: 150,
  379. groupKey: 'entry',
  380. groupTitle: '报关单信息',
  381. defaultVisible: false,
  382. isDate: true
  383. },
  384. {
  385. key: 'certRlsDate',
  386. property: 'certRlsDate',
  387. label: '单证放行时间',
  388. width: 150,
  389. groupKey: 'entry',
  390. groupTitle: '报关单信息',
  391. defaultVisible: false,
  392. isDate: true
  393. },
  394. {
  395. key: 'preReleaseDate',
  396. property: 'preReleaseDate',
  397. label: '担保放行时间',
  398. width: 150,
  399. groupKey: 'entry',
  400. groupTitle: '报关单信息',
  401. defaultVisible: false,
  402. isDate: true
  403. },
  404. {
  405. key: 'examDate',
  406. property: 'examDate',
  407. label: '转关数据发送时间',
  408. width: 150,
  409. groupKey: 'entry',
  410. groupTitle: '报关单信息',
  411. defaultVisible: false,
  412. isDate: true
  413. },
  414. {
  415. key: 'checkDate',
  416. property: 'checkDate',
  417. label: '转关数据核销时间',
  418. width: 150,
  419. groupKey: 'entry',
  420. groupTitle: '报关单信息',
  421. defaultVisible: false,
  422. isDate: true
  423. },
  424. {
  425. key: 'assessStartDate',
  426. property: 'assessStartDate',
  427. label: '现场验估时间',
  428. width: 150,
  429. groupKey: 'entry',
  430. groupTitle: '报关单信息',
  431. defaultVisible: false,
  432. isDate: true
  433. },
  434. {
  435. key: 'assessEndDate',
  436. property: 'assessEndDate',
  437. label: '验估处置完毕时间',
  438. width: 150,
  439. groupKey: 'entry',
  440. groupTitle: '报关单信息',
  441. defaultVisible: false,
  442. isDate: true
  443. },
  444. {
  445. key: 'newTwoStepFlag',
  446. property: 'newTwoStepFlag',
  447. label: '是否新两步申报',
  448. width: 120,
  449. groupKey: 'entry',
  450. groupTitle: '报关单信息',
  451. defaultVisible: false,
  452. isDict: true,
  453. dictKey: 'yes_no'
  454. },
  455. // 单位信息组
  456. {
  457. key: 'consignCode',
  458. property: 'consignCode',
  459. label: '境内收发货人代码',
  460. width: 130,
  461. groupKey: 'entry',
  462. groupTitle: '报关单信息',
  463. defaultVisible: false
  464. },
  465. {
  466. key: 'consignName',
  467. property: 'consignName',
  468. label: '境内收发货人名称',
  469. width: 130,
  470. showOverflowTooltip: true,
  471. groupKey: 'entry',
  472. groupTitle: '报关单信息',
  473. defaultVisible: false
  474. },
  475. {
  476. key: 'frnConsignCode',
  477. property: 'frnConsignCode',
  478. label: '境外收发货人代码',
  479. width: 130,
  480. groupKey: 'entry',
  481. groupTitle: '报关单信息',
  482. defaultVisible: false
  483. },
  484. {
  485. key: 'frnConsignName',
  486. property: 'frnConsignName',
  487. label: '境外收发货人名称(中文)',
  488. width: 170,
  489. showOverflowTooltip: true,
  490. groupKey: 'entry',
  491. groupTitle: '报关单信息',
  492. defaultVisible: false
  493. },
  494. {
  495. key: 'agentCode',
  496. property: 'agentCode',
  497. label: '申报单位代码',
  498. width: 110,
  499. groupKey: 'entry',
  500. groupTitle: '报关单信息',
  501. defaultVisible: false
  502. },
  503. {
  504. key: 'agentName',
  505. property: 'agentName',
  506. label: '申报单位名称',
  507. width: 110,
  508. showOverflowTooltip: true,
  509. groupKey: 'entry',
  510. groupTitle: '报关单信息',
  511. defaultVisible: false
  512. },
  513. {
  514. key: 'ownerCode',
  515. property: 'ownerCode',
  516. label: '生产销售单位代码',
  517. width: 130,
  518. groupKey: 'entry',
  519. groupTitle: '报关单信息',
  520. defaultVisible: false
  521. },
  522. {
  523. key: 'ownerName',
  524. property: 'ownerName',
  525. label: '生产销售单位名称',
  526. width: 130,
  527. showOverflowTooltip: true,
  528. groupKey: 'entry',
  529. groupTitle: '报关单信息',
  530. defaultVisible: false
  531. },
  532. // 货运信息组
  533. {
  534. key: 'grossWt',
  535. property: 'grossWt',
  536. label: '货运量毛重',
  537. width: 90,
  538. groupKey: 'entry',
  539. groupTitle: '报关单信息',
  540. defaultVisible: false
  541. },
  542. {
  543. key: 'netWt',
  544. property: 'netWt',
  545. label: '货运量净重',
  546. width: 90,
  547. groupKey: 'entry',
  548. groupTitle: '报关单信息',
  549. defaultVisible: false
  550. },
  551. {
  552. key: 'rmbPrice',
  553. property: 'rmbPrice',
  554. label: '货运值人民币(总)',
  555. width: 130,
  556. groupKey: 'entry',
  557. groupTitle: '报关单信息',
  558. defaultVisible: false
  559. },
  560. {
  561. key: 'usdPrice',
  562. property: 'usdPrice',
  563. label: '货运值美元(总)',
  564. width: 130,
  565. groupKey: 'entry',
  566. groupTitle: '报关单信息',
  567. defaultVisible: false
  568. },
  569. // 时效信息组
  570. {
  571. key: 'orderReceiveCost',
  572. property: 'orderReceiveCost',
  573. label: '接单耗时(小时)',
  574. width: 120,
  575. groupKey: 'entry',
  576. groupTitle: '报关单信息',
  577. defaultVisible: false
  578. },
  579. {
  580. key: 'cuCost',
  581. property: 'cuCost',
  582. label: '海关通关时间(小时)',
  583. width: 140,
  584. groupKey: 'entry',
  585. groupTitle: '报关单信息',
  586. defaultVisible: true
  587. },
  588. {
  589. key: 'totalCost',
  590. property: 'totalCost',
  591. label: '整体通关时间(小时)',
  592. width: 140,
  593. groupKey: 'entry',
  594. groupTitle: '报关单信息',
  595. defaultVisible: true
  596. },
  597. {
  598. key: 'beforeDeclCost',
  599. property: 'beforeDeclCost',
  600. label: '申报前准备时间(小时)',
  601. width: 150,
  602. groupKey: 'entry',
  603. groupTitle: '报关单信息',
  604. defaultVisible: false
  605. },
  606. {
  607. key: 'noteS',
  608. property: 'noteS',
  609. label: '备注',
  610. showOverflowTooltip: true,
  611. groupKey: 'entry',
  612. groupTitle: '报关单信息',
  613. defaultVisible: false
  614. },
  615. // 查验信息组
  616. {
  617. key: 'checkFlag',
  618. property: 'checkFlag',
  619. label: '是否查验',
  620. width: 80,
  621. groupKey: 'inspection',
  622. groupTitle: '查验信息',
  623. defaultVisible: false,
  624. isDict: true,
  625. dictKey: 'yes_no'
  626. },
  627. {
  628. key: 'checkCustomsCode',
  629. property: 'checkCustomsCode',
  630. label: '查验海关',
  631. width: 100,
  632. groupKey: 'inspection',
  633. groupTitle: '查验信息',
  634. defaultVisible: false,
  635. isDict: true,
  636. dictKey: 'affiliation_customs_info'
  637. },
  638. {
  639. key: 'manCreateTime',
  640. property: 'manCreateTime',
  641. label: '查验指令下达时间',
  642. width: 150,
  643. groupKey: 'inspection',
  644. groupTitle: '查验信息',
  645. defaultVisible: false,
  646. isDate: true
  647. },
  648. {
  649. key: 'manChkTimeStart',
  650. property: 'manChkTimeStart',
  651. label: '查验开始时间',
  652. width: 150,
  653. sortable: true,
  654. groupKey: 'inspection',
  655. groupTitle: '查验信息',
  656. defaultVisible: false,
  657. isDate: true
  658. },
  659. {
  660. key: 'manChkTimeEnd',
  661. property: 'manChkTimeEnd',
  662. label: '查验结束时间',
  663. width: 150,
  664. groupKey: 'inspection',
  665. groupTitle: '查验信息',
  666. defaultVisible: false,
  667. isDate: true
  668. },
  669. {
  670. key: 'manProcResult',
  671. property: 'manProcResult',
  672. label: '处理结果',
  673. width: 80,
  674. showOverflowTooltip: true,
  675. groupKey: 'inspection',
  676. groupTitle: '查验信息',
  677. defaultVisible: false,
  678. isDict: true,
  679. dictKey: 'proc_result'
  680. },
  681. {
  682. key: 'manProcIdea',
  683. property: 'manProcIdea',
  684. label: '处理意见',
  685. width: 80,
  686. showOverflowTooltip: true,
  687. groupKey: 'inspection',
  688. groupTitle: '查验信息',
  689. defaultVisible: false,
  690. isDict: true,
  691. dictKey: 'proc_idea'
  692. },
  693. {
  694. key: 'profVerifyFlag',
  695. property: 'profVerifyFlag',
  696. label: '是否专业审单',
  697. width: 110,
  698. groupKey: 'inspection',
  699. groupTitle: '查验信息',
  700. defaultVisible: false,
  701. isDict: true,
  702. dictKey: 'yes_no'
  703. },
  704. // 商品信息组
  705. {
  706. key: 'gno',
  707. property: 'gno',
  708. label: '商品项号',
  709. width: 80,
  710. groupKey: 'goods',
  711. groupTitle: '商品信息',
  712. defaultVisible: true
  713. },
  714. {
  715. key: 'iqCode',
  716. property: 'iqCode',
  717. label: '检验检疫编码',
  718. width: 120,
  719. groupKey: 'goods',
  720. groupTitle: '商品信息',
  721. defaultVisible: false
  722. },
  723. {
  724. key: 'codeTs',
  725. property: 'codeTs',
  726. label: '商品编码',
  727. width: 100,
  728. groupKey: 'goods',
  729. groupTitle: '商品信息',
  730. defaultVisible: true
  731. },
  732. {
  733. key: 'gname',
  734. property: 'gname',
  735. label: '商品名称',
  736. width: 100,
  737. showOverflowTooltip: true,
  738. groupKey: 'goods',
  739. groupTitle: '商品信息',
  740. defaultVisible: true
  741. },
  742. {
  743. key: 'gmodel',
  744. property: 'gmodel',
  745. label: '规格型号',
  746. width: 100,
  747. showOverflowTooltip: true,
  748. groupKey: 'goods',
  749. groupTitle: '商品信息',
  750. defaultVisible: true
  751. },
  752. {
  753. key: 'qty1',
  754. property: 'qty1',
  755. label: '第一(法定)数量',
  756. width: 120,
  757. groupKey: 'goods',
  758. groupTitle: '商品信息',
  759. defaultVisible: false
  760. },
  761. {
  762. key: 'rmbPriceList',
  763. property: 'rmbPriceList',
  764. label: '商品货运值人民币',
  765. width: 130,
  766. groupKey: 'goods',
  767. groupTitle: '商品信息',
  768. defaultVisible: false
  769. },
  770. {
  771. key: 'usdPriceList',
  772. property: 'usdPriceList',
  773. label: '商品货运值美元',
  774. width: 130,
  775. groupKey: 'goods',
  776. groupTitle: '商品信息',
  777. defaultVisible: false
  778. },
  779. {
  780. key: 'gCertFlag',
  781. property: 'gCertFlag',
  782. label: '每项商品需要监管证件',
  783. width: 160,
  784. groupKey: 'goods',
  785. groupTitle: '商品信息',
  786. defaultVisible: false
  787. },
  788. {
  789. key: 'ungid',
  790. property: 'ungid',
  791. label: 'UN编码',
  792. width: 70,
  793. groupKey: 'goods',
  794. groupTitle: '商品信息',
  795. defaultVisible: false
  796. },
  797. {
  798. key: 'ungFlag',
  799. property: 'ungFlag',
  800. label: '非危险化学品',
  801. width: 110,
  802. groupKey: 'goods',
  803. groupTitle: '商品信息',
  804. defaultVisible: false,
  805. isDict: true,
  806. dictKey: 'yes_no'
  807. },
  808. {
  809. key: 'ungModel',
  810. property: 'ungModel',
  811. label: '危包规格',
  812. width: 110,
  813. groupKey: 'goods',
  814. groupTitle: '商品信息',
  815. defaultVisible: false
  816. },
  817. {
  818. key: 'ungClassify',
  819. property: 'ungClassify',
  820. label: '危包类别',
  821. width: 80,
  822. groupKey: 'goods',
  823. groupTitle: '商品信息',
  824. defaultVisible: false
  825. },
  826. {
  827. key: 'ungGName',
  828. property: 'ungGName',
  829. label: '危险货物名称',
  830. width: 110,
  831. showOverflowTooltip: true,
  832. groupKey: 'goods',
  833. groupTitle: '商品信息',
  834. defaultVisible: false
  835. },
  836. {
  837. key: 'productCharCode',
  838. property: 'productCharCode',
  839. label: '货物属性代码',
  840. width: 110,
  841. groupKey: 'goods',
  842. groupTitle: '商品信息',
  843. defaultVisible: false
  844. },
  845. {
  846. key: 'goodsType',
  847. property: 'goodsType',
  848. label: '危险品类型',
  849. width: 130,
  850. groupKey: 'goods',
  851. groupTitle: '商品信息',
  852. defaultVisible: true,
  853. isDict: true,
  854. dictKey: 'goods_type'
  855. }
  856. ];
  857. // 使用动态列 Hook
  858. const dynamicColumns = useDynamicColumns({
  859. storageKey: 'goods_entry_columns',
  860. defaultVisibleKeys: allColumnConfigs
  861. .filter(col => col.defaultVisible)
  862. .map(col => col.key),
  863. columns: allColumnConfigs
  864. })
  865. // 对话框显示状态
  866. const showColumnDialog = ref(false)
  867. const state = reactive<State>({
  868. queryData: {
  869. entryId: '',
  870. beginReleaseDate: now.subtract(1, 'month').format('YYYY-MM-DD'),
  871. endReleaseDate: now.format('YYYY-MM-DD'),
  872. ieFlag: '',
  873. iePort: '',
  874. customsCode: '',
  875. passMode: '',
  876. trafMode: '',
  877. tradeMode: '',
  878. declMode: '',
  879. checkFlag: '',
  880. goodsType: '2'
  881. },
  882. isSelect: false,
  883. })
  884. const rules = reactive<FormRules<EntryQuery>>({
  885. beginReleaseDate: [{ required: true, message: '请输入结关开始时间', trigger: 'change' }],
  886. endReleaseDate: [{ required: true, message: '请输入结关结束时间', trigger: 'change' }]
  887. })
  888. const actions = <Array<TableAction>>[
  889. {
  890. key: '1',
  891. text: '查看',
  892. onclick: onView,
  893. limit: permissionStatus('one', 'GOODS_ENTRY_VIEW_BT'),
  894. type: 'primary'
  895. },
  896. {
  897. key: '2',
  898. text: '动态列设置',
  899. onclick: onColumnsSelector,
  900. limit: 'none',
  901. type: 'primary'
  902. },
  903. {
  904. key: '3',
  905. text: '导出',
  906. confirm: true,
  907. onclick: onExportData,
  908. limit: permissionStatus('none', 'GOODS_ENTRY_EXPORT_BT'),
  909. type: 'primary'
  910. },
  911. ]
  912. const getColumnProps = (column: any) => {
  913. // 类型断言为 ColumnConfig
  914. const col = column as ColumnConfig
  915. const props: Record<string, any> = {
  916. property: col.property || col.key,
  917. label: col.label
  918. }
  919. if (col.width) props.width = col.width
  920. if (col.sortable) props.sortable = col.sortable
  921. if (col.showOverflowTooltip) props['show-overflow-tooltip'] = col.showOverflowTooltip
  922. return props
  923. }
  924. function onSearch() {
  925. onPageChange(1)
  926. }
  927. function onReset() {
  928. formRef.value.resetFields()
  929. onPageChange(1)
  930. }
  931. function onColumnsSelector() {
  932. showColumnDialog.value = true;
  933. }
  934. function onView(row: Entry) {
  935. router.push({
  936. path: '/get-goods',
  937. query: {
  938. entryId: row.entryId
  939. }
  940. })
  941. }
  942. function onPageChange(page: number) {
  943. setPageIndex(page)
  944. onLoadData()
  945. }
  946. function onSizeChange(size: number) {
  947. setPageSizes(size)
  948. onLoadData()
  949. }
  950. // 运输方式
  951. function formatTrafMode(code: string): string {
  952. const result = trafMode.value.find((item) => item.value == code)
  953. if (result) {
  954. return result.label
  955. }
  956. return ''
  957. }
  958. // 监管方式
  959. function formatTradeMode(code: string): string {
  960. const result = tradeMode.value.find((item) => item.value == code)
  961. if (result) {
  962. return result.label
  963. }
  964. return ''
  965. }
  966. // 监管方式
  967. function formatCountryIso(code: string): string {
  968. const result = countryIso.value.find((item) => item.value == code)
  969. if (result) {
  970. return result.label
  971. }
  972. return ''
  973. }
  974. // 进出境口岸
  975. function formatIePort(code: string): string {
  976. const result = iePort.value.find((item) => item.value == code)
  977. if (result) {
  978. return result.label
  979. }
  980. return ''
  981. }
  982. // 获取字典选项
  983. const getDictOptions = (dictKey: string) => {
  984. return dict.value?.[dictKey] || []
  985. }
  986. // 根据列键获取格式化函数
  987. const getFormatter = (key: string): ((value: any) => string) | undefined => {
  988. const formatters: Record<string, (value: any) => string> = {
  989. 'trafMode': formatTrafMode,
  990. 'tradeMode': formatTradeMode,
  991. 'tradeCountry': formatCountryIso,
  992. 'iePort': formatIePort
  993. }
  994. return formatters[key]
  995. }
  996. // 加载数据
  997. async function onLoadData() {
  998. const loginCustomsCode = coreStore.currentUser.customsCode;
  999. if("4700" === loginCustomsCode){
  1000. state.isSelect = true;
  1001. }else{
  1002. state.queryData.customsCode = loginCustomsCode;
  1003. state.isSelect = false;
  1004. }
  1005. const query = { ...state.queryData, pageIndex: tablePagination.currentPage, pageSize: tablePagination.pageSize }
  1006. setLoading(true)
  1007. const res = await getList(query)
  1008. if (res.code == SuccessResultCode) {
  1009. setPagination(res.data)
  1010. }
  1011. setLoading(false)
  1012. }
  1013. // 加载数据
  1014. async function onExportData() : Promise<void>{
  1015. const query = { ...state.queryData,exportHeadList:dynamicColumns.selectedKeys.value.toString()}
  1016. await exportList(query);
  1017. }
  1018. async function getTrafMode() {
  1019. const traf = await getBaseCodeList("TransitMode")
  1020. if (traf.code == SuccessResultCode) {
  1021. trafMode.value = traf.data
  1022. }
  1023. }
  1024. async function getCustoms() {
  1025. const traf = await getBaseCodeList("customsCode")
  1026. if (traf.code == SuccessResultCode) {
  1027. iePort.value = traf.data
  1028. }
  1029. }
  1030. async function getTradeMode() {
  1031. const traf = await getBaseCodeList("tradeCode")
  1032. if (traf.code == SuccessResultCode) {
  1033. tradeMode.value = traf.data
  1034. }
  1035. }
  1036. async function getTradeCountry() {
  1037. const traf = await getBaseCodeList("countryCode")
  1038. if (traf.code == SuccessResultCode) {
  1039. tradeCountry.value = traf.data
  1040. }
  1041. }
  1042. async function getCountryIso() {
  1043. const traf = await getBaseCodeList("countryIsoE")
  1044. if (traf.code == SuccessResultCode) {
  1045. countryIso.value = traf.data
  1046. }
  1047. }
  1048. onBeforeMount(async () => {
  1049. await Promise.all([ getCustoms(),getTrafMode(),getTradeMode(),getTradeCountry(),getCountryIso()])
  1050. setTimeout(() => {
  1051. onLoadData()
  1052. }, 500)
  1053. // console.log(dict);
  1054. })
  1055. </script>