后台优化

This commit is contained in:
bb_pan 2025-10-15 09:05:19 +08:00
parent 3643e02c6f
commit 2ddea71248
9 changed files with 120 additions and 37 deletions

View File

@ -59,4 +59,12 @@ export const getManufacturerSelectApi = (data = {}) => {
method: 'GET',
params: data
})
}
// 共享出库列表
export const getDeviceByMaIdsApi = (data = {}) => {
return request({
url: `/material-mall/device/getDeviceByMaIds/${data}`,
method: 'GET',
})
}

View File

@ -123,6 +123,11 @@
placeholder="请选择生产日期"
value-format="yyyy-MM-dd"
style="width: 100%"
:picker-options="{
disabledDate(time) {
return time.getTime() > Date.now()
}
}"
>
</el-date-picker>
</el-form-item>
@ -153,11 +158,16 @@
</el-col>
<el-col :span="6">
<el-form-item label="最大使用年限" prop="maxServiceLifeYears">
<el-input
<el-input-number
clearable
maxlength="20"
placeholder="请输入最大使用年限"
v-model="form.maxServiceLifeYears"
:min="1"
:max="100"
:precision="0"
:controls="false"
style="width: 100%"
/>
</el-form-item>
</el-col>
@ -179,11 +189,15 @@
<el-row :gutter="24">
<el-col :span="6">
<el-form-item label="装备数量" prop="count">
<el-input
<el-input-number
v-model="form.count"
placeholder="请输入装备数量"
clearable
maxlength="10"
:min="1"
:max="100"
:precision="0"
:controls="false"
style="width: 100%"
:disabled="form.manageType === 0"
/>
</el-form-item>
</el-col>
@ -205,6 +219,11 @@
value-format="yyyy-MM-dd"
type="date"
style="width: 100%"
:picker-options="{
disabledDate(time) {
return time.getTime() > Date.now()
}
}"
>
</el-date-picker>
</el-form-item>
@ -474,7 +493,7 @@ export default {
},
deviceTypeChange(val) {
if (val === 0) {
this.form.count = '1'
this.form.count = 1
}
},
//
@ -541,6 +560,10 @@ export default {
}
})
console.log('🚀 ~ handleSubmit ~ certificates:', certificates)
} else {
//
this.$message.error('请上传合格证')
return
}
if (this.form.inspectionList) {
const arr = this.form.inspectionList.split(',')
@ -552,6 +575,10 @@ export default {
}
})
console.log('🚀 ~ handleSubmit ~ inspectionReports:', inspectionReports)
} else {
//
this.$message.error('请上传检测证书')
return
}
if (this.form.purchaseInvoices) {
const arr = this.form.purchaseInvoices.split(',')

View File

@ -254,13 +254,13 @@
<el-button type="text" @click="handleViewDetail(row)">
<i class="el-icon-view"></i> 查看
</el-button>
<el-button
<!-- <el-button
type="text"
@click="editRowInfo(row.maId)"
v-if="row.orderStatus == '3' && !isAddVisible"
>
<i class="el-icon-edit"></i> 编辑
</el-button>
</el-button> -->
<el-button
type="text"
@click="deleteRowInfo(row)"
@ -324,7 +324,7 @@ export default {
created() {
console.log(this.$route)
this.orderId = this.$route.query && this.$route.query.orderId
this.isAddVisible = this.$route.query && this.$route.query.isAddVisible
this.isAddVisible = this.$route.query && this.$route.query.isAddVisible == 'true'
this.isApprovalVisible = this.$route.query && this.$route.query.isApprovalVisible
if (!this.orderId) {
this.pageTitle = '新增设备录入'

View File

@ -349,7 +349,7 @@ export default {
},
mounted() {
const { orderId, status, orderStatus, isAddVisible, isApprovalVisible } = this.$route.query
this.isAddVisible = isAddVisible
this.isAddVisible = isAddVisible == 'true'
if (orderId) {
this.queryParams.orderId = orderId
this.orderStatus = status || orderStatus

View File

@ -30,8 +30,8 @@
placeholder="请选择操作类型"
@change="handleStatusChange(row)"
>
<el-option label="退役" value="1"/>
<el-option label="维修" value="4"/>
<el-option label="维修" value="1"/>
<el-option label="退役" value="4"/>
</el-select>
</template>
</el-table-column>
@ -61,7 +61,7 @@
<el-table-column label="退役原因" align="center" v-if="shouldShowRetireReason">
<template slot-scope="{ row }">
<el-input v-show="row.status=='1'" v-model="row.retireReason" clearable placeholder="请输入退役原因"/>
<el-input v-show="row.status=='4'" v-model="row.retireReason" clearable placeholder="请输入退役原因"/>
</template>
</el-table-column>
@ -118,10 +118,9 @@
<el-table-column align="center" show-overflow-tooltip prop="changeStatus" label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.status == 1" size="mini">在库</el-tag>
<el-tag v-if="scope.row.status == 2 || scope.row.status == 3" size="mini">
在用
</el-tag>
<el-tag v-if="scope.row.status == 5" size="mini"> 维修</el-tag>
<el-tag v-if="scope.row.status == 2" size="mini">自用</el-tag>
<el-tag v-if="scope.row.status == 3" size="mini">共享</el-tag>
<el-tag v-if="scope.row.status == 5" size="mini">维修</el-tag>
</template>
</el-table-column>
<el-table-column width="160" show-overflow-tooltip prop="unit" label="计数单位" align="center"/>
@ -221,7 +220,7 @@ export default {
pageNum: 1,
pageSize: 10,
name: '',
status: '5',
status: '2',
companyId: '',
proId: ''
},
@ -238,11 +237,11 @@ export default {
computed: {
//
shouldShowRepairCost() {
return this.selectedEquipment.some(row => row.status === '4')
return this.selectedEquipment.some(row => row.status === '1')
},
// 退
shouldShowRetireReason() {
return this.selectedEquipment.some(row => row.status === '1')
return this.selectedEquipment.some(row => row.status === '4')
}
},
created() {
@ -388,7 +387,7 @@ export default {
// 退退
for (const item of this.selectedEquipment) {
// "退"退
if (item.status === '1') { // '0'退
if (item.status === '4') { // '0'退
if (!item.retireReason || item.retireReason.trim() === '') {
this.$modal.msgError('存在退役原因为空的装备,请检查')
return false //
@ -484,6 +483,9 @@ export default {
)
if (newItems.length > 0) {
newItems.forEach(item => {
item.devId = item.maId
})
this.selectedEquipment = [...this.selectedEquipment, ...newItems]
this.$modal.msgSuccess(`成功添加 ${newItems.length} 个装备`)
} else {

View File

@ -421,6 +421,9 @@ export default {
)
if (newItems.length > 0) {
newItems.forEach(item => {
item.devId = item.maId
})
this.selectedEquipment = [...this.selectedEquipment, ...newItems]
this.$modal.msgSuccess('成功添加 ' + newItems.length + ' 个装备')
} else {

View File

@ -16,7 +16,7 @@
</el-radio-group>
</el-form-item> -->
<el-button size="mini" style="margin-bottom: 20px" type="primary" @click="onHandleSubmit"
<el-button size="mini" style="margin-bottom: 20px" type="primary" :disabled="!selectedEquipment.length" @click="onHandleSubmit"
>确定提交
</el-button
>
@ -151,7 +151,7 @@
</el-row>
<el-row :gutter="20" style="margin-top: 10px">
<el-button size="mini" type="primary" @click="onHandleAddEquipment">添加变更装备</el-button>
<el-button v-if="!maIds" size="mini" type="primary" @click="onHandleAddEquipment">添加变更装备</el-button>
<el-button size="mini" plain @click="clearSelectedEquipment" style="margin-left: 10px">清空已选</el-button>
</el-row>
</el-form>
@ -310,7 +310,7 @@ import {
getVoltageListAPI,
addProjectOutAPI
} from '@/api/EquipmentLedger/equ-out'
import { getDeviceListAPI } from '@/api/EquipmentLedger/index.js'
import { getDeviceListAPI, getDeviceByMaIdsApi } from '@/api/EquipmentLedger/index.js'
export default {
data() {
@ -373,10 +373,15 @@ export default {
tableColumns: 0,
addEquipmentTotal: 0,
useProjectList: [], // 使
voltageList: [] //
voltageList: [], //
maIds: '' // maIds
}
},
created() {
this.maIds = this.$route.query ? this.$route.query.maIds : ''
if (this.maIds) {
this.getList()
}
console.log(store.getters.roles)
this.getUseProjectList()
this.outForm.status == '0' ? this.outForm.useUint = sessionStorage.getItem('deptName') : ''
@ -387,6 +392,14 @@ export default {
goBack() {
this.$router.go(-1)
},
async getList() {
try {
const res = await getDeviceByMaIdsApi(this.maIds)
this.selectedEquipment = res.data
} catch (error) {
console.log('🚀 ~ getList ~ error:', error)
}
},
//
getSelectEquipmentList() {
@ -548,6 +561,10 @@ export default {
)
if (newItems.length > 0) {
newItems.forEach(item => {
item.devId = item.maId
})
console.log('🚀 ~ onHandleAddEquipmentConfirm ~ newItems:', newItems)
//
this.selectedEquipment = [...this.selectedEquipment, ...newItems]
this.$message.success(`成功添加 ${newItems.length} 个装备`)

View File

@ -5,18 +5,30 @@
<el-form ref="queryForm" size="small" label-width="auto" :model="queryParams">
<el-row :gutter="10" style="display: flex; justify-content: space-between">
<el-col>
<el-form-item prop="deviceName">
<el-form-item prop="name">
<el-input
style="width: 100%"
v-model="queryParams.deviceName"
v-model="queryParams.name"
placeholder="装备名称"
clearable
/>
</el-form-item>
</el-col>
<el-col>
<el-form-item prop="brand">
<el-input v-model="queryParams.brand" placeholder="装备厂家" clearable/>
<el-form-item prop="manufacturerId">
<el-select
v-model="queryParams.manufacturerId"
placeholder="请选择生产厂家"
clearable
style="width: 100%"
>
<el-option
v-for="item in manufacturerList"
:key="item.id"
:label="item.label"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col>
@ -54,7 +66,7 @@
<el-select
style="width: 100%"
v-model="queryParams.isWarn"
placeholder="剩余使用年限"
placeholder="预警情况"
clearable
>
<el-option label="告警" value="1"/>
@ -84,7 +96,7 @@
<el-table-column align="center" show-overflow-tooltip prop="name" label="装备名称"/>
<el-table-column align="center" show-overflow-tooltip prop="specificationModel" label="装备型号"/>
<el-table-column align="center" show-overflow-tooltip prop="code" label="装备编码"/>
<el-table-column align="center" show-overflow-tooltip prop="manufacturer" label="装备厂家"/>
<el-table-column align="center" show-overflow-tooltip prop="manufacturer" label="生产厂家"/>
<el-table-column align="center" show-overflow-tooltip prop="productionDate" label="出厂日期">
<template slot-scope="scope">
{{ formatDate(scope.row.productionDate) }}
@ -136,12 +148,13 @@
<script>
import { getRetireListAPI } from '@/api/EquipmentRetire/index.js'
import { getManufacturerSelectApi } from '@/api/EquipmentLedger/index.js'
export default {
data() {
return {
queryParams: {
deviceName: undefined,
name: undefined,
brand: undefined,
yearsDiff1: undefined,
yearsDiff2: undefined,
@ -156,10 +169,20 @@ export default {
label: 'label'
},
tableData: [],
total: 0
total: 0,
manufacturerList: []
}
},
methods: {
//
getManufacturerSelectList() {
getManufacturerSelectApi().then((res) => {
console.log('🚀 ~ getManufacturerSelectList ~ res:', res)
if (res.code === 200) {
this.manufacturerList = res.data
}
})
},
handleNodeClick(data) {
console.log(data)
},
@ -185,12 +208,12 @@ export default {
// 退
onHandleRetire() {
console.log('退役按钮')
this.$router.push('/equipment-ledger-retire')
this.$router.push('/equipment/equ-retire')
},
//
onHandleReset() {
this.queryParams = {
deviceName: undefined,
name: undefined,
brand: undefined,
yearsDiff: undefined,
remainingYears: undefined,
@ -208,7 +231,7 @@ export default {
// 退
onHandleBatchRetire() {
console.log('批量退役')
this.$router.push('/equipment-ledger-retire')
this.$router.push('/equipment/equ-retire')
},
//
formatDate(dateString) {
@ -249,6 +272,7 @@ export default {
created() {
this.getRetireList()
this.getManufacturerSelectList()
}
}
</script>

View File

@ -285,7 +285,7 @@
不同意
</el-button>
<el-button v-show="item.orderStatus =='2'" @click="(item)" type="primary" plain size="small">
<el-button v-show="item.orderStatus =='2'" @click="handleOut(item)" type="primary" plain size="small">
共享出库
</el-button>
</div>
@ -743,7 +743,9 @@ export default {
}
})
},
handleOut(item) {
this.$router.push({ path: '/equipment/euq-out', query: { maIds: item.maIds } })
},
//
handleViewOrder(row) {
this.showOrderDetail = true