地坪项目

This commit is contained in:
Li xia 2024-09-20 09:29:14 +08:00
parent d01a56caec
commit 6e46c063b9
15 changed files with 1300 additions and 806 deletions

View File

@ -3,6 +3,6 @@ ENV = 'development'
# base api # base api
#VUE_APP_BASE_API = 'http://localhost:8000' #VUE_APP_BASE_API = 'http://localhost:8000'
VUE_APP_BASE_API = 'https://qw.ctc-zc.com/api' VUE_APP_BASE_API = 'https://dppz.ctc.ac.cn/api'
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -3,4 +3,4 @@ ENV = 'production'
# base api # base api
# VUE_APP_BASE_API = '/prod-api' # VUE_APP_BASE_API = '/prod-api'
VUE_APP_BASE_API = 'https://qw.ctc-zc.com/api' VUE_APP_BASE_API = 'https://dppz.ctc.ac.cn/api'

View File

@ -4,7 +4,7 @@ export function getArticleList(query) {
return request({ return request({
url: '/cms/article/', url: '/cms/article/',
method: 'get', method: 'get',
params:query params: query
}) })
} }
export function createArticle(data) { export function createArticle(data) {
@ -24,19 +24,19 @@ export function updateArticle(id, data) {
export function deleteArticle(id) { export function deleteArticle(id) {
return request({ return request({
url: `/cms/article/${id}/`, url: `/cms/article/${id}/`,
method: 'delete', method: 'delete'
}) })
} }
export function getArticle(id) { export function getArticle(id) {
return request({ return request({
url: `/cms/article/${id}/`, url: `/cms/article/${id}/`,
method: 'get', method: 'get'
}) })
} }
export function topArticle(id) { export function topArticle(id) {
return request({ return request({
url: `/cms/article/${id}/top/`, url: `/cms/article/${id}/top/`,
method: 'put', method: 'put'
}) })
} }
@ -44,7 +44,7 @@ export function getMaterialList(query) {
return request({ return request({
url: '/cms/material/', url: '/cms/material/',
method: 'get', method: 'get',
params:query params: query
}) })
} }
export function createMaterial(data) { export function createMaterial(data) {
@ -72,7 +72,7 @@ export function getSourceList(query) {
return request({ return request({
url: '/cms/source/', url: '/cms/source/',
method: 'get', method: 'get',
params:query params: query
}) })
} }
export function createSource(data) { export function createSource(data) {
@ -100,7 +100,7 @@ export function getThresholdList(query) {
return request({ return request({
url: '/cms/threshold/', url: '/cms/threshold/',
method: 'get', method: 'get',
params:query params: query
}) })
} }
export function createThreshold(data) { export function createThreshold(data) {
@ -123,3 +123,60 @@ export function deleteThreshold(id) {
method: 'delete' method: 'delete'
}) })
} }
// 地坪项目优培企业
export function getCompanyList(query) {
return request({
url: '/cms/company/',
method: 'get',
params: query
})
}
export function createCompany(data) {
return request({
url: '/cms/company/',
method: 'post',
data
})
}
export function updateCompany(id, data) {
return request({
url: `/cms/company/${id}/`,
method: 'put',
data
})
}
export function deleteCompany(id) {
return request({
url: `/cms/company/${id}/`,
method: 'delete'
})
}
export function getChildcompanyList(query) {
return request({
url: '/cms/childcomany/',
method: 'get',
params: query
})
}
export function createChildcomany(data) {
return request({
url: '/cms/childcomany/',
method: 'post',
data
})
}
export function updateChildcomany(id, data) {
return request({
url: `/cms/childcomany/${id}/`,
method: 'put',
data
})
}
export function deleteChildcomany(id) {
return request({
url: `/cms/childcomany/${id}/`,
method: 'delete'
})
}

View File

@ -48,6 +48,7 @@ export const constantRoutes = [
* asyncRoutes * asyncRoutes
* the routes that need to be dynamically loaded based on user perms * the routes that need to be dynamically loaded based on user perms
*/ */
// eslint-disable-next-line no-sparse-arrays
export const asyncRoutes = [ export const asyncRoutes = [
{ {
path: '/', path: '/',
@ -57,7 +58,7 @@ export const asyncRoutes = [
path: 'dashboard', path: 'dashboard',
name: 'Dashboard', name: 'Dashboard',
component: () => import('@/views/dashboard/index'), component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'dashboard', perms:['admin'] } meta: { title: '首页', icon: 'dashboard', perms: ['admin'] }
}] }]
}, },
{ {
@ -83,18 +84,37 @@ export const asyncRoutes = [
path: 'news/create', path: 'news/create',
name: 'NewsCreate', name: 'NewsCreate',
component: () => import('@/views/news/newscreate.vue'), component: () => import('@/views/news/newscreate.vue'),
meta: { title: '新建文章', noCache: true, icon: '', perms: ['news_create']}, meta: { title: '新建文章', noCache: true, icon: '', perms: ['news_create'] },
hidden: true hidden: true
}, },
{ {
path: 'news/update', path: 'news/update',
name: 'NewsUpdate', name: 'NewsUpdate',
component: () => import('@/views/news/newsupdate.vue'), component: () => import('@/views/news/newsupdate.vue'),
meta: { title: '编辑文章', noCache: true, icon: '', perms: ['news_update']}, meta: { title: '编辑文章', noCache: true, icon: '', perms: ['news_update'] },
hidden: true hidden: true
} }
] ]
}, },
// youpei 是只针对地坪项目新建的菜单
{
path: '/youpei',
component: Layout,
redirect: '/youpei/index',
name: 'Youpei',
meta: { title: '优培企业', icon: 'documentation', perms: ['youpei_view'] },
children: [
{
path: 'index',
name: 'youpeiList',
component: () => import('@/views/youpei/index.vue'),
meta: { title: '优培企业', icon: 'documentation', perms: ['youpei_view'] }
}
]
},
{ {
path: '/vod', path: '/vod',
component: Layout, component: Layout,
@ -155,7 +175,7 @@ export const asyncRoutes = [
component: Layout, component: Layout,
redirect: '/Qmanage/question', redirect: '/Qmanage/question',
name: 'Qmanage', name: 'Qmanage',
meta: { title: '题库管理', icon: 'table'}, meta: { title: '题库管理', icon: 'table' },
children: [ children: [
{ {
path: 'subject', path: 'subject',
@ -179,14 +199,14 @@ export const asyncRoutes = [
path: 'question/create', path: 'question/create',
name: 'CreateQuestion', name: 'CreateQuestion',
component: () => import('@/views/question/questioncreate.vue'), component: () => import('@/views/question/questioncreate.vue'),
meta: { title: '新建题目', noCache: true, icon: '', perms: ['question_create']}, meta: { title: '新建题目', noCache: true, icon: '', perms: ['question_create'] },
hidden: true hidden: true
}, },
{ {
path: 'question/update', path: 'question/update',
name: 'UpdateQuestion', name: 'UpdateQuestion',
component: () => import('@/views/question/questionupdate.vue'), component: () => import('@/views/question/questionupdate.vue'),
meta: { title: '编辑题目', noCache: true, icon: '', perms: ['question_update']}, meta: { title: '编辑题目', noCache: true, icon: '', perms: ['question_update'] },
hidden: true hidden: true
} }
] ]
@ -196,19 +216,19 @@ export const asyncRoutes = [
component: Layout, component: Layout,
redirect: '/sjmanage/workscope', redirect: '/sjmanage/workscope',
name: 'Sjmanage', name: 'Sjmanage',
meta: { title: '出卷管理', icon: 'component', perms: []}, meta: { title: '出卷管理', icon: 'component', perms: [] },
children: [ children: [
{ {
path: 'testrule', path: 'testrule',
name: 'TestRule', name: 'TestRule',
component: () => import('@/views/examtest/rule.vue'), component: () => import('@/views/examtest/rule.vue'),
meta: { title: '试卷结构', icon: '', perms: ['testrule_manage'] }, meta: { title: '试卷结构', icon: '', perms: ['testrule_manage'] }
}, },
{ {
path: 'workscope', path: 'workscope',
name: 'workscope', name: 'workscope',
component: () => import('@/views/examtest/workscope.vue'), component: () => import('@/views/examtest/workscope.vue'),
meta: { title: '工作类别', icon: '', perms: ['workscope_manage'] }, meta: { title: '工作类别', icon: '', perms: ['workscope_manage'] }
}, },
{ {
path: 'testpaper', path: 'testpaper',
@ -220,42 +240,42 @@ export const asyncRoutes = [
path: 'testrule/create', path: 'testrule/create',
name: 'CreateRule', name: 'CreateRule',
component: () => import('@/views/examtest/rulecreate.vue'), component: () => import('@/views/examtest/rulecreate.vue'),
meta: { title: '新建试卷结构', noCache: true, icon: '', perms: ['testrule_add']}, meta: { title: '新建试卷结构', noCache: true, icon: '', perms: ['testrule_add'] },
hidden: true hidden: true
}, },
{ {
path: 'testrule/update', path: 'testrule/update',
name: 'UpdateRule', name: 'UpdateRule',
component: () => import('@/views/examtest/ruleupdate.vue'), component: () => import('@/views/examtest/ruleupdate.vue'),
meta: { title: '编辑试卷结构', noCache: true, icon: '', perms: ['testrule_update']}, meta: { title: '编辑试卷结构', noCache: true, icon: '', perms: ['testrule_update'] },
hidden: true hidden: true
}, },
{ {
path: 'workscope/create', path: 'workscope/create',
name: 'CreateWorkscope', name: 'CreateWorkscope',
component: () => import('@/views/examtest/workscopecreate.vue'), component: () => import('@/views/examtest/workscopecreate.vue'),
meta: { title: '新建工作类别', noCache: true, icon: '', perms: ['workscope_add']}, meta: { title: '新建工作类别', noCache: true, icon: '', perms: ['workscope_add'] },
hidden: true hidden: true
}, },
{ {
path: 'workscope/update', path: 'workscope/update',
name: 'UpdateWorkscope', name: 'UpdateWorkscope',
component: () => import('@/views/examtest/workscopeupdate.vue'), component: () => import('@/views/examtest/workscopeupdate.vue'),
meta: { title: '编辑工作类别', noCache: true, icon: '', perms: ['workscope_update']}, meta: { title: '编辑工作类别', noCache: true, icon: '', perms: ['workscope_update'] },
hidden: true hidden: true
}, },
{ {
path: 'paper/create', path: 'paper/create',
name: 'CreatePaper', name: 'CreatePaper',
component: () => import('@/views/examtest/papercreate.vue'), component: () => import('@/views/examtest/papercreate.vue'),
meta: { title: '新建押题试卷', noCache: true, icon: '', perms: ['paper_add']}, meta: { title: '新建押题试卷', noCache: true, icon: '', perms: ['paper_add'] },
hidden: true hidden: true
}, },
{ {
path: 'paper/update', path: 'paper/update',
name: 'UpdatePaper', name: 'UpdatePaper',
component: () => import('@/views/examtest/paperupdate.vue'), component: () => import('@/views/examtest/paperupdate.vue'),
meta: { title: '编辑押题试卷', noCache: true, icon: '', perms: ['paper_update']}, meta: { title: '编辑押题试卷', noCache: true, icon: '', perms: ['paper_update'] },
hidden: true hidden: true
} }
] ]
@ -265,19 +285,19 @@ export const asyncRoutes = [
component: Layout, component: Layout,
redirect: '/exammanage/index', redirect: '/exammanage/index',
name: 'Exammanage', name: 'Exammanage',
meta: { title: '考证管理', icon: 'component'}, meta: { title: '考证管理', icon: 'component' },
children: [ children: [
{ {
path: 'index', path: 'index',
name: 'exam', name: 'exam',
component: () => import('@/views/exam/index.vue'), component: () => import('@/views/exam/index.vue'),
meta: { title: '正式考试', perms: ['exam_view'] } meta: { title: '正式考试', perms: ['exam_view'] }
}, },
{ {
path: 'issue', path: 'issue',
name: 'issue', name: 'issue',
component: () => import('@/views/exam/issue.vue'), component: () => import('@/views/exam/issue.vue'),
meta: { title: '出证记录', perms: ['certificate_view'] } meta: { title: '出证记录', perms: ['certificate_view'] }
} }
] ]
}, },
@ -286,13 +306,13 @@ export const asyncRoutes = [
component: Layout, component: Layout,
redirect: '/threshold/source', redirect: '/threshold/source',
name: 'Threshold', name: 'Threshold',
meta: { title: '阈值库', icon: 'component'}, meta: { title: '阈值库', icon: 'component', perms: ['threshold_view']},
children: [ children: [
{ {
path: 'source', path: 'source',
name: 'source', name: 'source',
component: () => import('@/views/threshold/source.vue'), component: () => import('@/views/threshold/source.vue'),
meta: { title: '阈值库', perms: ['threshold_view'] } meta: { title: '阈值库', perms: ['threshold_view'] }
} }
] ]
}, },
@ -301,7 +321,7 @@ export const asyncRoutes = [
component: Layout, component: Layout,
redirect: '/analyse/examtest', redirect: '/analyse/examtest',
name: 'Analyse', name: 'Analyse',
meta: { title: '统计分析', icon: 'chart', perms: ['examtest_view']}, meta: { title: '统计分析', icon: 'chart', perms: ['examtest_view'] },
children: [ children: [
{ {
path: 'examtest', path: 'examtest',
@ -344,7 +364,7 @@ export const asyncRoutes = [
component: Layout, component: Layout,
redirect: '/system/admin', redirect: '/system/admin',
name: 'System', name: 'System',
meta: { title: '系统管理', icon: 'tree', perms:[] }, meta: { title: '系统管理', icon: 'tree', perms: [] },
children: [ children: [
{ {
path: 'banner', path: 'banner',
@ -369,7 +389,7 @@ export const asyncRoutes = [
name: 'Msg', name: 'Msg',
component: () => import('@/views/system/msg'), component: () => import('@/views/system/msg'),
meta: { title: '短信发送', icon: '', perms: ['msg_view'] } meta: { title: '短信发送', icon: '', perms: ['msg_view'] }
}, }
// { // {
// path: 'user/password', // path: 'user/password',
// name: 'ChangePassword', // name: 'ChangePassword',
@ -385,15 +405,15 @@ export const asyncRoutes = [
redirect: '/changepassword', redirect: '/changepassword',
name: 'ChangePW', name: 'ChangePW',
meta: { title: '修改密码', icon: 'tree' }, meta: { title: '修改密码', icon: 'tree' },
hidden:true, hidden: true,
children: [ children: [
{ {
path: '', path: '',
name: 'ChangePassword', name: 'ChangePassword',
component: () => import('@/views/system/changepassword'), component: () => import('@/views/system/changepassword'),
meta: { title: '修改密码', noCache: true, icon: ''}, meta: { title: '修改密码', noCache: true, icon: '' },
hidden: true hidden: true
}, }
] ]
}, },
// 404 page must be placed at the end !!! // 404 page must be placed at the end !!!

View File

@ -302,11 +302,11 @@ this.$confirm("确认删除该考试记录吗?将丢失数据!", "警告", {
}else{ }else{
this.listQuery.ordering = '-' + val.prop this.listQuery.ordering = '-' + val.prop
} }
this.getList() this.getList()
}, },
} }
}; };
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -38,12 +38,18 @@
<el-table-column label="姓名"> <el-table-column label="姓名">
<template slot-scope="scope">{{ scope.row.consumer_name }}</template> <template slot-scope="scope">{{ scope.row.consumer_name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="性别">
<template slot-scope="scope">{{ scope.row.gender }}</template>
</el-table-column>
<el-table-column label="身份证号"> <el-table-column label="身份证号">
<template slot-scope="scope">{{ scope.row.ID_number }}</template> <template slot-scope="scope">{{ scope.row.ID_number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="工作类别"> <el-table-column label="工作类别">
<template slot-scope="scope">{{ scope.row.workscope_name }}</template> <template slot-scope="scope">{{ scope.row.workscope_name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="职业等级">
<template slot-scope="scope">{{ scope.row.opllevel }}</template>
</el-table-column>
<el-table-column label="单位"> <el-table-column label="单位">
<template slot-scope="scope">{{ scope.row.company_name }}</template> <template slot-scope="scope">{{ scope.row.company_name }}</template>
</el-table-column> </el-table-column>
@ -118,6 +124,9 @@
<el-form-item label="姓名" prop="consumer_name"> <el-form-item label="姓名" prop="consumer_name">
<el-input v-model="candidate.consumer_name" placeholder="姓名" /> <el-input v-model="candidate.consumer_name" placeholder="姓名" />
</el-form-item> </el-form-item>
<el-form-item label="性别" prop="gender">
<el-input v-model="candidate.gender" placeholder="性别" />
</el-form-item>
<el-form-item label="身份证号" prop="ID_number"> <el-form-item label="身份证号" prop="ID_number">
<el-input v-model="candidate.ID_number" placeholder="身份证号" /> <el-input v-model="candidate.ID_number" placeholder="身份证号" />
</el-form-item> </el-form-item>
@ -127,12 +136,11 @@
placeholder="工作类别" placeholder="工作类别"
/> />
</el-form-item> </el-form-item>
<el-form-item label="单位" prop="company_name"> <el-form-item label="单位" prop="company_name">
<el-input v-model="candidate.company_name" placeholder="单位" /> <el-input v-model="candidate.company_name" placeholder="单位" />
</el-form-item> </el-form-item>
<el-form-item label="部门" prop="deptname">
<el-input v-model="candidate.deptname" placeholder="部门" />
</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="发证日期" prop="issue_date"> <el-form-item label="发证日期" prop="issue_date">
@ -167,23 +175,18 @@
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
/> />
</el-form-item> </el-form-item>
<el-form-item label="照片" prop="photo"> <el-form-item label="职业等级" prop="opllevel">
<el-upload <el-select v-model="candidate.opllevel" placeholder="职业等级" style="width:80%">
class="avatar-uploader" <el-option
:action="upUrl" v-for="item in typeOption"
accept="image/jpeg, image/gif, image/png, image/bmp" :key="item.value"
:show-file-list="false" :label="item.name"
:on-success="handleAvatarSuccess" :value="item.value"
:before-upload="beforeAvatarUpload" />
:headers="upHeaders" </el-select>
> </el-form-item>
<img <el-form-item label="部门" prop="deptname">
v-if="candidate.photo" <el-input v-model="candidate.deptname" placeholder="部门" />
:src="candidate.photo"
class="avatar"
>
<i v-else class="el-icon-plus avatar-uploader-icon" />
</el-upload>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -202,10 +205,10 @@
width="1000px" width="1000px"
title="证书查看" title="证书查看"
> >
<el-card shadow="never" style="width:100%;height:100%;background-color: black;"> <el-card shadow="never" style="width:100%;height:100%;background-color: black;">
<el-image :src="src" style="width:531px;height:809;margin:10px 230px" /> <el-image :src="src" style="width:531px;height:809;margin:10px 230px" />
</el-card> </el-card>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisibleissue = false">取消</el-button> <el-button type="danger" @click="dialogVisibleissue = false">取消</el-button>
@ -276,7 +279,15 @@ export default {
candidate: { photo: '' }, candidate: { photo: '' },
candidateRule: { candidateRule: {
number: [{ required: true, message: '请输入编号', trigger: 'blur' }] number: [{ required: true, message: '请输入编号', trigger: 'blur' }]
} },
typeOption:[
{ name: '初级工', value: '初级工' },
{ name: '中级工', value: '中级工'},
{ name: '高级工', value: '高级工' },
{ name: '技师', value: '技师'},
{ name: '高级技师', value: '高级技师' }
],
} }
}, },
computed: {}, computed: {},
@ -322,19 +333,16 @@ export default {
}, },
// //
handleDialogissue(scope) { handleDialogissue(scope) {
if(scope.row.photo==null) if (scope.row.photo == null) {
{ this.$message({
this.$message({
message: '请先点击编辑上传证书人员照片!', message: '请先点击编辑上传证书人员照片!',
type: 'warning' type: 'warning'
}); })
} else {
this.dialogVisibleissue = true
this.src = 'https://qw.ctc-zc.com' + scope.row.path
this.name = scope.row.workscope_name
} }
else{
this.dialogVisibleissue = true
this.src = 'https://qw.ctc-zc.com' + scope.row.path
this.name = scope.row.workscope_name
}
}, },
handleAdd() { handleAdd() {
this.dialogVisible = true this.dialogVisible = true
@ -375,11 +383,11 @@ export default {
}, },
// //
downCandidate() { downCandidate() {
var a = document.createElement('a'); var a = document.createElement('a')
a.href = this.src ; a.href = this.src
a.download = this.src ; a.download = this.src
a.target="_blank" a.target = '_blank'
a.click() a.click()
} }
} }
} }

View File

@ -199,4 +199,4 @@ export default {
} }
} }
}; };
</script> </script>

