<template>
|
<a-card :bordered="false">
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col
|
:md="5"
|
:sm="8"
|
>
|
<a-form-item label="仓库名称">
|
<a-input
|
placeholder="请输入仓库名称"
|
v-model="queryParam.warehouseName"
|
></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:md="7"
|
:sm="8"
|
>
|
<a-form-item label="开始时间">
|
<a-date-picker
|
show-time
|
placeholder="请选择开始时间"
|
format="YYYY-MM-DD HH:mm"
|
valueFormat="YYYY-MM-DD HH:mm"
|
v-model="queryParam.beginTime"
|
></a-date-picker>
|
<!-- :triggerChange="false" -->
|
</a-form-item>
|
</a-col>
|
<a-col
|
:md="7"
|
:sm="8"
|
>
|
<a-form-item label="结束时间">
|
<a-date-picker
|
show-time
|
placeholder="请选择结束时间"
|
format="YYYY-MM-DD HH:mm"
|
valueFormat="YYYY-MM-DD HH:mm"
|
v-model="queryParam.endTime"
|
></a-date-picker>
|
<!-- :triggerChange="false" -->
|
</a-form-item>
|
</a-col>
|
|
|
<a-col :md="4" :sm="4">
|
<a-space>
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
|
</a-space>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
<!-- 查询区域-END -->
|
|
<!-- 操作按钮区域 -->
|
<div class="table-operator">
|
<a-button @click="handleAdd" :disabled="addFlag" type="primary" icon="plus">新增</a-button>
|
<!-- <a-button type="primary" icon="download" @click="handleExportXls('tms_warehouse')">导出</a-button>-->
|
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
|
<!-- <a-button type="primary" icon="import">导入</a-button>-->
|
<!-- </a-upload>-->
|
<!-- 高级查询区域 -->
|
<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
|
<!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
|
<!-- <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>-->
|
</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"
|
:scroll="{x:true}"
|
bordered
|
rowKey="id"
|
:columns="columns"
|
:dataSource="dataSource"
|
:pagination="ipagination"
|
:loading="loading"
|
:rowSelection="null"
|
class="j-table-force-nowrap"
|
@change="handleTableChange">
|
|
<span slot="status" slot-scope="text, record">
|
<span v-if="text === '1'" class='enable'>启用</span>
|
<span v-if="text === '2'" class='disable'>停用</span>
|
</span>
|
|
<span slot="action" slot-scope="text, record">
|
<a @click="handleDetail(record)">详情</a>
|
|
<a-divider type="vertical" />
|
<a-dropdown>
|
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
<a-menu slot="overlay">
|
<a-menu-item>
|
<a @click="handleEdit(record)">编辑</a>
|
</a-menu-item>
|
<a-menu-item v-if="record.status === '1'">
|
<a-popconfirm title="确定停用吗?" @confirm="() => handleStatus(record)">
|
<a>停用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<a-menu-item v-if="record.status === '2'">
|
<a-popconfirm title="确定启用吗?" @confirm="() => handleStatus(record)">
|
<a>启用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<a-menu-item>
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
<a>删除</a>
|
</a-popconfirm>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</span>
|
|
</a-table>
|
</div>
|
|
<warehouse-modal ref="modalForm" :treeSelected="treeSelected" @ok="modalFormOk"></warehouse-modal>
|
</a-card>
|
</template>
|
|
<script>
|
|
import '@/assets/less/TableExpand.less'
|
import { mixinDevice } from '@/utils/mixin'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import WarehouseModal from './modules/WarehouseModal'
|
import { getAction, putAction, deleteAction } from '../../api/manage'
|
|
export default {
|
name: 'WarehouseList',
|
mixins:[JeecgListMixin, mixinDevice],
|
components: {
|
WarehouseModal
|
},
|
data () {
|
return {
|
description: '仓库管理',
|
// 表头
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key:'rowIndex',
|
width:60,
|
align:"center",
|
customRender:function (t,r,index) {
|
return parseInt(index)+1;
|
}
|
},
|
{
|
title:'仓库编号',
|
align:"center",
|
dataIndex: 'warehouseId'
|
},
|
{
|
title:'仓库名称',
|
align:"center",
|
dataIndex: 'warehouseName'
|
},
|
{
|
title:'父节点编号',
|
align:"center",
|
dataIndex: 'parentWarehouseId',
|
customRender:function (text,r) {
|
if (r.parentId === '-1') {
|
return '-1';
|
} else {
|
return text;
|
}
|
}
|
},
|
{
|
title:'父节点名称',
|
align:"center",
|
dataIndex: 'parentWarehouseName',
|
customRender:function (text,r) {
|
if (r.parentId === '-1') {
|
return '航宇救生';
|
} else {
|
return text;
|
}
|
}
|
},
|
{
|
title:'状态',
|
align:"center",
|
dataIndex: 'status',
|
scopedSlots: { customRender: 'status' }
|
},
|
{
|
title:'备注',
|
align:"center",
|
dataIndex: 'remark'
|
},
|
{
|
title:'创建人',
|
align:"center",
|
dataIndex: 'createBy'
|
},
|
{
|
title:'创建时间',
|
align:"center",
|
dataIndex: 'createTime'
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
align:"center",
|
fixed:"right",
|
width:147,
|
scopedSlots: { customRender: 'action' }
|
}
|
],
|
url: {
|
list: "/tms/warehouse/list",
|
delete: "/tms/warehouse/delete",
|
edit: "/tms/warehouse/edit",
|
deleteBatch: "/tms/warehouse/deleteBatch",
|
exportXlsUrl: "/tms/warehouse/exportXls",
|
importExcelUrl: "tms/warehouse/importExcel",
|
|
},
|
dictOptions:{},
|
superFieldList:[],
|
treeSelected: {},
|
}
|
},
|
created() {
|
this.getSuperFieldList();
|
},
|
computed: {
|
importExcelUrl: function(){
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
},
|
addFlag: function(){
|
return !(this.treeSelected.key && this.treeSelected.entity.leafFlag === '2');
|
}
|
},
|
mounted() {
|
this.handleGetCurrSelected = (data) => {
|
this.treeSelected = data;
|
this.queryParam.parentId = data.key;
|
this.loadData();
|
}
|
this.$bus.$on('getCurrSelected', this.handleGetCurrSelected);
|
},
|
beforeDestroy() {
|
this.$bus.$off('getCurrSelected', this.handleGetCurrSelected);
|
},
|
methods: {
|
handleAdd: function () {
|
const nextSeq = Number(this.dataSource[this.dataSource.length - 1].seq) + 1
|
this.$refs.modalForm.add(nextSeq);
|
this.$refs.modalForm.title = "新增";
|
this.$refs.modalForm.disableSubmit = false;
|
},
|
handleStatus(record) {
|
getAction(this.url.list, { parentId: record.id }).then((res) => {
|
if (res.success) {
|
if (res.result.total > 0) {
|
this.$message.warning('该节点下存在子节点,不能变更状态!')
|
} else {
|
const params = {
|
id: record.id,
|
status: record.status === '1' ? '2' : '1'
|
}
|
putAction(this.url.edit, params).then((res) => {
|
if (res.success) {
|
this.$message.success(res.message)
|
this.loadData()
|
} else {
|
this.$message.warning(res.message)
|
}
|
})
|
}
|
} else {
|
this.$message.warning(res.message);
|
}
|
});
|
|
},
|
handleDelete(id) {
|
getAction(this.url.list, { parentId: id }).then((res) => {
|
if (res.success) {
|
if (res.result.total > 0) {
|
this.$message.warning('请先删除子节点');
|
} else {
|
deleteAction(this.url.delete, {id: id}).then((res) => {
|
if (res.success) {
|
//重新计算分页问题
|
this.loadData()
|
this.$message.success(res.message);
|
this.$bus.$emit('queryTreeData')
|
} else {
|
this.$message.warning(res.message);
|
}
|
});
|
}
|
} else {
|
this.$message.warning(res.message);
|
}
|
})
|
},
|
searchReset() {
|
this.queryParam = {
|
parentId: this.treeSelected.key
|
}
|
this.loadData(1)
|
},
|
modalFormOk() {
|
this.loadData()
|
this.$bus.$emit('queryTreeData')
|
},
|
initDictConfig(){
|
},
|
getSuperFieldList(){
|
let fieldList=[];
|
fieldList.push({type:'string',value:'warehouseId',text:'仓库编号',dictCode:''})
|
fieldList.push({type:'string',value:'warehouseName',text:'仓库名称',dictCode:''})
|
fieldList.push({type:'string',value:'parentId',text:'父节点编号',dictCode:''})
|
fieldList.push({type:'string',value:'seq',text:'展示序号',dictCode:''})
|
fieldList.push({type:'string',value:'leafFlag',text:'是否叶子节点(1是;2否)',dictCode:''})
|
fieldList.push({type:'string',value:'status',text:'状态(1启用;2停用)',dictCode:''})
|
fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
|
fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''})
|
fieldList.push({type:'date',value:'createTime',text:'创建时间'})
|
this.superFieldList = fieldList
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
@import '~@assets/less/common.less';
|
.enable {
|
color: green;
|
}
|
.disable {
|
color: red;
|
}
|
</style>
|