vue index

This commit is contained in:
caoqianming 2020-08-14 09:56:42 +08:00
parent 548159edfe
commit d30aac24af
6 changed files with 202 additions and 13 deletions

40
client/src/api/unit.js Normal file
View File

@ -0,0 +1,40 @@
import request from '@/utils/request'
export function getUnitList(query) {
return request({
url: '/project/unit/',
method: 'get',
params: query
})
}
export function createUnit(data) {
return request({
url: '/project/unit/',
method: 'post',
data
})
}
export function deleteUnit(id) {
return request({
url: `/project/unit/${id}/`,
method: 'delete'
})
}
export function updateUnit(id, data) {
return request({
url: `/project/unit/${id}/`,
method: 'put',
data
})
}
export function getUnit(id) {
return request({
url: `/project/unit/${id}/`,
method: 'get',
})
}

View File

@ -64,16 +64,16 @@ export const asyncRoutes = [
{
path: '/project',
component: Layout,
redirect: '/project/case',
redirect: '/project/certapp',
name: 'ProjectManage',
meta: { title: '认证项目', icon: 'example'},
children: [
{
path: 'application',
name: 'Applicaion',
component: () => import('@/views/application/application'),
meta: { title: '认证受理', icon: 'example', perms: ['application_view'] }
},
// {
// path: 'application',
// name: 'Applicaion',
// component: () => import('@/views/application/application'),
// meta: { title: '认证受理', icon: 'example', perms: ['application_view'] }
// },
{
path: 'certapp',
name: 'Certapp',

View File

@ -1,11 +1,11 @@
<template>
<div class="app-container">
<el-tabs type="border-card" >
<el-tabs >
<el-tab-pane label="申请信息" style="height:700px;overflow-y:auto;overflow-x:hidden;">
<CCCform :action="action" @handleCommit="save" :certapp="certapp" v-if="kind=='CCC'"></CCCform>
</el-tab-pane>
<el-tab-pane label="产品单元" style="height:700px;overflow-y:auto;overflow-x:hidden;" v-if="certapp">
<Productunit :certapp="certapp"></Productunit>
</el-tab-pane>
<el-tab-pane label="原材料供应商" style="height:700px;overflow-y:auto;overflow-x:hidden;" v-if="certapp">
</el-tab-pane>
@ -23,9 +23,9 @@
</template>
<script>
import CCCform from "@/views/certapp/cccform"
import Productunit from "@/views/certapp/productunit"
export default {
components: { CCCform },
components: { CCCform, Productunit},
props: [],
data() {
return {

View File

@ -0,0 +1,136 @@
<template>
<div>
<el-table
v-loading="listLoading"
:data="tableData.results"
style="width: 100%;margin-top:10px;"
border
fit
stripe
highlight-current-row
max-height="400"
>
<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"><el-tag>{{ scope.row.status}}</el-tag></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="操作">
<template slot-scope="scope">
<el-button
type="primary"
size="small"
:disabled="!checkPermission(['case_update'])"
@click="handleUpdate(scope)"
>编辑</el-button>
<el-button
type="danger"
size="small"
:disabled="!checkPermission(['case_delete'])"
@click="handleDelete(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 { getUnitList, deleteUnit, createUnit, updateUnit } from "@/api/unit"
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 {
name:"Productunit",
components: { Pagination, Treeselect },
data() {
return {
tableData: {count:0},
listLoading: true,
listQuery: {
page: 1,
page_size: 20
},
};
},
created() {
this.getList()
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getUnitList(this.listQuery).then(response => {
if (response.data) {
this.tableData = response.data
}
this.listLoading = false
});
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20
}
this.getList()
},
handleFilter() {
this.listQuery.page = 1
this.getList()
},
handleCreate(item, index) {
this.$router.push({name:"CertappForm", params:{kind:item.code, action:'create'}})
},
handleUpdate(scope) {
this.$router.push({name:"CertappForm", params:{action:'update', kind:scope.row.cert_field_.code}, query:{id:scope.row.id}})
},
handleDelete(scope) {
this.$confirm('确定删除?', '警告', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
type: 'warning'
}).then(()=>{
deleteUnit(scope.row.id).then(res=>{
this.$message.success('成功')
this.getList()
})
})
},
}
};
</script>

View File

@ -21,7 +21,7 @@
<template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column>
<el-table-column align="header-center" label="采用标准">
<template slot-scope="scope">{{ scope.row.standard_.code }} {{ scope.row.standard_.name }}</template>
<template slot-scope="scope" v-if="scope.row.standard_">{{ scope.row.standard_.code }} {{ scope.row.standard_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="260px">
<template slot-scope="scope">
@ -138,7 +138,7 @@ export default {
this.$refs['Form'].clearValidate()
})
},
handleDelete(scope){
handleDelete(scope){
deleteUnitType(scope.row.id).then(res=>{
this.$message.success('成功')
this.getList()

View File

@ -253,6 +253,19 @@ export default {
this.$refs['Form'].clearValidate()
})
},
handleDelete(scope) {
this.$confirm('确定删除?', '警告', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteStandard(scope.row.id).then(res=>{
this.$message.success('成功')
this.getList()
})
})
},
handlePreview(file) {
if ('url' in file){
window.open(file.url)