index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <a-card :bordered="false" style="margin-bottom: 10px" class="mb-2">
  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="saleOrderNumber">
  7. <a-input v-model:value="searchFormState.saleOrderNumber" placeholder="订单编号查询" />
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item label="订单名称" name="saleOrderName">
  12. <a-input v-model:value="searchFormState.saleOrderName" placeholder="订单名称查询" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="订单类型" name="saleOrderType">
  17. <a-select v-model:value="searchFormState.saleOrderType" placeholder="订单类型查询"
  18. :options="orderTypeList"
  19. > </a-select>
  20. </a-form-item>
  21. </a-col>
  22. <template v-if="advanced">
  23. <a-col :span="6">
  24. <a-form-item label="货品名称" name="saleGoodsName">
  25. <a-input v-model:value="searchFormState.saleGoodsName" placeholder="货品名称查询" />
  26. </a-form-item>
  27. </a-col>
  28. </template>
  29. <a-col :span="6">
  30. <a-button type="primary" @click="tableRef.refresh()">查询</a-button>
  31. <a-button style="margin: 0 8px" @click="reset">重置</a-button>
  32. <a @click="toggleAdvanced" style="margin-left: 8px">
  33. {{ advanced ? '收起' : '展开' }}
  34. <component :is="advanced ? 'up-outlined' : 'down-outlined'" />
  35. </a>
  36. </a-col>
  37. </a-row>
  38. </a-form>
  39. </a-card>
  40. <a-card :bordered="false">
  41. <s-table
  42. ref="tableRef"
  43. :columns="columns"
  44. :data="loadData"
  45. bordered
  46. :row-key="(record) => record.id"
  47. >
  48. <template #operator class="table-operator">
  49. <a-space>
  50. <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizSaleOrderAdd')">
  51. <template #icon><plus-outlined /></template>
  52. 新增
  53. </a-button>
  54. </a-space>
  55. </template>
  56. <template #bodyCell="{ column, record }">
  57. <template v-if="column.dataIndex === 'action'">
  58. <a-space>
  59. <a @click="formRef.onOpen(record)" v-if="hasPerm('bizSaleOrderEdit') && record.saleStatus == '1'">编辑</a>
  60. <a-divider type="vertical" v-if="hasPerm(['bizSaleOrderEdit', 'bizSaleOrderDelete'], 'and') && record.saleStatus == '1'" />
  61. <a-button style="color:red" type="link" danger size="small" v-if="hasPerm('bizSaleOrderDelete')" @click="deleteConfig(record)">删除</a-button>
  62. </a-space>
  63. </template>
  64. <template v-if="column.dataIndex === 'saleOrderType'">
  65. <a-tag
  66. :color="
  67. record.saleOrderType === '1'
  68. ? 'orange'
  69. : record.saleOrderType === '2'
  70. ? 'green'
  71. : 'purple'
  72. "
  73. >
  74. {{ $TOOL.dictTypeData('order_type', record.saleOrderType) }}
  75. </a-tag>
  76. </template>
  77. <template v-if="column.dataIndex === 'saleStatus'">
  78. <a-tag
  79. :color="
  80. record.saleStatus === '1'
  81. ? 'processing'
  82. : record.saleStatus === '2'
  83. ? 'volcano'
  84. : 'red'
  85. "
  86. >
  87. {{ $TOOL.dictTypeData('sale_order_status', record.saleStatus) }}
  88. </a-tag>
  89. </template>
  90. </template>
  91. </s-table>
  92. </a-card>
  93. <Form ref="formRef" @successful="tableRef.refresh()" />
  94. </template>
  95. <script setup name="bizsaleorder">
  96. import { cloneDeep } from 'lodash-es'
  97. import Form from './form.vue'
  98. import bizSaleOrderApi from '@/api/biz/bizSaleOrderApi'
  99. import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
  100. import {Modal} from 'ant-design-vue';
  101. import {createVNode} from 'vue';
  102. import tool from '@/utils/tool'
  103. const tableRef = ref()
  104. const formRef = ref()
  105. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  106. const submitLoading = ref(false)
  107. //查询数据
  108. const searchFormState = ref({})
  109. const searchFormRef = ref()
  110. // 查询区域显示更多控制
  111. const advanced = ref(false)
  112. const toggleAdvanced = () => {
  113. advanced.value = !advanced.value
  114. }
  115. const orderTypeList = tool.dictList('order_type')
  116. const columns = [
  117. {
  118. title: '订单编号',
  119. dataIndex: 'saleOrderNumber',
  120. align:'center'
  121. },
  122. {
  123. title: '订单名称',
  124. dataIndex: 'saleOrderName',
  125. align:'center'
  126. },
  127. {
  128. title: '订单类型',
  129. dataIndex: 'saleOrderType',
  130. align:'center'
  131. },
  132. {
  133. title: '客户名称',
  134. dataIndex: 'customerName',
  135. align:'center'
  136. },
  137. {
  138. title: '货品名称',
  139. dataIndex: 'saleGoodsName',
  140. align:'center'
  141. },
  142. {
  143. title: '订单重量(吨)',
  144. dataIndex: 'saleOrderWeight',
  145. align:'center'
  146. },
  147. {
  148. title: '状态',
  149. dataIndex: 'saleStatus',
  150. align:'center'
  151. },
  152. ]
  153. // 操作栏通过权限判断是否显示
  154. columns.push({
  155. title: '操作',
  156. dataIndex: 'action',
  157. align: 'center',
  158. width: 150
  159. })
  160. const selectedRowKeys = ref([])
  161. // 列表选择配置
  162. const options = {
  163. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  164. alert: {
  165. show: true,
  166. clear: () => {
  167. selectedRowKeys.value = ref([])
  168. }
  169. },
  170. rowSelection: {
  171. onChange: (selectedRowKey, selectedRows) => {
  172. selectedRowKeys.value = selectedRowKey
  173. }
  174. }
  175. }
  176. const loadData = (parameter) => {
  177. const searchFormParam = cloneDeep(searchFormState.value)
  178. return bizSaleOrderApi.bizSaleOrderPage(Object.assign(parameter, searchFormParam)).then((data) => {
  179. return data
  180. })
  181. }
  182. // 重置
  183. const reset = () => {
  184. searchFormRef.value.resetFields()
  185. tableRef.value.refresh(true)
  186. }
  187. // 删除
  188. const deleteBizSaleOrder = (record) => {
  189. let params = [
  190. {
  191. id: record.id
  192. }
  193. ]
  194. bizSaleOrderApi.bizSaleOrderDelete(params).then(() => {
  195. tableRef.value.refresh(true)
  196. })
  197. }
  198. // 删除
  199. const deleteConfig = (record) => {
  200. Modal.confirm({
  201. title: '确定删除该数据吗?',
  202. icon: createVNode(ExclamationCircleOutlined),
  203. content: '',
  204. onOk() {
  205. submitLoading.value = true
  206. let params = [
  207. {
  208. id: record.id
  209. }
  210. ]
  211. bizSaleOrderApi
  212. .bizSaleOrderDelete(params)
  213. .then(() => {
  214. tableRef.value.refresh(true)
  215. })
  216. .finally(() => {
  217. submitLoading.value = false
  218. })
  219. },
  220. onCancel() {}
  221. })
  222. }
  223. // 批量删除
  224. const deleteBatchBizSaleOrder = (params) => {
  225. bizSaleOrderApi.bizSaleOrderDelete(params).then(() => {
  226. tableRef.value.clearRefreshSelected()
  227. })
  228. }
  229. </script>