CustomMStatF.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <cacp-search-layout>
  3. <template #search>
  4. <cacp-search-panel-layout
  5. :model="state.queryData"
  6. ref="queryFormRef"
  7. label-position="left"
  8. label-width="auto"
  9. :gutter="30"
  10. :colSpan="6"
  11. >
  12. <el-form-item label="月度">
  13. <el-date-picker
  14. type="month"
  15. value-format="YYYY-MM"
  16. v-model="state.queryData.beginDate"
  17. placeholder="开始时间"
  18. />
  19. </el-form-item>
  20. <template #buttonGroup>
  21. <el-button type="primary" @click="onSearch">查询</el-button>
  22. <el-button type="info" @click="onReset">重置</el-button>
  23. </template>
  24. </cacp-search-panel-layout>
  25. </template>
  26. <cacp-complex-table
  27. :actions="actions"
  28. :data="tableData"
  29. :actionsWidth="120"
  30. @selection-change="handleSelectionChange"
  31. @on-page-change="onPageChange"
  32. @on-size-change="onSizeChange"
  33. :loading="loading"
  34. >
  35. <el-table-column label="序号" property="index" width="60" align="center" >
  36. <template #default="scope">
  37. {{scope.$index + 1}}
  38. </template>
  39. </el-table-column>
  40. <el-table-column property="customCode" label="所属海关" width="120" :show-overflow-tooltip="true" >
  41. <template #default="scope">
  42. <dict-tag :options="dict.customs_info" :dictValue="scope.row.customCode" />
  43. </template>
  44. </el-table-column>
  45. <el-table-column property="impDeclCount" label="进口单数" width="120" :show-overflow-tooltip="true" />
  46. <el-table-column property="impManDeclCount" label="进口查验单数" width="120" :show-overflow-tooltip="true" />
  47. <el-table-column property="impManualAuditDeclCount" label="进口接单单数" width="120" :show-overflow-tooltip="true" />
  48. <!-- <el-table-column property="impDeclCountLm" label="上个月进口单数" width="120" :show-overflow-tooltip="true" />-->
  49. <!-- <el-table-column property="impDeclCountLyDec" label="去年12月进口单数" width="120" :show-overflow-tooltip="true" />-->
  50. <!-- <el-table-column property="impDeclCountCuryear" label="今年截止当月总进口单数" width="120" :show-overflow-tooltip="true" />-->
  51. <!-- <el-table-column property="impDeclCountYbl" label="前年总进口单数" width="120" :show-overflow-tooltip="true" />-->
  52. <el-table-column property="impTotalCost" label="进口平均整体通关时间(小时)" width="120" :show-overflow-tooltip="true" />
  53. <!-- <el-table-column property="impTotalCostLm" label="进口平均整体通关时间-上月" width="120" :show-overflow-tooltip="true" />-->
  54. <!-- <el-table-column property="impTotalCostLyDec" label="进口平均整体通关时间-去年12月" width="120" :show-overflow-tooltip="true" />-->
  55. <!-- <el-table-column property="impTotalCostCy" label="进口平均整体通关时间-1至当月" width="120" :show-overflow-tooltip="true" />-->
  56. <!-- <el-table-column property="impTotalCostYbl" label="进口平均整体通关时间-前年" width="120" :show-overflow-tooltip="true" />-->
  57. <el-table-column property="impCuCost" label="进口平均海关通关时间(小时)" width="120" :show-overflow-tooltip="true" />
  58. <!-- <el-table-column property="impCuCostLm" label="进口平均海关通关时间" width="120" :show-overflow-tooltip="true" />-->
  59. <!-- <el-table-column property="impCuCostLyDec" label="进口平均海关通关时间-去年12月" width="120" :show-overflow-tooltip="true" />-->
  60. <!-- <el-table-column property="impCuCostCy" label="进口平均海关通关时间-1至当月" width="120" :show-overflow-tooltip="true" />-->
  61. <!-- <el-table-column property="impCuCostYbl" label="进口平均海关通关时间-前年" width="120" :show-overflow-tooltip="true" />-->
  62. <el-table-column property="expDeclCount" label="出口单数" width="120" :show-overflow-tooltip="true" />
  63. <el-table-column property="expManDeclCount" label="出口查验单数" width="120" :show-overflow-tooltip="true" />
  64. <el-table-column property="expManualAuditDeclCount" label="出口接单单数" width="120" :show-overflow-tooltip="true" />
  65. <!-- <el-table-column property="expDeclCountLm" label="上个月出口单数" width="120" :show-overflow-tooltip="true" />-->
  66. <!-- <el-table-column property="expDeclCountLyDec" label="去年12月进口单数" width="120" :show-overflow-tooltip="true" />-->
  67. <!-- <el-table-column property="expDeclCountCuryear" label="今年截止当月总出口单数" width="120" :show-overflow-tooltip="true" />-->
  68. <!-- <el-table-column property="expDeclCountYbl" label="前年总出口单数" width="120" :show-overflow-tooltip="true" />-->
  69. <el-table-column property="expTotalCost" label="出口平均整体通关时间(小时)" width="120" :show-overflow-tooltip="true" />
  70. <!-- <el-table-column property="expTotalCostLm" label="出口平均整体通关时间" width="120" :show-overflow-tooltip="true" />-->
  71. <!-- <el-table-column property="expTotalCostLyDec" label="出口平均整体通关时间-去年12月" width="120" :show-overflow-tooltip="true" />-->
  72. <!-- <el-table-column property="expTotalCostCy" label="出口平均整体通关时间-1至当月" width="120" :show-overflow-tooltip="true" />-->
  73. <!-- <el-table-column property="expTotalCostYbl" label="出口平均整体通关时间-前年" width="120" :show-overflow-tooltip="true" />-->
  74. <el-table-column property="expCuCost" label="出口平均海关通关时间(小时)" width="120" :show-overflow-tooltip="true" />
  75. <!-- <el-table-column property="expCuCostLm" label="出口平均海关通关时间" width="120" :show-overflow-tooltip="true" />-->
  76. <!-- <el-table-column property="expCuCostLyDec" label="出口平均海关通关时间-去年12月" width="120" :show-overflow-tooltip="true" />-->
  77. <!-- <el-table-column property="expCuCostCy" label="出口平均海关通关时间-1至当月" width="120" :show-overflow-tooltip="true" />-->
  78. <!-- <el-table-column property="expCuCostYbl" label="出口平均海关通关时间-前年" width="120" :show-overflow-tooltip="true" />-->
  79. </cacp-complex-table>
  80. </cacp-search-layout>
  81. </template>
  82. <script lang="ts" setup>
  83. import { onMounted, reactive, ref } from 'vue'
  84. // import type { FormInstance } from 'element-plus'
  85. import { ElMessage, ElMessageBox } from 'element-plus'
  86. import config from '@/config'
  87. import {
  88. SuccessResultCode,
  89. useComplexTable,
  90. type SearchPanelLayoutInstance,
  91. type TableAction,
  92. useLoading
  93. } from '@cacp/ui'
  94. import type { CustomMStatF, CustomMStatFQuery } from '@/types/statReport/CustomMStatF'
  95. import { dataExport, getList } from '@/apis/statReport/CustomMStatF'
  96. import { permissionStatus } from '@/utils/globalPermission'
  97. import DictTag from '@/components/DictTag/dictTag.vue'
  98. import { useDictType } from '@/components/useDict'
  99. import dayjs from 'dayjs'
  100. const { dict } = useDictType('customs_info')
  101. // 表单引用
  102. const queryFormRef = ref<SearchPanelLayoutInstance>()
  103. // const dialogFormRef = ref<FormInstance>()
  104. // 加载状态
  105. const { loading, setLoading } = useLoading()
  106. // 表格 Hook
  107. const tableHooks = useComplexTable<CustomMStatF>(config)
  108. const { tableData, tablePagination, setPagination, setPageIndex, setPageSizes } = tableHooks
  109. // 响应式数据
  110. interface State {
  111. queryData: CustomMStatFQuery
  112. formData: CustomMStatF
  113. viewForm: CustomMStatF
  114. viewTitle: string
  115. viewDialogVisible: boolean
  116. title: string
  117. isEdit: boolean
  118. dialogVisible: boolean
  119. }
  120. const state = reactive<State>({
  121. queryData: {
  122. MONTH: '',
  123. customCode: '',
  124. impDeclCount: '',
  125. impManDeclCount: '',
  126. impManualAuditDeclCount: '',
  127. impDeclCountLm: '',
  128. impDeclCountLyDec: '',
  129. impDeclCountCuryear: '',
  130. impDeclCountYbl: '',
  131. impTotalCost: '',
  132. impTotalCostLm: '',
  133. impTotalCostLyDec: '',
  134. impTotalCostCy: '',
  135. impTotalCostYbl: '',
  136. impCuCost: '',
  137. impCuCostLm: '',
  138. impCuCostLyDec: '',
  139. impCuCostCy: '',
  140. impCuCostYbl: '',
  141. expDeclCount: '',
  142. expManDeclCount: '',
  143. expManualAuditDeclCount: '',
  144. expDeclCountLm: '',
  145. expDeclCountLyDec: '',
  146. expDeclCountCuryear: '',
  147. expDeclCountYbl: '',
  148. expTotalCost: '',
  149. expTotalCostLm: '',
  150. expTotalCostLyDec: '',
  151. expTotalCostCy: '',
  152. expTotalCostYbl: '',
  153. expCuCost: '',
  154. expCuCostLm: '',
  155. expCuCostLyDec: '',
  156. expCuCostCy: '',
  157. expCuCostYbl: '',
  158. beginDate: dayjs().startOf('month').format('YYYY-MM'),
  159. pageIndex: tablePagination.currentPage,
  160. pageSize: tablePagination.pageSize
  161. },
  162. formData: {
  163. ID: '',
  164. MONTH: '',
  165. customCode: '',
  166. impDeclCount: '',
  167. impManDeclCount: '',
  168. impManualAuditDeclCount: '',
  169. impDeclCountLm: '',
  170. impDeclCountLyDec: '',
  171. impDeclCountCuryear: '',
  172. impDeclCountYbl: '',
  173. impTotalCost: '',
  174. impTotalCostLm: '',
  175. impTotalCostLyDec: '',
  176. impTotalCostCy: '',
  177. impTotalCostYbl: '',
  178. impCuCost: '',
  179. impCuCostLm: '',
  180. impCuCostLyDec: '',
  181. impCuCostCy: '',
  182. impCuCostYbl: '',
  183. expDeclCount: '',
  184. expManDeclCount: '',
  185. expManualAuditDeclCount: '',
  186. expDeclCountLm: '',
  187. expDeclCountLyDec: '',
  188. expDeclCountCuryear: '',
  189. expDeclCountYbl: '',
  190. expTotalCost: '',
  191. expTotalCostLm: '',
  192. expTotalCostLyDec: '',
  193. expTotalCostCy: '',
  194. expTotalCostYbl: '',
  195. expCuCost: '',
  196. expCuCostLm: '',
  197. expCuCostLyDec: '',
  198. expCuCostCy: '',
  199. expCuCostYbl: '',
  200. } as CustomMStatF,
  201. viewForm: {} as CustomMStatF,
  202. viewTitle: '',
  203. viewDialogVisible: false,
  204. title: '',
  205. isEdit: false,
  206. dialogVisible: false,
  207. })
  208. // 表格操作按钮配置
  209. const actions = <Array<TableAction>>[
  210. {
  211. key: 'export',
  212. text: '导出',
  213. onclick: onExpot,
  214. limit: permissionStatus('none', 'CUSTOMS_STAT_F_EXPORT_BT'),
  215. type: 'primary'
  216. },
  217. // {
  218. // key: 'refresh',
  219. // type: 'primary',
  220. // text: '刷新',
  221. // onclick: onRefresh,
  222. // limit: 'none',
  223. // position: 'right',
  224. // plain: true
  225. // }
  226. ]
  227. // 选中项的 ID 数组
  228. const ids = ref<string[]>([])
  229. // 多选框选中数据
  230. function handleSelectionChange(selection: CustomMStatF[]) {
  231. ids.value = selection
  232. .map(item => item.ID)
  233. .filter((id): id is string => id != null && id !== undefined)
  234. }
  235. // 搜索方法
  236. const onSearch = () => {
  237. setPageIndex(1)
  238. onLoadData()
  239. }
  240. // 重置方法
  241. const onReset = () => {
  242. queryFormRef.value?.resetFields()
  243. onPageChange(1)
  244. }
  245. // 每页显示条数变化
  246. const onSizeChange = (size: number) => {
  247. setPageSizes(size)
  248. onLoadData()
  249. }
  250. // 翻页查询
  251. const onPageChange = (currentPage: number) => {
  252. setPageIndex(currentPage)
  253. onLoadData()
  254. }
  255. /*// 重置表单
  256. function resetForm() {
  257. state.formData = {
  258. ID: '',
  259. MONTH: '',
  260. customCode: '',
  261. impDeclCount: '',
  262. impManDeclCount: '',
  263. impManualAuditDeclCount: '',
  264. impDeclCountLm: '',
  265. impDeclCountLyDec: '',
  266. impDeclCountCuryear: '',
  267. impDeclCountYbl: '',
  268. impTotalCost: '',
  269. impTotalCostLm: '',
  270. impTotalCostLyDec: '',
  271. impTotalCostCy: '',
  272. impTotalCostYbl: '',
  273. impCuCost: '',
  274. impCuCostLm: '',
  275. impCuCostLyDec: '',
  276. impCuCostCy: '',
  277. impCuCostYbl: '',
  278. expDeclCount: '',
  279. expManDeclCount: '',
  280. expManualAuditDeclCount: '',
  281. expDeclCountLm: '',
  282. expDeclCountLyDec: '',
  283. expDeclCountCuryear: '',
  284. expDeclCountYbl: '',
  285. expTotalCost: '',
  286. expTotalCostLm: '',
  287. expTotalCostLyDec: '',
  288. expTotalCostCy: '',
  289. expTotalCostYbl: '',
  290. expCuCost: '',
  291. expCuCostLm: '',
  292. expCuCostLyDec: '',
  293. expCuCostCy: '',
  294. expCuCostYbl: '',
  295. } as CustomMStatF
  296. dialogFormRef.value?.resetFields()
  297. }*/
  298. // 刷新方法
  299. function onRefresh() {
  300. onReset()
  301. }
  302. // 导出
  303. async function onExpot() {
  304. try {
  305. await ElMessageBox.confirm('确定要导出申报地海关报表吗?', '提示', {
  306. confirmButtonText: '确定',
  307. cancelButtonText: '取消',
  308. type: 'warning'
  309. })
  310. const query = {
  311. ...state.queryData,
  312. pageIndex: tablePagination.currentPage,
  313. pageSize: tablePagination.pageSize
  314. }
  315. await dataExport(query);
  316. } catch{
  317. // 用户取消删除
  318. }
  319. }
  320. // 数据查询
  321. async function onLoadData() {
  322. setLoading(true)
  323. try {
  324. const query = {
  325. ...state.queryData,
  326. pageIndex: tablePagination.currentPage,
  327. pageSize: tablePagination.pageSize
  328. }
  329. const res = await getList(query)
  330. if (res.code === SuccessResultCode) {
  331. setPagination(res.data)
  332. } else {
  333. ElMessage.error(res.message || '查询失败')
  334. }
  335. } catch (error) {
  336. console.error('查询失败:', error)
  337. ElMessage.error('查询失败')
  338. } finally {
  339. setLoading(false)
  340. }
  341. }
  342. // 组件挂载时加载数据
  343. onMounted(() => {
  344. onLoadData()
  345. })
  346. </script>
  347. <style scoped>
  348. /* 自定义样式 */
  349. </style>