Commit 1ab14400 authored by 秦嘉's avatar 秦嘉

物料档案实现

parent 07f04081
...@@ -67,14 +67,6 @@ export function listEdit(query) { ...@@ -67,14 +67,6 @@ export function listEdit(query) {
}) })
} }
// 查询配置列表
export function listEditRules(query) {
return request({
url: '/nltmaterialeditrules/queryNltMaterialEditRuless',
method: 'get',
params: query
})
}
// 新增配置 // 新增配置
export function addEdit(data) { export function addEdit(data) {
......
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
</div> </div>
<el-input style="width: 90%" :maxlength="100" v-model.trim="item.totalDigits" placeholder="请输入总位数" /> <el-input style="width: 90%" :maxlength="100" v-model.trim="item.totalDigits" placeholder="请输入总位数" />
</el-form-item> </el-form-item>
<el-row class="rowMini" v-for="(item1, index1) in item.configurationRules"> <el-row class="rowMini" v-for="(item1, index1) in item.nltMaterialEditRules">
<el-form ref="form2" :rules="rules2" :model="form2" size="small" label-width="120px"> <el-form ref="form2" :rules="rules2" :model="form2" size="small" label-width="120px">
<el-col :span="9"> <el-col :span="9">
<el-form-item class="labelHeight" label="规则设置" prop="ruleByte"> <el-form-item class="labelHeight" label="规则设置" prop="ruleByte">
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-link v-if="index1 === 0" style="margin-top: 20px" type="primary" @click="addSNRule(item, index1)">增加一行</el-link> <el-link v-if="index1 === 0" style="margin-top: 20px" type="primary" @click="addSNRule(item, index)">增加一行</el-link>
<el-link v-if="index1 != 0" style="margin-top: 20px" type="primary" @click.prevent="delSNRule(item, index1)">删除</el-link> <el-link v-if="index1 != 0" style="margin-top: 20px" type="primary" @click.prevent="delSNRule(item, index1)">删除</el-link>
</el-col> </el-col>
</el-form> </el-form>
...@@ -237,7 +237,6 @@ import { ...@@ -237,7 +237,6 @@ import {
exportMater, exportMater,
getMaterial, getMaterial,
listEdit, listEdit,
listEditRules,
listMaterial, listMaterial,
updateMaterial updateMaterial
} from '@/api/material' } from '@/api/material'
...@@ -273,13 +272,7 @@ export default { ...@@ -273,13 +272,7 @@ export default {
// sn规则数据 // sn规则数据
snRulesList: [ snRulesList: [
{ {
totalDigits: '', nltMaterialEditRules: []
configurationRules: [
{
ruleByte: '',
rules: ''
}
]
} }
], ],
// 物料表数据 // 物料表数据
...@@ -291,9 +284,16 @@ export default { ...@@ -291,9 +284,16 @@ export default {
// 表单数据 // 表单数据
form: {}, form: {},
// 表单2数据 // 表单2数据
form1: {}, form1: {
totalDigits: '',
nltMaterialEditRules: [
{ruleByte: '', rules: ''}
]
},
// 表单3数据 // 表单3数据
form2: {}, form2: {
ruleByte: '', rules: ''
},
// 表单校验规则1 // 表单校验规则1
rules: {}, rules: {},
// 表单校验规则2 // 表单校验规则2
...@@ -388,26 +388,12 @@ export default { ...@@ -388,26 +388,12 @@ export default {
// 修改按钮 // 修改按钮
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset()
this.snRulesList = []
let tempList = []
this.rows = row this.rows = row
getMaterial(row.businessId).then(response => { getMaterial(row.businessId).then(response => {
this.form = response.data this.form = response.data
this.open = true this.open = true
listEdit({materId: row.businessId}).then(response => { this.getEditList(row)
tempList = response.data console.log(this.snRulesList)
tempList.forEach(item => {
item.configurationRules = [{ ruleByte: '', rules: '' }]
this.SNRule = item
listEditRules({editId: item.businessId}).then(response => {
item.configurationRules = response.data
if (item.configurationRules.length === 0) {
item.configurationRules.push({ruleByte: '', rules: ''})
}
this.snRulesList = tempList
})
})
})
}) })
}, },
// 状态修改方法 // 状态修改方法
...@@ -440,6 +426,17 @@ export default { ...@@ -440,6 +426,17 @@ export default {
this.Loading = false this.Loading = false
}) })
}, },
// 获取配置数据
getEditList(row) {
listEdit({materId: row.businessId}).then(response => {
this.snRulesList = response.data
this.snRulesList.forEach(item => {
if (item.nltMaterialEditRules.length === 0) {
item.nltMaterialEditRules = [{ruleByte: '', rules: ''}]
}
})
})
},
// 对话框取消按钮 // 对话框取消按钮
cancel() { cancel() {
this.open = false this.open = false
...@@ -464,86 +461,31 @@ export default { ...@@ -464,86 +461,31 @@ export default {
}, },
// 增加SN规则方法 // 增加SN规则方法
addSNRules() { addSNRules() {
this.form1 = { this.snRulesList.push(this.form1)
materId: this.rows.businessId this.form1 = {totalDigits: '',
} nltMaterialEditRules: [
addEdit(this.form1).then(response => { {ruleByte: '', rules: ''}
if (response.code === 200) { ]}
this.$message({
message: '新增成功',
type: 'success'
})
listEdit(this.form1).then(response => {
let tempList = response.data
tempList.forEach(item => {
item.configurationRules = [{ ruleByte: '', rules: '' }]
listEditRules({editId: item.businessId}).then(response => {
item.configurationRules = response.data
if (item.configurationRules.length === 0) {
item.configurationRules.push({ruleByte: '', rules: ''})
}
this.snRulesList = tempList
})
})
})
}
})
}, },
// 增加SN规则方法2 // 增加SN规则方法2
addSNRule(item, index) { addSNRule(item, index) {
this.form2 = { console.log(item,index)
editId: this.SNRule.businessId item.nltMaterialEditRules.push(this.form2)
}
addEditRules(this.form2).then(response => {
this.$message({
message: '新增成功',
type: 'success'
})
listEdit(this.form1).then(response => {
let tempList = response.data
tempList.forEach(item => {
item.configurationRules = [{ ruleByte: '', rules: '' }]
listEditRules({editId: item.businessId}).then(response => {
item.configurationRules = response.data
if (item.configurationRules.length === 0) {
item.configurationRules.push({ruleByte: '', rules: ''})
}
this.snRulesList = tempList
})
})
})
})
}, },
// 删除SN规则方法 // 删除SN规则方法
delSNRules(item, index) { delSNRules(item, index) {
this.$confirm('该规则即将删除,是否删除', '提示', { this.snRulesList.splice(index, 1)
confirmButtonText: '确定 Confirm',
cancelButtonText: '取消 Cancel',
cancelButtonClass: 'btn-custom-cancel',
customClass: 'confirmBtnSure',
type: 'warning'
}).then(() => {
this.snRulesList.splice(index, 1)
})
}, },
// 删除SN规则方法2 // 删除SN规则方法2
delSNRule(item, index1) { delSNRule(item, index1) {
console.log(index1) item.nltMaterialEditRules.splice(index1, 1)
this.$confirm('该规则即将删除,是否删除', '提示', {
confirmButtonText: '确定 Confirm',
cancelButtonText: '取消 Cancel',
cancelButtonClass: 'btn-custom-cancel',
customClass: 'confirmBtnSure',
type: 'warning'
}).then(() => {
item.configurationRules.splice(index1, 1)
})
}, },
// 重置表单 // 重置表单
reset() { reset() {
this.form = { this.form = {
softwareVer: undefined, softwareVer: undefined,
} }
this.snRulesList = []
this.resetForm('form') this.resetForm('form')
}, },
} }
......
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