index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <a-card :bordered="false" v-if="indexShow">
  3. <a-tabs v-model:activeKey="searchFormState.sblx" @change="onSearch()">
  4. <a-tab-pane key="1" tab="备案"/>
  5. <a-tab-pane key="2" tab="变更"/>
  6. <a-tab-pane key="3" 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="hfdrCode">
  12. <a-input v-model:value="searchFormState.hfdrCode" placeholder="请输入核放单预录入号" allow-clear/>
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="核放单号" name="hfdCode">
  17. <a-input v-model:value="searchFormState.hfdCode" placeholder="请输入核放单号" allow-clear/>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :span="6">
  21. <a-form-item label="台账编号" name="ledgerCode">
  22. <a-input v-model:value="searchFormState.ledgerCode" placeholder="请输入台账编号" allow-clear/>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :span="6">
  26. <a-form-item label="进出标志" name="jcbz">
  27. <a-select v-model:value="searchFormState.jcbz" placeholder="请选择进出标志" :options="jcbzOptions" show-search allow-clear option-filter-prop="label"/>
  28. </a-form-item>
  29. </a-col>
  30. <a-col :span="6">
  31. <a-form-item label="关联核注清单编号" name="glhzqdbh">
  32. <a-input v-model:value="searchFormState.glhzqdbh" placeholder="请输入关联核注清单编号" allow-clear/>
  33. </a-form-item>
  34. </a-col>
  35. <a-col :span="6">
  36. <a-form-item label="单据状态" name="status">
  37. <a-select v-model:value="searchFormState.status" placeholder="请选择单据状态" :options="statusOptions" show-search allow-clear option-filter-prop="label"/>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :span="6" :offset="6">
  41. <div style="width: 100%;display: flex;justify-content: flex-end">
  42. <a-button type="primary" @click="onSearch()">查询</a-button>
  43. <a-button style="margin: 0 0 0 8px" @click="reset">重置</a-button>
  44. </div>
  45. </a-col>
  46. </a-row>
  47. </a-form>
  48. <s-table
  49. ref="tableRef"
  50. :columns="columns"
  51. :data="loadData"
  52. :alert="options.alert.show"
  53. bordered
  54. :row-key="(record) => record.id"
  55. :tool-config="toolConfig"
  56. :row-selection="options.rowSelection"
  57. v-model:filterParam="filterParam"
  58. :scroll="{ x: 2000 }"
  59. >
  60. <template #operator class="table-operator">
  61. <a-space>
  62. <a-button type="primary" @click="onDetail(null, false, '1')" v-if="hasPerm('qySecondlineHfdAdd') && searchFormState.sblx == 1">
  63. <template #icon><plus-outlined /></template>
  64. 新增
  65. </a-button>
  66. <!-- <xn-batch-delete-->
  67. <!-- v-if="hasPerm('qySecondlineHfdDelete')"-->
  68. <!-- :selectedRowKeys="selectedRowKeys"-->
  69. <!-- @batchDelete="deleteBatchQySecondlineHfd"-->
  70. <!-- />-->
  71. <a-button @click="onExport" v-if="hasPerm('qySecondlineHfdBatchExport')">
  72. <template #icon><export-outlined /></template>
  73. 批量导出
  74. </a-button>
  75. </a-space>
  76. </template>
  77. <template #bodyCell="{ column, record }">
  78. <template v-if="column.dataIndex === 'hfdLx'">
  79. {{ $TOOL.dictTypeData('hfdlx', record.hfdLx) }}
  80. </template>
  81. <template v-if="column.dataIndex === 'status'">
  82. {{ $TOOL.dictTypeData('djzt', record.status) }}
  83. </template>
  84. <template v-if="column.dataIndex === 'sblx'">
  85. {{ $TOOL.dictTypeData('lgs_sblx', record.sblx) }}
  86. </template>
  87. <template v-if="column.dataIndex === 'action'">
  88. <a-space>
  89. <a @click="onDetail(record, true)" v-if="hasPerm('qySecondlineHfdView')">查看</a>
  90. <a @click="onDetail(record)" v-if="hasPerm('qySecondlineHfdEdit')">编辑</a>
  91. <a-popconfirm title="确定要删除吗?" @confirm="deleteQySecondlineHfd(record)">
  92. <a-button type="link" danger size="small" v-if="hasPerm('qySecondlineHfdDelete')">删除</a-button>
  93. </a-popconfirm>
  94. <a @click="onDetail(record, false, null, true)">复制</a>
  95. <a @click="resultDetailRef.onOpen(record)" v-if="record.status == 3 || record.status == 4">查看回执</a>
  96. <a @click="onChange(record)" v-if="record.sblx == 2 && record.status == 3">变更</a>
  97. <a-button type="link" danger size="small" @click="onKill(record)" v-if="record.sblx == 1 && record.status == 3">作废</a-button>
  98. </a-space>
  99. </template>
  100. </template>
  101. </s-table>
  102. </a-card>
  103. <Detail v-else ref="detailRef" @onClose="indexShow = true" @successful="onSearch()" />
  104. <ResultDetail ref="resultDetailRef"/>
  105. </template>
  106. <script setup name="qysecondlinehfd">
  107. import tool from '@/utils/tool'
  108. import { cloneDeep } from 'lodash-es'
  109. import Detail from './detail.vue'
  110. import qySecondlineHfdApi from '@/api/yqyc/qySecondlineHfdApi'
  111. import downloadUtil from "@/utils/downloadUtil";
  112. import {Modal} from "ant-design-vue";
  113. import {createVNode} from "vue";
  114. import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
  115. import qyRecordInfoApi from "@/api/yqyc/qyRecordInfoApi";
  116. import qySecondLineHzdTzApi from "@/api/yqyc/qySecondLineHzdTzApi";
  117. import ResultDetail from "./result.vue";
  118. const { proxy } = getCurrentInstance()
  119. const searchFormState = ref({
  120. sblx: '1'
  121. })
  122. const searchFormStateReal = ref(searchFormState.value) // 点击搜索后备份的查询参数
  123. const searchFormRef = ref()
  124. const resultDetailRef = ref()
  125. const tableRef = ref()
  126. const filterParam = ref({})
  127. const detailRef = ref()
  128. const indexShow = ref(true)
  129. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  130. // 查询区域显示更多控制
  131. const advanced = ref(false)
  132. const toggleAdvanced = () => {
  133. advanced.value = !advanced.value
  134. }
  135. const columns = [
  136. {
  137. title: '核放单预录入号',
  138. dataIndex: 'hfdrCode',
  139. },
  140. {
  141. title: '核放单号',
  142. dataIndex: 'hfdCode',
  143. },
  144. {
  145. title: '核放单类型',
  146. dataIndex: 'hfdLx',
  147. },
  148. {
  149. title: '台账编号',
  150. dataIndex: 'ledgerCode',
  151. },
  152. {
  153. title: '关联核注清单编号',
  154. dataIndex: 'glhzqdbh',
  155. },
  156. {
  157. title: '申报类型',
  158. dataIndex: 'sblx',
  159. },
  160. {
  161. title: '申报时间',
  162. dataIndex: 'sbsj',
  163. sorter: true,
  164. },
  165. {
  166. title: '单据状态',
  167. dataIndex: 'status',
  168. },
  169. {
  170. title: '操作',
  171. dataIndex: 'action',
  172. align: 'center',
  173. width: 300,
  174. fixed: 'right',
  175. }
  176. ]
  177. const selectedRowKeys = ref([])
  178. // 列表选择配置
  179. const options = {
  180. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  181. alert: {
  182. show: true,
  183. clear: () => {
  184. selectedRowKeys.value = ref([])
  185. }
  186. },
  187. rowSelection: {
  188. onChange: (selectedRowKey, selectedRows) => {
  189. selectedRowKeys.value = selectedRowKey
  190. }
  191. }
  192. }
  193. const loadData = (parameter) => {
  194. tableRef.value.clearSelected()
  195. return qySecondlineHfdApi.qySecondlineHfdPage(Object.assign(parameter, searchFormStateReal.value)).then((data) => {
  196. return data
  197. })
  198. }
  199. // 搜索同时备份参数
  200. const onSearch = (parameter) => {
  201. searchFormStateReal.value = cloneDeep(Object.assign(searchFormState.value, filterParam.value))
  202. nextTick(() => {
  203. tableRef.value.refresh(parameter)
  204. })
  205. }
  206. // 重置
  207. const reset = () => {
  208. searchFormRef.value.resetFields()
  209. onSearch(true)
  210. }
  211. // 删除
  212. const deleteQySecondlineHfd = (record) => {
  213. let params = [
  214. {
  215. id: record.id
  216. }
  217. ]
  218. qySecondlineHfdApi.qySecondlineHfdDelete(params).then(() => {
  219. tableRef.value.refresh(true)
  220. })
  221. }
  222. // 批量删除
  223. const deleteBatchQySecondlineHfd = (params) => {
  224. qySecondlineHfdApi.qySecondlineHfdDelete(params).then(() => {
  225. tableRef.value.clearRefreshSelected()
  226. })
  227. }
  228. // 批量导出
  229. const onExport = () => {
  230. const params = {
  231. ...filterParam.value
  232. }
  233. if (selectedRowKeys.value.length > 0) {
  234. params.ids = selectedRowKeys.value
  235. } else {
  236. Object.entries(searchFormStateReal.value).forEach(([key, value]) => {
  237. console.log(key)
  238. if (proxy.$util.isValue(value)) {
  239. params[key] = value
  240. }
  241. })
  242. }
  243. qySecondlineHfdApi.qySecondlineHfdExport(params).then((res) => {
  244. downloadUtil.resultDownload(res)
  245. tableRef.value.clearSelected()
  246. })
  247. }
  248. // 切换至表单
  249. const onDetail = (record = null, view, type, copy) => {
  250. indexShow.value = false
  251. nextTick(() => {
  252. detailRef.value.onOpen(record, view, type, copy)
  253. })
  254. }
  255. const onChange = (record) => {
  256. Modal.confirm({
  257. title: '请确定是否变更',
  258. icon: createVNode(ExclamationCircleOutlined),
  259. content: createVNode('div', { style: 'color:red;' }, '变更后将重新进行申报'),
  260. centered: true,
  261. onOk() {
  262. onDetail(record, false, '2')
  263. },
  264. onCancel() {
  265. },
  266. });
  267. }
  268. const onKill = (record) => {
  269. Modal.confirm({
  270. title: '确定是否作废该核放单',
  271. icon: createVNode(ExclamationCircleOutlined),
  272. content: createVNode('div', { style: 'color:red;' }, '提交作废申请后由海关审批'),
  273. centered: true,
  274. onOk() {
  275. qySecondlineHfdApi.qySecondlineHfdDetail({id: record.id}).then(res => {
  276. const params = res
  277. params.baseInfo.sblx = '3'
  278. params.baseInfo.status = '2'
  279. qySecondlineHfdApi.qySecondlineHfdSubmitForm(params, record.id).then(() => {
  280. onSearch()
  281. })
  282. })
  283. },
  284. onCancel() {
  285. },
  286. });
  287. }
  288. const jcbzOptions = tool.dictList('jcbz')
  289. const statusOptions = tool.dictList('djzt')
  290. </script>
  291. <style lang="less" scoped>
  292. </style>