You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
4.8 KiB

<template>
<div>
<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.huojiamingcheng" style="width: 200px;margin-right: 10px;" placeholder="名称搜索" />
<Select @on-change="clearType" v-model="select.storage_id" style="width: 200px;margin-right: 10px;" placeholder="所在区域" clearable>
<Option v-for="item in StorageList" :key="item.id" :value="item.id">{{ item.cangkumingcheng }}</Option>
</Select>
<Button type="primary" @click="select.page=1,getList()">查询</Button>
<Button type="primary" style="margin-left: 10px;" @click="$refs['addShelf'].type='add',
$refs['addShelf'].StorageList = StorageList,
$refs['addShelf'].isShow=true">添加</Button>
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['imports'].show()">导入</Button> -->
</div>
</slot>
</lx-header>
</div>
<xy-table :list="list" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange"
:table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" align="center" width="120" header-align="center">
<template slot-scope="scope">
<div>
<Button type="primary" size="small" @click="$refs['addShelf'].type='editor',
$refs['addShelf'].id=scope.row.id,$refs['addShelf'].StorageList = StorageList,
$refs['addShelf'].isShow=true">编辑</Button>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="delRow(scope.row.id)">
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<addShelf ref="addShelf" @refresh="getList"></addShelf>
</div>
</template>
<script>
import {
index,
destroy
} from "@/api/system/baseForm.js"
import { getStorehouseStorageList } from '@/api/system/storehouseType'
import addShelf from './components/addShelf.vue'
import {
getparameteritem
} from "@/api/system/dictionary.js"
export default {
components: {
addShelf,
},
data() {
return {
select: {
page: 1,
page_size: 10,
huojiamingcheng: '',
table_name: 'shelfs',
storage_id:''
},
total: 0,
list: [],
StorageList:[],
table: [{
label: '序号',
type: 'index',
fixed: 'left',
width: 80,
}, {
label: '所属仓库',
prop: 'storage_id_materialstorages_id_relation.cangkumingcheng',
align: 'left',
fixed: 'left'
}, {
label: '货架名称',
prop: 'huojiamingcheng',
// width: 120,
}, {
label: '创建日期',
prop: 'created_at',
width: 120,
formatter: (cell, data, value) => {
return value ? value.substring(0, 10) : ''
}
}],
}
},
created() {
this.getStorageList()
this.getList()
},
methods: {
clearType(e){
if(e){
this.select.storage_id = e
}else{
this.select.storage_id = ''
}
},
async getStorageList() {
const res = await index({
page:1,
page_size:999,
table_name:'materialstorages'
});
this.StorageList = res.data
console.log("this.StorageList",this.StorageList)
},
async getList() {
const res = await index({
...this.select,
filter: [{
key:'huojiamingcheng',
op:'like',
value:this.select.huojiamingcheng
},{
key:'storage_id',
op:'eq',
value:this.select.storage_id
}],
})
this.list = res.data
this.total = res.total
},
pageChange(e) {
this.select.page = e
this.getList()
},
pageSizeChange(e){
this.select.page_size = e
this.getList()
},
delRow(id) {
if (id) {
destroy({
id: id,
table_name: this.select.table_name,
}).then(res => {
this.$message({
type: 'success',
message: '删除成功'
})
this.getList()
})
}
},
}
}
</script>
<style>
</style>