dispatchPlan.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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
  19. type="text"
  20. size="mini"
  21. @click="getRequirementMaterial(scope.row)"
  22. >
  23. 物资详情
  24. </el-button>
  25. <!-- <el-button type="text" size="mini" @click="updatePlan(scope)">
  26. 修改
  27. </el-button> -->
  28. </template>
  29. </el-table-column>
  30. <!-- 车辆信息 -->
  31. <el-dialog
  32. title="车辆信息"
  33. :visible.sync="dialogTableVisible"
  34. :before-close="handleClose"
  35. >
  36. <dilTable
  37. v-bind.sync="truck"
  38. @radio-change="currentRadioChange1"
  39. ></dilTable>
  40. <span slot="footer" class="dialog-footer">
  41. <el-button @click="cancelUpdate()">取 消</el-button>
  42. <el-button type="primary" @click="updateTruckCapacity()"
  43. >确 定</el-button
  44. >
  45. </span>
  46. </el-dialog>
  47. <!-- 物资详情抽屉 -->
  48. <el-table-column type="expand" width="1">
  49. <template slot-scope="props">
  50. <el-form
  51. label-position="center"
  52. inline
  53. class="demo-table-expand"
  54. >
  55. <div v-if="false">{{ props }}</div>
  56. <div>
  57. <el-table :data="tableData" border>
  58. <el-table-column
  59. v-for="(item, i) in tableHead"
  60. :key="i"
  61. :prop="item.prop"
  62. :label="item.label"
  63. :width="item.width"
  64. ></el-table-column>
  65. </el-table>
  66. </div>
  67. </el-form>
  68. </template>
  69. </el-table-column>
  70. </dilTable>
  71. </el-tab-pane>
  72. <el-tab-pane label="已接收" name="second">
  73. <dilTable v-bind.sync="second"> </dilTable>
  74. </el-tab-pane>
  75. </el-tabs>
  76. </div>
  77. </template>
  78. </div>
  79. </template>
  80. <script>
  81. import { getCookie } from "@/utils/util.js";
  82. export default {
  83. data() {
  84. return {
  85. inputText: "",
  86. userCarrierId: "",
  87. //是否弹出对话框
  88. dialogTableVisible: false,
  89. first: {
  90. //
  91. requestUrl:
  92. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&carrierId=" +
  93. "",
  94. },
  95. //车辆信息的表格
  96. truck: {
  97. requestUrl:
  98. "/api/v1/oms/getCapacityAndDriverList?apiId=246&carrierId=" + "",
  99. // 控制显示当选列
  100. selectionType: "radio",
  101. },
  102. //选中的运力id
  103. capacityId: null,
  104. activeName: "first",
  105. second: {
  106. requestUrl: "",
  107. },
  108. tableHead: [
  109. {
  110. prop: "materialName",
  111. label: "物资名称",
  112. width: 150,
  113. },
  114. {
  115. prop: "loadName",
  116. label: "装货点",
  117. width: 150,
  118. },
  119. {
  120. prop: "unloadName",
  121. label: "卸货点",
  122. width: 150,
  123. },
  124. {
  125. prop: "loadSequence",
  126. label: "装卸货次序",
  127. width: 150,
  128. },
  129. {
  130. prop: "materialWeight",
  131. label: "物资重量",
  132. width: 150,
  133. },
  134. {
  135. prop: "materialCount",
  136. label: "物资数量",
  137. width: 150,
  138. },
  139. ],
  140. tableData: [],
  141. //记录旧的row对象(未下发)
  142. oldRow: "",
  143. //记录上一个展开的点击次数,单数为展开状态,复数为闭合状态(未下发)
  144. oldRowCount: 1,
  145. };
  146. },
  147. created() {
  148. if (getCookie("orgCode") == "chengyunshang") {
  149. this.first.requestUrl =
  150. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&carrierId=" +
  151. getCookie("userId");
  152. this.second.requestUrl =
  153. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5&carrierId=" +
  154. getCookie("userId");
  155. } else {
  156. this.first.requestUrl =
  157. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4";
  158. this.second.requestUrl =
  159. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5";
  160. }
  161. },
  162. methods: {
  163. getRequest() {
  164. if (getCookie("orgCode") == "chengyunshang") {
  165. this.first.requestUrl =
  166. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&carrierId=" +
  167. getCookie("userId") +
  168. new Date();
  169. this.second.requestUrl =
  170. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5&carrierId=" +
  171. getCookie("userId") +
  172. new Date();
  173. } else {
  174. this.first.requestUrl =
  175. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4";
  176. this.second.requestUrl =
  177. "/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5";
  178. }
  179. },
  180. // //修改运力
  181. // updatePlan() {
  182. // if (this.capacityId == null) {
  183. // this.$message.error("未选中运力");
  184. // return;
  185. // }
  186. // this.axios
  187. // .post("/api/v1/oms/updateCapacityId", {
  188. // capacityId: this.capacityId,
  189. // orderId: this.orderId,
  190. // })
  191. // .then((res) => {
  192. // if (res.data.code == "200") {
  193. // this.$message.success("修改运力成功");
  194. // this.getRequestUrl();
  195. // this.dialogTableVisible = false;
  196. // } else {
  197. // this.$message.error("修改运力失败");
  198. // }
  199. // });
  200. // },
  201. // cancelUpdate() {
  202. // this.dialogTableVisible = false;
  203. // this.$message.info("取消修改运力");
  204. // },
  205. handleClick() {
  206. this.getRequirementMaterial();
  207. },
  208. getRequirementMaterial(row) {
  209. // 记录重复点击次数
  210. if (this.oldRow === row) {
  211. this.oldRowCount += 1;
  212. }
  213. // 切换当前详情表
  214. this.$refs.table.toggleRowExpansion(row);
  215. // 打开前关闭上一个详情表
  216. if (this.oldRow != "") {
  217. if (this.oldRow != row) {
  218. if (this.oldRowCount % 2 === 1) {
  219. this.$refs.table.toggleRowExpansion(this.oldRow);
  220. } else {
  221. this.oldRowCount = 1;
  222. }
  223. } else {
  224. this.oldRow = null;
  225. return;
  226. }
  227. }
  228. // 重置上一个点击对象
  229. this.oldRow = row;
  230. this.getMaterial(row.requirementId);
  231. },
  232. getMaterial(requirementId) {
  233. console.log(requirementId);
  234. this.axios
  235. .post("/api/v1/ams/getRequirementMaterial/" + requirementId)
  236. .then((res) => {
  237. this.tableData = res.data.data;
  238. console.log(res.data.data);
  239. });
  240. },
  241. deletePlan(scope) {
  242. this.$confirm("是否删除", "提示", {
  243. confirmButtonText: "确定",
  244. cancelButtonText: "取消",
  245. type: "warning",
  246. center: true,
  247. })
  248. .then(() => {
  249. this.axios
  250. .post(
  251. "/api/v1/bms/deleteTrainSettlement/" + scope.row.requirementId
  252. )
  253. .then((res) => {
  254. if (res.data.code == 200) {
  255. this.$message({
  256. type: "success",
  257. message: "删除成功!",
  258. });
  259. } else {
  260. this.$message({
  261. message: "删除失败",
  262. type: "warning",
  263. });
  264. }
  265. });
  266. })
  267. .catch(() => {
  268. this.$message({
  269. type: "info",
  270. message: "删除操作已取消!",
  271. });
  272. });
  273. },
  274. },
  275. };
  276. </script>
  277. <style lang="scss">
  278. .steel_inbound {
  279. .sache {
  280. padding: 1.25rem 0.375rem;
  281. .el-input {
  282. width: 20%;
  283. margin-right: 1.25rem;
  284. }
  285. }
  286. }
  287. </style>