index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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="carNumber">
  7. <a-input v-model:value="searchFormState.carNumber" placeholder="请输入车次编码" />
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item label="车牌号码" name="licensePlate">
  12. <a-input v-model:value="searchFormState.licensePlate" placeholder="请输入车牌号码" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="过毛时间" name="grossTime">
  17. <a-range-picker
  18. v-model:value="searchFormState.grossTime"
  19. value-format="YYYY-MM-DD"
  20. />
  21. </a-form-item>
  22. </a-col>
  23. <a-col :span="6" v-show="advanced">
  24. <a-form-item label="司机姓名" name="driverName">
  25. <a-input v-model:value="searchFormState.driverName" placeholder="请输入司机姓名" />
  26. </a-form-item>
  27. </a-col>
  28. <a-col :span="6" v-show="advanced">
  29. <a-form-item label="司机电话" name="driverMobile">
  30. <a-input v-model:value="searchFormState.driverMobile" placeholder="请输入司机电话" />
  31. </a-form-item>
  32. </a-col>
  33. <a-col :span="6" v-show="advanced">
  34. <a-form-item label="货品名称" name="goodsName">
  35. <a-input v-model:value="searchFormState.goodsName" placeholder="请输入货品名称" />
  36. </a-form-item>
  37. </a-col>
  38. <a-col :span="6" v-show="advanced">
  39. <a-form-item label="规格型号" name="goodsModel">
  40. <a-input v-model:value="searchFormState.goodsModel" placeholder="请输入规格型号" />
  41. </a-form-item>
  42. </a-col>
  43. <!-- <a-col :span="6" v-show="advanced">
  44. <a-form-item label="收货单位" name="receiptCompany">
  45. <a-input v-model:value="searchFormState.receiptCompany" placeholder="请输入收货单位" />
  46. </a-form-item>
  47. </a-col>
  48. <a-col :span="6" v-show="advanced">
  49. <a-form-item label="发货单位" name="shippingCompany">
  50. <a-input v-model:value="searchFormState.shippingCompany" placeholder="请输入发货单位" />
  51. </a-form-item>
  52. </a-col>
  53. <a-col :span="6" v-show="advanced">
  54. <a-form-item label="运输单位" name="transportCompany">
  55. <a-input v-model:value="searchFormState.transportCompany" placeholder="请输入运输单位" />
  56. </a-form-item>
  57. </a-col>-->
  58. <a-col :span="6" v-show="advanced">
  59. <a-form-item label="订单编号" name="orderNumber">
  60. <a-input v-model:value="searchFormState.orderNumber" placeholder="请输入订单编号" />
  61. </a-form-item>
  62. </a-col>
  63. <!-- <a-col :span="6" v-show="advanced">
  64. <a-form-item label="订单名称" name="orderName">
  65. <a-input v-model:value="searchFormState.orderName" placeholder="请输入订单名称" />
  66. </a-form-item>
  67. </a-col>-->
  68. <a-col :span="6" v-show="advanced">
  69. <a-form-item label="客户名称" name="customerName">
  70. <a-input v-model:value="searchFormState.customerName" placeholder="请输入客户名称" />
  71. </a-form-item>
  72. </a-col>
  73. <a-col :span="6" v-show="advanced">
  74. <a-form-item label="确认状态" name="sendRecordStatus">
  75. <a-select v-model:value="searchFormState.sendRecordStatus" placeholder="确认状态查询"
  76. :options="sendRecordStatusList"
  77. > </a-select>
  78. </a-form-item>
  79. </a-col>
  80. <a-col :span="6">
  81. <a-button type="primary" @click="tableRef.refresh()">查询</a-button>
  82. <a-button style="margin: 0 8px" @click="reset">重置</a-button>
  83. <a @click="toggleAdvanced" style="margin-left: 8px">
  84. {{ advanced ? '收起' : '展开' }}
  85. <component :is="advanced ? 'up-outlined' : 'down-outlined'" />
  86. </a>
  87. </a-col>
  88. </a-row>
  89. </a-form>
  90. </a-card>
  91. <a-card :bordered="false">
  92. <s-table
  93. ref="tableRef"
  94. :columns="columns"
  95. :data="loadData"
  96. bordered
  97. :row-key="(record) => record.id"
  98. >
  99. <template #operator class="table-operator">
  100. <!-- <a-space>
  101. <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizRecordToConfirm')">
  102. 待确认
  103. </a-button>
  104. <a-button style="background-color: orange;" type="primary" @click="formRef.onOpen()" v-if="hasPerm('bizRecordAlreadyConfirm')">
  105. 已确认
  106. </a-button>
  107. </a-space>-->
  108. </template>
  109. <template #bodyCell="{ column, record }">
  110. <template v-if="column.dataIndex === 'licensePlate'">
  111. <span v-if="record.plateColor === '蓝色'" class="blue-background">{{ record.licensePlate }}</span>
  112. <span v-else-if="record.plateColor === '黄色'" class="yellow-background">{{ record.licensePlate }}</span>
  113. <span v-else-if="record.plateColor === '绿色'" class="green-background">{{ record.licensePlate }}</span>
  114. <span v-else-if="record.plateColor === '白色'" class="white-background">{{ record.licensePlate }}</span>
  115. <span v-else-if="record.plateColor === '黑色'" class="black-background">{{ record.licensePlate }}</span>
  116. <span v-else class="blue-background">{{ record.licensePlate }}</span>
  117. </template>
  118. <template v-if="column.dataIndex === 'enterTime'">
  119. <div class="time-list">
  120. <p>
  121. <span class="blueTag">过毛</span>
  122. <span style="font-weight: normal">{{ record.grossTime }}</span>
  123. </p>
  124. <p style="margin-bottom: 0">
  125. <span class="orangeTag">过皮</span>
  126. <span style="font-weight: normal">{{ record.tareTime }}</span>
  127. </p>
  128. </div>
  129. </template>
  130. <template v-if="column.dataIndex === 'weight'">
  131. <div class="time-list">
  132. <p>
  133. <span class="blueTag">毛重</span>
  134. <span class="showNum">{{ record.grossWeight }} </span>
  135. </p>
  136. <p>
  137. <span class="orangeTag">皮重</span>
  138. <span class="showNum">{{ record.tareWeight }}</span>
  139. </p>
  140. <p>
  141. <span class="greenTag">净重</span>
  142. <span class="showNum">{{ record.netWeight }}</span>
  143. </p>
  144. </div>
  145. </template>
  146. <template v-if="column.dataIndex === 'company'">
  147. <div class="company-list">
  148. <p>收货:{{ record.receiptCompany }}</p>
  149. <p>发货:{{ record.shippingCompany }}</p>
  150. <p style="margin-bottom: 0">运输:{{ record.transportCompany }}</p>
  151. </div>
  152. </template>
  153. <template v-if="column.dataIndex === 'goods'">
  154. <div class="time-list">
  155. <p>名称:{{ record.goodsName }}</p>
  156. <p style="margin-bottom: 0">编码:{{ record.goodsModel }}</p>
  157. </div>
  158. </template>
  159. <template v-if="column.dataIndex === 'driver'">
  160. <div class="time-list">
  161. <p>姓名:{{ record.driverName }}</p>
  162. <p style="margin-bottom: 0">电话:{{ record.driverMobile }}</p>
  163. </div>
  164. </template>
  165. <template v-if="column.dataIndex === 'orderInfo'">
  166. <div class="time-list">
  167. <p>名称:{{ record.orderName }}</p>
  168. <p style="margin-bottom: 0">编号:{{ record.orderNumber }}</p>
  169. </div>
  170. </template>
  171. <template v-if="column.dataIndex === 'action'">
  172. <a-space>
  173. <a @click="detailRef.onOpen(record)">详情</a>
  174. <a-divider type="vertical" v-if="hasPerm('bizRecordConfirm') && record.status=='6' " />
  175. <a @click="confirmRecord(record)" v-if="hasPerm('bizRecordConfirm') && record.status=='6' ">确认</a>
  176. </a-space>
  177. </template>
  178. </template>
  179. </s-table>
  180. </a-card>
  181. <Form ref="formRef" @successful="tableRef.refresh()" />
  182. <Detail ref="detailRef" />
  183. </template>
  184. <script setup name="record">
  185. import { message, Modal } from 'ant-design-vue'
  186. import { cloneDeep } from 'lodash-es'
  187. import Form from './form.vue'
  188. import Detail from './detail.vue'
  189. import bizRecordApi from '@/api/biz/bizRecordApi'
  190. import downloadUtil from '@/utils/downloadUtil'
  191. import {createVNode} from "vue";
  192. import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
  193. import bizAppointmentRecordApi from "@/api/biz/bizAppointmentRecordApi";
  194. import tool from '@/utils/tool'
  195. const searchFormState = ref({isFlag:1})
  196. const searchFormRef = ref()
  197. const tableRef = ref()
  198. const formRef = ref()
  199. const detailRef = ref()
  200. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  201. // 查询区域显示更多控制
  202. const advanced = ref(false)
  203. const submitLoading = ref(false)
  204. const sendRecordStatusList = tool.dictList('send_record_status')
  205. const toggleAdvanced = () => {
  206. advanced.value = !advanced.value
  207. }
  208. const columns = [
  209. {
  210. title: '车次编码',
  211. dataIndex: 'carNumber',
  212. width: 120,
  213. align: 'center'
  214. },
  215. {
  216. title: '车牌号码',
  217. dataIndex: 'licensePlate',
  218. width: '130px',
  219. align: 'center'
  220. },
  221. {
  222. title: '过车时间',
  223. dataIndex: 'enterTime',
  224. width: '130px'
  225. },
  226. {
  227. title: '重量(吨)',
  228. dataIndex: 'weight',
  229. align: 'center'
  230. },
  231. /*{
  232. title: '订单信息',
  233. dataIndex: 'orderInfo'
  234. },*/
  235. {
  236. title: '订单编号',
  237. dataIndex: 'orderNumber',
  238. align:'center'
  239. },
  240. {
  241. title: '客户名称',
  242. dataIndex: 'customerName',
  243. align:'center'
  244. },
  245. {
  246. title: '货品',
  247. dataIndex: 'goods'
  248. },
  249. {
  250. title: '司机信息',
  251. dataIndex: 'driver',
  252. width: '150px'
  253. }
  254. ]
  255. // 操作栏通过权限判断是否显示
  256. columns.push({
  257. title: '操作',
  258. dataIndex: 'action',
  259. align: 'center',
  260. width: 150
  261. })
  262. const loadData = (parameter) => {
  263. const searchFormParam = cloneDeep(searchFormState.value)
  264. // grossTime范围查询条件重载
  265. if (searchFormParam.grossTime) {
  266. searchFormParam.startGrossTime = searchFormParam.grossTime[0]
  267. searchFormParam.endGrossTime = searchFormParam.grossTime[1]
  268. delete searchFormParam.grossTime
  269. }
  270. // tareTime范围查询条件重载
  271. if (searchFormParam.tareTime) {
  272. searchFormParam.startTareTime = searchFormParam.tareTime[0]
  273. searchFormParam.endTareTime = searchFormParam.tareTime[1]
  274. delete searchFormParam.tareTime
  275. }
  276. return bizRecordApi.bizRecordPage(Object.assign(parameter, searchFormParam)).then((data) => {
  277. return data
  278. })
  279. }
  280. const dateRangeOnChange = (date, dateString) => {
  281. searchFormState.startGrossTime = dateString[0]
  282. searchFormState.endGrossTime = dateString[1]
  283. }
  284. const dateRangeOnChangeTare = (date, dateString) => {
  285. searchFormState.startTareTime = dateString[0]
  286. searchFormState.endTareTime = dateString[1]
  287. }
  288. // 重置
  289. const reset = () => {
  290. searchFormRef.value.resetFields()
  291. searchFormState.startGrossTime = null
  292. searchFormState.endGrossTime = null
  293. searchFormState.startTareTime = null
  294. searchFormState.endTareTime = null
  295. tableRef.value.refresh(true)
  296. }
  297. const exportData = () => {
  298. const paramData = {
  299. licensePlate: searchFormState.value.licensePlate,
  300. carNumber: searchFormState.value.carNumber,
  301. goodsName: searchFormState.value.goodsName,
  302. goodsModel: searchFormState.value.goodsModel,
  303. receiptCompany: searchFormState.value.receiptCompany,
  304. shippingCompany: searchFormState.value.shippingCompany,
  305. transportCompany: searchFormState.value.transportCompany,
  306. driverName: searchFormState.value.driverName,
  307. driverMobile: searchFormState.value.driverMobile,
  308. startGrossTime: searchFormState.startGrossTime,
  309. endGrossTime: searchFormState.endGrossTime,
  310. startTareTime: searchFormState.startTareTime,
  311. endTareTime: searchFormState.endTareTime
  312. }
  313. Modal.confirm({
  314. title: '提示',
  315. content: '确定要导出过磅记录?',
  316. maskClosable: true,
  317. onOk: () => {
  318. bizRecordApi.bizRecordExport(paramData).then((res) => {
  319. downloadUtil.resultDownload(res)
  320. tableRef.value.clearSelected()
  321. })
  322. }
  323. })
  324. }
  325. //确认
  326. const confirmRecord = (record) => {
  327. Modal.confirm({
  328. title: '提示',
  329. content: '确定完成发货吗?',
  330. onOk() {
  331. submitLoading.value = true
  332. let params =
  333. {
  334. id: record.id
  335. }
  336. bizRecordApi
  337. .confirmRecord(params)
  338. .then(() => {
  339. tableRef.value.refresh(true)
  340. })
  341. .finally(() => {
  342. submitLoading.value = false
  343. })
  344. },
  345. onCancel() {}
  346. })
  347. }
  348. </script>
  349. <style lang="less" scoped>
  350. /** 表头居中 */
  351. :deep .ant-table-thead > tr > th {
  352. text-align: center;
  353. }
  354. .time-list {
  355. -webkit-text-size-adjust: none;
  356. font-size: 13px;
  357. display: flex;
  358. flex-direction: column;
  359. p {
  360. white-space: nowrap;
  361. span {
  362. display: inline-block;
  363. font-weight: 600;
  364. height: 16px;
  365. line-height: 16px;
  366. border-radius: 5px;
  367. text-align: center;
  368. margin-right: 2px;
  369. padding: 0 5px;
  370. }
  371. .blueTag {
  372. color: #1890ff;
  373. background: rgba(24, 144, 255, 0.1);
  374. }
  375. .orangeTag {
  376. color: #ff7c18;
  377. background: rgba(24, 144, 255, 0.1);
  378. }
  379. .greenTag {
  380. color: rgb(82, 196, 26);
  381. background: rgba(82, 196, 26, 0.1);
  382. }
  383. .purpleTag {
  384. color: rgb(77, 26, 196);
  385. background: rgba(82, 196, 26, 0.1);
  386. }
  387. .showNum {
  388. display: inline-block;
  389. height: 16px;
  390. line-height: 16px;
  391. width: 45px;
  392. border-radius: 5px;
  393. text-align: center;
  394. margin-right: 2px;
  395. text-align: right;
  396. }
  397. }
  398. }
  399. .order-list,
  400. .company-list {
  401. -webkit-text-size-adjust: none;
  402. font-size: 13px;
  403. display: flex;
  404. flex-direction: column;
  405. p {
  406. white-space: nowrap;
  407. margin-bottom: 5px;
  408. .weightSpan,
  409. .company {
  410. display: inline-block;
  411. width: 17px;
  412. height: 17px;
  413. line-height: 16px;
  414. border-radius: 50%;
  415. color: #fff;
  416. text-align: center;
  417. }
  418. .company {
  419. margin-right: 5px;
  420. }
  421. .weight,
  422. .receiptCompany {
  423. background-color: #1890ff;
  424. }
  425. .tare {
  426. background-color: #2f54eb;
  427. }
  428. .netWeight,
  429. .shippingCompany {
  430. background-color: #52c41a;
  431. }
  432. .transportCompany {
  433. background-color: #c61263;
  434. }
  435. .showNum {
  436. display: inline-block;
  437. height: 16px;
  438. line-height: 16px;
  439. width: 45px;
  440. border-radius: 5px;
  441. text-align: center;
  442. margin-right: 2px;
  443. text-align: right;
  444. }
  445. em {
  446. font-style: normal;
  447. }
  448. }
  449. }
  450. .blue-background {
  451. background-color: #0d84ff;
  452. border-radius: 5px; /* 你可以根据需要调整圆角的大小 */
  453. padding: 5px; /* 可选:添加一些内边距 */
  454. color: white; /* 可选:设置文字颜色 */
  455. font-size: large;
  456. }
  457. .yellow-background {
  458. background-color: yellow;
  459. border-radius: 5px;
  460. padding: 5px;
  461. color: black;
  462. font-size: large;
  463. }
  464. .green-background {
  465. background: linear-gradient(to bottom, white, #39b54a);
  466. border-radius: 5px;
  467. padding: 5px;
  468. color: black; /* 文字颜色改为黑色以便在渐变背景上更清晰 */
  469. font-size: large;
  470. border: 1px solid #ccc; /* 增加边框 */
  471. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 增加阴影 */
  472. }
  473. .white-background {
  474. background-color: white;
  475. border-radius: 5px;
  476. padding: 5px;
  477. color: black;
  478. font-size: large;
  479. border: 1px solid #ccc; /* 增加边框 */
  480. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 增加阴影 */
  481. }
  482. .black-background {
  483. background-color: black;
  484. border-radius: 5px;
  485. padding: 5px;
  486. color: white;
  487. font-size: large;
  488. }
  489. </style>