index.vue 15 KB

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