index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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 === 'applyType'">
  80. {{ $TOOL.dictTypeData('shenbaoleixing', record.applyType) }}
  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-divider type="vertical"
  89. v-if="hasPerm('qyRecordView') && hasPerm(['qyRecordEdit', 'qyRecordDelete'], 'or')"/>
  90. <a @click="onDetail(record)" v-if="hasPerm('qyRecordEdit') && record.status == 1">编辑</a>
  91. <a-divider type="vertical" v-if="hasPerm(['qyRecordEdit', 'qyRecordDelete'], 'and')"/>
  92. <a-popconfirm title="确定要删除吗?" @confirm="deleteQyRecord(record)">
  93. <a-button type="link" danger size="small" v-if="hasPerm('qyRecordDelete')">删除</a-button>
  94. </a-popconfirm>
  95. <a-divider type="vertical" v-if="hasPerm(['qyRecordView', 'qyRecordEdit', 'qyRecordDelete'])"/>
  96. <a @click="resultDetailRef.onOpen(record)" v-if="record.status == 3 || record.status == 4">查看回执</a>
  97. <template v-if="searchFormState.baType === 'bgsq' && (record.status == 3 || record.status == 4)">
  98. <a-divider type="vertical"/>
  99. <a @click="onChange(record)">变更</a>
  100. </template>
  101. <template v-else-if="searchFormState.baType === 'zxsq' && record.status == 4">
  102. <a-divider type="vertical"/>
  103. <a @click="onKill(record)">注销</a>
  104. </template>
  105. </a-space>
  106. </template>
  107. </template>
  108. </s-table>
  109. </a-card>
  110. <Detail v-else ref="detailRef" @onClose="indexShow = true" @successful="onSearch()"/>
  111. <ResultDetail ref="resultDetailRef"/>
  112. </template>
  113. <script setup name="qyrecord">
  114. import tool from '@/utils/tool'
  115. import {cloneDeep} from 'lodash-es'
  116. import Detail from './detail.vue'
  117. import ResultDetail from './result.vue'
  118. import qyRecordApi from '@/api/yqyc/qyRecordApi'
  119. import downloadUtil from "@/utils/downloadUtil";
  120. import {message, Modal} from "ant-design-vue";
  121. import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
  122. import {createVNode} from "vue";
  123. const {proxy} = getCurrentInstance()
  124. const searchFormState = ref({
  125. baType: 'basq'
  126. })
  127. const searchFormStateReal = ref(searchFormState.value) // 点击搜索后备份的查询参数
  128. const searchFormRef = ref()
  129. const tableRef = ref()
  130. const filterParam = ref({})
  131. const detailRef = ref()
  132. const resultDetailRef = ref()
  133. const indexShow = ref(true)
  134. const toolConfig = {refresh: true, height: true, columnSetting: true, striped: false}
  135. const columns = ref([
  136. {
  137. title: '统一社会信用代码',
  138. dataIndex: 'companyCode',
  139. },
  140. {
  141. title: '企业注册名称',
  142. dataIndex: 'companyName',
  143. },
  144. {
  145. title: '申报企业编号',
  146. dataIndex: 'companyApplyCode',
  147. },
  148. {
  149. title: '主管海关',
  150. dataIndex: 'companyMainHgType',
  151. },
  152. {
  153. title: '申报类型',
  154. dataIndex: 'applyType',
  155. },
  156. {
  157. title: '申报时间',
  158. dataIndex: 'applyTime',
  159. },
  160. {
  161. title: '单据状态',
  162. dataIndex: 'status',
  163. },
  164. {
  165. title: '录入时间',
  166. dataIndex: 'createTime',
  167. },
  168. {
  169. title: '操作',
  170. dataIndex: 'action',
  171. align: 'center',
  172. width: 200,
  173. fixed: 'right',
  174. }
  175. ])
  176. // 操作栏通过权限判断是否显示
  177. if (hasPerm(['qyRecordView', 'qyRecordEdit', 'qyRecordDelete'])) {
  178. columns.value.forEach(v => {
  179. if (v.dataIndex === 'action') {
  180. v.width = 400
  181. }
  182. })
  183. }
  184. const selectedRowKeys = ref([])
  185. // 列表选择配置
  186. const options = {
  187. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  188. alert: {
  189. show: true,
  190. clear: () => {
  191. selectedRowKeys.value = ref([])
  192. }
  193. },
  194. rowSelection: {
  195. onChange: (selectedRowKey, selectedRows) => {
  196. selectedRowKeys.value = selectedRowKey
  197. }
  198. }
  199. }
  200. const loadData = (parameter) => {
  201. tableRef.value.clearSelected()
  202. // applyTime范围查询条件重载
  203. if (searchFormStateReal.value.applyTime) {
  204. searchFormStateReal.value.startApplyTime = searchFormStateReal.value.applyTime[0]
  205. searchFormStateReal.value.endApplyTime = searchFormStateReal.value.applyTime[1]
  206. delete searchFormStateReal.value.applyTime
  207. }
  208. // createTime范围查询条件重载
  209. if (searchFormStateReal.value.createTime) {
  210. searchFormStateReal.value.startCreateTime = searchFormStateReal.value.createTime[0]
  211. searchFormStateReal.value.endCreateTime = searchFormStateReal.value.createTime[1]
  212. delete searchFormStateReal.value.createTime
  213. }
  214. return qyRecordApi.qyRecordPage(Object.assign(parameter, searchFormStateReal.value)).then((data) => {
  215. return data
  216. })
  217. }
  218. // 搜索同时备份参数
  219. const onSearch = (parameter) => {
  220. searchFormStateReal.value = cloneDeep(Object.assign(searchFormState.value, filterParam.value))
  221. nextTick(() => {
  222. tableRef.value.refresh(parameter)
  223. })
  224. }
  225. // 重置
  226. const reset = () => {
  227. searchFormRef.value.resetFields()
  228. onSearch(true)
  229. }
  230. // 删除
  231. const deleteQyRecord = (record) => {
  232. let params = [
  233. {
  234. id: record.id
  235. }
  236. ]
  237. qyRecordApi.qyRecordDelete(params).then(() => {
  238. tableRef.value.refresh(true)
  239. })
  240. }
  241. // 批量删除
  242. const deleteBatchQyRecord = (params) => {
  243. qyRecordApi.qyRecordDelete(params).then(() => {
  244. tableRef.value.clearRefreshSelected()
  245. })
  246. }
  247. // 批量导出
  248. const onExport = () => {
  249. const params = {
  250. ...filterParam.value
  251. }
  252. if (selectedRowKeys.value.length > 0) {
  253. params.ids = selectedRowKeys.value
  254. } else {
  255. Object.entries(searchFormStateReal.value).forEach(([key, value]) => {
  256. console.log(key)
  257. if (proxy.$util.isValue(value)) {
  258. params[key] = value
  259. }
  260. })
  261. }
  262. qyRecordApi.qyRecordExport(params).then((res) => {
  263. downloadUtil.resultDownload(res)
  264. tableRef.value.clearSelected()
  265. })
  266. }
  267. // 切换至表单
  268. const onDetail = (record = null, view) => {
  269. indexShow.value = false
  270. nextTick(() => {
  271. detailRef.value.onOpen(record, view)
  272. })
  273. }
  274. // 变更
  275. const onChange = (record = null) => {
  276. Modal.confirm({
  277. title: '请确定是否变更?',
  278. icon: createVNode(ExclamationCircleOutlined),
  279. content: createVNode('div', { style: 'color:red;' }, '变更后将重新进行申报'),
  280. centered: true,
  281. onOk() {
  282. onDetail(record)
  283. },
  284. onCancel() {
  285. },
  286. });
  287. }
  288. // 注销
  289. const onKill = (record = null) => {
  290. Modal.confirm({
  291. title: '确定要对该企业进行注销操作?',
  292. icon: createVNode(ExclamationCircleOutlined),
  293. content: createVNode('div', { style: 'color:red;' }, '注销后将该公司将无法进行报关申请等操作'),
  294. centered: true,
  295. onOk() {
  296. let recordData = cloneDeep(record)
  297. recordData.applyTime = proxy.$util.YMDHms(new Date())
  298. recordData.status = '2'
  299. qyRecordApi.qyRecordSubmitForm(recordData, recordData.id).then(() => {
  300. onSearch()
  301. })
  302. },
  303. onCancel() {
  304. },
  305. });
  306. }
  307. const companyMainHgTypeOptions = tool.dictList('zhhg')
  308. const statusOptions = tool.dictList('djzt')
  309. </script>
  310. <style lang="less" scoped>
  311. </style>