index.vue 14 KB

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