index.vue 17 KB

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