index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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="appointmentType">
  7. <a-select v-model:value="searchFormState.appointmentType"
  8. placeholder="查询预约类型"
  9. :options="appointmentClassifyOptions">
  10. </a-select>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :span="6">
  14. <a-button type="primary" @click="tableRef.refresh()">查询</a-button>
  15. <a-button style="margin: 0 8px" @click="reset">重置</a-button>
  16. <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizParkConfigAdd')">
  17. <template #icon><plus-outlined /></template>
  18. 新增
  19. </a-button>
  20. </a-col>
  21. </a-row>
  22. </a-form>
  23. </a-card>
  24. <a-card :bordered="false" style="margin-bottom: 10px" class="mb-2">
  25. <s-table
  26. ref="tableRef"
  27. :columns="columns"
  28. :data="loadData"
  29. bordered
  30. :row-key="(record) => record.id"
  31. >
  32. <template #bodyCell="{ column, record, index }">
  33. <template v-if="column.dataIndex === 'serial'">
  34. {{ index + 1 }}
  35. </template>
  36. <template v-if="column.dataIndex === 'appointmentType'">
  37. {{ $TOOL.dictTypeData('appointment_classify', record.appointmentType) }}
  38. </template>
  39. <template v-if="column.dataIndex === 'freeParkTime'">
  40. {{ record.freeParkTime + ' 分钟' }}
  41. </template>
  42. <template v-if="column.dataIndex === 'exceedAmount'">
  43. {{ record.exceedAmount + ' 元/小时' }}
  44. </template>
  45. <template v-if="column.dataIndex === 'payAfterParkTime'">
  46. {{ record.payAfterParkTime + ' 分钟' }}
  47. </template>
  48. <template v-if="column.dataIndex === 'action'">
  49. <a-space>
  50. <a @click="formRef.onOpen(record)" v-if="hasPerm('bizParkConfigEdit')">编辑</a>
  51. <a-divider type="vertical" v-if="hasPerm(['bizParkConfigEdit', 'bizParkConfigDelete'], 'and')" />
  52. <a-button type="link" danger size="small" v-if="hasPerm('bizParkConfigDelete')" @click="deleteConfig(record)">删除</a-button>
  53. </a-space>
  54. </template>
  55. </template>
  56. </s-table>
  57. </a-card>
  58. <Form ref="formRef" @successful="tableRef.refresh()" />
  59. </template>
  60. <script setup name="bizparkconfig">
  61. import { cloneDeep } from 'lodash-es'
  62. import Form from './form.vue'
  63. import bizParkConfigApi from '@/api/biz/bizParkConfigApi'
  64. import tool from '@/utils/tool'
  65. const searchFormState = ref({})
  66. const searchFormRef = ref()
  67. const tableRef = ref()
  68. const formRef = ref()
  69. const submitLoading = ref(false)
  70. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  71. const columns = [
  72. {
  73. title: '序号',
  74. width: 50,
  75. dataIndex: 'serial',
  76. align:'center'
  77. },
  78. {
  79. title: '预约类型',
  80. dataIndex: 'appointmentType',
  81. align:'center'
  82. },
  83. {
  84. title: '免费停留时长',
  85. dataIndex: 'freeParkTime',
  86. align:'center'
  87. },
  88. {
  89. title: '超出每小时费用',
  90. dataIndex: 'exceedAmount',
  91. align:'center'
  92. },
  93. {
  94. title: '支付后停留时长',
  95. dataIndex: 'payAfterParkTime',
  96. align:'center'
  97. },
  98. {
  99. title: '创建时间',
  100. width: 180,
  101. dataIndex: 'createTime',
  102. align: 'center'
  103. },
  104. ]
  105. // 操作栏通过权限判断是否显示
  106. if (hasPerm(['bizParkConfigEdit', 'bizParkConfigDelete'])) {
  107. columns.push({
  108. title: '操作',
  109. dataIndex: 'action',
  110. align: 'center',
  111. width: 150
  112. })
  113. }
  114. const loadData = (parameter) => {
  115. const searchFormParam = cloneDeep(searchFormState.value)
  116. return bizParkConfigApi.bizParkConfigPage(Object.assign(parameter, searchFormParam)).then((data) => {
  117. return data
  118. })
  119. }
  120. // 重置
  121. const reset = () => {
  122. searchFormRef.value.resetFields()
  123. tableRef.value.refresh(true)
  124. }
  125. // 删除
  126. const deleteConfig = (record) => {
  127. Modal.confirm({
  128. title: '确定删除该数据吗?',
  129. icon: createVNode(ExclamationCircleOutlined),
  130. content: '',
  131. onOk() {
  132. submitLoading.value = true
  133. let params = [
  134. {
  135. id: record.id
  136. }
  137. ]
  138. bizParkConfigApi
  139. .bizParkConfigDelete(params)
  140. .then(() => {
  141. tableRef.value.refresh(true)
  142. })
  143. .finally(() => {
  144. submitLoading.value = false
  145. })
  146. },
  147. onCancel() {}
  148. })
  149. }
  150. // 预约分类
  151. const appointmentClassifyOptions = tool.dictList('appointment_classify')
  152. </script>