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.
228 lines
7.0 KiB
228 lines
7.0 KiB
<template>
|
|
<div class="app-container">
|
|
<div v-show="viewState == 1">
|
|
<button-bar ref="btnbar" view-title="项目行业维护" :btndisabled="btndisabled" @btnhandle="btnHandle" />
|
|
<div class="main-content">
|
|
<div class="searchcon">
|
|
<el-button size="small" class="searchbtn" @click="clicksearchShow">
|
|
{{ searchxianshitit }}
|
|
</el-button>
|
|
<div v-show="isSearchShow" class="search">
|
|
<el-form :inline="true" class="tab-header">
|
|
<el-form-item label="项目行业名称">
|
|
<el-input v-model="queryParams.params.industryName" placeholder="" clearable />
|
|
</el-form-item>
|
|
</el-form>
|
|
<div class="btn" style="text-align: center;">
|
|
<el-button type="primary" size="small" icon="el-icon-search" @click="dosearch">查询</el-button>
|
|
<el-button type="primary" size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Start 项目列表头部 -->
|
|
<div class="listtop">
|
|
<div class="tit">项目行业列表</div>
|
|
</div>
|
|
<!-- End 项目列表头部 -->
|
|
<!-- Start 项目列表 -->
|
|
<div class="">
|
|
<el-table v-loading="tableLoading" :data="dataList" border style="width: 100%"
|
|
@selection-change="handleSelectionChange">
|
|
<!-- <el-table-column fixed width="50" type="selection" align="center" /> -->
|
|
<el-table-column fixed width="80" label="序号" type="index" :index="indexMethod" align="center" />
|
|
<el-table-column label="操作" align="center" width="180">
|
|
<template slot-scope="scope">
|
|
<el-button type="primary" size="mini" @click="toRelevancy(scope.row)">编辑</el-button>
|
|
<el-button type="primary" size="mini" @click="toRelevancyInfo(scope.row)">删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="industryName" label="项目行业名称" align="center" />
|
|
<el-table-column prop="remarks" 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 查询和其列表部分 -->
|
|
<!-- 新增修改部分组件 -->
|
|
<divAdd v-show="viewState == 2 || viewState == 3" ref="divadd" @doback="resetState" @reloadlist="loadList" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from '@/api/dataDict/dataDict'
|
|
import ButtonBar from '@/components/ButtonBar'
|
|
import Pagination from '@/components/pagination'
|
|
import pageye from '@/components/pagination/pageye'
|
|
import divAdd from './industryAdd'
|
|
export default {
|
|
name: 'SupplierBankInfoIndex',
|
|
components: {
|
|
ButtonBar,
|
|
Pagination,
|
|
pageye,
|
|
divAdd
|
|
},
|
|
data() {
|
|
return {
|
|
btndisabled: false,
|
|
viewState: 1, // 1、列表 2、添加 3、修改 4、查看
|
|
isSearchShow: false,
|
|
searchxianshitit: '显示查询条件',
|
|
tableLoading: false,
|
|
dataList: [],
|
|
btnList: [{
|
|
type: 'primary',
|
|
size: 'small',
|
|
icon: 'plus',
|
|
btnKey: 'toAdd',
|
|
btnLabel: '新增'
|
|
},
|
|
{
|
|
type: 'info',
|
|
size: 'small',
|
|
icon: 'cross',
|
|
btnKey: 'doClose',
|
|
btnLabel: '关闭'
|
|
}
|
|
],
|
|
queryParams: {
|
|
current: 1,
|
|
size: 10,
|
|
total: 0,
|
|
params: {
|
|
industryName: '',
|
|
}
|
|
},
|
|
sids: []
|
|
}
|
|
},
|
|
mounted() {
|
|
this.$refs['btnbar'].setButtonList(this.btnList)
|
|
},
|
|
created() {
|
|
this.loadList()
|
|
},
|
|
methods: {
|
|
// 搜索条件效果
|
|
clicksearchShow() {
|
|
this.isSearchShow = !this.isSearchShow
|
|
if (this.isSearchShow) {
|
|
this.searchxianshitit = '隐藏查询条件'
|
|
} else {
|
|
this.searchxianshitit = '显示查询条件'
|
|
}
|
|
},
|
|
btnHandle(btnKey) {
|
|
switch (btnKey) {
|
|
case 'toAdd':
|
|
this.toAdd()
|
|
break
|
|
case 'doClose':
|
|
this.doClose()
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
},
|
|
loadList() {
|
|
this.tableLoading = true
|
|
req.industryListPage(this.queryParams).then((resp) => {
|
|
this.tableLoading = false
|
|
if (resp.success) {
|
|
const data = resp.data
|
|
this.queryParams.total = data.total
|
|
this.dataList = data.records
|
|
} else {
|
|
// 根据resp.code进行异常情况处理
|
|
this.dataList = []
|
|
this.queryParams.total = 0
|
|
}
|
|
}).catch(() => {
|
|
this.tableLoading = false
|
|
})
|
|
},
|
|
handleSelectionChange(row) {
|
|
const aa = []
|
|
row.forEach((element) => {
|
|
aa.push(element.sid)
|
|
})
|
|
this.sids = aa
|
|
},
|
|
// 序号
|
|
indexMethod(index) {
|
|
var pagestart = (this.queryParams.current - 1) * this.queryParams.size
|
|
var pageindex = index + 1 + pagestart
|
|
return pageindex
|
|
},
|
|
dosearch() {
|
|
this.queryParams.current = 1
|
|
this.loadList()
|
|
},
|
|
resetQuery() {
|
|
this.queryParams = {
|
|
current: 1,
|
|
size: 10,
|
|
total: 0,
|
|
params: {
|
|
code: '',
|
|
name: '',
|
|
}
|
|
}
|
|
this.loadList()
|
|
},
|
|
toAdd() {
|
|
this.viewState = 2
|
|
this.$refs['divadd'].showAdd()
|
|
},
|
|
|
|
toRelevancy(row) {
|
|
this.viewState = 3
|
|
this.$refs['divadd'].showEdit(row)
|
|
},
|
|
toRelevancyInfo(row) {
|
|
|
|
const tip = '请确认是否删除所选记录?'
|
|
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.industryDelBySids(row.sid).then((resp) => {
|
|
loading.close()
|
|
if (resp.success) {
|
|
this.$message({
|
|
type: 'success',
|
|
message: resp.msg,
|
|
showClose: true
|
|
})
|
|
this.loadList()
|
|
} else {
|
|
// 根据resp.code进行异常情况处理
|
|
}
|
|
}).catch(e => {
|
|
loading.close()
|
|
})
|
|
}).catch(() => {})
|
|
},
|
|
resetState() {
|
|
this.viewState = 1
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
</style>
|
|
|