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.

236 lines
7.9 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. .redClass {
  14. color: red;
  15. }
  16. </style>
  17. <form id="form1">
  18. <div id="app">
  19. <template>
  20. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  21. @*<el-divider>主表信息</el-divider>*@
  22. <br />
  23. <br />
  24. <el-row :gutter="24">
  25. <el-col :span="24">
  26. <el-form-item label="判定结果" prop="FinalResult">
  27. <el-radio-group v-model="form.Result" v-on:change="change4Result">
  28. <el-radio-button label="OK"></el-radio-button>
  29. <el-radio-button label="NG"></el-radio-button>
  30. </el-radio-group>
  31. </el-form-item>
  32. </el-col>
  33. </el-row>
  34. <el-row :gutter="24">
  35. <el-col :span="16">
  36. <el-form-item label="备注" prop="Remark">
  37. <el-input v-model="form.Remark" size="mini"></el-input>
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. </el-form>
  42. </template>
  43. </div>
  44. </form>
  45. <script type="text/javascript">
  46. //const { Console } = require("node:console");
  47. function UpLoadClick() {
  48. //var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  49. //if (ids.length != 1) {
  50. // $.modalAlertNew("WMS00050");
  51. // return;
  52. //}
  53. $("#FileUp2").click();
  54. }
  55. var vm = new Vue({
  56. el: '#app',
  57. data: {
  58. id:'',
  59. userCode: "",
  60. ssList: [],
  61. form: {},
  62. dataSource4CC: [],
  63. dataSource4WG: [],
  64. dataSource4XN: [],
  65. WHCodeList:[],
  66. currentRow4CC: null,
  67. currentRow4WG: null,
  68. currentRow4XN: null,
  69. rules: {
  70. },
  71. disabled4RulesCode: false,
  72. destroyExprementDataSource: [],
  73. qty: 0,
  74. docType:''
  75. },
  76. //挂在DOM 触发
  77. mounted() {
  78. //let reactiveObject = {
  79. //};
  80. //this.form = reactiveObject;
  81. // this.loadGrid();
  82. // this.show();
  83. this.id = '@ViewData["ids"]';
  84. this.qty = @ViewData["qty"];
  85. this.docType = @ViewData["docType"];
  86. this.initControl();
  87. // console.log(this.id);
  88. },
  89. beforeDestroy() {
  90. // this.autoScrol1(true);
  91. },
  92. methods: {
  93. change4FileUp2(e) {
  94. debugger;
  95. var files = e.target.files;
  96. var fileName = files[0].name;
  97. // vm.setExFileName(fileName);
  98. this.form.WgNgFile = fileName;
  99. if (fileName != null && fileName != "") {
  100. var data = new FormData();
  101. jQuery.each(jQuery('#FileUp2')[0].files, function (i, file) {
  102. data.append('file-' + i, file);
  103. });
  104. data.append("ID", '001');
  105. // data.append("LableName", LableName);
  106. $.modalConfirm("确定上传文件吗?", function (r) {
  107. if (r) {
  108. $.ajax({
  109. url: "/BBWMS/IQCQuality/UpLoadMaterialCheckExFile" + "?" + Math.random(),
  110. type: "post",
  111. data: data,
  112. contentType: false,
  113. processData: false,
  114. dataType: "json",
  115. success: function (data) {
  116. // console.log(data);
  117. if (data.message == "上传成功!") {
  118. $.modalMsg("操作成功", "success");
  119. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  120. }
  121. else {
  122. $.modalMsg(data.message, "warning");
  123. }
  124. },
  125. error: function (aa) {
  126. $.modalAlertNew("WMS00016", aa);
  127. }
  128. });
  129. }
  130. });
  131. }
  132. },
  133. setExFileName(val) {
  134. this.form.WgNgFile = val;
  135. },
  136. initControl: function () {
  137. let that = this;
  138. let orgName = '';
  139. this.disabled4RulesCode = this.id ? true : false;
  140. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  141. // console.log(userName);
  142. // this.getAllWHCodeList();
  143. this.getData();
  144. },
  145. getData() {
  146. if (!this.id) return;
  147. let _this = this;
  148. axios
  149. .get('/BBWMS/IQCQuality/GetMaterialCheckMain2?keyValue=' + _this.id + '&qty=' + _this.qty )
  150. .then(function (res) {
  151. // debugger;
  152. if (res.data) {
  153. if (res.data[0]) {
  154. for (var i in res.data[0]) {
  155. Vue.set(vm.form, i, res.data[0][i]);
  156. }
  157. _this.form.Result = 'OK';
  158. }
  159. }
  160. })
  161. .catch(function (error) { // 请求失败处理
  162. alert(error);
  163. });
  164. },
  165. submitCheck() {
  166. debugger;
  167. if (!this.form.Result) {
  168. $.modalMsg("必须存在最终检验结果", "warning");
  169. return false;
  170. }
  171. //if (this.dataSource4CC.length == 0 || this.dataSource4WG.length == 0 || this.dataSource4XN.length == 0) {
  172. // $.modalMsg("必须存在检验项目", "warning");
  173. // return false;
  174. //}
  175. this.form.InvBatcgQty = this.qty;
  176. this.form.EATTRIBUTE2 = this.docType;
  177. this.form.FinalItemLotList = this.destroyExprementDataSource;
  178. this.form.CCList = this.dataSource4CC;
  179. this.form.WGList = this.dataSource4WG;
  180. this.form.XNList = this.dataSource4XN;
  181. this.$refs['form'].validate((valid) => {
  182. if (valid) {
  183. //alert('submit!');
  184. $.submitForm({
  185. url: "/BBWMS/IQCQuality/SaveMaterialCheckResult",
  186. param: { keyValue: JSON.stringify(this.form) },
  187. success: function () {
  188. $.currentWindow().$("#gridList").trigger("reloadGrid");
  189. }
  190. })
  191. } else {
  192. console.log('error submit!!');
  193. return false;
  194. }
  195. });
  196. // console.log(result);
  197. },
  198. },
  199. });
  200. function submitForm() {
  201. //debugger;
  202. vm.submitCheck();
  203. }
  204. </script>