cnas/client/src/views/accessment/index.vue

186 lines
5.7 KiB
Python

<template>
<div class="app-container">
<el-row :gutter="6">
<el-col :xs="24" :md="4">
<treeselect
v-model="listQuery.user__dept"
:multiple="false"
:options="deptOptions"
placeholder="所属组织"
:disable-branch-nodes="true"
@input="handleFilter"
style="width: 100%" clearable/>
</el-col>
<el-col :xs="24" :md="4">
<el-input
v-model="listQuery.search"
placeholder="姓名/易记码/编号/注册领域"
style="width: 100%"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
</el-col>
<el-col :xs="24" :md="4">
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新</el-button>
</el-col>
</el-row>
<el-table
v-loading="listLoading"
:data="tableData.results"
style="width: 100%;margin-top:10px;"
border
fit
stripe
highlight-current-row
>
<el-table-column type="index" width="50" />
<el-table-column label="申请单号">
<template slot-scope="scope" v-if="scope.row.number">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="认证领域/分类">
<template slot-scope="scope">
<el-tag >{{scope.row.cert_field_.name}}</el-tag>
<el-tag v-if="scope.row.cccpv_class_" type="warning" style="margin:2px">{{scope.row.cccpv_class_.name}}</el-tag>
</template>
</el-table-column>
<el-table-column label="申请信息" width="300px">
<template slot-scope="scope">
<div><span style="color:darkblue;font-weight:bold">申请方</span>:{{ scope.row.applicant_v.name }}</div>
<div v-if="scope.row.manufacture"><span style="color:darkblue;font-weight:bold">制造商</span>:{{ scope.row.manufacture_v.name }}</div>
<div v-if="scope.row.factory"><span style="color:darkblue;font-weight:bold">生产厂</span>:{{ scope.row.factory_v.name }}</div>
</template>
</el-table-column>
<el-table-column label="当前状态">
<template slot-scope="scope">
{{ scope.row.status}}
</template>
</el-table-column>
<el-table-column label="创建人">
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
</el-table-column>
<el-table-column label="创建日期">
<template slot-scope="scope">
<span>{{ scope.row.create_time }}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right">
<template slot-scope="scope" >
<el-button
type="primary"
size="small"
:disabled="!checkPermission(['certapp_accessment'])"
@click="handleAccessment(scope)"
>评定</el-button>
<el-button
size="small"
:disabled="!checkPermission(['certapp_detail'])"
@click="handleCertappDetail(scope)"
>详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="tableData.count>0"
:total="tableData.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</div>
</template>
<script>
import { getCertappList, deleteCertapp } from "@/api/certapp"
import { getOrgList } from "@/api/org"
import { getDictList } from "@/api/dict"
import Pagination from "@/components/Pagination"
import checkPermission from '@/utils/permission'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { genTree } from '../../utils'
export default {
components: { Pagination, Treeselect },
data() {
return {
tableData: {count:0},
listLoading: true,
listQuery: {
page: 1,
page_size: 20
},
deptOptions: [],
field_list:[]
};
},
created() {
this.getList()
this.getdeptOptions()
this.getfields()
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getCertappList(this.listQuery).then(response => {
if (response.data) {
this.tableData = response.data
}
this.listLoading = false
});
},
getdeptOptions() {
getOrgList().then(res=>{
this.deptOptions = genTree(res.data)
})
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20
}
this.getList()
},
handleFilter() {
this.listQuery.page = 1
this.getList()
},
getfields(){
getDictList({type__code:'cert_field'}).then(res=>{
let fields = []
for(var i=0;i<res.data.length;i++){
if(res.data[i].parent!=null){
fields.push({id:res.data[i].id, name:res.data[i].name, code:res.data[i].code})
}
}
this.field_list = fields
})
},
handleCertappDetail(scope) {
this.$router.push({
name: "Certappdetail",
params: { id: scope.row.id },
});
},
handleAccessment(scope) {
this.$router.push({
name: "Certappaccess",
params: { id: scope.row.id, action:'access' },
});
}
}
};
</script>