View File

@ -12,7 +12,7 @@
<!-- <img class="logo" src="../../assets/logo.png" /> --> <!-- <img class="logo" src="../../assets/logo.png" /> -->
</div> </div>
<div class="title-container"> <div class="title-container">
<h3 class="title">中科辐射小程序后台管理</h3> <h3 class="title">小程序后台管理</h3>
</div> </div>
<el-form-item prop="username"> <el-form-item prop="username">
<span class="svg-container"> <span class="svg-container">

View File

@ -1,125 +1,126 @@
<template> <template>
<div class="app-container"> <el-container>
<div> <el-header>
<el-input <div style="margin-top: 10px;">
v-model="listQuery.search" <el-input
placeholder="名称/描述" v-model="listQuery.search"
style="width: 300px;" placeholder="名称/描述"
class="filter-item" style="width: 300px;"
@keyup.enter.native="handleFilter" class="filter-item"
/> @keyup.enter.native="handleFilter"
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">搜索</el-button> />
<el-button <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">搜索</el-button>
class="filter-item" <el-button
style="margin-left: 10px;" class="filter-item"
type="primary" style="margin-left: 10px;"
icon="el-icon-refresh-left" type="primary"
@click="resetFilter" icon="el-icon-refresh-left"
>刷新重置</el-button> @click="resetFilter"
</div> >刷新重置</el-button>
<div style="margin-top:6px"> </div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate('文档')">文档</el-button> <div style="margin-top:10px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate('视频')">视频</el-button> <el-button type="primary" icon="el-icon-plus" @click="handleCreate('文档')">文档</el-button>
</div> <el-button type="primary" icon="el-icon-plus" @click="handleCreate('视频')">视频</el-button>
<el-table </div>
v-loading="listLoading" </el-header>
:data="materialList.results" <el-main>
style="width: 100%;margin-top:10px;" <el-table
border v-loading="listLoading"
fit :data="materialList.results"
stripe style="width: 100%;margin-top:30px;"
highlight-current-row border
max-height="600" max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="名称">
<template slot-scope="scope">
<el-link
type="primary"
:href="scope.row.path"
target="_blank"
v-if="scope.row.path"
>{{ scope.row.name }}</el-link>
<span v-else>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="资源类型">
<template slot-scope="scope">{{ scope.row.type }}</template>
</el-table-column>
<el-table-column label="上传时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column label="分类" prop="cate"></el-table-column>
<el-table-column align="header-center" label="排序码">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column>
<el-table-column align="header-center" label="下载量/播放量">
<template slot-scope="scope">{{ scope.row.down_count }}</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
type="primary"
size="small"
icon="el-icon-edit"
:disabled="!checkPermission(['material_update'])"
@click="handleUpdate(scope)"
/>
<el-button
type="danger"
size="small"
icon="el-icon-delete"
:disabled="!checkPermission(['material_delete'])"
@click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
<pagination
v-show="materialList.count>0"
:total="materialList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="getList"
/>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType==='update'?'编辑':'新增'"
:close-on-click-modal="false"
>
<el-form
ref="Form"
:model="material"
label-width="80px"
label-position="right"
:rules="rule1"
> >
<el-form-item label="名称" prop="name"> <el-table-column type="index" width="50" />
<el-input v-model="material.name" placeholder="名称" /> <el-table-column label="名称">
</el-form-item> <template slot-scope="scope">
<el-form-item label="描述" prop="description"> <el-link
<el-input v-model="material.description" placeholder="描述" /> v-if="scope.row.path"
</el-form-item> type="primary"
<el-form-item label="分类" prop="cate"> :href="scope.row.path"
<el-select target="_blank"
v-model="material.cate" >{{ scope.row.name }}</el-link>
placeholder="所属分类" <span v-else>{{ scope.row.name }}</span>
clearable </template>
style="width: 200px" </el-table-column>
class="filter-item" <el-table-column label="资源类型">
> <template slot-scope="scope">{{ scope.row.type }}</template>
<el-option </el-table-column>
v-for="item in cateData" <el-table-column label="上传时间">
:key="item" <template slot-scope="scope">{{ scope.row.create_time }}</template>
:label="item" </el-table-column>
:value="item" <el-table-column label="分类" prop="cate" />
<el-table-column align="header-center" label="排序码">
<template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column>
<el-table-column align="header-center" label="下载量/播放量">
<template slot-scope="scope">{{ scope.row.down_count }}</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
type="primary"
size="small"
icon="el-icon-edit"
:disabled="!checkPermission(['material_update'])"
@click="handleUpdate(scope)"
/> />
</el-select> <el-button
</el-form-item> type="danger"
<el-form-item label="排序" prop="description"> size="small"
<el-input-number v-model="material.sort" :min="1"></el-input-number> icon="el-icon-delete"
</el-form-item> :disabled="!checkPermission(['material_delete'])"
<!-- <el-form-item label="封面" prop="poster" v-if="material.type=='视频'"> @click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
<pagination
v-show="materialList.count>0"
:total="materialList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="getList"
/>
</el-main>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType==='update'?'编辑':'新增'"
:close-on-click-modal="false"
>
<el-form
ref="Form"
:model="material"
label-width="80px"
label-position="right"
:rules="rule1"
>
<el-form-item label="名称" prop="name">
<el-input v-model="material.name" placeholder="名称" />
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="material.description" placeholder="描述" />
</el-form-item>
<el-form-item label="分类" prop="cate">
<el-select
v-model="material.cate"
placeholder="所属分类"
clearable
style="width: 200px"
class="filter-item"
>
<el-option
v-for="item in cateData"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item label="排序" prop="description">
<el-input-number v-model="material.sort" :min="1" />
</el-form-item>
<!-- <el-form-item label="封面" prop="poster" v-if="material.type=='视频'">
<el-upload <el-upload
accept=".png, .jpeg, .jpg" accept=".png, .jpeg, .jpg"
:before-upload="beforeUploadP" :before-upload="beforeUploadP"
@ -133,20 +134,20 @@
<i v-else class="el-icon-plus avatar-uploader-icon"></i> <i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload> </el-upload>
</el-form-item> --> </el-form-item> -->
<el-form-item :label="material.type=='文档'?'文件':'视频'" prop="path" v-if="dialogVisible"> <el-form-item v-if="dialogVisible" :label="material.type=='文档'?'文件':'视频'" prop="path">
<el-upload <el-upload
v-if="material.type=='文档'" v-if="material.type=='文档'"
:on-preview="handlePreview" :on-preview="handlePreview"
:on-success="handleSuccess" :on-success="handleSuccess"
:action="upUrl" :action="upUrl"
:headers="upHeaders" :headers="upHeaders"
:limit="1" :limit="1"
:file-list="fileList" :file-list="fileList"
accept=".pdf, .doc, .docx" accept=".pdf, .doc, .docx"
> >
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
</el-upload> </el-upload>
<!-- <el-upload <!-- <el-upload
v-else v-else
class="avatar-uploader" class="avatar-uploader"
:action="upUrl" :action="upUrl"
@ -174,17 +175,18 @@
></el-progress> ></el-progress>
</el-upload> </el-upload>
<div >请保证视频格式正确且不超过100M</div> --> <div >请保证视频格式正确且不超过100M</div> -->
<el-input v-else v-model="material.path" placeholder="腾讯视频地址" /> <el-input v-else v-model="material.path" placeholder="腾讯视频地址" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align:right;"> <div style="text-align:right;">
<el-button type="danger" @click="dialogVisible=false">取消</el-button> <el-button type="danger" @click="dialogVisible=false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button> <el-button type="primary" @click="confirm('Form')">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </el-container>
</template> </template>
<style> <style>
.avatar-uploader .el-upload { .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
@ -215,20 +217,20 @@ import {
getMaterialList, getMaterialList,
createMaterial, createMaterial,
updateMaterial, updateMaterial,
deleteMaterial, deleteMaterial
} from "@/api/cms"; } from '@/api/cms'
import { upUrl, upHeaders } from "@/api/file"; import { upUrl, upHeaders } from '@/api/file'
import Pagination from "@/components/Pagination"; import Pagination from '@/components/Pagination'
import checkPermission from "@/utils/permission"; import checkPermission from '@/utils/permission'
const defaultmaterial = { const defaultmaterial = {
id: null, id: null,
name: null, name: null,
description: null, description: null,
path: null, path: null,
poster: null, poster: null,
type: "文档", type: '文档',
cate:null, cate: null
}; }
export default { export default {
components: { Pagination }, components: { Pagination },
data() { data() {
@ -240,143 +242,143 @@ export default {
listLoading: true, listLoading: true,
listQuery: { listQuery: {
page: 1, page: 1,
limit: 20, limit: 20
}, },
cateData:['标准文件','文献','指南'], cateData: ['标准文件', '文献', '指南'],
dialogVisible: false, dialogVisible: false,
dialogType: "create", dialogType: 'create',
rule1: { rule1: {
name: [{ required: true, message: "请输入姓名", trigger: "blur" }], name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
path: [{ required: true, message: "请上传文件", trigger: "blur" }], path: [{ required: true, message: '请上传文件', trigger: 'blur' }],
cate: [{ required: true, message: "请选择文件分类", trigger: "blur" }], cate: [{ required: true, message: '请选择文件分类', trigger: 'blur' }]
}, },
fileList: [], fileList: [],
videoFlag:false, videoFlag: false,
upVideoPercent:0 upVideoPercent: 0
}; }
}, },
created() { created() {
this.getList(); this.getList()
}, },
methods: { methods: {
checkPermission, checkPermission,
getList() { getList() {
this.listLoading = true; this.listLoading = true
getMaterialList(this.listQuery).then((response) => { getMaterialList(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.materialList = response.data; this.materialList = response.data
} }
this.listLoading = false; this.listLoading = false
}); })
}, },
resetFilter() { resetFilter() {
this.listQuery = { this.listQuery = {
page: 1, page: 1,
limit: 20, limit: 20
}; }
this.getList(); this.getList()
}, },
handleFilter() { handleFilter() {
this.listQuery.page = 1; this.listQuery.page = 1
this.getList(); this.getList()
}, },
handleDelete(scope) { handleDelete(scope) {
deleteMaterial(scope.row.id).then((res) => { deleteMaterial(scope.row.id).then((res) => {
this.getList(); this.getList()
}); })
}, },
handleCreate(val) { handleCreate(val) {
this.material = Object.assign({}, defaultmaterial); this.material = Object.assign({}, defaultmaterial)
this.material.type = val; this.material.type = val
this.fileList = []; this.fileList = []
this.dialogType = "create"; this.dialogType = 'create'
this.dialogVisible = true; this.dialogVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["Form"].clearValidate(); this.$refs['Form'].clearValidate()
}); })
}, },
handleUpdate(scope) { handleUpdate(scope) {
this.material = Object.assign({}, scope.row); // copy obj this.material = Object.assign({}, scope.row) // copy obj
if (this.material.path) { if (this.material.path) {
this.fileList = [ this.fileList = [
{ {
name: name:
this.material.name + this.material.name +
"." + '.' +
this.material.path.split(".")[ this.material.path.split('.')[
this.material.path.split(".").length - 1 this.material.path.split('.').length - 1
], ],
url: this.material.path, url: this.material.path
}, }
]; ]
} }
this.dialogType = "update"; this.dialogType = 'update'
this.dialogVisible = true; this.dialogVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["Form"].clearValidate(); this.$refs['Form'].clearValidate()
}); })
}, },
handlePreview(file) { handlePreview(file) {
if ("url" in file) { if ('url' in file) {
window.open(file.url); window.open(file.url)
} else { } else {
window.open(file.response.data.path); window.open(file.response.data.path)
} }
}, },
beforeUploadP(file) { beforeUploadP(file) {
const isLt1M = file.size / 1024 / 1024 < 1; const isLt1M = file.size / 1024 / 1024 < 1
if (!isLt1M) { if (!isLt1M) {
this.$message.error("上传封面大小不能超过 1MB!"); this.$message.error('上传封面大小不能超过 1MB!')
} }
return isLt1M; return isLt1M
}, },
beforeUploadV(file) { beforeUploadV(file) {
const isLt1M = file.size / 1024 / 1024 < 100; const isLt1M = file.size / 1024 / 1024 < 100
if (!isLt1M) { if (!isLt1M) {
this.$message.error("上传视频大小不能超过 100MB!"); this.$message.error('上传视频大小不能超过 100MB!')
} }
return isLt1M; return isLt1M
}, },
handleSuccess(response, file, fileList) { handleSuccess(response, file, fileList) {
this.material.path = response.data.path; this.material.path = response.data.path
}, },
handleSuccessV(response, file, fileList) { handleSuccessV(response, file, fileList) {
this.videoFlag = false this.videoFlag = false
this.material.path = response.data.path; this.material.path = response.data.path
}, },
handleSuccessP(response, file, fileList) { handleSuccessP(response, file, fileList) {
this.material.poster = response.data.path; this.material.poster = response.data.path
}, },
upVideoProgess(event, file, fileList){ upVideoProgess(event, file, fileList) {
this.videoFlag = true; this.videoFlag = true
this.upVideoPercent = file.percentage.toFixed(0); this.upVideoPercent = file.percentage.toFixed(0)
}, },
async confirm(form) { async confirm(form) {
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
const isEdit = this.dialogType === "update"; const isEdit = this.dialogType === 'update'
if (isEdit) { if (isEdit) {
updateMaterial(this.material.id, this.material).then((res) => { updateMaterial(this.material.id, this.material).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList(); this.getList()
this.dialogVisible = false; this.dialogVisible = false
this.$message.success('成功') this.$message.success('成功')
} }
}); })
} else { } else {
createMaterial(this.material) createMaterial(this.material)
.then((res) => { .then((res) => {
this.getList(); this.getList()
this.dialogVisible = false; this.dialogVisible = false
this.$message.success('成功') this.$message.success('成功')
}) })
.catch((error) => {}); .catch((error) => {})
} }
} else { } else {
return false; return false
} }
}); })
}, }
}, }
}; }
</script> </script>

