orderDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. //钢材统计报表
  2. <template>
  3. <div class="purchasFuelNewMonitor">
  4. <div class="tableTop">
  5. <el-form :inline="true" style="margin-top :5px">
  6. <el-form-item>
  7. <span>车牌号</span>
  8. <el-input
  9. style="width:200px"
  10. v-model="input"
  11. placeholder="请输入查询条件"
  12. clearable
  13. ></el-input>
  14. </el-form-item>
  15. <el-form-item>
  16. <label class="el-form-item__label" style="width: auto;"
  17. >订单时间:</label
  18. >
  19. <el-date-picker
  20. v-model="startTime"
  21. type="datetime"
  22. placeholder="选择日期时间"
  23. style="width:200px"
  24. >
  25. </el-date-picker>
  26. <span>至</span>
  27. <el-date-picker
  28. v-model="endTime"
  29. type="datetime"
  30. placeholder="选择日期时间"
  31. style="width:200px"
  32. >
  33. </el-date-picker>
  34. <el-button type="primary" class="btn" @click="onclick">
  35. <i class="el-icon-search"></i>
  36. </el-button>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-button type="primary" @click="refresh">
  40. <i class="el-icon-refresh"></i>
  41. </el-button>
  42. </el-form-item>
  43. </el-form>
  44. </div>
  45. <div class="table">
  46. <el-table
  47. :data="tableData"
  48. :span-method="objectSpanMethod"
  49. ref="tableRef"
  50. border
  51. stripe
  52. style="width: 100%; margin-top: 20px"
  53. max-height="800px"
  54. @cell-click="cellClik"
  55. :row-style="{ height: '30px' }"
  56. :cell-style="{ fontWeight: '700' }"
  57. >
  58. <el-table-column
  59. width="50"
  60. label="序号"
  61. align="center"
  62. fixed="left"
  63. :resizable="false"
  64. >
  65. <template slot-scope="scope">{{ scope.row.group + 1 }}</template>
  66. </el-table-column>
  67. <el-table-column
  68. prop="capacityNumber"
  69. column-key="capacityNo"
  70. label="车牌号"
  71. align="center"
  72. width="250px"
  73. fixed
  74. >
  75. </el-table-column>
  76. <el-table-column
  77. prop="materialName"
  78. label="物资名称"
  79. align="center"
  80. width="150px"
  81. >
  82. </el-table-column>
  83. <el-table-column
  84. prop="specificationModel"
  85. label="物资规格"
  86. align="center"
  87. >
  88. </el-table-column>
  89. <el-table-column
  90. prop="materialNumber"
  91. label="物资件数"
  92. align="center"
  93. width="200px"
  94. >
  95. <template slot-scope="scope">
  96. <button
  97. type="primary"
  98. @click="scope.row.materialNumber--"
  99. v-if="scope.row.isNumShow == 1"
  100. style="height:40px"
  101. >
  102. -
  103. </button>
  104. <input
  105. v-model="scope.row.materialNumber"
  106. disabled
  107. style="width:40px;height: 40px;font-size:16px;line-height: 40px;text-align: center;"
  108. />
  109. <button
  110. type="primary"
  111. @click="scope.row.materialNumber++"
  112. v-if="scope.row.isNumShow == 1"
  113. style="height:40px"
  114. >
  115. +
  116. </button>
  117. <el-button
  118. type="primary"
  119. @click="updateBillOrder(scope.row)"
  120. v-if="scope.row.isNumShow == 1"
  121. >提交</el-button
  122. >
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="装货点" width="100">
  126. <template slot-scope="scope">
  127. <el-select size="mini" v-model="scope.row.warehouseId">
  128. <el-option
  129. v-for="item in option"
  130. :key="item.id"
  131. :label="item.value"
  132. :value="item.id"
  133. >
  134. </el-option>
  135. </el-select>
  136. </template>
  137. </el-table-column>
  138. <el-table-column prop="grossWeight" label="毛重"> </el-table-column>
  139. <el-table-column prop="grossWeightTime" label="毛重时间" width="130px">
  140. </el-table-column>
  141. <el-table-column prop="tareWeight" label="皮重"> </el-table-column>
  142. <el-table-column prop="tareWeightTime" label="皮重时间" width="130px">
  143. </el-table-column>
  144. <el-table-column prop="netWeight" label="净重"> </el-table-column>
  145. <el-table-column prop="entryGateTime" label="进厂时间" width="130px">
  146. </el-table-column>
  147. <el-table-column prop="loadTime" label="装货时间" width="130px">
  148. </el-table-column>
  149. <el-table-column prop="outGateTime" label="出厂时间" width="130px">
  150. </el-table-column>
  151. <el-table-column
  152. prop="orderNumber"
  153. label="运输订单号"
  154. width="180px"
  155. align="center"
  156. >
  157. </el-table-column>
  158. <el-table-column
  159. label="操作"
  160. fixed="right"
  161. width="120px"
  162. align="center"
  163. >
  164. <template slot-scope="scope">
  165. <el-button
  166. type="text"
  167. size="small"
  168. @click="disorderlyOutbound(scope.row)"
  169. :disabled="!scope.row.materialName.includes('乱尺')"
  170. >出库申请</el-button
  171. >
  172. </template>
  173. </el-table-column>
  174. </el-table>
  175. </div>
  176. </div>
  177. </template>
  178. <script>
  179. import { sjTime } from "@/utils/sharedJsFile";
  180. import { getCookie } from "@/utils/util.js";
  181. export default {
  182. data() {
  183. return {
  184. clickIndex: null,
  185. input: null,
  186. option: [],
  187. startTime: null,
  188. endTime: null,
  189. tableData: [],
  190. spanArr: [],
  191. pos: 0,
  192. isCellClick: 0,
  193. columnIndexs: [0, 1, 11, 13, 14]
  194. };
  195. },
  196. computed: {},
  197. created() {},
  198. mounted() {
  199. this.getSteelReport();
  200. this.infomation();
  201. },
  202. methods: {
  203. infomation() {
  204. this.axios.get("/api/v1/uc/getSteelWarehouse").then(res => {
  205. console.log(res.data);
  206. this.option = res.data;
  207. });
  208. },
  209. cellClik(row, column, cell, event) {
  210. if (row.group != this.clickIndex) {
  211. this.tableData.forEach(item => {
  212. if (item.group == this.clickIndex) {
  213. this.$set(item, "isNumShow", 0);
  214. }
  215. });
  216. }
  217. if (column.property == "materialNumber") {
  218. this.$set(row, "isNumShow", 1);
  219. this.clickIndex = row.group;
  220. }
  221. },
  222. //记录每一行的合并数
  223. getSpanArr(data) {
  224. //每次调用方法初始化
  225. this.spanArr = [];
  226. for (var i = 0; i < data.length; i++) {
  227. if (i === 0) {
  228. this.spanArr.push(1);
  229. data[i].group = i;
  230. this.pos = 0;
  231. } else {
  232. // 判断当前元素与上一个元素是否相同
  233. if (data[i].orderId === data[i - 1].orderId) {
  234. this.spanArr[this.pos] += 1;
  235. data[i].group = data[i - 1].group;
  236. this.spanArr.push(0);
  237. } else {
  238. this.spanArr.push(1);
  239. this.pos = i;
  240. data[i].group = data[i - 1].group + 1;
  241. }
  242. }
  243. this.totalCapacity = data[data.length - 1].group + 1;
  244. this.totalNumber = data.reduce(function(prev, item) {
  245. return prev + item.materialNum;
  246. }, 0);
  247. }
  248. },
  249. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  250. if (this.columnIndexs.indexOf(columnIndex) != -1) {
  251. const _row = this.spanArr[rowIndex];
  252. const _col = _row > 0 ? 1 : 0;
  253. return {
  254. rowspan: _row,
  255. colspan: _col
  256. };
  257. }
  258. },
  259. //减少物资件数
  260. updateBillOrder(row) {
  261. const loading = this.$loading({
  262. lock: true,
  263. text: "修改物资件数中",
  264. spinner: "el-icon-loading",
  265. background: "rgba(0, 0, 0, 0.7)"
  266. });
  267. let map = {
  268. materialId: row.materialId,
  269. materialNum: row.materialNumber
  270. };
  271. let arr = [];
  272. arr.push(map);
  273. let updateMap = {
  274. orderId: row.orderId,
  275. saleOrderMaterialId: row.saleOrderMaterialId,
  276. mapList: arr
  277. };
  278. this.axios
  279. .post("/api/v1/oms/updateMaterialMes", updateMap)
  280. .then(res => {
  281. if (res.data.code == "200") {
  282. this.$message.success("修改物资数量成功");
  283. this.getSteelReport();
  284. loading.close();
  285. } else {
  286. this.$message.error("修改物资数量失败,请联系管理员");
  287. this.getSteelReport();
  288. loading.close();
  289. }
  290. })
  291. .catch(() => {
  292. this.$message.error("修改物资数量失败,请联系管理员");
  293. this.getSteelReport();
  294. loading.close();
  295. });
  296. },
  297. //查询,输入查询条件
  298. onclick() {
  299. let startTime = null;
  300. let endTime = null;
  301. let capacityNo = null;
  302. if (this.startTime && this.endTime) {
  303. startTime = sjTime(this.startTime);
  304. endTime = sjTime(this.endTime);
  305. }
  306. this.axios
  307. .post(
  308. "/api/v1/tms/getSaleSteelReport?startTime=" +
  309. startTime +
  310. "&endTime=" +
  311. endTime +
  312. "&carrierSsoId=" +
  313. carrierSsoId +
  314. "&i=" +
  315. new Date() +
  316. "&capacityNo=" +
  317. capacityNo
  318. )
  319. .then(res => {
  320. this.tableData = res.data.data;
  321. this.getSpanArr(res.data.data);
  322. });
  323. },
  324. //重新获取表格数据
  325. refresh() {
  326. this.getSteelReport();
  327. },
  328. //获取钢材统计报表
  329. getSteelReport() {
  330. this.axios
  331. .post(
  332. "/api/v1/oms/getWarehouseMes?startTime=" +
  333. null +
  334. "&endTime=" +
  335. null +
  336. "&i=" +
  337. new Date()
  338. )
  339. .then(res => {
  340. this.tableData = res.data.data;
  341. console.log(this.tableData);
  342. this.getSpanArr(res.data.data);
  343. });
  344. },
  345. disorderlyOutbound(row) {
  346. console.log(row);
  347. if (row.warehouseId == null) {
  348. this.$message.error("请先选择装货点");
  349. return;
  350. }
  351. row.userId = getCookie("userId");
  352. let title = `确定对${row.capacityNumber}的${row.materialNumber}${row.materialName}出库吗?`;
  353. this.$confirm(title, "提醒", {
  354. confirmButtonText: "确认",
  355. cancelButtonText: "取消",
  356. center: true
  357. }).then(() => {
  358. this.axios.post("/api/v1/wms/disorderlyOutbound", row).then(res => {
  359. console.log(res);
  360. });
  361. });
  362. }
  363. }
  364. };
  365. </script>
  366. <style lang="scss" scoped>
  367. .purchasFuelNewMonitor {
  368. .tableTop {
  369. margin-left: 20px;
  370. margin-top: 20px;
  371. }
  372. .table {
  373. margin-left: 20px;
  374. margin-top: 20px;
  375. }
  376. .address {
  377. .button-box {
  378. display: flex;
  379. justify-content: center;
  380. align-items: center;
  381. }
  382. }
  383. }
  384. </style>