index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <a-card :bordered="false" v-if="indexShow">
  3. <a-tabs v-model:activeKey="searchFormState.baType" @change="onSearch()">
  4. <a-tab-pane key="basq" tab="备案申请"/>
  5. <a-tab-pane key="bgsq" tab="变更申请"/>
  6. <a-tab-pane key="zxsq" tab="注销申请"/>
  7. </a-tabs>
  8. <a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
  9. <a-row :gutter="24">
  10. <a-col :span="6">
  11. <a-form-item label="主管海关" name="companyMainHgType">
  12. <a-select v-model:value="searchFormState.companyMainHgType" placeholder="请选择主管海关"
  13. :options="companyMainHgTypeOptions" show-search allow-clear option-filter-prop="label"/>
  14. </a-form-item>
  15. </a-col>
  16. <a-col :span="6">
  17. <a-form-item label="申报时间" name="applyTime">
  18. <a-range-picker v-model:value="searchFormState.applyTime" value-format="YYYY-MM-DD HH:mm:ss" show-time
  19. allow-clear/>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :span="6">
  23. <a-form-item label="录入时间" name="createTime">
  24. <a-range-picker v-model:value="searchFormState.createTime" value-format="YYYY-MM-DD HH:mm:ss" show-time
  25. allow-clear/>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :span="6">
  29. <a-form-item label="单据状态" name="status">
  30. <a-select v-model:value="searchFormState.status " placeholder="请选择单据状态"
  31. :options="statusOptions" show-search allow-clear option-filter-prop="label"/>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :span="6" :offset="18">
  35. <div style="width: 100%;display: flex;justify-content: flex-end">
  36. <a-button type="primary" @click="onSearch()">查询</a-button>
  37. <a-button style="margin: 0 0 0 8px" @click="reset">重置</a-button>
  38. </div>
  39. </a-col>
  40. </a-row>
  41. </a-form>
  42. <s-table
  43. ref="tableRef"
  44. :columns="columns"
  45. :data="loadData"
  46. :alert="options.alert.show"
  47. bordered
  48. :row-key="(record) => record.id"
  49. :tool-config="toolConfig"
  50. :row-selection="options.rowSelection"
  51. v-model:filterParam="filterParam"
  52. :scroll="{ x: 2000 }"
  53. >
  54. <template #operator class="table-operator">
  55. <a-space>
  56. <a-button type="primary" @click="onDetail()" v-if="hasPerm('qyRecordAdd') && searchFormState.baType === 'basq'">
  57. <template #icon>
  58. <plus-outlined/>
  59. </template>
  60. 新增
  61. </a-button>
  62. <xn-batch-delete
  63. v-if="hasPerm('qyRecordDelete')"
  64. :selectedRowKeys="selectedRowKeys"
  65. @batchDelete="deleteBatchQyRecord"
  66. />
  67. <a-button @click="onExport" v-if="hasPerm('qyRecordBatchExport')">
  68. <template #icon>
  69. <export-outlined/>
  70. </template>
  71. 批量导出
  72. </a-button>
  73. </a-space>
  74. </template>
  75. <template #bodyCell="{ column, record }">
  76. <template v-if="column.dataIndex === 'companyMainHgType'">
  77. {{ $TOOL.dictTypeData('zhhg', record.companyMainHgType) }}
  78. </template>
  79. <template v-if="column.dataIndex === 'baType'">
  80. {{ $TOOL.dictTypeData('qybalx', record.baType) }}
  81. </template>
  82. <template v-if="column.dataIndex === 'status'">
  83. {{ $TOOL.dictTypeData('djzt', record.status) }}
  84. </template>
  85. <template v-if="column.dataIndex === 'action'">
  86. <a-space>
  87. <a @click="onDetail(record, true)" v-if="hasPerm('qyRecordView')">查看</a>
  88. <a @click="onDetail(record)" v-if="hasPerm('qyRecordEdit') && record.status == 1">编辑</a>
  89. <a-popconfirm title="确定要删除吗?" @confirm="deleteQyRecord(record)">
  90. <a-button type="link" danger size="small" v-if="hasPerm('qyRecordDelete') && record.status == 1">删除</a-button>
  91. </a-popconfirm>
  92. <a @click="resultDetailRef.onOpen(record)" v-if="record.status == 3 || record.status == 4">查看回执</a>
  93. <template v-if="(record.baType === 'basq' || record.baType === 'bgsq') && record.status == 3">
  94. <a @click="onChange(record)">变更</a>
  95. </template>
  96. <template v-else-if="(record.baType === 'basq' || record.baType === 'bgsq') && record.status == 3">
  97. <a @click="onKill(record)">注销</a>
  98. </template>
  99. </a-space>
  100. </template>
  101. </template>
  102. </s-table>
  103. </a-card>
  104. <Detail v-else ref="detailRef" @onClose="indexShow = true" @successful="onSearch()"/>
  105. <ResultDetail ref="resultDetailRef"/>
  106. </template>
  107. <script setup name="qyrecord">
  108. import tool from '@/utils/tool'
  109. import {cloneDeep} from 'lodash-es'
  110. import Detail from './detail.vue'
  111. import ResultDetail from './result.vue'
  112. import qyRecordApi from '@/api/yqyc/qyRecordApi'
  113. import downloadUtil from "@/utils/downloadUtil";
  114. import {message, Modal} from "ant-design-vue";
  115. import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
  116. import {createVNode} from "vue";
  117. const {proxy} = getCurrentInstance()
  118. const searchFormState = ref({
  119. baType: 'basq'
  120. })
  121. const searchFormStateReal = ref(searchFormState.value) // 点击搜索后备份的查询参数
  122. const searchFormRef = ref()
  123. const tableRef = ref()
  124. const filterParam = ref({})
  125. const detailRef = ref()
  126. const resultDetailRef = ref()
  127. const indexShow = ref(true)
  128. const toolConfig = {refresh: true, height: true, columnSetting: true, striped: false}
  129. const columns = ref([
  130. {
  131. title: '统一社会信用代码',
  132. dataIndex: 'companyCode',
  133. },
  134. {
  135. title: '企业注册名称',
  136. dataIndex: 'companyName',
  137. },
  138. {
  139. title: '申报企业编号',
  140. dataIndex: 'companyApplyCode',
  141. },
  142. {
  143. title: '主管海关',
  144. dataIndex: 'companyMainHgType',
  145. },
  146. {
  147. title: '申报类型',
  148. dataIndex: 'baType',
  149. },
  150. {
  151. title: '申报时间',
  152. dataIndex: 'applyTime',
  153. },
  154. {
  155. title: '单据状态',
  156. dataIndex: 'status',
  157. },
  158. {
  159. title: '录入时间',
  160. dataIndex: 'createTime',
  161. },
  162. {
  163. title: '操作',
  164. dataIndex: 'action',
  165. align: 'center',
  166. width: 200,
  167. fixed: 'right',
  168. }
  169. ])
  170. // 操作栏通过权限判断是否显示
  171. if (hasPerm(['qyRecordView', 'qyRecordEdit', 'qyRecordDelete'])) {
  172. columns.value.forEach(v => {
  173. if (v.dataIndex === 'action') {
  174. v.width = 200
  175. }
  176. })
  177. }
  178. const selectedRowKeys = ref([])
  179. // 列表选择配置
  180. const options = {
  181. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  182. alert: {
  183. show: true,
  184. clear: () => {
  185. selectedRowKeys.value = ref([])
  186. }
  187. },
  188. rowSelection: {
  189. onChange: (selectedRowKey, selectedRows) => {
  190. selectedRowKeys.value = selectedRowKey
  191. }
  192. }
  193. }
  194. const loadData = (parameter) => {
  195. tableRef.value.clearSelected()
  196. // applyTime范围查询条件重载
  197. if (searchFormStateReal.value.applyTime) {
  198. searchFormStateReal.value.startApplyTime = searchFormStateReal.value.applyTime[0]
  199. searchFormStateReal.value.endApplyTime = searchFormStateReal.value.applyTime[1]
  200. delete searchFormStateReal.value.applyTime
  201. }
  202. // createTime范围查询条件重载
  203. if (searchFormStateReal.value.createTime) {
  204. searchFormStateReal.value.startCreateTime = searchFormStateReal.value.createTime[0]
  205. searchFormStateReal.value.endCreateTime = searchFormStateReal.value.createTime[1]
  206. delete searchFormStateReal.value.createTime
  207. }
  208. return qyRecordApi.qyRecordPage(Object.assign(parameter, searchFormStateReal.value)).then((data) => {
  209. return data
  210. })
  211. }
  212. // 搜索同时备份参数
  213. const onSearch = (parameter) => {
  214. searchFormStateReal.value = cloneDeep(Object.assign(searchFormState.value, filterParam.value))
  215. nextTick(() => {
  216. tableRef.value.refresh(parameter)
  217. })
  218. }
  219. // 重置
  220. const reset = () => {
  221. searchFormRef.value?.resetFields()
  222. onSearch(true)
  223. }
  224. // 删除
  225. const deleteQyRecord = (record) => {
  226. let params = [
  227. {
  228. id: record.id
  229. }
  230. ]
  231. qyRecordApi.qyRecordDelete(params).then(() => {
  232. tableRef.value.refresh(true)
  233. })
  234. }
  235. // 批量删除
  236. const deleteBatchQyRecord = (params) => {
  237. qyRecordApi.qyRecordDelete(params).then(() => {
  238. tableRef.value.clearRefreshSelected()
  239. })
  240. }
  241. // 批量导出
  242. const onExport = () => {
  243. const params = {
  244. ...filterParam.value
  245. }
  246. if (selectedRowKeys.value.length > 0) {
  247. params.ids = selectedRowKeys.value
  248. } else {
  249. Object.entries(searchFormStateReal.value).forEach(([key, value]) => {
  250. console.log(key)
  251. if (proxy.$util.isValue(value)) {
  252. params[key] = value
  253. }
  254. })
  255. }
  256. qyRecordApi.qyRecordExport(params).then((res) => {
  257. downloadUtil.resultDownload(res)
  258. tableRef.value.clearSelected()
  259. })
  260. }
  261. // 切换至表单
  262. const onDetail = (record = null, view) => {
  263. indexShow.value = false
  264. nextTick(() => {
  265. detailRef.value.onOpen(record, view)
  266. })
  267. }
  268. // 变更
  269. const onChange = (record = null) => {
  270. Modal.confirm({
  271. title: '请确定是否变更?',
  272. icon: createVNode(ExclamationCircleOutlined),
  273. content: createVNode('div', { style: 'color:red;' }, '变更后将重新进行申报'),
  274. centered: true,
  275. onOk() {
  276. const form = cloneDeep(record)
  277. form.baType = 'bgsq'
  278. onDetail(form)
  279. },
  280. onCancel() {
  281. },
  282. });
  283. }
  284. // 注销
  285. const onKill = (record = null) => {
  286. Modal.confirm({
  287. title: '确定要对该企业进行注销操作?',
  288. icon: createVNode(ExclamationCircleOutlined),
  289. content: createVNode('div', { style: 'color:red;' }, '注销后将该公司将无法进行报关申请等操作'),
  290. centered: true,
  291. onOk() {
  292. let recordData = cloneDeep(record)
  293. recordData.applyTime = proxy.$util.YMDHms(new Date())
  294. recordData.status = '3'
  295. recordData.baType = 'zxsq'
  296. qyRecordApi.qyRecordSubmitForm(recordData, recordData.id).then(() => {
  297. onSearch()
  298. })
  299. },
  300. onCancel() {
  301. },
  302. });
  303. }
  304. const companyMainHgTypeOptions = tool.dictList('zhhg')
  305. const statusOptions = tool.dictList('djzt')
  306. </script>
  307. <style lang="less" scoped>
  308. </style>