addSalePlanDetail.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <!-- 销售订单详细页面 -->
  3. <div class="salePlan">
  4. <div class="main">
  5. <span class="text">新增销售计划物资信息</span>
  6. <span class="a"></span>
  7. </div>
  8. <!-- <div>
  9. <div class="form-box" style="margin-left: 5rem">
  10. <el-form><dil-form :formId="289" v-model="form"></dil-form></el-form>
  11. </div>
  12. </div>
  13. <div class="button-ins">
  14. <el-button type="primary" @click="makeSure">确定添加</el-button>
  15. </div> -->
  16. <dilTable v-bind.sync="option">
  17. <el-table-column fixed="right" label="操作" align="center" width="200">
  18. <template slot-scope="scope">
  19. <el-button
  20. @click="editclick(scope.row.planMaterialId)"
  21. type="text"
  22. size="mini"
  23. >修改</el-button
  24. >
  25. <el-button
  26. type="text"
  27. size="mini"
  28. @click="deleteclick(scope.row.planMaterialId)"
  29. >删除</el-button
  30. >
  31. </template>
  32. </el-table-column>
  33. </dilTable>
  34. <div class="button-box">
  35. <el-button @click="onClickCancel">返回</el-button>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. export default {
  41. name: "salePlan",
  42. data() {
  43. return {
  44. option: {
  45. // 表格请求数据的地址
  46. requestUrl:
  47. "/api/v1/ams/getSalePlanMaterialInfo?apiId=228&planId=" +
  48. this.$route.params.planId,
  49. },
  50. };
  51. },
  52. methods: {
  53. // 新增
  54. makeSure() {
  55. let amsSalePlanMaterial = {
  56. salePlanId: this.$route.params.planId,
  57. materialId: this.form.materialId,
  58. materialNumber: this.form.materialNumber,
  59. };
  60. if (
  61. amsSalePlanMaterial.materialId == null ||
  62. amsSalePlanMaterial.materialNumber == null
  63. )
  64. this.$message.error("存在空值!");
  65. else
  66. this.axios
  67. .post(
  68. "/api/v1/ams/addAmsSalePlanMaterial",
  69. amsSalePlanMaterial
  70. )
  71. .then((res) => {
  72. if (res.data.code == 200) {
  73. this.$message({
  74. type: "success",
  75. message: "新增成功!",
  76. });
  77. this.$router.go(0);
  78. } else {
  79. this.$message.error("新增失败!");
  80. }
  81. this.$refs["table"].resetField();
  82. });
  83. },
  84. //修改
  85. editclick(planMaterialId) {
  86. this.$router.push("/editSalePalnDetail/" + planMaterialId);
  87. },
  88. //删除
  89. deleteclick(scope) {
  90. let planMaterialId = scope;
  91. this.$confirm("是否删除", "提示", {
  92. confirmButtonText: "确定",
  93. cancelButtonText: "取消",
  94. type: "warning",
  95. center: true,
  96. })
  97. .then(() => {
  98. this.$message({
  99. type: "success",
  100. message: "删除成功!",
  101. });
  102. this.axios
  103. .post(
  104. "/api/v1/ams/deleteAmsSalePlanMaterial?planMaterialId=" +
  105. planMaterialId
  106. )
  107. .then(() => {
  108. this.$router.go(0);
  109. });
  110. })
  111. .catch(() => {
  112. this.$message({
  113. type: "info",
  114. message: "取消删除!",
  115. });
  116. });
  117. },
  118. // 返回
  119. onClickCancel() {
  120. this.$router.go(-1);
  121. },
  122. },
  123. };
  124. </script>
  125. <style lang='scss' scoped>
  126. </style>