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.
745 lines
33 KiB
745 lines
33 KiB
|
|
@{
|
|
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" label-width="100px">
|
|
<el-divider>搜索区域</el-divider>
|
|
<el-row :gutter="24">
|
|
<el-col :span="6">
|
|
<el-form-item label="物料编码" prop="itemCode">
|
|
<el-input v-model="itemCode" size="mini" readonly></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
@*<el-col :span="6">
|
|
<el-form-item label="物料编码" prop="itemCode">
|
|
<el-autocomplete v-model="itemCode"
|
|
:fetch-suggestions="querySearch"
|
|
placeholder="请输入物料编码"
|
|
size="mini"
|
|
v-on:select="handleSelect"
|
|
clearable
|
|
:loading="loading"></el-autocomplete>
|
|
</el-form-item>
|
|
</el-col>*@
|
|
@*<el-col :span="6">
|
|
<button id="btn_search" type="button" class="btn btn-primary" v-on:click="query()">
|
|
<i class="fa fa-search"></i>查询物料
|
|
</button>
|
|
</el-col>*@
|
|
<el-col :span="6">
|
|
<el-form-item label="类型" prop="EATTRIBUTE1">
|
|
<el-select v-model="EATTRIBUTE1" placeholder="请选择" size="mini">
|
|
<el-option v-for="item in checkAttrList"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="检验项目组" prop="GroupCode">
|
|
<el-select v-model="GroupCode" placeholder="请选择" size="mini" v-on:change="queryGroupList()">
|
|
<el-option v-for="item in checkGroupCode"
|
|
:key="item.Code"
|
|
:label="item.Name"
|
|
:value="item.Code">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-divider>选择区域</el-divider>
|
|
|
|
<el-row :gutter="24">
|
|
<el-col :span="24">
|
|
<el-table ref="dataSource4Left" highlight-current-row
|
|
:data="dataSource4Left"
|
|
style="width: 100%"
|
|
stripe border
|
|
size="mini"
|
|
height="200"
|
|
v-on:current-change="handleCurrentChange">
|
|
<el-table-column type="index" width="50"></el-table-column>
|
|
<el-table-column prop="InvCode" label="料品编码" width="140">
|
|
</el-table-column>
|
|
<el-table-column prop="InvName" label="料品名称" width="140">
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
<el-row :gutter="24">
|
|
<el-col :span="24">
|
|
<a id="NF-Add" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="addLine()"><i class="fa fa-pencil-square-o"></i>新增</a>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-table ref="singleTable" highlight-current-row
|
|
:data="dataSource4Detail"
|
|
style="width: 100%"
|
|
stripe border
|
|
size="mini"
|
|
height="500">
|
|
@*v-on:current-change="handleCurrentChange"*@
|
|
<el-table-column prop="EATTRIBUTE6" label="检验类型" width="140">
|
|
<template slot-scope="scope">
|
|
<el-select v-model="scope.row.EATTRIBUTE6" placeholder="请选择" size="mini">
|
|
<el-option v-for="item in dataSourceType"
|
|
:key="item.Code"
|
|
:label="item.Name"
|
|
:value="item.Code">
|
|
</el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
@*<el-table-column type="index" width="50"></el-table-column>*@
|
|
<el-table-column prop="ListCode" label="检验项目代码" width="140">
|
|
<template slot-scope="scope">
|
|
<el-select v-model="scope.row.ListCode" placeholder="请选择" size="mini"
|
|
v-on:change="(val) => ListCodeChange(val, scope.$index)">
|
|
<el-option v-for="item in dataSourceListCode"
|
|
:key="item.Code"
|
|
:label="item.Name"
|
|
:value="item.Code">
|
|
</el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="ListName" label="检验项目名称" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.ListName" controls-position="right" size="small" disabled="disabled"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="SetValueMin" label="标准下限" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input-number v-model="scope.row.SetValueMin" controls-position="right" :min="0" size="small"></el-input-number>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="SetValueMax" label="标准上限" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input-number v-model="scope.row.SetValueMax" controls-position="right" :min="0" size="small"></el-input-number>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="Unit" label="单位" width="140">
|
|
<template slot-scope="scope">
|
|
<el-select v-model="scope.row.Unit" placeholder="请选择" size="mini">
|
|
<el-option v-for="item in dataSourceUom"
|
|
:key="item.Name"
|
|
:label="item.Name"
|
|
:value="item.Name">
|
|
</el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="EATTRIBUTE7" label="检验仪器" width="140">
|
|
<template slot-scope="scope">
|
|
<el-select v-model="scope.row.EATTRIBUTE7" placeholder="请选择" size="mini">
|
|
<el-option v-for="item in dataSourceDevice"
|
|
:key="item.Name"
|
|
:label="item.Name"
|
|
:value="item.Name">
|
|
</el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="EATTRIBUTE1" label="检验标准" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.EATTRIBUTE1" controls-position="right" size="small"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
@*<el-table-column prop="EATTRIBUTE2" label="抽样水准" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.EATTRIBUTE2" controls-position="right" size="small"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="EATTRIBUTE3" label="允收标准" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.EATTRIBUTE3" controls-position="right" size="small"></el-input>
|
|
</template>
|
|
</el-table-column>*@
|
|
<el-table-column prop="EATTRIBUTE4" label="检验实际值是否必填" width="150">
|
|
<template slot-scope="scope">
|
|
<el-switch v-model="scope.row.EATTRIBUTE4" active-color="#13ce66" inactive-color="#ff4949">
|
|
</el-switch>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="EATTRIBUTE5" label="AQL代码" width="140">
|
|
<template slot-scope="scope">
|
|
<el-select v-model="scope.row.EATTRIBUTE5" placeholder="请选择" size="mini">
|
|
<el-option v-for="item in dataSourceAql"
|
|
:key="item.Code"
|
|
:label="item.Name"
|
|
:value="item.Code">
|
|
</el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="Enable" label="启用" width="150">
|
|
<template slot-scope="scope">
|
|
<el-switch v-model="scope.row.Enable" active-color="#13ce66" inactive-color="#ff4949">
|
|
</el-switch>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作">
|
|
<template slot-scope="scope">
|
|
<a id="NF-Delete" authorize="yes" class="btn btn-primary" v-on:click="handleDelete(scope.$index, scope.row)"><i class="fa fa-trash-o"></i>删除</a>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
</el-form>
|
|
</template>
|
|
</div>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
//const { Console } = require("node:console");
|
|
debugger;
|
|
var selectInvCode = $.request("INVCode");
|
|
var selectCheckAttr = "";
|
|
var selectCheckGroupCode = "";
|
|
var vm = new Vue({
|
|
el: '#app',
|
|
data: {
|
|
id:'',
|
|
userCode: "",
|
|
ssList: [],
|
|
dataSourceType: [],
|
|
dataSourceAql: [],
|
|
dataSourceListCode: [],
|
|
dataSourceUom: [],
|
|
dataSourceDevice: [],
|
|
form: {},
|
|
detail: {
|
|
key: 0,
|
|
ListCode: '',
|
|
ListNAme: '',
|
|
SetValueMin: 0,
|
|
SetValueMax: 0,
|
|
SampleQuantity: 0,
|
|
Unit: '',
|
|
Enable: true,
|
|
EATTRIBUTE1: '',
|
|
EATTRIBUTE2: '',
|
|
EATTRIBUTE3: '',
|
|
EATTRIBUTE4: '',
|
|
EATTRIBUTE5: '',
|
|
EATTRIBUTE6: '',
|
|
},
|
|
dataSource4Detail: [],//检验项目数据源
|
|
rules: {
|
|
RulesCode: [{ required: true, message: '请输入', trigger: 'blur' },],
|
|
RulesName: [{ required: true, message: '请输入', trigger: 'blur' },],
|
|
|
|
},
|
|
disabled4RulesCode: false,
|
|
disabled4SetValue: false,
|
|
itemCode: selectInvCode,
|
|
loading: false,
|
|
GroupCode: '',
|
|
GroupCodeName: '', // 新增:存储检验项目组名称
|
|
dataSource4Left: [],//物料数据源
|
|
checkAttrList: [],//
|
|
checkGroupCode: [],//
|
|
item2CheckGroup: {
|
|
EATTRIBUTE1: '',
|
|
GroupCode:'',
|
|
ItemList: [],
|
|
CheckItemList:[],
|
|
},
|
|
selectItem4Item: null,
|
|
EATTRIBUTE1:''//检验属性
|
|
},
|
|
//挂在DOM 触发
|
|
mounted() {
|
|
let reactiveObject = {
|
|
GroupCode: '',
|
|
EATTRIBUTE1: '',
|
|
Type: '',
|
|
Enable: true,
|
|
DetailList: [],
|
|
};
|
|
this.form = reactiveObject;
|
|
Promise.all([
|
|
this.getAllCheckAttrPromise(), // 转为Promise版
|
|
this.getAllCheckGroupPromise() // 转为Promise版
|
|
]).then(() => {
|
|
// 数据源加载完成后,再调用GetEditData获取默认值
|
|
this.GetEditData().then(() => {
|
|
// 赋值完成后,触发检验项目组的change事件(加载对应数据)
|
|
this.queryGroupList();
|
|
});
|
|
});
|
|
// this.loadGrid();
|
|
// this.show();
|
|
this.id = '@ViewData["ids"]';
|
|
this.GetEditData();
|
|
this.initControl();
|
|
this.getType();
|
|
this.getListCode();
|
|
this.getUom();
|
|
this.getDevice();
|
|
this.getAllItem();
|
|
// console.log(this.id);
|
|
},
|
|
beforeDestroy() {
|
|
},
|
|
methods: {
|
|
getAllCheckAttrPromise() {
|
|
return new Promise((resolve, reject) => {
|
|
axios
|
|
.get('/DHAY/IQCQuality/GetSelectItemList?keyValue=InspectionGroupType')
|
|
.then(function (res) {
|
|
if (res.data) {
|
|
vm.checkAttrList = []; // 先清空,避免数据叠加
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.checkAttrList, i, el);
|
|
});
|
|
}
|
|
resolve(); // 数据源加载完成, resolve
|
|
})
|
|
.catch(function (error) {
|
|
alert(error);
|
|
reject(error);
|
|
});
|
|
});
|
|
},
|
|
getAllCheckGroupPromise() {
|
|
return new Promise((resolve, reject) => {
|
|
axios
|
|
.get('/DHAY/IQCQuality/GetSelectCheckGroup')
|
|
.then(function (res) {
|
|
if (res.data) {
|
|
vm.checkGroupCode = []; // 先清空,避免数据叠加
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.checkGroupCode, i, el);
|
|
});
|
|
}
|
|
resolve(); // 数据源加载完成, resolve
|
|
})
|
|
.catch(function (error) {
|
|
alert(error);
|
|
reject(error);
|
|
});
|
|
});
|
|
},
|
|
getListCode() {
|
|
axios
|
|
.get('/WMS/BasicSettings/GetInspectListCode')
|
|
.then(function (res) {
|
|
|
|
if (res.data) {
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.dataSourceListCode, i, el)
|
|
});
|
|
}
|
|
})
|
|
.catch(function (error) { // 请求失败处理
|
|
alert(error);
|
|
});
|
|
},
|
|
getUom() {
|
|
axios
|
|
.get('/WMS/BasicSettings/GetUom')
|
|
.then(function (res) {
|
|
|
|
if (res.data) {
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.dataSourceUom, i, el)
|
|
});
|
|
}
|
|
})
|
|
.catch(function (error) { // 请求失败处理
|
|
alert(error);
|
|
});
|
|
},
|
|
getDevice() {
|
|
axios
|
|
.get('/WMS/BasicSettings/GetDevice')
|
|
.then(function (res) {
|
|
|
|
if (res.data) {
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.dataSourceDevice, i, el)
|
|
});
|
|
}
|
|
})
|
|
.catch(function (error) { // 请求失败处理
|
|
alert(error);
|
|
});
|
|
},
|
|
ListCodeChange(val, index) {
|
|
// 如果未选择值则清空名称
|
|
if (!val) {
|
|
this.dataSource4Detail[index].ListName = '';
|
|
return;
|
|
}
|
|
|
|
axios
|
|
.get('/WMS/BasicSettings/GetListName?ListCode=' + val)
|
|
.then(function (res) {
|
|
if (res.data && res.data[0].ListName) {
|
|
// 填充当前行的检验项目名称
|
|
vm.dataSource4Detail[index].ListName = res.data[0].ListName;
|
|
} else {
|
|
// 未找到对应名称时清空
|
|
vm.dataSource4Detail[index].ListName = '';
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
alert('获取检验项目名称失败:' + error);
|
|
});
|
|
},
|
|
addLine() {
|
|
//debugger;
|
|
// console.log('new line');
|
|
let key = 1;
|
|
let maxObj = this.dataSource4Detail.sort((a, b) => b.key - a.key)[0];
|
|
if (maxObj != null) {
|
|
key = maxObj.key + 1;
|
|
}
|
|
let obj = {
|
|
key: key,
|
|
ListCode: '',
|
|
ListNAme: '',
|
|
SetValueMin: 0,
|
|
SetValueMax: 0,
|
|
SampleQuantity: 0,
|
|
Unit: '',
|
|
Enable: true,
|
|
EATTRIBUTE1: '',
|
|
EATTRIBUTE2: '',
|
|
EATTRIBUTE3: '',
|
|
EATTRIBUTE4: true,
|
|
EATTRIBUTE5: '',
|
|
EATTRIBUTE6: '',
|
|
};
|
|
this.dataSource4Detail.push(obj);
|
|
|
|
},
|
|
//删除行
|
|
handleDelete(index, row) {
|
|
// console.log(index, row);
|
|
this.dataSource4Detail = this.dataSource4Detail.filter(x => x.key != row.key);
|
|
},
|
|
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.getData();
|
|
this.getAql();
|
|
},
|
|
GetEditData() {
|
|
return new Promise((resolve, reject) => {
|
|
axios
|
|
.get('/DHAY/IQCQuality/GetEditInfoData?code=' + selectInvCode)
|
|
.then(function (res) {
|
|
// debugger;
|
|
if (res.data && res.data.length > 0) { // 确保有数据
|
|
const editData = res.data[0];
|
|
// 直接赋值给Vue实例的属性(同步到下拉框)
|
|
vm.EATTRIBUTE1 = editData.CheckAttr; // 赋值给“类型”下拉
|
|
vm.GroupCode = editData.GroupCode; // 赋值给“检验项目组”下拉
|
|
|
|
// (可选)更新全局变量(如果其他地方用到)
|
|
selectCheckAttr = editData.CheckAttr;
|
|
selectCheckGroupCode = editData.GroupCode;
|
|
}
|
|
resolve(); // 赋值完成, resolve
|
|
})
|
|
.catch(function (error) {
|
|
alert(error);
|
|
reject(error);
|
|
});
|
|
});
|
|
},
|
|
getAllItem() {
|
|
axios
|
|
.get('/DHAY/IQCQuality/GetEditItemList?code=' + selectInvCode)
|
|
.then(function (res) {
|
|
//debugger;
|
|
if (res.data) {
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.dataSource4Left, i, el)
|
|
});
|
|
}
|
|
})
|
|
.catch(function (error) { // 请求失败处理
|
|
alert(error);
|
|
});
|
|
},
|
|
querySearch(queryString, cb) {
|
|
if (!queryString) {
|
|
cb([]);
|
|
return;
|
|
}
|
|
|
|
this.loading = true;
|
|
|
|
// 调用接口获取数据
|
|
axios
|
|
.get('/DHAY/IQCQuality/GetItemCodeSearch?ItemCode=' + this.itemCode.trim())
|
|
.then(response => {
|
|
this.loading = false;
|
|
const results = response.data.map(item => ({
|
|
value: item.InvCode,
|
|
label: `${item.InvCode} - ${item.InvName}`,
|
|
...item
|
|
}));
|
|
cb(results);
|
|
}).catch(error => {
|
|
this.loading = false;
|
|
console.error('获取物料数据失败', error);
|
|
cb([]);
|
|
});
|
|
},
|
|
|
|
// 处理选择事件
|
|
handleSelect(item) {
|
|
this.itemCode = item.value;
|
|
// 可以在这里自动触发查询
|
|
this.query();
|
|
},
|
|
getAllCheckGroupList(GroupCode, INVCode) {
|
|
vm.dataSource4Detail = [];
|
|
axios
|
|
.get('/DHAY/IQCQuality/GetEditCheckGroupList?code=' + GroupCode + '&INVCode=' + INVCode)
|
|
.then(function (res) {
|
|
if (res.data && Array.isArray(res.data)) { // 确保是数组
|
|
res.data.forEach(function (el, i) {
|
|
// 1. 处理EATTRIBUTE4的布尔值转换
|
|
if (el.EATTRIBUTE4 === "true") {
|
|
el.EATTRIBUTE4 = true;
|
|
} else if (el.EATTRIBUTE4 === "false") {
|
|
el.EATTRIBUTE4 = false;
|
|
}
|
|
// 2. 为每行添加唯一key(使用索引+i确保唯一,也可根据后端唯一ID生成)
|
|
el.key = i + 1; // 关键:生成唯一key
|
|
// 3. 赋值到数据源
|
|
Vue.set(vm.dataSource4Detail, i, el);
|
|
});
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
alert(error);
|
|
});
|
|
},
|
|
getType() {
|
|
axios
|
|
.get('/WMS/BasicSettings/GetICSType?Type=EATTRIBUTE6&TableCode=ICSInspectionList')
|
|
.then(function (res) {
|
|
|
|
if (res.data) {
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.dataSourceType, i, el)
|
|
});
|
|
}
|
|
})
|
|
.catch(function (error) { // 请求失败处理
|
|
alert(error);
|
|
});
|
|
},
|
|
getAql() {
|
|
axios
|
|
.get('/DHAY/IQCQuality/GetICSAql')
|
|
.then(function (res) {
|
|
|
|
if (res.data && Array.isArray(res.data)) {
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.dataSourceAql, i, el);
|
|
});
|
|
}
|
|
//if (res.data) {
|
|
// debugger;
|
|
// for (var i in res.data) {
|
|
|
|
// Vue.set(vm.dataSourceAql, i, res.data[i])
|
|
// }
|
|
// //res.data.forEach(function (el, i) {
|
|
// // Vue.set(vm.dataSourceAql, i, el)
|
|
// //});
|
|
//}
|
|
})
|
|
.catch(function (error) { // 请求失败处理
|
|
alert(error);
|
|
});
|
|
},
|
|
getData() {
|
|
if (!this.id) return;
|
|
|
|
axios
|
|
.get('/DHAY/IQCQuality/GetAql?keyValue=' + this.id)
|
|
.then(function (res) {
|
|
|
|
debugger;
|
|
if (res.data) {
|
|
for (var i in res.data) {
|
|
Vue.set(vm.form, i, res.data[i]);
|
|
}
|
|
|
|
res.data.DetailList.forEach(function (el, i) {
|
|
debugger;
|
|
if (el.EATTRIBUTE4 == "true") {
|
|
el.EATTRIBUTE4 = true;
|
|
}
|
|
Vue.set(vm.dataSource4Detail, i, el)
|
|
|
|
});
|
|
}
|
|
})
|
|
.catch(function (error) { // 请求失败处理
|
|
alert(error);
|
|
});
|
|
},
|
|
query() {
|
|
//debugger;
|
|
this.itemCode = this.itemCode.trim();
|
|
this.GroupCode = this.GroupCode.trim();
|
|
if (this.itemCode) {
|
|
this.getAllItem();
|
|
}
|
|
},
|
|
queryGroupList() {
|
|
debugger;
|
|
var GroupCode = this.GroupCode.trim();
|
|
if (this.GroupCode) {
|
|
// 【新增:根据 GroupCode 匹配对应的 Name】
|
|
const selectedGroup = this.checkGroupCode.find(item => item.Code === GroupCode);
|
|
if (selectedGroup) {
|
|
this.GroupCodeName = selectedGroup.Name; // 保存选中的检验项目组名称
|
|
} else {
|
|
this.GroupCodeName = ''; // 未找到时清空
|
|
}
|
|
this.getAllCheckGroupList(GroupCode);
|
|
}
|
|
var INVCode = this.itemCode.trim();
|
|
if (this.GroupCode) {
|
|
this.getAllCheckGroupList(GroupCode, INVCode);
|
|
}
|
|
},
|
|
|
|
handleCurrentChange(val) {
|
|
this.selectItem4Item = val;
|
|
},
|
|
submitCheck() {
|
|
//console.log(this.multipleSelection);
|
|
//console.log(this.currentRow4Right);
|
|
debugger;
|
|
if (this.dataSource4Left.length === 1) {
|
|
this.selectItem4Item = this.dataSource4Left[0]; // 自动选中唯一行
|
|
}
|
|
if (this.dataSource4Detail.length == 0) {
|
|
$.modalMsg("必须存在检验项目行", "warning");
|
|
return false;
|
|
}
|
|
|
|
if (!this.selectItem4Item) {
|
|
$.modalMsg("请选择物料行");
|
|
return false;
|
|
}
|
|
if (!this.EATTRIBUTE1) {
|
|
$.modalMsg("请选择检验属性");
|
|
return false;
|
|
}
|
|
if (!this.GroupCode) {
|
|
$.modalMsg("请选择检验项目组");
|
|
return false;
|
|
}
|
|
|
|
for (var i = 0; i < this.dataSource4Detail.length; i++) {
|
|
let item = this.dataSource4Detail[i];
|
|
if (item.EATTRIBUTE6 == '') {
|
|
$.modalMsg("第" + (i + 1) + "行检验类型不能为空!", "warning");
|
|
return false;
|
|
}
|
|
if (item.ListCode == '') {
|
|
$.modalMsg("第" + (i + 1) + "行检验项目代码不能为空!", "warning");
|
|
return false;
|
|
}
|
|
if (item.EATTRIBUTE6 == "Size") {
|
|
if (!item.SetValueMax || !item.SetValueMin) {
|
|
$.modalMsg("当属性为定量时,最大值最小值单位必填,行号 " + (i + 1), "warning");
|
|
return false;
|
|
}
|
|
if (item.Unit == '' || item.EATTRIBUTE7 == '') {
|
|
$.modalMsg("当属性为定量时,单位与检验仪器必填,行号 " + (i + 1), "warning");
|
|
return false;
|
|
}
|
|
if (item.SetValueMin >= item.SetValueMax) {
|
|
$.modalMsg("下限必须小于上限,行号 " + (i + 1), "warning");
|
|
return false;
|
|
}
|
|
}
|
|
else {
|
|
|
|
item.SetValueMax = null;
|
|
item.SetValueMin = null;
|
|
}
|
|
item.InvCode = this.selectItem4Item.InvCode;
|
|
item.InvName = this.selectItem4Item.InvName;
|
|
item.CheckAttr = this.EATTRIBUTE1;
|
|
}
|
|
|
|
|
|
//this.item2CheckGroup.ItemList = [this.selectItem4Item];
|
|
this.item2CheckGroup.GroupCodeName = this.GroupCodeName; // 关键:添加名称字段
|
|
this.item2CheckGroup.CheckItemList = this.dataSource4Detail;
|
|
this.item2CheckGroup.GroupCode = this.GroupCode;
|
|
//if (this.item2CheckGroup.ItemList.length != 1 || this.item2CheckGroup.CheckItemList.length == 0) {
|
|
// $.modalMsg("必须选择物料行,检验类型行", "warning");
|
|
// return false;
|
|
//}
|
|
|
|
|
|
|
|
this.$refs['form'].validate((valid) => {
|
|
debugger;
|
|
if (valid) {
|
|
//alert('submit!');
|
|
|
|
$.submitForm({
|
|
url: "/DHAY/IQCQuality/UpdateItem2CheckItem",
|
|
param: { keyValue: JSON.stringify(this.item2CheckGroup) },
|
|
success: function () {
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
})
|
|
|
|
} else {
|
|
console.log('error submit!!');
|
|
return false;
|
|
}
|
|
});
|
|
// console.log(result);
|
|
},
|
|
},
|
|
});
|
|
function submitForm() {
|
|
//debugger;
|
|
vm.submitCheck();
|
|
|
|
|
|
}
|
|
</script>
|