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">
|
<el-card class="search-box">
|
||||||
<!-- 用Flex实现自动换行+均匀分布 -->
|
<!-- 用Flex实现自动换行+均匀分布 -->
|
||||||
<div >
|
<div>
|
||||||
<el-form-item prop="major" label="专业" >
|
<el-form-item prop="major" label="专业">
|
||||||
<el-input
|
<el-input clearable placeholder="请输入" v-model="searchParams.major" style="width: 230px" />
|
||||||
clearable
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model="searchParams.major"
|
|
||||||
style="width: 230px;"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="subProcess" label="工序" label-width="60px">
|
<el-form-item prop="subProcess" label="工序" label-width="60px">
|
||||||
|
|
@ -26,35 +21,25 @@
|
||||||
clearable
|
clearable
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
v-model="searchParams.subProcess"
|
v-model="searchParams.subProcess"
|
||||||
style="width: 230px;"
|
style="width: 230px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="name" label="装备名称" >
|
<el-form-item prop="name" label="装备名称">
|
||||||
<el-input
|
<el-input clearable placeholder="请输入" v-model="searchParams.name" style="width: 230px" />
|
||||||
clearable
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model="searchParams.name"
|
|
||||||
style="width: 230px;"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="specificationModel" label="规格型号" >
|
<el-form-item prop="specificationModel" label="规格型号">
|
||||||
<el-input
|
<el-input
|
||||||
clearable
|
clearable
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
v-model="searchParams.specificationModel"
|
v-model="searchParams.specificationModel"
|
||||||
style="width: 230px;"
|
style="width: 230px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="status" label="装备状态" >
|
<el-form-item prop="status" label="装备状态">
|
||||||
<el-select
|
<el-select clearable placeholder="请选择" v-model="searchParams.status" style="width: 230px">
|
||||||
clearable
|
|
||||||
placeholder="请选择"
|
|
||||||
v-model="searchParams.status"
|
|
||||||
style="width: 230px;"
|
|
||||||
>
|
|
||||||
<el-option label="在库" value="1"></el-option>
|
<el-option label="在库" value="1"></el-option>
|
||||||
<el-option label="自用" value="2"></el-option>
|
<el-option label="自用" value="2"></el-option>
|
||||||
<el-option label="共享" value="3"></el-option>
|
<el-option label="共享" value="3"></el-option>
|
||||||
|
|
@ -63,23 +48,25 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="code" label="装备编码" >
|
<el-form-item prop="code" label="装备编码">
|
||||||
<el-input
|
<el-input clearable placeholder="请输入" v-model="searchParams.code" style="width: 230px" />
|
||||||
clearable
|
|
||||||
placeholder="请输入"
|
|
||||||
v-model="searchParams.code"
|
|
||||||
style="width: 230px;"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
<!-- 按钮区域:固定在右侧 -->
|
<!-- 按钮区域:固定在右侧 -->
|
||||||
<el-form-item style="float:right">
|
<el-form-item style="float: right">
|
||||||
<el-button @click="getEquipmentList" size="mini" icon="el-icon-search" type="primary" class="primary-lease">
|
<el-button
|
||||||
|
@click="getEquipmentList"
|
||||||
|
size="mini"
|
||||||
|
icon="el-icon-search"
|
||||||
|
type="primary"
|
||||||
|
class="primary-lease"
|
||||||
|
>
|
||||||
查询
|
查询
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="onReset" icon="el-icon-refresh" size="mini" class="primary-lease">重置</el-button>
|
<el-button @click="onReset" icon="el-icon-refresh" size="mini" class="primary-lease"
|
||||||
</el-form-item >
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
@ -97,62 +84,58 @@
|
||||||
批量下架
|
批量下架
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<el-button
|
<el-button size="mini" @click="equipment" type="primary" class="primary-lease">
|
||||||
size="mini"
|
|
||||||
@click="equipment"
|
|
||||||
type="primary"
|
|
||||||
class="primary-lease"
|
|
||||||
>
|
|
||||||
添加上架装备
|
添加上架装备
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
:data="equipmentList"
|
:data="equipmentList"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
border stripe
|
border
|
||||||
|
stripe
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
class="custom-table"
|
class="custom-table"
|
||||||
height="546"
|
height="546"
|
||||||
>
|
>
|
||||||
<!-- 表格列保持原有内容 -->
|
<!-- 表格列保持原有内容 -->
|
||||||
<el-table-column type="selection" width="55" align="center"/>
|
<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="序号" type="index" width="80" />
|
||||||
<el-table-column align="center" prop="province" label="所属省份"/>
|
<el-table-column align="center" prop="province" label="所属省份" />
|
||||||
<el-table-column align="center" prop="propertyUnit" label="产权单位"/>
|
<el-table-column align="center" prop="propertyUnit" label="产权单位" />
|
||||||
<el-table-column align="center" prop="major" label="专业"/>
|
<el-table-column align="center" prop="major" label="专业" />
|
||||||
<el-table-column align="center" prop="subProcess" label="工序"/>
|
<el-table-column align="center" prop="subProcess" label="工序" />
|
||||||
<el-table-column align="center" prop="subCategory" label="装备类目"/>
|
<el-table-column align="center" prop="subCategory" label="装备类目" />
|
||||||
<el-table-column align="center" prop="name" label="装备名称"/>
|
<el-table-column align="center" prop="name" label="装备名称" />
|
||||||
<el-table-column align="center" prop="specificationModel" label="规格型号"/>
|
<el-table-column align="center" prop="specificationModel" label="规格型号" />
|
||||||
<el-table-column align="center" prop="code" label="装备编码"/>
|
<el-table-column align="center" prop="code" label="装备编码" />
|
||||||
<el-table-column align="center" prop="status" label="装备状态">
|
<el-table-column align="center" prop="status" label="装备状态">
|
||||||
<template slot-scope="scope">
|
<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 == 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 == 2" size="mini">自用</el-tag>
|
||||||
<el-tag v-if="scope.row.status == 3" 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 == 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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" prop="serviceLife" label="使用年限"/>
|
<el-table-column align="center" prop="serviceLife" label="使用年限" />
|
||||||
<el-table-column align="center" prop="usingProject" label="使用项目"/>
|
<el-table-column align="center" prop="usingProject" label="使用项目" />
|
||||||
<el-table-column align="center" prop="expirationTime" label="使用到期时间"/>
|
<el-table-column align="center" prop="expirationTime" label="使用到期时间" />
|
||||||
<el-table-column align="center" prop="originalCode" label="装备原始编码"/>
|
<el-table-column align="center" prop="originalCode" label="装备原始编码" />
|
||||||
<el-table-column align="center" prop="unit" label="计量单位"/>
|
<el-table-column align="center" prop="unit" label="计量单位" />
|
||||||
<el-table-column align="center" prop="manufacturer" label="生产厂家"/>
|
<el-table-column align="center" prop="manufacturer" label="生产厂家" />
|
||||||
<el-table-column align="center" prop="productionDate" label="出厂日期"/>
|
<el-table-column align="center" prop="productionDate" label="出厂日期" />
|
||||||
<el-table-column align="center" prop="purchaseDate" label="采购日期"/>
|
<el-table-column align="center" prop="purchaseDate" label="采购日期" />
|
||||||
<el-table-column align="center" prop="originalValue" label="资产原值(万元)"/>
|
<el-table-column align="center" prop="originalValue" label="资产原值(万元)" />
|
||||||
<el-table-column align="center" prop="maxServiceLifeYears" label="最大使用年限(年)"/>
|
<el-table-column align="center" prop="maxServiceLifeYears" label="最大使用年限(年)" />
|
||||||
<el-table-column align="center" prop="nextMaintenanceDate" label="下次维保日期"/>
|
<el-table-column align="center" prop="nextMaintenanceDate" label="下次维保日期" />
|
||||||
<el-table-column align="center" prop="appearanceImages" label="装备外观"/>
|
<el-table-column align="center" prop="appearanceImages" label="装备外观" />
|
||||||
<el-table-column align="center" prop="certificates" label="合格证"/>
|
<el-table-column align="center" prop="certificates" label="合格证" />
|
||||||
<el-table-column align="center" prop="inspectionReports" label="定期检验报告"/>
|
<el-table-column align="center" prop="inspectionReports" label="定期检验报告" />
|
||||||
<el-table-column align="center" prop="purchaseInvoices" label="采购发票"/>
|
<el-table-column align="center" prop="purchaseInvoices" label="采购发票" />
|
||||||
<el-table-column align="center" prop="feature1" label="特征项1"/>
|
<el-table-column align="center" prop="feature1" label="特征项1" />
|
||||||
<el-table-column align="center" prop="featureValue1" 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">
|
<el-table-column align="center" label="操作" :width="199" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
@ -164,7 +147,12 @@
|
||||||
@confirm="handleDown(scope.row.maId)"
|
@confirm="handleDown(scope.row.maId)"
|
||||||
>
|
>
|
||||||
<template slot="reference">
|
<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>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -173,7 +161,6 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
|
|
||||||
<div class="pagination-wrapper">
|
<div class="pagination-wrapper">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
background
|
background
|
||||||
|
|
@ -190,47 +177,37 @@
|
||||||
|
|
||||||
<!-- 添加上架装备弹窗(保持原有内容,优化样式) -->
|
<!-- 添加上架装备弹窗(保持原有内容,优化样式) -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
width="1600px"
|
width="95%"
|
||||||
@close="handleDialogClose"
|
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
:title="dialogTitle"
|
:title="dialogTitle"
|
||||||
:visible.sync="equipmentDialogVisible"
|
@close="handleDialogClose"
|
||||||
custom-class="simple-dialog"
|
custom-class="simple-dialog"
|
||||||
|
:visible.sync="equipmentDialogVisible"
|
||||||
>
|
>
|
||||||
<el-form :inline="true" :model="searchParams" class="dialog-search-form">
|
<el-form :inline="true" :model="searchParams" class="dialog-search-form">
|
||||||
<el-row style="height: 36px">
|
<el-row style="height: 36px">
|
||||||
<el-form-item label="装备名称" prop="name" >
|
<el-form-item label="装备名称" prop="name">
|
||||||
<el-input
|
<el-input v-model="searchParams.name" placeholder="请输入" clearable style="width: 100%" />
|
||||||
v-model="searchParams.name"
|
|
||||||
placeholder="请输入"
|
|
||||||
clearable
|
|
||||||
style="width: 100%;"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="规格型号" prop="specificationModel" >
|
<el-form-item label="规格型号" prop="specificationModel">
|
||||||
<el-input
|
<el-input
|
||||||
|
clearable
|
||||||
|
style="width: 100%"
|
||||||
|
placeholder="输入内容"
|
||||||
v-model="searchParams.specificationModel"
|
v-model="searchParams.specificationModel"
|
||||||
placeholder="输入内容"
|
|
||||||
clearable
|
|
||||||
style="width: 100%;"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="装备编码" prop="code" >
|
<el-form-item label="装备编码" prop="code">
|
||||||
<el-input
|
<el-input v-model="searchParams.code" placeholder="输入内容" clearable style="width: 100%" />
|
||||||
v-model="searchParams.code"
|
|
||||||
placeholder="输入内容"
|
|
||||||
clearable
|
|
||||||
style="width: 100%;"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</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" type="primary" @click="getListDownEquipment">查询</el-button>
|
||||||
<el-button size="small" @click="handleReset">重置</el-button>
|
<el-button size="small" @click="handleReset">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<div >
|
<div>
|
||||||
<div class="batch-up-btn-wrapper">
|
<div class="batch-up-btn-wrapper">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
|
|
@ -244,30 +221,43 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
:data="downEquipmentList"
|
border
|
||||||
show-overflow-tooltip
|
stripe
|
||||||
border stripe
|
|
||||||
@selection-change="handleSelectionChange"
|
|
||||||
class="custom-table"
|
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 type="selection" width="55" align="center" />
|
||||||
<el-table-column align="center" label="序号" type="index" width="80"/>
|
<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="name" />
|
||||||
<el-table-column align="center" label="规格型号" prop="specificationModel"/>
|
<el-table-column align="center" label="规格型号" prop="specificationModel" />
|
||||||
<el-table-column align="center" label="装备编码" prop="code"/>
|
<el-table-column align="center" label="装备编码" prop="code" />
|
||||||
<el-table-column align="center" label="计量单位" prop="unit"/>
|
<el-table-column align="center" label="计量单位" prop="unit" />
|
||||||
<el-table-column align="center" label="生产厂家" prop="manufacturer"/>
|
<el-table-column align="center" label="生产厂家" prop="manufacturer" />
|
||||||
<el-table-column align="center" label="出厂日期" prop="productionDate"/>
|
<el-table-column align="center" label="出厂日期" prop="productionDate" />
|
||||||
<el-table-column align="center" label="资产原值(万元)" prop="originalValue"/>
|
<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="装备状态">
|
<el-table-column align="center" prop="status" label="装备状态">
|
||||||
<template slot-scope="scope">
|
<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 == 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 == 2" size="mini">自用</el-tag>
|
||||||
<el-tag v-if="scope.row.status == 3" 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 == 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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -296,9 +286,9 @@ import {
|
||||||
listDownEquipment,
|
listDownEquipment,
|
||||||
listEquipment,
|
listEquipment,
|
||||||
downEquipment,
|
downEquipment,
|
||||||
batchUpEquipment
|
batchUpEquipment,
|
||||||
} from '@/api/EquipmentUpOrDown/equipment'
|
} from '@/api/EquipmentUpOrDown/equipment'
|
||||||
import {Message} from 'element-ui'
|
import { Message } from 'element-ui'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ProjectManagement',
|
name: 'ProjectManagement',
|
||||||
|
|
@ -315,7 +305,7 @@ export default {
|
||||||
isAdd: true,
|
isAdd: true,
|
||||||
isView: false,
|
isView: false,
|
||||||
dialogSearchParams: {
|
dialogSearchParams: {
|
||||||
toolCategory: ''
|
toolCategory: '',
|
||||||
},
|
},
|
||||||
searchParams: {
|
searchParams: {
|
||||||
major: '',
|
major: '',
|
||||||
|
|
@ -326,9 +316,9 @@ export default {
|
||||||
status: '',
|
status: '',
|
||||||
code: '',
|
code: '',
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pageNum: 1
|
pageNum: 1,
|
||||||
},
|
},
|
||||||
projectTypeList: []
|
projectTypeList: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -355,7 +345,15 @@ export default {
|
||||||
try {
|
try {
|
||||||
const res = await listDownEquipment(this.searchParams)
|
const res = await listDownEquipment(this.searchParams)
|
||||||
if (res.code === 200) {
|
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
|
this.downTotal = res.total || 0
|
||||||
} else {
|
} else {
|
||||||
Message.error(res.message || '获取待上架装备列表失败')
|
Message.error(res.message || '获取待上架装备列表失败')
|
||||||
|
|
@ -374,7 +372,7 @@ export default {
|
||||||
status: '',
|
status: '',
|
||||||
code: '',
|
code: '',
|
||||||
pageSize: this.searchParams.pageSize,
|
pageSize: this.searchParams.pageSize,
|
||||||
pageNum: 1
|
pageNum: 1,
|
||||||
}
|
}
|
||||||
this.$refs.searchFormRef?.clearValidate()
|
this.$refs.searchFormRef?.clearValidate()
|
||||||
this.getEquipmentList()
|
this.getEquipmentList()
|
||||||
|
|
@ -389,7 +387,7 @@ export default {
|
||||||
status: '',
|
status: '',
|
||||||
code: '',
|
code: '',
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pageNum: 1
|
pageNum: 1,
|
||||||
}
|
}
|
||||||
this.$refs.searchFormRef?.clearValidate()
|
this.$refs.searchFormRef?.clearValidate()
|
||||||
this.getListDownEquipment()
|
this.getListDownEquipment()
|
||||||
|
|
@ -429,17 +427,13 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.$confirm(
|
await this.$confirm(`确定下架选中的 ${this.selectedRows.length} 个装备吗?`, '提示', {
|
||||||
`确定下架选中的 ${this.selectedRows.length} 个装备吗?`,
|
|
||||||
'提示',
|
|
||||||
{
|
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消'
|
cancelButtonText: '取消',
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const ids = this.selectedRows.map(row => row.maId)
|
const ids = this.selectedRows.map((row) => row.maId)
|
||||||
const res = await batchDownEquipment(ids)
|
const res = await batchDownEquipment(ids)
|
||||||
|
|
||||||
if (res.code === 200) {
|
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() {
|
async handleBatchUp() {
|
||||||
if (this.selectedRows.length === 0) {
|
if (this.selectedRows.length === 0) {
|
||||||
Message.warning('请选择要上架的装备')
|
Message.warning('请选择要上架的装备')
|
||||||
return
|
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 {
|
try {
|
||||||
await this.$confirm(
|
await this.$confirm(`确定上架选中的 ${this.selectedRows.length} 个装备吗?`, '提示', {
|
||||||
`确定上架选中的 ${this.selectedRows.length} 个装备吗?`,
|
|
||||||
'提示',
|
|
||||||
{
|
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
confirmButtonText: '确定',
|
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) {
|
if (res.code === 200) {
|
||||||
Message.success(`成功上架 ${this.selectedRows.length} 个装备`)
|
this.$modal.msgSuccess(`成功上架 ${this.selectedRows.length} 个装备`)
|
||||||
this.getListDownEquipment()
|
this.getListDownEquipment()
|
||||||
this.getEquipmentList()
|
this.getEquipmentList()
|
||||||
this.selectedRows = []
|
this.selectedRows = []
|
||||||
} else {
|
} else {
|
||||||
Message.error(res.message || '批量上架失败')
|
this.$modal.msgError(res.message || '批量上架失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error !== 'cancel') {
|
console.log('error', error)
|
||||||
Message.error('网络错误,批量上架失败')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -515,8 +628,8 @@ export default {
|
||||||
handleDownCurrentChange(val) {
|
handleDownCurrentChange(val) {
|
||||||
this.searchParams.pageNum = val
|
this.searchParams.pageNum = val
|
||||||
this.getListDownEquipment()
|
this.getListDownEquipment()
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -549,7 +662,6 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-item {
|
.search-item {
|
||||||
|
|
||||||
min-width: 220px;
|
min-width: 220px;
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
@ -596,9 +708,9 @@ export default {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
::v-deep .el-table__header {
|
::v-deep .el-table__header {
|
||||||
background: #E9F0EE;
|
background: #e9f0ee;
|
||||||
th {
|
th {
|
||||||
background: #E9F0EE !important;
|
background: #e9f0ee !important;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
|
|
@ -606,11 +718,11 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
|
::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 {
|
::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 {
|
::v-deep .el-dialog__footer {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
border-top: 1px solid #eee;
|
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>
|
</style>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,167 +1,129 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 类型管理 -->
|
<!-- 类型管理 -->
|
||||||
<div class="app-container" id="toolsType">
|
<div class="app-container" id="toolsType">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="10" class="main-content">
|
||||||
<!--树数据-->
|
<el-col :span="5">
|
||||||
<el-col :span="5" :xs="24">
|
<el-card>
|
||||||
<div class="head-container">
|
|
||||||
<el-input
|
<el-input
|
||||||
v-model="typeName"
|
|
||||||
placeholder="请输入类型名称"
|
|
||||||
clearable
|
clearable
|
||||||
maxlength="50"
|
|
||||||
size="small"
|
size="small"
|
||||||
|
maxlength="50"
|
||||||
|
v-model="typeName"
|
||||||
prefix-icon="el-icon-search"
|
prefix-icon="el-icon-search"
|
||||||
|
placeholder="请输入类型名称"
|
||||||
style="margin-bottom: 20px"
|
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>
|
</div>
|
||||||
|
</el-tree>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</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 :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"
|
|
||||||
placeholder="请输入关键字"
|
|
||||||
clearable
|
clearable
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
|
placeholder="请输入关键字"
|
||||||
|
v-model="queryParams.keyWord"
|
||||||
@keyup.enter.native="getList"
|
@keyup.enter.native="getList"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<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-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 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-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</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
|
<el-table v-loading="loading" :data="typeList" border @selection-change="handleSelectionChange">
|
||||||
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 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="major" prop="major" show-overflow-tooltip />
|
||||||
<el-table-column
|
<el-table-column label="子工序" align="center" prop="mainProcedure" show-overflow-tooltip />
|
||||||
label="子工序"
|
<el-table-column label="装备类目" align="center" prop="subProcedure" show-overflow-tooltip />
|
||||||
align="center"
|
<el-table-column label="装备名称" align="center" prop="typeName" show-overflow-tooltip />
|
||||||
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-column label="租赁价" align="center" prop="leasePrice" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
:total="total"
|
:total="total"
|
||||||
|
@pagination="getList"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
|
||||||
/>
|
/>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</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
|
<el-dialog
|
||||||
title="修改共享价"
|
title="修改共享价"
|
||||||
|
|
@ -187,16 +149,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 { 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 {
|
export default {
|
||||||
name: 'ToolsType',
|
name: 'priceManagement',
|
||||||
components: { AddNode, EditNode, AddChildNode, EditChildNode },
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
editPriceForm: {
|
editPriceForm: {
|
||||||
|
|
@ -212,38 +170,18 @@ export default {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
typeName: undefined,
|
typeName: undefined,
|
||||||
|
typeName_1: '',
|
||||||
treeOptions: undefined,
|
treeOptions: undefined,
|
||||||
treeOptions2: undefined,
|
treeOptions2: undefined,
|
||||||
addOpen: false,
|
|
||||||
addParentNode: {},
|
|
||||||
editOpen: false,
|
|
||||||
editParentNode: {},
|
|
||||||
|
|
||||||
addChildOpen: false,
|
|
||||||
addChildNode: {},
|
|
||||||
editChildOpen: false,
|
|
||||||
editChildNode: {},
|
|
||||||
isMousemoveId: null,
|
isMousemoveId: null,
|
||||||
addFormParams: {
|
|
||||||
label: '',
|
|
||||||
typeName: '',
|
|
||||||
companyId: 101,
|
|
||||||
},
|
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
keyWord: undefined,
|
keyWord: undefined,
|
||||||
level: 1,
|
level: 1,
|
||||||
},
|
},
|
||||||
addFormParamsRules: {
|
|
||||||
typeName: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '名称不能为空',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
editPriceFormRules: {
|
editPriceFormRules: {
|
||||||
leasePrice: [
|
leasePrice: [
|
||||||
{
|
{
|
||||||
|
|
@ -258,9 +196,7 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
addTitleVisible: false,
|
|
||||||
addTitle: '',
|
|
||||||
showIsStateGrid: null,
|
|
||||||
ids: [],
|
ids: [],
|
||||||
defaultExpandedKeys: [],
|
defaultExpandedKeys: [],
|
||||||
defaultExpandedKeys2: [],
|
defaultExpandedKeys2: [],
|
||||||
|
|
@ -271,6 +207,9 @@ export default {
|
||||||
typeName(val) {
|
typeName(val) {
|
||||||
this.$refs.tree.filter(val)
|
this.$refs.tree.filter(val)
|
||||||
},
|
},
|
||||||
|
typeName_1(val) {
|
||||||
|
this.$refs.tree_1.filter(val)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getTreeData()
|
this.getTreeData()
|
||||||
|
|
@ -368,11 +307,13 @@ export default {
|
||||||
if (!value) return true
|
if (!value) return true
|
||||||
return data.label.indexOf(value) !== -1
|
return data.label.indexOf(value) !== -1
|
||||||
},
|
},
|
||||||
|
filterNode_1(value, data) {
|
||||||
|
if (!value) return true
|
||||||
|
return data.label.indexOf(value) !== -1
|
||||||
|
},
|
||||||
|
|
||||||
handleNodeClick(data) {
|
handleNodeClick(data) {
|
||||||
console.log('节点点击', data)
|
|
||||||
this.isTool = data.isTool
|
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
|
||||||
|
|
@ -389,90 +330,12 @@ export default {
|
||||||
this.$refs.tree.setCurrentKey(null)
|
this.$refs.tree.setCurrentKey(null)
|
||||||
this.getList()
|
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() {
|
refresh() {
|
||||||
this.getTreeData()
|
this.getTreeData()
|
||||||
this.getList()
|
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() {
|
onBatchEditPrice() {
|
||||||
this.$message.closeAll()
|
this.$message.closeAll()
|
||||||
|
|
@ -487,20 +350,13 @@ export default {
|
||||||
|
|
||||||
// 复选框
|
// 复选框
|
||||||
handleSelectionChange(val) {
|
handleSelectionChange(val) {
|
||||||
console.log(val)
|
|
||||||
this.ids = val
|
this.ids = val
|
||||||
},
|
},
|
||||||
onEditCancel() {
|
onEditCancel() {
|
||||||
this.editLeasePriceVisible = false
|
this.editLeasePriceVisible = false
|
||||||
this.$refs.editPriceFormRef.resetFields()
|
this.$refs.editPriceFormRef.resetFields()
|
||||||
},
|
},
|
||||||
handleUpdateLeasePrice(row) {
|
|
||||||
this.editPriceForm.leasePrice = ''
|
|
||||||
// this.batchEdit = false
|
|
||||||
// this.editTypeIds = []
|
|
||||||
// this.editTypeIds.push(row.typeId)
|
|
||||||
this.editLeasePriceVisible = true
|
|
||||||
},
|
|
||||||
onEditSubmit() {
|
onEditSubmit() {
|
||||||
this.$refs.editPriceFormRef.validate(async (valid) => {
|
this.$refs.editPriceFormRef.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
|
@ -573,7 +429,6 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-tree {
|
::v-deep .el-tree {
|
||||||
height: 300px;
|
|
||||||
overflow-y: scroll; /* 必须保留scroll而不是auto */
|
overflow-y: scroll; /* 必须保留scroll而不是auto */
|
||||||
scrollbar-width: none; /* Firefox */
|
scrollbar-width: none; /* Firefox */
|
||||||
-ms-overflow-style: none; /* IE/Edge */
|
-ms-overflow-style: none; /* IE/Edge */
|
||||||
|
|
@ -582,4 +437,24 @@ export default {
|
||||||
::v-deep .el-tree::-webkit-scrollbar {
|
::v-deep .el-tree::-webkit-scrollbar {
|
||||||
display: none; /* Chrome/Safari/Opera */
|
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>
|
</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