Merge branch 'anhui-mall-ui-test' of http://192.168.0.75:3000/bonus/bonus-ui into anhui-mall-ui-test
This commit is contained in:
commit
f1b97845d9
|
|
@ -11,14 +11,9 @@
|
|||
>
|
||||
<el-card class="search-box">
|
||||
<!-- 用Flex实现自动换行+均匀分布 -->
|
||||
<div >
|
||||
<el-form-item prop="major" label="专业" >
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入"
|
||||
v-model="searchParams.major"
|
||||
style="width: 230px;"
|
||||
/>
|
||||
<div>
|
||||
<el-form-item prop="major" label="专业">
|
||||
<el-input clearable placeholder="请输入" v-model="searchParams.major" style="width: 230px" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="subProcess" label="工序" label-width="60px">
|
||||
|
|
@ -26,35 +21,25 @@
|
|||
clearable
|
||||
placeholder="请输入"
|
||||
v-model="searchParams.subProcess"
|
||||
style="width: 230px;"
|
||||
style="width: 230px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="name" label="装备名称" >
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入"
|
||||
v-model="searchParams.name"
|
||||
style="width: 230px;"
|
||||
/>
|
||||
<el-form-item prop="name" label="装备名称">
|
||||
<el-input clearable placeholder="请输入" v-model="searchParams.name" style="width: 230px" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="specificationModel" label="规格型号" >
|
||||
<el-form-item prop="specificationModel" label="规格型号">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入"
|
||||
v-model="searchParams.specificationModel"
|
||||
style="width: 230px;"
|
||||
style="width: 230px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="status" label="装备状态" >
|
||||
<el-select
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
v-model="searchParams.status"
|
||||
style="width: 230px;"
|
||||
>
|
||||
<el-form-item prop="status" label="装备状态">
|
||||
<el-select clearable placeholder="请选择" v-model="searchParams.status" style="width: 230px">
|
||||
<el-option label="在库" value="1"></el-option>
|
||||
<el-option label="自用" value="2"></el-option>
|
||||
<el-option label="共享" value="3"></el-option>
|
||||
|
|
@ -63,23 +48,25 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="code" label="装备编码" >
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入"
|
||||
v-model="searchParams.code"
|
||||
style="width: 230px;"
|
||||
/>
|
||||
<el-form-item prop="code" label="装备编码">
|
||||
<el-input clearable placeholder="请输入" v-model="searchParams.code" style="width: 230px" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<!-- 按钮区域:固定在右侧 -->
|
||||
<el-form-item style="float:right">
|
||||
<el-button @click="getEquipmentList" size="mini" icon="el-icon-search" type="primary" class="primary-lease">
|
||||
<el-form-item style="float: right">
|
||||
<el-button
|
||||
@click="getEquipmentList"
|
||||
size="mini"
|
||||
icon="el-icon-search"
|
||||
type="primary"
|
||||
class="primary-lease"
|
||||
>
|
||||
查询
|
||||
</el-button>
|
||||
<el-button @click="onReset" icon="el-icon-refresh" size="mini" class="primary-lease">重置</el-button>
|
||||
</el-form-item >
|
||||
<el-button @click="onReset" icon="el-icon-refresh" size="mini" class="primary-lease"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-form>
|
||||
|
|
@ -97,62 +84,58 @@
|
|||
批量下架
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
size="mini"
|
||||
@click="equipment"
|
||||
type="primary"
|
||||
class="primary-lease"
|
||||
>
|
||||
<el-button size="mini" @click="equipment" type="primary" class="primary-lease">
|
||||
添加上架装备
|
||||
</el-button>
|
||||
</el-row>
|
||||
|
||||
|
||||
<el-table
|
||||
:data="equipmentList"
|
||||
show-overflow-tooltip
|
||||
border stripe
|
||||
border
|
||||
stripe
|
||||
@selection-change="handleSelectionChange"
|
||||
class="custom-table"
|
||||
height="546"
|
||||
>
|
||||
<!-- 表格列保持原有内容 -->
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column align="center" label="序号" type="index" width="80"/>
|
||||
<el-table-column align="center" prop="province" label="所属省份"/>
|
||||
<el-table-column align="center" prop="propertyUnit" label="产权单位"/>
|
||||
<el-table-column align="center" prop="major" label="专业"/>
|
||||
<el-table-column align="center" prop="subProcess" label="工序"/>
|
||||
<el-table-column align="center" prop="subCategory" label="装备类目"/>
|
||||
<el-table-column align="center" prop="name" label="装备名称"/>
|
||||
<el-table-column align="center" prop="specificationModel" label="规格型号"/>
|
||||
<el-table-column align="center" prop="code" label="装备编码"/>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column align="center" label="序号" type="index" width="80" />
|
||||
<el-table-column align="center" prop="province" label="所属省份" />
|
||||
<el-table-column align="center" prop="propertyUnit" label="产权单位" />
|
||||
<el-table-column align="center" prop="major" label="专业" />
|
||||
<el-table-column align="center" prop="subProcess" label="工序" />
|
||||
<el-table-column align="center" prop="subCategory" label="装备类目" />
|
||||
<el-table-column align="center" prop="name" label="装备名称" />
|
||||
<el-table-column align="center" prop="specificationModel" label="规格型号" />
|
||||
<el-table-column align="center" prop="code" label="装备编码" />
|
||||
<el-table-column align="center" prop="status" label="装备状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status == 1" type="success" size="mini">在库</el-tag>
|
||||
<el-tag v-if="scope.row.status == 2" size="mini">自用</el-tag>
|
||||
<el-tag v-if="scope.row.status == 3" size="mini">共享</el-tag>
|
||||
<el-tag v-if="scope.row.status == 4" size="mini" type="danger">退役</el-tag>
|
||||
<el-tag v-if="scope.row.status == 5" size="mini" type="warning" >维修</el-tag>
|
||||
<el-tag v-if="scope.row.status == 5" size="mini" type="warning">维修</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="serviceLife" label="使用年限"/>
|
||||
<el-table-column align="center" prop="usingProject" label="使用项目"/>
|
||||
<el-table-column align="center" prop="expirationTime" label="使用到期时间"/>
|
||||
<el-table-column align="center" prop="originalCode" label="装备原始编码"/>
|
||||
<el-table-column align="center" prop="unit" label="计量单位"/>
|
||||
<el-table-column align="center" prop="manufacturer" label="生产厂家"/>
|
||||
<el-table-column align="center" prop="productionDate" label="出厂日期"/>
|
||||
<el-table-column align="center" prop="purchaseDate" label="采购日期"/>
|
||||
<el-table-column align="center" prop="originalValue" label="资产原值(万元)"/>
|
||||
<el-table-column align="center" prop="maxServiceLifeYears" label="最大使用年限(年)"/>
|
||||
<el-table-column align="center" prop="nextMaintenanceDate" label="下次维保日期"/>
|
||||
<el-table-column align="center" prop="appearanceImages" label="装备外观"/>
|
||||
<el-table-column align="center" prop="certificates" label="合格证"/>
|
||||
<el-table-column align="center" prop="inspectionReports" label="定期检验报告"/>
|
||||
<el-table-column align="center" prop="purchaseInvoices" label="采购发票"/>
|
||||
<el-table-column align="center" prop="feature1" label="特征项1"/>
|
||||
<el-table-column align="center" prop="featureValue1" label="特征值1"/>
|
||||
<el-table-column align="center" prop="serviceLife" label="使用年限" />
|
||||
<el-table-column align="center" prop="usingProject" label="使用项目" />
|
||||
<el-table-column align="center" prop="expirationTime" label="使用到期时间" />
|
||||
<el-table-column align="center" prop="originalCode" label="装备原始编码" />
|
||||
<el-table-column align="center" prop="unit" label="计量单位" />
|
||||
<el-table-column align="center" prop="manufacturer" label="生产厂家" />
|
||||
<el-table-column align="center" prop="productionDate" label="出厂日期" />
|
||||
<el-table-column align="center" prop="purchaseDate" label="采购日期" />
|
||||
<el-table-column align="center" prop="originalValue" label="资产原值(万元)" />
|
||||
<el-table-column align="center" prop="maxServiceLifeYears" label="最大使用年限(年)" />
|
||||
<el-table-column align="center" prop="nextMaintenanceDate" label="下次维保日期" />
|
||||
<el-table-column align="center" prop="appearanceImages" label="装备外观" />
|
||||
<el-table-column align="center" prop="certificates" label="合格证" />
|
||||
<el-table-column align="center" prop="inspectionReports" label="定期检验报告" />
|
||||
<el-table-column align="center" prop="purchaseInvoices" label="采购发票" />
|
||||
<el-table-column align="center" prop="feature1" label="特征项1" />
|
||||
<el-table-column align="center" prop="featureValue1" label="特征值1" />
|
||||
<el-table-column align="center" prop="leasePrice" label="租赁价" />
|
||||
|
||||
<el-table-column align="center" label="操作" :width="199" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
|
|
@ -164,7 +147,12 @@
|
|||
@confirm="handleDown(scope.row.maId)"
|
||||
>
|
||||
<template slot="reference">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" style="margin-left: 8px; color: red">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
style="margin-left: 8px; color: red"
|
||||
>
|
||||
下架
|
||||
</el-button>
|
||||
</template>
|
||||
|
|
@ -173,7 +161,6 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
<div class="pagination-wrapper">
|
||||
<el-pagination
|
||||
background
|
||||
|
|
@ -190,47 +177,37 @@
|
|||
|
||||
<!-- 添加上架装备弹窗(保持原有内容,优化样式) -->
|
||||
<el-dialog
|
||||
width="1600px"
|
||||
@close="handleDialogClose"
|
||||
width="95%"
|
||||
destroy-on-close
|
||||
:title="dialogTitle"
|
||||
:visible.sync="equipmentDialogVisible"
|
||||
@close="handleDialogClose"
|
||||
custom-class="simple-dialog"
|
||||
:visible.sync="equipmentDialogVisible"
|
||||
>
|
||||
<el-form :inline="true" :model="searchParams" class="dialog-search-form">
|
||||
<el-row style="height: 36px">
|
||||
<el-form-item label="装备名称" prop="name" >
|
||||
<el-input
|
||||
v-model="searchParams.name"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
style="width: 100%;"
|
||||
/>
|
||||
<el-form-item label="装备名称" prop="name">
|
||||
<el-input v-model="searchParams.name" placeholder="请输入" clearable style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号" prop="specificationModel" >
|
||||
<el-form-item label="规格型号" prop="specificationModel">
|
||||
<el-input
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="输入内容"
|
||||
v-model="searchParams.specificationModel"
|
||||
placeholder="输入内容"
|
||||
clearable
|
||||
style="width: 100%;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="装备编码" prop="code" >
|
||||
<el-input
|
||||
v-model="searchParams.code"
|
||||
placeholder="输入内容"
|
||||
clearable
|
||||
style="width: 100%;"
|
||||
/>
|
||||
<el-form-item label="装备编码" prop="code">
|
||||
<el-input v-model="searchParams.code" placeholder="输入内容" clearable style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item style="margin-left: 543px">
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" @click="getListDownEquipment">查询</el-button>
|
||||
<el-button size="small" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<div >
|
||||
<div>
|
||||
<div class="batch-up-btn-wrapper">
|
||||
<el-button
|
||||
size="mini"
|
||||
|
|
@ -244,30 +221,43 @@
|
|||
</div>
|
||||
|
||||
<el-table
|
||||
:data="downEquipmentList"
|
||||
show-overflow-tooltip
|
||||
border stripe
|
||||
@selection-change="handleSelectionChange"
|
||||
border
|
||||
stripe
|
||||
class="custom-table"
|
||||
height="546"
|
||||
show-overflow-tooltip
|
||||
:data="downEquipmentList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<!-- 弹窗表格列保持原有内容 -->
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column align="center" label="序号" type="index" width="80"/>
|
||||
<el-table-column align="center" label="装备名称" prop="name"/>
|
||||
<el-table-column align="center" label="规格型号" prop="specificationModel"/>
|
||||
<el-table-column align="center" label="装备编码" prop="code"/>
|
||||
<el-table-column align="center" label="计量单位" prop="unit"/>
|
||||
<el-table-column align="center" label="生产厂家" prop="manufacturer"/>
|
||||
<el-table-column align="center" label="出厂日期" prop="productionDate"/>
|
||||
<el-table-column align="center" label="资产原值(万元)" prop="originalValue"/>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column align="center" label="序号" type="index" width="80" />
|
||||
<el-table-column align="center" label="装备名称" prop="name" />
|
||||
<el-table-column align="center" label="规格型号" prop="specificationModel" />
|
||||
<el-table-column align="center" label="装备编码" prop="code" />
|
||||
<el-table-column align="center" label="计量单位" prop="unit" />
|
||||
<el-table-column align="center" label="生产厂家" prop="manufacturer" />
|
||||
<el-table-column align="center" label="出厂日期" prop="productionDate" />
|
||||
<el-table-column align="center" label="资产原值(万元)" prop="originalValue" />
|
||||
<el-table-column align="center" label="租赁价" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
:ref="`leasePriceInput${scope.$index}`"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请输入租赁价"
|
||||
v-model.trim="scope.row.oldLeasePrice"
|
||||
:class="{ 'lease-price-error': scope.row.priceError }"
|
||||
@blur="handleLeasePriceBlur(scope.row, scope.$index)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="status" label="装备状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status == 1" type="success" size="mini">在库</el-tag>
|
||||
<el-tag v-if="scope.row.status == 2" size="mini">自用</el-tag>
|
||||
<el-tag v-if="scope.row.status == 3" size="mini">共享</el-tag>
|
||||
<el-tag v-if="scope.row.status == 4" size="mini" type="danger">退役</el-tag>
|
||||
<el-tag v-if="scope.row.status == 5" size="mini" type="warning" >维修</el-tag>
|
||||
<el-tag v-if="scope.row.status == 5" size="mini" type="warning">维修</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -296,9 +286,9 @@ import {
|
|||
listDownEquipment,
|
||||
listEquipment,
|
||||
downEquipment,
|
||||
batchUpEquipment
|
||||
batchUpEquipment,
|
||||
} from '@/api/EquipmentUpOrDown/equipment'
|
||||
import {Message} from 'element-ui'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
export default {
|
||||
name: 'ProjectManagement',
|
||||
|
|
@ -315,7 +305,7 @@ export default {
|
|||
isAdd: true,
|
||||
isView: false,
|
||||
dialogSearchParams: {
|
||||
toolCategory: ''
|
||||
toolCategory: '',
|
||||
},
|
||||
searchParams: {
|
||||
major: '',
|
||||
|
|
@ -326,9 +316,9 @@ export default {
|
|||
status: '',
|
||||
code: '',
|
||||
pageSize: 10,
|
||||
pageNum: 1
|
||||
pageNum: 1,
|
||||
},
|
||||
projectTypeList: []
|
||||
projectTypeList: [],
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -355,7 +345,15 @@ export default {
|
|||
try {
|
||||
const res = await listDownEquipment(this.searchParams)
|
||||
if (res.code === 200) {
|
||||
this.downEquipmentList = res.rows || []
|
||||
this.downEquipmentList =
|
||||
res.rows.map((e) => {
|
||||
return {
|
||||
...e,
|
||||
isChangePrice: false, // 是否修改租赁价
|
||||
oldLeasePrice: e.leasePrice, // 原始租赁价
|
||||
priceError: false, // 价格校验错误标识
|
||||
}
|
||||
}) || []
|
||||
this.downTotal = res.total || 0
|
||||
} else {
|
||||
Message.error(res.message || '获取待上架装备列表失败')
|
||||
|
|
@ -374,7 +372,7 @@ export default {
|
|||
status: '',
|
||||
code: '',
|
||||
pageSize: this.searchParams.pageSize,
|
||||
pageNum: 1
|
||||
pageNum: 1,
|
||||
}
|
||||
this.$refs.searchFormRef?.clearValidate()
|
||||
this.getEquipmentList()
|
||||
|
|
@ -389,7 +387,7 @@ export default {
|
|||
status: '',
|
||||
code: '',
|
||||
pageSize: 10,
|
||||
pageNum: 1
|
||||
pageNum: 1,
|
||||
}
|
||||
this.$refs.searchFormRef?.clearValidate()
|
||||
this.getListDownEquipment()
|
||||
|
|
@ -429,17 +427,13 @@ export default {
|
|||
}
|
||||
|
||||
try {
|
||||
await this.$confirm(
|
||||
`确定下架选中的 ${this.selectedRows.length} 个装备吗?`,
|
||||
'提示',
|
||||
{
|
||||
await this.$confirm(`确定下架选中的 ${this.selectedRows.length} 个装备吗?`, '提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}
|
||||
)
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
|
||||
const ids = this.selectedRows.map(row => row.maId)
|
||||
const ids = this.selectedRows.map((row) => row.maId)
|
||||
const res = await batchDownEquipment(ids)
|
||||
|
||||
if (res.code === 200) {
|
||||
|
|
@ -456,38 +450,157 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
// 校验租赁价格格式
|
||||
validateLeasePrice(value) {
|
||||
// 如果为空,默认为0
|
||||
if (value === '' || value === null || value === undefined) {
|
||||
return { valid: true, value: 0 }
|
||||
}
|
||||
|
||||
// 转换为字符串进行校验
|
||||
const strValue = String(value).trim()
|
||||
if (strValue === '') {
|
||||
return { valid: true, value: 0 }
|
||||
}
|
||||
|
||||
// 正则:最多两位小数的数字
|
||||
const regex = /^\d+(\.\d{1,2})?$/
|
||||
if (!regex.test(strValue)) {
|
||||
return { valid: false, value: strValue }
|
||||
}
|
||||
|
||||
// 转换为数字进行范围校验
|
||||
const numValue = parseFloat(strValue)
|
||||
if (isNaN(numValue) || numValue < 0 || numValue >= 99999999.99) {
|
||||
return { valid: false, value: strValue }
|
||||
}
|
||||
|
||||
return { valid: true, value: numValue }
|
||||
},
|
||||
|
||||
// 租赁价格失去焦点时的处理
|
||||
handleLeasePriceBlur(row, index) {
|
||||
const validation = this.validateLeasePrice(row.oldLeasePrice)
|
||||
|
||||
// 如果为空,设置为0
|
||||
if (row.oldLeasePrice === '' || row.oldLeasePrice === null || row.oldLeasePrice === undefined) {
|
||||
this.$set(row, 'oldLeasePrice', 0)
|
||||
this.$set(row, 'priceError', false)
|
||||
return
|
||||
}
|
||||
|
||||
// 校验格式和范围
|
||||
if (!validation.valid) {
|
||||
this.$set(row, 'priceError', true)
|
||||
this.$modal.msgError(
|
||||
`第 ${index + 1} 行的租赁价格格式不正确,请输入大于等于0且小于99999999.99的数字(最多两位小数)`,
|
||||
)
|
||||
} else {
|
||||
this.$set(row, 'oldLeasePrice', validation.value)
|
||||
this.$set(row, 'priceError', false)
|
||||
}
|
||||
},
|
||||
|
||||
async handleBatchUp() {
|
||||
if (this.selectedRows.length === 0) {
|
||||
Message.warning('请选择要上架的装备')
|
||||
return
|
||||
}
|
||||
|
||||
// 遍历选中的行,校验租赁价格并设置isChangePrice
|
||||
const errorRows = []
|
||||
|
||||
// 遍历所有输入框ref进行校验
|
||||
for (let i = 0; i < this.downEquipmentList.length; i++) {
|
||||
const listRow = this.downEquipmentList[i]
|
||||
|
||||
// 检查该行是否在选中的行中
|
||||
const isSelected = this.selectedRows.some((selectedRow) => selectedRow.maId === listRow.maId)
|
||||
if (!isSelected) {
|
||||
continue
|
||||
}
|
||||
|
||||
// 校验租赁价格格式
|
||||
const validation = this.validateLeasePrice(listRow.oldLeasePrice)
|
||||
if (!validation.valid) {
|
||||
const displayIndex = i + 1
|
||||
errorRows.push(displayIndex)
|
||||
// 设置错误状态(通过priceError控制样式)
|
||||
this.$set(listRow, 'priceError', true)
|
||||
} else {
|
||||
// 如果为空,设置为0
|
||||
if (
|
||||
listRow.oldLeasePrice === '' ||
|
||||
listRow.oldLeasePrice === null ||
|
||||
listRow.oldLeasePrice === undefined
|
||||
) {
|
||||
this.$set(listRow, 'oldLeasePrice', 0)
|
||||
} else {
|
||||
this.$set(listRow, 'oldLeasePrice', validation.value)
|
||||
}
|
||||
this.$set(listRow, 'priceError', false)
|
||||
}
|
||||
|
||||
// 判断价格是否修改
|
||||
const originalPrice = listRow.leasePrice || 0
|
||||
const newPrice =
|
||||
listRow.oldLeasePrice === '' ||
|
||||
listRow.oldLeasePrice === null ||
|
||||
listRow.oldLeasePrice === undefined
|
||||
? 0
|
||||
: parseFloat(listRow.oldLeasePrice) || 0
|
||||
|
||||
this.$set(listRow, 'isChangePrice', originalPrice !== newPrice)
|
||||
}
|
||||
|
||||
// 同步更新selectedRows中的数据
|
||||
this.selectedRows.forEach((selectedRow) => {
|
||||
const listRow = this.downEquipmentList.find((item) => item.maId === selectedRow.maId)
|
||||
if (listRow) {
|
||||
selectedRow.oldLeasePrice = listRow.oldLeasePrice
|
||||
selectedRow.isChangePrice = listRow.isChangePrice
|
||||
selectedRow.priceError = listRow.priceError
|
||||
}
|
||||
})
|
||||
|
||||
// 如果有校验错误,统一提示用户
|
||||
if (errorRows.length > 0) {
|
||||
this.$modal.msgError(
|
||||
`第 ${errorRows.join(
|
||||
'、',
|
||||
)} 行的租赁价格格式不正确,请输入大于等于0且小于99999999.99的数字(最多两位小数)`,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await this.$confirm(
|
||||
`确定上架选中的 ${this.selectedRows.length} 个装备吗?`,
|
||||
'提示',
|
||||
{
|
||||
await this.$confirm(`确定上架选中的 ${this.selectedRows.length} 个装备吗?`, '提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
}
|
||||
)
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
|
||||
const ids = this.selectedRows.map(row => row.maId)
|
||||
const res = await batchUpEquipment(ids)
|
||||
// 组装参数
|
||||
const launchList = this.selectedRows.map((row) => {
|
||||
return {
|
||||
maId: row.maId,
|
||||
leasePrice: row.oldLeasePrice,
|
||||
isChangePrice: row.isChangePrice,
|
||||
}
|
||||
})
|
||||
|
||||
const res = await batchUpEquipment(launchList)
|
||||
|
||||
if (res.code === 200) {
|
||||
Message.success(`成功上架 ${this.selectedRows.length} 个装备`)
|
||||
this.$modal.msgSuccess(`成功上架 ${this.selectedRows.length} 个装备`)
|
||||
this.getListDownEquipment()
|
||||
this.getEquipmentList()
|
||||
this.selectedRows = []
|
||||
} else {
|
||||
Message.error(res.message || '批量上架失败')
|
||||
this.$modal.msgError(res.message || '批量上架失败')
|
||||
}
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') {
|
||||
Message.error('网络错误,批量上架失败')
|
||||
}
|
||||
console.log('error', error)
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -515,8 +628,8 @@ export default {
|
|||
handleDownCurrentChange(val) {
|
||||
this.searchParams.pageNum = val
|
||||
this.getListDownEquipment()
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -549,7 +662,6 @@ export default {
|
|||
}
|
||||
|
||||
.search-item {
|
||||
|
||||
min-width: 220px;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
|
@ -596,9 +708,9 @@ export default {
|
|||
width: 100%;
|
||||
|
||||
::v-deep .el-table__header {
|
||||
background: #E9F0EE;
|
||||
background: #e9f0ee;
|
||||
th {
|
||||
background: #E9F0EE !important;
|
||||
background: #e9f0ee !important;
|
||||
color: #606266;
|
||||
font-weight: 600;
|
||||
height: 48px;
|
||||
|
|
@ -606,11 +718,11 @@ export default {
|
|||
}
|
||||
|
||||
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
|
||||
background-color: #F6FBFA !important;
|
||||
background-color: #f6fbfa !important;
|
||||
}
|
||||
|
||||
::v-deep .el-table__body tr:hover > td.el-table__cell {
|
||||
background-color: #CCF1E9 !important;
|
||||
background-color: #ccf1e9 !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -669,15 +781,32 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
::v-deep .el-dialog__body {
|
||||
padding: 20px;
|
||||
max-height: 70vh;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
::v-deep .el-dialog__footer {
|
||||
padding: 10px 20px;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .el-dialog {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
margin: 0 !important;
|
||||
position: absolute !important;
|
||||
top: 50% !important;
|
||||
left: 50% !important;
|
||||
transform: translate(-50%, -50%) !important;
|
||||
min-height: 95vh !important;
|
||||
max-height: 95vh !important;
|
||||
.el-dialog__body {
|
||||
flex: 1 !important;
|
||||
overflow-y: scroll !important;
|
||||
padding: 20px 20px !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* 租赁价格输入框错误样式 */
|
||||
::v-deep .lease-price-error .el-input__inner {
|
||||
border-color: #f56c6c !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,167 +1,129 @@
|
|||
<template>
|
||||
<!-- 类型管理 -->
|
||||
<div class="app-container" id="toolsType">
|
||||
<el-row :gutter="20">
|
||||
<!--树数据-->
|
||||
<el-col :span="5" :xs="24">
|
||||
<div class="head-container">
|
||||
<el-row :gutter="10" class="main-content">
|
||||
<el-col :span="5">
|
||||
<el-card>
|
||||
<el-input
|
||||
v-model="typeName"
|
||||
placeholder="请输入类型名称"
|
||||
clearable
|
||||
maxlength="50"
|
||||
size="small"
|
||||
maxlength="50"
|
||||
v-model="typeName"
|
||||
prefix-icon="el-icon-search"
|
||||
placeholder="请输入类型名称"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
<el-tree
|
||||
ref="tree"
|
||||
node-key="id"
|
||||
highlight-current
|
||||
:data="treeOptions"
|
||||
:expand-on-click-node="false"
|
||||
@node-click="handleNodeClick"
|
||||
:filter-node-method="filterNode"
|
||||
:default-expanded-keys="defaultExpandedKeys"
|
||||
:props="{ children: 'children', label: 'label' }"
|
||||
>
|
||||
<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>
|
||||
</div>
|
||||
</el-tree>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="19" :xs="24">
|
||||
<el-col :span="5">
|
||||
<el-card>
|
||||
<el-input
|
||||
clearable
|
||||
size="small"
|
||||
maxlength="50"
|
||||
v-model="typeName_1"
|
||||
prefix-icon="el-icon-search"
|
||||
placeholder="请输入类型名称"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
<el-tree
|
||||
ref="tree_1"
|
||||
node-key="id"
|
||||
highlight-current
|
||||
:data="treeOptions2"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode_1"
|
||||
@node-click="handleNodeClick"
|
||||
:default-expanded-keys="defaultExpandedKeys2"
|
||||
:props="{ children: 'children', label: 'label' }"
|
||||
>
|
||||
<div class="custom-tree-node" slot-scope="{ node, data }">
|
||||
<span v-if="isMousemoveId === data.id && node.label.length > 10">{{
|
||||
node.label.slice(0, 10) + '...'
|
||||
}}</span>
|
||||
<span v-else>{{ node.label }}</span>
|
||||
</div>
|
||||
</el-tree>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<el-card class="table-container">
|
||||
<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"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
placeholder="请输入关键字"
|
||||
v-model="queryParams.keyWord"
|
||||
@keyup.enter.native="getList"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="getList">查询 </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>
|
||||
<el-row :gutter="20" style="height: 93%">
|
||||
<!--树数据-->
|
||||
<el-col :span="5" :xs="24" style="height: 100%">
|
||||
<div class="head-container" style="height: 100%">
|
||||
<el-tree
|
||||
style="overflow-y: auto"
|
||||
:data="treeOptions"
|
||||
:props="{ children: 'children', label: 'label' }"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
node-key="id"
|
||||
:default-expanded-keys="defaultExpandedKeys"
|
||||
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>
|
||||
</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>
|
||||
</div>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="18" style="height: 100%">
|
||||
<el-table v-if="typeList.length > 0" v-loading="loading" :data="typeList" border height="546" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="typeList" border @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="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"
|
||||
key="mainProcedure"
|
||||
prop="mainProcedure"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="装备类目"
|
||||
align="center"
|
||||
key="subProcedure"
|
||||
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="工具类型"
|
||||
align="center"
|
||||
key="grandparentTypeName"
|
||||
prop="grandparentTypeName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<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="mainProcedure" show-overflow-tooltip />
|
||||
<el-table-column label="装备类目" align="center" prop="subProcedure" show-overflow-tooltip />
|
||||
<el-table-column label="装备名称" align="center" prop="typeName" show-overflow-tooltip />
|
||||
<el-table-column label="租赁价" align="center" prop="leasePrice" show-overflow-tooltip />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
</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" />
|
||||
|
||||
<EditChildNode :visible.sync="editChildOpen" :parentNode="editChildNode" @refresh="refresh" />
|
||||
|
||||
<!-- 修改价格弹框 -->
|
||||
<el-dialog
|
||||
title="修改共享价"
|
||||
|
|
@ -187,16 +149,12 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaTypeList, delMaType, getList, updateLeasePriceApi } from '@/api/lessor/equipType'
|
||||
import { getMaTypeList, 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'
|
||||
import EditChildNode from '@/views/lessor/equipment/equipType/child/editChildNode.vue'
|
||||
|
||||
export default {
|
||||
name: 'ToolsType',
|
||||
components: { AddNode, EditNode, AddChildNode, EditChildNode },
|
||||
name: 'priceManagement',
|
||||
|
||||
data() {
|
||||
return {
|
||||
editPriceForm: {
|
||||
|
|
@ -212,38 +170,18 @@ export default {
|
|||
// 遮罩层
|
||||
loading: true,
|
||||
typeName: undefined,
|
||||
typeName_1: '',
|
||||
treeOptions: undefined,
|
||||
treeOptions2: undefined,
|
||||
addOpen: false,
|
||||
addParentNode: {},
|
||||
editOpen: false,
|
||||
editParentNode: {},
|
||||
|
||||
addChildOpen: false,
|
||||
addChildNode: {},
|
||||
editChildOpen: false,
|
||||
editChildNode: {},
|
||||
isMousemoveId: null,
|
||||
addFormParams: {
|
||||
label: '',
|
||||
typeName: '',
|
||||
companyId: 101,
|
||||
},
|
||||
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyWord: undefined,
|
||||
level: 1,
|
||||
},
|
||||
addFormParamsRules: {
|
||||
typeName: [
|
||||
{
|
||||
required: true,
|
||||
message: '名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
editPriceFormRules: {
|
||||
leasePrice: [
|
||||
{
|
||||
|
|
@ -258,9 +196,7 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
addTitleVisible: false,
|
||||
addTitle: '',
|
||||
showIsStateGrid: null,
|
||||
|
||||
ids: [],
|
||||
defaultExpandedKeys: [],
|
||||
defaultExpandedKeys2: [],
|
||||
|
|
@ -271,6 +207,9 @@ export default {
|
|||
typeName(val) {
|
||||
this.$refs.tree.filter(val)
|
||||
},
|
||||
typeName_1(val) {
|
||||
this.$refs.tree_1.filter(val)
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getTreeData()
|
||||
|
|
@ -368,11 +307,13 @@ export default {
|
|||
if (!value) return true
|
||||
return data.label.indexOf(value) !== -1
|
||||
},
|
||||
filterNode_1(value, data) {
|
||||
if (!value) return true
|
||||
return data.label.indexOf(value) !== -1
|
||||
},
|
||||
|
||||
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
|
||||
|
|
@ -389,90 +330,12 @@ export default {
|
|||
this.$refs.tree.setCurrentKey(null)
|
||||
this.getList()
|
||||
},
|
||||
appendTreeNode(data) {
|
||||
this.showIsStateGrid = data.level == 4
|
||||
if (data.level == 6) {
|
||||
const path = this.getParentNames(this.treeOptions, data.id)
|
||||
data.major = path[1]
|
||||
data.mainProcedure = path[2]
|
||||
this.addChildOpen = true
|
||||
this.addChildNode = data
|
||||
} else {
|
||||
this.addOpen = true
|
||||
this.addParentNode = data
|
||||
}
|
||||
},
|
||||
|
||||
editTreeNode(data) {
|
||||
console.log('🚀 ~ editTreeNode ~ data.level:', data)
|
||||
this.showIsStateGrid = data.level == 5
|
||||
if (data.level == 7) {
|
||||
const path = this.getParentNames(this.treeOptions, data.parentId)
|
||||
data.major = path[1]
|
||||
data.mainProcedure = path[2]
|
||||
this.editChildOpen = true
|
||||
this.editChildNode = data
|
||||
console.log(data)
|
||||
} else {
|
||||
this.editOpen = true
|
||||
this.editParentNode = data
|
||||
}
|
||||
},
|
||||
|
||||
removeTreeNode(data) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除数据项?')
|
||||
.then(() => delMaType(data.id || data.typeId))
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
this.getTreeData()
|
||||
this.getList()
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
onMousemove(data) {
|
||||
this.isMousemoveId = data.id
|
||||
},
|
||||
onMouseleave() {
|
||||
this.isMousemoveId = null
|
||||
},
|
||||
refresh() {
|
||||
this.getTreeData()
|
||||
this.getList()
|
||||
},
|
||||
/**
|
||||
* 根据节点ID查找完整父级路径名称
|
||||
* @param {Array} treeData 树形数据
|
||||
* @param {number} nodeId 要查找的节点ID
|
||||
* @returns {Array} 从根节点到目标节点的名称路径数组
|
||||
*/
|
||||
getParentNames(treeData, nodeId) {
|
||||
const path = []
|
||||
|
||||
function findNode(nodes, targetId) {
|
||||
for (const node of nodes) {
|
||||
// 如果找到目标节点
|
||||
if (node.id === targetId) {
|
||||
path.unshift(node.label) // 添加到路径开头
|
||||
return true
|
||||
}
|
||||
|
||||
// 如果有子节点且在其中找到了目标
|
||||
if (node.children && node.children.length > 0) {
|
||||
if (findNode(node.children, targetId)) {
|
||||
path.unshift(node.label) // 将当前节点添加到路径开头
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
findNode(treeData, nodeId)
|
||||
console.log(path)
|
||||
return path
|
||||
},
|
||||
//修改价格
|
||||
onBatchEditPrice() {
|
||||
this.$message.closeAll()
|
||||
|
|
@ -487,20 +350,13 @@ export default {
|
|||
|
||||
// 复选框
|
||||
handleSelectionChange(val) {
|
||||
console.log(val)
|
||||
this.ids = val
|
||||
},
|
||||
onEditCancel() {
|
||||
this.editLeasePriceVisible = false
|
||||
this.$refs.editPriceFormRef.resetFields()
|
||||
},
|
||||
handleUpdateLeasePrice(row) {
|
||||
this.editPriceForm.leasePrice = ''
|
||||
// this.batchEdit = false
|
||||
// this.editTypeIds = []
|
||||
// this.editTypeIds.push(row.typeId)
|
||||
this.editLeasePriceVisible = true
|
||||
},
|
||||
|
||||
onEditSubmit() {
|
||||
this.$refs.editPriceFormRef.validate(async (valid) => {
|
||||
if (valid) {
|
||||
|
|
@ -573,7 +429,6 @@ export default {
|
|||
}
|
||||
|
||||
::v-deep .el-tree {
|
||||
height: 300px;
|
||||
overflow-y: scroll; /* 必须保留scroll而不是auto */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
|
|
@ -582,4 +437,24 @@ export default {
|
|||
::v-deep .el-tree::-webkit-scrollbar {
|
||||
display: none; /* Chrome/Safari/Opera */
|
||||
}
|
||||
|
||||
.main-content {
|
||||
height: 100%;
|
||||
|
||||
.el-col {
|
||||
height: 100%;
|
||||
|
||||
.el-card {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .el-card__body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,635 @@
|
|||
<template>
|
||||
<!-- 类型管理 -->
|
||||
<div class="app-container" id="toolsType">
|
||||
<el-row :gutter="20">
|
||||
<!--树数据-->
|
||||
<el-col :span="5" :xs="24">
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="typeName"
|
||||
placeholder="请输入类型名称"
|
||||
clearable
|
||||
maxlength="50"
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="19" :xs="24">
|
||||
<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"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="getList"
|
||||
/>
|
||||
</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-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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" style="height: 93%">
|
||||
<!--树数据-->
|
||||
<el-col :span="5" :xs="24" style="height: 100%">
|
||||
<div class="head-container" style="height: 100%">
|
||||
<el-tree
|
||||
style="overflow-y: auto"
|
||||
:data="treeOptions"
|
||||
:props="{ children: 'children', label: 'label' }"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
node-key="id"
|
||||
:default-expanded-keys="defaultExpandedKeys"
|
||||
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>
|
||||
</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>
|
||||
</div>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="18" style="height: 100%">
|
||||
<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"
|
||||
key="mainProcedure"
|
||||
prop="mainProcedure"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="装备类目"
|
||||
align="center"
|
||||
key="subProcedure"
|
||||
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="工具类型"
|
||||
align="center"
|
||||
key="grandparentTypeName"
|
||||
prop="grandparentTypeName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<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"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</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" />
|
||||
|
||||
<EditChildNode :visible.sync="editChildOpen" :parentNode="editChildNode" @refresh="refresh" />
|
||||
|
||||
<!-- 修改价格弹框 -->
|
||||
<el-dialog
|
||||
title="修改共享价"
|
||||
:visible.sync="editLeasePriceVisible"
|
||||
v-if="editLeasePriceVisible"
|
||||
width="30%"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form :inline="true" :model="editPriceForm" ref="editPriceFormRef" :rules="editPriceFormRules">
|
||||
<el-form-item label="修改后租赁价" prop="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-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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'
|
||||
import EditChildNode from '@/views/lessor/equipment/equipType/child/editChildNode.vue'
|
||||
|
||||
export default {
|
||||
name: 'ToolsType',
|
||||
components: { AddNode, EditNode, AddChildNode, EditChildNode },
|
||||
data() {
|
||||
return {
|
||||
editPriceForm: {
|
||||
leasePrice: '',
|
||||
},
|
||||
editLeasePriceVisible: false,
|
||||
|
||||
// 总条数
|
||||
total: 0,
|
||||
//列表数据
|
||||
typeList: undefined,
|
||||
typeList2: [],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
typeName: undefined,
|
||||
treeOptions: undefined,
|
||||
treeOptions2: undefined,
|
||||
addOpen: false,
|
||||
addParentNode: {},
|
||||
editOpen: false,
|
||||
editParentNode: {},
|
||||
|
||||
addChildOpen: false,
|
||||
addChildNode: {},
|
||||
editChildOpen: false,
|
||||
editChildNode: {},
|
||||
isMousemoveId: null,
|
||||
addFormParams: {
|
||||
label: '',
|
||||
typeName: '',
|
||||
companyId: 101,
|
||||
},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyWord: undefined,
|
||||
level: 1,
|
||||
},
|
||||
addFormParamsRules: {
|
||||
typeName: [
|
||||
{
|
||||
required: true,
|
||||
message: '名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
editPriceFormRules: {
|
||||
leasePrice: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入修改后共享价格',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
pattern: /^(0(\.\d{0,2})?|([1-9]\d*)(\.\d{0,2})?)$/,
|
||||
message: '请输入正确的费用金额,最多两位小数点',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
addTitleVisible: false,
|
||||
addTitle: '',
|
||||
showIsStateGrid: null,
|
||||
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
|
||||
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) => ({
|
||||
...node,
|
||||
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) : [],
|
||||
}))
|
||||
}
|
||||
|
||||
this.treeOptions = [
|
||||
{
|
||||
label: '机具类型',
|
||||
id: 0,
|
||||
children: filterTree(response.data),
|
||||
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
|
||||
return data.label.indexOf(value) !== -1
|
||||
},
|
||||
|
||||
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
|
||||
this.getList()
|
||||
},
|
||||
|
||||
resetQuery() {
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.queryParams.typeId = undefined
|
||||
this.queryParams.pageNum = 1
|
||||
this.queryParams.pageSize = 10
|
||||
this.queryParams.level = 1
|
||||
this.$refs.tree.setCurrentKey(null)
|
||||
this.getList()
|
||||
},
|
||||
appendTreeNode(data) {
|
||||
this.showIsStateGrid = data.level == 4
|
||||
if (data.level == 6) {
|
||||
const path = this.getParentNames(this.treeOptions, data.id)
|
||||
data.major = path[1]
|
||||
data.mainProcedure = path[2]
|
||||
this.addChildOpen = true
|
||||
this.addChildNode = data
|
||||
} else {
|
||||
this.addOpen = true
|
||||
this.addParentNode = data
|
||||
}
|
||||
},
|
||||
|
||||
editTreeNode(data) {
|
||||
console.log('🚀 ~ editTreeNode ~ data.level:', data)
|
||||
this.showIsStateGrid = data.level == 5
|
||||
if (data.level == 7) {
|
||||
const path = this.getParentNames(this.treeOptions, data.parentId)
|
||||
data.major = path[1]
|
||||
data.mainProcedure = path[2]
|
||||
this.editChildOpen = true
|
||||
this.editChildNode = data
|
||||
console.log(data)
|
||||
} else {
|
||||
this.editOpen = true
|
||||
this.editParentNode = data
|
||||
}
|
||||
},
|
||||
|
||||
removeTreeNode(data) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除数据项?')
|
||||
.then(() => delMaType(data.id || data.typeId))
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
this.getTreeData()
|
||||
this.getList()
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
onMousemove(data) {
|
||||
this.isMousemoveId = data.id
|
||||
},
|
||||
onMouseleave() {
|
||||
this.isMousemoveId = null
|
||||
},
|
||||
refresh() {
|
||||
this.getTreeData()
|
||||
this.getList()
|
||||
},
|
||||
/**
|
||||
* 根据节点ID查找完整父级路径名称
|
||||
* @param {Array} treeData 树形数据
|
||||
* @param {number} nodeId 要查找的节点ID
|
||||
* @returns {Array} 从根节点到目标节点的名称路径数组
|
||||
*/
|
||||
getParentNames(treeData, nodeId) {
|
||||
const path = []
|
||||
|
||||
function findNode(nodes, targetId) {
|
||||
for (const node of nodes) {
|
||||
// 如果找到目标节点
|
||||
if (node.id === targetId) {
|
||||
path.unshift(node.label) // 添加到路径开头
|
||||
return true
|
||||
}
|
||||
|
||||
// 如果有子节点且在其中找到了目标
|
||||
if (node.children && node.children.length > 0) {
|
||||
if (findNode(node.children, targetId)) {
|
||||
path.unshift(node.label) // 将当前节点添加到路径开头
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
findNode(treeData, nodeId)
|
||||
console.log(path)
|
||||
return path
|
||||
},
|
||||
//修改价格
|
||||
onBatchEditPrice() {
|
||||
this.$message.closeAll()
|
||||
if (this.ids.length < 1) {
|
||||
this.$message.error('请勾选改价的设备')
|
||||
return
|
||||
}
|
||||
this.editPriceForm.leasePrice = ''
|
||||
// this.batchEdit = true
|
||||
this.editLeasePriceVisible = true
|
||||
},
|
||||
|
||||
// 复选框
|
||||
handleSelectionChange(val) {
|
||||
console.log(val)
|
||||
this.ids = val
|
||||
},
|
||||
onEditCancel() {
|
||||
this.editLeasePriceVisible = false
|
||||
this.$refs.editPriceFormRef.resetFields()
|
||||
},
|
||||
handleUpdateLeasePrice(row) {
|
||||
this.editPriceForm.leasePrice = ''
|
||||
// this.batchEdit = false
|
||||
// this.editTypeIds = []
|
||||
// this.editTypeIds.push(row.typeId)
|
||||
this.editLeasePriceVisible = true
|
||||
},
|
||||
onEditSubmit() {
|
||||
this.$refs.editPriceFormRef.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const params = {
|
||||
typeIds: this.ids.map((e) => e.typeId),
|
||||
leasePrice: this.editPriceForm.leasePrice * 1,
|
||||
}
|
||||
let res = null
|
||||
if (this.isTool) {
|
||||
res = await updateLeasePriceTool(params)
|
||||
} else {
|
||||
res = await updateLeasePriceApi(params)
|
||||
}
|
||||
if (res.code === 200) {
|
||||
this.$message.success('修改成功')
|
||||
this.editLeasePriceVisible = false
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.el-table .fixed-width .el-button--mini {
|
||||
width: 60px !important;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
::v-deep .btn-items .el-button + .el-button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.btn-items {
|
||||
margin-left: 4px;
|
||||
|
||||
.el-button--text {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
::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';
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
::v-deep .el-tree .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
|
||||
content: '\e781';
|
||||
font-size: 16px;
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
|
||||
color: #1890ff !important;
|
||||
}
|
||||
|
||||
::v-deep .el-tree-node__expand-icon.is-leaf {
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
::v-deep .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
|
||||
background-color: #8decf1;
|
||||
}
|
||||
|
||||
::v-deep .el-tree {
|
||||
height: 300px;
|
||||
overflow-y: scroll; /* 必须保留scroll而不是auto */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
}
|
||||
|
||||
::v-deep .el-tree::-webkit-scrollbar {
|
||||
display: none; /* Chrome/Safari/Opera */
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue