dispatchPlan.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. </div>
  11. <template>
  12. <div>
  13. <el-tabs v-model="activeName" @tab-click="handleClick">
  14. <el-tab-pane label="待接收" name="first">
  15. <dilTable v-bind.sync="first" ref="table">
  16. <el-table-column fixed="right" label="操作" width="180">
  17. <template slot-scope="scope">
  18. <el-button type="text" size="mini" @click="getRequirementMaterial(scope.row)">
  19. 物资详情
  20. </el-button>
  21. <el-button type="text" size="mini" @click="updatePlan(scope)">
  22. 修改
  23. </el-button>
  24. </template>
  25. </el-table-column>
  26. <!-- 物资详情抽屉 -->
  27. <el-table-column type="expand" width="1">
  28. <template slot-scope="props">
  29. <el-form label-position="center" inline class="demo-table-expand">
  30. <div v-if="false">{{ props }}</div>
  31. <div>
  32. <el-table :data="tableData" border >
  33. <el-table-column
  34. v-for="(item, i) in tableHead"
  35. :key="i"
  36. :prop="item.prop"
  37. :label="item.label"
  38. :width="item.width"
  39. ></el-table-column>
  40. </el-table>
  41. </div>
  42. </el-form>
  43. </template>
  44. </el-table-column>
  45. </dilTable>
  46. </el-tab-pane>
  47. <el-tab-pane label="已接收" name="second">
  48. <dilTable v-bind.sync="second"> </dilTable>
  49. </el-tab-pane>
  50. </el-tabs>
  51. </div>
  52. </template>
  53. </div>
  54. </template>
  55. <script>
  56. import { getCookie } from "@/utils/util.js";
  57. export default {
  58. data() {
  59. return {
  60. inputText: "",
  61. userCarrierId:'',
  62. first: {
  63. //
  64. requestUrl:
  65. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&carrierId=" + '',
  66. },
  67. activeName: "first",
  68. second: {
  69. requestUrl:""
  70. },
  71. tableHead: [
  72. {
  73. prop: "materialName",
  74. label: "物资名称",
  75. width: 150,
  76. },
  77. {
  78. prop:"loadName",
  79. label:"装货点",
  80. width:150
  81. },
  82. {
  83. prop:"unloadName",
  84. label:"卸货点",
  85. width:150
  86. },
  87. {
  88. prop:"loadSequence",
  89. label:"装卸货次序",
  90. width:150
  91. },
  92. {
  93. prop: "materialWeight",
  94. label: "物资重量",
  95. width: 150,
  96. },
  97. {
  98. prop: "materialCount",
  99. label: "物资数量",
  100. width: 150,
  101. },
  102. ],
  103. tableData: [],
  104. //记录旧的row对象(未下发)
  105. oldRow: "",
  106. //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态(未下发)
  107. oldRowCount: 1,
  108. };
  109. },
  110. created(){
  111. if(getCookie("orgCode") == "chengyunshang"){
  112. this.first.requestUrl = "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&carrierId=" + getCookie("userId")
  113. this.second.requestUrl = "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5&carrierId=" + getCookie("userId")
  114. }else{
  115. this.first.requestUrl = "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4"
  116. this.second.requestUrl = "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5"
  117. }
  118. },
  119. methods: {
  120. getRequest(){
  121. if(getCookie("orgCode") == "chengyunshang"){
  122. this.first.requestUrl = "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&carrierId=" + getCookie("userId") + new Date()
  123. this.second.requestUrl = "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5&carrierId=" + getCookie("userId") + new Date()
  124. }else{
  125. this.first.requestUrl = "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4"
  126. this.second.requestUrl = "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5"
  127. }
  128. },
  129. handleClick(){
  130. this.getRequirementMaterial()
  131. },
  132. getRequirementMaterial(row) {
  133. // 记录重复点击次数
  134. if (this.oldRow === row) {
  135. this.oldRowCount += 1;
  136. }
  137. // 切换当前详情表
  138. this.$refs.table.toggleRowExpansion(row);
  139. // 打开前关闭上一个详情表
  140. if (this.oldRow != "") {
  141. if (this.oldRow != row) {
  142. if (this.oldRowCount % 2 === 1) {
  143. this.$refs.table.toggleRowExpansion(this.oldRow);
  144. } else {
  145. this.oldRowCount = 1;
  146. }
  147. } else {
  148. this.oldRow = null;
  149. return;
  150. }
  151. }
  152. // 重置上一个点击对象
  153. this.oldRow = row;
  154. this.getMaterial(row.requirementId);
  155. },
  156. getMaterial(requirementId){
  157. console.log(requirementId)
  158. this.axios.post("/api/v1/ams/getRequirementMaterial/" + requirementId).then((res) => {
  159. this.tableData = res.data.data
  160. console.log(res.data.data)
  161. })
  162. },
  163. deletePlan(scope) {
  164. this.$confirm("是否删除", "提示", {
  165. confirmButtonText: "确定",
  166. cancelButtonText: "取消",
  167. type: "warning",
  168. center: true,
  169. })
  170. .then(() => {
  171. this.axios
  172. .post(
  173. "/api/v1/bms/deleteTrainSettlement/" + scope.row.requirementId
  174. )
  175. .then((res) => {
  176. if (res.data.code == 200) {
  177. this.$message({
  178. type: "success",
  179. message: "删除成功!",
  180. });
  181. } else {
  182. this.$message({
  183. message: "删除失败",
  184. type: "warning",
  185. });
  186. }
  187. });
  188. })
  189. .catch(() => {
  190. this.$message({
  191. type: "info",
  192. message: "删除操作已取消!",
  193. });
  194. });
  195. },
  196. },
  197. };
  198. </script>
  199. <style lang="scss">
  200. .steel_inbound{
  201. .sache{
  202. padding: 1.25rem 0.375rem;
  203. .el-input {
  204. width: 20%;
  205. margin-right: 1.25rem;
  206. }
  207. }
  208. }
  209. </style>