View File

@ -33,6 +33,9 @@
<el-table-column align="left" label="标题"> <el-table-column align="left" label="标题">
<template slot-scope="scope">{{ scope.row.title }}</template> <template slot-scope="scope">{{ scope.row.title }}</template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="文章类型">
<template slot-scope="scope">{{ type_[scope.row.type] }}</template>
</el-table-column>
<el-table-column align="left" label="来源"> <el-table-column align="left" label="来源">
<template slot-scope="scope">{{ scope.row.ifrom }}</template> <template slot-scope="scope">{{ scope.row.ifrom }}</template>
</el-table-column> </el-table-column>
@ -107,10 +110,13 @@ export default {
components: { Pagination }, components: { Pagination },
data() { data() {
return { return {
type_: {1:"技能大赛",2:"铺装工匠",3:"培训信息",4:"大赛信息"},
listQuery: Object.assign({}, listQuery), listQuery: Object.assign({}, listQuery),
tableData: { tableData: {
count:0, count:0,
results:[], results:[],
}, },
listLoading: true, listLoading: true,
}; };

View File

@ -1,66 +1,83 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div> <div>
<el-form <el-form
:model="Form" ref="Form"
:rules="rules" :model="Form"
ref="Form" :rules="rules"
label-width="100px" label-width="100px"
status-icon status-icon
> >
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="Form.title" style="width: 80%"></el-input> <el-input v-model="Form.title" style="width: 80%" />
</el-form-item> </el-form-item>
<el-form-item label="来源" prop="ifrom"> <el-form-item label="文章类型">
<el-input v-model="Form.ifrom" style="width: 80%"></el-input> <el-select v-model="Form.type" placeholder="文章类型" style="width:80%">
</el-form-item> <el-option
<el-form-item label="外部链接" prop="elink" > v-for="item in typeOption"
<el-input v-model="Form.elink" style="width: 80%"></el-input> :key="item.value"
</el-form-item> :label="item.name"
<el-form-item label="内容" prop="content" v-show="is_show"> :value="item.value"
<tinymce v-model="Form.content" :height="400" width="80%"/> />
</el-form-item> </el-select>
<el-form-item> </el-form-item>
<el-button type="primary" @click="submitForm('Form')" :loading="submitLoding">立即创建</el-button> <el-form-item label="来源" prop="ifrom">
<el-button type="warning" @click="goBack()">返回</el-button> <el-input v-model="Form.ifrom" style="width: 80%" />
</el-form-item> </el-form-item>
</el-form> <el-form-item label="外部链接" prop="elink">
<el-input v-model="Form.elink" style="width: 80%" />
</el-form-item>
<el-form-item v-show="is_show" label="内容" prop="content">
<tinymce v-model="Form.content" :height="400" width="80%" />
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="submitLoding" @click="submitForm('Form')">立即创建</el-button>
<el-button type="warning" @click="goBack()">返回</el-button>
</el-form-item>
</el-form>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import Tinymce from '@/components/Tinymce' import Tinymce from '@/components/Tinymce'
import {createArticle} from "@/api/cms"; import { createArticle } from '@/api/cms'
export default { export default {
name: 'TinymceDemo', name: 'TinymceDemo',
components: { Tinymce }, components: { Tinymce },
data() { data() {
return { return {
Form:{ typeOption: [
title:'', { name: '技能大赛', value: 1 },
ifrom:'', { name: '铺装工匠', value: 2 },
elink:'', { name: '培训信息', value: 3 },
content:'' { name: '大赛信息', value: 4 }
],
Form: {
title: '',
ifrom: '',
elink: '',
content: ''
}, },
submitLoding: false, submitLoding: false,
rules: { rules: {
title: [ title: [
{ required: true, message: "请输入", trigger: "blur" } { required: true, message: '请输入', trigger: 'blur' }
], ],
ifrom: [ ifrom: [
{ required: true, message: "请输入", trigger: "blur" } { required: true, message: '请输入', trigger: 'blur' }
], ]
}, },
is_show: true is_show: true
} }
}, },
watch:{ watch: {
'Form.elink':'showEditor' 'Form.elink': 'showEditor'
}, },
methods:{ methods: {
goBack() { goBack() {
this.$router.go(-1) this.$router.go(-1)
}, },
@ -68,28 +85,26 @@ export default {
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
if (valid) { if (valid) {
// this.submitLoding = true // this.submitLoding = true
createArticle(this.Form).then(response => { createArticle(this.Form).then(response => {
this.submitLoding = false this.submitLoding = false
if(response.code >= 200){ if (response.code >= 200) {
this.$message({ this.$message({
type: "success", type: 'success',
message: "新建成功!" message: '新建成功!'
}); })
this.goBack() this.goBack()
} }
})
});
} else { } else {
return false; return false
} }
}); })
}, },
showEditor(){ showEditor() {
if(this.Form.elink){ if (this.Form.elink) {
this.Form.content = '' this.Form.content = ''
this.is_show = false this.is_show = false
}else{ } else {
this.is_show = true this.is_show = true
} }
} }
@ -97,5 +112,3 @@ export default {
} }
</script> </script>

View File

@ -11,6 +11,16 @@
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="Form.title" style="width: 80%"></el-input> <el-input v-model="Form.title" style="width: 80%"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="文章类型">
<el-select v-model="Form.type" placeholder="文章类型" style="width:80%">
<el-option
v-for="item in typeOption"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="来源" prop="ifrom"> <el-form-item label="来源" prop="ifrom">
<el-input v-model="Form.ifrom" style="width: 80%"></el-input> <el-input v-model="Form.ifrom" style="width: 80%"></el-input>
</el-form-item> </el-form-item>
@ -25,7 +35,7 @@
<el-button type="warning" @click="goBack()">返回</el-button> <el-button type="warning" @click="goBack()">返回</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</div> </div>
</template> </template>
@ -45,6 +55,12 @@ export default {
elink:'', elink:'',
content:'' content:''
}, },
typeOption: [
{ name: '技能大赛', value: 1 },
{ name: '铺装工匠', value: 2 },
{ name: '培训信息', value: 3 },
{ name: '大赛信息', value: 4 }
],
submitLoding: false, submitLoding: false,
rules: { rules: {
title: [ title: [
@ -81,8 +97,8 @@ export default {
}); });
this.goBack() this.goBack()
} }
}); });
} else { } else {
return false; return false;

View File

@ -0,0 +1,7 @@
<template>
<div class="app-container">
<div style="margin-top:10px" >
地坪技能大赛详细信心
</div>
</div>
</template>

View File

@ -0,0 +1,339 @@
<template>
<div class="app-container">
<el-row :gutter="2">
<el-col :span="12">
<el-card style=" height:750px">
<div style="margin-top:10px">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
</div>
<el-table
v-loading="listLoading"
:data="tableData.results"
style="width: 100%;margin-top:10px;"
border
stripe
fit
highlight-current-row
max-height="600"
@row-click="sourceRowClick"
>
<el-table-column type="index" width="50" />
<el-table-column align="left" width="230" label="企业名称">
<template slot-scope="scope">{{ scope.row.company_name }}</template>
</el-table-column>
<el-table-column align="left" label="教育工匠总积分">
<template slot-scope="scope">{{ scope.row.edu_points }}</template>
</el-table-column>
<el-table-column align="left" label="协办大赛总积分">
<template slot-scope="scope">{{ scope.row.co_sponsor_points }}</template>
</el-table-column>
<el-table-column align="left" label="企业总积分">
<template slot-scope="scope">{{ scope.row.edu_points+scope.row.co_sponsor_points }}</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
type="primary"
size="small"
icon="el-icon-edit"
:disabled="!checkPermission(['article_update'])"
@click="handleEdit(scope)"
/>
<el-button
type="danger"
size="small"
icon="el-icon-delete"
:disabled="!checkPermission(['article_delete'])"
@click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑信息':'新增信息'">
<el-form
ref="commonForm"
:model="companydata"
label-width="120px"
label-position="right"
:rules="rule1"
>
<el-form-item label="企业名称" prop="company_name">
<el-input v-model="companydata.company_name " placeholder="企业名称" />
</el-form-item>
<el-form-item label="教育工匠总积分" prop="edu_points">
<el-input-number v-model="companydata.edu_points " />
</el-form-item>
<el-form-item label="协办大赛总积分" prop="co_sponsor_points">
<el-input-number v-model="companydata.co_sponsor_points " />
</el-form-item>
</el-form>
<div style="text-align:right;">
<el-button type="danger" @click="dialogVisible=false">取消</el-button>
<el-button type="primary" @click="confirmcompany('commonForm')">确认</el-button>
</div>
</el-dialog>
<pagination
v-show="tableData.count>0"
:total="tableData.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="getList"
/>
</el-card>
</el-col>
<el-col :span="12">
<el-card style="height:750px">
<div style="margin-top:10px">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd2">新增</el-button>
</div>
<el-table
v-loading="listLoading"
:data="tableData2.results"
style="width: 100%;margin-top:10px;"
border
stripe
fit
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column align="left" label="企业名称">
<template slot-scope="scope">{{ scope.row.parent_company_name }}</template>
</el-table-column>
<el-table-column align="left" label="教育工匠积分">
<template slot-scope="scope">{{ scope.row.child_edu_points }}</template>
</el-table-column>
<el-table-column align="left" label="协办大赛积分">
<template slot-scope="scope">{{ scope.row.child_co_sponsor_points }}</template>
</el-table-column>
<el-table-column align="left" label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
type="danger"
size="small"
icon="el-icon-delete"
:disabled="!checkPermission(['article_delete'])"
@click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
<el-dialog :visible.sync="dialogVisible2" :title="dialogType2==='edit'?'编辑信息':'新增信息'">
<el-form
ref="commonForm2"
:model="childCompy"
label-width="120px"
label-position="right"
:rules="rule1"
>
<el-form-item label="企业名称" prop="child_edu_points">
<el-select
v-model="childCompy.parent_company "
placeholder="请选择企业名称"
style="width:400px"
>
<el-option
v-for="item in companyOption"
:key="item.id"
:label="item.company_name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="教育工匠积分" prop="child_edu_points">
<el-input v-model.number="childCompy.child_edu_points" placeholder="教育工匠积分" />
</el-form-item>
<el-form-item label="协办大赛积分" prop="child_co_sponsor_points">
<el-input v-model.number="childCompy.child_co_sponsor_points" placeholder="协办大赛积分" />
</el-form-item>
</el-form>
<div style="text-align:right;">
<el-button type="danger" @click="dialogVisible2=false">取消</el-button>
<el-button type="primary" @click="confirmchild('commonForm2')">确认</el-button>
</div>
</el-dialog>
<pagination
v-show="tableData2.count>0"
:total="tableData2.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.limit"
@pagination="getList2"
/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import { getCompanyList, createCompany, deleteCompany, updateCompany, getChildcompanyList, createChildcomany, deleteChildcomany, updateChildcomany } from '@/api/cms'
import checkPermission from '@/utils/permission'
import Pagination from '@/components/Pagination'
import { genTree, deepClone } from '@/utils'
const listQuery = {
page: 1,
limit: 20,
search: ''
}
const listQuery2 = {
page: 1,
limit: 20,
search: ''
}
export default {
components: { Pagination },
data() {
return {
listQuery: Object.assign({}, listQuery),
listQuery2: Object.assign({}, listQuery2),
tableData: [],
tableData2: [],
listLoading: true,
dialogVisible: false,
dialogType: 'new',
dialogType2: 'new',
dialogVisible2: false,
childCompy: {},
companydata: {},
companyOption: []
}
},
computed: {},
created() {
this.getList()
this.getList2()
},
methods: {
checkPermission,
getList() {
this.listLoading = true
getCompanyList(this.listQuery).then((response) => {
this.tableData = response.data
this.companyOption = genTree(response.data.results)
this.listLoading = false
})
},
getList2() {
this.listLoading = true
getChildcompanyList(this.listQuery2).then((response) => {
this.tableData2 = response.data
this.listLoading = false
})
},
handleAdd() {
this.companydata = {}
this.dialogType = 'new'
this.dialogVisible = true
this.$nextTick(() => {
this.$refs['commonForm'].clearValidate()
})
},
handleAdd2() {
this.childCompy = {}
this.dialogType2 = 'new'
this.dialogVisible2 = true
this.$nextTick(() => {
this.$refs['commonForm2'].clearValidate()
})
},
handleEdit(scope) {
this.companydata = Object.assign({}, scope.row) // copy obj
this.dialogType = 'edit'
this.dialogVisible = true
this.$nextTick(() => {
this.$refs['commonForm'].clearValidate()
})
},
handleDelete(scope) {
this.$confirm('确认删数据吗?将丢失数据!', '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'error'
})
.then(async() => {
await deleteCompany(scope.row.id)
this.getList()
this.$message({
type: 'success',
message: '成功删除!'
})
})
// eslint-disable-next-line handle-callback-err
.catch(err => {
// console.error(err);
})
},
//
sourceRowClick(row) {
this.listQuery2.parent_company = row.id
this.compayNameC = row.company_name
this.getList2()
},
handleTop(scope) {
},
//
async confirmcompany(form) {
this.$refs[form].validate(valid => {
if (valid) {
const isEdit = this.dialogType === 'edit'
if (isEdit) {
updateChildcomany(this.companydata.id, this.companydata).then(() => {
this.getList()
this.dialogVisible = false
this.$message.success('成功')
})
} else {
createCompany(this.companydata).then(res => {
// this.exam = res.data
// this.tableData.unshift(this.exam)
this.getList()
this.dialogVisible = false
this.$message.success('成功')
})
}
} else {
return false
}
})
},
//
async confirmchild(form) {
this.$refs[form].validate(valid => {
if (valid) {
const isEdit = this.dialogType2 === 'edit'
if (isEdit) {
updateCompany(this.childCompy.id, this.childCompy).then(() => {
this.getList2()
this.getList()
this.dialogVisible2 = false
this.$message.success('成功')
})
} else {
createChildcomany(this.childCompy).then(res => {
// this.exam = res.data
// this.tableData.unshift(this.exam)
this.getList2()
this.getList()
this.dialogVisible2 = false
this.$message.success('成功')
})
}
} else {
return false
}
})
},
}
}
</script>