index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  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. <a-col :span="6">
  21. <a-form-item label="客户名称" name="customerName">
  22. <a-input v-model:value="searchFormState.customerName" placeholder="客户名称查询" />
  23. </a-form-item>
  24. </a-col>
  25. <template v-if="advanced">
  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 === 'carInfo'">
  90. <div class="time-list">
  91. <p>车牌号:{{ record.licenseNumber }}</p>
  92. <p style="margin-bottom: 0">车轴数:{{ record.axleNumber + '轴' }}</p>
  93. </div>
  94. </template>
  95. <template v-if="column.dataIndex === 'timeInfo'">
  96. <!-- <span>{{record.beginTime + '~' + record.endTime}}</span>-->
  97. <div class="time-list">
  98. <p>开始时间:{{ record.beginTime }}</p>
  99. <p style="margin-bottom: 0">结束时间:{{ record.endTime }}</p>
  100. </div>
  101. </template>
  102. <template v-if="column.dataIndex === 'customerInfo'">
  103. <span>{{record.customerName}}</span>
  104. </template>
  105. <template v-if="column.dataIndex === 'driverInfo'">
  106. <div class="time-list">
  107. <p>姓名:{{ record.driverName }}</p>
  108. <p style="margin-bottom: 0">电话:{{ record.driverMobile }}</p>
  109. </div>
  110. </template>
  111. <template v-if="column.dataIndex === 'goodsInfo'">
  112. <div class="time-list">
  113. <p>名称:{{ record.goodsName }}</p>
  114. <p style="margin-bottom: 0">编码:{{ record.goodsCode }}</p>
  115. </div>
  116. </template>
  117. <template v-if="column.dataIndex === 'axleNumber'">
  118. {{record.axleNumber+'轴'}}
  119. </template>
  120. <template v-if="column.dataIndex === 'status'">
  121. <a-tag
  122. :color="
  123. record.status === '1'
  124. ? 'volcano'
  125. : record.status === '2'
  126. ? 'red'
  127. : record.status === '3'
  128. ? 'processing'
  129. : record.status === '4'
  130. ? 'warning'
  131. : record.status === '5'
  132. ? 'magenta'
  133. : record.status === '6'
  134. ? 'orange'
  135. : record.status === '7'
  136. ? 'gold'
  137. : record.status === '8'
  138. ? 'lime'
  139. : record.status === '9'
  140. ? 'green'
  141. : record.status === '10'
  142. ? 'cyan'
  143. : record.status === '11'
  144. ? 'success'
  145. : record.status === '12'
  146. ? 'blue'
  147. : record.status === '13'
  148. ? 'geekblue'
  149. : 'error'
  150. "
  151. >
  152. {{ $TOOL.dictTypeData('appointment_status', record.status) }}
  153. </a-tag>
  154. </template>
  155. <template v-if="column.dataIndex === 'action'">
  156. <a @click="showModal(record)" v-if="record.status!='1'&& record.status!='2' && record.status!='10' && record.status!='11'&&
  157. record.status!='12' && record.status!='13' && record.status!='14' && record.status!='15'">二维码</a>
  158. <a-divider type="vertical" v-if="record.status!='1'&& record.status!='2' && record.status!='10' && record.status!='11'&&
  159. record.status!='12' && record.status!='13' && record.status!='14' && record.status!='15'"/>
  160. <a-space>
  161. <a-dropdown>
  162. <a class="ant-dropdown-link">
  163. 更多
  164. <DownOutlined />
  165. </a>
  166. <template #overlay>
  167. <a-menu>
  168. <a-menu-item>
  169. <a @click="detailRef.onOpen(record)">详情</a>
  170. </a-menu-item>
  171. <a-menu-item v-if="hasPerm('bizAppointmentAudit') && (record.status == '1')">
  172. <a style="color: #ffaa00" @click="reviewRef.showModal(record.id)">审核</a>
  173. </a-menu-item>
  174. <a-menu-item v-if="hasPerm('bizAppointmentRecordEdit') && (record.status == '2')">
  175. <a style="color:blue" @click="formRef.onOpen(record)" >编辑</a>
  176. </a-menu-item>
  177. <a-menu-item v-if="hasPerm('bizAppointmentRecordDelete') && (record.status == '2' || record.status == '4')">
  178. <a style="color:red" type="link" danger size="small" @click="deleteConfig(record)">删除</a>
  179. </a-menu-item>
  180. <a-menu-item v-if="hasPerm('bizAppointmentDriverConfim') && record.status == '8'">
  181. <a @click="XnSignNameRef.show(record.recordId)" >确认</a>
  182. </a-menu-item>
  183. <a-menu-item v-if="hasPerm('bizAppointmentDriverSign') && record.status=='10' && record.orderType=='1'">
  184. <a @click="signRef.onOpen(record)" >回签</a>
  185. </a-menu-item>
  186. <a-menu-item v-if="record.status=='4'">
  187. <a style="color:green" @click="cancel(record)" >取消</a>
  188. </a-menu-item>
  189. <a-menu-item v-if="hasPerm('bizAppointmentDriverExit') && (record.status=='5' || record.status=='6' || record.status=='7' || record.status=='8')">
  190. <a style="color:orange" @click="exit(record)" >授权出场</a>
  191. </a-menu-item>
  192. </a-menu>
  193. </template>
  194. </a-dropdown>
  195. </a-space>
  196. </template>
  197. </template>
  198. </s-table>
  199. </a-card>
  200. <Form ref="formRef" @successful="tableRef.refresh()" />
  201. <Review ref="reviewRef" @successful="tableRef.refresh(true)" />
  202. <Detail ref="detailRef" @successful="tableRef.refresh()" />
  203. <Sign ref="signRef" @successful="tableRef.refresh(true)" />
  204. <XnSignName ref="XnSignNameRef" :image="searchFormState.driverSign" @successful="signSuccess" />
  205. <a-modal v-model:visible="open" title="二维码" width="600px" style="height: 700px">
  206. <div id="qrcode" style="text-align: center; margin: 15px 5px 15px 5px">
  207. <a-row>
  208. <a-col :span="13" id="colFlag">
  209. <div style="margin-top:10px;font-size:16px;">
  210. <!-- <p id="projectNameFlag">订单名称:{{nowRecord.orderName}}</p>-->
  211. <p id="projectCodeFlag">订单编码:{{ nowRecord.orderNumber }}</p>
  212. <p id="projectCodeFlag">客户名称:{{ nowRecord.customerName }}</p>
  213. <p id="projectCodeFlag">货品名称:{{ nowRecord.goodsName }}</p>
  214. <p id="projectCodeFlag">司机姓名:{{ nowRecord.driverName }}</p>
  215. <p id="projectCodeFlag">预约状态:{{ $TOOL.dictTypeData('appointment_status', nowRecord.status) }}</p>
  216. </div>
  217. </a-col>
  218. <a-col :span="11">
  219. <a-image width="250" height="100%" :src="qrCodeUrl.codeUrl"></a-image>
  220. </a-col>
  221. </a-row>
  222. </div>
  223. <template #footer>
  224. <a-button @click="closeQrCode">关闭</a-button>
  225. <a-button type="primary" @click="downloadFile">下载</a-button>
  226. </template>
  227. </a-modal>
  228. </template>
  229. <script setup name="bizappointmentrecord">
  230. import { cloneDeep } from 'lodash-es'
  231. import Form from './form.vue'
  232. import Detail from './detail.vue'
  233. import bizAppointmentRecordApi from '@/api/biz/bizAppointmentRecordApi'
  234. import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
  235. import {Modal} from 'ant-design-vue';
  236. import {createVNode} from 'vue';
  237. import Review from './review.vue'
  238. import tool from '@/utils/tool'
  239. import QRCode from 'qrcode'
  240. import html2canvas from 'html2canvas'
  241. import downloadUtil from '@/utils/downloadUtil'
  242. import bizRecordApi from '@/api/biz/bizRecordApi'
  243. import Sign from './sign.vue'
  244. import bizOrderApi from "@/api/biz/bizOrderApi";
  245. const submitLoading = ref(false)
  246. const tableRef = ref()
  247. const signRef = ref()
  248. const formRef = ref()
  249. const reviewRef = ref()
  250. const detailRef = ref()
  251. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  252. const nowRecord = ref()
  253. const XnSignNameRef = ref()
  254. //查询数据
  255. const searchFormState = ref({})
  256. const searchFormRef = ref()
  257. const statusList = tool.dictList('appointment_status')
  258. // 查询区域显示更多控制
  259. const advanced = ref(false)
  260. const toggleAdvanced = () => {
  261. advanced.value = !advanced.value
  262. }
  263. const columns = [
  264. /*{
  265. title: '订单信息',
  266. dataIndex: 'orderInfo',
  267. width:200
  268. },*/
  269. {
  270. title: '订单编号',
  271. dataIndex: 'orderNumber',
  272. align:'center',
  273. width:150
  274. },
  275. {
  276. title: '车牌号',
  277. dataIndex: 'licenseNumber',
  278. width:150,
  279. align: 'center'
  280. },
  281. {
  282. title: '提货时间',
  283. dataIndex: 'timeInfo',
  284. align:'center',
  285. width:200
  286. },
  287. {
  288. title: '客户名称',
  289. dataIndex: 'customerInfo',
  290. align:'center',
  291. width:180
  292. },
  293. {
  294. title: '货品信息',
  295. dataIndex: 'goodsInfo',
  296. width:160
  297. },
  298. {
  299. title: '司机信息',
  300. dataIndex: 'driverInfo',
  301. width: 160
  302. },
  303. {
  304. title: '车辆轴数',
  305. dataIndex: 'axleNumber',
  306. width: 110,
  307. align:'center'
  308. },
  309. {
  310. title: '状态',
  311. dataIndex: 'status',
  312. align: 'center',
  313. width:130
  314. },
  315. ]
  316. // 操作栏通过权限判断是否显示
  317. columns.push({
  318. title: '操作',
  319. dataIndex: 'action',
  320. align: 'center',
  321. width: 150,
  322. })
  323. const selectedRowKeys = ref([])
  324. // 列表选择配置
  325. const options = {
  326. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  327. alert: {
  328. show: true,
  329. clear: () => {
  330. selectedRowKeys.value = ref([])
  331. }
  332. },
  333. rowSelection: {
  334. onChange: (selectedRowKey, selectedRows) => {
  335. selectedRowKeys.value = selectedRowKey
  336. }
  337. }
  338. }
  339. const loadData = (parameter) => {
  340. const searchFormParam = cloneDeep(searchFormState.value)
  341. searchFormParam.type = '1'
  342. return bizAppointmentRecordApi.bizAppointmentRecordPage(Object.assign(parameter, searchFormParam)).then((data) => {
  343. return data
  344. })
  345. }
  346. // 重置
  347. const reset = () => {
  348. searchFormRef.value.resetFields()
  349. tableRef.value.refresh(true)
  350. }
  351. // 删除
  352. const deleteBizAppointmentRecord = (record) => {
  353. let params = [
  354. {
  355. id: record.id
  356. }
  357. ]
  358. bizAppointmentRecordApi.bizAppointmentRecordDelete(params).then(() => {
  359. tableRef.value.refresh(true)
  360. })
  361. }
  362. // 删除
  363. const deleteConfig = (record) => {
  364. Modal.confirm({
  365. title: '确定删除该数据吗?',
  366. icon: createVNode(ExclamationCircleOutlined),
  367. content: '',
  368. onOk() {
  369. submitLoading.value = true
  370. let params = [
  371. {
  372. id: record.id
  373. }
  374. ]
  375. bizAppointmentRecordApi
  376. .bizAppointmentRecordDelete(params)
  377. .then(() => {
  378. tableRef.value.refresh(true)
  379. })
  380. .finally(() => {
  381. submitLoading.value = false
  382. })
  383. },
  384. onCancel() {}
  385. })
  386. }
  387. //取消预约
  388. const cancel = (record) => {
  389. Modal.confirm({
  390. title: '确定要取消吗?',
  391. icon: createVNode(ExclamationCircleOutlined),
  392. content: '',
  393. onOk() {
  394. submitLoading.value = true
  395. let params =
  396. {
  397. id: record.id
  398. }
  399. bizAppointmentRecordApi
  400. .bizAppointmentCancel(params)
  401. .then(() => {
  402. tableRef.value.refresh(true)
  403. })
  404. .finally(() => {
  405. submitLoading.value = false
  406. })
  407. },
  408. onCancel() {}
  409. })
  410. }
  411. //授权出场
  412. const exit = (record) => {
  413. Modal.confirm({
  414. title: '确定要授权出场吗?',
  415. icon: createVNode(ExclamationCircleOutlined),
  416. content: '',
  417. onOk() {
  418. submitLoading.value = true
  419. let params =
  420. {
  421. id: record.id
  422. }
  423. bizAppointmentRecordApi
  424. .bizAppointmentExit(params)
  425. .then(() => {
  426. tableRef.value.refresh(true)
  427. })
  428. .finally(() => {
  429. submitLoading.value = false
  430. })
  431. },
  432. onCancel() {}
  433. })
  434. }
  435. // 批量删除
  436. const deleteBatchBizAppointmentRecord = (params) => {
  437. bizAppointmentRecordApi.bizAppointmentRecordDelete(params).then(() => {
  438. tableRef.value.clearRefreshSelected()
  439. })
  440. }
  441. //二维码
  442. const open = ref(false);
  443. const qrCodeUrl = ref({})
  444. const showModal = (record) => {
  445. nowRecord.value = record
  446. open.value = true;
  447. getQrCode(record)
  448. };
  449. const getQrCode = (record) => {
  450. //QRCode.toDataURL("id:"+record.id+"saleCode:"+record.saleCode, {
  451. let param = {
  452. id:record.id,
  453. licenseNumber:record.licenseNumber
  454. }
  455. QRCode.toDataURL(JSON.stringify(param), {
  456. errorCorrectionLevel: 'H',
  457. margin: 1,
  458. height: 206,
  459. width: 206,
  460. type: '10',
  461. scal: 177,
  462. color: {
  463. dark: '#000' // 二维码背景颜色
  464. },
  465. rendererOpts: {
  466. quality: 0.9
  467. }
  468. })
  469. .then((url) => {
  470. qrCodeUrl.value.codeUrl = url
  471. })
  472. .catch((err) => {
  473. console.error(err)
  474. })
  475. }
  476. const closeQrCode = () => {
  477. open.value = false;
  478. }
  479. // 下载二维码
  480. const downloadFile = () => {
  481. const qrcodeDiv = document.getElementById('qrcode');
  482. html2canvas(qrcodeDiv, {
  483. logging: false,
  484. allowTaint: true,
  485. scale: window.devicePixelRatio,
  486. scrollY: 0,
  487. scrollX: 0,
  488. useCORS: true,
  489. backgroundColor: '#ffffff'
  490. })
  491. .then(function (canvas) {
  492. const a = window.document.createElement('a')
  493. a.href = canvas.toDataURL('image/png')
  494. a.download = '二维码'
  495. a.click()
  496. this.$message.success('正在进行下载保存')
  497. })
  498. .catch((err) => {
  499. console.log(err)
  500. })
  501. }
  502. //导出
  503. const exportTotal = () => {
  504. /*const searchFormParam = cloneDeep(searchFormState.value)
  505. bizAppointmentRecordApi.exportRecord(Object.assign(searchFormParam)).then((res)=>{
  506. downloadUtil.resultDownload(res)
  507. })*/
  508. Modal.confirm({
  509. title: '确定要导出记录吗?',
  510. icon: createVNode(ExclamationCircleOutlined),
  511. content: '',
  512. onOk() {
  513. submitLoading.value = true
  514. const searchFormParam = cloneDeep(searchFormState.value)
  515. bizAppointmentRecordApi
  516. .exportRecord(Object.assign(searchFormParam))
  517. .then((res) => {
  518. downloadUtil.resultDownload(res)
  519. })
  520. .finally(() => {
  521. submitLoading.value = false
  522. })
  523. },
  524. onCancel() {}
  525. })
  526. }
  527. // 签名板组件回调
  528. const signSuccess = (value) => {
  529. const param = {
  530. id:value.id,
  531. driverSign: value.value
  532. }
  533. bizRecordApi.updateDriverSign(param).then(() => {
  534. tableRef.value.refresh(true)
  535. })
  536. }
  537. </script>
  538. <style lang="less" scoped>
  539. /** 表头居中 */
  540. :deep .ant-table-thead > tr > th {
  541. text-align: center;
  542. }
  543. .time-list {
  544. -webkit-text-size-adjust: none;
  545. font-size: 13px;
  546. display: flex;
  547. flex-direction: column;
  548. p {
  549. white-space: nowrap;
  550. span {
  551. display: inline-block;
  552. font-weight: 600;
  553. height: 16px;
  554. line-height: 16px;
  555. border-radius: 5px;
  556. text-align: center;
  557. margin-right: 2px;
  558. padding: 0 5px;
  559. }
  560. .blueTag {
  561. color: #1890ff;
  562. background: rgba(24, 144, 255, 0.1);
  563. }
  564. .orangeTag {
  565. color: #ff7c18;
  566. background: rgba(24, 144, 255, 0.1);
  567. }
  568. .greenTag {
  569. color: rgb(82, 196, 26);
  570. background: rgba(82, 196, 26, 0.1);
  571. }
  572. .purpleTag {
  573. color: rgb(77, 26, 196);
  574. background: rgba(82, 196, 26, 0.1);
  575. }
  576. .showNum {
  577. display: inline-block;
  578. height: 16px;
  579. line-height: 16px;
  580. width: 45px;
  581. border-radius: 5px;
  582. text-align: center;
  583. margin-right: 2px;
  584. text-align: right;
  585. }
  586. }
  587. }
  588. </style>