index.vue 14 KB

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