You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

208 lines
7.6 KiB

3 weeks ago
  1. 
  2. @{
  3. ViewBag.Title = "";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  7. <!--引入 element-ui 的样式,-->
  8. <link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css">
  9. <script src="~/Content/vue/dist/vue.js"></script>
  10. <script src="~/Content/element-ui/lib/index.js"></script>
  11. <script src="~/Content/axios.min.js"></script>
  12. <style>
  13. </style>
  14. <form id="form1">
  15. <div id="app">
  16. <template>
  17. <el-form ref="form" :model="form" label-width="80px">
  18. <el-divider></el-divider>
  19. <el-row :gutter="24">
  20. <el-col :span="24">
  21. </el-col>
  22. </el-row>
  23. <el-row :gutter="24">
  24. <el-col :span="2">
  25. &nbsp;&nbsp;
  26. </el-col>
  27. <el-col :span="20">
  28. <el-table ref="dataSource4Test" highlight-current-row
  29. :data="dataSource4Test"
  30. style="width: 100%"
  31. stripe border
  32. size="mini"
  33. height="200"
  34. v-on:current-change="handleCurrentChange4Test">
  35. <el-table-column type="index" width="50"></el-table-column>
  36. <el-table-column type="selection" width="55"> </el-table-column>
  37. <el-table-column prop="InvCode" label="物料编码" width="150">
  38. </el-table-column>
  39. <el-table-column prop="InvName" label="物料名称" width="150">
  40. </el-table-column>
  41. <el-table-column prop="LotNo" label="物料条码" width="150">
  42. </el-table-column>
  43. <el-table-column prop="TransCode" label="采购订单" width="150">
  44. </el-table-column>
  45. <el-table-column prop="TransSequence" label="采购订单行" width="100">
  46. </el-table-column>
  47. <el-table-column prop="InvBatcgNo" label="批次" width="100">
  48. </el-table-column>
  49. <el-table-column prop="Quantity" label="条码数量" width="100">
  50. </el-table-column>
  51. <el-table-column prop="SampleQty" label="抽选数量" width="100">
  52. <template slot-scope="scope">
  53. <el-input-number v-model="scope.row.SampleQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4SampleQty"></el-input-number>
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="LeftQty" label="剩余数量" width="100">
  57. </el-table-column>
  58. </el-table>
  59. </el-col>
  60. <el-col :span="2">
  61. &nbsp;&nbsp;
  62. </el-col>
  63. </el-row>
  64. </el-form>
  65. </template>
  66. </div>
  67. </form>
  68. <script type="text/javascript">
  69. //const { Console } = require("node:console");
  70. var vm = new Vue({
  71. el: '#app',
  72. data: {
  73. id:'',
  74. userCode: "",
  75. ssList: [],
  76. form: {},
  77. detail: {
  78. key:0,
  79. SetValueMin: 0,
  80. SetValueMax: 0,
  81. SampleQuantity: 0,
  82. EATTRIBUTE1: 0,
  83. EATTRIBUTE2: 0,
  84. EATTRIBUTE3: 0,
  85. },
  86. currentRow4Test: null,//规则单选
  87. rules: {
  88. RulesCode: [{ required: true, message: '请输入', trigger: 'blur' },],
  89. RulesName: [{ required: true, message: '请输入', trigger: 'blur' },],
  90. },
  91. dataSource4Test: [],
  92. //multipleSelection:[],
  93. },
  94. //挂在DOM 触发
  95. mounted() {
  96. let reactiveObject = {
  97. RulesCode: '',
  98. RulesName: '',
  99. RulesDesc: '',
  100. Type: '',
  101. Enable: true,
  102. DetailList: [],
  103. };
  104. this.form = reactiveObject;
  105. // this.loadGrid();
  106. // this.show();
  107. this.id = '@ViewData["ids"]';
  108. this.initControl();
  109. // console.log(this.id);
  110. },
  111. beforeDestroy() {
  112. // this.autoScrol1(true);
  113. },
  114. methods: {
  115. handleCurrentChange4Test(val) {
  116. this.currentRow4Test = val;
  117. },
  118. change4SampleQty(currentValue, oldValue) {
  119. let currentRow = this.dataSource4Test.filter((x) => x.LotNo == this.currentRow4Test.LotNo)[0];
  120. if (!currentRow) {
  121. return;
  122. }
  123. currentRow.LeftQty = currentRow.Quantity - currentValue;
  124. if (currentRow.LeftQty < 0) {
  125. currentRow.SampleQty = 0;
  126. currentRow.LeftQty = 0;
  127. }
  128. },
  129. initControl: function () {
  130. let that = this;
  131. // let orgName = '';
  132. // this.disabled4RulesCode = this.id ? true : false;
  133. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  134. // console.log(userName);
  135. this.getData();
  136. //this.getAllItem();
  137. //this.getAllAql();
  138. },
  139. getData() {
  140. if (!this.id) return;
  141. let _this = this;
  142. // debugger;
  143. axios
  144. .get('/BBWMS/IQCQuality/GetMaterialCheckMain?keyValue=' + _this.id)
  145. .then(function (res) {
  146. // debugger;
  147. if (res.data) {
  148. if (res.data[0]) {
  149. for (var i in res.data[0]) {
  150. Vue.set(vm.form, i, res.data[0][i]);
  151. }
  152. }
  153. }
  154. })
  155. .then(function () {
  156. axios
  157. .get("/BBWMS/IQCQuality/GetMaterialInStorageCheckDetailList2?code=" + _this.form.AsnCode + "&lotno=" + _this.form.InvBatcgNo + "&invCode=" + _this.form.InvCode )
  158. .then(function (res) {
  159. if (res.data) {
  160. res.data.forEach(function (el, i) {
  161. el.SampleQty = 0;
  162. el.LeftQty = el.Quantity;
  163. Vue.set(vm.dataSource4Test, i, el)
  164. });
  165. }
  166. })
  167. })
  168. .catch(function (error) { // 请求失败处理
  169. alert(error);
  170. });
  171. },
  172. handleSelectionChange4File(val) {
  173. this.multipleSelection = val;
  174. },
  175. submitCheck() {
  176. //$.submitForm({});
  177. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  178. },
  179. },
  180. });
  181. function submitForm() {
  182. //debugger;
  183. vm.submitCheck();
  184. return vm.dataSource4Test;
  185. }
  186. function Close() {
  187. $.modalClose();
  188. }
  189. </script>