代码提交

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'
# 机械化施工装备管理(共享)平台/生产环境
# 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-row>
<el-row>
<el-form-item prop="minBuyPrice" label="资产原值(万元)">
<el-form-item prop="minOriginalValue" label="资产原值(万元)">
<el-input
clearable
style="width: 105px"
placeholder="请输入"
v-model.trim="queryParams.minBuyPrice"
@input="handleNumber('min')"
@input="handleNumberInput('minOriginalValue')"
v-model.trim="queryParams.minOriginalValue"
/>
</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
clearable
style="width: 105px"
placeholder="请输入"
v-model.trim="queryParams.maxBuyPrice"
@change="handleNumber('max')"
@input="handleNumberInput('maxOriginalValue')"
v-model.trim="queryParams.maxOriginalValue"
/>
</el-form-item>
@ -327,6 +328,9 @@ export default {
specificationModel: '',
originalCode: '',
manufacturer: '',
minOriginalValue: '',
maxOriginalValue: '',
manufacturerId: '',
minBuyPrice: '',
maxBuyPrice: '',
@ -335,6 +339,11 @@ export default {
pageNum: 1,
pageSize: 10
},
//
lastValidValues: {
minOriginalValue: '',
maxOriginalValue: ''
},
manufacturerList: [],
tableData: [],
columns2: [],
@ -374,6 +383,117 @@ export default {
this.getManufacturerSelectList()
},
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() {
// this.$router.go(-1)
this.$router.push({ path: '/equipment/equipment-entry-approval' })
@ -401,6 +521,7 @@ export default {
* 获取装备申请列表
*/
getEquipmentApplyList() {
this.validateNumberRange()
this.queryParams.startOrderCreateTime = this.orderCreateTime ? this.orderCreateTime[0] : ''
this.queryParams.endOrderCreateTime = this.orderCreateTime ? this.orderCreateTime[1] : ''
this.queryParams.startProductionDate = this.productionDate ? this.productionDate[0] : ''

View File

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

View File

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

View File

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

View File

@ -58,6 +58,7 @@
:disabled="!routerParams.isEdit"
v-model="queryParams.useTimeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@ -317,7 +318,7 @@
/>
</el-dialog>
<ConfirmationDialog ref="confirmationDlg" @confirm="saveAdd" />
<ConfirmationDialog ref="confirmationDlg" @confirm="saveAdd"/>
</div>
</template>
<script>
@ -464,7 +465,7 @@ export default {
'queryParams.useTimeRange'(newVal) {
if (newVal && newVal.length === 2 && this.tableList.length > 0) {
this.tableList.forEach(item => {
item.useTimeRange = [...newVal] //
item.useTimeRange = newVal //
})
}
}
@ -893,7 +894,7 @@ export default {
this.selectedRow.forEach(item => {
this.tableList.push({
...item,
useTimeRange: [...defaultTimeRange] //
useTimeRange: defaultTimeRange //
})
})
@ -950,13 +951,45 @@ export default {
// 1.
const devInfo = { ...this.queryParams }
console.log(devInfo)
if (devInfo.useTimeRange && devInfo.useTimeRange.length === 2) {
// 使
devInfo.useStartTime = safeFormatDate(devInfo.useTimeRange[0])
devInfo.useEndTime = safeFormatDate(devInfo.useTimeRange[1])
}
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.
const tempTableList = this.tableList.map(item => ({
...item,

View File

@ -5,7 +5,8 @@
<el-form :model="queryParams" ref="queryForm" size="small" inline label-width="100px">
<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
/>
</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="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="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">
<template slot-scope="scope">
<!-- 处理日期为 null/undefined 的情况显示占位符有值则拼接为 "开始日期 至 结束日期" 格式 -->
@ -403,6 +404,7 @@ export default {
//
handleOut(row) {
row.category = ''
row.proCode = this.queryParams.proCode
this.$confirm('是否确定出库?', '提示', {
confirmButtonText: '确定',
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="num">
<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"
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)"
/>
</template>

View File

@ -131,10 +131,10 @@
<el-table-column label="操作" align="center">
<template slot-scope="{ row }">
<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 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"
>删除
</el-button

View File

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

View File

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