saleOrderArrange.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. // 销售订单排车
  2. <template>
  3. <div class="steel_inbound">
  4. <div class="sache">
  5. <el-input placeholder="请输入内容" v-model="inputText" clearable>
  6. </el-input>
  7. <el-button type="primary" class="btn">
  8. <i class="el-icon-search"></i>查询
  9. </el-button>
  10. <el-button type="primary" class="btn" @click="Issue()">
  11. <i class="el-icon-download"></i>下发
  12. </el-button>
  13. </div>
  14. <template>
  15. <div>
  16. <dilTable v-bind.sync="first" @selection-change="selectionChange" ref="table">
  17. <el-table-column fixed="right" label="操作" width="200">
  18. <template slot-scope="scope">
  19. <el-button
  20. @click="lookclick(scope.row.saleOrderId)"
  21. type="text"
  22. size="small"
  23. >查看修改地址</el-button
  24. >
  25. <el-button
  26. @click="passclick(scope.row.saleOrderId)"
  27. type="text"
  28. size="small"
  29. >修改日志</el-button
  30. >
  31. <el-button
  32. @click="materialclick(scope.row)"
  33. type="text"
  34. size="small"
  35. >物资详情</el-button
  36. >
  37. </template>
  38. </el-table-column>
  39. <!-- 物资详情抽屉 -->
  40. <el-table-column type="expand" width="1">
  41. <template slot-scope="props">
  42. <el-form label-position="center" inline class="demo-table-expand">
  43. <div v-if="false">{{ props }}</div>
  44. <div>
  45. <el-table :data="tableData" border>
  46. <el-table-column
  47. v-for="(item, i) in tableHead"
  48. :key="i"
  49. :prop="item.prop"
  50. :label="item.label"
  51. :width="item.width"
  52. ></el-table-column>
  53. </el-table>
  54. </div>
  55. </el-form>
  56. </template>
  57. </el-table-column>
  58. </dilTable>
  59. </div>
  60. </template>
  61. </div>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. inputText: "",
  68. first: {
  69. // first请求数据的地址
  70. requestUrl: "/api/v1/ams/getTruckNoList?apiId=411&issueStatus=0",
  71. selectionType: "select",
  72. mapList: [],
  73. },
  74. activeName: "first",
  75. //记录旧的row对象
  76. oldRow: "",
  77. //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态
  78. oldRowCount: 1,
  79. tableHead: [
  80. {
  81. prop: "materialName",
  82. label: "物资名称",
  83. width: 150,
  84. },
  85. {
  86. prop: "specificationModel",
  87. label: "规格型号",
  88. width: 150,
  89. },
  90. {
  91. prop: "materialNumber",
  92. label: "物资件数",
  93. width: 100,
  94. },
  95. {
  96. prop: "materialWeight",
  97. label: "物资重量",
  98. width: 100,
  99. },
  100. ],
  101. tableData: [],
  102. };
  103. },
  104. methods: {
  105. Issue() {
  106. if (this.first.mapList.length == 0) {
  107. this.$message({
  108. type: "warning",
  109. message: "请先选择订单!",
  110. });
  111. } else {
  112. this.$confirm("是否下发", "提示", {
  113. confirmButtonText: "确定",
  114. cancelButtonText: "取消",
  115. type: "warning",
  116. center: true,
  117. })
  118. .then(() => {
  119. //初始化maplist
  120. var mapList = [];
  121. this.first.mapList.forEach((item, i) => {
  122. //初始化mapItem
  123. var mapItem = {
  124. //销售订单物资中间表id
  125. saleOrderMaterialId: 0,
  126. };
  127. mapItem.saleOrderMaterialId = item.saleOrderMaterialId;
  128. mapList.push(mapItem);
  129. });
  130. this.$message({
  131. type: "success",
  132. message: "下发成功!",
  133. });
  134. this.axios.post("/api/v1/ams/issueTruckNo", mapList).then((res) => {
  135. if (res.data.code == "200") {
  136. this.$router.go(0);
  137. }
  138. });
  139. })
  140. .catch(() => {
  141. this.$message({
  142. type: "info",
  143. message: "取消上传!",
  144. });
  145. });
  146. }
  147. },
  148. lookclick(saleOrderId) {
  149. this.$router.push("/saleOrderDetailApproved/" + saleOrderId);
  150. },
  151. passclick(saleOrderId) {
  152. this.$router.push("/saleOrderUpdateLog/" + saleOrderId);
  153. },
  154. materialclick(row) {
  155. // 记录重复点击次数
  156. if (this.oldRow === row) {
  157. this.oldRowCount += 1;
  158. }
  159. // 切换当前详情表
  160. this.$refs.table.toggleRowExpansion(row);
  161. // 打开前关闭上一个详情表
  162. if (this.oldRow != "") {
  163. if (this.oldRow != row) {
  164. if (this.oldRowCount % 2 === 1) {
  165. this.$refs.table.toggleRowExpansion(this.oldRow);
  166. } else {
  167. this.oldRowCount = 1;
  168. }
  169. } else {
  170. this.oldRow = null;
  171. return;
  172. }
  173. }
  174. // 重置上一个点击对象
  175. this.oldRow = row;
  176. this.getMaterial(row.saleOrderMaterialId);
  177. },
  178. // 根据车序号id查询物资信息
  179. getMaterial(saleOrderMaterialId) {
  180. this.axios
  181. .post(
  182. "/api/v1/ams/getTruckNoMaterialList?saleOrderMaterialId=" +
  183. saleOrderMaterialId
  184. )
  185. .then((res) => {
  186. this.tableData = res.data.data;
  187. });
  188. },
  189. selectionChange(selection) {
  190. this.first.mapList = selection;
  191. },
  192. },
  193. };
  194. </script>
  195. <style lang="scss" scode>
  196. .steel_inbound {
  197. .sache {
  198. padding: 1.25rem 0.375rem;
  199. .el-input {
  200. width: 20%;
  201. margin-right: 1.25rem;
  202. }
  203. }
  204. }
  205. </style>