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.
322 lines
14 KiB
322 lines
14 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" :rules="rules" label-width="80px">
|
|
<el-divider>主表信息</el-divider>
|
|
<el-row :gutter="24">
|
|
<el-col :span="6">
|
|
<el-form-item label="Aql编码" prop="RulesCode">
|
|
<el-input v-model="form.RulesCode" placeholder="请输入内容" size="mini" :disabled="disabled4RulesCode"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="Aql名称" prop="RulesName">
|
|
<el-input v-model="form.RulesName" placeholder="请输入内容" size="mini"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="Aql描述" prop="RulesDesc">
|
|
<el-input v-model="form.RulesDesc" placeholder="请输入内容" size="mini"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="Aql类别" prop="Type">
|
|
<el-input v-model="form.Type" placeholder="请输入内容" size="mini"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="24">
|
|
<el-col :span="6">
|
|
<el-form-item label="启用" prop="Enable">
|
|
<el-switch v-model="form.Enable" active-color="#13ce66" inactive-color="#ff4949">
|
|
</el-switch>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-divider>子表信息</el-divider>
|
|
<el-row :gutter="24">
|
|
<el-col :span="24">
|
|
@*<el-button type="primary" size="mini" v-on:click="addLine()">新增</el-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-row :gutter="24">
|
|
<el-col :span="2">
|
|
|
|
</el-col>
|
|
<el-col :span="22">
|
|
<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 type="index" width="50"></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="SampleQuantity" label="取样数量" width="140">
|
|
<template slot-scope="scope">
|
|
<el-input-number v-model="scope.row.SampleQuantity" controls-position="right" :min="0" size="small"></el-input-number>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="EATTRIBUTE1" label="允收数量" width="150">
|
|
<template slot-scope="scope">
|
|
<el-input-number v-model="scope.row.EATTRIBUTE1" controls-position="right" :min="0" size="small"></el-input-number>
|
|
</template>
|
|
</el-table-column>
|
|
@*<el-table-column prop="EATTRIBUTE2" label="允许不良数(主要)" width="150">
|
|
<template slot-scope="scope">
|
|
<el-input-number v-model="scope.row.EATTRIBUTE2" controls-position="right" :min="0" size="small"></el-input-number>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="EATTRIBUTE3" label="允许不良数(次要)" width="150">
|
|
<template slot-scope="scope">
|
|
<el-input-number v-model="scope.row.EATTRIBUTE3" controls-position="right" :min="0" size="small"></el-input-number>
|
|
</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>
|
|
@*<el-button size="mini" type="danger" v-on:click="handleDelete(scope.$index, scope.row)">删除</el-button>*@
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-col>
|
|
<el-col :span="2">
|
|
|
|
</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: [],
|
|
currentRow: null,
|
|
rules: {
|
|
RulesCode: [{ required: true, message: '请输入', trigger: 'blur' },],
|
|
RulesName: [{ required: true, message: '请输入', trigger: 'blur' },],
|
|
|
|
},
|
|
disabled4RulesCode:false,
|
|
},
|
|
//挂在DOM 触发
|
|
mounted() {
|
|
let reactiveObject = {
|
|
RulesCode: '',
|
|
RulesName: '',
|
|
RulesDesc: '',
|
|
Type: '',
|
|
Enable: true,
|
|
DetailList: [],
|
|
};
|
|
this.form = reactiveObject;
|
|
|
|
// this.loadGrid();
|
|
// this.show();
|
|
this.id = '@ViewData["ids"]';
|
|
this.initControl();
|
|
// console.log(this.id);
|
|
},
|
|
beforeDestroy() {
|
|
// this.autoScrol1(true);
|
|
|
|
},
|
|
methods: {
|
|
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();
|
|
},
|
|
getData() {
|
|
if (!this.id) return;
|
|
|
|
axios
|
|
.get('/BBWMS/IQCQuality/GetAql?keyValue=' + this.id)
|
|
.then(function (res) {
|
|
// console.log(res.data);
|
|
//this.ssList = res.data;
|
|
//if (res.data != null) {
|
|
// res.data.forEach(function (el, i) {
|
|
// Vue.set(vm.ssList, i, el)
|
|
// });
|
|
//}
|
|
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) {
|
|
Vue.set(vm.dataSource4Detail, 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,
|
|
SetValueMin: 0,
|
|
SetValueMax: 0,
|
|
SampleQuantity: 0,
|
|
EATTRIBUTE1: '',
|
|
EATTRIBUTE2: '',
|
|
EATTRIBUTE3: '',
|
|
};
|
|
this.dataSource4Detail.push(obj );
|
|
|
|
},
|
|
//删除行
|
|
handleDelete(index, row) {
|
|
// console.log(index, row);
|
|
this.dataSource4Detail = this.dataSource4Detail.filter(x => x.key != row.key);
|
|
},
|
|
//选中行变化
|
|
handleCurrentChange(val) {
|
|
this.currentRow = val;
|
|
// console.log(val);
|
|
},
|
|
submitCheck() {
|
|
// debugger;
|
|
this.dataSource4Detail = this.dataSource4Detail.sort((a, b) => a.SetValueMin - b.SetValueMin);
|
|
if (this.dataSource4Detail.length == 0) {
|
|
$.modalMsg("必须存在规则信息行", "warning");
|
|
return false;
|
|
}
|
|
|
|
let allNum = [];
|
|
//debugger;
|
|
for (var i = 0; i < this.dataSource4Detail.length; i++) {
|
|
let item = this.dataSource4Detail[i];
|
|
if (item.SetValueMin >= item.SetValueMax) {
|
|
$.modalMsg("下限必须小于上限,行号 "+(i+1), "warning");
|
|
return false;
|
|
}
|
|
allNum.push(item.SetValueMin);
|
|
allNum.push(item.SetValueMax);
|
|
}
|
|
|
|
|
|
for (var i = 0; i < allNum.length; i++) {
|
|
if (i == 0) {
|
|
continue;
|
|
}
|
|
if (i <= allNum.length - 1) {
|
|
if (allNum[i - 1] >= allNum[i]) {
|
|
$.modalMsg("区间范围重复,重复值: " + allNum[i - 1], "warning");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
this.form.DetailList = this.dataSource4Detail;
|
|
this.$refs['form'].validate((valid) => {
|
|
if (valid) {
|
|
//alert('submit!');
|
|
|
|
$.submitForm({
|
|
url: "/BBWMS/IQCQuality/SaveAql",
|
|
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();
|
|
|
|
//if (!$('#form1').formValid()) {
|
|
// $.modalMsg("验证未通过", "warning");
|
|
// return false;
|
|
//}
|
|
|
|
//let obj = {
|
|
// CheckFixtureNo: $("#F_CheckFixtureNo").val(),
|
|
// CheckFixtureName: $("#F_CheckFixtureName").val(),
|
|
// CustomerItemCode: $("#F_CustomerItemCode").val(),
|
|
// ID: $("#ids").val(),
|
|
// Useage: $("#F_Useage").val(),
|
|
// Unit: $("#F_Unit").val(),
|
|
// Remark: $("#F_Remark").val(),
|
|
// Std: $("#F_Std").val(),
|
|
//};
|
|
////if (!obj.line) {
|
|
//// return false;
|
|
////}
|
|
//if (!obj.CheckFixtureNo) {
|
|
// return false;
|
|
//}
|
|
|
|
//$.submitForm({
|
|
// url: "/BBWMS/CheckingFixture/SaveCheckingFixture",
|
|
// param: { keyValue: JSON.stringify(obj) },
|
|
// success: function () {
|
|
// $.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
// }
|
|
//})
|
|
}
|
|
</script>
|