Commit 80d0daee authored by 高宇's avatar 高宇

Merge remote-tracking branch 'origin/project1' into project1

parents 13b77f81 2b31a486
<template>
<div class="app-container">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="pn" prop="pn">
<el-input
v-model="queryParams.pn"
placeholder="请输入pn"
clearable
:maxlength="30"
size="small"
style="width: 150px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="phd" prop="phdStr">
<el-input
v-model="queryParams.phdStr"
placeholder="请输入phd"
clearable
size="small"
style="width: 150px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="prank" prop="prankStr">
<el-input
v-model="queryParams.prankStr"
placeholder="请输入prank"
clearable
:maxlength="100"
size="small"
style="width: 150px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="pstatus">
<el-select
v-model="queryParams.pstatus"
placeholder="请选择状态"
clearable
size="small"
style="width: 150px"
>
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" style="padding: 8px 7px;" icon="el-icon-search" size="small" @click="handleQuery">查询</el-button>
<el-button style="padding: 8px 7px;" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="placeholder" />
<div style="padding:5px 10px">
<div class="mb12 font-small-bold">设备领用</div>
<el-table v-loading="loading" border :data="equipmentapplyList" @selection-change="handleSelectionChange">
<el-table-column type="index" label="序号" width="50" />
<el-table-column label="pn" prop="pn" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.pn || '-' }}
</template>
</el-table-column>
<el-table-column label="phd" prop="phd" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.phd || '-' }}
</template>
</el-table-column>
<el-table-column label="prank" prop="prank" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.prank || '-' }}
</template>
</el-table-column>
<el-table-column label="pgx" prop="pgx">
<template slot-scope="scope">
{{ replace(scope.row.pgx) }}
</template>
</el-table-column>
<el-table-column label="pissb" prop="pissb">
<template slot-scope="scope">
{{ selectedPissb(scope.row.pissb) }}
</template>
</el-table-column>
<el-table-column label="库类型" prop="ptype">
<template slot-scope="scope">
{{ selectedPtype(scope.row.ptype) }}
</template>
</el-table-column>
<el-table-column label="状态" prop="pstatus">
<template slot-scope="scope">
<span v-if="scope.row.pstatus === '0'" style="color: red">未完成</span>
<span v-else style="color: green">已完成</span>
</template>
</el-table-column>
<el-table-column label="申请人" prop="createName">
<template slot-scope="scope">
{{ scope.row.createName || '-' }}
</template>
</el-table-column>
<el-table-column label="申请时间" :show-overflow-tooltip="true" align="center" prop="updateDate" width="200px">
<template slot-scope="scope">
<span>{{ scope.row.updateDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width" width="200px">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
<!-- TODO: 详情 -->
<el-dialog class="aboutSingleDetails" :title="title" :visible.sync="openDetails" width="1200px" append-to-body>
<el-form ref="formDetails" :model="singleDetails" size="small" label-width="90px">
<el-row>
<el-col :span="8">
<el-form-item label="pn:" prop="pn">
<el-input v-model.trim="singleDetails.pn" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="phd:" prop="phd">
<el-input v-model.trim="singleDetails.phd" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="prank:" prop="prank">
<el-input v-model.trim="singleDetails.prank" :readonly="true" :maxlengrh="100" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="pgx:" prop="pgx">
<span>{{ replace(singleDetails.pgx) }}</span>
<!-- <el-input v-model.trim="singleDetails.pgx" :readonly="true" />-->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="pissb:" prop="pissb">
{{ selectedPissb(singleDetails.pissb) }}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="pnumber:" prop="pnumber">
<el-input v-model.trim="singleDetails.pnumber" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="申请人:" prop="createName">
<el-input v-model.trim="singleDetails.createName" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label=" 申请时间:" prop="createDate">
<el-input v-model.trim="singleDetails.createDate" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- apply详情-->
<el-table v-if="applyStatus === '1'" v-loading="loadingDetail" border :data="applyList" @selection-change="handleSelectionChange">
<el-table-column type="index" label="序号" width="50" />
<el-table-column label="pn" prop="pn">
<template slot-scope="scope">
{{ scope.row.pn || '-' }}
</template>
</el-table-column>
<el-table-column label="lot" prop="lot" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.lot || '-' }}
</template>
</el-table-column>
<el-table-column label="plocation" prop="plocation">
<template slot-scope="scope">
{{ scope.row.plocation || '-' }}
</template>
</el-table-column>
<el-table-column label="prank" prop="prank">
<template slot-scope="scope">
{{ scope.row.prank || '-' }}
</template>
</el-table-column>
<el-table-column label="pzl" prop="pzl">
<template slot-scope="scope">
{{ scope.row.pzl || '-' }}
</template>
</el-table-column>
<el-table-column label="phd" prop="phd">
<template slot-scope="scope">
{{ scope.row.phd || '-' }}
</template>
</el-table-column>
<el-table-column label="psm" prop="psm">
<template slot-scope="scope">
{{ scope.row.psm || '-' }}
</template>
</el-table-column>
<el-table-column label="pissb" prop="pissb">
<template slot-scope="scope">
<span v-if="scope.row.pissb === '0'"></span>
<span v-else></span>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!-- TODO: 处理 -->
<el-dialog title="设备领用" :visible.sync="openHandle" width="1200px" append-to-body :close-on-click-modal="false" @close="handlecanceClose">
<el-form ref="formDetails" class="aboutSingleDetails" :model="singleDetails" size="small" label-width="90px">
<el-row>
<el-col :span="8">
<el-form-item label="pn:" prop="pn">
<el-input v-model.trim="singleDetails.pn" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="phd:" prop="phd">
<el-input v-model.trim="singleDetails.phd" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="prank:" prop="prank">
<el-input v-model.trim="singleDetails.prank" :readonly="true" :maxlength="100"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="pgx:" prop="pgx">
<span>{{ replace(singleDetails.pgx) }}</span>
<!-- {{ singleDetails.pgx }}-->
<!-- <el-input v-model.trim="singleDetails.pgx" :readonly="true" />-->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="pissb:" prop="pissb">
<template>
<span v-if="singleDetails.pissb === '0'"></span>
<span v-else></span>
</template>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="pnumber:" prop="pnumber">
<el-input v-model.trim="singleDetails.pnumber" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="申请人:" prop="createName">
<el-input v-model.trim="singleDetails.createName" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label=" 申请时间:" prop="createDate">
<el-input v-model.trim="singleDetails.createDate" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 分割线-->
<el-divider />
<el-form ref="queryFormWarehouse" style="padding: 0 0 0 10px" :model="queryParamsDetail" :inline="true">
<el-form-item label="pn" prop="pn">
<el-input
v-model="queryParamsDetail.pn"
placeholder="请输入pn"
clearable
:maxlength="30"
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="lot" prop="lot">
<el-input
v-model="queryParamsDetail.lot"
placeholder="请输入lot"
clearable
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="plocation" prop="plocation">
<el-input
v-model="queryParamsDetail.plocation"
placeholder="请输入plocation"
clearable
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" style="padding: 8px 7px;" icon="el-icon-search" size="small" @click="handleQueryWarehouse">查询</el-button>
<el-button style="padding: 8px 7px;" icon="el-icon-refresh" size="small" @click="resetQueryWarehouse">重置</el-button>
</el-form-item>
<el-radio-group v-model="radio1" class="ml-4" style="padding: 25px 7px;" @change="login">
<el-radio label="2" size="large">工序库</el-radio>
<el-radio label="1" size="large">设备库</el-radio>
</el-radio-group>
</el-form>
<el-table v-loading="loadingDetail" border :data="detailApplyList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column type="index" label="序号" width="50" />
<el-table-column label="pn" prop="pn">
<template slot-scope="scope">
{{ scope.row.pn || '-' }}
</template>
</el-table-column>
<el-table-column label="lot" prop="lot" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.lot || '-' }}
</template>
</el-table-column>
<el-table-column label="plocation" prop="plocation">
<template slot-scope="scope">
{{ scope.row.plocation || '-' }}
</template>
</el-table-column>
<el-table-column label="prank" prop="prank">
<template slot-scope="scope">
{{ scope.row.prank || '-' }}
</template>
</el-table-column>
<el-table-column label="pzl" prop="pzl">
<template slot-scope="scope">
{{ scope.row.pzl || '-' }}
</template>
</el-table-column>
<el-table-column label="phd" prop="phd">
<template slot-scope="scope">
{{ scope.row.phd || '-' }}
</template>
</el-table-column>
<el-table-column label="psm" prop="psm">
<template slot-scope="scope">
{{ scope.row.psm || '-' }}
</template>
</el-table-column>
<el-table-column v-if="this.radio1 == '2'" label="入库日期" prop="recycleDate">
<template slot-scope="scope">
{{ parseTime(scope.row.recycleDate,'{y}-{m}-{d}') }}
</template>
</el-table-column>
<el-table-column v-if="this.radio1 === '1'" label="入库日期" prop="createDate">
<template slot-scope="scope">
{{ parseTime(scope.row.createDate, '{y}-{m}-{d}') || '-' }}
</template>
</el-table-column>
</el-table>
<div style="float: right;padding:3px 15px;">
<el-button
type="primary"
size="small"
@click="handleCance"
>确定</el-button>
</div>
</el-dialog>
<el-dialog title="权限验证" :visible.sync="menu" width="500px" append-to-body :close-on-click-modal="false" @close="handlemenuClose">
<div style="text-align: center">
<span style="font-size: 15px">您选择的设备入库日期较早,需要权限验证 </span>
</div>
<el-form ref="form" :model="menuform" label-width="80px">
<el-form-item label="密码">
<el-input v-model="menuform.passWord" type="password" placeholder="请输入密码" />
<span v-if="twoerrorPassword" style="font-size: 14px;color: red">密码错误,请重试</span>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handlemenuConfirm">确定</el-button>
</el-form-item>
</el-form>
</el-dialog>
<!-- 菜单权限验证-->
<el-dialog :title="title" :visible.sync="openLogin" width="500px" append-to-body :close-on-click-modal="false" @close="handleClose">
<div style="text-align: center">
<span style="font-size: 15px">当前选择跨越设备需要权限验证</span>
</div>
<el-form ref="form" :model="loginform" label-width="80px">
<el-form-item label="密码">
<el-input v-model="loginform.password" type="password" placeholder="请输入密码" />
<span v-if="errorPassword" style="font-size: 14px;color: red">密码错误,请重试</span>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import { getDictData, getEquipment } from '@/api/equipment/application'
import { listWbApply, deleteLogical, batchAddition, detail, checkPermission, canceListByType } from '@/api/equipment/draw'
import { parseTime } from '@/utils'
export default {
name: 'Draw',
data() {
return {
twoerrorPassword: false,
errorPassword: false,
// 数据字典列表
dictList: [],
isClose: false,
number: '',
menu: false,
menuform: {
passWord: ''
},
monthDate: false,
// 是否切换库
isCheck: false,
loginform: {
password: ''
},
// 打开登录验证界面
openLogin: false,
radio1: '2',
ptype: '',
pgx: '',
prank: '',
pissb: '',
rkDate: '',
totalApplyDetail: 0,
applyList: [],
canceList: [],
applyId: '',
multipleSelection: [],
detailApplyList: [],
deviceList: [],
// TODO: 表单里的单项详情参数
singleDetails: {
pn: '',
phd: '',
prank: '',
pgx: '',
pissb: '',
pstatus: '',
pnumber: '',
createName: '',
createTime: ''
},
// 是否显示弹出层(申请处理)
openHandle: false,
// 是否显示弹出层(数据详情)
openDetails: false,
loadingDetail: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// apply_detail的总条数
totalDetail: 0,
// 设备申请表格数据
equipmentapplyList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 是否显示弹出层(数据权限)
openDataScope: false,
// 日期范围
// dateRange: [],
// 菜单表格数据
menuList: [],
menuExpand: false,
menuNodeAll: false,
deptExpand: true,
deptNodeAll: false,
// 状态数据字典
statusOptions: [
{
dictLabel: '已完成',
dictValue: '1'
},
{
dictLabel: '未完成',
dictValue: '0'
}
],
// pissb数据字典
pissbOptions: [
{
dictLabel: '是',
dictValue: '1'
},
{
dictLabel: '否',
dictValue: '0'
}
],
// 查询参数
queryParams: {
page: 1,
rows: 10,
pn: undefined,
lot: undefined,
plocation: undefined,
ptype: '',
delFlag: 0
},
// 查询warehouse的参数
queryParamsDetail: {
page: 1,
rows: 10,
pn: undefined,
lot: undefined,
plocation: undefined,
ptype: '2',
delFlag: 0
},
// 表单参数
form: {},
deptOptions: [],
// 判断状态显示表单
applyStatus: ''
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
this.getDict()
this.getList()
},
methods: {
// 判断日期是否相同
isSameMonthDates(datesArray) {
console.log('datesArray', datesArray)
// 如果数组中只有一个元素,返回日期相同
if (datesArray.length === 1) {
return true
}
// 获取第一个日期的月份
const firstMonth = datesArray[0].getMonth()
// 遍历数组中的日期,检查月份是否都相同
for (let i = 1; i < datesArray.length; i++) {
if (datesArray[i].getMonth() !== firstMonth) {
console.log('111')
return false
}
}
return true
},
// 符合弹出权限菜单时返回 true,不符合false
condition(list1, list2, number) {
// 所有数据的id的集合
var idList = []
// 前选中的数量id的集合
var checkIdList = []
// 选中的list日期的集合
var checkTimeList = []
idList = list2.map(item => item.businessId)
checkIdList = idList.splice(0, number)
var i = 0
list1.forEach(item => {
checkIdList.forEach(Litem => {
if (item.tempId === Litem) {
i = i + 1
}
})
})
console.log('list1', list1)
console.log('checkIdList', checkIdList)
console.log('i', i)
console.log('number', number)
if (i === number) {
return false
} else {
list1.forEach(item => {
checkTimeList.push(new Date(item.rkDate))
})
if (this.isSameMonthDates(checkTimeList)) {
return false
} else {
return true
}
}
},
replace(value) {
if (this.dictList.length === 0) {
return value
}
let label = ''
if (this.dictList.length > 0) {
this.dictList.forEach(item => {
if (item.dictValue === value) {
label = item.dictLabel
}
})
}
return label
},
getDict() {
const obj = {
key: 'GX_CODE'
}
getDictData(obj).then(res => {
if (res.code === 200 && res.data !== null) {
this.dictList = res.data
}
})
},
handlemenuClose() {
this.menu = false
this.loadingDetail = false
this.openHandle = true
this.twoerrorPassword = false
this.menuform.passWord = ''
},
handleClose() {
this.openLogin = false
this.loadingDetail = false
this.openHandle = true
this.loginform.password = ''
console.log('isClose', this.isClose)
if (this.isClose) {
this.radio1 = '1'
} else {
this.radio1 = '2'
}
},
handlemenuConfirm() {
const obj = {
passWord: this.menuform.passWord
}
checkPermission(obj).then(res => {
if (res.code === 200) {
this.menu = false
this.loadingDetail = false
this.openHandle = false
this.twoerrorPassword = false
batchAddition(this.canceList).then(res => {
if (res.code === 200) {
this.openHandle = false
this.$message.success('操作成功')
this.queryParams.page = 1
this.getList()
}
})
} else if (res.code === null) {
this.twoerrorPassword = true
}
})
},
// 判断时间范围 是否是一个月以内的的时间
isWithinLastMonth(dateToCheck) {
// 获取当前日期
const currentDate = new Date()
// 获取当前日期的年份和月份
const currentYear = currentDate.getFullYear()
const currentMonth = currentDate.getMonth()
// 获取要比较日期的年份和月份
const compareYear = dateToCheck.getFullYear()
const compareMonth = dateToCheck.getMonth()
// 比较年份和月份是否相等
return currentYear === compareYear && currentMonth === compareMonth
},
handlecanceClose() {
this.loadingDetail = false
this.openHandle = false
this.isCheck = false
},
handcheckPermissionQuery() {
const obj = {
sort: '2',
pn: this.pn,
type: this.radio1,
pgx: this.pgx,
prank: this.prank,
pissb: this.pissb,
page: this.queryParamsDetail.page,
rows: this.queryParamsDetail.rows,
tempPn: this.queryParamsDetail.pn,
lot: this.queryParamsDetail.lot,
plocation: this.queryParamsDetail.plocation
}
canceListByType(obj).then(res => {
if (res.code === 200) {
if (res.data.createDate !== null) {
res.data.createDate = parseTime(res.data.createDate, '{y}-{m}-{d}')
}
this.detailApplyList = res.data
this.loadingDetail = false
this.openHandle = true
}
})
},
// 菜单权限验证确定
handleConfirm() {
this.isClose = false
const obj = {
passWord: this.loginform.password
}
checkPermission(obj).then(res => {
if (res.code === 200) {
this.openHandle = false
this.loadingDetail = false
this.errorPassword = false
this.openLogin = false
this.isClose = true
const obj = {
sort: '1',
pn: this.pn,
type: this.radio1,
pgx: this.pgx,
prank: this.prank,
pissb: this.pissb
}
canceListByType(obj).then(res => {
console.log('res', res)
if (res.code === 200) {
this.isCheck = true
if (res.data.createDate !== null) {
res.data.createDate = parseTime(res.data.createDate, '{y}-{m}-{d}')
}
console.log('radio1', this.radio1)
this.loginform.password = ''
this.detailApplyList = res.data
this.loadingDetail = false
this.openHandle = true
}
})
} else if (res.code === null) {
this.isClose = false
this.errorPassword = true
}
})
},
// 处理弹窗里的勾选确定
handleCance() {
this.loadingDetail = true
this.monthDate = false
if (this.multipleSelection.length === 0) {
this.loadingDetail = false
return this.$message.warning('请至少选择一个要处理的设备')
} else {
this.canceList = []
this.multipleSelection.forEach(item => {
let recycleDate = ''
if (this.radio1 === '2') {
recycleDate = item.recycleDate
} else if (this.radio1 === '1') {
recycleDate = item.createDate
}
const obj = {
tempId: item.businessId,
applyId: this.applyId,
pn: item.pn,
pzl: item.pzl,
lot: item.lot,
plocation: item.plocation,
phd: item.phd,
psm: item.psm,
prank: item.prank,
rkDate: recycleDate
}
this.canceList.push(obj)
})
if (this.canceList.length !== this.number) {
console.log('number', this.number)
this.loadingDetail = false
this.openHandle = true
return this.$message.warning('您选择的设备数据不符合您申请设备的数量')
}
// 判断是否弹出权限菜单,true是符合条件,false是不符合条件
if (this.condition(this.canceList, this.detailApplyList, this.singleDetails.pnumber)) {
this.monthDate = true
this.openHandle = false
}
if (this.monthDate) {
this.twoerrorPassword = false
this.menu = true
}
if (!this.monthDate) {
batchAddition(this.canceList).then(res => {
if (res.code === 200) {
this.loadingDetail = false
this.openHandle = false
this.radio1 = '2'
this.isCheck = false
this.$message.success('操作成功')
this.queryParams.page = 1
this.getList()
}
})
}
}
},
/** 查询warehouse列表 */
getDeviceList() {
this.loadingDetail = true
if (!this.isCheck) {
const obj = {
sort: '2',
type: this.radio1,
pn: this.pn,
phd: this.phd,
ptype: this.ptype,
pgx: this.pgx,
prank: this.prank,
pissb: this.pissb,
page: this.queryParamsDetail.page,
rows: this.queryParamsDetail.rows,
tempPn: this.queryParamsDetail.pn,
lot: this.queryParamsDetail.lot,
plocation: this.queryParamsDetail.plocation
}
getEquipment(obj).then(res => {
if (res.code === 200) {
if (res.data.createDate !== null) {
res.data.createDate = parseTime(res.data.createDate, '{y}-{m}-{d}')
}
this.detailApplyList = res.data
this.loadingDetail = false
this.openHandle = true
}
})
} else {
this.handcheckPermissionQuery()
}
},
// 处理点击
handle(row) {
const id = row.businessId
this.singleDetails = row
this.monthDate = false
this.openHandle = true
this.number = row.pnumber
this.applyId = row.businessId
this.pn = row.pn
this.ptype = row.ptype
this.pgx = row.pgx
this.phd = row.phd
this.prank = row.prank
this.pissb = row.pissb
const obj = {
sort: '2',
type: this.radio1,
phd: row.phd,
pn: row.pn,
ptype: row.ptype,
pgx: row.pgx,
prank: row.prank,
pissb: row.pissb,
page: this.queryParamsDetail.page,
rows: this.queryParamsDetail.rows
}
detail(id).then(res => {
console.log('res', res)
res.data.createDate = parseTime(res.data.createDate, '{y}-{m}-{d}')
this.applyList = res.data.wbApplyDetailList
this.applyStatus = res.data.pstatus
this.loadingDetail = false
})
// 调warehouse分页查询接口
getEquipment(obj).then(res => {
if (res.code === 200) {
if (res.data.createDate !== null) {
res.data.createDate = parseTime(res.data.createDate, '{y}-{m}-{d}')
}
this.detailApplyList = res.data
this.loadingDetail = false
this.openHandle = true
}
})
this.title = '权限验证'
this.loadingDetail = true
},
// 获取行详情信息
handleDetail(row) {
const id = row.businessId
this.openDetails = true
this.singleDetails = row
this.title = '详情'
detail(id).then(res => {
res.data.createDate = parseTime(res.data.createDate, '{y}-{m}-{d}')
this.applyList = res.data.wbApplyDetailList
this.applyStatus = res.data.pstatus
this.loadingDetail = false
})
},
// 查询apply表单
getList() {
this.isCheck = false
this.radio1 = '2'
this.loading = true
listWbApply(this.queryParams).then(
response => {
this.equipmentapplyList = response.rows
this.total = response.total
this.loading = false
}
)
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 取消按钮(数据权限)
cancelDataScope() {
this.openDataScope = false
this.reset()
},
// 表单重置
reset() {
if (this.$refs.menu !== undefined) {
this.$refs.menu.setCheckedKeys([])
}
this.menuExpand = false
this.menuNodeAll = false
this.deptExpand = true
this.deptNodeAll = false
this.form = {
pn: undefined,
ptype: undefined,
pgx: undefined,
flag: undefined,
menuIds: [],
menuName: undefined,
deptIds: [],
menuCheckStrictly: true,
deptCheckStrictly: true,
remark: undefined
}
this.resetForm('form')
},
// warehouse查询
handleQueryWarehouse() {
this.queryParamsDetail.page = 1
this.getDeviceList()
},
/** 查询按钮操作 */
handleQuery() {
this.queryParams.page = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
page: 1,
rows: 10,
pn: '',
phd: '',
prank: '',
pstatus: '',
delFlag: 0
}
this.handleQuery()
},
// 登录
login() {
this.errorPassword = false
this.isClose = false
console.log('radio1', this.radio1)
if (this.radio1 === '1') {
this.title = '权限验证'
this.openLogin = true
this.openHandle = false
} else {
this.loadingDetail = true
const obj = {
sort: '2',
type: this.radio1,
phd: this.phd,
pn: this.pn,
ptype: this.ptype,
pgx: this.pgx,
prank: this.prank,
pissb: this.pissb,
page: this.queryParamsDetail.page,
rows: this.queryParamsDetail.rows,
tempPn: this.queryParamsDetail.pn,
lot: this.queryParamsDetail.lot,
plocation: this.queryParamsDetail.plocation
}
getEquipment(obj).then(res => {
if (res.code === 200) {
if (res.data.createDate !== null) {
res.data.createDate = parseTime(res.data.createDate, '{y}-{m}-{d}')
}
this.detailApplyList = res.data
this.loadingDetail = false
}
})
}
},
// warehouse的重置按钮
resetQueryWarehouse() {
this.queryParamsDetail.pn = null
this.queryParamsDetail.lot = null
this.queryParamsDetail.plocation = null
this.queryParamsDetail.page = 1
this.handleQueryWarehouse()
},
// 多选框选中数据
handleSelectionChange: function(selection) {
this.multipleSelection = selection
},
// 树权限(父子联动)
handleCheckedTreeConnect(value, type) {
if (type === 'menu') {
this.form.menuCheckStrictly = !!value
} else if (type === 'dept') {
this.form.deptCheckStrictly = !!value
}
},
// 树权限(全选/全不选)
handleCheckedTreeNodeAll(value, type) {
if (type === 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions : [])
} else if (type === 'dept') {
this.$refs.dept.setCheckedNodes(value ? this.deptOptions : [])
}
},
// 树权限(展开/折叠)
handleCheckedTreeExpand(value, type) {
if (type === 'menu') {
const treeList = this.menuOptions
for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value
}
} else if (type === 'dept') {
const treeList = this.deptOptions
for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value
}
}
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.businessId
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(res => {
deleteLogical(id).then(res => {
if (res.code === 200) {
this.$message.success('操作成功')
this.queryParams.page = 1
this.getList()
}
})
})
},
/* TODO: pissb 类型判断的公用方法 */
selectedPissb(pissb) {
switch (pissb) {
case '0':
return '否'
case '1':
return '是'
default:
return ''
}
},
/* TODO: ptype 库类型判断的公用方法 */
selectedPtype(ptype) {
switch (ptype) {
case '1':
return '设备库'
case '2':
return '工序库'
default:
return ''
}
}
}
}
</script>
<style lang="scss" scoped>
.aboutSingleDetails{
.el-form-item{
.el-input >>> .el-input__inner {
-webkit-appearance: none;
background-color: #FFF;
background-image: none;
border-radius: 4px;
border: 0;
width: 100%;
}
}
}
.app-container {
font-size: 18px;
padding: 0;
.placeholder {
height: 1.3vh;
background-color: #F4F4F4;
margin-bottom: 10px
}
.table-drop {
vertical-align: 2px;
line-height: 20px;
margin-left: 15px
}
.el-switch {
margin-left: 15px;
}
}
.el-divider--vertical{
height: 12em;
width: 4px;
}
</style>
<template>
<div class="app-container">
<div class="ToolBar">
<el-form v-show="showSearch" ref="queryForm" style="padding: 0 0 0 10px" :model="queryEntity" :inline="true">
<el-form-item label="pn" prop="pn">
<el-input
ref="autoGetFocusInput"
v-model="queryEntity.entity.pn"
placeholder="请输入pn"
clearable
:maxlength="inputMaxLength"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="lot" prop="lot">
<el-input
v-model="queryEntity.entity.lot"
placeholder="请输入lot"
clearable
:maxlength="inputMaxLength"
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="操作时间" prop="date">
<div class="block">
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd"
style="width: 250px"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleChange"
/>
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
<!--TODO: 导出和盘点按钮所在 -->
<el-form-item style="float: right;">
<el-button
type="success"
size="small"
icon="el-icon-download"
@click="handleExport"
>导出
</el-button>
</el-form-item>
</el-form>
</div>
<!-- TODO: 分隔符-->
<div class="placeholder" />
<!--TODO: Table表单-->
<transition name="fade-transform" mode="out-in">
<component
:is="BaseTable"
:key="queryParams.rows"
:all-table-arguments="allTableArguments"
@handle-detail="handleDetail"
@change-table-sort="changeTableSort"
/>
</transition>
<!--TODO: 分页组件-->
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
<!-- TODO: 单项详情信息表单配置 -->
<el-dialog
class="aboutSingleDetails"
:title="title"
:visible.sync="openDetails"
:close-on-click-modal="false"
width="800px"
append-to-body
@closed="handleClose"
>
<el-form ref="formDetails" :model="singleDetails" size="small" label-width="90px">
<el-row :gutter="10" justify="start" align="middle">
<el-col :span="12">
<el-form-item label="pn:" prop="pn">
<el-input ref="input1" v-model.trim="singleDetails.pn" :readonly="isReadOnly" @keyup.enter.native="handelTab(1,$event)" />
</el-form-item>
<el-form-item label="lot:" prop="lot">
<el-input ref="input2" v-model.trim="singleDetails.lot" :readonly="isReadOnly" @keyup.enter.native="handelTab(2,$event)" />
</el-form-item>
<el-form-item label="unit:" prop="unit">
<el-input ref="input3" v-model.trim="singleDetails.unit" :readonly="isReadOnly" @keyup.enter.native="handelTab(3,$event)" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库状态:" prop="poperate">
{{ selectedPoperate(singleDetails.poperate) }}
</el-form-item>
<el-form-item label="qty:" prop="qty">
{{ singleDetails.qty }}
</el-form-item>
<el-form-item label="memo:" prop="memo">
<el-input ref="input4" v-model.trim="singleDetails.memo" :readonly="isReadOnly" @keyup.enter.native="handelTab(4,$event)" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="操作员:" prop="userName">
<el-input ref="input5" v-model.trim="singleDetails.userName" :readonly="isReadOnly" @keyup.enter.native="handelTab(5,$event)" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="操作时间:" prop="createDate">
<el-input ref="input6" v-model.trim="singleDetails.createDate" :readonly="isReadOnly" @keyup.enter.native="handelTab(6,$event)" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</div>
</template>
<script>
import { exportInventoryRecord, findSingleLogDetail, listLog } from '@/api/sample/inventoryRecord'
import BaseTable from '@/components/Table/BaseTable/index.vue'
import { BaseTableArgumentsTest } from '@/components/Table/AllTableArguments/BaseTableArguments'
export default {
name: 'InventoryRecord',
components: [
BaseTable
],
data() {
return {
textPrimary: 'text',
deleteName: '删除',
deleteSize: 'mini',
deleteDisabled: 'multiple',
cleanName: '清空',
cleanSize: 'small',
exportName: '导出',
exportSize: 'small',
delIcon: 'el-icon-delete',
exportIcon: 'el-icon-download',
// TODO: 限制搜索输入框的最大能输入数
inputMaxLength: 100,
// TODO:遮罩层
loading: true,
// 非多个禁用
multiple: true,
// TODO: 显示搜索条件
showSearch: true,
// TODO: 数据总条数
total: 0,
// TODO: 查询参数
// TODO: 时间日期范围 调用全局方法来输入进去
dateRange: [],
queryParams: {
page: 1,
rows: 10,
beginTime: '',
endTime: ''
},
queryEntity: {
// TODO: 0表示倒序排序,1表示顺序排序
tableSortMark: 0,
entity: {
// TODO: 设备编码
pn: '',
// TODO: lot
lot: '',
// TODO: 库状态 1入库 2出库 3修正 4废弃
poperate: '4'
}
},
// TODO: list记录表名
listName: '出入库记录列表',
// TODO: 用来接收数据源
inventoryRecordList: [],
// TODO: 用来说明每一列的类型
columObj: {
// 序列
nIndex: true,
// 序列根据条件是否继承排序顺序
nIndextable: false,
// 选择框
selection: false,
// 选择框根据条件是否可选
selectable: (row, index) => {
if (row.switchs) {
return true
}
},
// TODO: column列,columType(列类型,可选text(默认为普通文字模式),input(input可编辑框),switch(switch开关),image(图片),operation(操作按钮))
// TODO: :prop(参数),label(列名),width(宽度),align(对齐方式),sortable(是否支持排序)
columnData: [
{
text: true,
prop: 'pn',
label: 'pn'
},
{
text: true,
prop: 'lot',
label: 'lot'
},
{
text: true,
prop: 'qty',
label: 'qty',
width: '180px',
ownDefinedReturn: (row, $index) => {
return this.selectedPoperate(row.poperate)
}
},
{
ownDefined: true,
prop: 'poperate',
label: '库状态',
ownDefinedReturn: (row, $index) => {
return this.selectedPoperate(row.poperate)
}
},
{
text: true,
prop: 'producer',
label: 'producer',
sortable: false,
width: '150px'
},
{
text: true,
prop: 'userName',
label: '操作员',
sortable: false,
width: '150px'
},
{
time: true,
prop: 'createDate',
label: '操作时间',
align: 'center'
},
/* TODO: 如果为操作列,则需要填写需要的操作按钮,类型为Object。operation(操作类型,可选edit,delete,see),type(按钮样式,参考el—botton类型),label(按钮文字)icon(参考el-icon),color(字体颜色)
* clickType 1为详情 2为修改 3为删除
* */
{
isOperation: true,
label: '操作',
width: '80px',
align: 'center',
sortable: false,
operation: [{
clickType: '1',
label: '详情',
icon: '',
color: '',
size: this.size
}]
}
]
},
// TODO: 表单里的单项详情参数
title: '',
openDetails: false,
isReadOnly: true,
singleDetails: {},
// TODO: 获取表单单项详情的参数
singleLogIdAndPn: {}
}
},
computed: {
BaseTable() {
return BaseTable
},
// TODO: 用来汇总Table组件所需要的全部数据并一次性传输给子组件
allTableArguments() {
const baseTableArgumentsTest = new BaseTableArgumentsTest()
baseTableArgumentsTest.listName = this.listName
baseTableArgumentsTest.loading = this.loading
baseTableArgumentsTest.List = this.inventoryRecordList
baseTableArgumentsTest.queryParams = this.queryParams
baseTableArgumentsTest.columObj = this.columObj
return baseTableArgumentsTest
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
this.getList()
},
// 监听回车
mounted() {
this.$refs.autoGetFocusInput.focus()
},
methods: {
handleChange() {
console.log('dateRange', this.dateRange)
if (this.dateRange !== null) {
this.queryParams.beginTime = this.dateRange[0] + ' 00:00:00'
this.queryParams.endTime = this.dateRange[1] + ' 23:59:00'
} else {
this.queryParams.beginTime = ''
this.queryParams.endTime = ''
}
},
// 回车跳转下一个输入框
focusNextInput(form) {
this.$nextTick(() => {
this.$refs[form].$refs.input.focus()
})
},
// 回车到下一个输入框方法
handelTab(i, e) {
const that = this
if (that.$refs['input' + i]) {
that.$nextTick(() => {
e.target.blur()
const index = i + 1
that.$refs['input' + index].focus()
})
}
},
/** TODO:查询工序库的出入库记录列表 */
getList() {
this.loading = true
listLog(this.queryParams, this.addDateRange(this.queryEntity, this.dateRange)).then(response => {
this.inventoryRecordList = response.rows
this.total = response.total
this.loading = false
})
},
/* TODO: poperate的库状态判断的公用方法 */
selectedPoperate(poperate) {
switch (poperate) {
case '1':
return '入库'
case '2':
return '出库'
case '3':
return '修正'
case '4':
return '废弃'
default:
return ''
}
},
/** TODO: 查询按钮操作 */
handleQuery() {
this.queryParams.page = 1
this.getList()
},
/** TODO: 重置按钮操作 */
resetQuery() {
this.queryEntity = {
tableSortMark: 0,
entity: {
pn: '',
lot: '',
poperate: '4'
}
}
this.dateRange = []
this.handleQuery()
},
/* TODO: 控制单项表单关闭的详情 */
handleClose() {
this.singleLogIdAndPn = {}
},
/* TODO: 进行排序 */
changeTableSort: function(val) {
console.log('column', val)
// TODO:按照降序排序
if (val.order === 'descending') {
this.queryEntity.tableSortMark = 0
} else {
// TODO:按照升序排序
this.queryEntity.tableSortMark = 1
}
this.getList()
},
handleDetail: function(row) {
this.singleDetails = { ...row }
/* TODO: 设置单项详情的查询的条件 */
this.singleLogIdAndPn['businessId'] = row.businessId
this.singleLogIdAndPn['pn'] = row.pn
/* TODO: 进行单项详情的查询 */
findSingleLogDetail(this.singleLogIdAndPn).then(
response => {
this.singleDetails = Object.assign({}, response.data, { ...row })
}
)
this.title = '记录详情'
this.openDetails = true
},
handleExport() {
const obj = {
page: this.queryParams.page,
row: this.queryParams.rows,
beginTime: this.queryParams.beginTime,
endTime: this.queryParams.endTime,
pn: this.queryEntity.entity.pn,
lot: this.queryEntity.entity.lot,
poperate: this.queryEntity.entity.poperate
}
exportInventoryRecord(obj).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
// TODO: 创建下载的链接
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
// TODO: 下载后文件名
downloadElement.download = '出入库记录' + '.xls'
document.body.appendChild(downloadElement)
// TODO: 点击下载
downloadElement.click()
// TODO: 下载完成移除元素
document.body.removeChild(downloadElement)
// TODO: 释放掉blob对象
window.URL.revokeObjectURL(href)
// this.download(response.msg);
})
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
padding: 0;
font-size: 18px;
.placeholder{
height:1.3vh;
background-color: #F4F4F4;
margin-bottom:10px
}
/*TODO: 这里是调整ToolBar的样式的噢!*/
.ToolBar{
.el-form{
.el-form-item{
.el-select{
width: 160px
}
.el-input{
width: 180px
}
}
/* TODO: 定义按钮样式 */
.el-button{
padding: 8px 7px;
}
}
}
}
/* TODO: 专门用来解决el-input边框的问题 */
.aboutSingleDetails{
.el-form{
.el-form-item{
.el-input >>> .el-input__inner {
-webkit-appearance: none;
background-color: #FFF;
background-image: none;
border-radius: 4px;
border: 0;
width: 100%;
}
}
}
}
</style>
......@@ -204,9 +204,6 @@ export default {
{
value: '3',
label: '修正'
}, {
value: '4',
label: '废弃'
}
],
......
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