orderplan.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <a-card>
  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="orderName">
  7. <a-input v-model:value="searchFormState.orderName" placeholder="订单名称查询" />
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item label="订单编号" name="orderNumber">
  12. <a-input v-model:value="searchFormState.orderNumber" placeholder="订单编号查询" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="客户名称" name="customerName">
  17. <a-input v-model:value="searchFormState.customerName" placeholder="客户名称查询" />
  18. </a-form-item>
  19. </a-col>
  20. <a-col :span="6">
  21. <a-button type="primary" @click="query()">查询</a-button>
  22. <a-button style="margin: 0 8px" @click="reset">重置</a-button>
  23. <a-button type="dashed" class="snowy-buttom-left" @click="exportData()"><export-outlined />导出</a-button>
  24. <!-- <a @click="toggleAdvanced" style="margin-left: 8px">
  25. {{ advanced ? '收起' : '展开' }}
  26. <component :is="advanced ? 'up-outlined' : 'down-outlined'" />
  27. </a>-->
  28. </a-col>
  29. </a-row>
  30. </a-form>
  31. </a-card>
  32. <a-card style="margin-top: 5px">
  33. <a-table
  34. ref="tableRef"
  35. :columns="columns"
  36. :data-source="companyData"
  37. bordered
  38. :row-key="(record) => record.id"
  39. :rowClassName="rowClassName"
  40. >
  41. <!-- :pagination="false" -->
  42. <template #bodyCell="{ column, record, index }">
  43. <template v-if="column.dataIndex === 'serial'">
  44. {{ index + 1 }}
  45. </template>
  46. <!-- <template v-if="column.dataIndex === 'actualWeight'">
  47. <span v-if="record.actualWeight>record.netWeight" style="color:red">{{ record.actualWeight}}</span>
  48. <span v-else>{{ record.actualWeight}}</span>
  49. </template>-->
  50. </template>
  51. </a-table>
  52. </a-card>
  53. </template>
  54. <script setup name="receiptcount">
  55. import { Modal } from 'ant-design-vue'
  56. import { ref, onMounted } from 'vue'
  57. import { cloneDeep } from 'lodash-es'
  58. import bizRecordApi from '@/api/biz/bizRecordApi'
  59. import downloadUtil from '@/utils/downloadUtil'
  60. import bizOrderApi from "@/api/biz/bizOrderApi";
  61. const searchFormRef = ref()
  62. const searchFormState = ref({
  63. times: [],
  64. licensePlate: '',
  65. goodsName: '',
  66. receiptCompany: ''
  67. })
  68. onMounted(() => {
  69. loadData()
  70. })
  71. // 查询区域显示更多控制
  72. const advanced = ref(false)
  73. const toggleAdvanced = () => {
  74. advanced.value = !advanced.value
  75. }
  76. // 重置
  77. const reset = () => {
  78. searchFormRef.value.resetFields()
  79. }
  80. //表格相关
  81. const columns = [
  82. {
  83. title: '序号',
  84. width: 80,
  85. dataIndex: 'serial',
  86. align:'center'
  87. },
  88. {
  89. title: '订单名称',
  90. dataIndex: 'orderName',
  91. align:'center'
  92. },
  93. {
  94. title: '订单编号',
  95. dataIndex: 'orderNumber',
  96. align:'center'
  97. },
  98. {
  99. title: '客户名称',
  100. dataIndex: 'customerName',
  101. align:'center'
  102. },
  103. {
  104. title: '订单重量(吨)',
  105. dataIndex: 'orderWeight',
  106. align:'center'
  107. },
  108. {
  109. title: '过磅重量(吨)',
  110. dataIndex: 'netWeight',
  111. align:'center'
  112. },
  113. {
  114. title: '卸货重量(吨)',
  115. dataIndex: 'shippingWeight',
  116. align:'center'
  117. },
  118. {
  119. title: '实际拖运重量(吨)',
  120. dataIndex: 'actualWeight',
  121. align:'center'
  122. },
  123. ]
  124. const companyData = ref([])
  125. const loadData = () => {
  126. const searchFormParam = cloneDeep(searchFormState.value)
  127. bizOrderApi.getOrderTotal(searchFormParam).then((data) => {
  128. companyData.value = data.records
  129. })
  130. }
  131. // 根据条件设置行的类名
  132. const rowClassName = (record, index) => {
  133. // 如果 status 为 'inactive',则标红
  134. console.log("record:"+JSON.stringify(record))
  135. return record.actualWeight > record.netWeight ? 'highlight' : '';
  136. };
  137. const query = () => {
  138. loadData()
  139. }
  140. // 导出
  141. const exportData = () => {
  142. const searchFormParam = cloneDeep(searchFormState.value)
  143. Modal.confirm({
  144. title: '提示',
  145. content: '确定要导出订单计划统计记录吗?',
  146. maskClosable: true,
  147. onOk: () => {
  148. bizOrderApi.exportRecordTotal(searchFormParam).then((res) => {
  149. downloadUtil.resultDownload(res)
  150. })
  151. }
  152. })
  153. }
  154. </script>
  155. <style>
  156. /*.highlight {
  157. animation: blink 2s infinite;
  158. }
  159. @keyframes blink {
  160. 0%, 100% { background-color: transparent; }
  161. 50% { background-color: red; }
  162. }*/
  163. .highlight {
  164. background-color: red; /* 设置背景色为红色 */
  165. /*color: white;*/ /* 可选:设置文字颜色为白色,以便更好地显示 */
  166. }
  167. </style>