价格管理

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'
//机具类型管理
export function getMaTypeList(query) {
export function getTreeSelect(query) {
return request({
url: '/material-mall/tool/getTreeSelect',
method: 'get',
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) {

View File

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

View File

@ -215,7 +215,7 @@
<script>
import Treeselect from '@riophae/vue-treeselect'
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'
export default {
@ -318,7 +318,7 @@ export default {
methods: {
/** 查询新增页面-上级类型下拉树结构 */
getTreeData() {
getMaTypeList().then((response) => {
getTreeSelect().then((response) => {
this.treeOptions = response.data
this.defaultExpandedKeys = this.getSecondLevelKeys(this.treeOptions)
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 {
getMaTypeList,
getTreeSelect,
queryKeeperDataApi,
queryKeeperProApi,
getListByMaType,
@ -456,7 +456,7 @@ export default {
},
/** 查询新增页面-上级类型下拉树结构 */
async getTreeDataTwo() {
getMaTypeList().then((response) => {
getTreeSelect().then((response) => {
this.treeOptionsTwo = response.data;
if (
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 {
getMaTypeList,
getTreeSelect,
queryKeeperDataApi,
queryKeeperProApi,
getListByMaType,
@ -409,7 +409,7 @@ export default {
},
/** 查询新增页面-上级类型下拉树结构 */
async getTreeDataTwo() {
getMaTypeList().then((response) => {
getTreeSelect().then((response) => {
this.treeOptionsTwo = response.data;
if (
this.treeOptionsTwo.length > 0 &&