Commit 2b298967 by lichengming

修改了编辑原始记录模板

parent 6a17b82b
......@@ -9,8 +9,8 @@
</Spin>
</div>
<div>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="80">
<Form-item label="类别" prop="classType">
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="95" inline class="inputBox">
<Form-item label="类别" prop="classType" style="width: 100%">
<!-- <Input v-model="formObj.classType" @on-keyup="_onKeyUp" name="classType" placeholder="请选择类别" icon="plus-circled"-->
<!-- ></Input>-->
<el-select v-model="formObj.classType" placeholder="请选择类别" size="small" clearable>
......@@ -18,11 +18,51 @@
:key="index"></el-option>
</el-select>
</Form-item>
<Form-item label="别名" prop="alias">
<Input v-model="formObj.alias" name="alias" placeholder="请输入别名"></Input>
<Form-item label="原始记录名称" prop="alias" style="width: 100%">
<Input v-model="formObj.alias" name="alias" placeholder="请输入原始记录名称"></Input>
</Form-item>
<Form-item label="项目代号" prop="remark">
<Input v-model="formObj.remark" name="remark" placeholder="请输入项目代号"></Input>
<Form-item label="备注" prop="remark" style="width: 100%">
<Input v-model="formObj.remark" name="remark" placeholder="请输入备注"></Input>
</Form-item>
<Form-item label="样品开始行" prop="sampleBeginRow" class="width-48">
<el-input
v-model="formObj.sampleBeginRow"
@keydown.native="channelInputLimit"
name="sampleBeginRow"
type="number"
onmousewheel="return false"
placeholder="请输入样品开始行"
/>
</Form-item>
<Form-item label="样品开始列" prop="sampleBeginCol" class="width-48">
<el-input
v-model="formObj.sampleBeginCol"
@keydown.native="channelInputLimit"
name="sampleBeginCol"
type="number"
onmousewheel="return false"
placeholder="请输入样品开始列"
/>
</Form-item>
<Form-item label="样品合并数" prop="sampleMergerNum" class="width-48">
<el-input
v-model="formObj.sampleMergerNum"
@keydown.native="channelInputLimit"
name="sampleMergerNum"
type="number"
onmousewheel="return false"
placeholder="请输入样品合并数"
/>
</Form-item>
<Form-item label="模板样品数" prop="templateSampleNum" class="width-48">
<el-input
v-model="formObj.templateSampleNum"
@keydown.native="channelInputLimit"
name="templateSampleNum"
type="number"
onmousewheel="return false"
placeholder="请输入模板样品数"
/>
</Form-item>
</Form>
</div>
......@@ -62,19 +102,82 @@ const defVal = {
alias: '',
classType: '',
remark: '',
sampleBeginRow: '',
sampleBeginCol: '',
sampleMergerNum: '',
templateSampleNum: '',
classifyId: 0
}
export default {
// components: { LmsTemplateClassifyZTree },
data() {
const validatesampleBeginRow = (rule, value, callback) => {
if (this.formObj.sampleBeginRow === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validatesampleMergerNum = (rule, value, callback) => {
if (this.formObj.sampleMergerNum === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validatetemplateSampleNum = (rule, value, callback) => {
if (this.formObj.templateSampleNum === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validatesampleBeginCol = (rule, value, callback) => {
if (this.formObj.sampleBeginCol === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
return {
modalTitle: '添加',
modalTitle: '编辑',
formObj: defVal,
ruleValidate: {
alias: [{ required: true, message: '别名不能为空', trigger: 'blur' }],
remark: [
{ required: true, message: '项目代号不能为空', trigger: 'blur' }
alias: [
{ required: true, message: '模板名称不能为空', trigger: 'blur' }
],
sampleBeginRow: [
{
required: true,
validator: validatesampleBeginRow,
message: '样品开始行不能为空',
trigger: 'blur'
}
],
sampleBeginCol: [
{
required: true,
validator: validatesampleBeginCol,
message: '样品开始列不能为空',
trigger: 'blur'
}
],
sampleMergerNum: [
{
required: true,
validator: validatesampleMergerNum,
message: '样品合并数不能为空',
trigger: 'blur'
}
],
templateSampleNum: [
{
required: true,
validator: validatetemplateSampleNum,
message: '模板样品数不能为空',
trigger: 'blur'
}
],
classType: [
{ required: true, message: '类别不能为空', trigger: 'blur' }
......@@ -82,10 +185,10 @@ export default {
},
typeList: [
{
value: '检定证书'
value: '力学'
},
{
value: '校准证书'
value: '物性'
}
],
id: '',
......@@ -102,11 +205,7 @@ export default {
},
methods: {
_onKeyUp() {
if (
this.formObj.alias === '' ||
this.formObj.classType === '' ||
this.formObj.remark === ''
) {
if (this.formObj.alias === '' || this.formObj.classType === '') {
this.isDisable = true
} else {
this.isDisable = false
......@@ -120,13 +219,32 @@ export default {
this.formObj.remark
}
},
channelInputLimit(e) {
const key = e.key
// 不允许输入'e'和'.'
if (key === 'e' || key === '.') {
e.returnValue = false
return false
}
return true
},
_selectZtree() {
// this.$refs.ztreeModal._openZtree()
},
_cancel() {
this.showEditModal = false
},
_ok: async function() {
_ok() {
this.$refs.formObj.validate(valid => {
console.log('valid', valid)
if (valid) {
this._editOk()
} else {
this.$Message.error('请输入必填值')
}
})
},
_editOk: async function() {
const result = await soilAptitude.originalTemplateEdit({
id: this.id,
formObj: this.formObj
......@@ -145,6 +263,10 @@ export default {
this.formObj.alias = data.alias
this.formObj.remark = data.remark
this.formObj.classType = data.classType
this.formObj.sampleBeginRow = data.sampleBeginRow
this.formObj.sampleBeginCol = data.sampleBeginCol
this.formObj.sampleMergerNum = data.sampleMergerNum
this.formObj.templateSampleNum = data.templateSampleNum
this.modalTitle = '编辑模板'
console.log(this.id)
},
......@@ -196,4 +318,11 @@ export default {
clear: both;
display: block;
}
.inputBox >>> input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
.inputBox >>> input[type='number'] {
-moz-appearance: textfield !important;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment