index.vue 14 KB

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