代码提交

This commit is contained in:
jiang 2025-12-19 18:20:33 +08:00
parent caa22e1cb2
commit b727742da6
11 changed files with 791 additions and 741 deletions

View File

@ -5,6 +5,6 @@ VUE_APP_TITLE = 机械化施工装备管理(共享)平台
ENV = 'production' ENV = 'production'
# 机械化施工装备管理(共享)平台/生产环境 # 机械化施工装备管理(共享)平台/生产环境
# VUE_APP_BASE_API = '/prod-api' VUE_APP_BASE_API = '/prod-api'
# 宏源 # 宏源
VUE_APP_BASE_API = '/iws/jxhzb-api' #VUE_APP_BASE_API = '/iws/jxhzb-api'

View File

@ -110,23 +110,24 @@
</el-form-item>--> </el-form-item>-->
</el-row> </el-row>
<el-row> <el-row>
<el-form-item prop="minBuyPrice" label="资产原值(万元)">
<el-form-item prop="minOriginalValue" label="资产原值(万元)">
<el-input <el-input
clearable clearable
style="width: 105px" style="width: 105px"
placeholder="请输入" placeholder="请输入"
v-model.trim="queryParams.minBuyPrice" @input="handleNumberInput('minOriginalValue')"
@input="handleNumber('min')" v-model.trim="queryParams.minOriginalValue"
/> />
</el-form-item> </el-form-item>
<el-form-item prop="maxBuyPrice" label="-" style="margin-left: -5.5%;"> <el-form-item prop="maxOriginalValue" label="-" style="margin-left: -5.5%;">
<el-input <el-input
clearable clearable
style="width: 105px" style="width: 105px"
placeholder="请输入" placeholder="请输入"
v-model.trim="queryParams.maxBuyPrice" @input="handleNumberInput('maxOriginalValue')"
@change="handleNumber('max')" v-model.trim="queryParams.maxOriginalValue"
/> />
</el-form-item> </el-form-item>
@ -327,6 +328,9 @@ export default {
specificationModel: '', specificationModel: '',
originalCode: '', originalCode: '',
manufacturer: '', manufacturer: '',
minOriginalValue: '',
maxOriginalValue: '',
manufacturerId: '', manufacturerId: '',
minBuyPrice: '', minBuyPrice: '',
maxBuyPrice: '', maxBuyPrice: '',
@ -335,6 +339,11 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}, },
//
lastValidValues: {
minOriginalValue: '',
maxOriginalValue: ''
},
manufacturerList: [], manufacturerList: [],
tableData: [], tableData: [],
columns2: [], columns2: [],
@ -374,6 +383,117 @@ export default {
this.getManufacturerSelectList() this.getManufacturerSelectList()
}, },
methods: { methods: {
handleNumberInput(key) {
let value = this.queryParams[key] || ''
// 1.
const cleanedValue = this.cleanNumberInput(value)
// 2.
this.lastValidValues[key] = cleanedValue
// 3.
if (key === 'minOriginalValue') {
this.queryParams[key] = this.validateMinValue(cleanedValue)
} else if (key === 'maxOriginalValue') {
this.queryParams[key] = this.validateMaxValue(cleanedValue)
} else {
this.queryParams[key] = cleanedValue
}
// 4.
this.$forceUpdate()
},
//
cleanNumberInput(input) {
if (!input) return ''
//
let cleaned = input.replace(/[^\d.]/g, '')
//
const dotIndex = cleaned.indexOf('.')
if (dotIndex !== -1) {
const before = cleaned.substring(0, dotIndex + 1)
const after = cleaned.substring(dotIndex + 1).replace(/\./g, '')
cleaned = before + after
}
//
const parts = cleaned.split('.')
if (parts.length > 1) {
cleaned = parts[0] + '.' + parts[1].slice(0, 2)
}
return cleaned
},
//
validateMinValue(value) {
//
if (!value || value === '.') return value
const maxValue = this.queryParams.maxOriginalValue
const minNum = this.safeParseNumber(value)
const maxNum = this.safeParseNumber(maxValue)
//
if (maxNum === null) return value
// 使
if (minNum !== null && minNum > maxNum) {
return maxValue
}
return value
},
//
validateMaxValue(value) {
//
if (!value || value === '.') return value
const minValue = this.queryParams.minOriginalValue
const maxNum = this.safeParseNumber(value)
const minNum = this.safeParseNumber(minValue)
//
if (minNum === null) return value
// 使
if (maxNum !== null && maxNum < minNum) {
return minValue
}
return value
},
//
safeParseNumber(str) {
if (!str || str === '.' || isNaN(Number(str))) {
return null
}
return Number(str)
},
//
validateNumberRange() {
const minNum = this.safeParseNumber(this.queryParams.minOriginalValue)
const maxNum = this.safeParseNumber(this.queryParams.maxOriginalValue)
if (minNum !== null && maxNum !== null && minNum > maxNum) {
// 使 <=
const temp = this.queryParams.minOriginalValue
this.queryParams.minOriginalValue = this.queryParams.maxOriginalValue
this.queryParams.maxOriginalValue = temp
//
this.$message.warning('已自动调整数值范围,确保最小值 ≤ 最大值')
return false
}
return true
},
goBack() { goBack() {
// this.$router.go(-1) // this.$router.go(-1)
this.$router.push({ path: '/equipment/equipment-entry-approval' }) this.$router.push({ path: '/equipment/equipment-entry-approval' })
@ -401,6 +521,7 @@ export default {
* 获取装备申请列表 * 获取装备申请列表
*/ */
getEquipmentApplyList() { getEquipmentApplyList() {
this.validateNumberRange()
this.queryParams.startOrderCreateTime = this.orderCreateTime ? this.orderCreateTime[0] : '' this.queryParams.startOrderCreateTime = this.orderCreateTime ? this.orderCreateTime[0] : ''
this.queryParams.endOrderCreateTime = this.orderCreateTime ? this.orderCreateTime[1] : '' this.queryParams.endOrderCreateTime = this.orderCreateTime ? this.orderCreateTime[1] : ''
this.queryParams.startProductionDate = this.productionDate ? this.productionDate[0] : '' this.queryParams.startProductionDate = this.productionDate ? this.productionDate[0] : ''

View File

@ -404,6 +404,7 @@ export default {
// //
handleOut(row) { handleOut(row) {
row.category = '' row.category = ''
row.proCode = this.queryParams.proCode
this.$confirm('是否确定出库?', '提示', { this.$confirm('是否确定出库?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',

View File

@ -15,9 +15,9 @@
style="margin-bottom: 20px" style="margin-bottom: 20px"
/> />
</div> </div>
<div class="head-container" style> <div class="head-container">
<el-tree <el-tree
style="height: 700px; overflow: scroll" style="height: 730px; overflow-y: auto "
:data="treeData" :data="treeData"
:props="defaultProps" :props="defaultProps"
:expand-on-click-node="false" :expand-on-click-node="false"
@ -40,7 +40,9 @@
<span v-else>{{ node.label }}</span> <span v-else>{{ node.label }}</span>
<span class="btn-items" v-if="isMousemoveId === data.id"> <span class="btn-items" v-if="isMousemoveId === data.id">
<el-button type="text" size="mini" icon="el-icon-plus" @click.stop="() => appendTreeNode(data)"> <el-button type="text" v-if=" data.level != '6'" size="mini" icon="el-icon-plus"
@click.stop="() => appendTreeNode(data)"
>
</el-button> </el-button>
<el-button <el-button
type="text" type="text"
@ -82,7 +84,6 @@
<el-form <el-form
:model="queryParams" :model="queryParams"
ref="queryForm" ref="queryForm"
size="small"
:inline="true" :inline="true"
label-width="68px" label-width="68px"
@submit.native.prevent @submit.native.prevent
@ -110,15 +111,18 @@
<el-row style="margin-bottom: 10px"> <el-row style="margin-bottom: 10px">
<el-col :span="24" style="text-align: right"> <el-col :span="24" style="text-align: right">
<el-button type="primary" size="mini" @click="handleAdd">新增</el-button> <el-button type="primary" size="mini" @click="handleAdd">新增</el-button>
<el-button type="primary" size="mini" @click="handleExport"
>导出
</el-button>
</el-col> </el-col>
</el-row> </el-row>
<div > <div>
<el-table <el-table
:data="tableData" :data="tableData"
style="width: 100%" style="width: 100%"
border border
stripe stripe
height="750" height="610"
:loading="tableLoading" :loading="tableLoading"
> >
<el-table-column <el-table-column
@ -132,88 +136,56 @@
<el-table-column <el-table-column
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
prop="level1" prop="major"
label="所属专业" label="所属专业"
width="180" width="150"
/> />
<el-table-column <el-table-column
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
prop="level2" prop="mainProcess"
label="施工主工序" label="施工主工序"
width="180" width="150"
/> />
<el-table-column <el-table-column
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
prop="level3" prop="subProcess"
label="施工子工序" label="施工子工序"
min-width="180" min-width="150"
/> />
<el-table-column <el-table-column
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
prop="level4" prop="mainCategory"
label="装备大类" label="装备大类"
min-width="200" min-width="150"
/> />
<el-table-column <el-table-column
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
prop="level5" prop="subCategory"
label="装备小类" label="装备小类"
min-width="200" min-width="150"
/> />
<el-table-column <el-table-column
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
prop="level6" prop="branch"
label="类型分支" label="类型分支"
min-width="200" min-width="150"
/> />
<!-- <el-table-column <el-table-column align="center" min-width="200" label="操作">
align="center"
show-overflow-tooltip
prop="createBy"
label="创建人"
min-width="200"
/>
<el-table-column
align="center"
show-overflow-tooltip
prop="createTime"
label="创建时间"
min-width="200"
/>
<el-table-column
align="center"
show-overflow-tooltip
prop="updateBy"
label="更新人"
min-width="200"
/>
<el-table-column
align="center"
show-overflow-tooltip
prop="updateTime"
label="更新时间"
min-width="200"
/> -->
<el-table-column align="center" fixed="right" min-width="200" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="mini" @click="onHandlePreview(scope.row)">
<i class="el-icon-view"></i> 查看
</el-button>
<el-button type="text" size="mini" @click="onHandleEdit(scope.row)"> <el-button type="text" size="mini" @click="onHandleEdit(scope.row)">
<i class="el-icon-edit"></i> 编辑 <i class="el-icon-edit"></i> 编辑
</el-button> </el-button>
<el-button type="text" size="mini" @click="onHandleDelete(scope.row)">
<i class="el-icon-delete"></i> 删除
</el-button>
<el-button type="text" size="mini" @click="onHandleConfig(scope.row)"> <el-button type="text" size="mini" @click="onHandleConfig(scope.row)">
<i class="el-icon-setting"></i> 配置特征项 <i class="el-icon-setting"></i> 配置特征项
</el-button> </el-button>
<el-button type="text" style="color: red" size="mini" @click="onHandleDelete(scope.row)">
<i class="el-icon-delete"></i> 删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -282,7 +254,7 @@
<el-dialog <el-dialog
:title="`编辑装备 - ${formData.deviceName || ''}`" :title="`编辑装备 - ${formData.deviceName || ''}`"
:visible.sync="editDialogVisible" :visible.sync="editDialogVisible"
width="70%" width="40%"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="handleEditClose" :before-close="handleEditClose"
> >
@ -294,41 +266,23 @@
size="small" size="small"
class="detail-form" class="detail-form"
> >
<el-row :gutter="20"> <el-form-item label="装备分类" prop="categoryPath">
<!-- 核心修改1分类路径展示+修改入口 --> <!-- 分类修改级联选择器默认隐藏 -->
<el-col :span="24"> <el-cascader
<el-form-item label="装备分类" prop="categoryPath"> v-model="formData.categoryPath"
<!-- 路径展示区点击可展开修改 --> :options="processedTreeData"
<div class="category-display" @click="showCategoryEditor = true"> :props="cascaderProps"
<el-input placeholder="请选择装备分类(最多六级)"
v-model="categoryPathText" clearable
readonly style="width: 100%;"
placeholder="无分类路径" @change="handleEditCategoryChange"
style="width: 100%" filterable
/> popper-class="six-level-cascader"
<span class="edit-category-btn">点击修改</span> />
</div> </el-form-item>
<!-- 分类修改级联选择器默认隐藏 --> <el-form-item label="装备名称" prop="deviceName">
<el-cascader <el-input v-model="formData.deviceName" placeholder="请输入装备名称"/>
v-if="showCategoryEditor" </el-form-item>
v-model="formData.categoryPath"
:options="processedTreeData"
:props="cascaderProps"
placeholder="请选择装备分类(最多六级)"
clearable
style="width: 100%; margin-top: 8px"
@change="handleEditCategoryChange"
filterable
popper-class="six-level-cascader"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="装备名称" prop="deviceName">
<el-input v-model="formData.deviceName" placeholder="请输入装备名称"/>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="handleEditClose">取消</el-button> <el-button @click="handleEditClose">取消</el-button>
@ -340,7 +294,7 @@
<el-dialog <el-dialog
:title="'新增装备'" :title="'新增装备'"
:visible.sync="addDialogVisible" :visible.sync="addDialogVisible"
width="70%" width="40%"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="handleAddClose" :before-close="handleAddClose"
> >
@ -352,28 +306,22 @@
size="small" size="small"
class="detail-form" class="detail-form"
> >
<el-row :gutter="20"> <el-form-item label="装备分类" prop="categoryPath">
<el-col :span="24"> <el-cascader
<el-form-item label="装备分类" prop="categoryPath"> v-model="addFormData.categoryPath"
<el-cascader :options="processedTreeData"
v-model="addFormData.categoryPath" :props="cascaderProps"
:options="processedTreeData" placeholder="请选择装备分类(最多六级)"
:props="cascaderProps" clearable
placeholder="请选择装备分类(最多六级)" style="width: 100%"
clearable @change="handleCategoryChange"
style="width: 100%" filterable
@change="handleCategoryChange" popper-class="six-level-cascader"
filterable />
popper-class="six-level-cascader" </el-form-item>
/> <el-form-item label="装备名称" prop="deviceName">
</el-form-item> <el-input v-model="addFormData.deviceName" placeholder="请输入装备名称"/>
</el-col> </el-form-item>
<el-col :span="12">
<el-form-item label="装备名称" prop="deviceName">
<el-input v-model="addFormData.deviceName" placeholder="请输入装备名称"/>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="handleAddClose">取消</el-button> <el-button @click="handleAddClose">取消</el-button>
@ -452,38 +400,6 @@
<div class="value-management"> <div class="value-management">
<!-- 已选特征值展示区分开展示 + 编辑 --> <!-- 已选特征值展示区分开展示 + 编辑 -->
<div class="selected-values-section"> <div class="selected-values-section">
<!-- <div class="section-title">-->
<!-- <span>已选特征值</span>-->
<!-- <el-button type="text" size="mini" @click="enterEditMode" v-if="!isEditing">-->
<!-- <i class="el-icon-edit"></i> 编辑-->
<!-- </el-button>-->
<!-- <el-button type="text" size="mini" @click="exitEditMode" v-else>-->
<!-- <i class="el-icon-check"></i> 完成-->
<!-- </el-button>-->
<!-- <el-tag size="small">{{ selectedFeatureValues.length }} </el-tag>-->
<!-- </div>-->
<!-- <div class="selected-values-list">-->
<!--&lt;!&ndash; <el-tag&ndash;&gt;-->
<!--&lt;!&ndash; v-for="(item, index) in isEditing ? tempSelectedFeatures : selectedFeatureValues"&ndash;&gt;-->
<!--&lt;!&ndash; :key="index"&ndash;&gt;-->
<!--&lt;!&ndash; closable&ndash;&gt;-->
<!--&lt;!&ndash; @close="removeFeatureValue(index)"&ndash;&gt;-->
<!--&lt;!&ndash; @click="handleEditFeature(item)"&ndash;&gt;-->
<!--&lt;!&ndash; :type="item.mustHave === '1' ? 'danger' : 'primary'"&ndash;&gt;-->
<!--&lt;!&ndash; class="value-tag"&ndash;&gt;-->
<!--&lt;!&ndash; :style="{ cursor: 'pointer' }"&ndash;&gt;-->
<!--&lt;!&ndash; >&ndash;&gt;-->
<!--&lt;!&ndash; {{ item.propertyName }}: {{ item.propertyValue }}&ndash;&gt;-->
<!--&lt;!&ndash; </el-tag>&ndash;&gt;-->
<!-- <div v-if="isEditing" class="editing-tip">-->
<!-- <i class="el-icon-edit" style="color: #409eff;"></i>-->
<!-- <span>正在编辑请重新选择后点击完成保存</span>-->
<!-- </div>-->
<!-- <div v-if="!isEditing && selectedFeatureValues.length === 0" class="empty-values">-->
<!-- <i class="el-icon-tickets"></i>-->
<!-- <span>暂无特征值配置</span>-->
<!-- </div>-->
<!-- </div>-->
</div> </div>
<!-- 预定义选项展示下拉/多选 --> <!-- 预定义选项展示下拉/多选 -->
@ -644,17 +560,12 @@ export default {
isEditing: false, isEditing: false,
editingFeature: null, editingFeature: null,
tempSelectedFeatures: [], tempSelectedFeatures: [],
editingPredefinedIndex: -1, editingPredefinedIndex: -1,
isEditingPredefined: false, isEditingPredefined: false,
predefinedInputTemp: '', // predefinedInputTemp: '', //
queryParams: { queryParams: {
deptName: undefined, typeId: '',
status: undefined, keyWord: '',
typeId: undefined,
keyWord: undefined,
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}, },
@ -665,7 +576,7 @@ export default {
label: 'name' label: 'name'
}, },
// //
equipmentTypeName: undefined, equipmentTypeName: '',
defaultExpandedKeys: [], defaultExpandedKeys: [],
isMousemoveId: null, isMousemoveId: null,
cascaderProps: { cascaderProps: {
@ -681,13 +592,11 @@ export default {
total: 0, total: 0,
tableLoading: false, tableLoading: false,
previewDialogVisible: false, previewDialogVisible: false,
formData: { formData: {
id: '', id: '',
categoryPath: [], // ID categoryPath: [], // ID
deviceName: '' deviceName: ''
}, },
// 2ID // 2ID
editFormRules: { editFormRules: {
categoryPath: [{ required: true, message: '请选择装备分类', trigger: 'change' }], categoryPath: [{ required: true, message: '请选择装备分类', trigger: 'change' }],
@ -707,10 +616,8 @@ export default {
}, },
selectedParentNode: null, selectedParentNode: null,
levelMapping: new Map(), levelMapping: new Map(),
// 4 // 4
categoryPathText: '', categoryPathText: '',
// //
configDialogVisible: false, configDialogVisible: false,
currentEquipmentId: '', currentEquipmentId: '',
@ -747,7 +654,6 @@ export default {
inputType: [{ required: true, message: '请选择输入类型', trigger: 'change' }], inputType: [{ required: true, message: '请选择输入类型', trigger: 'change' }],
mustHave: [{ required: true, message: '请选择是否必填', trigger: 'change' }] mustHave: [{ required: true, message: '请选择是否必填', trigger: 'change' }]
}, },
// typeId // typeId
currentEquipmentTypeIdForFeature: '' currentEquipmentTypeIdForFeature: ''
} }
@ -778,19 +684,6 @@ export default {
}, },
methods: { methods: {
//
enterEditMode() {
this.isEditing = true
this.tempSelectedFeatures = [...this.selectedFeatureValues]
},
// 退
exitEditMode() {
this.isEditing = false
this.selectedFeatureValues = [...this.tempSelectedFeatures]
this.tempSelectedFeatures = []
this.$message.success('编辑完成')
},
// //
isPredefinedValueSelected(value) { isPredefinedValueSelected(value) {
if (this.currentFeature.inputType === 3) { if (this.currentFeature.inputType === 3) {
@ -808,7 +701,7 @@ export default {
} }
// inputType=3/ // inputType=3/
else if (this.currentFeature.inputType === 3) { else if (this.currentFeature.inputType === 3) {
// undefined // ''
if (!Array.isArray(this.addValueForm.propertyValue)) { if (!Array.isArray(this.addValueForm.propertyValue)) {
this.addValueForm.propertyValue = [] this.addValueForm.propertyValue = []
} }
@ -946,7 +839,7 @@ export default {
}, },
processChildrenData(data, currentLevel = 1) { processChildrenData(data, currentLevel = 1) {
if (currentLevel > 6) { if (currentLevel > 5) {
return [] return []
} }
return data.map((item) => { return data.map((item) => {
@ -958,7 +851,7 @@ export default {
parentId: item.parentId ? Number(item.parentId) : null, parentId: item.parentId ? Number(item.parentId) : null,
...item ...item
} }
if (item.children && item.children.length > 0 && currentLevel < 6) { if (item.children && item.children.length > 0 && currentLevel < 5) {
processedItem.children = this.processChildrenData(item.children, currentLevel + 1) processedItem.children = this.processChildrenData(item.children, currentLevel + 1)
} else { } else {
delete processedItem.children delete processedItem.children
@ -968,14 +861,7 @@ export default {
}, },
handleNodeClick(data, node) { handleNodeClick(data, node) {
if (data.id === 'all') { this.queryParams.typeId = data.id
this.queryParams.typeId = undefined
this.queryParams.parentId = undefined
} else {
this.queryParams.typeId = data.id
this.queryParams.parentId = data.parentId
}
this.queryParams.pageNum = 1
this.getDeviceList() this.getDeviceList()
}, },
@ -994,6 +880,7 @@ export default {
// 5 // 5
handleEditCategoryChange(value, selectedOptions) { handleEditCategoryChange(value, selectedOptions) {
console.log(value)
if (value && value.length > 6) { if (value && value.length > 6) {
this.$message.warning('最多只能选择6级分类') this.$message.warning('最多只能选择6级分类')
this.formData.categoryPath = value.slice(0, 6) this.formData.categoryPath = value.slice(0, 6)
@ -1007,19 +894,6 @@ export default {
this.categoryPathText = '无分类路径' this.categoryPathText = '无分类路径'
} }
}, },
getFullCategoryPath() {
if (!this.formData.currentCategoryInfo || !this.formData.currentCategoryInfo.fullPath) {
return '无分类信息'
}
const path = this.formData.currentCategoryInfo.fullPath
const nonEmptyPath = path.filter((item) => item && item.trim() !== '')
if (nonEmptyPath.length === 0) {
return '根分类'
}
return nonEmptyPath.join(' > ')
},
// - // -
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true
@ -1037,21 +911,91 @@ export default {
}, },
// //
appendTreeNode(data) { async appendTreeNode(data) {
console.log('🚀 ~ data--->add:', data) this.resetAddFormData()
this.$message.info('新增功能开发中...') console.log(data)
const targetId = data.id
if (!targetId) {
this.$message.warning('无法获取装备ID编辑失败')
return
}
const levelInfo = this.levelMapping.get(targetId)
console.log(levelInfo)
if (!levelInfo) {
this.$message.warning('未找到该装备的分类信息,无法编辑')
return
}
// 1. 1 > 1 > 1
const fullPath = levelInfo.fullPath || []
this.categoryPathText = fullPath.filter((item) => item.trim()).join(' > ') || '无分类路径'
// 2. ID
const categoryPath = this.getCategoryPathById(targetId)
// /
this.addFormData = {
categoryPath: categoryPath.map((item) => item)
}
console.log(this.formData)
await this.$nextTick()
this.addDialogVisible = true
}, },
// //
editTreeNode(data) { async editTreeNode(data) {
console.log('🚀 ~ data:', data) console.log(data)
this.$message.info('编辑功能开发中...') const targetId = data.id
if (!targetId) {
this.$message.warning('无法获取装备ID编辑失败')
return
}
const levelInfo = this.levelMapping.get(targetId)
console.log(levelInfo)
if (!levelInfo) {
this.$message.warning('未找到该装备的分类信息,无法编辑')
return
}
// 1. 1 > 1 > 1
const fullPath = levelInfo.fullPath || []
this.categoryPathText = fullPath.filter((item) => item.trim()).join(' > ') || '无分类路径'
// 2. ID
const categoryPath = this.getCategoryPathById(targetId)
// /
const limitedCategoryPath = Array.isArray(categoryPath)
? categoryPath.slice(0, levelInfo.level - 1) // 0
: []
this.formData = {
id: targetId,
categoryPath: limitedCategoryPath.map((item) => item),
deviceName: levelInfo.name || ''
}
await this.$nextTick()
this.editDialogVisible = true
}, },
// //
removeTreeNode(data) { removeTreeNode(data) {
console.log(data, '删除时的数据源--') this.$confirm('确定要删除该类别吗?', '提示', {
this.$message.info('删除功能开发中...') confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
try {
const id = data.id
const res = await deleteEquipmentTypeAPI(id)
if (res.code === 200) {
this.$message.success('删除成功')
this.getDeviceList()
this.getDeviceTree()
} else {
this.$message.error(res.msg || '删除失败')
}
} catch (error) {
console.log(error)
}
})
}, },
toggleCollapse() { toggleCollapse() {
@ -1064,7 +1008,7 @@ export default {
const res = await getEquipmentTreeAPI() const res = await getEquipmentTreeAPI()
if (res.code === 200) { if (res.code === 200) {
this.treeData = this.processTreeData(res.data) this.treeData = this.processTreeData(res.data)
this.processedTreeData = this.processTreeData(res.data) this.processedTreeData = this.processChildrenData(res.data)
this.buildLevelMapping(res.data) this.buildLevelMapping(res.data)
// //
this.defaultExpandedKeys = this.getSecondLevelKeys(this.treeData) this.defaultExpandedKeys = this.getSecondLevelKeys(this.treeData)
@ -1128,37 +1072,8 @@ export default {
this.tableLoading = true this.tableLoading = true
const listRes = await getEquipmentListAPI(this.queryParams) const listRes = await getEquipmentListAPI(this.queryParams)
if (listRes.code === 200) { if (listRes.code === 200) {
let rawData = [] this.tableData = listRes.rows
let totalCount = 0 this.total = listRes.total || 0
if (listRes.data && typeof listRes.data === 'object') {
if (listRes.data.rows) {
rawData = listRes.data.rows
totalCount = listRes.data.total || 0
} else if (Array.isArray(listRes.data)) {
rawData = listRes.data
totalCount = rawData.length
} else if (listRes.data.list) {
rawData = listRes.data.list
totalCount = listRes.data.total || rawData.length
} else {
rawData = [listRes.data]
totalCount = 1
}
} else if (Array.isArray(listRes.data)) {
rawData = listRes.data
totalCount = rawData.length
} else {
rawData = []
totalCount = 0
}
if (rawData.length > 0) {
this.tableData = this.transformDataToTable(rawData)
this.total = totalCount
} else {
this.tableData = []
this.total = 0
this.$message.info('该分类下暂无数据')
}
} else { } else {
this.$message.error(listRes.msg || '获取装备列表失败') this.$message.error(listRes.msg || '获取装备列表失败')
} }
@ -1168,78 +1083,6 @@ export default {
this.tableLoading = false this.tableLoading = false
} }
}, },
transformDataToTable(data) {
if (!data || !Array.isArray(data)) return []
const tableData = []
data.forEach((item) => {
const itemId = item.typeId || item.id
const levelInfo = this.levelMapping.get(itemId)
let level1 = '',
level2 = '',
level3 = '',
level4 = '',
level5 = '',
level6 = ''
if (levelInfo && levelInfo.fullPath) {
const path = levelInfo.fullPath
level1 = path[0] || ''
level2 = path[1] || ''
level3 = path[2] || ''
level4 = path[3] || ''
level5 = path[4] || ''
level6 = path[5] || ''
}
tableData.push({
id: itemId,
level1,
level2,
level3,
level4,
level5,
level6,
createBy: item.createBy || '',
createTime: item.createTime || '',
updateBy: item.updateBy || '',
updateTime: item.updateTime || '',
rawData: item
})
})
return tableData
},
async onHandlePreview(row) {
try {
const targetId = row.rawData.typeId || row.rawData.id || row.id
if (!targetId) {
this.$message.warning('无法获取装备ID查看失败')
return
}
const res = await getEquipmentTypeDetailAPI(targetId)
if (res.code === 200) {
const detailData = res.data
const levelInfo = this.levelMapping.get(targetId) || {}
const fullPath = levelInfo.fullPath || ['', '', '', '', '', '']
this.formData = {
id: detailData.typeId || detailData.id || targetId,
level1: fullPath[0],
level2: fullPath[1],
level3: fullPath[2],
level4: fullPath[3],
level5: fullPath[4],
level6: detailData.typeName || fullPath[5],
categoryPath: [],
deviceName: ''
}
this.previewDialogVisible = true
} else {
this.$message.error(res.msg || '获取装备详情失败')
}
} catch (error) {
this.$message.error('获取装备详情失败:' + (error.message || '未知错误'))
}
},
handlePreviewClose() { handlePreviewClose() {
this.previewDialogVisible = false this.previewDialogVisible = false
}, },
@ -1280,12 +1123,13 @@ export default {
// 6ID // 6ID
async onHandleEdit(row) { async onHandleEdit(row) {
const targetId = row.rawData.typeId || row.rawData.id || row.id const targetId = row.typeId
if (!targetId) { if (!targetId) {
this.$message.warning('无法获取装备ID编辑失败') this.$message.warning('无法获取装备ID编辑失败')
return return
} }
const levelInfo = this.levelMapping.get(targetId) const levelInfo = this.levelMapping.get(targetId)
console.log(levelInfo)
if (!levelInfo) { if (!levelInfo) {
this.$message.warning('未找到该装备的分类信息,无法编辑') this.$message.warning('未找到该装备的分类信息,无法编辑')
return return
@ -1296,14 +1140,18 @@ export default {
// 2. ID // 2. ID
const categoryPath = this.getCategoryPathById(targetId) const categoryPath = this.getCategoryPathById(targetId)
// /
const limitedCategoryPath = Array.isArray(categoryPath)
? categoryPath.slice(0, levelInfo.level - 1) // 0
: []
this.formData = { this.formData = {
id: targetId, id: targetId,
categoryPath: categoryPath.map((id) => String(id)), categoryPath: limitedCategoryPath.map((item) => item),
deviceName: levelInfo.name || '' deviceName: levelInfo.name || ''
} }
// 3. console.log(this.formData)
this.showCategoryEditor = false
await this.$nextTick() await this.$nextTick()
this.editDialogVisible = true this.editDialogVisible = true
}, },
@ -1389,7 +1237,7 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm') this.resetForm('queryForm')
this.queryParams.keyWord = undefined this.queryParams.keyWord = ''
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
this.queryParams.pageSize = 10 this.queryParams.pageSize = 10
this.getDeviceList() this.getDeviceList()
@ -1399,6 +1247,15 @@ export default {
this.resetAddFormData() this.resetAddFormData()
this.addDialogVisible = true this.addDialogVisible = true
}, },
handleExport() {
this.download(
'/material-mall/equipment/type/export',
{
...this.queryParams
},
`装备类型管理_${new Date().getTime()}.xlsx`
)
},
handleAddClose() { handleAddClose() {
this.addDialogVisible = false this.addDialogVisible = false
@ -1449,42 +1306,43 @@ export default {
}, },
onHandleDelete(row) { onHandleDelete(row) {
this.$confirm('确定要删除该装备吗?', '提示', { this.$confirm('确定要删除该类别吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(async() => { }).then(async() => {
try { try {
const id = row.rawData.id || row.rawData.typeId const id = row.typeId
const res = await deleteEquipmentTypeAPI(id) const res = await deleteEquipmentTypeAPI(id)
if (res.code === 200) { if (res.code === 200) {
this.$message.success('删除成功') this.$message.success('删除成功')
await this.getDeviceTree()
this.getDeviceList() this.getDeviceList()
} else { } else {
this.$message.error(res.msg || '删除失败') this.$message.error(res.msg || '删除失败')
} }
} catch (error) { } catch (error) {
this.$message.error('删除失败:' + (error.message || '未知错误')) console.log(error)
} }
}) })
}, },
// ========== ========== // ========== ==========
async onHandleConfig(row) { async onHandleConfig(row) {
const targetId = row.rawData.typeId const targetId = row.typeId
if (!targetId) { if (!targetId) {
this.$message.warning('无法获取装备ID配置失败') this.$message.warning('无法获取装备ID配置失败')
return return
} }
this.resetConfigData() this.resetConfigData()
this.currentEquipmentId = targetId this.currentEquipmentId = targetId
this.currentEquipmentTypeIdForFeature = targetId this.currentEquipmentTypeIdForFeature = targetId
if (row.actualLevel == '5') {
this.currentEquipmentName = row.level6 || row.rawData.typeName || row.rawData.name || '当前装备' this.currentEquipmentName = row.subCategory
} else {
this.currentEquipmentName = row.branch
}
this.featureLoading = true this.featureLoading = true
try { try {
const featureListRes = await getPropertiesByTypeId(this.currentEquipmentId) const featureListRes = await getPropertiesByTypeId(this.currentEquipmentId)
const equipmentFeatureRes = await getPropertiesByTypeId(targetId) const equipmentFeatureRes = await getPropertiesByTypeId(targetId)
@ -1748,7 +1606,6 @@ export default {
} }
} catch (error) { } catch (error) {
console.error('删除特征项失败:', error) console.error('删除特征项失败:', error)
this.$message.error('删除失败:' + (error.message || '网络错误'))
} }
}) })
.catch(() => { .catch(() => {
@ -2019,6 +1876,7 @@ export default {
.tree-column .el-card { .tree-column .el-card {
width: 100%; width: 100%;
height: 100% !important;
} }
.card-container { .card-container {
@ -2423,7 +2281,7 @@ export default {
.content-box { .content-box {
border-radius: 8px; border-radius: 8px;
height: calc(100vh - 120px); height: calc(100vh - 220px);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
@ -2610,4 +2468,6 @@ export default {
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
} }
</style> </style>

View File

@ -1,170 +1,195 @@
<template> <template>
<!-- 地址管理 -->
<div class="app-container"> <div class="app-container">
<!-- 搜索表单 -->
<el-form <el-form
:inline="true"
label-width="auto" size="small"
ref="searchFormRef" ref="searchFormRef"
:model="searchParams" :model="searchParams"
:inline="true"
label-width="auto"
size="small"
> >
</el-form> </el-form>
<!-- 主内容卡片 -->
<el-card class="content-box"> <el-card class="content-box">
<el-row> <!-- 操作按钮区域 -->
<el-col :span="24" style="text-align: right;"> <div class="action-bar">
<el-button <el-button
size="mini" size="mini"
@click="handleAddAddress" type="primary"
type="primary" @click="handleAddAddress"
class="primary-lease"
>
新建收货地址
</el-button>
</el-col>
</el-row>
<div>
<!-- 表格 -->
<el-table
:data="leaseList"
show-overflow-tooltip
border
stripe
height="546"
> >
<el-table-column align="center" label="序号" type="index" width="80"/> 新建收货地址
<el-table-column align="center" label="收货地址"> </el-button>
<template slot-scope="{ row }">
{{ `${row.provinceName}${row.cityName}${row.areaName}${row.address}` }}
</template>
</el-table-column>
<el-table-column align="center" label="操作" :width="220">
<template slot-scope="{ row }">
<el-button
size="small"
type="text"
icon="el-icon-edit"
class="primary-lease"
@click="onRepublish(row)"
>
编辑
</el-button>
<el-button
size="small"
type="text"
icon="el-icon-delete"
class="primary-lease"
@click="delRow(row.id)"
style="color: red"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div> </div>
<!-- 地址列表表格 -->
<el-table
:data="addressList"
border
stripe
height="546"
show-overflow-tooltip
>
<el-table-column
type="index"
label="序号"
align="center"
width="80"
/>
<el-table-column
label="收货地址"
align="center"
>
<template slot-scope="{ row }">
{{ formatFullAddress(row) }}
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
width="220"
>
<template slot-scope="{ row }">
<el-button
size="small"
type="text"
icon="el-icon-edit"
@click="handleEditAddress(row)"
>
编辑
</el-button>
<el-button
size="small"
type="text"
icon="el-icon-delete"
class="danger-text"
@click="handleDeleteAddress(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<div class="pagination-wrapper"> <div class="pagination-wrapper">
<pagination <pagination
:total="total" :total="total"
@pagination="getLeaseListData"
:page.sync="searchParams.pageNum" :page.sync="searchParams.pageNum"
:limit.sync="searchParams.pageSize" :limit.sync="searchParams.pageSize"
@pagination="getAddressListData"
/> />
</div> </div>
</el-card> </el-card>
<!-- 新增修改对话框 -->
<!-- 地址编辑对话框 -->
<el-dialog <el-dialog
:title="dialogTitle"
:visible="dialogVisible"
width="40%" width="40%"
align-center align-center
@close="onClose" append-to-body
destroy-on-close @close="handleDialogClose"
:title="dialogTitle"
:visible.sync="addOrEditDialogVisible"
> >
<el-form <el-form
label-width="auto" ref="addressFormRef"
:model="addressForm"
:rules="addressFormRules"
label-position="right" label-position="right"
ref="addOrEditFormRef" label-width="auto"
:model="addOrEditForm"
:rules="addOrEditFormRules"
> >
<el-row :gutter="20"> <el-row :gutter="20">
<!-- 省份选择 -->
<el-col :span="24"> <el-col :span="24">
<el-form-item label="所在省" prop="provinceCode"> <el-form-item
label="所在省"
prop="provinceCode"
>
<el-select <el-select
v-model="addressForm.provinceCode"
placeholder="请选择省"
clearable clearable
style="width: 95%" style="width: 95%"
placeholder="请选择省" @change="handleProvinceChange"
v-model="addOrEditForm.provinceCode"
@change="onProvinceChange"
> >
<el-option <el-option
v-for="item in provinceList"
:key="item.areaId" :key="item.areaId"
:value="item.areaCode * 1" :value="item.areaCode * 1"
:label="item.areaName" :label="item.areaName"
v-for="item in areaList"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 城市选择 -->
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="cityCode" label="所在市"> <el-form-item
label="所在市"
prop="cityCode"
>
<el-select <el-select
clearable v-model="addressForm.cityCode"
style="width: 95%"
placeholder="请选择市" placeholder="请选择市"
v-model="addOrEditForm.cityCode" clearable
@change="onCityChange" style="width: 95%"
@change="handleCityChange"
> >
<el-option <el-option
v-for="item in cityList"
:key="item.areaId" :key="item.areaId"
:value="item.areaCode * 1" :value="item.areaCode * 1"
:label="item.areaName" :label="item.areaName"
v-for="item in areaCityList"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 区县选择 -->
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="areaCode" label="所在区/县"> <el-form-item
label="所在区/县"
prop="areaCode"
>
<el-select <el-select
v-model="addressForm.areaCode"
placeholder="请选择区/县"
clearable clearable
style="width: 95%" style="width: 95%"
placeholder="请选择区/县"
v-model="addOrEditForm.areaCode"
@change="onCountyChange"
> >
<el-option <el-option
v-for="item in districtList"
:key="item.areaId" :key="item.areaId"
:value="item.areaCode * 1" :value="item.areaCode * 1"
:label="item.areaName" :label="item.areaName"
v-for="item in areaCountyList"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 详细地址 -->
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="address" label="详细地址"> <el-form-item
label="详细地址"
prop="address"
>
<el-input <el-input
style="width: 95%" v-model="addressForm.address"
clearable
placeholder="请输入详细地址" placeholder="请输入详细地址"
v-model="addOrEditForm.address" clearable
:maxlength="99" :maxlength="99"
style="width: 95%"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<!-- 对话框按钮 -->
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" class="primary-lease" @click="onCancel"> <el-button @click="handleCancel">取消</el-button>
取消 <el-button type="primary" @click="handleSubmit">提交</el-button>
</el-button>
<el-button class="primary-lease" type="primary" @click="onSubmit(true)">
提交
</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -176,313 +201,371 @@ import {
addAddressInfoApi, addAddressInfoApi,
getAddressListApi, getAddressListApi,
editAddressApi, editAddressApi,
deleteLeaseInfoApi, delAddressApi
maLeaseAuditApi,
delAddressApi,
getLeaseDetailsByIdApi
} from '@/api/address-manage/index' } from '@/api/address-manage/index'
import { MessageBox, Message } from 'element-ui' import { Message } from 'element-ui'
import { out } from '@/api/business/outbound'
export default { export default {
name: 'AddressManage',
data() { data() {
return { return {
//
addressList: [],
total: 0, total: 0,
endTime: [],
isSave: false,
releaseTime: [],
isRepublish: true,
areaList: [],
leaseList: [],
dialogTitle: '新增收货地址',
fileListTemp: [],
searchFormRef: null,
addOrEditFormRef: null,
addOrEditDialogVisible: false,
addOrEditDemandFormList: [],
areaCityList: [],
areaCountyList: [],
//
searchParams: { searchParams: {
pageSize: 10, pageSize: 10,
pageNum: 1 pageNum: 1
}, },
addOrEditForm: {
areaCode: '', //
cityCode: '', dialogVisible: false,
dialogTitle: '',
isEditMode: false,
//
addressForm: {
id: '',
provinceCode: '', provinceCode: '',
address: '', cityCode: '',
id: '' areaCode: '',
address: ''
}, },
addOrEditFormTemp: {}
//
provinceList: [],
cityList: [],
districtList: [],
//
searchFormRef: null,
addressFormRef: null
} }
}, },
computed: { computed: {
addOrEditFormRules() { //
addressFormRules() {
return { return {
areaCode: [{ required: true, message: '请选择项目所在区/县', trigger: 'change' }], provinceCode: [
cityCode: [{ required: true, message: '请选择项目所在市', trigger: 'change' }], { required: true, message: '请选择所在省', trigger: 'change' }
provinceCode: [{ required: true, message: '请选择项目所在省', trigger: 'change' }], ],
address: [{ required: true, message: '请输入项目详细地址', trigger: 'blur' }] cityCode: [
{ required: true, message: '请选择所在市', trigger: 'change' }
],
areaCode: [
{ required: true, message: '请选择所在区/县', trigger: 'change' }
],
address: [
{ required: true, message: '请输入详细地址', trigger: 'blur' },
{ max: 99, message: '详细地址不能超过99个字符', trigger: 'blur' }
]
} }
} }
}, },
created() {
this.initData()
},
methods: { methods: {
// /**
* 初始化数据
*/
async initData() {
await Promise.all([
this.getAddressListData(),
this.getProvinceList()
])
},
/**
* 获取地址列表数据
*/
async getAddressListData() {
try {
const res = await getAddressListApi(this.searchParams)
if (res.code === 200) {
this.addressList = res.rows || []
this.total = res.total || 0
}
} catch (error) {
console.error('获取地址列表失败:', error)
}
},
/**
* 获取省份列表
*/
async getProvinceList() {
try {
const res = await getAreaApi(0)
if (res.code === 200) {
this.provinceList = res.data || []
}
} catch (error) {
console.error('获取省份列表失败:', error)
}
},
/**
* 获取城市列表
*/
async getCityList(provinceCode) {
try {
const res = await getAreaApi(provinceCode)
if (res.code === 200) {
this.cityList = res.data || []
this.districtList = [] //
}
} catch (error) {
console.error('获取城市列表失败:', error)
}
},
/**
* 获取区县列表
*/
async getDistrictList(cityCode) {
try {
const res = await getAreaApi(cityCode)
if (res.code === 200) {
this.districtList = res.data || []
}
} catch (error) {
console.error('获取区县列表失败:', error)
}
},
/**
* 格式化完整地址
*/
formatFullAddress(row) {
const { provinceName = '', cityName = '', areaName = '', address = '' } = row
return `${provinceName}${cityName}${areaName}${address}`
},
/**
* 处理新增地址
*/
handleAddAddress() { handleAddAddress() {
this.isRepublish = true
this.dialogTitle = '新增收货地址' this.dialogTitle = '新增收货地址'
this.addOrEditDialogVisible = true this.isEditMode = false
// this.resetAddressForm()
this.addOrEditForm = { this.dialogVisible = true
areaCode: '', },
cityCode: '',
provinceCode: '', /**
address: '', * 处理编辑地址
id: '' */
async handleEditAddress(row) {
this.dialogTitle = '编辑收货地址'
this.isEditMode = true
//
this.addressForm = {
id: row.id,
provinceCode: row.provinceCode,
cityCode: row.cityCode,
areaCode: row.areaCode,
address: row.address
}
//
await this.loadRegionDataForEdit()
this.dialogVisible = true
},
/**
* 编辑时加载地区数据
*/
async loadRegionDataForEdit() {
const { provinceCode, cityCode } = this.addressForm
if (provinceCode) {
await this.getCityList(provinceCode)
}
if (cityCode) {
await this.getDistrictList(cityCode)
} }
}, },
// /**
async getLeaseListData() { * 处理省份变化
const res = await getAddressListApi(this.searchParams) */
this.leaseList = res.rows async handleProvinceChange(provinceCode) {
this.total = res.total if (!provinceCode) {
}, this.cityList = []
this.districtList = []
// this.addressForm.cityCode = ''
async getAreaData() { this.addressForm.areaCode = ''
const res = await getAreaApi(0) return
this.areaList = res.data
},
//
onReset() {
},
//
async onDelete(id) {
const res = await deleteLeaseInfoApi({ id })
if (res.code === 200) {
Message({
type: 'success',
message: '删除成功'
})
this.getLeaseListData()
} }
await this.getCityList(provinceCode)
this.addressForm.cityCode = ''
this.addressForm.areaCode = ''
}, },
async delRow(id) { /**
this.$confirm('是否确定删除?', '提示', { * 处理城市变化
*/
async handleCityChange(cityCode) {
if (!cityCode) {
this.districtList = []
this.addressForm.areaCode = ''
return
}
await this.getDistrictList(cityCode)
this.addressForm.areaCode = ''
},
/**
* 处理删除地址
*/
handleDeleteAddress(id) {
this.$confirm('确定删除该收货地址吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(async() => { }).then(async() => {
delAddressApi(id).then(res => { try {
this.$message({ const res = await delAddressApi(id)
type: 'success',
message: '操作成功!'
})
this.getLeaseListData()
})
})
},
//
async onRepublish(row) {
this.dialogTitle = '编辑收货地址'
const { areaCode, address, cityCode, provinceCode, id } = row
this.addOrEditForm = {
areaCode,
address,
cityCode,
provinceCode,
id
}
await Promise.all([
this.onProvinceChange(provinceCode),
this.onCityChange(cityCode)
])
this.addOrEditDialogVisible = true
},
//
async onSubmit(type) {
this.$refs.addOrEditFormRef.validate(async(valid) => {
if (valid) {
const SUBMIT_API = this.dialogTitle === '新增收货地址'
? addAddressInfoApi
: editAddressApi
const res = await SUBMIT_API(this.addOrEditForm)
if (res.code === 200) { if (res.code === 200) {
Message({ Message.success('删除成功')
type: 'success', this.getAddressListData()
message: '提交成功'
})
this.addOrEditDialogVisible = false
this.getLeaseListData()
} }
} catch (error) {
console.error('删除地址失败:', error)
} }
}).catch(() => {
}) })
}, },
// /**
onCancel() { * 处理表单提交
this.addOrEditDialogVisible = false */
}, async handleSubmit() {
try {
await this.$refs.addressFormRef.validate()
// const api = this.isEditMode ? editAddressApi : addAddressInfoApi
onClose() { const res = await api(this.addressForm)
this.addOrEditDemandFormList = []
if (this.$refs.addOrEditFormRef) { if (res.code === 200) {
this.$refs.addOrEditFormRef.resetFields() Message.success(this.isEditMode ? '编辑成功' : '新增成功')
this.dialogVisible = false
this.getAddressListData()
}
} catch (error) {
// API
console.error('提交失败:', error)
} }
this.addOrEditForm = JSON.parse(JSON.stringify(this.addOrEditFormTemp))
this.fileListTemp = []
}, },
// /**
async onProvinceChange(id) { * 处理对话框关闭
const res = await getAreaApi(id) */
this.areaCityList = res.data handleDialogClose() {
this.dialogVisible = false
this.resetAddressForm()
this.resetRegionLists()
if (this.$refs.addressFormRef) {
this.$refs.addressFormRef.clearValidate()
}
}, },
// /**
async onCityChange(id) { * 处理取消操作
const res = await getAreaApi(id) */
this.areaCountyList = res.data handleCancel() {
this.dialogVisible = false
}, },
// /**
async onCountyChange(id) { * 重置地址表单
*/
resetAddressForm() {
this.addressForm = {
id: '',
provinceCode: '',
cityCode: '',
areaCode: '',
address: ''
}
}, },
// /**
onAuditing(id, leaseStatus) { * 重置地区列表
MessageBox.confirm(`是否${leaseStatus === 1 ? '通过' : '驳回'}此次接单申请?`, '温馨提示', { */
confirmButtonText: '确定', resetRegionLists() {
cancelButtonText: '取消', this.cityList = []
type: 'success' this.districtList = []
})
.then(async() => {
const res = await maLeaseAuditApi({
id,
leaseStatus
})
if (res.code == 200) {
Message({
type: 'success',
message: '提交成功'
})
//
this.getLeaseListData()
}
})
.catch(() => {
})
} }
},
mounted() {
this.getLeaseListData()
this.getAreaData()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .upload-tip .el-form-item__label { .app-container {
color: transparent; height: 100%;
}
.el-pagination { .content-box {
justify-content: flex-end; border-radius: 8px;
padding: 5px 0; height: calc(100vh - 125px);
} display: flex;
flex-direction: column;
::v-deep .el-pagination.is-background .el-pager li.is-active { ::v-deep .el-card__body {
background-color: #3cb4a6; display: flex;
} flex-direction: column;
::v-deep .el-form--inline .el-form-item {
margin-right: 6px;
width: 95%;
}
.img-list {
display: flex;
align-items: center;
.img-items {
width: 100px;
height: 100px;
margin-right: 8px;
position: relative;
img {
width: 100%;
height: 100%; height: 100%;
padding: 20px;
} }
.mask-img { .action-bar {
visibility: hidden; margin-bottom: 16px;
position: absolute; text-align: right;
top: 0; flex-shrink: 0;
left: 0; }
right: 0;
bottom: 0;
background-color: #000;
opacity: 0.5;
display: flex;
align-items: center;
justify-content: center;
.delete-icon { .pagination-wrapper {
font-size: 20px; flex-shrink: 0;
cursor: pointer; padding-top: 6px;
z-index: 9; margin-top: auto;
color: #fff;
::v-deep .pagination-container {
padding: 0 20px;
} }
} }
} }
.img-items:hover .mask-img { .danger-text {
visibility: visible; color: #F56C6C;
}
}
.app-container-content { &:hover {
::v-deep .el-dialog { color: #f78989;
display: flex !important;
flex-direction: column !important;
margin: 0 !important;
position: absolute !important;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
max-height: 100vh !important;
.el-dialog__body {
flex: 1;
overflow-y: scroll !important;
}
.dialog-content {
padding: 20px;
} }
} }
} }
//
::v-deep .el-table { ::v-deep .el-table {
// flex: 1;
&.el-table--striped .el-table__body { min-height: 0;
tr.el-table__row--striped td {
background-color: #F6FBFA !important; // &.el-table--striped {
.el-table__body {
tr.el-table__row--striped {
td {
background-color: #F6FBFA !important;
}
}
} }
} }
@ -497,80 +580,28 @@ export default {
} }
} }
&.el-table--striped .el-table__body tr.el-table__row:hover > td.el-table__cell { &.el-table--striped {
background-color: #CCF1E9 !important; .el-table__body {
tr.el-table__row:hover > td.el-table__cell {
background-color: #CCF1E9 !important;
}
}
} }
} }
.content-box { //
border-radius: 8px; ::v-deep .el-pagination {
height: calc(100vh - 120px); &.is-background {
display: flex; .el-pager {
flex-direction: column; li.is-active {
overflow: hidden; background-color: #3cb4a6;
::v-deep .el-card__body {
display: flex !important;
flex-direction: column !important;
height: 100% !important;
padding: 20px;
}
.el-row:first-child {
margin-bottom: 16px;
flex-shrink: 0;
.el-col {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 12px;
}
}
.table-container {
flex: 1;
overflow: hidden;
margin-bottom: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
.pagination-wrapper {
flex-shrink: 0;
padding-top: 6px;
margin-top: auto;
::v-deep .pagination-container {
padding: 0px 20px !important;
/* margin-bottom: 30px; */
}
}
::v-deep .el-table {
//
&.el-table--striped .el-table__body {
tr.el-table__row--striped td {
background-color: #F6FBFA !important; //
} }
} }
.el-table__header {
background: #E9F0EE;
th {
background: #E9F0EE !important;
color: #606266;
font-weight: 600;
height: 50px;
}
}
&.el-table--striped .el-table__body tr.el-table__row:hover > td.el-table__cell {
background-color: #CCF1E9 !important;
}
} }
} }
//
.dialog-footer {
text-align: center;
}
</style> </style>

View File

@ -58,6 +58,7 @@
:disabled="!routerParams.isEdit" :disabled="!routerParams.isEdit"
v-model="queryParams.useTimeRange" v-model="queryParams.useTimeRange"
type="daterange" type="daterange"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
@ -317,7 +318,7 @@
/> />
</el-dialog> </el-dialog>
<ConfirmationDialog ref="confirmationDlg" @confirm="saveAdd" /> <ConfirmationDialog ref="confirmationDlg" @confirm="saveAdd"/>
</div> </div>
</template> </template>
<script> <script>
@ -464,7 +465,7 @@ export default {
'queryParams.useTimeRange'(newVal) { 'queryParams.useTimeRange'(newVal) {
if (newVal && newVal.length === 2 && this.tableList.length > 0) { if (newVal && newVal.length === 2 && this.tableList.length > 0) {
this.tableList.forEach(item => { this.tableList.forEach(item => {
item.useTimeRange = [...newVal] // item.useTimeRange = newVal //
}) })
} }
} }
@ -893,7 +894,7 @@ export default {
this.selectedRow.forEach(item => { this.selectedRow.forEach(item => {
this.tableList.push({ this.tableList.push({
...item, ...item,
useTimeRange: [...defaultTimeRange] // useTimeRange: defaultTimeRange //
}) })
}) })
@ -950,13 +951,45 @@ export default {
// 1. // 1.
const devInfo = { ...this.queryParams } const devInfo = { ...this.queryParams }
console.log(devInfo)
if (devInfo.useTimeRange && devInfo.useTimeRange.length === 2) { if (devInfo.useTimeRange && devInfo.useTimeRange.length === 2) {
// 使 // 使
devInfo.useStartTime = safeFormatDate(devInfo.useTimeRange[0]) devInfo.useStartTime = safeFormatDate(devInfo.useTimeRange[0])
devInfo.useEndTime = safeFormatDate(devInfo.useTimeRange[1]) devInfo.useEndTime = safeFormatDate(devInfo.useTimeRange[1])
} }
delete devInfo.useTimeRange delete devInfo.useTimeRange
const emptyFields = []
//
this.tableList.forEach((row, index) => {
const rowInfo = {
rowIndex: index + 1, // 1
emptyKeys: []
}
// useStartTime
if (!row.useTimeRange || row.useTimeRange === '' || row.useTimeRange === 'Invalid Date') {
rowInfo.emptyKeys.push('useTimeRange')
}
//
if (rowInfo.emptyKeys.length > 0) {
emptyFields.push(rowInfo)
}
})
// +
if (emptyFields.length > 0) {
console.log('空值字段信息:', emptyFields)
//
const tipMsg = emptyFields.map(item => {
return `${item.rowIndex} 行,使用到期日期为空`
}).join('\n')
// Vue $message ElementUI
this.$message.warning(tipMsg)
return;
}
// 2. // 2.
const tempTableList = this.tableList.map(item => ({ const tempTableList = this.tableList.map(item => ({
...item, ...item,

View File

@ -5,7 +5,8 @@
<el-form :model="queryParams" ref="queryForm" size="small" inline label-width="100px"> <el-form :model="queryParams" ref="queryForm" size="small" inline label-width="100px">
<el-form-item label="需求单位" prop="useUnit"> <el-form-item label="需求单位" prop="useUnit">
<el-input v-model="queryParams.useUnit" style="width: 200px" placeholder="请输入需求单位" :disabled="queryParams.status=='0'" <el-input v-model="queryParams.useUnit" style="width: 200px" placeholder="请输入需求单位"
:disabled="queryParams.status=='0'"
clearable clearable
/> />
</el-form-item> </el-form-item>
@ -156,7 +157,7 @@
<el-table-column label="设备编码" align="center" prop="devCode" :show-overflow-tooltip="true" width="140px"/> <el-table-column label="设备编码" align="center" prop="devCode" :show-overflow-tooltip="true" width="140px"/>
<el-table-column label="当前库存" align="center" prop="storageNum" width="80px" :show-overflow-tooltip="true"/> <el-table-column label="当前库存" align="center" prop="storageNum" width="80px" :show-overflow-tooltip="true"/>
<el-table-column label="申请数量" align="center" prop="num" width="80px" :show-overflow-tooltip="true"/> <el-table-column label="申请数量" align="center" prop="num" width="80px" :show-overflow-tooltip="true"/>
<el-table-column label="已出库数量" align="center" prop="realNum" width="100px" :show-overflow-tooltip="true"/> <el-table-column label="已出库数量" align="center" prop="realNum" width="100px" :show-overflow-tooltip="true"/>
<el-table-column label="使用到期日期" align="center" width="250px" :show-overflow-tooltip="true"> <el-table-column label="使用到期日期" align="center" width="250px" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 处理日期为 null/undefined 的情况显示占位符有值则拼接为 "开始日期 至 结束日期" 格式 --> <!-- 处理日期为 null/undefined 的情况显示占位符有值则拼接为 "开始日期 至 结束日期" 格式 -->
@ -403,6 +404,7 @@ export default {
// //
handleOut(row) { handleOut(row) {
row.category = '' row.category = ''
row.proCode = this.queryParams.proCode
this.$confirm('是否确定出库?', '提示', { this.$confirm('是否确定出库?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',

View File

@ -127,10 +127,10 @@
<el-table-column label="当前自用" align="center" prop="useNum" :show-overflow-tooltip="true" min-width="55px"/> <el-table-column label="当前自用" align="center" prop="useNum" :show-overflow-tooltip="true" min-width="55px"/>
<el-table-column label="退库数量" align="center" prop="num"> <el-table-column label="退库数量" align="center" prop="num">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.manageType==0">{{ scope.row.useNum }}</span> <span v-if="scope.row.manageType==0">{{ scope.row.num }}</span>
<el-input-number v-if="scope.row.manageType==1" :disabled="routerParams.isView" <el-input-number v-if="scope.row.manageType==1" :disabled="routerParams.isView"
v-model="scope.row.num" v-model="scope.row.num"
:min="0" :max="scope.row.useNum" :default-value="0" style="width: 120px" :min="0" :max="scope.row.num" :default-value="0" style="width: 120px"
@change="applyNumChange(scope.row)" @change="applyNumChange(scope.row)"
/> />
</template> </template>

View File

@ -131,10 +131,10 @@
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handleView(row)">查看</el-button> <el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handleView(row)">查看</el-button>
<el-button v-if="row.taskStatus != 1" size="mini" type="text" icon="el-icon-edit" @click="handleEdit(row)"> <el-button v-if="row.taskStatus != 2" size="mini" type="text" icon="el-icon-edit" @click="handleEdit(row)">
编辑 编辑
</el-button> </el-button>
<el-button v-if="row.taskStatus != 1" size="mini" type="text" icon="el-icon-delete" <el-button v-if="row.taskStatus != 2" size="mini" type="text" icon="el-icon-delete"
@click="handleDelete(row)" style="color: red" @click="handleDelete(row)" style="color: red"
>删除 >删除
</el-button </el-button

View File

@ -314,6 +314,7 @@ export default {
}, },
created() { created() {
this.getTreeData() this.getTreeData()
this.getList()
}, },
methods: { methods: {
/** 查询新增页面-上级类型下拉树结构 */ /** 查询新增页面-上级类型下拉树结构 */

View File

@ -263,6 +263,13 @@ export default {
{ label: '工具类型', prop: 'grandparentTypeName' }, { label: '工具类型', prop: 'grandparentTypeName' },
{ label: '工具名称', prop: 'parentTypeName' }, { label: '工具名称', prop: 'parentTypeName' },
{ label: '规格型号', prop: 'typeName' }, { label: '规格型号', prop: 'typeName' },
{
label: '管理模式',
prop: 'manageMode',
render: (h, { row }) => {
return row.manageMode == '1' ? h('span', {}, '数量管理') : h('span', {}, '编码管理')
},
},
{ {
label: '在库数量', label: '在库数量',
prop: 'availableNum', prop: 'availableNum',
@ -332,13 +339,7 @@ export default {
prop: 'scrapNum', prop: 'scrapNum',
}, },
{ label: '工具总数(不含退役数)', prop: 'totalNum' }, { label: '工具总数(不含退役数)', prop: 'totalNum' },
{
label: '管理模式',
prop: 'manageMode',
render: (h, { row }) => {
return row.manageMode == '1' ? h('span', {}, '数量管理') : h('span', {}, '编码管理')
},
},
], ],
// //
tableList: [], tableList: [],