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.
253 lines
9.6 KiB
253 lines
9.6 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="150px">
|
|
<el-row :gutter="24">
|
|
<el-col :span="8">
|
|
<el-form-item label="物料编码" prop="InvCode">
|
|
<el-input v-model="form.InvCode" size="mini" :disabled="true"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="物料名称" prop="InvName">
|
|
<el-input v-model="form.InvName" size="mini" :disabled="true"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
<el-row :gutter="24">
|
|
<el-col :span="8">
|
|
<el-form-item label="检验项目编码" prop="ListCode">
|
|
<el-input v-model="form.ListCode" size="mini" :disabled="true"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="检验项目名称" prop="ListName">
|
|
<el-input v-model="form.ListName" size="mini" ></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="24">
|
|
<el-col :span="8">
|
|
<el-form-item label="检验属性" prop="CheckAttr">
|
|
<el-select v-model="form.CheckAttr" placeholder="请选择" size="mini" :disabled="true">
|
|
<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="8">
|
|
<el-form-item label="检验方法" prop="EATTRIBUTE1">
|
|
<el-input v-model="form.EATTRIBUTE1" size="mini"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="24">
|
|
<el-col :span="8">
|
|
<el-form-item label="最大值" prop="SetValueMax">
|
|
<el-input-number v-model="form.SetValueMax" controls-position="right" :min="0" size="small"></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="最小值" prop="SetValueMin">
|
|
<el-input-number v-model="form.SetValueMin" controls-position="right" :min="0" size="small"></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
<el-row :gutter="24">
|
|
<el-col :span="8">
|
|
<el-form-item label="单位" prop="Unit">
|
|
<el-input v-model="form.Unit" size="mini"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<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-form>
|
|
</template>
|
|
</div>
|
|
</form>
|
|
|
|
<script type="text/javascript">
|
|
//const { Console } = require("node:console");
|
|
var vm = new Vue({
|
|
el: '#app',
|
|
data: {
|
|
id:'',
|
|
userCode: "",
|
|
ssList: [],
|
|
form: {},
|
|
rules: {
|
|
InvCode: [{ required: true, message: '请输入', trigger: 'blur' },],
|
|
RulesCode: [{ required: true, message: '请输入', trigger: 'blur' },],
|
|
|
|
},
|
|
disabled4RulesCode: false,
|
|
checkAttrList: [],//
|
|
},
|
|
//挂在DOM 触发
|
|
mounted() {
|
|
//let reactiveObject = {
|
|
// InvCode:'',
|
|
// RulesCode: '',
|
|
// RulesName: '',
|
|
// RulesDesc: '',
|
|
// Type: '',
|
|
// Enable: true,
|
|
|
|
//};
|
|
//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.getAllCheckAttr();
|
|
this.getData();
|
|
//this.getAllItem();
|
|
|
|
},
|
|
|
|
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);
|
|
});
|
|
},
|
|
getData() {
|
|
if (!this.id) return;
|
|
|
|
axios
|
|
.get('/BBWMS/IQCQuality/GetItem2CheckItem?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);
|
|
});
|
|
},
|
|
submitCheck() {
|
|
if (this.form.CheckAttr == "001") {
|
|
|
|
debugger;
|
|
if (!validateFormFields(
|
|
this.form,
|
|
["Unit", "SetValueMax", "SetValueMin"],
|
|
"当属性为尺寸时,最大值最小值单位必填"
|
|
)) {
|
|
return false;
|
|
}
|
|
//if (!this.form.Unit || !this.form.SetValueMax || !this.form.SetValueMin) {
|
|
// $.modalMsg("当属性为尺寸时,最大值最小值单位必填", "warning");
|
|
// return false;
|
|
//}
|
|
if (this.form.SetValueMax <= this.form.SetValueMin) {
|
|
$.modalMsg("下限必须小于上限", "warning");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.$refs['form'].validate((valid) => {
|
|
if (valid) {
|
|
//alert('submit!');
|
|
|
|
$.submitForm({
|
|
url: "/BBWMS/IQCQuality/SaveItem2CheckItemSingle",
|
|
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();
|
|
|
|
|
|
}
|
|
|
|
|
|
@** 验证表单字段是否为空
|
|
* @param { Object } form - 表单对象
|
|
* @param { Array } fields - 需要验证的字段名数组
|
|
* @param { String } errorMsg - 验证失败时显示的错误信息
|
|
* @returns { Boolean } - 验证是否通过 *@
|
|
function validateFormFields(form, fields, errorMsg) {
|
|
// 检查每个字段是否为空
|
|
for (const field of fields) {
|
|
const value = form[field];
|
|
if (value === null || value === undefined || value === "") {
|
|
$.modalMsg(errorMsg, "warning");
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
</script>
|