|
|
|
@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<div class="table-page-container">
|
|
|
|
|
|
|
|
<div ref="lxHeader">
|
|
|
|
|
|
|
|
<lx-header icon="md-apps" text="仓库类型" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
|
|
|
|
|
|
|
<slot>
|
|
|
|
|
|
|
|
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
|
|
|
|
|
|
|
|
<Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="仓库类型" />
|
|
|
|
|
|
|
|
<Button type="primary" @click="getTypeList">查询</Button>
|
|
|
|
|
|
|
|
<Button type="primary" style="margin-left: 10px;" @click="$refs.addType.open('add')">添加</Button>
|
|
|
|
|
|
|
|
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
|
|
|
|
|
|
|
|
@click="$refs['imports'].show()">导入</Button> -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</slot>
|
|
|
|
|
|
|
|
</lx-header>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="table-flex-content">
|
|
|
|
|
|
|
|
<xy-table :list="list" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange"
|
|
|
|
|
|
|
|
:table-item="table" size="medium" :height="tableHeight" style="border-radius: 10px; overflow: hidden; box-shadow: 0 2px 12px 0 rgba(0,0,0,0.08); width: 100%;">
|
|
|
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
|
|
|
<el-table-column label="操作" align="center" min-width="140" header-align="center" class-name="table-col-action">
|
|
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
|
|
<div style="display: flex; gap: 8px; justify-content: center;">
|
|
|
|
|
|
|
|
<Button type="primary" size="small" style="border-radius: 6px;" @click="$refs.addType.open('editor', scope.row)">编辑</Button>
|
|
|
|
|
|
|
|
<Button type="primary" style="margin-left: 0; border-radius: 6px;" size="small" ghost @click="delRow(scope.row.id)">删除</Button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</xy-table>
|
|
|
|
|
|
|
|
<addType ref="addType" @refresh="getTypeList"></addType>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
|
|
destroy
|
|
|
|
|
|
|
|
} from "@/api/system/baseForm.js"
|
|
|
|
|
|
|
|
import { getStorehouseTypeList } from '@/api/system/storehouseType'
|
|
|
|
|
|
|
|
import addType from './components/addType.vue'
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
|
|
getparameteritem
|
|
|
|
|
|
|
|
} from "@/api/system/dictionary.js"
|
|
|
|
|
|
|
|
import { destroyStorehouseType } from '@/api/system/storehouseType'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
|
|
components: {
|
|
|
|
|
|
|
|
addType,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
select: {
|
|
|
|
|
|
|
|
page: 1,
|
|
|
|
|
|
|
|
page_size: 10,
|
|
|
|
|
|
|
|
keyword: '',
|
|
|
|
|
|
|
|
table_name: 'materialstorages',
|
|
|
|
|
|
|
|
area:''
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
areaList:[],
|
|
|
|
|
|
|
|
total: 0,
|
|
|
|
|
|
|
|
list: [],
|
|
|
|
|
|
|
|
table: [{
|
|
|
|
|
|
|
|
label: '序号',
|
|
|
|
|
|
|
|
type: 'index',
|
|
|
|
|
|
|
|
width: 60,
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
label: '仓库类型',
|
|
|
|
|
|
|
|
prop: 'name',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minWidth: 180
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
label: '排序编号',
|
|
|
|
|
|
|
|
prop: 'sort',
|
|
|
|
|
|
|
|
minWidth: 120,
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
label: '备注',
|
|
|
|
|
|
|
|
prop: 'remark',
|
|
|
|
|
|
|
|
minWidth: 200,
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
label: '创建日期',
|
|
|
|
|
|
|
|
prop: 'created_at',
|
|
|
|
|
|
|
|
minWidth: 120,
|
|
|
|
|
|
|
|
formatter: (cell, data, value) => {
|
|
|
|
|
|
|
|
return value ? value.substring(0, 10) : ''
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}],
|
|
|
|
|
|
|
|
tableHeight: 550 // 默认高度
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
|
|
|
|
this.getTypeList()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
this.calcTableHeight();
|
|
|
|
|
|
|
|
window.addEventListener('resize', this.calcTableHeight);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
|
|
|
window.removeEventListener('resize', this.calcTableHeight);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
async getTypeList() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
|
|
|
formData.append('page', this.select.page);
|
|
|
|
|
|
|
|
formData.append('page_size', this.select.page_size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果有搜索关键词,添加模糊匹配条件
|
|
|
|
|
|
|
|
if (this.select.keyword) {
|
|
|
|
|
|
|
|
formData.append('filter[0][key]', 'name');
|
|
|
|
|
|
|
|
formData.append('filter[0][op]', 'like');
|
|
|
|
|
|
|
|
formData.append('filter[0][value]', this.select.keyword);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const res = await getStorehouseTypeList(formData);
|
|
|
|
|
|
|
|
this.list = res.data;
|
|
|
|
|
|
|
|
this.total = res.total;
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
this.$message.error('获取仓库类型列表失败');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
pageChange(e) {
|
|
|
|
|
|
|
|
this.select.page = e
|
|
|
|
|
|
|
|
this.getTypeList()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
pageSizeChange(e){
|
|
|
|
|
|
|
|
this.select.page_size = e
|
|
|
|
|
|
|
|
this.getTypeList()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
delRow(id) {
|
|
|
|
|
|
|
|
if (id) {
|
|
|
|
|
|
|
|
this.$confirm('确认要删除该仓库类型吗?', '提示', {
|
|
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
|
|
}).then(async () => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
await destroyStorehouseType(id);
|
|
|
|
|
|
|
|
this.$message.success('删除成功');
|
|
|
|
|
|
|
|
this.getTypeList();
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
this.$message.error('删除失败');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
calcTableHeight() {
|
|
|
|
|
|
|
|
const header = this.$refs.lxHeader ? this.$refs.lxHeader.offsetHeight : 0;
|
|
|
|
|
|
|
|
const windowHeight = window.innerHeight;
|
|
|
|
|
|
|
|
const minTableHeight = 600; // 至少能展示一页数据
|
|
|
|
|
|
|
|
this.tableHeight = Math.max(windowHeight - header - 100, minTableHeight);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
.table-page-container {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
height: 100vh;
|
|
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
background: #f5f7fa;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.table-flex-content {
|
|
|
|
|
|
|
|
flex: 1 1 0;
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-table th {
|
|
|
|
|
|
|
|
background: #f5f7fa !important;
|
|
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-table td {
|
|
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
height: 48px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-table {
|
|
|
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 让操作列自动填充剩余空间 */
|
|
|
|
|
|
|
|
.table-col-action {
|
|
|
|
|
|
|
|
flex: 1 !important;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|