抱杆配套管理

This commit is contained in:
binbin_pan 2024-04-16 18:01:02 +08:00
parent 2640c40b17
commit 9deec6f550
2 changed files with 33 additions and 16 deletions

View File

@ -5,6 +5,7 @@ const addUrl = '/material/maWhole/add' // 添加
const selectListUrl = '/material/maWhole/selectList' // 查询首页 const selectListUrl = '/material/maWhole/selectList' // 查询首页
const selectListByIdUrl = '/material/maWhole/selectListById' // 查询详情 const selectListByIdUrl = '/material/maWhole/selectListById' // 查询详情
const deleteByIdUrl = '/material/maWhole/deleteById' // 删除 const deleteByIdUrl = '/material/maWhole/deleteById' // 删除
const treeTypeUrl = '/system/select/getDeviceTypeTree' // 设备树
// 物品类型 选择配件 // 物品类型 选择配件
export function getMaType(query) { export function getMaType(query) {
@ -15,6 +16,15 @@ export function getMaType(query) {
}) })
} }
// 设备树
export function getDeviceTypeTree(params = {}){
return request({
url: treeTypeUrl,
method: 'post',
data: params
})
}
// 新增 // 新增
export function addMaWhole(data) { export function addMaWhole(data) {
return request({ return request({

View File

@ -144,7 +144,13 @@
</template> </template>
<script> <script>
import { getMaType, addMaWhole, searchSelectList, searchSelectListById, deleteById } from '@/api/store/poleConfig' import {
getDeviceTypeTree,
addMaWhole,
searchSelectList,
searchSelectListById,
deleteById,
} from '@/api/store/poleConfig'
export default { export default {
name: 'poleConfig', name: 'poleConfig',
data() { data() {
@ -178,25 +184,15 @@ export default {
}, },
created() { created() {
this.getList() this.getList()
getMaType({ parentId: 1 }).then(res => {
// typeOptions
const data = res.data
this.typeOptions = this.getTree(data)
})
getMaType({ parentId: 2 }).then(res => {
// mountingsOptions
const data = res.data
this.mountingsOptions = this.getTree(data)
})
}, },
methods: { methods: {
// //
async getList(data = {}) { async getList(data = {}) {
this.houseList = []
this.queryParams.pageNum = data.page || 1 this.queryParams.pageNum = data.page || 1
this.queryParams.pageSize = data.limit || 10 this.queryParams.pageSize = data.limit || 10
this.queryParams.keyWord = this.formData.keyWord || '' this.queryParams.keyWord = this.formData.keyWord || ''
const res = await searchSelectList({ ...this.queryParams }) const res = await searchSelectList({ ...this.queryParams })
console.log('🚀 ~ getList ~ res:', res);
this.houseList = res.data.result this.houseList = res.data.result
this.total = res.data.totalCount || 0 this.total = res.data.totalCount || 0
}, },
@ -228,6 +224,18 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dialogForm.resetFields() this.$refs.dialogForm.resetFields()
}) })
getDeviceTypeTree().then(res => {
// typeOptions
const data = res.data
// this.typeOptions = this.getTree(data)
// this.mountingsOptions = this.getTree(data)
this.typeOptions = this.mountingsOptions = this.getTree(data)
})
// getDeviceTypeTree().then(res => {
// // mountingsOptions
// const data = res.data
// this.mountingsOptions = this.getTree(data)
// })
}, },
// //
handleDetail(row) { handleDetail(row) {
@ -263,7 +271,7 @@ export default {
}, },
// //
handleTypeOptions(val) { handleTypeOptions(val) {
this.dialogForm.parentId = val[val.length - 1] this.dialogForm.parentId = val[3]
}, },
// //
handleMountingsOptions(val) { handleMountingsOptions(val) {
@ -271,11 +279,11 @@ export default {
this.dialogForm.mountingsValue = val this.dialogForm.mountingsValue = val
const selected = this.$refs.mountingsTree.getCheckedNodes() const selected = this.$refs.mountingsTree.getCheckedNodes()
// level = 2 // level = 2
const filterSel = selected.filter(item => item.level === 2) const filterSel = selected.filter(item => item.level === 4)
this.selectList = filterSel.map(item => { this.selectList = filterSel.map(item => {
return { return {
typeId: item.value, typeId: item.value,
typeName: item.pathLabels[0], typeName: item.pathLabels[2],
typeModelName: item.label, typeModelName: item.label,
totalNum: 1, totalNum: 1,
} }
@ -296,7 +304,6 @@ export default {
}, },
// //
handleDeleteDialog(row) { handleDeleteDialog(row) {
console.log('🚀 ~ handleDeleteDialog ~ row:', row);
// row.parentId // row.parentId
this.dialogList = this.dialogList.filter(item => item.typeId !== row.typeId) this.dialogList = this.dialogList.filter(item => item.typeId !== row.typeId)
}, },