价格管理

This commit is contained in:
bb_pan 2025-12-11 21:28:01 +08:00
parent fb472c72a7
commit 3cf298bd1d
5 changed files with 196 additions and 182 deletions

View File

@ -1,13 +1,30 @@
import request from '@/utils/request' import request from '@/utils/request'
//机具类型管理 //机具类型管理
export function getMaTypeList(query) { export function getTreeSelect(query) {
return request({ return request({
url: '/material-mall/tool/getTreeSelect', url: '/material-mall/tool/getTreeSelect',
method: 'get', method: 'get',
params: query, params: query,
}) })
} }
// 列表
export function getListTool(query) {
return request({
url: '/material-mall/tool/list',
method: 'get',
params: query,
})
}
// 工具改价格
export function updateLeasePriceTool(data) {
return request({
url: '/material-mall/tool/updateLeasePrice',
method: 'post',
data: data,
})
}
//机具类型管理列表信息 //机具类型管理列表信息
export function getListByMaType(query) { export function getListByMaType(query) {

View File

@ -17,13 +17,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="19" :xs="24"> <el-col :span="19" :xs="24">
<el-form <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
label-width="68px"
>
<el-form-item label="关键字" prop="keyWord"> <el-form-item label="关键字" prop="keyWord">
<el-input <el-input
v-model="queryParams.keyWord" v-model="queryParams.keyWord"
@ -35,33 +29,17 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">查询 </el-button>
type="primary" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置 </el-button>
icon="el-icon-search"
size="mini"
@click="getList"
>查询
</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置
</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="warning" plain icon="el-icon-edit" size="mini" @click="onBatchEditPrice"
type="warning" >批量修改租赁价
plain
icon="el-icon-edit"
size="mini"
@click="onBatchEditPrice"
>批量修改租赁价
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
@ -70,14 +48,14 @@
<el-col :span="5" :xs="24" style="height: 100%"> <el-col :span="5" :xs="24" style="height: 100%">
<div class="head-container" style="height: 100%"> <div class="head-container" style="height: 100%">
<el-tree <el-tree
style="height: 100%;overflow-y: auto;" style="overflow-y: auto"
:data="treeOptions" :data="treeOptions"
:props="{children: 'children',label: 'label'}" :props="{ children: 'children', label: 'label' }"
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterNode" :filter-node-method="filterNode"
ref="tree" ref="tree"
node-key="id" node-key="id"
default-expand-all :default-expanded-keys="defaultExpandedKeys"
highlight-current highlight-current
@node-click="handleNodeClick" @node-click="handleNodeClick"
> >
@ -88,61 +66,43 @@
@mouseleave="onMouseleave()" @mouseleave="onMouseleave()"
> >
<span v-if="isMousemoveId === data.id && node.label.length > 10">{{ <span v-if="isMousemoveId === data.id && node.label.length > 10">{{
node.label.slice(0, 10) + '...' node.label.slice(0, 10) + '...'
}}</span> }}</span>
<span v-else>{{ node.label }}</span>
</div>
</el-tree>
<el-tree
style="height: 100%"
:data="treeOptions2"
:props="{ children: 'children', label: 'label' }"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree2"
node-key="id"
:default-expanded-keys="defaultExpandedKeys2"
highlight-current
@node-click="handleNodeClick"
>
<div
class="custom-tree-node"
slot-scope="{ node, data }"
@mousemove="onMousemove(data)"
@mouseleave="onMouseleave()"
>
<span v-if="isMousemoveId === data.id && node.label.length > 10">{{
node.label.slice(0, 10) + '...'
}}</span>
<span v-else>{{ node.label }}</span> <span v-else>{{ node.label }}</span>
<!-- <span class="btn-items" v-if="isMousemoveId === data.id">
<el-button
type="text"
size="mini"
icon="el-icon-plus"
v-show="data.level !== 7"
@click.stop="() => appendTreeNode(data)"
/>
<el-button
type="text"
size="mini"
icon="el-icon-edit-outline"
style="color: #67c23a"
v-if="data.id !== 0"
@click.stop="() => editTreeNode(data)"
/>
<el-button
type="text"
size="mini"
icon="el-icon-delete"
style="color: #f56c6c"
v-if="data.id !== 0"
@click.stop="() => removeTreeNode(data)"
/>
</span>-->
</div> </div>
</el-tree> </el-tree>
</div> </div>
</el-col> </el-col>
<el-col :span="18" style="height: 100%"> <el-col :span="18" style="height: 100%">
<el-table <el-table v-if="typeList.length > 0" v-loading="loading" :data="typeList" border height="546" @selection-change="handleSelectionChange">
v-loading="loading" <el-table-column type="selection" width="50" align="center" />
:data="typeList" <el-table-column label="专业" align="center" key="equipCategory" prop="equipCategory" show-overflow-tooltip />
border <el-table-column label="主工序" align="center" key="major" prop="major" show-overflow-tooltip />
height="546"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="50" align="center"/>
<el-table-column
label="专业"
align="center"
key="equipCategory"
prop="equipCategory"
show-overflow-tooltip
/>
<el-table-column
label="主工序"
align="center"
key="major"
prop="major"
show-overflow-tooltip
/>
<el-table-column <el-table-column
label="子工序" label="子工序"
align="center" align="center"
@ -157,55 +117,27 @@
prop="subProcedure" prop="subProcedure"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column label="装备名称" align="center" key="typeName" prop="typeName" show-overflow-tooltip />
<el-table-column label="租赁价" align="center" prop="leasePrice" show-overflow-tooltip />
</el-table>
<el-table v-if="typeList2.length > 0" v-loading="loading" :data="typeList2" border height="546" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="工具专业" align="center" key="fourthParentName" prop="fourthParentName" show-overflow-tooltip />
<el-table-column label="施工类型" align="center" key="greatGrandparentName" prop="greatGrandparentName" show-overflow-tooltip />
<el-table-column <el-table-column
label="装备名称" label="工具类型"
align="center" align="center"
key="typeName" key="grandparentTypeName"
prop="typeName" prop="grandparentTypeName"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column label="工具名称" align="center" key="parentTypeName" prop="parentTypeName" show-overflow-tooltip />
label="租赁价" <el-table-column label="规格型号" align="center" key="typeName" prop="typeName" show-overflow-tooltip />
align="center" <el-table-column label="租赁价" align="center" prop="leasePrice" show-overflow-tooltip />
prop="leasePrice"
show-overflow-tooltip
/>
<!-- <el-table-column label="操作" align="center" width="180">
<template slot-scope="scope" v-if="scope.row.typeId !== 1">
&lt;!&ndash; <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="editTreeNode(scope.row)"
v-hasPermi="['machinery:type:config']"
>
配置
</el-button>&ndash;&gt;
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="editTreeNode(scope.row)"
v-hasPermi="['machinery:type:edit']"
>
修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="removeTreeNode(scope.row)"
v-hasPermi="['machinery:type:del']"
style="color: #f56c6c;"
>
删除
</el-button>
</template>
</el-table-column>-->
</el-table> </el-table>
<pagination <pagination
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -214,16 +146,21 @@
</el-col> </el-col>
</el-row> </el-row>
<AddNode :visible.sync="addOpen" :parentNode="addParentNode" :showIsStateGrid="showIsStateGrid" @refresh="refresh"/> <AddNode
<EditNode :visible.sync="editOpen" :parentNode="editParentNode" :showIsStateGrid="showIsStateGrid" :visible.sync="addOpen"
@refresh="refresh"/> :parentNode="addParentNode"
<AddChildNode :visible.sync="addChildOpen" :parentNode="addChildNode" :showIsStateGrid="showIsStateGrid"
@refresh="refresh" @refresh="refresh"
/> />
<EditNode
:visible.sync="editOpen"
:parentNode="editParentNode"
:showIsStateGrid="showIsStateGrid"
@refresh="refresh"
/>
<AddChildNode :visible.sync="addChildOpen" :parentNode="addChildNode" @refresh="refresh" />
<EditChildNode :visible.sync="editChildOpen" :parentNode="editChildNode" <EditChildNode :visible.sync="editChildOpen" :parentNode="editChildNode" @refresh="refresh" />
@refresh="refresh"
/>
<!-- 修改价格弹框 --> <!-- 修改价格弹框 -->
<el-dialog <el-dialog
@ -234,32 +171,24 @@
append-to-body append-to-body
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form <el-form :inline="true" :model="editPriceForm" ref="editPriceFormRef" :rules="editPriceFormRules">
:inline="true"
:model="editPriceForm"
ref="editPriceFormRef"
:rules="editPriceFormRules"
>
<el-form-item label="修改后租赁价" prop="leasePrice"> <el-form-item label="修改后租赁价" prop="leasePrice">
<el-input v-model="editPriceForm.leasePrice"/> <el-input v-model="editPriceForm.leasePrice" />
</el-form-item> </el-form-item>
<el-row style="text-align: right"> <el-row style="text-align: right">
<el-form-item> <el-form-item>
<el-button size="small" @click="onEditCancel"> </el-button> <el-button size="small" @click="onEditCancel"> </el-button>
<el-button size="small" type="primary" @click="onEditSubmit" <el-button size="small" type="primary" @click="onEditSubmit"> </el-button>
>
</el-button
>
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form> </el-form>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {getMaTypeList, delMaType, getList, updateLeasePriceApi} from '@/api/lessor/equipType' import { getMaTypeList, delMaType, getList, updateLeasePriceApi } from '@/api/lessor/equipType'
import { getTreeSelect, getListTool, updateLeasePriceTool } from '@/api/ma/base'
import AddNode from '@/views/lessor/equipment/equipType/child/addNode.vue' import AddNode from '@/views/lessor/equipment/equipType/child/addNode.vue'
import EditNode from '@/views/lessor/equipment/equipType/child/editNode.vue' import EditNode from '@/views/lessor/equipment/equipType/child/editNode.vue'
import AddChildNode from '@/views/lessor/equipment/equipType/child/addChildNode.vue' import AddChildNode from '@/views/lessor/equipment/equipType/child/addChildNode.vue'
@ -267,11 +196,11 @@ import EditChildNode from '@/views/lessor/equipment/equipType/child/editChildNod
export default { export default {
name: 'ToolsType', name: 'ToolsType',
components: {AddNode, EditNode, AddChildNode, EditChildNode}, components: { AddNode, EditNode, AddChildNode, EditChildNode },
data() { data() {
return { return {
editPriceForm: { editPriceForm: {
leasePrice: '' leasePrice: '',
}, },
editLeasePriceVisible: false, editLeasePriceVisible: false,
@ -279,10 +208,12 @@ export default {
total: 0, total: 0,
// //
typeList: undefined, typeList: undefined,
typeList2: [],
// //
loading: true, loading: true,
typeName: undefined, typeName: undefined,
treeOptions: undefined, treeOptions: undefined,
treeOptions2: undefined,
addOpen: false, addOpen: false,
addParentNode: {}, addParentNode: {},
editOpen: false, editOpen: false,
@ -296,70 +227,115 @@ export default {
addFormParams: { addFormParams: {
label: '', label: '',
typeName: '', typeName: '',
companyId: 101 companyId: 101,
}, },
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
keyWord: undefined, keyWord: undefined,
level: 1 level: 1,
}, },
addFormParamsRules: { addFormParamsRules: {
typeName: [ typeName: [
{ {
required: true, required: true,
message: '名称不能为空', message: '名称不能为空',
trigger: 'blur' trigger: 'blur',
} },
] ],
}, },
editPriceFormRules: { editPriceFormRules: {
leasePrice: [ leasePrice: [
{ {
required: true, required: true,
message: '请输入修改后共享价格', message: '请输入修改后共享价格',
trigger: 'blur' trigger: 'blur',
}, },
{ {
pattern: /^(0(\.\d{0,2})?|([1-9]\d*)(\.\d{0,2})?)$/, pattern: /^(0(\.\d{0,2})?|([1-9]\d*)(\.\d{0,2})?)$/,
message: '请输入正确的费用金额,最多两位小数点', message: '请输入正确的费用金额,最多两位小数点',
trigger: 'blur' trigger: 'blur',
} },
] ],
}, },
addTitleVisible: false, addTitleVisible: false,
addTitle: '', addTitle: '',
showIsStateGrid: null, showIsStateGrid: null,
ids: [] ids: [],
defaultExpandedKeys: [],
defaultExpandedKeys2: [],
isTool: false,
} }
}, },
watch: { watch: {
typeName(val) { typeName(val) {
this.$refs.tree.filter(val) this.$refs.tree.filter(val)
} },
}, },
created() { created() {
this.getTreeData() this.getTreeData()
this.getList() this.getList()
}, },
methods: { methods: {
collectExpandKeys(nodes, currentLevel = 1, maxLevel = 2) {
let keys = []
nodes.forEach((node) => {
if (currentLevel <= maxLevel) {
keys.push(node.id)
}
if (node.children && node.children.length) {
keys = keys.concat(this.collectExpandKeys(node.children, currentLevel + 1, maxLevel))
}
})
return keys
},
getList() { getList() {
this.loading = true this.loading = true
getList(this.queryParams).then((response) => { this.typeList = []
this.typeList = response.data.rows this.typeList2 = []
this.total = response.data.total if (this.isTool) {
this.loading = false const params = {
}) typeId: this.queryParams.typeId,
pageNum: this.queryParams.pageNum,
pageSize: this.queryParams.pageSize,
}
getListTool(params).then((res) => {
this.typeList2 = res.rows
this.total = res.total
this.loading = false
})
} else {
getList(this.queryParams).then((response) => {
this.typeList = response.data.rows
this.total = response.data.total
this.loading = false
})
}
}, },
async getTreeData() { async getTreeData() {
const response = await getMaTypeList() const response = await getMaTypeList()
const res = await getTreeSelect()
// level == 7 // level == 7
const filterTree = (nodes) => { const filterTree = (nodes) => {
return nodes return nodes
.filter(node => node.level !== 7) // level=7 .filter((node) => node.level !== 7) // level=7
.map(node => ({ .map((node) => ({
...node, ...node,
children: node.children ? filterTree(node.children) : [] children: node.children ? filterTree(node.children) : [],
}))
}
const filterTree2 = (nodes) => {
return nodes
.filter((node) => node.level !== 7) // level=7
.map((node) => ({
...node,
id: node.typeId,
label: node.typeName,
isTool: true,
children: node.children ? filterTree2(node.children) : [],
})) }))
} }
@ -368,9 +344,25 @@ export default {
label: '机具类型', label: '机具类型',
id: 0, id: 0,
children: filterTree(response.data), children: filterTree(response.data),
level: 0 level: 0,
} },
] ]
this.treeOptions2 = [
{
label: '工具类型',
id: 0,
children: filterTree2(res.data),
level: 0,
},
]
this.defaultExpandedKeys = this.collectExpandKeys(this.treeOptions)
this.defaultExpandedKeys2 = this.collectExpandKeys(this.treeOptions2)
this.$nextTick(() => {
this.$refs.tree && this.$refs.tree.setCurrentKey(null)
this.$refs.tree2 && this.$refs.tree2.setCurrentKey(null)
})
console.log('🚀 ~ this.treeOptions2:', this.treeOptions2)
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true
@ -379,6 +371,8 @@ export default {
handleNodeClick(data) { handleNodeClick(data) {
console.log('节点点击', data) console.log('节点点击', data)
this.isTool = data.isTool
console.log('🚀 ~ this.isTool:', this.isTool)
this.queryParams.typeId = data.id this.queryParams.typeId = data.id
this.queryParams.level = data.level this.queryParams.level = data.level
this.queryParams.typeName = data.label this.queryParams.typeName = data.label
@ -426,15 +420,15 @@ export default {
}, },
removeTreeNode(data) { removeTreeNode(data) {
this.$modal.confirm('是否确认删除数据项?') this.$modal
.confirm('是否确认删除数据项?')
.then(() => delMaType(data.id || data.typeId)) .then(() => delMaType(data.id || data.typeId))
.then(() => { .then(() => {
this.$modal.msgSuccess('删除成功') this.$modal.msgSuccess('删除成功')
this.getTreeData() this.getTreeData()
this.getList() this.getList()
}) })
.catch(() => { .catch(() => {})
})
}, },
onMousemove(data) { onMousemove(data) {
@ -512,9 +506,14 @@ export default {
if (valid) { if (valid) {
const params = { const params = {
typeIds: this.ids.map((e) => e.typeId), typeIds: this.ids.map((e) => e.typeId),
leasePrice: this.editPriceForm.leasePrice * 1 leasePrice: this.editPriceForm.leasePrice * 1,
}
let res = null
if (this.isTool) {
res = await updateLeasePriceTool(params)
} else {
res = await updateLeasePriceApi(params)
} }
const res = await updateLeasePriceApi(params)
if (res.code === 200) { if (res.code === 200) {
this.$message.success('修改成功') this.$message.success('修改成功')
this.editLeasePriceVisible = false this.editLeasePriceVisible = false
@ -523,7 +522,7 @@ export default {
} }
}) })
}, },
} },
} }
</script> </script>
@ -545,19 +544,18 @@ export default {
} }
} }
::v-deep .el-tree .el-tree-node__expand-icon.expanded { ::v-deep .el-tree .el-tree-node__expand-icon.expanded {
-webkit-transform: rotate(0deg); -webkit-transform: rotate(0deg);
transform: rotate(0deg); transform: rotate(0deg);
} }
::v-deep .el-tree .el-icon-caret-right:before { ::v-deep .el-tree .el-icon-caret-right:before {
content: "\e783"; content: '\e783';
font-size: 16px; font-size: 16px;
} }
::v-deep .el-tree .el-tree-node__expand-icon.expanded.el-icon-caret-right:before { ::v-deep .el-tree .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
content: "\e781"; content: '\e781';
font-size: 16px; font-size: 16px;
color: #1890ff; color: #1890ff;
} }
@ -574,7 +572,6 @@ export default {
background-color: #8decf1; background-color: #8decf1;
} }
::v-deep .el-tree { ::v-deep .el-tree {
height: 300px; height: 300px;
overflow-y: scroll; /* 必须保留scroll而不是auto */ overflow-y: scroll; /* 必须保留scroll而不是auto */

View File

@ -215,7 +215,7 @@
<script> <script>
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getMaTypeList, getListByMaType, delMaType, addMaType, updateMaType } from '@/api/ma/base' import { getTreeSelect, getListByMaType, delMaType, addMaType, updateMaType } from '@/api/ma/base'
import ImageUpload from '@/components/ImageUpload' import ImageUpload from '@/components/ImageUpload'
export default { export default {
@ -318,7 +318,7 @@ export default {
methods: { methods: {
/** 查询新增页面-上级类型下拉树结构 */ /** 查询新增页面-上级类型下拉树结构 */
getTreeData() { getTreeData() {
getMaTypeList().then((response) => { getTreeSelect().then((response) => {
this.treeOptions = response.data this.treeOptions = response.data
this.defaultExpandedKeys = this.getSecondLevelKeys(this.treeOptions) this.defaultExpandedKeys = this.getSecondLevelKeys(this.treeOptions)
console.log('🚀 ~ this.defaultExpandedKeys:', this.defaultExpandedKeys) console.log('🚀 ~ this.defaultExpandedKeys:', this.defaultExpandedKeys)

View File

@ -241,7 +241,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getUserByRoleList, getMaUserList } from "@/api/system/user"; import { getUserByRoleList, getMaUserList } from "@/api/system/user";
import { import {
getMaTypeList, getTreeSelect,
queryKeeperDataApi, queryKeeperDataApi,
queryKeeperProApi, queryKeeperProApi,
getListByMaType, getListByMaType,
@ -456,7 +456,7 @@ export default {
}, },
/** 查询新增页面-上级类型下拉树结构 */ /** 查询新增页面-上级类型下拉树结构 */
async getTreeDataTwo() { async getTreeDataTwo() {
getMaTypeList().then((response) => { getTreeSelect().then((response) => {
this.treeOptionsTwo = response.data; this.treeOptionsTwo = response.data;
if ( if (
this.treeOptionsTwo.length > 0 && this.treeOptionsTwo.length > 0 &&

View File

@ -241,7 +241,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getUserByRoleList, getMaUserList } from "@/api/system/user"; import { getUserByRoleList, getMaUserList } from "@/api/system/user";
import { import {
getMaTypeList, getTreeSelect,
queryKeeperDataApi, queryKeeperDataApi,
queryKeeperProApi, queryKeeperProApi,
getListByMaType, getListByMaType,
@ -409,7 +409,7 @@ export default {
}, },
/** 查询新增页面-上级类型下拉树结构 */ /** 查询新增页面-上级类型下拉树结构 */
async getTreeDataTwo() { async getTreeDataTwo() {
getMaTypeList().then((response) => { getTreeSelect().then((response) => {
this.treeOptionsTwo = response.data; this.treeOptionsTwo = response.data;
if ( if (
this.treeOptionsTwo.length > 0 && this.treeOptionsTwo.length > 0 &&