<template>
|
<div class="page">
|
<div class="page-title">
|
<div>
|
<h2>承修单位管理</h2>
|
<p>数据来源:组织机构部门表(DEPT_TYPE = cj)</p>
|
</div>
|
<el-button icon="el-icon-refresh" @click="load">刷新</el-button>
|
</div>
|
|
<div class="toolbar">
|
<el-input
|
v-model="keyword"
|
placeholder="名称 / 部门编码 / 负责人"
|
clearable
|
style="width:280px"
|
@keyup.enter.native="load"
|
></el-input>
|
<el-button type="primary" icon="el-icon-search" @click="load">查询</el-button>
|
<div class="spacer"></div>
|
<span class="summary">共 {{ filteredRows.length }} 个承修单位</span>
|
</div>
|
|
<div class="table-panel">
|
<el-table
|
v-loading="loading"
|
:data="filteredRows"
|
border
|
stripe
|
height="calc(100vh - 245px)"
|
>
|
<el-table-column prop="sortNo" label="排序" width="80" align="center"></el-table-column>
|
<el-table-column label="常用" width="80" align="center">
|
<template slot-scope="{ $index }">
|
<el-tag v-if="$index < 7" size="mini" type="success">前7</el-tag>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="name" label="名称" min-width="240" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="deptCode" label="部门编码" width="160"></el-table-column>
|
<el-table-column prop="contact" label="负责人" width="120"></el-table-column>
|
<el-table-column prop="phone" label="联系电话" width="160"></el-table-column>
|
<el-table-column label="状态" width="100" align="center">
|
<template slot-scope="{ row }">
|
<el-tag size="mini" :type="row.status === '1' ? 'info' : 'success'">
|
{{ row.status === '1' ? '停用' : '正常' }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
</template>
|
<script>
|
import api from '@/api'
|
export default {
|
name: 'ContractorManage',
|
data() {
|
return {
|
loading: false,
|
rows: [],
|
keyword: ''
|
}
|
},
|
computed: {
|
filteredRows() {
|
const keyword = this.keyword.trim().toLowerCase()
|
if (!keyword) return this.rows
|
return this.rows.filter(item => [item.name, item.deptCode, item.contact]
|
.some(value => String(value || '').toLowerCase().includes(keyword)))
|
}
|
},
|
created() {
|
this.load()
|
},
|
methods: {
|
load() {
|
this.loading = true
|
api.get('/system/contractors').then(res => {
|
this.rows = res.data || []
|
}).finally(() => {
|
this.loading = false
|
})
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
.summary {
|
color: #6d7f91;
|
font-size: 13px;
|
}
|
</style>
|