<template>
|
<a-card :bordered="false">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
</a-row>
|
</a-form>
|
</div>
|
<div class="table-operator">
|
<a-row :gutter="24">
|
<a-col :md="24">
|
<a-button
|
@click="handleAdd"
|
type="primary"
|
icon="plus"
|
:disabled="versionStatus!=''&&versionStatus!='0'&&versionStatus!='1'"
|
v-if="updatePermission&&updateVersionPermission"
|
>
|
新增
|
</a-button>
|
<a-dropdown v-if="selectedRowKeys.length > 0&&!(versionStatus!='0'&&versionStatus!='1')&&updatePermission">
|
<a-menu slot="overlay">
|
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
</a-menu>
|
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
</a-dropdown>
|
<a-button
|
type="primary"
|
icon="arrow-up"
|
style="margin-left:100px"
|
:loading="updataVersionloading"
|
@click="updateVersion"
|
:disabled="versionStatus=='1'||versionStatus=='0'"
|
v-if="updatePermission&&updateVersionPermission"
|
>
|
升版
|
</a-button>
|
<a-button
|
type="primary"
|
icon="arrow-up"
|
style="margin-left:100px"
|
:loading="updataVersionloading"
|
@click="updateVersionForChange"
|
v-if="updatePermission&&!updateVersionPermission&&booleanTag"
|
>
|
升版维护
|
</a-button>
|
<a-dropdown :disabled="versionStatus!='1'&&versionStatus!='0'||usablePermission"
|
v-if="updatePermission&&updateVersionPermission"
|
>
|
<a-menu slot="overlay">
|
<a-menu-item key="1" @click="setTime" ><a-icon type="dashboard" />断点生效</a-menu-item>
|
<a-menu-item key="2" @click="updateVersionStatusToUsable" ><a-icon type="check"/>立即生效</a-menu-item>
|
</a-menu>
|
<a-button type="primary" :loading="usableLoading"> 生效 <a-icon type="down" /></a-button>
|
</a-dropdown>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24" style="margin-top:15px">
|
<a-col
|
:md="6"
|
>
|
车间:
|
<a-select
|
style="width:50%;"
|
placeholder="检索车间"
|
allowClear
|
v-model="warehouseInfo.workshopId"
|
>
|
<a-select-option v-for="item of workshopList" :value="item.id" :key="item.id" >
|
<span :style="getWorkshopOptionStyle(item.versionStatus)"> {{item.name}} <a-icon type="tag" /> {{"V"+item.version+".0"+"("+getVersionStatusDetail(item.versionStatus)+")"}}</span>
|
</a-select-option>
|
</a-select>
|
<a-button v-if="false" type="primary" style="margin-left:5px" @click="clearWorkshopId">清空</a-button>
|
</a-col>
|
<a-col
|
:md="6"
|
>
|
版本:
|
<a-select
|
style="width:50%;"
|
placeholder="选择版本"
|
v-model="warehouseInfo.version"
|
:disabled="versionSelectDisabled"
|
>
|
<a-select-option v-for="item of this.versionList" :value="item" :key="item" >
|
{{"V"+item+".0"}}
|
</a-select-option>
|
</a-select>
|
</a-col>
|
<a-col
|
:md="4"
|
>
|
版本状态:
|
<a-input
|
style="width:47%;"
|
placeholder="版本状态展示区"
|
:disabled="true"
|
v-model="versionStatusDetail"
|
>
|
</a-input>
|
</a-col>
|
<a-col
|
:md="4"
|
>
|
当前生效版本:
|
<a-input
|
style="width:47%;"
|
placeholder="版本"
|
:disabled="true"
|
v-model="nowUsableVersion"
|
>
|
</a-input>
|
</a-col>
|
<a-col
|
:md="4"
|
>
|
上次生效版本:
|
<a-input
|
style="width:47%;"
|
placeholder="版本"
|
:disabled="true"
|
v-model="lastUsableVersion"
|
>
|
</a-input>
|
</a-col>
|
</a-row>
|
</div>
|
<!-- table区域-begin -->
|
<div>
|
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
</div>
|
<a-table
|
ref="table"
|
size="middle"
|
bordered
|
rowKey="id"
|
class="j-table-force-nowrap"
|
:scroll="{x:true}"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
@change="handleTableChange">
|
|
<template slot="htmlSlot" slot-scope="text">
|
<div v-html="text"></div>
|
</template>
|
<template slot="imgSlot" slot-scope="text,record">
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
</template>
|
<template slot="fileSlot" slot-scope="text">
|
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
<a-button
|
v-else
|
:ghost="true"
|
type="primary"
|
icon="download"
|
size="small"
|
@click="downloadFile(text)">
|
下载
|
</a-button>
|
</template>
|
|
<span slot="action" slot-scope="text, record">
|
<a-button
|
type="primary"
|
icon="edit"
|
@click="handleEdit(record)"
|
:disabled="(versionStatus!='0'&&versionStatus!='1')"
|
v-if="updatePermission"
|
>
|
编辑
|
</a-button>
|
<a-divider type="vertical"/>
|
<a-popconfirm
|
title="确定删除吗?"
|
@confirm="() => handleDelete(record.id)"
|
:disabled="(versionStatus!='0'&&versionStatus!='1')"
|
>
|
<a-button
|
type="primary"
|
icon="delete"
|
:disabled="(versionStatus!='0'&&versionStatus!='1')"
|
v-if="updatePermission"
|
>删除
|
</a-button>
|
</a-popconfirm>
|
</span>
|
|
</a-table>
|
</div>
|
|
<a-tabs defaultActiveKey="1">
|
<a-tab-pane tab="仓库服务对象" key="1" >
|
<production-line-warehouse-client-list
|
:mainId="warehouseClientMainId"
|
:workshopId="aWorkshopId"
|
ref="clint" />
|
</a-tab-pane>
|
</a-tabs>
|
|
<production-line-warehouse-modal
|
ref="modalForm"
|
@ok="modalFormOk"
|
@postAdd="postAdd"
|
@handleAdd="handleAdd"
|
:workshopId="warehouseInfo.workshopId"
|
:version="warehouseInfo.version"
|
:workshopList="addWorkShopList"
|
>
|
</production-line-warehouse-modal>
|
<j-modal
|
:visible="visible"
|
switchFullscreen
|
@ok="handleOk"
|
@cancel="handleCancel"
|
:confirmLoading="timeLoading"
|
cancelText="关闭">
|
<j-date
|
v-model="dateStr"
|
placeholder="请设置生效时间"
|
:showTime="true"
|
dateFormat="YYYY-MM-DD HH:mm:ss"
|
>
|
</j-date>
|
</j-modal>
|
</a-card>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import { getAction } from '@/api/manage'
|
import '@/assets/less/TableExpand.less'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
import JDate from '@/components/jeecg/JDate'
|
import dayjs from 'dayjs'
|
import { postAction } from '../../api/manage'
|
import ProductionLineWarehouseModal from './modules/ProductionLineWarehouseModal.vue'
|
import ProductionLineWarehouseClientList from './ProductionLineWarehouseClientList.vue'
|
export default {
|
name: "WarehouseList",
|
mixins:[JeecgListMixin],
|
components: {
|
ProductionLineWarehouseClientList,
|
ProductionLineWarehouseModal,
|
JEllipsis,
|
JDate,
|
dayjs,
|
},
|
data () {
|
return {
|
description: '仓库管理页面',
|
disableMixinCreated:true,
|
// 表头
|
columns: [
|
{
|
title:'仓库编码',
|
align:"center",
|
dataIndex: 'code',
|
width:200
|
},
|
{
|
title:'仓库名称',
|
align:"center",
|
dataIndex: 'name',
|
ellipsis:true,
|
width:200
|
},
|
{
|
title:'是否虚拟',
|
align:"center",
|
dataIndex: 'status',
|
customRender:function(text){
|
if(text=='1'){
|
return "是";
|
}else{
|
return "否";
|
}
|
},
|
width:200,
|
},
|
{
|
title:'创建人',
|
align:"center",
|
dataIndex: 'createBy',
|
width:200
|
},
|
{
|
title:'创建日期',
|
align:"center",
|
dataIndex: 'createTime',
|
width:200
|
},
|
{
|
title:'更新人',
|
align:"center",
|
dataIndex: 'updateBy',
|
width:200
|
},
|
{
|
title:'更新日期',
|
align:"center",
|
dataIndex: 'updateTime',
|
width:200
|
},
|
{
|
title:'备注',
|
align:"center",
|
dataIndex: 'remark',
|
ellipsis:true,
|
width:250,
|
customRender:function(text){
|
if(text=='null'){
|
return '';
|
}else {
|
return text
|
}
|
|
},
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
align:"center",
|
fixed:"right",
|
width:200,
|
scopedSlots: { customRender: 'action' },
|
}
|
],
|
url: {
|
getVersionList:"/base/productionLineWarehouse/getVersionList",
|
getWarehouseInfo:"/base/productionLineWarehouse/getWarehouseInfo",
|
getUsableWorkShopList:'/base/factoryModel/getUsableWorkShopList',
|
updateVersion: "base/productionLineWarehouse/updateVersion",
|
list: "/base/productionLineWarehouse/list",
|
delete: "/base/productionLineWarehouse/delete",
|
deleteBatch: "/base/productionLineWarehouse/deleteBatch",
|
exportXlsUrl: "/base/productionLineWarehouse/exportXls",
|
importExcelUrl: "base/productionLineWarehouse/importExcel",
|
getNowAndLastUsableVersion:"/base/productionLineWarehouse/getNowAndLastUsableVersion",
|
updateVersionStatusToUsable:"/base/productionLineWarehouse/updateVersionStatusToUsable",
|
updateVersionStatusToUsableBySetTime:"/base/productionLineWarehouse/updateVersionStatusToUsableBySetTime",
|
getVersionStatusByVersion:"/base/productionLineWarehouse/getVersionStatusByVersion",
|
getNewVersionPermission: '/base/productionLineWarehouse/getNewVersionPermission',
|
getUpdateVersionPermission:'/base/productionLineWarehouse/getUpdateVersionPermission',
|
updateVersionForChange:'/base/productionLineWarehouse/updateVersionForChange',
|
},
|
dictOptions:{
|
},
|
workshopList:[],
|
addWorkShopList:[],
|
versionList:[],
|
/* 分页参数 */
|
ipagination:{
|
current: 1,
|
pageSize: 5,
|
pageSizeOptions: ['5', '10', '50'],
|
showTotal: (total, range) => {
|
return range[0] + "-" + range[1] + " 共" + total + "条"
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
selectedMainId:'',
|
superFieldList:[],
|
warehouseClientMainId: '',
|
versionStatusDetail:'',
|
versionStatus:'',
|
warehouseInfo:{},
|
aWorkshopId:'',
|
nowUsableVersion:'',
|
lastUsableVersion:'',
|
updataVersionloading:false,
|
usableLoading:false,
|
visible:false,
|
loading:false,
|
timeLoading:false,
|
dateStr:'',
|
updatePermission:false,
|
updateVersionPermission:true,
|
originVersionLength:0,
|
versionSelectDisabled:false,
|
usablePermission:false,
|
booleanTag:true,
|
}
|
},
|
created() {
|
this.getWorkShopList();
|
this.getVersionList();
|
this.getWorehouseInfo();
|
this.getNowAndLastUsableVersion();
|
this.getInitInfo();
|
},
|
computed: {
|
importExcelUrl: function(){
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
}
|
},
|
methods: {
|
clearWorkshopId(){
|
this.warehouseInfo.workshopId=''
|
},
|
updateVersion(){
|
var that = this;
|
this.$confirm({
|
title:"确认升版操作",
|
content:"数据量较大时,会导致升版时间过长,确认升版吗?",
|
onOk: function () {
|
that.updataVersionloading=true;
|
postAction(that.url.updateVersion,{version:that.warehouseInfo.version}).then(res=>{
|
if(res.success){
|
that.$message.success("升版成功");
|
that.getVersionList();
|
that.getNowAndLastUsableVersion();
|
that.warehouseInfo.version=res.result;
|
}else{
|
that.$message.error("升版出现异常");
|
}
|
}).finally(res=>{
|
that.updataVersionloading=false;
|
that.onClearSelected();
|
})
|
}
|
});
|
|
},
|
handleOk(){
|
this.timeLoading=true;
|
if(dayjs(this.dateStr).isBefore(dayjs().add(10,'minute').format('YYYY-MM-DD HH:mm:ss'))){
|
this.timeLoading=false;
|
this.$message.warning("生效时间至少为当前时间10分钟以后,请重新设置")
|
}else{
|
postAction(this.url.updateVersionStatusToUsableBySetTime,{
|
jobClassName:"org.jeecg.modules.quartz.job.ProductionLineWarehouseSetUsableJob",
|
cronExpression:this.dateStr,
|
parameter:this.warehouseInfo.version,
|
description:"仓库管理数据定时生效",
|
status:"0"
|
}).then(res=>{
|
if(res.success){
|
this.$message.success("定时生效触发成功");
|
this.quartzJobId = res.result.id;
|
console.log(this.quartzJobId);
|
}
|
else{
|
this.$message.error("定时生效出现异常")
|
}
|
}).finally(res=>{
|
this.timeLoading=false;
|
this.visible=false;
|
})
|
}
|
},
|
handleCancel(){
|
this.visible = false;
|
},
|
setTime(){
|
this.visible = true;
|
},
|
updateVersionStatusToUsable(){
|
var that = this;
|
this.$confirm({
|
title:"确认立即生效",
|
content:"数据量较大时,会导致生效时间过长(建议断点生效),确认立即生效吗?",
|
onOk:function(){
|
that.usableLoading=true;
|
postAction(that.url.updateVersionStatusToUsable,{version:that.warehouseInfo.version}).then(res=>{
|
if(res.success){
|
that.$message.success("生效成功");
|
that.loadData(1);
|
this.getNowAndLastUsableVersion();
|
}else{
|
that.$message.error("生效出现异常");
|
}
|
}).finally(res=>{
|
that.usableLoading=false;
|
})
|
}
|
});
|
|
},
|
clickThenSelect(record) {
|
return {
|
on: {
|
click: () => {
|
this.onSelectChange(record.id.split(","), [record]);
|
}
|
}
|
}
|
},
|
onClearSelected() {
|
this.selectedRowKeys = [];
|
this.selectionRows = [];
|
this.selectedMainId='';
|
this.warehouseClientMainId='';
|
},
|
onSelectChange(selectedRowKeys, selectionRows) {
|
if(selectedRowKeys.length==1){
|
this.selectedMainId=selectedRowKeys[0]
|
this.warehouseClientMainId = selectionRows[0]['id']
|
this.aWorkshopId = selectionRows[0]['workshopId']
|
}else{
|
this.selectedMainId=''
|
this.warehouseClientMainId = ''
|
this.aWorkshopId=''
|
}
|
this.selectedRowKeys = selectedRowKeys;
|
this.selectionRows = selectionRows;
|
},
|
getWorkShopList(){
|
getAction(this.url.getUsableWorkShopList).then(res=>{
|
if(res.success){
|
this.workshopList = res.result
|
for(var i=0;i<res.result.length;i++){
|
if(res.result[i].versionStatus=='2'){
|
this.addWorkShopList.push(res.result[i])
|
}
|
}
|
console.log(this.addWorkShopList)
|
}
|
else{
|
this.$message.error(res.message);
|
}
|
})
|
},
|
getWorehouseInfo(){
|
getAction(this.url.getWarehouseInfo).then(res=>{
|
if(res.success){
|
this.warehouseInfo = res.result;
|
}
|
else{
|
this.$message.error(res.message);
|
}
|
})
|
},
|
loadData(arg) {
|
if(!this.url.list){
|
this.$message.error("请设置url.list属性!")
|
return
|
}
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1;
|
}
|
this.onClearSelected();
|
var params = this.getQueryParams();//查询条件
|
this.loading = true;
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
this.dataSource = res.result.records||res.result;
|
if(res.result.records[0]){
|
this.versionStatus = res.result.records[0].versionStatus;
|
this.versionStatusDetail = this.getVersionStatusDetail(this.versionStatus);
|
}
|
else{
|
this.getVersionStatusByVersion();
|
}
|
if(res.result.total)
|
{
|
this.ipagination.total = res.result.total;
|
}else{
|
this.ipagination.total = 0;
|
}
|
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
}else{
|
this.$message.warning(res.message)
|
}
|
}).finally(() => {
|
this.loading = false
|
})
|
},
|
getVersionList(){
|
getAction(this.url.getVersionList).then(res=>{
|
if(res.success){
|
this.versionList = res.result;
|
this.originVersionLength = res.result.length;
|
}
|
else{
|
this.$message.error(res.message);
|
}
|
})
|
},
|
getVersionStatusDetail(data){
|
if(data=='0'){
|
return '编辑'
|
}else if(data=='1'){
|
return '编辑'
|
}else if(data=='2'){
|
return '生效'
|
}else if(data=='3'){
|
return '失效'
|
}else if(data=='3'){
|
return '待生效'
|
}
|
},
|
getVersionStatusByVersion(){
|
getAction(this.url.getVersionStatusByVersion,{version:this.warehouseInfo.version}).then(res=>{
|
if(res.result[0]){
|
this.versionStatus = res.result[0];
|
this.versionStatusDetail = this.getVersionStatusDetail(this.versionStatus);
|
}
|
else{
|
this.versionStatus='1';
|
this.versionStatusDetail='编辑';
|
}
|
})
|
},
|
getNowAndLastUsableVersion(){
|
getAction(this.url.getNowAndLastUsableVersion).then(res=>{
|
if(res.result.usableVersion){
|
this.nowUsableVersion = "V"+res.result.usableVersion+".0";
|
}
|
if(res.result.lastUsableVersion){
|
this.lastUsableVersion = "V"+res.result.lastUsableVersion+".0"
|
}
|
})
|
},
|
getWorkshopOptionStyle(data){
|
if(data=='0'||data=='1'){
|
return {
|
color:"darkOrange !important",
|
}
|
}else if(data=='2'){
|
return {
|
color:"green !important",
|
}
|
}else if(data=='3'){
|
return {
|
color:"red !important",
|
}
|
}else{
|
return {
|
color:"skyblue !important",
|
}
|
}
|
},
|
updateVersionForChange(){
|
var that = this;
|
this.$confirm({
|
title:"确认升版操作",
|
content:"确认因为生效企业变更而进行的升版维护操作吗?",
|
onOk: function () {
|
that.versionSelectDisabled=true;
|
that.updataVersionloading=true;
|
that.usablePermission=true;
|
postAction(that.url.updateVersionForChange).then(res=>{
|
if(res.success){
|
that.$message.success("升版成功");
|
that.versionList.unshift(res.result);
|
that.warehouseInfo.version=res.result;
|
that.updateVersionPermission=false;
|
}else{
|
that.$message.error("升版出现异常");
|
}
|
}).finally(res=>{
|
that.updataVersionloading=false;
|
that.onClearSelected();
|
})
|
}
|
});
|
|
},
|
getInitInfo(){
|
getAction(this.url.getNewVersionPermission).then(res=>{
|
if(res.result==true){
|
this.usablePermission=true;
|
this.booleanTag=true;
|
this.$message.warning("车间生效版本已经变更,请选择生效车间,对线边库进行维护升版操作")
|
}else{
|
this.usablePermission=false;
|
this.booleanTag=false;
|
}
|
})
|
},
|
postAdd(){
|
this.usablePermission=false;
|
this.versionSelectDisabled=false
|
this.originVersionLength=this.versionList.length
|
}
|
},
|
watch:{
|
warehouseInfo:{
|
immediate:true,
|
deep:true,
|
handler(val) {
|
this.queryParam = this.warehouseInfo;
|
this.loadData(1);
|
}
|
},
|
'warehouseInfo.workshopId'(newval,oldval){
|
for(var i=0;i<this.workshopList.length;i++ ){
|
if(this.workshopList[i].id==newval&&this.workshopList[i].versionStatus=='2'){
|
this.updatePermission=true;
|
}else if(this.workshopList[i].id==newval){
|
this.updatePermission=false;
|
}
|
}
|
},
|
'warehouseInfo.version'(val){
|
getAction(this.url.getUpdateVersionPermission,{version:val}).then(res=>{
|
if((res.result==null||res.result.length==0)&&this.versionList.length==this.originVersionLength){
|
this.updateVersionPermission=false;
|
}
|
else{
|
this.booleanTag = false;
|
this.updateVersionPermission=true;
|
}
|
})
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
@import '~@assets/less/common.less'
|
</style>
|