order-in-table.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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="50">
  28. <template slot="header" slot-scope="scope">
  29. <el-tooltip
  30. class="fr"
  31. style="margin: 3px 0 0 0"
  32. v-if="
  33. (status === '1' && powers.some((i) => i == '028')) ||
  34. (status === '2' && powers.some((i) => i == '028'))
  35. "
  36. effect="dark"
  37. content="添加"
  38. placement="top"
  39. >
  40. <i
  41. class="el-icon-circle-plus-outline tb-icon"
  42. style="color: #63cbe7"
  43. @click="openModal()"
  44. ></i>
  45. </el-tooltip>
  46. <span v-else>操作</span>
  47. </template>
  48. <template slot-scope="scope">
  49. <el-tooltip
  50. v-if="powers.some((i) => i == '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. const tran =
  90. this.$store.getters.btnList.find(
  91. (item) => item.menu_route == "purchaseOrderDetail"
  92. ) || {};
  93. const { action } = tran ?? {};
  94. return action ?? [];
  95. },
  96. },
  97. data() {
  98. return {
  99. showModel: false,
  100. isDetail: false,
  101. modelId: 0,
  102. options: [],
  103. status: "",
  104. loading: false,
  105. modelSitem: null,
  106. wsm_in_code: "",
  107. tableForm: {
  108. product_go: [], //出库商品
  109. },
  110. tableFormThis: config.tableFormThis,
  111. statusOptions: [
  112. // { value: "0", label: "取消" },
  113. {
  114. value: "0",
  115. label: "待发货",
  116. },
  117. {
  118. value: "1",
  119. label: "待验货",
  120. },
  121. {
  122. value: "2",
  123. label: "待审核",
  124. },
  125. {
  126. value: "3",
  127. label: "待入库",
  128. },
  129. {
  130. value: "4",
  131. label: "无退货入库成功",
  132. },
  133. // {
  134. // value: "5",
  135. // label: "退货成功",
  136. // },
  137. ],
  138. columns: config.columns,
  139. };
  140. },
  141. watch: {
  142. newTime: function (val) {
  143. if (val) {
  144. this.initForm();
  145. }
  146. },
  147. },
  148. mounted() {
  149. this.initForm();
  150. },
  151. methods: {
  152. async initForm() {
  153. this.loading = true;
  154. this.modelSitem = null;
  155. await this.resetForm();
  156. this.loading = false;
  157. },
  158. async resetForm() {
  159. // 重置
  160. await this.$nextTick(() => {
  161. if (this.$refs.tableForm) {
  162. this.$refs.tableForm.resetFields();
  163. this.$refs.tableForm.clearValidate();
  164. const { status, child } = this.sitem;
  165. this.status = status;
  166. this.tableForm.product_go = child || [];
  167. this.tableForm.product_go.forEach((e) => {
  168. e.sendtype_name =
  169. e.sendtype === "1"
  170. ? "公司自提"
  171. : e.sendtype === "2"
  172. ? "供应商包邮"
  173. : "--";
  174. e.status_name =
  175. (
  176. this.statusOptions.find(
  177. (item) => item.value == e.status
  178. ) || {}
  179. ).label || "--";
  180. });
  181. }
  182. });
  183. },
  184. openModal() {
  185. this.modelSitem = this.sitem;
  186. this.showModel = true;
  187. },
  188. async submitForm() {
  189. if (this.loading) {
  190. return;
  191. }
  192. let good = [];
  193. this.loading = true;
  194. good = this.getGoodList();
  195. const model = {
  196. allot_code: this.sitem.allot_code,
  197. good: good,
  198. };
  199. let res = {};
  200. if (this.status == "3") {
  201. res = await asyncRequest.allotgetin(model);
  202. } else {
  203. res = await asyncRequest.allotvesio(model);
  204. }
  205. this.loading = false;
  206. if (res && res.code === 0) {
  207. this.$notify.success({
  208. title:
  209. this.status == "3"
  210. ? "入库方验货结果提交成功!"
  211. : "入库方验货审核结果提交成功",
  212. message: "",
  213. });
  214. this.$emit("refresh");
  215. } else if (res && res.code >= 100 && res.code <= 104) {
  216. await this.logout();
  217. } else {
  218. this.$message.warning(res.message);
  219. }
  220. },
  221. //提交表单前 商品信息list 汇总
  222. getGoodList() {
  223. let oldList = JSON.parse(JSON.stringify(this.tableForm.product_go)),
  224. resList = [];
  225. oldList.forEach((v1) => {
  226. let goodModel = {
  227. good_code: v1.type_code,
  228. usable_num: v1.usable_stock,
  229. error_num: v1.error_num,
  230. error_remark: v1.error_remark,
  231. error_code: v1.error_code,
  232. };
  233. if (this.status === "4") {
  234. goodModel.stock_num = v1.stock_num;
  235. }
  236. resList.push(goodModel);
  237. });
  238. return resList;
  239. },
  240. },
  241. };
  242. </script>
  243. <style lang="scss" scoped>
  244. .allot,
  245. .allotDetail {
  246. .label-title-model {
  247. line-height: 30px;
  248. width: 100%;
  249. color: #909399;
  250. font-weight: bold;
  251. font-size: 15px;
  252. padding-bottom: 12px;
  253. text-align: center;
  254. }
  255. .product_go {
  256. .el-form-item--mini.el-form-item {
  257. margin: 0 !important;
  258. .spscope {
  259. word-break: break-all !important;
  260. line-height: 23px !important;
  261. padding: 0 !important;
  262. margin: 0 !important;
  263. list-style: none !important;
  264. font-style: normal !important;
  265. text-decoration: none !important;
  266. border: none !important;
  267. display: inline-block !important;
  268. font-weight: 500 !important;
  269. font-family: "Microsoft Yahei", sans-serif !important;
  270. -webkit-tap-highlight-color: transparent !important;
  271. -webkit-font-smoothing: antialiased !important;
  272. color: #606266 !important;
  273. font-size: 12px !important;
  274. }
  275. }
  276. }
  277. }
  278. </style>