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.
397 lines
16 KiB
397 lines
16 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="80px">
|
|
<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"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="检验属性" prop="EATTRIBUTE1" >
|
|
<el-select v-model="EATTRIBUTE1" placeholder="请选择" size="mini" v-on:change="change4EATTRIBUTE1">
|
|
<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-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>
|
|
<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-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">
|
|
<el-table ref="singleTable" highlight-current-row
|
|
:data="dataSource4Detail"
|
|
style="width: 100%"
|
|
stripe border
|
|
size="mini">
|
|
<el-table-column type="index" width="50"></el-table-column>
|
|
<el-table-column prop="ListCode" label="检验项目代码" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.ListCode" size="small"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="ListName" label="检验项目名称" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.ListName" size="small"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="EATTRIBUTE1" label="检验方法" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.EATTRIBUTE1" size="small"></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="Unit" label="单位" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input v-model="scope.row.Unit" size="small" :disabled="disabled4SetValue"></el-input>
|
|
</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" :disabled="disabled4SetValue"></el-input-number>
|
|
</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" :disabled="disabled4SetValue"></el-input-number>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="Enable" label="启用" width="140">
|
|
<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");
|
|
var vm = new Vue({
|
|
el: '#app',
|
|
data: {
|
|
id:'',
|
|
userCode: "",
|
|
ssList: [],
|
|
form: {},
|
|
detail: {
|
|
key:0,
|
|
SetValueMin: 0,
|
|
SetValueMax: 0,
|
|
SampleQuantity: 0,
|
|
EATTRIBUTE1: 0,
|
|
EATTRIBUTE2: 0,
|
|
EATTRIBUTE3: 0,
|
|
},
|
|
dataSource4Detail: [],//检验项目数据源
|
|
|
|
rules: {
|
|
RulesCode: [{ required: true, message: '请输入', trigger: 'blur' },],
|
|
RulesName: [{ required: true, message: '请输入', trigger: 'blur' },],
|
|
|
|
},
|
|
disabled4RulesCode: false,
|
|
disabled4SetValue: false,
|
|
itemCode: '',
|
|
//groupCode: '',
|
|
dataSource4Left: [],//物料数据源
|
|
checkAttrList: [],//
|
|
item2CheckGroup: {
|
|
EATTRIBUTE1:'',
|
|
ItemList: [],
|
|
CheckItemList:[],
|
|
},
|
|
selectItem4Item: null,
|
|
EATTRIBUTE1:''//检验属性
|
|
},
|
|
//挂在DOM 触发
|
|
mounted() {
|
|
let reactiveObject = {
|
|
RulesCode: '',
|
|
RulesName: '',
|
|
RulesDesc: '',
|
|
Type: '',
|
|
Enable: true,
|
|
DetailList: [],
|
|
};
|
|
this.form = reactiveObject;
|
|
|
|
// this.loadGrid();
|
|
// this.show();
|
|
this.id = '@ViewData["ids"]';
|
|
this.initControl();
|
|
this.getAllCheckAttr();
|
|
// console.log(this.id);
|
|
},
|
|
beforeDestroy() {
|
|
// this.autoScrol1(true);
|
|
|
|
},
|
|
methods: {
|
|
change4EATTRIBUTE1(val) {
|
|
// console.log(val);
|
|
let currentSelect = this.checkAttrList.filter(x => x.value == val)[0];
|
|
// console.log(currentSelect);
|
|
if (currentSelect)
|
|
this.disabled4SetValue = currentSelect.Ext1=="尺寸" ? false : true;
|
|
else {
|
|
this.disabled4SetValue = true;
|
|
}
|
|
},
|
|
getAllCheckAttr() {
|
|
axios
|
|
.get('/BBWMS/IQCQuality/GetSelectItemList?keyValue=CheckAttr')
|
|
.then(function (res) {
|
|
//debugger;
|
|
if (res.data) {
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.checkAttrList, i, el)
|
|
});
|
|
}
|
|
})
|
|
.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: '',
|
|
EATTRIBUTE1: '',
|
|
Unit: '',
|
|
SetValueMax: 0,
|
|
SetValueMin: 0,
|
|
Enable: true,
|
|
};
|
|
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.getAllItem();
|
|
//this.getAllAql();
|
|
},
|
|
getAllItem() {
|
|
axios
|
|
.get('/BBWMS/IQCQuality/GetAllItemList?code=' + this.itemCode.trim())
|
|
.then(function (res) {
|
|
//debugger;
|
|
if (res.data) {
|
|
res.data.forEach(function (el, i) {
|
|
Vue.set(vm.dataSource4Left, i, el)
|
|
});
|
|
}
|
|
})
|
|
.catch(function (error) { // 请求失败处理
|
|
alert(error);
|
|
});
|
|
},
|
|
getAllCheckGroup() {
|
|
//axios
|
|
// .get('/BBWMS/IQCQuality/GetAllCheckGroupList?code=' + this.groupCode.trim())
|
|
// .then(function (res) {
|
|
|
|
// if (res.data) {
|
|
// res.data.forEach(function (el, i) {
|
|
// Vue.set(vm.dataSource4Right, i, el)
|
|
// });
|
|
// }
|
|
// })
|
|
// .catch(function (error) { // 请求失败处理
|
|
// alert(error);
|
|
// });
|
|
},
|
|
getData() {
|
|
if (!this.id) return;
|
|
|
|
axios
|
|
.get('/BBWMS/IQCQuality/GetAql?keyValue=' + this.id)
|
|
.then(function (res) {
|
|
|
|
if (res.data) {
|
|
for (var i in res.data) {
|
|
Vue.set(vm.form, i, res.data[i]);
|
|
}
|
|
|
|
res.data.DetailList.forEach(function (el, i) {
|
|
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.dataSource4Left = this.dataSource4Left.filter(x => x.InvCode.includes(this.itemCode));
|
|
this.getAllItem();
|
|
}
|
|
//if (this.groupCode) {
|
|
// // this.dataSource4Right = this.dataSource4Right.filter(x => x.RulesCode.includes(this.groupCode));
|
|
// this.getAllCheckGroup();
|
|
//}
|
|
},
|
|
|
|
handleCurrentChange(val) {
|
|
this.selectItem4Item = val;
|
|
},
|
|
submitCheck() {
|
|
//console.log(this.multipleSelection);
|
|
//console.log(this.currentRow4Right);
|
|
debugger;
|
|
if (this.dataSource4Detail.length == 0) {
|
|
$.modalMsg("必须存在检验项目行", "warning");
|
|
return false;
|
|
}
|
|
|
|
if (!this.selectItem4Item) {
|
|
$.modalMsg("请选择物料行");
|
|
return false;
|
|
}
|
|
if (!this.EATTRIBUTE1) {
|
|
$.modalMsg("请选择检验属性");
|
|
return false;
|
|
}
|
|
|
|
for (var i = 0; i < this.dataSource4Detail.length; i++) {
|
|
let item = this.dataSource4Detail[i];
|
|
|
|
if (this.EATTRIBUTE1 == "001") {
|
|
if (!item.Unit || !item.SetValueMax || !item.SetValueMin) {
|
|
$.modalMsg("当属性为尺寸时,最大值最小值单位必填,行号 " + (i + 1), "warning");
|
|
return false;
|
|
}
|
|
if (item.SetValueMin >= item.SetValueMax) {
|
|
$.modalMsg("下限必须小于上限,行号 " + (i + 1), "warning");
|
|
return false;
|
|
}
|
|
}
|
|
else {
|
|
item.Unit = null;
|
|
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.CheckItemList = this.dataSource4Detail;
|
|
|
|
//if (this.item2CheckGroup.ItemList.length != 1 || this.item2CheckGroup.CheckItemList.length == 0) {
|
|
// $.modalMsg("必须选择物料行,检验类型行", "warning");
|
|
// return false;
|
|
//}
|
|
|
|
|
|
|
|
this.$refs['form'].validate((valid) => {
|
|
if (valid) {
|
|
//alert('submit!');
|
|
|
|
$.submitForm({
|
|
url: "/BBWMS/IQCQuality/SaveItem2CheckItem",
|
|
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>
|