Commit d9d2d050 authored by 秦嘉's avatar 秦嘉

物料

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