编码工具管理

This commit is contained in:
bb_pan 2025-11-14 16:26:33 +08:00
parent 313645601c
commit ec5ec1e26b
8 changed files with 450 additions and 293 deletions

View File

@ -125,3 +125,21 @@ export const getListEncodingApi = (data = {}) => {
params: data,
})
}
// 编码工具管理-列表
export const getListCodeApi = (data = {}) => {
return request({
url: '/material-mall/toolLedger/listCode',
method: 'GET',
params: data,
})
}
// 编码工具管理-编辑
export const updateByIdApi = (data = {}) => {
return request({
url: '/material-mall/toolLedger/updateById',
method: 'POST',
data: data,
})
}

View File

@ -32,7 +32,7 @@
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
<el-link v-if="!isView" :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
</div>
</li>
</transition-group>
@ -66,6 +66,10 @@ export default {
isShowTip: {
type: Boolean,
default: true
},
isView: {
type: Boolean,
default: false
}
},
data() {

View File

@ -1,39 +1,74 @@
<template>
<!-- 基础页面 -->
<div class="app-container">
<el-card>
<el-form
v-show="showSearch"
:model="queryParams"
ref="queryForm"
size="small"
inline
:rules="rules"
@submit.native.prevent
<el-card v-show="showSearch" style="margin-bottom: 20px">
<el-form :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent>
<el-form-item label="工具专业" prop="fourthParentId">
<el-select
v-model="queryParams.fourthParentId"
placeholder="请选择工具专业"
clearable
filterable
@change="(val) => changeType(val, '2')"
style="width: 240px"
>
<el-form-item label="关键字" prop="keyWord">
<el-option v-for="item in fourthParentList" :key="item.id" :label="item.label" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="施工类型" prop="greatGrandparentId">
<el-select
v-model="queryParams.greatGrandparentId"
placeholder="请选择施工类型"
clearable
filterable
:disabled="!queryParams.fourthParentId"
@change="(val) => changeType(val, '3')"
style="width: 240px"
>
<el-option v-for="item in greatGrandparentList" :key="item.id" :label="item.label" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="工具类型" prop="grandparentTypeId">
<el-select
v-model="queryParams.grandparentTypeId"
placeholder="请选择工具类型"
clearable
filterable
:disabled="!queryParams.greatGrandparentId"
@change="(val) => changeType(val, '4')"
style="width: 240px"
>
<el-option v-for="item in grandparentTypeList" :key="item.id" :label="item.label" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="工具名称" prop="parentTypeId">
<el-select
v-model="queryParams.parentTypeId"
placeholder="请选择工具名称"
clearable
filterable
:disabled="!queryParams.grandparentTypeId"
style="width: 240px"
>
<el-option v-for="item in parentTypeList" :key="item.id" :label="item.label" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="规格型号" prop="typeName">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入关键字"
v-model="queryParams.typeName"
placeholder="请输入规格型号"
clearable
@keyup.enter.native="handleQuery"
style="width: 240px"
/>
</el-form-item>
<!-- 日期范围 -->
<el-form-item label="查询日期" prop="timeRange">
<el-date-picker
v-model="queryParams.timeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
<el-form-item label="工具编码" prop="toolCode">
<el-input
v-model="queryParams.toolCode"
placeholder="请输入规格型号"
clearable
unlink-panels
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
@keyup.enter.native="handleQuery"
style="width: 240px"
:picker-options="pickerOptions"
/>
</el-form-item>
@ -48,12 +83,20 @@
<el-card>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出数据</el-button>
<div style="font-size: 20; font-weight: 800">编码工具台账列表</div>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
</el-row>
<el-table :data="tableList" highlight-current-row style="width: 100%" v-loading="isLoading" :max-height="650">
<el-table
v-loading="isLoading"
:data="tableList"
highlight-current-row
border
stripe
:max-height="650"
style="width: 100%"
>
<el-table-column
type="index"
width="55"
@ -69,24 +112,19 @@
:prop="column.prop"
align="center"
>
<!-- 插槽 -->
<template v-slot="{ row }" v-if="column.prop == 'outNum'">
<span
v-if="row.outNum > 0"
style="color: #F56C6C; cursor: pointer; text-decoration: underline"
@click="handleDialog(row, 'out')"
>
{{ row.outNum }}
</span>
<span v-else>{{ row.outNum }}</span>
<!-- render插槽 -->
<template v-slot="{ row }">
<component :is="column.render ? { render: (h) => column.render(h, { row }) } : 'span'">
{{ !column.render ? row[column.prop] : '' }}
</component>
</template>
</el-table-column>
<!-- 操作 -->
<!-- <el-table-column label="操作" align="center" width="300">
<el-table-column label="操作" align="center">
<template slot-scope="{ row }">
<el-button type="primary" size="mini" @click="">查看详情</el-button>
<el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handleDialog(row, true)">查看</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleDialog(row, false)">编辑</el-button>
</template>
</el-table-column> -->
</el-table-column>
</el-table>
<!-- 分页 -->
@ -100,176 +138,228 @@
</el-card>
<!-- 弹框 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="70%">
<el-form ref="dialogForm" :model="dialogForm" label-width="" size="small" inline @submit.native.prevent>
<el-form-item label="关键字" prop="keyWord">
<el-input v-model="dialogForm.keyWord" placeholder="请输入关键字" clearable />
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-loading="isLoading">
<el-form
ref="dialogForm"
:model="dialogForm"
label-width="110px"
size="small"
inline
@submit.native.prevent
:disabled="isView"
>
<el-form-item label="工具专业" prop="fourthParentName">
<el-input v-model="dialogForm.fourthParentName" placeholder="请输入工具专业" readonly style="width: 240px" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleDialogQuery">查询</el-button>
<el-button icon="el-icon-refresh" @click="handleDialogReset">重置</el-button>
<el-form-item label="施工类型" prop="greatGrandparentName">
<el-input
v-model="dialogForm.greatGrandparentName"
placeholder="请输入工具专业"
readonly
style="width: 240px"
/>
</el-form-item>
<el-form-item label="工具类型" prop="grandparentTypeName">
<el-input
v-model="dialogForm.grandparentTypeName"
placeholder="请输入工具专业"
readonly
style="width: 240px"
/>
</el-form-item>
<el-form-item label="工具名称" prop="parentTypeName">
<el-input v-model="dialogForm.parentTypeName" placeholder="请输入工具专业" readonly style="width: 240px" />
</el-form-item>
<el-form-item label="规格型号" prop="typeName">
<el-input v-model="dialogForm.typeName" placeholder="请输入工具专业" readonly style="width: 240px" />
</el-form-item>
<el-form-item label="工具编码" prop="toolCode">
<el-input v-model="dialogForm.toolCode" placeholder="请输入工具专业" readonly style="width: 240px" />
</el-form-item>
<el-form-item label="计量单位" prop="unitName">
<el-select v-model="dialogForm.unitName" placeholder="请选择计量单位" clearable style="width: 240px">
<el-option
v-for="dict in dict.type.dev_unit_type"
:key="dict.label"
:label="dict.label"
:value="dict.label"
/>
</el-select>
</el-form-item>
<!-- 厂家 -->
<el-form-item label="生产厂家">
<el-select v-model="dialogForm.supplierId" placeholder="请选择厂家" clearable style="width: 240px">
<el-option
v-for="item in manufacturerSelect"
:key="item.id"
:label="item.label"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<!-- 出厂日期 -->
<el-form-item label="出厂日期">
<el-date-picker
v-model="dialogForm.productionDate"
type="date"
clearable
placeholder="选择出厂日期"
value-format="yyyy-MM-dd"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="本次检验时间">
<el-date-picker
v-model="dialogForm.lastCheckDate"
type="date"
clearable
placeholder="选择本次检验时间"
value-format="yyyy-MM-dd"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="资产原值">
<el-input-number
v-model="dialogForm.originCost"
:min="0"
:max="99999999"
:controls="false"
:precision="0"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="原始编码">
<el-input v-model="dialogForm.identifyCode" maxlength="999" style="width: 240px" />
</el-form-item>
<el-form-item label="下次检验时间">
<el-date-picker
v-model="dialogForm.nextCheckDate"
type="date"
clearable
placeholder="选择下次检验时间"
value-format="yyyy-MM-dd"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="工具状态">
<el-input v-model="dialogForm.identifyCode" readonly style="width: 240px" />
</el-form-item>
<div v-for="(item, index) in dialogForm.propertyVoList" :key="index">
<el-form-item label="特征项">
<el-input v-model="item.propertyName" placeholder="请输入特征项" style="width: 240px" />
</el-form-item>
<el-form-item label="特征值">
<div style="display: flex; align-items: center">
<el-input v-model="item.propertyValue" placeholder="请输入特征值" style="width: 240px" />
<i
v-if="index == dialogForm.propertyVoList.length - 1 && dialogForm.propertyVoList.length < 9 && !isView"
class="el-icon-circle-plus-outline"
@click="handleProperty('add', index)"
style="color: #67c23a; font-size: 24px; margin-left: 8px"
/>
<i
v-if="index != 0 && !isView"
class="el-icon-remove-outline"
@click="handleProperty('remove', index)"
style="color: #f56c6c; font-size: 24px; margin-left: 8px"
/>
</div>
</el-form-item>
</div>
<el-form-item label="附件" prop="fileList">
<FileUpload
v-model="dialogForm.fileList"
:value="dialogForm.fileList"
:limit="9"
:fileType="['doc', 'xls', 'pdf', 'jpg', 'jpeg', 'png']"
:isView="isView"
@input="handleImage"
/>
</el-form-item>
</el-form>
<el-table
:data="dialogList"
fit
highlight-current-row
style="width: 100%"
v-loading="isLoading"
:max-height="500"
>
<el-table-column
type="index"
width="55"
label="序号"
align="center"
:index="(index) => (dialogForm.pageNum - 1) * dialogForm.pageSize + index + 1"
/>
<el-table-column
v-for="(column, index) in dialogColumns"
:width="column.width"
:show-overflow-tooltip="!column.unShowTooltip"
:key="index"
:label="column.label"
:prop="column.prop"
align="center"
>
<!-- 插槽 -->
<template v-slot="{ row }" v-if="column.prop == 'num'">
<span v-if="isOut">{{ row.outNum }}</span>
<span v-else>{{ row.inputNum }}</span>
</template>
<template v-slot="{ row }" v-else-if="column.prop == 'maCode'">
<span>{{ row.maCode || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="{ row }">
<el-button size="mini" plain icon="el-icon-zoom-in" @click="">查看</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-show="dlgTotal > 0"
:total="dlgTotal"
:page.sync="dialogForm.pageNum"
:limit.sync="dialogForm.pageSize"
@pagination="getDialogList"
/>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button v-if="!isView" type="primary" @click="submit"> </el-button>
<el-button @click="dialogVisible = false">{{ isView ? '关 闭' : '取 消' }}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
// import {} from '@/api'
import { formatTime } from '@/utils/bonus.js'
import { getListCodeApi, getToolSelectApi, updateByIdApi } from '@/api/toolsManage'
import { getManufacturerSelectApi } from '@/api/EquipmentLedger'
import FileUpload from '@/components/FileUpload'
export default {
name: 'ToolsLedger',
name: 'CodeToolsLedger',
dicts: ['dev_unit_type'],
components: { FileUpload },
data() {
return {
isLoading: false,
showSearch: true,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now()
},
},
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: '', //
startTime: '', //
endTime: '', //
timeRange: [], //
parentId: '0',
level: '1',
fourthParentId: null, //
greatGrandparentId: null, //
grandparentTypeId: null, //
parentTypeId: null, //
typeName: null, //
toolCode: null,
},
rules: [],
fourthParentList: [],
greatGrandparentList: [],
grandparentTypeList: [],
parentTypeList: [],
total: 0, //
//
tableColumns: [
{ label: '物品种类', prop: 'constructionType' },
{ label: '物品类型', prop: 'materialType' },
{ label: '设备类型', prop: 'typeName' },
{ label: '规格型号', prop: 'typeModelName' },
{ label: '昨日库存', prop: 'preStoreNum' },
{
label: '出库数',
prop: 'outNum',
render: (h, { row }) => {
return row.outNum > 0
? h(
'span',
{
style: { color: '#F56C6C', cursor: 'pointer', textDecoration: 'underline' },
on: { click: () => this.handleDialog(row, 'out') },
},
row.outNum,
)
: h('span', {}, row.outNum)
},
},
{
label: '入库数',
prop: 'inputNum',
render: (h, { row }) => {
return row.inputNum > 0
? h(
'span',
{
style: { color: '#409eff', cursor: 'pointer', textDecoration: 'underline' },
on: { click: () => this.handleDialog(row, 'in') },
},
row.inputNum,
)
: h('span', {}, row.inputNum)
},
},
{ label: '当前库存', prop: 'afterStoreNum' },
{ label: '工具专业', prop: 'fourthParentName' },
{ label: '施工类型', prop: 'greatGrandparentName' },
{ label: '工具类型', prop: 'grandparentTypeName' },
{ label: '工具名称', prop: 'parentTypeName' },
{ label: '规格型号', prop: 'typeName' },
{ label: '计量单位', prop: 'unitName' },
{ label: '工具编码', prop: 'toolCode' },
{ label: '下次检验时间', prop: 'nextCheckDate' },
{ label: '生产厂家', prop: 'supplierName', width: 200 },
{ label: '出厂日期', prop: 'productionDate' },
{ label: '资产原值', prop: 'originCost' },
{ label: '原始编码', prop: 'identifyCode' },
],
//
tableList: [],
isOut: false, //
dialogTitle: '详情',
isView: false,
dialogTitle: '编码设备管理',
dialogVisible: false,
dialogForm: {
keyWord: '',
pageNum: 1,
pageSize: 10,
fourthParentName: '',
greatGrandparentName: '',
grandparentTypeName: '',
parentTypeName: '',
typeName: '',
unitName: '',
supplierId: '',
productionDate: '',
lastCheckDate: '',
originCost: null,
identifyCode: '',
nextCheckDate: '',
propertyVoList: [],
fileList: null,
},
dlgTotal: 0, //
dialogColumns: [
{ label: '设备类型', prop: 'typeName' },
{ label: '规格型号', prop: 'typeModelName' },
{ label: '设备编码', prop: 'maCode' },
{ label: '数量', prop: 'num' },
{ label: '操作人', prop: 'nickName' },
{ label: '操作时间', prop: 'createTime' },
{ label: '任务单号', prop: 'code' },
],
dialogList: [],
manufacturerSelect: [],
}
},
created() {
// //
// let start = new Date()
// start.setMonth(start.getMonth() - 1)
const date = new Date()
this.queryParams.timeRange = [this.format(date), this.format(date)]
// this.getList()
this.getList()
this.getSelectList()
},
methods: {
format(date) {
const y = date.getFullYear()
const m = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
},
//
handleQuery() {
this.queryParams.pageNum = 1
@ -277,11 +367,11 @@ export default {
},
//
handleReset() {
this.$refs.queryForm.resetFields()
const date = new Date()
this.queryParams.timeRange = [this.format(date), this.format(date)]
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.queryParams.parentId = '0'
this.queryParams.level = '1'
this.$refs.queryForm.resetFields()
this.getList()
},
//
@ -289,98 +379,124 @@ export default {
console.log('列表-查询', this.queryParams)
this.isLoading = true
try {
const params = {
...this.queryParams,
startTime: this.queryParams.timeRange ? this.queryParams.timeRange[0] : '',
endTime: this.queryParams.timeRange ? this.queryParams.timeRange[1] : '',
}
delete params.timeRange
console.log('🚀 ~ getList ~ params:', params)
const res = await getInventoryLogListApi(params)
console.log('🚀 ~ 获取列表 ~ res:', res)
this.tableList = res.data.rows || []
this.total = res.data.total || 0
const params = { ...this.queryParams }
const res = await getListCodeApi(params)
this.tableList = res.rows || []
this.total = res.total || 0
} catch (error) {
console.log('🚀 ~ 获取列表 ~ error:', error)
this.tableList = []
this.total = 0
} finally {
this.isLoading = false
}
},
handleDialog(row, type) {
console.log('🚀 ~ handleDialog ~ row:', row)
this.dialogTitle = type == 'out' ? '出库详情' : '入库详情'
this.isOut = type == 'out' ? true : false
this.dialogVisible = true
this.dialogList = []
setTimeout(() => {
this.$refs.dialogForm.resetFields()
this.dialogForm.typeId = row.typeId
this.dialogForm.startTime = this.queryParams.timeRange ? this.queryParams.timeRange[0] : ''
this.dialogForm.endTime = this.queryParams.timeRange ? this.queryParams.timeRange[1] : ''
this.getDialogList()
}, 100)
},
//
handleDialogQuery() {
this.dialogForm.pageNum = 1
this.getDialogList()
},
//
handleDialogReset() {
this.dialogForm.keyWord = ''
this.dialogForm.pageNum = 1
this.dialogForm.pageSize = 10
this.getDialogList()
},
//
async getDialogList() {
//
async getSelectList() {
try {
this.isLoading = true
const params = { ...this.dialogForm }
console.log('🚀 ~ getDialogList ~ params:', params)
const res = await getInventoryLogDetailsApi(params)
console.log('🚀 ~ 获取弹框列表 ~ res:', res)
this.dialogList = res.data.rows || []
this.dlgTotal = res.data.total || 0
const params = { ...this.queryParams }
const res = await getToolSelectApi(params)
if (this.queryParams.level == '1') {
this.fourthParentList = res.data || []
} else if (this.queryParams.level == '2') {
this.greatGrandparentList = res.data || []
} else if (this.queryParams.level == '3') {
this.grandparentTypeList = res.data || []
} else if (this.queryParams.level == '4') {
this.parentTypeList = res.data || []
}
} catch (error) {
console.log('🚀 ~ 获取弹框列表 ~ error:', error)
} finally {
this.isLoading = false
console.log('🚀 ~ error:', error)
}
},
//
// formatTime(date) {
// const year = date.getFullYear()
// const month = String(date.getMonth() + 1).padStart(2, '0')
// const day = String(date.getDate()).padStart(2, '0')
// const hours = String(date.getHours()).padStart(2, '0')
// const minutes = String(date.getMinutes()).padStart(2, '0')
// const seconds = String(date.getSeconds()).padStart(2, '0')
// return `${year}${month}${day}_${hours}${minutes}${seconds}`
// },
//
handleExport() {
//
this.$message({
type: 'warning',
message: '导出功能开发中,敬请期待!',
})
changeType(val, level) {
console.log('🚀 ~ val, type:', val, level)
if (level == '2') {
this.queryParams.parentId = val
this.queryParams.greatGrandparentId = null
this.queryParams.grandparentTypeId = null
this.queryParams.parentTypeId = null
this.greatGrandparentList = []
this.grandparentTypeList = []
this.parentTypeList = []
} else if (level == '3') {
this.queryParams.parentId = this.queryParams.greatGrandparentId
this.queryParams.grandparentTypeId = null
this.queryParams.parentTypeId = null
this.grandparentTypeList = []
this.parentTypeList = []
} else if (level == '4') {
this.queryParams.parentId = this.queryParams.grandparentTypeId
this.queryParams.parentTypeId = null
this.parentTypeList = []
}
this.queryParams.level = level
if (!val) return
this.getSelectList()
},
//
async getManufacturerSelect() {
try {
let fileName = `导出_${formatTime(new Date())}.xLsx`
let url = '/material/backstage/costPush/exportPushCheck'
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
// this.derive(url, params, fileName)
// this.download(url, params, fileName)
const res = await getManufacturerSelectApi()
this.manufacturerSelect = res.data
} catch (error) {}
},
handleProperty(type, index) {
if (type == 'add') {
this.dialogForm.propertyVoList.push({
propertyName: '',
propertyValue: '',
})
} else {
this.dialogForm.propertyVoList.splice(index, 1)
}
},
handleDialog(row, type) {
this.dialogTitle = type ? '编码设备管理' : '编码设备详情'
this.isView = type
this.dialogVisible = true
this.getManufacturerSelect()
this.$nextTick(() => {
this.$refs.dialogForm.resetFields()
this.dialogForm = { ...this.dialogForm, ...row }
if (!this.dialogForm.propertyVoList || this.dialogForm.propertyVoList.length == 0) {
this.dialogForm.propertyVoList = [
{
propertyName: '',
propertyValue: '',
},
]
}
console.log('🚀 ~ this.dialogForm:', this.dialogForm)
})
},
handleImage(file) {
console.log('🚀 ~ file:', file)
console.log('🚀 ~ file.url:', this.dialogForm.fileList)
},
async submit() {
console.log('🚀 ~ methods.submit:', this.dialogForm)
this.isLoading = true
try {
await updateByIdApi(this.dialogForm)
this.$message({
type: 'success',
message: '操作成功!',
})
this.dialogVisible = false
this.getList()
} catch (error) {
console.log('导出数据失败', error)
console.log('🚀 ~ error:', error)
} finally {
this.isLoading = false
}
},
},
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
::v-deep .el-input-number.is-without-controls .el-input__inner {
text-align: left;
}
</style>

View File

@ -133,8 +133,8 @@ export default {
applyId: null,
},
typeList: [
{ label: '数量管理', value: '0' },
{ label: '编码管理', value: '1' },
{ label: '数量管理', value: '1' },
{ label: '编码管理', value: '0' },
],
total: 0, //
//
@ -148,7 +148,7 @@ export default {
label: '管理模式',
prop: 'manageType',
render: (h, { row }) => {
return row.manageType == '0' ? h('span', {}, '数量管理') : h('span', {}, '编码管理')
return row.manageType == '1' ? h('span', {}, '数量管理') : h('span', {}, '编码管理')
},
},
{ label: '申请数量', prop: 'applyNum' },

View File

@ -102,7 +102,7 @@
</template>
<!-- 插槽 -->
<template v-slot="{ row }" v-else-if="column.prop == 'toolPrice'">
<el-input-number v-model="row.toolPrice" :min="0" :max="9999" :controls="false" style="width: 120px" />
<el-input-number v-model="row.toolPrice" :min="0" :max="99999999" :controls="false" style="width: 120px" />
</template>
<!-- 插槽 -->
<template v-slot="{ row }" v-else-if="column.prop == 'identifyCode'">
@ -174,7 +174,7 @@ export default {
},
async getTreeSelect() {
try {
const res = await getTreeSelectApi({ manageType: 1 })
const res = await getTreeSelectApi({ manageType: 0 })
this.options = res.data
this.handleTree(this.options)
} catch (error) {}

View File

@ -103,7 +103,7 @@ export default {
},
async getTreeSelect() {
try {
const res = await getTreeSelectApi({ manageType: 0 })
const res = await getTreeSelectApi({ manageType: 1 })
console.log('🚀 ~ res:', res)
this.options = res.data
this.handleTree(this.options)

View File

@ -83,14 +83,25 @@
<el-tag v-if="row.status == '3'" type="danger">驳回</el-tag>
</template>
<template v-slot="{ row }" v-else-if="column.prop == 'manageType'">
<span>{{ row.manageType == 0 ? '数量管理' : '编码管理' }}</span>
<span>{{ row.manageType == 1 ? '数量管理' : '编码管理' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" v-if="!routerParams.isView">
<el-table-column label="操作" align="center">
<template slot-scope="{ row }">
<el-button v-if="row.manageType == 1" size="mini" type="text" @click="handleDialog(row)">查看</el-button>
<el-button v-if="row.status == 1" size="mini" type="text" @click="handleApprove(row, 2)">通过</el-button>
<el-button v-if="row.status == 1" size="mini" type="text" @click="handleApprove(row, 3)" style="color: red"
<el-button v-if="row.manageType == 0" size="mini" type="text" @click="handleDialog(row)">查看</el-button>
<el-button
v-if="row.status == 1 && !routerParams.isView"
size="mini"
type="text"
@click="handleApprove(row, 2)"
>通过</el-button
>
<el-button
v-if="row.status == 1 && !routerParams.isView"
size="mini"
type="text"
@click="handleApprove(row, 3)"
style="color: red"
>驳回</el-button
>
</template>
@ -133,8 +144,8 @@ export default {
applyId: null,
},
typeList: [
{ label: '数量管理', value: '0' },
{ label: '编码管理', value: '1' },
{ label: '数量管理', value: '1' },
{ label: '编码管理', value: '0' },
],
total: 0, //
//
@ -250,7 +261,7 @@ export default {
type: 'success',
message: '操作成功!',
})
if (showAll) {
if (this.showAll) {
this.getList()
} else {
this.$tab.closeOpenPage({ path: '/toolsManage/approveList' })

View File

@ -230,74 +230,74 @@ export default {
{ label: '规格型号', prop: 'typeName' },
{
label: '在库数量',
prop: 'stockQuantity',
prop: 'availableNum',
render: (h, { row }) => {
return row.manageType == 1 && row.stockQuantity > 0
return row.manageMode == 0 && row.availableNum > 0
? h(
'span',
{
style: { color: '#409EFF', cursor: 'pointer' },
on: { click: () => this.handleDialog(row, 'out') },
on: { click: () => this.handleDialog(row, '0') },
},
row.stockQuantity,
row.availableNum,
)
: h('span', {}, row.stockQuantity)
: h('span', {}, row.availableNum)
},
},
{
label: '自用数量',
prop: 'selfUseQuantity',
prop: 'inNum',
render: (h, { row }) => {
return row.selfUseQuantity > 0
return row.inNum > 0
? h(
'span',
{
style: { color: '#409EFF', cursor: 'pointer' },
on: { click: () => this.handleDialog(row, '1') },
},
row.selfUseQuantity,
row.inNum,
)
: h('span', {}, row.selfUseQuantity)
: h('span', {}, row.inNum)
},
},
{
label: '共享数量',
prop: 'shareQuantity',
prop: 'scrapNum',
render: (h, { row }) => {
return row.shareQuantity > 0
return row.scrapNum > 0
? h(
'span',
{
style: { color: '#409EFF', cursor: 'pointer' },
on: { click: () => this.handleDialog(row, '1') },
},
row.shareQuantity,
row.scrapNum,
)
: h('span', {}, row.shareQuantity)
: h('span', {}, row.scrapNum)
},
},
{
label: '在修数量',
prop: 'repairingQuantity',
prop: 'repairNum',
render: (h, { row }) => {
return row.manageType == 1 && row.repairingQuantity > 0
return row.manageMode == 0 && row.repairNum > 0
? h(
'span',
{
style: { color: '#409EFF', cursor: 'pointer' },
on: { click: () => this.handleDialog(row, '1') },
on: { click: () => this.handleDialog(row, '0') },
},
row.repairingQuantity,
row.repairNum,
)
: h('span', {}, row.repairingQuantity)
: h('span', {}, row.repairNum)
},
},
{ label: '工具总数', prop: 'count' },
{ label: '工具总数', prop: 'totalNum' },
{
label: '管理模式',
prop: 'manageType',
prop: 'manageMode',
render: (h, { row }) => {
return row.manageType == '0' ? h('span', {}, '数量管理') : h('span', {}, '编码管理')
return row.manageMode == '1' ? h('span', {}, '数量管理') : h('span', {}, '编码管理')
},
},
],
@ -401,8 +401,16 @@ export default {
this.getSelectList()
},
handleDialog(row, type) {
this.dialogTitle = type == 'out' ? '出库详情' : '入库详情'
this.isOut = type == 'out' ? true : false
console.log('🚀 ~ type:', type == 0)
this.dialogTitle = '工具详情'
if (type == 0) {
this.dialogColumns = this.dialogColumns.filter(item => item.prop != 'proName')
console.log('🚀 ~ this.dialogColumns:', this.dialogColumns)
} else {
if (!this.dialogColumns.some(item => item.prop == 'proName')) {
this.dialogColumns.push({ label: '所在工程', prop: 'proName' })
}
}
this.dialogVisible = true
this.dialogList = []
setTimeout(() => {