Commit d9d2d050 authored by 秦嘉's avatar 秦嘉

物料

parent 4f8be43f
......@@ -37,13 +37,12 @@ export function changeStaStatus(data) {
// 修改物料表
export function updateMaterial(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/nltifsmaterial/update/' + businessId,
method: 'put',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Type': 'application/json'
}
})
}
......@@ -58,38 +57,6 @@ export function exportMater(query) {
})
}
// 查询配置列表
export function listEdit(query) {
return request({
url: '/nltmaterialedit/queryNltMaterialEdits',
method: 'get',
params: query
})
}
// 新增配置
export function addEdit(data) {
data = Qs.stringify(data)
return request({
url: '/nltmaterialedit/add',
method: 'post',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
// 新增配置规则
export function addEditRules(data) {
data = Qs.stringify(data)
return request({
url: '/nltmaterialeditrules/add',
method: 'post',
data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
......@@ -183,7 +183,7 @@
</el-form-item>
</el-form>
<div>配置SN规则</div>
<div style="margin-top: 20px; border: 1px solid gray; padding: 10px" v-for="(item, index) in snRulesList">
<div style="margin-top: 20px; border: 1px solid gray; padding: 10px" v-for="(item, index) in form.nltMaterialEditList">
<el-form ref="form1" :rules="rules1" :model="item" size="small" label-width="120px">
<el-row>
<el-col :span="13">
......@@ -251,11 +251,9 @@
<script>
import {
addEdit, addEditRules,
changeStaStatus,
exportMater,
getMaterial,
listEdit,
listMaterial,
updateMaterial
} from '@/api/material'
......@@ -292,12 +290,6 @@ export default {
Loading: true,
// 遮罩2
Loading1: true,
// sn规则数据
snRulesList: [
{
nltMaterialEditRules: []
}
],
// 物料表数据
materialList: [],
// 表格总条数
......@@ -414,7 +406,12 @@ export default {
getMaterial(row.businessId).then(response => {
this.form = response.data
this.Loading1 = false
this.getEditList(row)
this.form.nltMaterialEditList.forEach(item => {
if (item.nltMaterialEditRules.length === 0) {
item.nltMaterialEditRules = [{ruleByte: '', rules: ''}]
}
})
console.log(this.form)
})
},
// 状态修改方法
......@@ -447,18 +444,6 @@ export default {
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: ''}]
}
console.log(item)
})
})
},
// 对话框取消按钮
cancel() {
this.open = false
......@@ -468,22 +453,15 @@ export default {
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
this.$refs['form1'].validate(valid1 => {
if (valid1) {
this.$refs['form2'].validate(valid2 => {
if (valid2) {
updateMaterial(this.form).then(response => {
if (response.code === 200) {
this.$message({
message: '修改成功',
type: 'success'
})
this.open = false
this.getMatTable()
}
})
}
console.log(this.form, '这是修改后的form')
updateMaterial(this.form).then(response => {
if (response.code === 200) {
this.$message({
message: '修改成功',
type: 'success'
})
this.open = false
this.getMatTable()
}
})
}
......@@ -492,7 +470,7 @@ export default {
// 增加SN规则方法
addSNRules() {
let temp = JSON.parse(JSON.stringify(this.form1))
this.snRulesList.push(temp)
this.form.nltMaterialEditList.push(temp)
},
// 增加SN规则方法2
addSNRule(item, index) {
......
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