代码提交
This commit is contained in:
parent
a7a930667d
commit
1e045e262d
|
|
@ -0,0 +1,56 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 工具台账-列表
|
||||||
|
export const getOutboundList = (data = {}) => {
|
||||||
|
return request({
|
||||||
|
url: '/material-mall/decChange/getOutboundList',
|
||||||
|
method: 'GET',
|
||||||
|
params: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 申请-获取详情
|
||||||
|
export const getApplyDetailsApi = (data = {}) => {
|
||||||
|
return request({
|
||||||
|
url: '/material-mall/decChange/getDevDetailsById',
|
||||||
|
method: 'get',
|
||||||
|
params: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const out = (data = {}) => {
|
||||||
|
return request({
|
||||||
|
url: '/material-mall/decChange/out',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const outCancel = (data = {}) => {
|
||||||
|
return request({
|
||||||
|
url: '/material-mall/decChange/outCancel',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const outCancelAll = (data = {}) => {
|
||||||
|
return request({
|
||||||
|
url: '/material-mall/decChange/outCancelAll',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const outAll = (data = {}) => {
|
||||||
|
return request({
|
||||||
|
url: '/material-mall/decChange/outAll',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,466 @@
|
||||||
|
<template>
|
||||||
|
<!-- 基础页面 -->
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card v-show="showSearch" style="margin-bottom: 20px">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" inline label-width="auto">
|
||||||
|
|
||||||
|
<el-form-item label="需求单位:" prop="useUnit">
|
||||||
|
<el-input v-model="queryParams.useUnit" placeholder="请输入需求单位" :disabled="queryParams.status=='0'"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="使用项目:" prop="proCode">
|
||||||
|
<el-select
|
||||||
|
clearable
|
||||||
|
style="width: 100%"
|
||||||
|
disabled
|
||||||
|
placeholder="请选择使用项目"
|
||||||
|
v-model="queryParams.proCode"
|
||||||
|
@change="onChangeProCode"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:key="item.proCode"
|
||||||
|
:label="item.proName"
|
||||||
|
:value="item.proCode"
|
||||||
|
v-for="item in useProjectList"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="项目类型:" prop="proType">
|
||||||
|
<el-select clearable disabled style="width: 100%" placeholder="请选择项目类型" v-model="queryParams.proType">
|
||||||
|
<el-option value="0" label="线路"/>
|
||||||
|
<el-option value="1" label="电缆"/>
|
||||||
|
<el-option value="2" label="变电"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="电压等级:" prop="voltageLevel">
|
||||||
|
<el-select
|
||||||
|
clearable
|
||||||
|
style="width: 100%"
|
||||||
|
disabled
|
||||||
|
placeholder="请选择电压等级:"
|
||||||
|
v-model="queryParams.voltageLevel"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:key="item.voltage"
|
||||||
|
:value="item.voltage"
|
||||||
|
:label="`${item.voltage}kV`"
|
||||||
|
v-for="item in voltageList"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="项目所在省:" prop="proProvince">
|
||||||
|
<el-select
|
||||||
|
clearable
|
||||||
|
style="width: 100%"
|
||||||
|
disabled
|
||||||
|
placeholder="请选择项目所在省"
|
||||||
|
v-model="queryParams.proProvince"
|
||||||
|
@change="onChangeProvince"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.label"
|
||||||
|
v-for="item in provinceList"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="项目所在市:" prop="proCity">
|
||||||
|
<el-select
|
||||||
|
clearable
|
||||||
|
style="width: 100%"
|
||||||
|
disabled
|
||||||
|
placeholder="请选择项目所在市"
|
||||||
|
v-model="queryParams.proCity"
|
||||||
|
@change="onChangeCity"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.label"
|
||||||
|
v-for="item in cityList"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="项目所在区/县:" prop="proCounty">
|
||||||
|
<el-select
|
||||||
|
clearable
|
||||||
|
disabled
|
||||||
|
style="width: 100%"
|
||||||
|
placeholder="请选择项目所在区/县"
|
||||||
|
v-model="queryParams.proCounty"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.label"
|
||||||
|
v-for="item in countyList"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item style="margin-left:20px">
|
||||||
|
<el-button icon="el-icon-refresh" @click="handleBack">返回</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card>
|
||||||
|
<el-row :gutter="10" class="mb8" justify="end">
|
||||||
|
<el-col v-if="routerParams.isView" :span="24" style="display: flex; justify-content: flex-end">
|
||||||
|
<el-button type="primary" :disabled="queryParams.taskStatus =='3'" @click="handleOutAll">全部出库</el-button>
|
||||||
|
<el-button type="primary" :disabled="queryParams.taskStatus =='3'" @click="handleOutCancelAll">全部取消出库
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
label="序号"
|
||||||
|
align="center"
|
||||||
|
/>
|
||||||
|
<el-table-column label="分类" align="center" prop="devType" :show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.devType==1">{{ '装备' }}</span>
|
||||||
|
<span v-if="scope.row.devType==2">{{ '工具' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="类目" align="center" prop="category" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="名称" align="center" prop="typeName" :show-overflow-tooltip="true" width="120px"/>
|
||||||
|
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="管理模式" align="center" prop="manageType" :show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.manageType==0">{{ '编码设备' }}</span>
|
||||||
|
<span v-if="scope.row.manageType==1">{{ '数量设备' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="设备编码" align="center" prop="devCode" :show-overflow-tooltip="true" width="140px"/>
|
||||||
|
<el-table-column label="当前库存" align="center" prop="storageNum" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="申请数量" align="center" prop="num" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="已出库数量" align="center" prop="realNum" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="使用到期日期" align="center" prop="useTime" width="160px"/>
|
||||||
|
<el-table-column label="出库数量" v-if="routerParams.isView" align="center" prop="outNum"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
:disabled="scope.row.isFinished =='1'"
|
||||||
|
v-if="scope.row.manageType === '1'"
|
||||||
|
v-model.number="scope.row.outNum"
|
||||||
|
:placeholder="`请输入出库数量(最大${scope.row.remainNum.toFixed(2)})`"
|
||||||
|
:max="scope.row.remainNum"
|
||||||
|
:min="0"
|
||||||
|
step="0.01"
|
||||||
|
@input="handleOutNumInput(scope.row)"
|
||||||
|
@change="handleOutNumChange(scope.row)"
|
||||||
|
/>
|
||||||
|
<span v-if="scope.row.manageType==0">{{ scope.row.num , scope.row.outNum = scope.row.num }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" v-if="routerParams.isView">
|
||||||
|
<template slot-scope="{ row }">
|
||||||
|
<el-button size="mini" :disabled="row.isFinished =='1' || row.outNum == 0" type="text"
|
||||||
|
icon="el-icon-zoom-in"
|
||||||
|
@click="handleOut(row)"
|
||||||
|
>出库
|
||||||
|
</el-button
|
||||||
|
>
|
||||||
|
<el-button size="mini" :disabled="row.isFinished =='1'" type="text" @click="handleOutCancel(row)">取消出库
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getApplyDetailsApi, out, outAll, outCancel, outCancelAll } from '@/api/business/outbound'
|
||||||
|
import {
|
||||||
|
getUseProjectListAPI,
|
||||||
|
getVoltageListAPI
|
||||||
|
} from '@/api/EquipmentLedger/equ-out'
|
||||||
|
import { regionData } from 'element-china-area-data'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AddEditApply',
|
||||||
|
// components: { AddNum, AddCode },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
routerParams: {},
|
||||||
|
isLoading: false,
|
||||||
|
showSearch: true,
|
||||||
|
timeRange: [],
|
||||||
|
queryParams: {
|
||||||
|
type: 2, // 出库
|
||||||
|
status: '0', // 变更状态
|
||||||
|
proCode: '', // 使用项目id
|
||||||
|
proName: '', // 使用项目名称
|
||||||
|
proType: '', // 项目类型
|
||||||
|
voltageLevel: '', // 电压等级
|
||||||
|
proProvince: '', // 项目所在省
|
||||||
|
proCity: '', // 项目所在市
|
||||||
|
proCounty: '', // 项目所在区/县
|
||||||
|
proLocation: '', // 详细地址
|
||||||
|
useUnit: '', // 需求单位
|
||||||
|
useTime: null,
|
||||||
|
pageNum: 1, // 页码
|
||||||
|
pageSize: 10, // 每页条数
|
||||||
|
taskStatus: ''
|
||||||
|
},
|
||||||
|
useProjectList: [], // 使用项目下拉选
|
||||||
|
voltageList: [], // 电压等级下拉选
|
||||||
|
provinceList: [],
|
||||||
|
cityList: [],
|
||||||
|
countyList: [],
|
||||||
|
|
||||||
|
typeList: [
|
||||||
|
{ label: '数量管理', value: '1' },
|
||||||
|
{ label: '编码管理', value: '0' }
|
||||||
|
],
|
||||||
|
total: 0, // 总条数
|
||||||
|
// 表格数据
|
||||||
|
tableList: [],
|
||||||
|
openAdd: false, // 添加申请
|
||||||
|
addQuery: { // 添加申请查询
|
||||||
|
typeName: '', // 名称
|
||||||
|
typeModelName: '', // 规格型号
|
||||||
|
devCode: '', // 设备编码
|
||||||
|
pageNum: 1, // 页码
|
||||||
|
pageSize: 10 // 每页条数
|
||||||
|
},
|
||||||
|
addTotal: 0, // 总条数
|
||||||
|
addList: [], // 添加申请列表
|
||||||
|
addTempList: [], // 添加申请临时列表
|
||||||
|
ids: [], // 选中的id
|
||||||
|
single: false, // 单选
|
||||||
|
multiple: false // 多选
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.routerParams = this.$route.query
|
||||||
|
let title = '自用出库详情'
|
||||||
|
if (this.routerParams.isView) {
|
||||||
|
title = '查看审核'
|
||||||
|
} else if (this.routerParams.isEdit) {
|
||||||
|
title = '审核详情'
|
||||||
|
}
|
||||||
|
this.queryParams.id = this.routerParams.id || ''
|
||||||
|
this.getUseProjectList()
|
||||||
|
this.queryParams.status == '0' ? this.queryParams.useUnit = sessionStorage.getItem('deptName') : ''
|
||||||
|
this.provinceList = regionData
|
||||||
|
const obj = Object.assign({}, this.$route, { title })
|
||||||
|
this.$tab.updatePage(obj)
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 输入出库数量时校验(实时拦截超限)
|
||||||
|
handleOutNumInput(row) {
|
||||||
|
const { outNum, remainNum } = row
|
||||||
|
if (isNaN(outNum)) {
|
||||||
|
this.showOverLimitTip = true
|
||||||
|
this.overLimitTip = '请输入有效的数字!'
|
||||||
|
row.outNum = null // 清空非法输入
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验是否超限
|
||||||
|
if (outNum > remainNum) {
|
||||||
|
this.showOverLimitTip = true
|
||||||
|
this.overLimitTip = `出库数量不能超过剩余可出库数量(${remainNum.toFixed(2)})!`
|
||||||
|
row.outNum = remainNum // 自动修正为最大值
|
||||||
|
} else if (outNum < 0) {
|
||||||
|
this.showOverLimitTip = true
|
||||||
|
this.overLimitTip = '出库数量不能为负数!'
|
||||||
|
row.outNum = 0 // 自动修正为最小值
|
||||||
|
} else {
|
||||||
|
this.showOverLimitTip = false
|
||||||
|
// 保留两位小数(匹配数据库 decimal(10,2) 精度)
|
||||||
|
row.outNum = Number(outNum.toFixed(2))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 失去焦点时最终修正(防止手动输入多位小数)
|
||||||
|
handleOutNumChange(row) {
|
||||||
|
if (row.outNum !== null && row.outNum !== undefined) {
|
||||||
|
row.outNum = Number(row.outNum.toFixed(2))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取使用项目的下拉选
|
||||||
|
async getUseProjectList() {
|
||||||
|
const res = await getUseProjectListAPI()
|
||||||
|
const result = await getVoltageListAPI()
|
||||||
|
this.useProjectList = res.data
|
||||||
|
this.voltageList = result.data
|
||||||
|
},
|
||||||
|
|
||||||
|
// 选择使用项目
|
||||||
|
onChangeProCode(value) {
|
||||||
|
this.queryParams.proCode = value
|
||||||
|
this.queryParams.proName = this.useProjectList.find((item) => item.proCode === value)?.proName || ''
|
||||||
|
},
|
||||||
|
|
||||||
|
// 选择省份
|
||||||
|
onChangeProvince(value) {
|
||||||
|
if (!value) {
|
||||||
|
this.cityList = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.cityList = this.provinceList.find((item) => item.label === value)?.children || []
|
||||||
|
},
|
||||||
|
|
||||||
|
// 选择城市
|
||||||
|
onChangeCity(value) {
|
||||||
|
if (!value) {
|
||||||
|
this.countyList = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.countyList = this.cityList.find((item) => item.label === value)?.children || []
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
// 重置
|
||||||
|
handleReset() {
|
||||||
|
this.queryParams.pageNum = 1
|
||||||
|
this.queryParams.pageSize = 10
|
||||||
|
this.queryParams.parentId = '0'
|
||||||
|
this.queryParams.level = '1'
|
||||||
|
this.$refs.queryForm.resetFields()
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
// 获取列表
|
||||||
|
// 获取列表
|
||||||
|
async getList(emit = {}) {
|
||||||
|
console.log('🚀 ~ emit:', emit)
|
||||||
|
if (emit.id) {
|
||||||
|
this.queryParams.id = emit.id
|
||||||
|
// 存到 route
|
||||||
|
this.$route.query.id = this.queryParams.id
|
||||||
|
}
|
||||||
|
console.log('列表-查询', this.queryParams)
|
||||||
|
this.isLoading = true
|
||||||
|
try {
|
||||||
|
const params = { ...this.queryParams }
|
||||||
|
const res = await getApplyDetailsApi(params)
|
||||||
|
this.tableList = res.data.devDetailsList.map(item => {
|
||||||
|
// 计算剩余可出库数量:num - 已出库数量(real_num 为 null 则按 0 计算)
|
||||||
|
const remainNum = Number(item.num) - (item.realNum ? Number(item.realNum) : 0)
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
remainNum: remainNum > 0 ? remainNum : 0, // 剩余数量不能为负数
|
||||||
|
outNum: 0 // 绑定输入的出库数量
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (this.queryParams.id) {
|
||||||
|
this.queryParams = res.data.devInfo || {}
|
||||||
|
this.queryParams.status = '0'
|
||||||
|
this.queryParams.useUnit = sessionStorage.getItem('deptName')
|
||||||
|
}
|
||||||
|
this.total = res.data.total || 0
|
||||||
|
} catch (error) {
|
||||||
|
this.tableList = []
|
||||||
|
this.total = 0
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//通过
|
||||||
|
handleOut(row) {
|
||||||
|
row.category = ''
|
||||||
|
this.$confirm('是否确定出库?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(async() => {
|
||||||
|
out(row).then(res => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '操作成功!'
|
||||||
|
})
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 驳回
|
||||||
|
handleOutCancel(row) {
|
||||||
|
this.$confirm('是否确定取消出库?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(async() => {
|
||||||
|
outCancel({ id: row.detailsId }).then(res => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '操作成功!'
|
||||||
|
})
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleBack() {
|
||||||
|
this.$router.push({ path: '/business/outbound/index' })
|
||||||
|
},
|
||||||
|
|
||||||
|
handleOutAll() {
|
||||||
|
this.$confirm('是否确定全部取消出库?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(async() => {
|
||||||
|
outAll({ id: this.queryParams.id }).then(res => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '操作成功!'
|
||||||
|
})
|
||||||
|
this.$router.go(-1)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
handleOutCancelAll() {
|
||||||
|
this.$confirm('是否确定全部取消出库?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(async() => {
|
||||||
|
outCancelAll({ id: this.queryParams.id }).then(res => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '操作成功!'
|
||||||
|
})
|
||||||
|
this.$router.go(-1)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue