index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <a-card :bordered="false" v-if="indexShow">
  3. <a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
  4. <a-row :gutter="24">
  5. <a-col :span="6">
  6. <a-form-item label="核注单预录入号" name="hzdrCode">
  7. <a-input v-model:value="searchFormState.hzdrCode" placeholder="请输入核注单预录入号" allow-clear/>
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item label="核注单编号" name="hgHzdCode">
  12. <a-input v-model:value="searchFormState.hgHzdCode" placeholder="请输入核注单编号" allow-clear/>
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="台账性质" name="tzNature">
  17. <a-select v-model:value="searchFormState.tzNature" placeholder="请选择台账性质" :options="tzTypeOptions" show-search allow-clear option-filter-prop="label"/>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :span="6">
  21. <a-form-item label="台账编号" name="tzCode">
  22. <a-input v-model:value="searchFormState.tzCode" placeholder="请输入台账编号" allow-clear/>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :span="6">
  26. <a-form-item label="申报时间" name="sbsj">
  27. <a-range-picker v-model:value="searchFormState.sbsj" value-format="YYYY-MM-DD HH:mm:ss" show-time allow-clear/>
  28. </a-form-item>
  29. </a-col>
  30. <a-col :span="6">
  31. <a-form-item label="申报类型" name="sblx">
  32. <a-select v-model:value="searchFormState.sblx" placeholder="请选择申报类型" :options="applyTypeOptions" show-search allow-clear option-filter-prop="label"/>
  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">
  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()" v-if="hasPerm('qySecondlineHzdTzAdd')">
  63. <template #icon><plus-outlined /></template>
  64. 新增
  65. </a-button>
  66. <!-- <xn-batch-delete-->
  67. <!-- v-if="hasPerm('qySecondlineHzdTzDelete')"-->
  68. <!-- :selectedRowKeys="selectedRowKeys"-->
  69. <!-- @batchDelete="deleteBatchQySecondlineHzdTz"-->
  70. <!-- />-->
  71. <a-button @click="onExport" v-if="hasPerm('qySecondlineHzdTzBatchExport')">
  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 === 'tzNature'">
  79. {{ $TOOL.dictTypeData('tzlx', record.tzNature) }}
  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('qybalx', record.sblx) }}
  86. </template>
  87. <template v-if="column.dataIndex === 'action'">
  88. <a-space>
  89. <a @click="resultDetailRef.onOpen(record)" v-if="record.status == 3 || record.status == 4">查看回执</a>
  90. <a @click="onDetail(record, true)" v-if="hasPerm('qySecondlineHzdTzView')">查看</a>
  91. <a @click="onDetail(record)" v-if="hasPerm('qySecondlineHzdTzEdit') && record.status == 1">编辑</a>
  92. <a-popconfirm title="确定要删除吗?" @confirm="deleteQySecondlineHzdTz(record)">
  93. <a-button type="link" danger size="small" v-if="hasPerm('qySecondlineHzdTzDelete') && (record.status == 1 || record.status == 4)">删除</a-button>
  94. </a-popconfirm>
  95. <a @click="onDetail(record, false,true)">复制</a>
  96. <a @click="onDetail(record, false, false, 'bgsq')" v-if="record.status == 3">变更</a>
  97. <a @click="onBack(record)" v-if="record.status == 2">撤回</a>
  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="exrqhzd">
  107. import tool from '@/utils/tool'
  108. import { cloneDeep } from 'lodash-es'
  109. import Detail from './detail.vue'
  110. import qySecondLineInHzdApi from '@/api/yqyc/qySecondLineInHzdApi'
  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 ResultDetail from "./result.vue";
  116. const { proxy } = getCurrentInstance()
  117. const searchFormState = ref({})
  118. const searchFormStateReal = ref(searchFormState.value) // 点击搜索后备份的查询参数
  119. const searchFormRef = ref()
  120. const resultDetailRef = ref()
  121. const tableRef = ref()
  122. const filterParam = ref({})
  123. const detailRef = ref()
  124. const indexShow = ref(true)
  125. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  126. // 查询区域显示更多控制
  127. const advanced = ref(false)
  128. const toggleAdvanced = () => {
  129. advanced.value = !advanced.value
  130. }
  131. const columns = [
  132. {
  133. title: '核注单预录入号',
  134. dataIndex: 'hzdrCode',
  135. },
  136. {
  137. title: '核注单编号',
  138. dataIndex: 'hgHzdCode',
  139. },
  140. {
  141. title: '台账性质',
  142. dataIndex: 'tzNature',
  143. },
  144. {
  145. title: '台账编号',
  146. dataIndex: 'tzCode',
  147. },
  148. {
  149. title: '申报时间',
  150. dataIndex: 'sbsj',
  151. sorter: true,
  152. },
  153. {
  154. title: '申报类型',
  155. dataIndex: 'sblx',
  156. },
  157. {
  158. title: '单据状态',
  159. dataIndex: 'status',
  160. },
  161. ]
  162. // 操作栏通过权限判断是否显示
  163. if (hasPerm(['qySecondlineHzdTzEdit', 'qySecondlineHzdTzDelete'])) {
  164. columns.push({
  165. title: '操作',
  166. dataIndex: 'action',
  167. align: 'center',
  168. width: 200,
  169. fixed: 'right',
  170. })
  171. }
  172. const selectedRowKeys = ref([])
  173. // 列表选择配置
  174. const options = {
  175. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  176. alert: {
  177. show: true,
  178. clear: () => {
  179. selectedRowKeys.value = ref([])
  180. }
  181. },
  182. rowSelection: {
  183. onChange: (selectedRowKey, selectedRows) => {
  184. selectedRowKeys.value = selectedRowKey
  185. }
  186. }
  187. }
  188. const loadData = (parameter) => {
  189. tableRef.value.clearSelected()
  190. // sbsj范围查询条件重载
  191. if (searchFormStateReal.value.sbsj) {
  192. searchFormStateReal.value.startSbsj = searchFormStateReal.value.sbsj[0]
  193. searchFormStateReal.value.endSbsj = searchFormStateReal.value.sbsj[1]
  194. delete searchFormStateReal.value.sbsj
  195. }
  196. return qySecondLineInHzdApi.qysecondlinehzdrqtzPage(Object.assign(parameter, searchFormStateReal.value)).then((data) => {
  197. return data
  198. })
  199. }
  200. // 搜索同时备份参数
  201. const onSearch = (parameter) => {
  202. searchFormStateReal.value = cloneDeep(Object.assign(searchFormState.value, filterParam.value))
  203. nextTick(() => {
  204. tableRef.value.refresh(parameter)
  205. })
  206. }
  207. // 重置
  208. const reset = () => {
  209. searchFormRef.value?.resetFields()
  210. onSearch(true)
  211. }
  212. // 删除
  213. const deleteQySecondlineHzdTz = (record) => {
  214. let params = [
  215. {
  216. id: record.id
  217. }
  218. ]
  219. qySecondLineInHzdApi.qysecondlinehzdrqtzDelete(params).then(() => {
  220. tableRef.value.refresh(true)
  221. })
  222. }
  223. // 批量删除
  224. const deleteBatchQySecondlineHzdTz = (params) => {
  225. qySecondLineInHzdApi.qysecondlinehzdrqtzDelete(params).then(() => {
  226. tableRef.value.clearRefreshSelected()
  227. })
  228. }
  229. // 批量导出
  230. const onExport = () => {
  231. const params = {
  232. ...filterParam.value
  233. }
  234. if (selectedRowKeys.value.length > 0) {
  235. params.ids = selectedRowKeys.value
  236. } else {
  237. Object.entries(searchFormStateReal.value).forEach(([key, value]) => {
  238. console.log(key)
  239. if (proxy.$util.isValue(value)) {
  240. params[key] = value
  241. }
  242. })
  243. }
  244. qySecondLineInHzdApi.qysecondlinehzdrqtzExport(params).then((res) => {
  245. downloadUtil.resultDownload(res)
  246. tableRef.value.clearSelected()
  247. })
  248. }
  249. // 切换至表单
  250. const onDetail = (record = null, view, copy, sblx) => {
  251. indexShow.value = false
  252. nextTick(() => {
  253. detailRef.value.onOpen(record, view, copy, sblx)
  254. })
  255. }
  256. const onBack = (record) => {
  257. Modal.confirm({
  258. title: '提示',
  259. icon: createVNode(ExclamationCircleOutlined),
  260. content: '确定要对该核注单进行撤回操作?',
  261. centered: true,
  262. onOk() {
  263. qySecondLineInHzdApi.qysecondlinehzdrqtzDetail({id: record.id}).then(res => {
  264. const params = res
  265. params.baseInfo.status = '1'
  266. qySecondLineInHzdApi.qysecondlinehzdrqtzSubmitForm(params, true).then(() => {
  267. onSearch()
  268. })
  269. })
  270. },
  271. onCancel() {
  272. },
  273. });
  274. }
  275. const tzTypeOptions = tool.dictList('tzlx')
  276. const statusOptions = tool.dictList('djzt')
  277. const applyTypeOptions = tool.dictList('qybalx')
  278. </script>
  279. <style lang="less" scoped>
  280. </style>