Commit c194e224 authored by 11528's avatar 11528

不良定义新增

parent 10cdac96
// 不良定义api
import request from '@/utils/request'
import Qs from "qs";
import Qs from 'qs'
// 分页查询列表
export function listBad(query) {
......
......@@ -68,7 +68,7 @@
>
<el-table-column type="selection" width="50" />
<el-table-column type="index" label="序号" width="50" />
<el-table-column align="center" prop="rejectCode" width="120" :show-overflow-tooltip="true">
<el-table-column align="center" prop="rejectCode" width="200" :show-overflow-tooltip="true">
<template slot="header">
<div>不良编号</div>
<div>Reject Code</div>
......@@ -77,7 +77,7 @@
{{ scope.row.rejectCode || '-' }}
</template>
</el-table-column>
<el-table-column align="center" prop="rejectDescription" width="200" :show-overflow-tooltip="true">
<el-table-column align="center" prop="rejectDescription" :show-overflow-tooltip="true">
<template slot="header">
<div>不良描述</div>
<div>Reject Description</div>
......@@ -95,15 +95,15 @@
{{ scope.row.positionName || '-' }}
</template>
</el-table-column>
<el-table-column align="center" prop="specificExplanation" :show-overflow-tooltip="true">
<template slot="header">
<div>具体解释</div>
<div>Specific Explanation</div>
</template>
<template slot-scope="scope">
{{ scope.row.specificExplanation || '-' }}
</template>
</el-table-column>
<!-- <el-table-column align="center" prop="specificExplanation" :show-overflow-tooltip="true">-->
<!-- <template slot="header">-->
<!-- <div>具体解释</div>-->
<!-- <div>Specific Explanation</div>-->
<!-- </template>-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.specificExplanation || '-' }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" width="100" prop="flag">
<template slot="header">
<div>状态</div>
......@@ -166,8 +166,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="labelHeight" label="工站" prop="Position">
<div slot="label" class="labelClass">
<el-form-item class="labelHeight" label="工站" prop="positionName">
<div slot="label" class="labelClassRequired">
<div class="labelName">工站</div>
<div class="labelName">Position</div>
</div>
......@@ -184,8 +184,8 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item class="labelHeight" label="不良描述" prop="phone">
<div slot="label" class="labelClass">
<el-form-item class="labelHeight" label="不良描述" prop="rejectDescription">
<div slot="label" class="labelClassRequired">
<div class="labelName">不良描述</div>
<div class="labelName">Reject Description</div>
</div>
......@@ -193,7 +193,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="labelHeight" label="状态" prop="email">
<el-form-item class="labelHeight" label="状态" prop="flag">
<div slot="label" class="labelClass">
<div class="labelName">状态</div>
<div class="labelName">Status</div>
......@@ -212,9 +212,9 @@
<div class="labelName">具体解释</div>
<div class="labelName">Specific Explanation</div>
</div>
<el-col v-for="(item, index) in form.specificExplanation" :key="item.specificExplanation" :span="18" style="width: 70%">
<el-col v-for="(item, index) in form.specificExplanations" :key="item" :span="18" style="width: 70%">
<el-input v-model="item.specificExplanation" placeholder="" style="width: 70%" />
<el-link v-if="form.specificExplanation.length > 1" style="width: 20%" @click.prevent="removeDomain(item,index)">删除</el-link>
<el-link v-if="form.specificExplanations.length > 1" type="primary" style="width: 20%" @click.prevent="removeDomain(item,index)">删除</el-link>
</el-col>
<el-col :span="6">
<el-link type="primary" @click="addDomain">增加一行</el-link>
......@@ -328,27 +328,25 @@ export default {
form: {
explanationId: '',
rejectCode: '',
position: '',
positionId: '',
rejectDescription: '',
flag: '',
specificExplanation: [
specificExplanations: [
{ specificExplanation: '' }
],
positionName: ''
positionName: '',
specificExplanation1: []
},
// 表单校验
rules: {
rejectCode: [
{ required: true, message: '请输入不良编号', trigger: 'blur' }
],
position: [
positionName: [
{ required: true, message: '请输入工站', trigger: 'blur' }
],
rejectDescription: [
{ required: true, message: '请输入不良描述', trigger: 'blur' }
],
specificExplanation: [
{ required: false, message: '请输入具体解释', trigger: 'blur' }
]
},
title: '',
......@@ -383,7 +381,7 @@ export default {
createBy: undefined,
updateBy: undefined,
remark: undefined,
specificExplanation: [
specificExplanations: [
{ specificExplanation: '' }
]
}
......@@ -479,13 +477,30 @@ export default {
}
})
} else {
addBad(this.form).then(response => {
console.log(this.form.specificExplanations)
this.form.specificExplanation1 = []
this.form.specificExplanations.forEach(item => {
if (this.form.specificExplanations.length < 1) {
this.form.specificExplanation1.push(item.specificExplanation)
} else {
this.form.specificExplanation1.push(item.specificExplanation)
}
})
console.log(this.form.specificExplanation1)
addBad({
rejectCode: this.form.rejectCode,
rejectDescription: this.form.rejectDescription,
flag: this.form.flag,
positionName: this.form.positionName,
specificExplanations: this.form.specificExplanation1
}).then(response => {
if (response.code === 200) {
this.$message({
message: '新增成功',
type: 'success'
})
this.open = false
this.openBad = false
this.reset()
this.getList()
}
})
......@@ -494,16 +509,16 @@ export default {
})
},
addDomain() {
this.form.specificExplanation.push({
specificExplanation: ''
})
this.form.specificExplanations.push(
{ specificExplanation: '' }
)
},
/** 新增弹窗的删除按钮 */
removeDomain(item, index) {
if (this.form.specificExplanation.length <= 1) {
if (this.form.specificExplanations.length <= 1) {
return false
}
this.form.specificExplanation.splice(index, 1)
this.form.specificExplanations.splice(index, 1)
}
}
}
......@@ -553,7 +568,7 @@ export default {
.badDialog{
.labelHeight{
.el-form-item__label{
height: 48px;
height: 40px;
}
}
.el-form-item--small .el-form-item__label{
......
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