order-in-table.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <el-row class="addForm">
  3. <el-col :span="24">
  4. <el-form
  5. :model="tableForm"
  6. :rules="tableFormThis"
  7. ref="tableForm"
  8. :size="'mini'"
  9. class="demo-tableForm product_go"
  10. >
  11. <el-table
  12. :data="tableForm.product_go"
  13. border
  14. :size="'mini'"
  15. row-key="key"
  16. >
  17. <template v-for="(item, index) in columns">
  18. <el-table-column
  19. :prop="item.prop"
  20. show-overflow-tooltip
  21. :label="item.label"
  22. :width="item.width"
  23. :min-width="item.minWidth"
  24. :key="item.prop + index"
  25. />
  26. </template>
  27. <el-table-column fixed="right" width="80">
  28. <template slot="header" slot-scope="scope">
  29. <span>操作</span>
  30. <el-tooltip
  31. class="fr"
  32. style="margin: 3px 0 0 0"
  33. v-if="
  34. (status === '1' && powers.some((item) => item == '028')) ||
  35. (status === '2' && powers.some((item) => item == '028'))
  36. "
  37. effect="dark"
  38. content="添加"
  39. placement="top"
  40. >
  41. <i
  42. class="el-icon-circle-plus-outline tb-icon"
  43. style="color: #63cbe7"
  44. @click="openModal()"
  45. ></i>
  46. </el-tooltip>
  47. </template>
  48. <template slot-scope="scope">
  49. <el-tooltip
  50. v-if="powers.some((item) => item == '007')"
  51. effect="dark"
  52. content="详情"
  53. placement="top"
  54. >
  55. <i
  56. class="el-icon-view tb-icon"
  57. @click="
  58. routeGoto('wsmInOrderDetail', {
  59. id: scope.row.wsm_in_code,
  60. })
  61. "
  62. ></i>
  63. </el-tooltip>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. </el-form>
  68. <wsm-in-order-model
  69. :show-model="showModel"
  70. :sitem="modelSitem"
  71. @refresh="(showModel = false), $emit('refresh')"
  72. @cancel="showModel = false"
  73. />
  74. </el-col>
  75. </el-row>
  76. </template>
  77. <script>
  78. import asyncRequest from "@/apis/service/stock/allot/detail";
  79. import resToken from "@/mixins/resToken";
  80. import config from "./columns-table"; //表格列参数
  81. import wsmInOrderModel from "@/views/purchaseIn/wsmInOrder/components/wsm-in-order-model";
  82. export default {
  83. name: "allot",
  84. props: ["id", "sitem", "newTime"],
  85. mixins: [resToken],
  86. components: { wsmInOrderModel },
  87. computed: {
  88. powers() {
  89. let tran =
  90. this.$store.getters.btnList.find(
  91. (item) => item.menu_route == "purchaseOrderDetail"
  92. ) || {};
  93. if (tran && tran.action && tran.action.length > 0) {
  94. return tran.action;
  95. } else {
  96. return [];
  97. }
  98. },
  99. },
  100. data() {
  101. return {
  102. showModel: false,
  103. isDetail: false,
  104. modelId: 0,
  105. options: [],
  106. status: "",
  107. loading: false,
  108. modelSitem: null,
  109. wsm_in_code: "",
  110. tableForm: {
  111. product_go: [], //出库商品
  112. },
  113. tableFormThis: config.tableFormThis,
  114. columns: config.columns,
  115. };
  116. },
  117. watch: {
  118. newTime: function (val) {
  119. if (val) {
  120. this.initForm();
  121. }
  122. },
  123. },
  124. mounted() {
  125. this.initForm();
  126. },
  127. methods: {
  128. async initForm() {
  129. this.loading = true;
  130. this.modelSitem = null;
  131. await this.resetForm();
  132. this.loading = false;
  133. },
  134. async resetForm() {
  135. // 重置
  136. await this.$nextTick(() => {
  137. if (this.$refs.tableForm) {
  138. this.$refs.tableForm.resetFields();
  139. this.$refs.tableForm.clearValidate();
  140. const { status, child } = this.sitem;
  141. this.status = status;
  142. this.tableForm.product_go = child || [];
  143. }
  144. });
  145. },
  146. openModal() {
  147. this.modelSitem=this.sitem;
  148. this.showModel = true;
  149. },
  150. async submitForm() {
  151. let good = [];
  152. this.loading = true;
  153. good = this.getGoodList();
  154. const model = {
  155. allot_code: this.sitem.allot_code,
  156. good: good,
  157. };
  158. let res = {};
  159. if (this.status == "3") {
  160. res = await asyncRequest.allotgetin(model);
  161. } else {
  162. res = await asyncRequest.allotvesio(model);
  163. }
  164. this.loading = false;
  165. if (res && res.code === 0) {
  166. this.$notify.success({
  167. title:
  168. this.status == "3"
  169. ? "入库方验货结果提交成功!"
  170. : "入库方验货审核结果提交成功",
  171. message: "",
  172. });
  173. this.$emit("refresh");
  174. } else if (res && res.code >= 100 && res.code <= 104) {
  175. await this.logout();
  176. } else {
  177. this.$message.warning(res.message);
  178. }
  179. },
  180. //提交表单前 商品信息list 汇总
  181. getGoodList() {
  182. let oldList = JSON.parse(JSON.stringify(this.tableForm.product_go)),
  183. resList = [];
  184. oldList.forEach((v1) => {
  185. let goodModel = {
  186. good_code: v1.type_code,
  187. usable_num: v1.usable_stock,
  188. error_num: v1.error_num,
  189. error_remark: v1.error_remark,
  190. error_code: v1.error_code,
  191. };
  192. if (this.status === "4") {
  193. goodModel.stock_num = v1.stock_num;
  194. }
  195. resList.push(goodModel);
  196. });
  197. return resList;
  198. },
  199. },
  200. };
  201. </script>
  202. <style lang="scss" scoped>
  203. .allot,
  204. .allotDetail {
  205. .label-title-model {
  206. line-height: 30px;
  207. width: 100%;
  208. color: #909399;
  209. font-weight: bold;
  210. font-size: 15px;
  211. padding-bottom: 12px;
  212. text-align: center;
  213. }
  214. .product_go {
  215. .el-form-item--mini.el-form-item {
  216. margin: 0 !important;
  217. .spscope {
  218. word-break: break-all !important;
  219. line-height: 23px !important;
  220. padding: 0 !important;
  221. margin: 0 !important;
  222. list-style: none !important;
  223. font-style: normal !important;
  224. text-decoration: none !important;
  225. border: none !important;
  226. display: inline-block !important;
  227. font-weight: 500 !important;
  228. font-family: "Microsoft Yahei", sans-serif !important;
  229. -webkit-tap-highlight-color: transparent !important;
  230. -webkit-font-smoothing: antialiased !important;
  231. color: #606266 !important;
  232. font-size: 12px !important;
  233. }
  234. }
  235. }
  236. }
  237. </style>