Commit 9d0acf99 authored by Hagsn3's avatar Hagsn3

修改

parent 381515da
import request from '@/utils/request'
import Qs from 'qs'
/**
* 1. 列表查询
* 2. 查询详细信息
* 3. 新增
* 4. 修改
* 5. 逻辑删除
* 6. 导出
*
*/
export function listOutcomeWmsJbapplyTemp(query) {
return request({
url: '/outcomewmsjbapplytemp/list',
method: 'get',
params: query
})
}
export function getOutcomeWmsJbapplyTemp(businessId) {
return request({
url: '/outcomewmsjbapplytemp/detail/' + businessId,
method: 'get'
})
}
export function addOutcomeWmsJbapplyTemp(data) {
data = Qs.stringify(data)
return request({
url: '/outcomewmsjbapplytemp/add',
method: 'post',
data: data
})
}
export function updateOutcomeWmsJbapplyTemp(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/outcomewmsjbapplytemp/update/' + businessId,
method: 'put',
data
})
}
export function delOutcomeWmsJbapplyTemp(businessId) {
return request({
url: '/outcomewmsjbapplytemp/deleteLogical/' + businessId,
method: 'delete'
})
}
export function exportOutcomeWmsJbapplyTemp(query) {
return request({
url: '/outcomewmsjbapplytemp/export',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 校验
export function validNumber(query) {
return request({
url: '/outcomewmsjbapplytemp/validNumber',
method: 'get',
params: query
})
}
// 查询标签信息
export function querykindsNumber() {
return request({
url: '/outcomewmsjbapplytemp/querykindsNumber',
method: 'get'
})
}
// 处理
export function handleOutWarehouse(query) {
return request({
url: '/outcomewmsjbapplytemp/handleOutWarehouse',
method: 'get',
params: query
})
}
......@@ -4,7 +4,7 @@ import { getInfo } from '@/api/login'
import Layout from '@/layout/index'
// pathList: 是要隐藏菜单的集合 system元素:一级菜单的路径(path)
const pathList = ['system','system/log','production','equipment','process','/none2','sample','tlias','/test','/inspect','/controlPlatform/control','/template/planeGraph']
const pathList = ['system', 'system/log', 'production', 'equipment', 'process', '/none2', 'sample', 'tlias', '/test', '/inspect', '/controlPlatform/control', '/template/planeGraph', '/demoData/demoData1']
const permission = {
state: {
......@@ -26,7 +26,7 @@ const permission = {
var menus = []
res.data.menus.forEach(item => {
if (!pathList.includes(item.path)) {
menus.push(item)
menus.push(item)
}
})
const accessedRoutes = filterAsyncRouter(menus)
......
<template>
<div class="dispose-module">
<div class="search">
<el-form ref="searchRef" :model="form" :rules="rules" label-width="80px" class="formClass" label-position="right">
<el-form-item label="code:">
<span>{{ form.appCode || '-' }}</span>
</el-form-item>
<el-form-item label="pn:">
<span>{{ form.pn || '-' }}</span>
</el-form-item>
<div class="searchDiv">
<el-form-item label="ptype:">
<span>{{ getDictLabelByValue(typeList,form.ptype) || '-' }}</span>
</el-form-item>
<el-form-item label="qty:">
<span>{{ form.qty || '-' }}</span>
</el-form-item>
</div>
</el-form>
</div>
<hr class="disposeHr">
<div class="disposeTable">
<div class="searchInput">
<el-form ref="formRef" :model="searchForm" :rules="rules" label-width="80px" class="formClass" label-position="right">
<el-form-item label="位置">
<el-input ref="input1" v-model="searchForm.search" clearable @keyup.enter.native="handleSearch" />
</el-form-item>
<el-form-item label="LOT">
<el-input ref="input2" v-model="searchForm.lot" clearable @keyup.enter.native="handleSearchLot" />
</el-form-item>
</el-form>
</div>
<div class="disposeTableContent">
<el-table :data="tableList" :row-class-name="tableRowClassName" style="width: 100%">
<el-table-column label="location">
<template slot-scope="scope">
<span>{{ scope.row.location || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="LOT">
<template slot-scope="scope">
<span>{{ scope.row.lot || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="数量">
<template slot-scope="scope">
<span>{{ scope.row.needNumber || '-' }}</span>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="totalNumber">
<div class="label">总计:</div>
<div v-if="total > 0" class="number">{{ total }}</div>
</div>
<div class="button_row">
<el-button class="button_rowBtn" type="primary" @click="handleSave">出库</el-button>
</div>
</div>
</template>
<script>
import { persistOut } from '@/api/setup/applicationTable'
import { handleOutWarehouse } from '@/api/outcomeWmsJbapplyTemp'
import { getDict } from '@/api/system/dict/data'
import { playAudio, successAudio } from '@/utils/common'
export default {
name: 'Dispose',
data() {
return {
typeList: [],
// 本地储存
/**
* 元素是一个对象 对象中有三个值 location list frequency
* **/
storeList: [],
search: null,
lot: null,
// 总计
total: 0,
rowIndexList: [],
// 当前高亮的索引
currentIndex: -1,
SearchKeyword: '',
businessId: null,
form: {
},
rules: {
},
tableList: [],
searchForm: {
search: '',
lot: ''
}
}
},
created() {
this.focusing()
this.getAllDict()
// 获取数据字典
this.getDetail()
},
methods: {
/**
* @description: 一开始将焦点聚焦到第一个输入框下
* @author: gaoyu
* @param:
* @return:
**/
focusing() {
this.$nextTick().then(() => {
this.$refs.input1.focus()
})
},
getAllDict() {
getDict('APPLICATION_TYPE').then(res => {
if (res.code === 200) {
console.log('res', res)
this.typeList = res.data
}
})
},
getDictLabelByValue(list, value) {
let label = '-'
if (list && list.length > 0 && value) {
if (list.find(item => item.dictValue === value)) {
label = list.find(item => item.dictValue === value).dictLabel
console.log('111')
return label
}
}
return label
},
tableRowClassName({ row, rowIndex }) {
if (this.rowIndexList.includes(rowIndex)) {
return 'hight_row'
}
},
// 获取详情
getDetail() {
this.businessId = this.$route.query.businessId
const obj = {
businessId: this.businessId
}
handleOutWarehouse(obj).then(res => {
console.log('res', res)
if (res.code === 200) {
this.form = res.data
this.tableList = res.data.boxList
}
})
},
/**
* 获取本次要高亮的行的下坐标和要加的数量
* **/
getIndexAndNeedNumber(search, lot) {
var last = {
index: null,
lot: null,
needNumber: null
}
/**
* 1.判断储存的list是不是为空
* **/
if (this.storeList.length > 0) {
var list = []
// 判断tableList中location和search及lot相同的元素个数
this.tableList.forEach((item, index) => {
if (item.location === search && item.lot === lot) {
list.push(index)
}
})
if (list.length > 0) {
if (list.length === 1) {
last.index = list[0]
last.lot = this.tableList[list[0]].lot
last.needNumber = this.tableList[list[0]].needNumber
return last
}
if (list.length > 1) {
// 是否能从储存中找到location
if (this.storeList.find(Litem => Litem.location === search && Litem.lot === lot)) {
var index = this.storeList.findIndex(Litem => Litem.location === search && Litem.lot === lot)
this.storeList[index].frequency = this.storeList[index].frequency + 1
if (this.storeList[index].frequency < this.storeList[index].list.length) {
last.index = this.storeList[index].list[this.storeList[index].frequency]
last.needNumber = this.tableList[this.storeList[index].list[this.storeList[index].frequency]].needNumber
last.lot = this.tableList[this.storeList[index].list[this.storeList[index].frequency]].lot
return last
} else {
return null
}
} else {
var objT = {
location: search,
lot: lot,
list: list,
frequency: 0
}
this.storeList.push(objT)
last.index = list[0]
last.needNumber = this.tableList[list[0]].needNumber
last.lot = this.tableList[list[0]].lot
return last
}
}
} else {
playAudio(true)
this.$message.error({
message: '输入的位置' + this.searchForm.search + '不正确请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
this.searchForm.search = null
this.searchForm.lot = null
return null
}
} else {
// 向储存列表加数据
var obj = {
location: search,
lot: lot,
list: [],
frequency: 0
}
// 判断tableList中location和search相同的元素个数
this.tableList.forEach((item, index) => {
if (item.location === search && item.lot === lot) {
obj.list.push(index)
}
})
if (obj.list.length > 0) {
if (obj.list.length === 1) {
this.storeList.push(obj)
last.index = obj.list[0]
last.lot = this.tableList[obj.list[0].lot]
last.needNumber = this.tableList[obj.list[0]].needNumber
return last
}
if (obj.list.length > 1) {
// 向本地本地储存存入obj
this.storeList.push(obj)
last.index = obj.list[0]
last.lot = this.tableList[obj.list[0].lot]
last.needNumber = this.tableList[obj.list[0]].needNumber
return last
}
} else {
playAudio(true)
this.$message.error({
message: '输入的位置' + this.searchForm.search + '不正确请重新输入',
duration: 2000,
onClose: () => {
playAudio(false)
}
})
this.searchForm.search = null
this.searchForm.lot = null
return null
}
console.log('判断tableList中location和search相同的元素个数', obj.list.length)
}
},
// 查询回
handleSearch() {
// 获取位置输入框的数据
if (this.searchForm.search && this.searchForm.search !== '') {
if (this.searchForm.search.includes(',')) {
this.search = this.searchForm.search.split(',')[0]
} else {
this.search = this.searchForm.search
}
}
console.log('this.search', this.search)
if (this.search != null) {
this.$nextTick().then(() => {
this.$refs.input2.focus()
})
}
},
handleSearchLot() {
// 获取LOT输入框的数据
if (this.searchForm.lot && this.searchForm.lot !== '') {
this.lot = this.searchForm.lot
}
if (this.search && this.lot) {
var lot = this.lot
var search = this.search
// 调用方法,并传入位置和LOT作为参数
const obj = this.getIndexAndNeedNumber(search, lot)
if (obj) {
const { index, needNumber } = obj
if (!this.rowIndexList.includes(index)) {
successAudio(true)
this.rowIndexList.push(index)
this.search = null
this.lot = null
}
this.total = this.total + needNumber
this.searchForm.search = ''
this.searchForm.lot = '' // 清空LOT输入框数据
}
}
},
// 出库
handleSave() {
if (this.total === this.form.qty) {
const obj = {
pn: this.form.pn,
ptype: this.form.ptype,
businessId: this.businessId,
boxList: this.tableList
}
console.log('参数', obj)
persistOut(obj).then(res => {
console.log('res', res)
if (res.code === 200) {
this.$router.push({
path: '/setup/applicationTable'
})
this.$message.success({
message: '出库成功!',
duration: 2500
})
}
})
} else {
this.$message.warning({
message: '您所选择的库存数量' + this.form.qty + '小于您申请的数量' + this.total,
duration: 2000
})
}
}
}
}
</script>
<style lang="scss">
.dispose-module{
.hight_row {
background: #FFCC66 !important; /* 设置高亮行的背景色 */
}
.search{
width: 96%;
.searchDiv{
display: flex;
justify-content: space-between;
}
}
.disposeHr{
margin-bottom: 20px;
}
.disposeTable{
margin-left: 2%;
width: 96%;
.disposeTableContent{
margin-top: 20px;
}
}
.totalNumber{
display: flex;
.label{
color: red;
margin: 20px;
}
.number{
margin: 20px;
}
}
.button_row{
display: flex;
justify-content: center;
.button_rowBtn{
font-size: 17px;
width: 160px;
}
.button_rowText{
margin-top: 10px;
}
}
}
</style>
<template>
<div class="application">
<!-- 第一部分 -->
<div class="oneRegion">
<div class="top">
<div v-if="tabList[0].number == 0" class="oneButtion">
<div class="spanTest">
<div class="testContent">{{ tabList[0].label }}</div>
</div>
</div>
<div v-if="tabList[0].number > 0" class="oneButtion">
<el-button
:class="actionIndex === 0 ? 'button_rowBtn_action' : 'button_rowBtn'"
type="primary"
@click="handleToggle(tabList[0],0)"
>
<div class="buttionText">
<span>{{ tabList[0].label }}</span>
<span style="color: red">({{ tabList[0].number }})</span>
</div>
</el-button>
</div>
<!-- <div v-if="tabList[1].number == 0" class="oneButtion">-->
<!-- <div class="spanTest"><div class="testContent">{{ tabList[1].label }}</div></div>-->
<!-- </div>-->
<!-- <div v-if="tabList[1].number > 0" class="oneButtion">-->
<!-- <el-button-->
<!-- :class="actionIndex === 1 ? 'button_rowBtn_action' : 'button_rowBtn'"-->
<!-- type="primary"-->
<!-- @click="handleToggle(tabList[1],1)"-->
<!-- >-->
<!-- <div class="buttionText">-->
<!-- <span>{{ tabList[1].label }}</span>-->
<!-- <span style="color: red">({{ tabList[1].number }})</span>-->
<!-- </div>-->
<!-- </el-button>-->
<!-- </div>-->
</div>
<!-- <div class="top">-->
<!-- <div v-if="tabList[2].number == 0" class="oneButtion">-->
<!-- <div class="spanTest"><div class="testContent">{{ tabList[2].label }}</div></div>-->
<!-- </div>-->
<!-- <div v-if="tabList[2].number > 0" class="oneButtion">-->
<!-- <el-button-->
<!-- :class="actionIndex === 2 ? 'button_rowBtn_action' : 'button_rowBtn'"-->
<!-- type="primary"-->
<!-- @click="handleToggle(tabList[2],2)"-->
<!-- >-->
<!-- <div class="buttionText">-->
<!-- <span>{{ tabList[2].label }}</span>-->
<!-- <span style="color: red">({{ tabList[2].number }})</span>-->
<!-- </div>-->
<!-- </el-button>-->
<!-- </div>-->
<!-- <div v-if="tabList[3].number == 0" class="oneButtion">-->
<!-- <div class="spanTest"><div class="testContent">{{ tabList[3].label }}</div></div>-->
<!-- </div>-->
<!-- <div v-if="tabList[3].number > 0" class="oneButtion">-->
<!-- <el-button-->
<!-- :class="actionIndex === 3 ? 'button_rowBtn_action' : 'button_rowBtn'"-->
<!-- type="primary"-->
<!-- @click="handleToggle(tabList[3],3)"-->
<!-- >-->
<!-- <div class="buttionText">-->
<!-- <span>{{ tabList[3].label }}</span>-->
<!-- <span style="color: red">({{ tabList[3].number }})</span>-->
<!-- </div>-->
<!-- </el-button>-->
<!-- </div>-->
<!-- </div>-->
</div>
<!-- 清空按钮 -->
<div class="clearRegion">
<el-button class="button_rowBtn" type="warning" @click="handleClear">刷新</el-button>
</div>
<!-- 第三部分-->
<div class="threeTable">
<hr class="tableHr">
<el-table :data="tableList">
<el-table-column type="index" label="序号" width="50" />
<el-table-column label="pn">
<template slot-scope="scope">
<span>{{ scope.row.pn || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template slot-scope="scope">
<span style="color: #46BCF3;cursor: pointer" @click="handleDispose(scope.row)">处理</span>
</template>
</el-table-column>
</el-table>
<app-pagination
v-show="total>0"
:total="total"
:page.sync="queryparams.page"
:limit.sync="queryparams.rows"
@pagination="getList"
/>
</div>
</div>
</template>
<script>
import appPagination from '@/views/components/appPagination'
import AppPagination from '@/views/components/appPagination'
import { listOutcomeWmsJbapplyTemp, validNumber, querykindsNumber } from '@/api/outcomeWmsJbapplyTemp'
export default {
name: 'ApplicationTable',
comments: [appPagination],
components: { AppPagination },
data() {
return {
loading: false,
total: 0,
queryparams: {
page: 1,
rows: 10,
ptype: '',
dealStatus: '0'
},
// 选中的下坐表
actionIndex: null,
// 标签集合
tabList: [],
// 对应标签下的列表数据
tableList: []
}
},
created() {
this.getTabList()
},
methods: {
// 获取申请分类的数量
getTabList() {
querykindsNumber().then(res => {
if (res.code === 200) {
this.tabList = res.data
console.log('检查列表', this.tabList)
this.getTableAndIndex(res.data).then(() => {})
}
})
},
// 切换分类
handleToggle(value, index) {
this.queryparams.ptype = value.type
this.actionIndex = index
this.loading = true
listOutcomeWmsJbapplyTemp(this.queryparams).then(res => {
this.tableList = res.rows
this.total = res.total
this.loading = false
})
},
// 重置
handleClear() {
this.getTabList()
},
/**
* @description: 根据list 获取第一number不为0的数据
* @author: gaoyu
* @param: list
**/
async getTableAndIndex(list) {
var tempIndexList = []
var tempTypeList = []
list.forEach((item, index) => {
if (item.number > 0 || item.number === '0') {
tempIndexList.push(index)
tempTypeList.push(item.type)
}
})
console.log('tempIndexList', tempIndexList)
console.log('tempTypeList', tempTypeList)
if (tempIndexList.length > 0) {
this.actionIndex = tempIndexList[0]
}
if (tempTypeList.length > 0) {
this.queryparams.ptype = tempTypeList[0]
const obj = {
page: 1,
rows: 10,
ptype: tempTypeList[0],
dealStatus: '0'
}
try {
console.log('传给后端获取的值', obj)
const res = await listOutcomeWmsJbapplyTemp(obj)
this.tableList = res.rows
console.log('获取的数据', this.tableList)
this.total = res.total
} catch (error) {
console.error('Error fetching data:', error)
}
}
},
getList() {
this.loading = true
listOutcomeWmsJbapplyTemp(this.queryparams).then(res => {
this.tableList = res.rows
this.total = res.total
this.loading = false
})
},
// 处理
handleDispose(item) {
const obj = {
businessId: item.businessId
}
validNumber(obj).then(res => {
console.log('res', res)
if (res.data) {
this.$router.push({
path: '/setup/checkTheApplicationForExit',
query: {
businessId: item.businessId
}
})
}
})
}
}
}
</script>
<style scoped lang="scss">
.application {
.oneRegion {
.top {
display: flex;
justify-content: center;
margin-bottom: 20px;
.oneButtion {
margin-right: 10px;
.divTest {
}
.spanTest {
cursor: pointer;
background: #808080;
color: #FFFFFF;
border-radius: 4px;
height: 30px;
width: 140px;
display: flex;
justify-content: center;
align-items: center;
.testContent{
width: 108px;
height: 18px;
}
}
.button_rowBtn {
width: 140px;
background: #808080;
border: #808080;
.buttionText {
display: flex;
justify-content: space-between;
}
}
.button_rowBtn_action {
width: 140px;
.buttionText {
display: flex;
justify-content: space-between;
}
}
}
}
}
.clearRegion {
display: flex;
justify-content: center;
margin-bottom: 20px;
.button_rowBtn {
width: 140px;
}
}
.threeTable{
width: 92%;
margin: 4%;
.tableHr{
margin-bottom: 20px;
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment