产品定义
This commit is contained in:
@@ -28,11 +28,39 @@ export function listproductEfinition(query) {
|
||||
})
|
||||
}
|
||||
|
||||
export function addUnitmeasure(data) {
|
||||
export function addProductDefine(data) {
|
||||
return request({
|
||||
url: '/mes/md/unit/addUnit',
|
||||
url: '/mes/md/product/addProductDefine',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
export function updateProductDefine(data) {
|
||||
return request({
|
||||
url: '/mes/md/product/updateProductDefine',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function getProductBypk(query) {
|
||||
return request({
|
||||
url: '/mes/md/product/getProductBypk/'+query,
|
||||
method: 'get',
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function delproduct(id) {
|
||||
return request({
|
||||
url: '/mes/md/product/delproduct/'+id,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
<el-table-column label="产品名称" align="center" prop="productName" />
|
||||
<el-table-column label="单位" align="center" prop="productUnitName" />
|
||||
<el-table-column label="工艺路线" align="center" prop="processrouteName" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" class="delred">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination :v-show="true" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
@@ -49,7 +55,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="measureName">
|
||||
<el-autocomplete
|
||||
v-model="dmlform.measureName"
|
||||
v-model="dmlform.productUnitName"
|
||||
:fetch-suggestions="querymeasureNameAsync"
|
||||
placeholder="请输入单位名称"
|
||||
@select="handlemeasureNamSelect"
|
||||
@@ -57,7 +63,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="工艺路线" prop="processrouteName">
|
||||
<el-autocomplete
|
||||
v-model="dmlform.processrouteName"
|
||||
v-model="dmlform.processrouteCodeName"
|
||||
:fetch-suggestions="queryprocessrouteNameAsync"
|
||||
placeholder="请输入工艺路线"
|
||||
@select="handleProcessrouteNameSelect"
|
||||
@@ -96,12 +102,11 @@
|
||||
<script>
|
||||
import {
|
||||
listproductEfinition,
|
||||
listPrimaryUnitmeasure,
|
||||
addProductDefine,
|
||||
getUnitmeasure,
|
||||
delUnitmeasure,
|
||||
addUnitmeasure,
|
||||
updateUnitmeasure,
|
||||
exportUnit,
|
||||
updateProductDefine,
|
||||
getProductBypk,
|
||||
delproduct
|
||||
} from '@/api/basisManagement/productEfinition.js'
|
||||
import { debounce } from '@/utils'
|
||||
|
||||
@@ -131,17 +136,18 @@ export default {
|
||||
open: false,
|
||||
exportopen: false,
|
||||
dmlform: {
|
||||
measureCode: '',
|
||||
productCode: '',
|
||||
productName: '',
|
||||
measureName: '',
|
||||
processrouteName: '',
|
||||
measureId: '',
|
||||
ProcessrouteId:""
|
||||
measureId: '', //unit表
|
||||
productUnit: '', //product表
|
||||
productUnitName: '', //product表
|
||||
processrouteCodeName: '',
|
||||
ProcessrouteId: '',
|
||||
},
|
||||
rules: {
|
||||
measureCode: [{ required: true, message: '单位编码不能为空', trigger: 'blur' }],
|
||||
measureName: [{ required: true, message: '单位名称不能为空', trigger: 'blur' }],
|
||||
enableFlag: [{ required: true, message: '是否启用不能为空', trigger: 'blur' }],
|
||||
productCode: [{ required: true, message: '产品编码不能为空', trigger: 'blur' }],
|
||||
productName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
|
||||
productUnitName: [{ required: true, message: '单位名称不能为空', trigger: 'blur' }],
|
||||
},
|
||||
ids: [],
|
||||
idsName: [],
|
||||
@@ -206,21 +212,25 @@ export default {
|
||||
this.open = true
|
||||
},
|
||||
handleUpdate(row) {
|
||||
debugger
|
||||
this.dmlform.productUnitName = '22222222222222222'
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '修改'
|
||||
const measureId = row.measureId || this.ids
|
||||
getUnitmeasure(measureId).then((response) => {
|
||||
const id = row.id || this.ids
|
||||
|
||||
getProductBypk(id).then((response) => {
|
||||
this.dmlform = response.data
|
||||
})
|
||||
//ProductUnitName
|
||||
},
|
||||
handleDelete(row) {
|
||||
const measureIds = row.measureId || this.ids
|
||||
const idsName = row.measureName || this.idsName
|
||||
const id = row.id || this.ids
|
||||
const idsName = row.productName || this.idsName
|
||||
this.$modal
|
||||
.confirm('是否确认删除单位编号为"' + idsName + '"的数据项?')
|
||||
.then(function () {
|
||||
return delUnitmeasure(measureIds)
|
||||
return delproduct(id)
|
||||
})
|
||||
.then((response) => {
|
||||
this.getList()
|
||||
@@ -241,8 +251,8 @@ export default {
|
||||
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.measureId)
|
||||
this.idsName = selection.map((item) => item.measureName)
|
||||
this.ids = selection.map((item) => item.id)
|
||||
this.idsName = selection.map((item) => item.productName)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
@@ -250,20 +260,32 @@ export default {
|
||||
submitForm() {
|
||||
this.$refs['dmlform'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.dmlform.measureId != null || this.dmlform.measureId == '') {
|
||||
updateUnitmeasure(this.dmlform).then((response) => {
|
||||
if (this.dmlform.id != null || this.dmlform.id == '') {
|
||||
updateProductDefine(this.dmlform).then((response) => {
|
||||
if (response.data == 1) {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
this.reset()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
addUnitmeasure(this.dmlform).then((response) => {
|
||||
let data = new Object()
|
||||
data.productCode = this.dmlform.productCode
|
||||
data.productName = this.dmlform.productName
|
||||
data.productUnit = this.dmlform.productUnit
|
||||
data.productUnitName = this.dmlform.productUnitName
|
||||
data.productUnitName = this.dmlform.productUnitName
|
||||
data.processrouteCodeName = this.dmlform.processrouteCodeName
|
||||
data.ProcessrouteId = this.dmlform.ProcessrouteId
|
||||
|
||||
addProductDefine(data).then((response) => {
|
||||
if (response.data == 1) {
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
} else {
|
||||
this.$notify.error('新增失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -278,14 +300,16 @@ export default {
|
||||
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
measureId: null,
|
||||
measureCode: null,
|
||||
measureName: null,
|
||||
enableFlag: 'Y',
|
||||
remark: null,
|
||||
}
|
||||
this.resetForm('dmlform')
|
||||
;(this.dmlform = {
|
||||
productCode: '',
|
||||
productName: '',
|
||||
measureId: '', //unit表
|
||||
productUnit: '', //product表
|
||||
productUnitName: '', //product表
|
||||
processrouteCodeName: '',
|
||||
ProcessrouteId: '',
|
||||
}),
|
||||
this.resetForm('dmlform')
|
||||
},
|
||||
|
||||
//excel导出
|
||||
@@ -302,11 +326,14 @@ export default {
|
||||
|
||||
// 远程搜索单位
|
||||
querymeasureNameAsync(queryString, cb) {
|
||||
if (queryString == undefined) {
|
||||
queryString = ''
|
||||
}
|
||||
getUnitmeasure(queryString).then((res) => {
|
||||
const data = []
|
||||
for (let i of res.data) {
|
||||
data.push({
|
||||
unitid: i.measureId,
|
||||
measureId: i.measureId,
|
||||
value: i.measureName,
|
||||
})
|
||||
}
|
||||
@@ -316,15 +343,18 @@ export default {
|
||||
},
|
||||
//处理单位选择
|
||||
handlemeasureNamSelect(row) {
|
||||
this.dmlform.measureId = row.unitid
|
||||
this.dmlform.productUnit = row.measureId
|
||||
},
|
||||
//搜索远程工艺路线
|
||||
queryprocessrouteNameAsync(queryString, cb) {
|
||||
if (queryString == undefined) {
|
||||
queryString = ''
|
||||
}
|
||||
getUnitmeasure(queryString).then((res) => {
|
||||
const data = []
|
||||
for (let i of res.data) {
|
||||
data.push({
|
||||
unitid: i.measureId,
|
||||
measureId: i.measureId,
|
||||
value: i.measureName,
|
||||
})
|
||||
}
|
||||
@@ -333,10 +363,9 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
handleProcessrouteNameSelect(row){
|
||||
this.dmlform.Processroute = row.unitid
|
||||
|
||||
}
|
||||
handleProcessrouteNameSelect(row) {
|
||||
this.dmlform.Processroute = row.measureId
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -288,7 +288,7 @@ export default {
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
this.dmlform = {
|
||||
measureId: null,
|
||||
measureCode: null,
|
||||
measureName: null,
|
||||
|
||||
Reference in New Issue
Block a user