index.vue 13 KB

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