index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <a-card :bordered="false">
  3. <s-table
  4. ref="tableRef"
  5. :columns="columns"
  6. :data="loadData"
  7. bordered
  8. :row-key="(record) => record.id"
  9. >
  10. <template #operator class="table-operator">
  11. <a-space>
  12. <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizConfigAdd')">
  13. <template #icon><plus-outlined /></template>
  14. 新增
  15. </a-button>
  16. </a-space>
  17. </template>
  18. <template #bodyCell="{ column, record }">
  19. <template v-if="column.dataIndex === 'action'">
  20. <a-space>
  21. <a @click="formRef.onOpen(record)" v-if="hasPerm('bizConfigEdit')">编辑</a>
  22. <a-divider type="vertical" v-if="hasPerm(['bizConfigEdit', 'bizConfigDelete'], 'and')" />
  23. <a-button type="link" danger size="small" v-if="hasPerm('bizConfigDelete')" @click="deleteConfig(record)">删除</a-button>
  24. </a-space>
  25. </template>
  26. <template v-if="column.dataIndex === 'queueEfficiency'">
  27. {{record.queueEfficiency}}分钟
  28. </template>
  29. <template v-if="column.dataIndex === 'pullNumber'">
  30. {{record.pullNumber}}个
  31. </template>
  32. <template v-if="column.dataIndex === 'stopDuration'">
  33. {{record.stopDuration}}分钟
  34. </template>
  35. <template v-if="column.dataIndex === 'auditSwitch'">
  36. {{ $TOOL.dictTypeData('biz_switch', record.auditSwitch) }}
  37. </template>
  38. <template v-if="column.dataIndex === 'orderWeightSwitch'">
  39. {{ $TOOL.dictTypeData('biz_switch', record.orderWeightSwitch) }}
  40. </template>
  41. <template v-if="column.dataIndex === 'accessControlSwitch'">
  42. {{ $TOOL.dictTypeData('biz_switch', record.accessControlSwitch) }}
  43. </template>
  44. <template v-if="column.dataIndex === 'lossWarn'">
  45. {{record.lossWarn}}%
  46. </template>
  47. <template v-if="column.dataIndex === 'applyCount'">
  48. {{record.applyCount}}个
  49. </template>
  50. <template v-if="column.dataIndex === 'lineNoticeSwitch'">
  51. {{ $TOOL.dictTypeData('biz_switch', record.lineNoticeSwitch) }}
  52. </template>
  53. </template>
  54. </s-table>
  55. </a-card>
  56. <Form ref="formRef" @successful="tableRef.refresh()" />
  57. </template>
  58. <script setup name="bizconfig">
  59. import { cloneDeep } from 'lodash-es'
  60. import Form from './form.vue'
  61. import bizConfigApi from '@/api/biz/bizConfigApi'
  62. import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
  63. import {Modal} from 'ant-design-vue';
  64. import {createVNode} from 'vue';
  65. const tableRef = ref()
  66. const formRef = ref()
  67. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  68. const loading = ref(false)
  69. const submitLoading = ref(false)
  70. const columns = [
  71. {
  72. title: '排队时效',
  73. dataIndex: 'queueEfficiency',
  74. align:'center'
  75. },
  76. /*{
  77. title: '时段下拉个数',
  78. dataIndex: 'pullNumber',
  79. align:'center'
  80. },*/
  81. {
  82. title: '停留时长',
  83. dataIndex: 'stopDuration',
  84. align:'center'
  85. },
  86. {
  87. title: '预约审核开关',
  88. dataIndex: 'auditSwitch',
  89. align:'center'
  90. },
  91. {
  92. title: '订单重量校验开关',
  93. dataIndex: 'orderWeightSwitch',
  94. align:'center'
  95. },
  96. {
  97. title: '门禁强制校验开关',
  98. dataIndex: 'accessControlSwitch',
  99. align:'center'
  100. },
  101. {
  102. title: '装卸损耗预警值',
  103. dataIndex: 'lossWarn',
  104. align:'center'
  105. },
  106. {
  107. title: '预约申请数量',
  108. dataIndex: 'applyCount',
  109. align:'center'
  110. },
  111. {
  112. title: '排队通知开关',
  113. dataIndex: 'lineNoticeSwitch',
  114. align:'center'
  115. },
  116. ]
  117. // 操作栏通过权限判断是否显示
  118. columns.push({
  119. title: '操作',
  120. dataIndex: 'action',
  121. align: 'center',
  122. width: 150
  123. })
  124. const selectedRowKeys = ref([])
  125. // 列表选择配置
  126. const options = {
  127. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  128. alert: {
  129. show: true,
  130. clear: () => {
  131. selectedRowKeys.value = ref([])
  132. }
  133. },
  134. rowSelection: {
  135. onChange: (selectedRowKey, selectedRows) => {
  136. selectedRowKeys.value = selectedRowKey
  137. }
  138. }
  139. }
  140. const loadData = (parameter) => {
  141. return bizConfigApi.bizConfigPage(parameter).then((data) => {
  142. return data
  143. })
  144. }
  145. // 重置
  146. const reset = () => {
  147. searchFormRef.value.resetFields()
  148. tableRef.value.refresh(true)
  149. }
  150. // 删除
  151. const deleteBizConfig = (record) => {
  152. let params = [
  153. {
  154. id: record.id
  155. }
  156. ]
  157. bizConfigApi.bizConfigDelete(params).then(() => {
  158. tableRef.value.refresh(true)
  159. })
  160. }
  161. // 删除
  162. const deleteConfig = (record) => {
  163. Modal.confirm({
  164. title: '确定删除该数据吗?',
  165. icon: createVNode(ExclamationCircleOutlined),
  166. content: '',
  167. onOk() {
  168. submitLoading.value = true
  169. let params = [
  170. {
  171. id: record.id
  172. }
  173. ]
  174. bizConfigApi
  175. .bizConfigDelete(params)
  176. .then(() => {
  177. tableRef.value.refresh(true)
  178. })
  179. .finally(() => {
  180. submitLoading.value = false
  181. })
  182. },
  183. onCancel() {}
  184. })
  185. }
  186. // 批量删除
  187. const deleteBatchBizConfig = (params) => {
  188. bizConfigApi.bizConfigDelete(params).then(() => {
  189. tableRef.value.clearRefreshSelected()
  190. })
  191. }
  192. </script>