index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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="planNumber">
  7. <a-input v-model:value="searchFormState.planNumber" placeholder="管桩计划单号查询" />
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item label="车牌号" name="licenseNumber">
  12. <a-input v-model:value="searchFormState.licenseNumber" placeholder="车牌号码查询" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="司机名称" name="driverName">
  17. <a-input v-model:value="searchFormState.driverName" placeholder="司机名称查询" />
  18. </a-form-item>
  19. </a-col>
  20. <template v-if="advanced">
  21. <a-col :span="6">
  22. <a-form-item label="司机电话" name="driverMobile">
  23. <a-input v-model:value="searchFormState.driverMobile" placeholder="司机电话查询" />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :span="6">
  27. <a-form-item label="预约状态" name="status">
  28. <a-select v-model:value="searchFormState.status" placeholder="预约状态查询"
  29. :options="statusList"
  30. > </a-select>
  31. </a-form-item>
  32. </a-col>
  33. </template>
  34. <a-col :span="6">
  35. <a-button type="primary" @click="tableRef.refresh()">查询</a-button>
  36. <a-button style="margin: 0 8px" @click="reset">重置</a-button>
  37. <a @click="toggleAdvanced" style="margin-left: 8px">
  38. {{ advanced ? '收起' : '展开' }}
  39. <component :is="advanced ? 'up-outlined' : 'down-outlined'" />
  40. </a>
  41. </a-col>
  42. </a-row>
  43. </a-form>
  44. </a-card>
  45. <a-card :bordered="false">
  46. <s-table
  47. ref="tableRef"
  48. :columns="columns"
  49. :data="loadData"
  50. bordered
  51. :row-key="(record) => record.id"
  52. >
  53. <template #operator class="table-operator">
  54. <a-space>
  55. <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizPipeAppointAdd')">
  56. <template #icon><plus-outlined /></template>
  57. 新增
  58. </a-button>
  59. <a-button @click="exportTotal" v-if="hasPerm('bizPipeAppointExport')">
  60. <template #icon>
  61. <export-outlined/>
  62. </template>
  63. 导出
  64. </a-button>
  65. </a-space>
  66. </template>
  67. <template #bodyCell="{ column, record }">
  68. <template v-if="column.dataIndex === 'action'">
  69. <!-- <a-space>
  70. <a @click="formRef.onOpen(record)" v-if="hasPerm('bizPipeAppointEdit')">编辑</a>
  71. <a-divider type="vertical" v-if="hasPerm(['bizPipeAppointEdit', 'bizPipeAppointDelete'], 'and')" />
  72. <a-popconfirm title="确定要删除吗?" @confirm="deleteBizPipeAppoint(record)">
  73. <a-button type="link" danger size="small" v-if="hasPerm('bizPipeAppointDelete')">删除</a-button>
  74. </a-popconfirm>
  75. </a-space>-->
  76. <a-space>
  77. <a-dropdown>
  78. <a class="ant-dropdown-link">
  79. 更多
  80. <DownOutlined />
  81. </a>
  82. <template #overlay>
  83. <a-menu>
  84. <a-menu-item>
  85. <a @click="detailRef.onOpen(record)">详情</a>
  86. </a-menu-item>
  87. <a-menu-item v-if="hasPerm('bizAppointmentRecordEdit') && (record.status == '2' || record.status == '4')">
  88. <a @click="formRef.onOpen(record)" >编辑</a>
  89. </a-menu-item>
  90. <a-menu-item v-if="hasPerm('bizAppointmentRecordDelete') && (record.status == '2' || record.status == '4')">
  91. <a style="color:red" type="link" danger size="small" @click="deleteConfig(record)">删除</a>
  92. </a-menu-item>
  93. <a-menu-item v-if="record.status=='4'">
  94. <a style="color:green" @click="cancel(record)" >取消</a>
  95. </a-menu-item>
  96. </a-menu>
  97. </template>
  98. </a-dropdown>
  99. </a-space>
  100. </template>
  101. <template v-if="column.dataIndex === 'status'">
  102. <a-tag
  103. :color="
  104. record.status === '1'
  105. ? 'volcano'
  106. : record.status === '2'
  107. ? 'red'
  108. : record.status === '3'
  109. ? 'processing'
  110. : record.status === '4'
  111. ? 'warning'
  112. : record.status === '5'
  113. ? 'magenta'
  114. : record.status === '6'
  115. ? 'orange'
  116. : record.status === '7'
  117. ? 'gold'
  118. : record.status === '8'
  119. ? 'lime'
  120. : record.status === '9'
  121. ? 'green'
  122. : record.status === '10'
  123. ? 'cyan'
  124. : record.status === '11'
  125. ? 'success'
  126. : record.status === '12'
  127. ? 'blue'
  128. : record.status === '13'
  129. ? 'geekblue'
  130. : 'error'
  131. "
  132. >
  133. {{ $TOOL.dictTypeData('appointment_status', record.status) }}
  134. </a-tag>
  135. </template>
  136. </template>
  137. </s-table>
  138. </a-card>
  139. <Form ref="formRef" @successful="tableRef.refresh()" />
  140. <Detail ref="detailRef" @successful="tableRef.refresh()" />
  141. </template>
  142. <script setup name="bizpipeappoint">
  143. import { cloneDeep } from 'lodash-es'
  144. import Form from './form.vue'
  145. import bizPipeAppointApi from '@/api/biz/bizPipeAppointApi'
  146. import bizAppointmentRecordApi from "@/api/biz/bizAppointmentRecordApi"
  147. import tool from '@/utils/tool'
  148. import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
  149. import {Modal} from 'ant-design-vue';
  150. import {createVNode} from 'vue';
  151. import Detail from "./detail.vue";
  152. import downloadUtil from '@/utils/downloadUtil'
  153. //查询数据
  154. const searchFormState = ref({})
  155. const searchFormRef = ref()
  156. const statusList = tool.dictList('appointment_status')
  157. // 查询区域显示更多控制
  158. const advanced = ref(false)
  159. const toggleAdvanced = () => {
  160. advanced.value = !advanced.value
  161. }
  162. const submitLoading = ref(false)
  163. const tableRef = ref()
  164. const formRef = ref()
  165. const detailRef = ref()
  166. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  167. const columns = [
  168. {
  169. title: '管桩计划单号',
  170. dataIndex: 'planNumber',
  171. align:'center'
  172. },
  173. {
  174. title: '车牌号',
  175. dataIndex: 'licenseNumber',
  176. align:'center'
  177. },
  178. {
  179. title: '司机姓名',
  180. dataIndex: 'driverName',
  181. align:'center'
  182. },
  183. {
  184. title: '司机电话',
  185. dataIndex: 'driverMobile',
  186. align:'center'
  187. },
  188. {
  189. title: '入场时间',
  190. dataIndex: 'enterTime',
  191. align:'center'
  192. },
  193. {
  194. title: '出场时间',
  195. dataIndex: 'leaveTime',
  196. align:'center'
  197. },
  198. {
  199. title: '状态',
  200. dataIndex: 'status',
  201. align:'center'
  202. },
  203. ]
  204. // 操作栏通过权限判断是否显示
  205. if (hasPerm(['bizPipeAppointEdit', 'bizPipeAppointDelete'])) {
  206. columns.push({
  207. title: '操作',
  208. dataIndex: 'action',
  209. align: 'center',
  210. width: 150
  211. })
  212. }
  213. const selectedRowKeys = ref([])
  214. // 列表选择配置
  215. const options = {
  216. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  217. alert: {
  218. show: true,
  219. clear: () => {
  220. selectedRowKeys.value = ref([])
  221. }
  222. },
  223. rowSelection: {
  224. onChange: (selectedRowKey, selectedRows) => {
  225. selectedRowKeys.value = selectedRowKey
  226. }
  227. }
  228. }
  229. const loadData = (parameter) => {
  230. const searchFormParam = cloneDeep(searchFormState.value)
  231. searchFormParam.type = '5'
  232. return bizAppointmentRecordApi.bizAppointmentPipeRecordPage(Object.assign(parameter, searchFormParam)).then((data) => {
  233. return data
  234. })
  235. }
  236. //导出
  237. const exportTotal = () => {
  238. Modal.confirm({
  239. title: '确定要导出记录吗?',
  240. icon: createVNode(ExclamationCircleOutlined),
  241. content: '',
  242. onOk() {
  243. submitLoading.value = true
  244. const searchFormParam = cloneDeep(searchFormState.value)
  245. searchFormParam.type = '5'
  246. bizAppointmentRecordApi
  247. .exportPipeRecord(Object.assign(searchFormParam))
  248. .then((res) => {
  249. downloadUtil.resultDownload(res)
  250. })
  251. .finally(() => {
  252. submitLoading.value = false
  253. })
  254. },
  255. onCancel() {}
  256. })
  257. }
  258. // 重置
  259. const reset = () => {
  260. searchFormRef.value.resetFields()
  261. tableRef.value.refresh(true)
  262. }
  263. // 删除
  264. const deleteBizPipeAppoint = (record) => {
  265. let params = [
  266. {
  267. id: record.id
  268. }
  269. ]
  270. bizPipeAppointApi.bizPipeAppointDelete(params).then(() => {
  271. tableRef.value.refresh(true)
  272. })
  273. }
  274. //取消预约
  275. const cancel = (record) => {
  276. Modal.confirm({
  277. title: '确定要取消吗?',
  278. icon: createVNode(ExclamationCircleOutlined),
  279. content: '',
  280. onOk() {
  281. submitLoading.value = true
  282. let params =
  283. {
  284. id: record.id
  285. }
  286. bizAppointmentRecordApi
  287. .replacePipeAppoint(params)
  288. .then(() => {
  289. tableRef.value.refresh(true)
  290. })
  291. .finally(() => {
  292. submitLoading.value = false
  293. })
  294. },
  295. onCancel() {}
  296. })
  297. }
  298. // 删除
  299. const deleteConfig = (record) => {
  300. Modal.confirm({
  301. title: '确定删除该数据吗?',
  302. icon: createVNode(ExclamationCircleOutlined),
  303. content: '',
  304. onOk() {
  305. submitLoading.value = true
  306. let params = [
  307. {
  308. id: record.id
  309. }
  310. ]
  311. bizAppointmentRecordApi
  312. .bizAppointmentRecordDelete(params)
  313. .then(() => {
  314. tableRef.value.refresh(true)
  315. })
  316. .finally(() => {
  317. submitLoading.value = false
  318. })
  319. },
  320. onCancel() {}
  321. })
  322. }
  323. // 批量删除
  324. const deleteBatchBizPipeAppoint = (params) => {
  325. bizPipeAppointApi.bizPipeAppointDelete(params).then(() => {
  326. tableRef.value.clearRefreshSelected()
  327. })
  328. }
  329. </script>