index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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="orderNumber">
  7. <a-input v-model:value="searchFormState.orderNumber" placeholder="订单编号查询" />
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item label="订单名称" name="orderName">
  12. <a-input v-model:value="searchFormState.orderName" placeholder="订单名称查询" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="车牌号" name="licenseNumber">
  17. <a-input v-model:value="searchFormState.licenseNumber" placeholder="车牌号码查询" />
  18. </a-form-item>
  19. </a-col>
  20. <template v-if="advanced">
  21. <a-col :span="6">
  22. <a-form-item label="客户名称" name="customerName">
  23. <a-input v-model:value="searchFormState.customerName" placeholder="客户名称查询" />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :span="6">
  27. <a-form-item label="货品名称" name="goodsName">
  28. <a-input v-model:value="searchFormState.goodsName" placeholder="货品名称查询" />
  29. </a-form-item>
  30. </a-col>
  31. <a-col :span="6">
  32. <a-form-item label="司机名称" name="driverName">
  33. <a-input v-model:value="searchFormState.driverName" placeholder="司机名称查询" />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :span="6">
  37. <a-form-item label="司机电话" name="driverMobile">
  38. <a-input v-model:value="searchFormState.driverMobile" placeholder="司机电话查询" />
  39. </a-form-item>
  40. </a-col>
  41. <a-col :span="6">
  42. <a-form-item label="预约状态" name="status">
  43. <a-select v-model:value="searchFormState.status" placeholder="预约状态查询"
  44. :options="statusList"
  45. > </a-select>
  46. </a-form-item>
  47. </a-col>
  48. </template>
  49. <a-col :span="6">
  50. <a-button type="primary" @click="tableRef.refresh()">查询</a-button>
  51. <a-button style="margin: 0 8px" @click="reset">重置</a-button>
  52. <a @click="toggleAdvanced" style="margin-left: 8px">
  53. {{ advanced ? '收起' : '展开' }}
  54. <component :is="advanced ? 'up-outlined' : 'down-outlined'" />
  55. </a>
  56. </a-col>
  57. </a-row>
  58. </a-form>
  59. </a-card>
  60. <a-card :bordered="false">
  61. <s-table
  62. ref="tableRef"
  63. :columns="columns"
  64. :data="loadData"
  65. bordered
  66. :row-key="(record) => record.id"
  67. >
  68. <template #operator class="table-operator">
  69. <a-space>
  70. <!-- <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizAppointmentRecordAdd')">
  71. <template #icon><plus-outlined /></template>
  72. 新增
  73. </a-button>-->
  74. <!-- <a-button @click="exportTotal" v-if="hasPerm('bizAppointmentExport')">
  75. <template #icon>
  76. <export-outlined/>
  77. </template>
  78. 导出
  79. </a-button>-->
  80. </a-space>
  81. </template>
  82. <template #bodyCell="{ column, record }">
  83. <template v-if="column.dataIndex === 'orderInfo'">
  84. <div class="time-list">
  85. <p>名称:{{ record.orderName }}</p>
  86. <p style="margin-bottom: 0">编号:{{ record.orderNumber }}</p>
  87. </div>
  88. </template>
  89. <template v-if="column.dataIndex === 'timeInfo'">
  90. <div class="time-list">
  91. <p>开始时间:{{ record.beginTime }}</p>
  92. <p style="margin-bottom: 0">结束时间:{{ record.endTime }}</p>
  93. </div>
  94. </template>
  95. <template v-if="column.dataIndex === 'customerInfo'">
  96. <span>{{record.customerName}}</span>
  97. </template>
  98. <template v-if="column.dataIndex === 'driverInfo'">
  99. <div class="time-list">
  100. <p>姓名:{{ record.driverName }}</p>
  101. <p style="margin-bottom: 0">电话:{{ record.driverMobile }}</p>
  102. </div>
  103. </template>
  104. <template v-if="column.dataIndex === 'goodsInfo'">
  105. <div class="time-list">
  106. <p>名称:{{ record.goodsName }}</p>
  107. <p style="margin-bottom: 0">规格:{{ record.goodsModel }}</p>
  108. </div>
  109. </template>
  110. <template v-if="column.dataIndex === 'status'">
  111. <a-tag
  112. :color="
  113. record.status === '1'
  114. ? 'volcano'
  115. : record.status === '2'
  116. ? 'red'
  117. : record.status === '3'
  118. ? 'processing'
  119. : record.status === '4'
  120. ? 'warning'
  121. : record.status === '5'
  122. ? 'magenta'
  123. : record.status === '6'
  124. ? 'orange'
  125. : record.status === '7'
  126. ? 'gold'
  127. : record.status === '8'
  128. ? 'lime'
  129. : record.status === '9'
  130. ? 'green'
  131. : record.status === '10'
  132. ? 'cyan'
  133. : record.status === '11'
  134. ? 'success'
  135. : record.status === '12'
  136. ? 'blue'
  137. : record.status === '13'
  138. ? 'geekblue'
  139. : 'error'
  140. "
  141. >
  142. {{ $TOOL.dictTypeData('appointment_status', record.status) }}
  143. </a-tag>
  144. </template>
  145. <template v-if="column.dataIndex === 'action'">
  146. <a style="color: #ffaa00" @click="orderRef.onOpen(record)" v-if="hasPerm('bizAppointmentRecordOrder') && (record.status == '3' || record.status == '4' || record.status == '5' || record.status == '6')">车辆调度</a>
  147. <!-- <a-divider type="vertical" v-if="(hasPerm('bizAppointmentRecordOrder') && (record.status == '3' || record.status == '4' || record.status == '5' || record.status == '6'|| record.status == '7'|| record.status == '8'|| record.status == '9')) && (hasPerm('bizAppointmentRecordTime') && (record.status == '3' || record.status == '4'))" />
  148. <a style="color:blue" @click="formRef.onOpen(record)" v-if="hasPerm('bizAppointmentRecordTime') && (record.status == '3' || record.status == '4')">调整时段</a>-->
  149. <a-divider type="vertical" v-if="(hasPerm('bizAppointmentRecordOrder') && (record.status == '3' || record.status == '4' || record.status == '5' || record.status == '6')) && (hasPerm('bizAppointmentRecordCancel') && (record.status == '3' || record.status == '4'))" />
  150. <a style="color:red" type="link" danger size="small" @click="cancelConfig(record)" v-if="hasPerm('bizAppointmentRecordCancel') && (record.status == '3' || record.status == '4')">取消排队</a>
  151. </template>
  152. </template>
  153. </s-table>
  154. </a-card>
  155. <Form ref="formRef" @successful="tableRef.refresh()" />
  156. <Order ref="orderRef" @successful="tableRef.refresh()" />
  157. <Review ref="reviewRef" @successful="tableRef.refresh(true)" />
  158. <Detail ref="detailRef" @successful="tableRef.refresh()" />
  159. </template>
  160. <script setup name="bizappointmentrecord">
  161. import { cloneDeep } from 'lodash-es'
  162. import bizAppointmentRecordApi from '@/api/biz/bizAppointmentRecordApi'
  163. import tool from '@/utils/tool'
  164. import downloadUtil from '@/utils/downloadUtil'
  165. import Detail from './detail.vue'
  166. import Order from './editOrder.vue'
  167. import Form from './form.vue'
  168. import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
  169. import {Modal} from 'ant-design-vue';
  170. import {createVNode} from 'vue';
  171. const submitLoading = ref(false)
  172. const tableRef = ref()
  173. const formRef = ref()
  174. const orderRef = ref()
  175. const reviewRef = ref()
  176. const detailRef = ref()
  177. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  178. const nowRecord = ref()
  179. //查询数据
  180. const searchFormState = ref({appointmentFlag:'1'})
  181. const searchFormRef = ref()
  182. const statusList = tool.dictList('queue_status')
  183. // 查询区域显示更多控制
  184. const advanced = ref(false)
  185. const toggleAdvanced = () => {
  186. advanced.value = !advanced.value
  187. }
  188. const columns = [
  189. {
  190. title: '订单信息',
  191. dataIndex: 'orderInfo',
  192. width:200
  193. },
  194. {
  195. title: '车牌号',
  196. dataIndex: 'licenseNumber',
  197. width:150,
  198. align: 'center'
  199. },
  200. {
  201. title: '提货时间',
  202. dataIndex: 'timeInfo',
  203. align:'center',
  204. width:200
  205. },
  206. {
  207. title: '客户名称',
  208. dataIndex: 'customerInfo',
  209. align:'center',
  210. width:180
  211. },
  212. {
  213. title: '货品信息',
  214. dataIndex: 'goodsInfo',
  215. width:160
  216. },
  217. {
  218. title: '司机信息',
  219. dataIndex: 'driverInfo',
  220. width: 160
  221. },
  222. {
  223. title: '排队号',
  224. dataIndex: 'queueNumber',
  225. width: 110,
  226. align:'center'
  227. },
  228. {
  229. title: '状态',
  230. dataIndex: 'status',
  231. align: 'center',
  232. width:120
  233. },
  234. ]
  235. // 操作栏通过权限判断是否显示
  236. columns.push({
  237. title: '操作',
  238. dataIndex: 'action',
  239. align: 'center',
  240. fixed: 'right',
  241. width: 240
  242. })
  243. const selectedRowKeys = ref([])
  244. // 列表选择配置
  245. const options = {
  246. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  247. alert: {
  248. show: true,
  249. clear: () => {
  250. selectedRowKeys.value = ref([])
  251. }
  252. },
  253. rowSelection: {
  254. onChange: (selectedRowKey, selectedRows) => {
  255. selectedRowKeys.value = selectedRowKey
  256. }
  257. }
  258. }
  259. const loadData = (parameter) => {
  260. const searchFormParam = cloneDeep(searchFormState.value)
  261. return bizAppointmentRecordApi.bizAppointmentRecordPage(Object.assign(parameter, searchFormParam)).then((data) => {
  262. return data
  263. })
  264. }
  265. // 重置
  266. const reset = () => {
  267. searchFormRef.value.resetFields()
  268. tableRef.value.refresh(true)
  269. }
  270. // 删除
  271. const deleteBizAppointmentRecord = (record) => {
  272. let params = [
  273. {
  274. id: record.id
  275. }
  276. ]
  277. bizAppointmentRecordApi.bizAppointmentRecordDelete(params).then(() => {
  278. tableRef.value.refresh(true)
  279. })
  280. }
  281. // 删除
  282. const deleteConfig = (record) => {
  283. Modal.confirm({
  284. title: '确定删除该数据吗?',
  285. icon: createVNode(ExclamationCircleOutlined),
  286. content: '',
  287. onOk() {
  288. submitLoading.value = true
  289. let params = [
  290. {
  291. id: record.id
  292. }
  293. ]
  294. bizAppointmentRecordApi
  295. .bizAppointmentRecordDelete(params)
  296. .then(() => {
  297. tableRef.value.refresh(true)
  298. })
  299. .finally(() => {
  300. submitLoading.value = false
  301. })
  302. },
  303. onCancel() {}
  304. })
  305. }
  306. //取消排队
  307. const cancelConfig = (record)=>{
  308. Modal.confirm({
  309. title: '确定要取消排队吗?',
  310. icon: createVNode(ExclamationCircleOutlined),
  311. content: '',
  312. onOk() {
  313. submitLoading.value = true
  314. let params =
  315. {
  316. id: record.id
  317. }
  318. bizAppointmentRecordApi
  319. .cancelAppointmentRecord(params)
  320. .then(() => {
  321. tableRef.value.refresh(true)
  322. })
  323. .finally(() => {
  324. submitLoading.value = false
  325. })
  326. },
  327. onCancel() {}
  328. })
  329. }
  330. // 批量删除
  331. const deleteBatchBizAppointmentRecord = (params) => {
  332. bizAppointmentRecordApi.bizAppointmentRecordDelete(params).then(() => {
  333. tableRef.value.clearRefreshSelected()
  334. })
  335. }
  336. //导出
  337. const exportTotal = () => {
  338. const searchFormParam = cloneDeep(searchFormState.value)
  339. bizAppointmentRecordApi.exportRecord(Object.assign(searchFormParam)).then((res)=>{
  340. downloadUtil.resultDownload(res)
  341. })
  342. }
  343. </script>
  344. <style lang="less" scoped>
  345. /** 表头居中 */
  346. :deep .ant-table-thead > tr > th {
  347. text-align: center;
  348. }
  349. .time-list {
  350. -webkit-text-size-adjust: none;
  351. font-size: 13px;
  352. display: flex;
  353. flex-direction: column;
  354. p {
  355. white-space: nowrap;
  356. span {
  357. display: inline-block;
  358. font-weight: 600;
  359. height: 16px;
  360. line-height: 16px;
  361. border-radius: 5px;
  362. text-align: center;
  363. margin-right: 2px;
  364. padding: 0 5px;
  365. }
  366. .blueTag {
  367. color: #1890ff;
  368. background: rgba(24, 144, 255, 0.1);
  369. }
  370. .orangeTag {
  371. color: #ff7c18;
  372. background: rgba(24, 144, 255, 0.1);
  373. }
  374. .greenTag {
  375. color: rgb(82, 196, 26);
  376. background: rgba(82, 196, 26, 0.1);
  377. }
  378. .purpleTag {
  379. color: rgb(77, 26, 196);
  380. background: rgba(82, 196, 26, 0.1);
  381. }
  382. .showNum {
  383. display: inline-block;
  384. height: 16px;
  385. line-height: 16px;
  386. width: 45px;
  387. border-radius: 5px;
  388. text-align: center;
  389. margin-right: 2px;
  390. text-align: right;
  391. }
  392. }
  393. }
  394. </style>