物资类型管理-功能完善
This commit is contained in:
parent
296ed51e45
commit
9143abe7b6
|
|
@ -23,3 +23,14 @@ export const queryIdWhenAddMa = (data) => {
|
|||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交物资添加表单 */
|
||||
export const submitAddForm = (data) => {
|
||||
return request.post('/material/maType/add', data)
|
||||
}
|
||||
|
||||
/** 删除单个物资 */
|
||||
export const delSingleMa = (id) => {
|
||||
return request.delete(`/material/maType/${id}` )
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -253,8 +253,10 @@ export default {
|
|||
if(res.code === 200) {
|
||||
if(res.data) {
|
||||
this.tableList = res.data.rows
|
||||
this.total = res.data.total
|
||||
} else {
|
||||
this.tableList = res.rows
|
||||
this.total = res.total
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export const commonMixin = {
|
|||
handleAddData(level) {
|
||||
if(level == null) {
|
||||
this.$modal.msgError('请在左侧菜单选择设备类型!')
|
||||
} else if(level >= 3) {
|
||||
} else if(level > 3) {
|
||||
this.$modal.msgError('该类型无法添加子类型!')
|
||||
} else {
|
||||
this.editParams = null
|
||||
|
|
@ -25,8 +25,9 @@ export const commonMixin = {
|
|||
method(id).then(res => {
|
||||
console.log(res)
|
||||
if(res.code === 200) {
|
||||
// this.$message.msgSuccess('操作成功!')
|
||||
this.$modal.msgSuccess('操作成功!')
|
||||
this.$refs.tableRef.getTableList()
|
||||
this.getTreeData()
|
||||
}
|
||||
}).catch(err => {})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
<el-form-item label="新增类型编码" prop="code">
|
||||
<el-input v-model="typeParamsLv1.code" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="新增类型名称" prop="name">
|
||||
<el-input v-model="typeParamsLv1.name" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- form-新增 level2 -->
|
||||
<el-form
|
||||
|
|
@ -39,6 +42,24 @@
|
|||
<el-form-item label="新增类型编码" prop="code">
|
||||
<el-input v-model="typeParamsLv2.code" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="新增类型名称" prop="name">
|
||||
<el-input v-model="typeParamsLv2.name" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- form-新增 level3 -->
|
||||
<el-form
|
||||
label-width="100px"
|
||||
size="medium"
|
||||
ref="typeParamsRefLv3"
|
||||
:model="typeParamsLv3"
|
||||
v-if="subSort === 1 && sendData.level === 3"
|
||||
>
|
||||
<el-form-item label="新增类型编码" prop="code">
|
||||
<el-input v-model="typeParamsLv3.code" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="新增类型名称" prop="name">
|
||||
<el-input v-model="typeParamsLv3.name" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- form-修改 -->
|
||||
<el-form
|
||||
|
|
@ -113,7 +134,8 @@ import {
|
|||
queryProjectSelApi
|
||||
} from '@/api/base/project'
|
||||
import {
|
||||
queryIdWhenAddMa
|
||||
queryIdWhenAddMa,
|
||||
submitAddForm
|
||||
} from '@/api/material/type'
|
||||
export default {
|
||||
name: 'FormType',
|
||||
|
|
@ -129,6 +151,10 @@ export default {
|
|||
sendInfo: {
|
||||
type: Object | Array,
|
||||
default: () => null
|
||||
},
|
||||
treeMethod: {
|
||||
type: Function,
|
||||
default: () => null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
@ -157,6 +183,9 @@ export default {
|
|||
case 2:
|
||||
this.typeParamsLv2.code = res.data.code
|
||||
break;
|
||||
case 3:
|
||||
this.typeParamsLv3.code = res.data.code
|
||||
break;
|
||||
}
|
||||
}).catch(err => {})
|
||||
}
|
||||
|
|
@ -172,11 +201,18 @@ export default {
|
|||
},
|
||||
// 物资新增表单 Lv1
|
||||
typeParamsLv1: {
|
||||
code: undefined
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
},
|
||||
// 物资新增表单 Lv2
|
||||
typeParamsLv2: {
|
||||
code: undefined
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
},
|
||||
// 物资新增表单 Lv3
|
||||
typeParamsLv3: {
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
},
|
||||
// 物资修改表单
|
||||
typeEditParams: {
|
||||
|
|
@ -260,15 +296,39 @@ export default {
|
|||
onSubmitAdd(level) {
|
||||
switch(level) {
|
||||
case 0:
|
||||
console.log(this.typeParamsLv0)
|
||||
console.log(1)
|
||||
this.typeParamsLv0.id = this.sendData.id
|
||||
this.typeParamsLv0.level = this.sendData.level
|
||||
submitAddForm(this.typeParamsLv0).then(res => {
|
||||
console.log(res)
|
||||
}).catch(err => {})
|
||||
break;
|
||||
case 1:
|
||||
console.log(this.typeParamsLv1)
|
||||
this.typeParamsLv1.id = this.sendData.id
|
||||
this.typeParamsLv1.level = this.sendData.level
|
||||
submitAddForm(this.typeParamsLv1).then(res => {
|
||||
console.log(res)
|
||||
}).catch(err => {})
|
||||
break;
|
||||
case 2:
|
||||
console.log(this.typeParamsLv2)
|
||||
this.typeParamsLv2.id = this.sendData.id
|
||||
this.typeParamsLv2.level = this.sendData.level
|
||||
submitAddForm(this.typeParamsLv2).then(res => {
|
||||
console.log(res)
|
||||
}).catch(err => {})
|
||||
break;
|
||||
case 3:
|
||||
this.typeParamsLv3.id = this.sendData.id
|
||||
this.typeParamsLv3.level = this.sendData.level
|
||||
submitAddForm(this.typeParamsLv3).then(res => {
|
||||
console.log(res)
|
||||
}).catch(err => {})
|
||||
break;
|
||||
}
|
||||
// 2. 成功之后通知父组件关闭弹框
|
||||
this.$emit('closeDialog', true)
|
||||
// this.$emit('treeMethod')
|
||||
this.treeMethod()
|
||||
/* this.$refs.typeEditParamsRef.validate((valid) => {
|
||||
if (valid) {
|
||||
console.log('校验通过', this.typeEditParams)
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
@node-click="handleNodeClick"
|
||||
>
|
||||
<span class="custom-tree-node" slot-scope="{ node, data }" style="font-size: 14px">
|
||||
<i v-if="node.level <= 2" class="el-icon-folder" style="color: #fabd16" />
|
||||
<i v-else-if="node.level > 2" class="el-icon-document" style="color: #C0C0C0" />
|
||||
<i v-if="node.level <= 3" class="el-icon-folder" style="color: #fabd16" />
|
||||
<i v-else-if="node.level > 3" class="el-icon-document" style="color: #C0C0C0" />
|
||||
{{ data.label }}
|
||||
</span>
|
||||
</el-tree>
|
||||
|
|
@ -39,10 +39,8 @@
|
|||
:formLabel="formLabel"
|
||||
:columnsList="columnsList"
|
||||
:request-api="queryMaListApi"
|
||||
|
||||
:show-sel="false"
|
||||
ref="tableRef"
|
||||
|
||||
style="display: flex; flex-direction: column"
|
||||
>
|
||||
<template slot="btn" slot-scope="{ queryParams }">
|
||||
|
|
@ -52,6 +50,12 @@
|
|||
>导出</el-button>
|
||||
</template>
|
||||
<template slot="handle" slot-scope="{ data }">
|
||||
<el-button
|
||||
type="info"
|
||||
size="mini"
|
||||
v-if="data.level === '4'"
|
||||
>查看</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
|
|
@ -61,7 +65,7 @@
|
|||
<el-button
|
||||
type="danger"
|
||||
size="mini"
|
||||
@click="handleDeleteData(data.id)"
|
||||
@click="handleDeleteData(data.id, delSingleMa)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
|
|
@ -79,9 +83,10 @@
|
|||
<!-- 新增以及修改数据的表单组件 -->
|
||||
<FormType
|
||||
@closeDialog="closeDialog"
|
||||
:edit-params="editParams"
|
||||
:send-data="transData"
|
||||
:send-info="transInfo"
|
||||
:editParams="editParams"
|
||||
:sendData="transData"
|
||||
:sendInfo="transInfo"
|
||||
:treeMethod="getTreeData"
|
||||
/>
|
||||
</template>
|
||||
</DialogModel>
|
||||
|
|
@ -94,7 +99,8 @@ import { commonMixin } from '../mixins/common'
|
|||
import FormType from './components/form-type.vue'
|
||||
import {
|
||||
queryMaTypeTreeListApi,
|
||||
queryMaListApi
|
||||
queryMaListApi,
|
||||
delSingleMa
|
||||
} from '@/api/material/type'
|
||||
export default {
|
||||
name: 'typeManage',
|
||||
|
|
@ -115,6 +121,7 @@ export default {
|
|||
// 获取树形数据
|
||||
getTreeData() {
|
||||
queryMaTypeTreeListApi().then(res => {
|
||||
this.rootOpt[0].children = []
|
||||
res.data.forEach(item => {
|
||||
this.rootOpt[0].children.push(item)
|
||||
})
|
||||
|
|
@ -139,7 +146,7 @@ export default {
|
|||
this.transLevel = data.level
|
||||
this.transData = data
|
||||
this.$refs.tableRef.queryTableList({
|
||||
typeId: data.id
|
||||
code: data.code
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
@ -186,6 +193,8 @@ export default {
|
|||
},
|
||||
// 查询右侧数据
|
||||
queryMaListApi,
|
||||
// 删除单个物资
|
||||
delSingleMa,
|
||||
// 传递给表单的数据, level, 数据
|
||||
transData: null,
|
||||
transLevel: null,
|
||||
|
|
|
|||
Loading…
Reference in New Issue