|
|
@{ ViewBag.Title = ""; Layout = "~/Views/Shared/_Form.cshtml";}<script src="~/Content/js/datepicker/WdatePicker.js"></script><!--引入 element-ui 的样式,--><link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css"><script src="~/Content/vue/dist/vue.js"></script><script src="~/Content/element-ui/lib/index.js"></script>
<script src="~/Content/axios.min.js"></script><style></style><form id="form1"> <div id="app"> <template> <el-form ref="form" :model="form" :rules="rules" label-width="130px"> @*<el-divider>主表信息</el-divider>*@ <el-row :gutter="24"> <el-col :span="4"> <el-form-item label="物料编码" prop="InvCode"> <el-input v-model="form.InvCode" placeholder="请输入内容" size="mini" :disabled="true"></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="物料名称" prop="InvName"> <el-input v-model="form.InvName" placeholder="请输入内容" size="mini" :disabled="true"></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="批次" prop="InvBatcgNo"> <el-input v-model="form.InvBatcgNo" placeholder="请输入内容" size="mini" :disabled="true"></el-input> </el-form-item> </el-col> <el-col :span="4">
</el-col> </el-row> <el-row :gutter="24"> <el-col :span="4"> <el-form-item label="批次数量" prop="InvBatcgQty"> <el-input v-model="form.InvBatcgQty" size="mini" :disabled="true"></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="单位" prop="InvUnit"> <el-input v-model="form.InvUnit" size="mini" :disabled="true"></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="外观抽检数量" prop="AqlCheckQty"> <el-input v-model="form.AqlCheckQty" size="mini" :disabled="true"></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item label="检验结果" prop="Result"> <el-input v-model="form.Result" size="mini" :disabled="true"></el-input> </el-form-item> </el-col> </el-row>
<el-row :gutter="24"> <el-col :span="6"> <el-form-item label="判定结果" prop="FinalResult"> <el-radio-group v-model="form.FinalResult" v-on:change="change4FinalResult"> <el-radio-button label="判退"></el-radio-button> <el-radio-button label="返工"></el-radio-button> <el-radio-button label="让步接收"></el-radio-button> </el-radio-group> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="特采单号" prop="SpecialNo"> <el-input v-model="form.SpecialNo" size="mini" :disabled="disabled4SpecialNo"></el-input> </el-form-item> </el-col> <el-col :span="2"> <input id='FileUp2' type='file' style="display: none;" />
<a id="NF-Uploading" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick()" :disabled="disabled4SpecialNo"><i class="fa fa-file-excel-o"></i>上传</a> </el-col>
@*<el-col :span="6"> <el-form-item label="SQE处理方案" prop="EATTRIBUTE1"> <el-input v-model="form.EATTRIBUTE1" size="mini" :disabled="true"></el-input> </el-form-item> </el-col>*@ </el-row>
<el-divider>条码信息</el-divider> <el-row :gutter="24">
<el-col :span="24"> <el-table ref="dataSource4Test" highlight-current-row :data="dataSource4Test" style="width: 100%" stripe border size="mini" height="500" v-on:current-change="handleCurrentChange4Test"> <el-table-column type="index" width="50"></el-table-column> <el-table-column type="selection" width="55"> </el-table-column> <el-table-column prop="InvCode" label="物料编码" width="100"> </el-table-column> <el-table-column prop="InvName" label="物料名称" width="100"> </el-table-column> <el-table-column prop="LotNo" label="物料条码" width="150"> </el-table-column> <el-table-column prop="TransCode" label="采购订单" width="100"> </el-table-column> <el-table-column prop="TransSequence" label="采购订单行" width="150"> </el-table-column> <el-table-column prop="InvBatcgNo" label="批次" width="100"> </el-table-column> <el-table-column prop="Quantity" label="条码数量" width="100"> </el-table-column> <el-table-column prop="GoodQty" label="合格数量" width="100"> <template slot-scope="scope"> <el-input-number v-model="scope.row.GoodQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4GoodQty" :disabled="disabled4GoodQty"></el-input-number> </template> </el-table-column> <el-table-column prop="NgQty" label="不合格数量" width="100"> <template slot-scope="scope"> <el-input-number v-model="scope.row.NgQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4NgQty" :disabled="disabled4NgQty"></el-input-number> </template> </el-table-column> <el-table-column prop="InQty" label="入库数量" width="100"> </el-table-column> </el-table> </el-col>
</el-row>
</el-form> </template> </div></form>
<script type="text/javascript"> //const { Console } = require("node:console"); var vm = new Vue({ el: '#app', data: { id:'', userCode: "", ssList: [], form: {}, dataSource4Test: [], currentRow4Test:null, rules: {
}, disabled4RulesCode: false, disabled4SpecialNo:false, disabled4GoodQty:false, disabled4NgQty: false, fileName:'', }, //挂在DOM 触发 mounted() { //let reactiveObject = {
//}; //this.form = reactiveObject;
// this.loadGrid(); // this.show(); this.id = '@ViewData["ids"]'; this.judgeRole='@ViewData["judgeRole"]'; this.initControl(); this.loadEvent(); // console.log(this.id); }, beforeDestroy() { // this.autoScrol1(true);
}, methods: { change4FinalResult(val) { if (!val) { return; }
if (val == "判退") { this.disabled4SpecialNo = true; this.disabled4GoodQty = true; this.disabled4NgQty = true;
} else if (val == "返工") { this.disabled4SpecialNo = true; this.disabled4GoodQty = false; this.disabled4NgQty = false; for (var i = 0; i < this.dataSource4Test.length; i++) { let item = this.dataSource4Test[i]; item.NgQty = 0; item.GoodQty = item.Quantity; item.InQty = item.Quantity; }
} else if (val == "让步接收") { this.disabled4SpecialNo = false; this.disabled4GoodQty = false; this.disabled4NgQty = false; for (var i = 0; i < this.dataSource4Test.length; i++) { let item = this.dataSource4Test[i]; item.NgQty = 0; item.GoodQty = item.Quantity; item.InQty = item.Quantity;
} } else {
} }, upload() {
}, loadEvent() { let that = this; debugger; $("#FileUp2").on("change", function (e) { var files = e.target.files; var fileName = files[0].name; if (fileName != null && fileName != "") { var data = new FormData(); jQuery.each(jQuery('#FileUp2')[0].files, function (i, file) { data.append('file-' + i, file); }); data.append("ID", that.id); // data.append("LableName", LableName); $.modalConfirm("确定上传文件吗?", function (r) { if (r) { $.ajax({ url: "/BBWMS/IQCQuality/UpLoadFinalJudgeFile" + "?" + Math.random(), type: "post", data: data, contentType: false, processData: false, dataType: "json", success: function (data) { // console.log(data); if (data.message == "上传成功!") { $.modalMsg("操作成功", "success"); // $.currentWindow().$("#gridList").trigger("reloadGrid"); that.form.SpecialFile = fileName; } else { $.modalMsg(data.message, "warning"); } }, error: function (aa) { $.modalAlertNew("WMS00016", aa); } }); } }); } }); }, change4GoodQty(currentValue, oldValue) { //console.log('OK数改变'); //debugger; let currentRow = this.dataSource4Test.filter((x) => x.RowNo == this.currentRow4Test.RowNo)[0]; if (currentRow) { currentRow.NgQty = currentRow.Quantity - currentValue;
if (currentRow.NgQty < 0) { currentRow.GoodQty = 0; currentRow.InQty = 0; currentRow.NgQty = 0; } currentRow.InQty = currentRow.GoodQty; } }, change4NgQty(currentValue, oldValue) { //console.log('NG数改变'); let currentRow = this.dataSource4Test.filter((x) => x.RowNo == this.currentRow4Test.RowNo)[0]; if (currentRow) { currentRow.GoodQty = currentRow.Quantity - currentValue; if (currentRow.GoodQty < 0) { currentRow.GoodQty = 0; currentRow.NgQty = 0; } currentRow.InQty = currentRow.GoodQty; } }, judgeWGRowResult(currentRow) { if (!currentRow) { return; }
if (currentRow.NgQty <= this.form.AllowNgQty) { currentRow.Result = "OK"; } else { currentRow.Result = "NG"; } }, initControl: function () { let that = this; let orgName = ''; this.disabled4RulesCode = this.id ? true : false; let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName'; // console.log(userName); //this.getAllBRGCode(); //this.getAllBCGCode(); this.getData();
},
getData() { if (!this.id) return;
let _this = this;
axios .get('/BBWMS/IQCQuality/GetMaterialReJudgeMain?keyValue=' + _this.id) .then(function (res) {
// debugger; if (res.data) {
for (var i in res.data) { Vue.set(vm.form, i, res.data[i]); }
//_this.form.JudgeRole = _this.judgeRole; if (!_this.form.FinalResult) { _this.form.FinalResult = '判退'; _this.change4FinalResult(_this.form.FinalResult); } } }) .then(function () { axios .get("/BBWMS/IQCQuality/GetCPMaterialInStorageCheckDetailList2?code=" + _this.form.AsnCode + "&lotno=" + _this.form.InvBatcgNo + "&invCode=" + _this.form.InvCode) .then(function (res) {
if (res.data) { res.data.forEach(function (el, i) { Vue.set(vm.dataSource4Test, i, el) });
} }) }) .catch(function (error) { // 请求失败处理 alert(error); }); }, //选中行变化 handleCurrentChange4CC(val) { this.currentRow4CC = val; console.log('尺寸行变化'); }, handleCurrentChange4WG(val) { this.currentRow4WG = val; console.log('外观行变化'); }, handleCurrentChange4Test(val) { this.currentRow4Test = val; }, submitCheck() { debugger; if (!this.form.Result) { $.modalMsg("必须存在最终检验结果", "warning"); return false; } if (!this.form.FinalResult) { $.modalMsg("必须存在终判结果", "warning"); return false; } //if (!this.form.IQCGroupHeaderResult) { // $.modalMsg("必须存在判定结果", "warning"); // return false; //} //if (!this.form.IQCGroupHeaderRemark ) { // $.modalMsg("判定必须填写原因", "warning"); // return false; //} //if (this.form.IQCGroupHeaderResult == "NG") { // if ( !this.form.BRGCode) { // $.modalMsg("判定不合格必须填写选择不良分类", "warning"); // return false; // } //} //this.dataSource4CC.forEach((item) => { // if (!item.Result) {
// } //}) if (this.form.FinalResult == "判退") { for (var i = 0; i < this.dataSource4Test.length; i++) { let item = this.dataSource4Test[i]; item.NgQty = item.Quantity; item.GoodQty = 0; item.InQty = 0; //if (!item.GoodQty && !item.NgQty) { // $.modalMsg("必须填写合格不合格数量", "warning"); // return false; //} } } else if (this.form.FinalResult == "返工") { for (var i = 0; i < this.dataSource4Test.length; i++) { let item = this.dataSource4Test[i]; if (!item.GoodQty && !item.NgQty) { $.modalMsg("必须填写合格不合格数量", "warning"); return false; } } } else if (this.form.FinalResult == "让步接收") {
if (!this.form.SpecialNo || !this.form.SpecialFile) { $.modalMsg("让步接收必须填写特采单号,上传文件", "warning"); return false; } for (var i = 0; i < this.dataSource4Test.length; i++) { let item = this.dataSource4Test[i]; if (!item.GoodQty && !item.NgQty) { $.modalMsg("必须填写合格不合格数量", "warning"); return false; } } } else {
}
//this.form.CCList = this.dataSource4CC; //this.form.WGList = this.dataSource4WG; this.form.FinalItemLotList = this.dataSource4Test; this.$refs['form'].validate((valid) => { if (valid) { //alert('submit!');
$.submitForm({ url: "/BBWMS/IQCQuality/SaveMaterialCheckFinalJudgeResult", param: { keyValue: JSON.stringify(this.form) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } })
} else { console.log('error submit!!'); return false; } }); // console.log(result); }, }, }); function submitForm() { //debugger; vm.submitCheck();
} function UpLoadClick() {
//var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 //if (ids.length != 1) { // $.modalAlertNew("WMS00050"); // return; //} $("#FileUp2").click(); }</script>
|