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.
330 lines
11 KiB
330 lines
11 KiB
<template>
|
|
<div class="app-container">
|
|
<div v-show="viewState == 1">
|
|
<button-bar view-title="存放地点" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
|
|
<div class="main-content">
|
|
<div class="searchcon">
|
|
<el-button size="small" class="searchbtn" @click="isSearchShow = !isSearchShow">
|
|
{{ isSearchShow ? '隐藏查询条件' : '显示查询条件' }}
|
|
</el-button>
|
|
<div v-show="isSearchShow" class="search">
|
|
<el-form :inline="true" class="tab-header">
|
|
<el-form-item label="使用组织">
|
|
<el-select v-model="queryParams.params.useOrgSid" placeholder="请选择" filterable clearable class="addinputw">
|
|
<el-option v-for="item in useOrg_list" :key="item.sid" :label="item.name" :value="item.sid"/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="名称">
|
|
<el-input v-model="queryParams.params.warehouseName" placeholder="请输入名称" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="详细地址">
|
|
<el-input v-model="queryParams.params.warehouseAttribute" placeholder="请输入存放地点属性" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="负责人及电话">
|
|
<el-input v-model="queryParams.params.warehouseContract" placeholder="请输入负责人" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="分组">
|
|
<el-select v-model="queryParams.params.warehouseGroupKey" placeholder="请选择" clearable class="addinputw">
|
|
<el-option v-for="item in warehouseGroup_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div class="btn" style="text-align: center;">
|
|
<el-button type="primary" icon="el-icon-search" size="small" @click="dosearch">查询</el-button>
|
|
<el-button type="primary" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--Start 项目列表头部-->
|
|
<div class="listtop">
|
|
<div class="tit">存放地点列表</div>
|
|
<pageye v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" :limit.sync="queryParams.size" class="pagination" @pagination="loadList"/>
|
|
</div>
|
|
<!--End 项目列表头部-->
|
|
<!--Start 项目列表-->
|
|
<div class="">
|
|
<el-table v-loading="tableLoading" :data="dataList" border style="width: 100%" @selection-change="handleSelectionChange">
|
|
<el-table-column width="50" type="selection" align="center"/>
|
|
<el-table-column width="80" label="序号" type="index" :index="indexMethod" align="center"/>
|
|
<el-table-column width="240" prop="gressionCode" label="编码" align="center"/>
|
|
<el-table-column width="200" prop="warehouseName" label="名称" align="center">
|
|
<template slot-scope="scope">
|
|
<span class="bluezi" @click="toInfo(scope.row)">{{ scope.row.warehouseName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column width="240" prop="useOrg" label="使用组织" align="center"/>
|
|
<el-table-column prop="warehouseAttribute" label="详细地址" align="center"/>
|
|
<el-table-column width="200" prop="warehouseContract" label="负责人及电话" align="center"/>
|
|
<el-table-column width="140" prop="warehouseGroupValue" label="分组" align="center"/>
|
|
</el-table>
|
|
</div>
|
|
<!--End 项目列表-->
|
|
<div class="pages">
|
|
<div class="tit"/>
|
|
<!-- 翻页 -->
|
|
<pagination v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" :limit.sync="queryParams.size" class="pagination" @pagination="loadList"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--End 查询和其列表部分-->
|
|
<!--新增修改部分组件-->
|
|
<div-add v-show="viewState == 2 || viewState == 3" ref="divadd" @doback="resetState" @reloadlist="getUseOrg"/>
|
|
<!--详情部分组件-->
|
|
<div-info v-show="viewState == 4" ref="divinfo" @doback="resetState"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from '@/api/anruiscm/scmwarehouse'
|
|
import { getUseOrgByUserSid } from '@/api/cheliang/basevehicle'
|
|
import ButtonBar from '@/components/ButtonBar'
|
|
import Pagination from '@/components/pagination'
|
|
import pageye from '@/components/pagination/pageye'
|
|
import divAdd from './scmwarehouseAdd'
|
|
import divInfo from './scmwarehouseInfo'
|
|
import { typeValues, selectOrgByLevel } from '@/api/cheliang/dictcommons'
|
|
|
|
export default {
|
|
name: 'ScmWarehouseIndex',
|
|
components: {
|
|
ButtonBar,
|
|
Pagination,
|
|
pageye,
|
|
divAdd,
|
|
divInfo
|
|
},
|
|
data() {
|
|
return {
|
|
btndisabled: false,
|
|
viewState: 1, // 1、列表 2、添加 3、修改 4、查看
|
|
isSearchShow: false,
|
|
tableLoading: false,
|
|
dataList: [],
|
|
useOrg_list: [],
|
|
warehouseGroup_list: [],
|
|
useOrg: '', // 使用组织
|
|
useOrgSid: '', // 使用组织sid
|
|
queryParams: {
|
|
current: 1,
|
|
size: 10,
|
|
total: 0,
|
|
params: {
|
|
sids: [], // 用于导出的时候保存已选择SID
|
|
useOrgSid: '', // 使用组织sid
|
|
warehouseName: '', // 名称
|
|
warehouseAttribute: '', // 存放地点属性
|
|
warehouseContract: '', // 存放地点负责人
|
|
warehouseGroup: '' // 分组
|
|
}
|
|
},
|
|
btnList: [
|
|
{
|
|
type: 'primary',
|
|
size: 'small',
|
|
icon: 'plus',
|
|
btnKey: 'toAdd',
|
|
btnLabel: '新增'
|
|
},
|
|
{
|
|
type: 'primary',
|
|
size: 'small',
|
|
icon: 'edit',
|
|
btnKey: 'toEdit',
|
|
btnLabel: '编辑'
|
|
},
|
|
{
|
|
type: 'danger',
|
|
size: 'small',
|
|
icon: 'del',
|
|
btnKey: 'doDel',
|
|
btnLabel: '删除'
|
|
},
|
|
{
|
|
type: 'info',
|
|
size: 'small',
|
|
icon: 'cross',
|
|
btnKey: 'doClose',
|
|
btnLabel: '关闭'
|
|
}
|
|
],
|
|
multipleSelection: []
|
|
}
|
|
},
|
|
created() {
|
|
this.getType()
|
|
this.getUseOrg()
|
|
this.getListOrgAll()
|
|
},
|
|
mounted() {
|
|
this.$refs['btnbar'].setButtonList(this.btnList)
|
|
},
|
|
methods: {
|
|
resetState() {
|
|
this.viewState = 1
|
|
},
|
|
btnHandle(btnKey) {
|
|
console.log('XXXXXXXXXXXXXXX ' + btnKey)
|
|
switch (btnKey) {
|
|
case 'toAdd':
|
|
this.toAdd()
|
|
break
|
|
case 'toEdit':
|
|
this.toEdit()
|
|
break
|
|
case 'doDel':
|
|
this.doDel()
|
|
break
|
|
case 'doClose':
|
|
this.doClose()
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
},
|
|
toAdd(row) {
|
|
this.viewState = 2
|
|
this.$refs['divadd'].showAdd()
|
|
},
|
|
toEdit() {
|
|
if (this.multipleSelection.length === 0) {
|
|
this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行编辑' })
|
|
return
|
|
}
|
|
if (this.multipleSelection.length > 1) {
|
|
this.$message({ showClose: true, type: 'error', message: '只能选择一条记录进行编辑' })
|
|
return
|
|
}
|
|
this.viewState = 3
|
|
const row = this.multipleSelection[0]
|
|
this.$refs['divadd'].showEdit(row)
|
|
},
|
|
doDel(row) {
|
|
if (this.multipleSelection.length === 0) {
|
|
this.$message({showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作'})
|
|
return
|
|
}
|
|
const sids = []
|
|
this.multipleSelection.forEach(row => {
|
|
sids.push(row.sid)
|
|
})
|
|
const tip = '请确认是否删除所选 ' + this.multipleSelection.length + ' 条记录?'
|
|
this.$confirm(tip, '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: 'Loading',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
})
|
|
req.delBySids(sids).then(resp => {
|
|
loading.close()
|
|
this.$message({ type: 'success', message: resp.msg, showClose: true })
|
|
this.loadList()
|
|
}).catch(e => {
|
|
loading.close()
|
|
})
|
|
}).catch(() => {
|
|
})
|
|
},
|
|
toInfo(row) {
|
|
this.$refs['divinfo'].showInfo(row)
|
|
console.log('详情回显', row)
|
|
this.viewState = 4
|
|
},
|
|
dosearch() {
|
|
this.queryParams.current = 1
|
|
this.loadList()
|
|
},
|
|
resetQuery() {
|
|
this.queryParams.params = {
|
|
sids: [], // 用于导出的时候保存已选择SID
|
|
useOrg: this.useOrg,
|
|
useOrgSid: this.useOrgSid,
|
|
warehouseName: '', // 名称
|
|
warehouseAttribute: '', // 存放地点属性
|
|
warehouseContract: '', // 存放地点负责人
|
|
warehouseGroup: '' // 分组
|
|
}
|
|
this.queryParams.params.sid = '' // sid
|
|
this.queryParams.params.name = '' // 登录名
|
|
this.dosearch()
|
|
},
|
|
loadList() {
|
|
const _this = this
|
|
this.tableLoading = true
|
|
req.listPage(this.queryParams).then(resp => {
|
|
_this.tableLoading = false
|
|
const data = resp.data
|
|
_this.queryParams.total = data.total
|
|
_this.dataList = data.records
|
|
}).catch(() => {
|
|
_this.tableLoading = false
|
|
})
|
|
},
|
|
handleSelectionChange(val) {
|
|
this.multipleSelection = val
|
|
console.log('点击数据', this.multipleSelection)
|
|
},
|
|
getType() {
|
|
typeValues({ type: 'locationGroup' }).then((res) => {
|
|
if (res.success) {
|
|
this.warehouseGroup_list = res.data
|
|
}
|
|
})
|
|
},
|
|
// 根据个人sid查询个人分公司
|
|
getUseOrg() {
|
|
const userSid = window.sessionStorage.getItem('userSid')
|
|
getUseOrgByUserSid({ userSid: userSid }).then((res) => {
|
|
if (res.success) {
|
|
this.useOrg = res.data.name // 使用组织
|
|
this.useOrgSid = res.data.sid // 使用组织sid
|
|
this.queryParams.params.useOrgSid = res.data.sid
|
|
this.loadList()
|
|
}
|
|
})
|
|
},
|
|
// 查询所有的分公司
|
|
getListOrgAll() {
|
|
selectOrgByLevel({ orgSidPath: window.sessionStorage.getItem('orgSidPath') }).then((res) => {
|
|
if (res.success) {
|
|
this.useOrg_list = res.data
|
|
}
|
|
})
|
|
},
|
|
// 序号
|
|
indexMethod(index) {
|
|
var pagestart = (this.queryParams.current - 1) * this.queryParams.size
|
|
var pageindex = index + 1 + pagestart
|
|
return pageindex
|
|
},
|
|
doClose() {
|
|
this.$store.dispatch('tagsView/delView', this.$route)
|
|
this.$router.go(-1)
|
|
}
|
|
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
/deep/ .el-collapse {
|
|
border-top: 0 solid #e6ebf5;
|
|
border-bottom: 0 solid #e6ebf5;
|
|
}
|
|
|
|
/deep/ .el-collapse-item__content {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
/deep/ .el-collapse-item__wrap {
|
|
border-bottom: 0 solid #ebeef5;
|
|
}
|
|
|
|
/deep/ .el-collapse-item__header {
|
|
border-bottom: 0 solid #e6ebf5;
|
|
}
|
|
</style>
|
|
|