地坪项目
This commit is contained in:
parent
d01a56caec
commit
6e46c063b9
|
@ -3,6 +3,6 @@ ENV = 'development'
|
|||
|
||||
# base api
|
||||
#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
|
||||
|
|
|
@ -3,4 +3,4 @@ ENV = 'production'
|
|||
|
||||
# base 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'
|
||||
|
|
|
@ -4,7 +4,7 @@ export function getArticleList(query) {
|
|||
return request({
|
||||
url: '/cms/article/',
|
||||
method: 'get',
|
||||
params:query
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function createArticle(data) {
|
||||
|
@ -24,19 +24,19 @@ export function updateArticle(id, data) {
|
|||
export function deleteArticle(id) {
|
||||
return request({
|
||||
url: `/cms/article/${id}/`,
|
||||
method: 'delete',
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
export function getArticle(id) {
|
||||
return request({
|
||||
url: `/cms/article/${id}/`,
|
||||
method: 'get',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
export function topArticle(id) {
|
||||
return request({
|
||||
url: `/cms/article/${id}/top/`,
|
||||
method: 'put',
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ export function getMaterialList(query) {
|
|||
return request({
|
||||
url: '/cms/material/',
|
||||
method: 'get',
|
||||
params:query
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function createMaterial(data) {
|
||||
|
@ -72,7 +72,7 @@ export function getSourceList(query) {
|
|||
return request({
|
||||
url: '/cms/source/',
|
||||
method: 'get',
|
||||
params:query
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function createSource(data) {
|
||||
|
@ -100,7 +100,7 @@ export function getThresholdList(query) {
|
|||
return request({
|
||||
url: '/cms/threshold/',
|
||||
method: 'get',
|
||||
params:query
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function createThreshold(data) {
|
||||
|
@ -123,3 +123,60 @@ export function deleteThreshold(id) {
|
|||
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'
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ export const constantRoutes = [
|
|||
* asyncRoutes
|
||||
* the routes that need to be dynamically loaded based on user perms
|
||||
*/
|
||||
// eslint-disable-next-line no-sparse-arrays
|
||||
export const asyncRoutes = [
|
||||
{
|
||||
path: '/',
|
||||
|
@ -57,7 +58,7 @@ export const asyncRoutes = [
|
|||
path: 'dashboard',
|
||||
name: 'Dashboard',
|
||||
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',
|
||||
name: 'NewsCreate',
|
||||
component: () => import('@/views/news/newscreate.vue'),
|
||||
meta: { title: '新建文章', noCache: true, icon: '', perms: ['news_create']},
|
||||
meta: { title: '新建文章', noCache: true, icon: '', perms: ['news_create'] },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'news/update',
|
||||
name: 'NewsUpdate',
|
||||
component: () => import('@/views/news/newsupdate.vue'),
|
||||
meta: { title: '编辑文章', noCache: true, icon: '', perms: ['news_update']},
|
||||
meta: { title: '编辑文章', noCache: true, icon: '', perms: ['news_update'] },
|
||||
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',
|
||||
component: Layout,
|
||||
|
@ -155,7 +175,7 @@ export const asyncRoutes = [
|
|||
component: Layout,
|
||||
redirect: '/Qmanage/question',
|
||||
name: 'Qmanage',
|
||||
meta: { title: '题库管理', icon: 'table'},
|
||||
meta: { title: '题库管理', icon: 'table' },
|
||||
children: [
|
||||
{
|
||||
path: 'subject',
|
||||
|
@ -179,14 +199,14 @@ export const asyncRoutes = [
|
|||
path: 'question/create',
|
||||
name: 'CreateQuestion',
|
||||
component: () => import('@/views/question/questioncreate.vue'),
|
||||
meta: { title: '新建题目', noCache: true, icon: '', perms: ['question_create']},
|
||||
meta: { title: '新建题目', noCache: true, icon: '', perms: ['question_create'] },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'question/update',
|
||||
name: 'UpdateQuestion',
|
||||
component: () => import('@/views/question/questionupdate.vue'),
|
||||
meta: { title: '编辑题目', noCache: true, icon: '', perms: ['question_update']},
|
||||
meta: { title: '编辑题目', noCache: true, icon: '', perms: ['question_update'] },
|
||||
hidden: true
|
||||
}
|
||||
]
|
||||
|
@ -196,19 +216,19 @@ export const asyncRoutes = [
|
|||
component: Layout,
|
||||
redirect: '/sjmanage/workscope',
|
||||
name: 'Sjmanage',
|
||||
meta: { title: '出卷管理', icon: 'component', perms: []},
|
||||
meta: { title: '出卷管理', icon: 'component', perms: [] },
|
||||
children: [
|
||||
{
|
||||
path: 'testrule',
|
||||
name: 'TestRule',
|
||||
component: () => import('@/views/examtest/rule.vue'),
|
||||
meta: { title: '试卷结构', icon: '', perms: ['testrule_manage'] },
|
||||
meta: { title: '试卷结构', icon: '', perms: ['testrule_manage'] }
|
||||
},
|
||||
{
|
||||
path: 'workscope',
|
||||
name: 'workscope',
|
||||
component: () => import('@/views/examtest/workscope.vue'),
|
||||
meta: { title: '工作类别', icon: '', perms: ['workscope_manage'] },
|
||||
meta: { title: '工作类别', icon: '', perms: ['workscope_manage'] }
|
||||
},
|
||||
{
|
||||
path: 'testpaper',
|
||||
|
@ -220,42 +240,42 @@ export const asyncRoutes = [
|
|||
path: 'testrule/create',
|
||||
name: 'CreateRule',
|
||||
component: () => import('@/views/examtest/rulecreate.vue'),
|
||||
meta: { title: '新建试卷结构', noCache: true, icon: '', perms: ['testrule_add']},
|
||||
meta: { title: '新建试卷结构', noCache: true, icon: '', perms: ['testrule_add'] },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'testrule/update',
|
||||
name: 'UpdateRule',
|
||||
component: () => import('@/views/examtest/ruleupdate.vue'),
|
||||
meta: { title: '编辑试卷结构', noCache: true, icon: '', perms: ['testrule_update']},
|
||||
meta: { title: '编辑试卷结构', noCache: true, icon: '', perms: ['testrule_update'] },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'workscope/create',
|
||||
name: 'CreateWorkscope',
|
||||
component: () => import('@/views/examtest/workscopecreate.vue'),
|
||||
meta: { title: '新建工作类别', noCache: true, icon: '', perms: ['workscope_add']},
|
||||
meta: { title: '新建工作类别', noCache: true, icon: '', perms: ['workscope_add'] },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'workscope/update',
|
||||
name: 'UpdateWorkscope',
|
||||
component: () => import('@/views/examtest/workscopeupdate.vue'),
|
||||
meta: { title: '编辑工作类别', noCache: true, icon: '', perms: ['workscope_update']},
|
||||
meta: { title: '编辑工作类别', noCache: true, icon: '', perms: ['workscope_update'] },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'paper/create',
|
||||
name: 'CreatePaper',
|
||||
component: () => import('@/views/examtest/papercreate.vue'),
|
||||
meta: { title: '新建押题试卷', noCache: true, icon: '', perms: ['paper_add']},
|
||||
meta: { title: '新建押题试卷', noCache: true, icon: '', perms: ['paper_add'] },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'paper/update',
|
||||
name: 'UpdatePaper',
|
||||
component: () => import('@/views/examtest/paperupdate.vue'),
|
||||
meta: { title: '编辑押题试卷', noCache: true, icon: '', perms: ['paper_update']},
|
||||
meta: { title: '编辑押题试卷', noCache: true, icon: '', perms: ['paper_update'] },
|
||||
hidden: true
|
||||
}
|
||||
]
|
||||
|
@ -265,7 +285,7 @@ export const asyncRoutes = [
|
|||
component: Layout,
|
||||
redirect: '/exammanage/index',
|
||||
name: 'Exammanage',
|
||||
meta: { title: '考证管理', icon: 'component'},
|
||||
meta: { title: '考证管理', icon: 'component' },
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
|
@ -286,7 +306,7 @@ export const asyncRoutes = [
|
|||
component: Layout,
|
||||
redirect: '/threshold/source',
|
||||
name: 'Threshold',
|
||||
meta: { title: '阈值库', icon: 'component'},
|
||||
meta: { title: '阈值库', icon: 'component', perms: ['threshold_view']},
|
||||
children: [
|
||||
{
|
||||
path: 'source',
|
||||
|
@ -301,7 +321,7 @@ export const asyncRoutes = [
|
|||
component: Layout,
|
||||
redirect: '/analyse/examtest',
|
||||
name: 'Analyse',
|
||||
meta: { title: '统计分析', icon: 'chart', perms: ['examtest_view']},
|
||||
meta: { title: '统计分析', icon: 'chart', perms: ['examtest_view'] },
|
||||
children: [
|
||||
{
|
||||
path: 'examtest',
|
||||
|
@ -344,7 +364,7 @@ export const asyncRoutes = [
|
|||
component: Layout,
|
||||
redirect: '/system/admin',
|
||||
name: 'System',
|
||||
meta: { title: '系统管理', icon: 'tree', perms:[] },
|
||||
meta: { title: '系统管理', icon: 'tree', perms: [] },
|
||||
children: [
|
||||
{
|
||||
path: 'banner',
|
||||
|
@ -369,7 +389,7 @@ export const asyncRoutes = [
|
|||
name: 'Msg',
|
||||
component: () => import('@/views/system/msg'),
|
||||
meta: { title: '短信发送', icon: '', perms: ['msg_view'] }
|
||||
},
|
||||
}
|
||||
// {
|
||||
// path: 'user/password',
|
||||
// name: 'ChangePassword',
|
||||
|
@ -385,15 +405,15 @@ export const asyncRoutes = [
|
|||
redirect: '/changepassword',
|
||||
name: 'ChangePW',
|
||||
meta: { title: '修改密码', icon: 'tree' },
|
||||
hidden:true,
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'ChangePassword',
|
||||
component: () => import('@/views/system/changepassword'),
|
||||
meta: { title: '修改密码', noCache: true, icon: ''},
|
||||
meta: { title: '修改密码', noCache: true, icon: '' },
|
||||
hidden: true
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
// 404 page must be placed at the end !!!
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card v-if="checkPermission(['company_view'])">
|
||||
<div slot="header" class="clearfix">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>单位</span>
|
||||
</div>
|
||||
<el-table
|
||||
<el-table
|
||||
v-loading="listLoadingc"
|
||||
:data="tableDatac.results"
|
||||
style="width: 100%;"
|
||||
border
|
||||
fit
|
||||
v-loading="listLoadingc"
|
||||
highlight-current-row
|
||||
height="160"
|
||||
row-key="id"
|
||||
@row-click = 'handleCompanyClick'
|
||||
@row-click="handleCompanyClick"
|
||||
>
|
||||
<el-table-column label="单位名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
|
@ -93,7 +93,7 @@
|
|||
end-placeholder="结束日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
:picker-options="pickerOptions"
|
||||
></el-date-picker>
|
||||
/>
|
||||
<!-- <el-select
|
||||
v-model="listQuery.is_paid"
|
||||
placeholder="是否缴费"
|
||||
|
@ -126,21 +126,21 @@
|
|||
</div>
|
||||
<div style="margin-top:10px">
|
||||
|
||||
<el-button type="primary" @click="handleAddUser" icon="el-icon-plus">新增</el-button>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleAddUser">新增</el-button>
|
||||
<el-popover
|
||||
v-if="checkPermission(['consumer_import'])"
|
||||
v-model="popovervisible"
|
||||
type="primary"
|
||||
placement="top"
|
||||
width="160"
|
||||
v-if="checkPermission(['consumer_import'])"
|
||||
v-model="popovervisible"
|
||||
>
|
||||
<p>导入用户前,请下载模板并按格式录入.</p>
|
||||
<div style="text-align: left; margin: 0;">
|
||||
<el-link
|
||||
href="/media/muban/user.xlsx"
|
||||
target="_blank"
|
||||
@click="popovervisible = false"
|
||||
type="primary"
|
||||
@click="popovervisible = false"
|
||||
>下载模板</el-link>
|
||||
<el-upload
|
||||
:action="upUrl"
|
||||
|
@ -155,20 +155,20 @@
|
|||
<el-button slot="reference" icon="el-icon-upload2">Excel导入</el-button>
|
||||
</el-popover>
|
||||
<el-button
|
||||
v-if="checkPermission(['consumer__export'])"
|
||||
type="primary"
|
||||
icon="el-icon-download"
|
||||
@click="exportConsumer"
|
||||
v-if="checkPermission(['consumer__export'])"
|
||||
>导出Excel</el-button>
|
||||
<el-button
|
||||
v-if="checkPermission(['consumer__deletes'])"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDeletes"
|
||||
v-if="checkPermission(['consumer__deletes'])"
|
||||
>批量删除</el-button>
|
||||
<el-button
|
||||
@click="handleUpdateends"
|
||||
v-if="checkPermission(['consumer_exceeddates'])"
|
||||
@click="handleUpdateends"
|
||||
>批量修改到期</el-button>
|
||||
<!-- <el-button
|
||||
type="primary"
|
||||
|
@ -186,17 +186,17 @@
|
|||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="consumerList"
|
||||
style="width: 100%;margin-top:10px;"
|
||||
border
|
||||
fit
|
||||
v-loading="listLoading"
|
||||
highlight-current-row
|
||||
height="400"
|
||||
@sort-change="changeSort"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="姓名">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
|
@ -226,7 +226,7 @@
|
|||
<el-tag v-if="scope.row.workscope_name">{{ scope.row.workscope_name }}</el-tag>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="创建信息" sortable="custom" prop="create_time" v-if="showCreate" >
|
||||
<el-table-column v-if="showCreate" label="创建信息" sortable="custom" prop="create_time">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.create_admin_">{{ scope.row.create_admin_.username }}/</span>
|
||||
<span>{{ scope.row.create_time.substring(0,10) }}</span>
|
||||
|
@ -239,24 +239,24 @@
|
|||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
v-if="checkPermission(['consumer_update'])"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleEdit(scope)"
|
||||
icon="el-icon-edit"
|
||||
v-if="checkPermission(['consumer_update'])"
|
||||
></el-button>
|
||||
@click="handleEdit(scope)"
|
||||
/>
|
||||
<el-button
|
||||
v-if="checkPermission(['consumer_delete'])"
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="handleDelete(scope)"
|
||||
icon="el-icon-delete"
|
||||
v-if="checkPermission(['consumer_delete'])"
|
||||
></el-button>
|
||||
@click="handleDelete(scope)"
|
||||
/>
|
||||
<el-button
|
||||
v-if="scope.row.username&&scope.row.openid&&checkPermission(['consumer_unbind'])"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleUnbind(scope)"
|
||||
v-if="scope.row.username&&scope.row.openid&&checkPermission(['consumer_unbind'])"
|
||||
>解微</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
|
@ -271,24 +271,24 @@
|
|||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
<el-dialog :visible.sync="dateVisible" title='修改截止期限'>
|
||||
<el-dialog :visible.sync="dateVisible" title="修改截止期限">
|
||||
<el-date-picker
|
||||
v-model="exceed_date"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
value-format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
value-format="yyyy-MM-dd"
|
||||
/>
|
||||
<div style="text-align:right;">
|
||||
<el-button type="primary" @click="confirmupdateend">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑用户':'新增用户'">
|
||||
<el-form
|
||||
ref="consumerForm"
|
||||
:model="consumer"
|
||||
label-width="80px"
|
||||
label-position="right"
|
||||
:rules="rule1"
|
||||
ref="consumerForm"
|
||||
>
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input v-model="consumer.name" placeholder="姓名" />
|
||||
|
@ -297,8 +297,8 @@
|
|||
<el-input v-model="consumer.username" placeholder="手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="company">
|
||||
<el-input placeholder="单位" v-model="consumer.company_.name" readonly>
|
||||
<el-button slot="append" icon="el-icon-search" @click="choose()"></el-button>
|
||||
<el-input v-model="consumer.company_.name" placeholder="单位" readonly>
|
||||
<el-button slot="append" icon="el-icon-search" @click="choose()" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位(自填)" prop="companyname">
|
||||
|
@ -311,7 +311,7 @@
|
|||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工作类别" prop="workscope">
|
||||
|
@ -321,7 +321,7 @@
|
|||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户类型" prop="role">
|
||||
|
@ -331,7 +331,7 @@
|
|||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="账号过期" prop="exceed_date">
|
||||
|
@ -339,12 +339,27 @@
|
|||
v-model="consumer.exceed_date"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
value-format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
value-format="yyyy-MM-dd"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号" prop="ID_number1">
|
||||
<el-input v-model="consumer.ID_number1" placeholder="身份证号" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="头像" prop="avatar">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="upUrl"
|
||||
accept="image/jpeg, image/gif, image/png, image/bmp"
|
||||
:show-file-list="false"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
:headers="upHeaders"
|
||||
>
|
||||
<img v-if="consumer.avatar" :src="consumer.avatar" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="text-align:right;">
|
||||
<el-button type="danger" @click="dialogVisible=false">取消</el-button>
|
||||
|
@ -358,7 +373,7 @@
|
|||
width="80%"
|
||||
:append-to-body="true"
|
||||
>
|
||||
<Companychose ref="Companychose" @handleChose="chooseComplete"></Companychose>
|
||||
<Companychose ref="Companychose" @handleChose="chooseComplete" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -375,50 +390,47 @@ import {
|
|||
unbindConsumer,
|
||||
getConsumerRoleAll,
|
||||
updateendConsumers
|
||||
} from "@/api/crm";
|
||||
import { getSubjectAll } from "@/api/question";
|
||||
import { getWorkScopeAll } from "@/api/examtest";
|
||||
import { getCompanyList } from "@/api/crm";
|
||||
import { genTree, deepClone } from "@/utils";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import { upUrl } from "@/api/file";
|
||||
import { getUserList } from "@/api/user";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
import Companychose from "@/views/crm/companychose";
|
||||
} from '@/api/crm'
|
||||
import { getSubjectAll } from '@/api/question'
|
||||
import { getWorkScopeAll } from '@/api/examtest'
|
||||
import { getCompanyList } from '@/api/crm'
|
||||
import { genTree, deepClone } from '@/utils'
|
||||
import checkPermission from '@/utils/permission'
|
||||
|
||||
import { upUrl, upHeaders } from '@/api/file'
|
||||
import { getUserList } from '@/api/user'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
|
||||
import Companychose from '@/views/crm/companychose'
|
||||
const defaultConsumer = {
|
||||
id: "",
|
||||
name: "",
|
||||
username: "",
|
||||
id: '',
|
||||
name: '',
|
||||
username: '',
|
||||
company: null,
|
||||
company_: {},
|
||||
subjects: [],
|
||||
workscope: null,
|
||||
role: 3,
|
||||
};
|
||||
avatar: ''
|
||||
}
|
||||
const listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
search: "",
|
||||
};
|
||||
search: ''
|
||||
}
|
||||
export default {
|
||||
components: { Pagination, Companychose },
|
||||
watch: {
|
||||
filterOrgText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dateVisible:false,
|
||||
exceed_date:'',
|
||||
dateVisible: false,
|
||||
exceed_date: '',
|
||||
dgVisiable: false,
|
||||
tableKey: 0,
|
||||
showCreate: true,
|
||||
upUrl: upUrl(),
|
||||
popovervisible: false,
|
||||
consumer: defaultConsumer,
|
||||
upHeaders: { Authorization: "JWT " + getToken() },
|
||||
upHeaders: { Authorization: 'JWT ' + getToken() },
|
||||
consumerList: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
|
@ -426,36 +438,36 @@ export default {
|
|||
listQuery: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
search: "",
|
||||
search: ''
|
||||
},
|
||||
listQueryc: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
search: "",
|
||||
search: ''
|
||||
},
|
||||
tableDatac: {count:0},
|
||||
tableDatac: { count: 0 },
|
||||
enabledOptions: [
|
||||
{ key: "true", display_name: "已缴" },
|
||||
{ key: "false", display_name: "未缴" },
|
||||
{ key: 'true', display_name: '已缴' },
|
||||
{ key: 'false', display_name: '未缴' }
|
||||
],
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
dialogType: 'new',
|
||||
rule1: {
|
||||
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
||||
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
||||
username: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入手机号",
|
||||
trigger: "change",
|
||||
pattern: /^1[3456789]\d{9}$/,
|
||||
},
|
||||
message: '请输入手机号',
|
||||
trigger: 'change',
|
||||
pattern: /^1[3456789]\d{9}$/
|
||||
}
|
||||
],
|
||||
role: [{ required: true, message: "请选择", trigger: "change" }],
|
||||
workscope: [{ required: true, message: "请选择", trigger: "change" }],
|
||||
subjects: [{ required: true, message: "请选择", trigger: "change" }],
|
||||
exceed_date: [{ required: true, message: "请选择", trigger: "change" }],
|
||||
role: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
workscope: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
subjects: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
exceed_date: [{ required: true, message: '请选择', trigger: 'change' }]
|
||||
},
|
||||
filterOrgText: "",
|
||||
filterOrgText: '',
|
||||
treeLoding: false,
|
||||
companyData: [],
|
||||
subjectData: [],
|
||||
|
@ -465,104 +477,119 @@ export default {
|
|||
pickerOptions: {
|
||||
shortcuts: [
|
||||
{
|
||||
text: "最近一天",
|
||||
text: '最近一天',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24);
|
||||
picker.$emit("pick", [start, end]);
|
||||
},
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24)
|
||||
picker.$emit('pick', [start, end])
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "最近一周",
|
||||
text: '最近一周',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
||||
picker.$emit("pick", [start, end]);
|
||||
},
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||||
picker.$emit('pick', [start, end])
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "最近一个月",
|
||||
text: '最近一个月',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||||
picker.$emit("pick", [start, end]);
|
||||
},
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
||||
picker.$emit('pick', [start, end])
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "最近三个月",
|
||||
text: '最近三个月',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
||||
picker.$emit("pick", [start, end]);
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
||||
picker.$emit('pick', [start, end])
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
datevalue: "",
|
||||
adminOptions: [],
|
||||
};
|
||||
datevalue: '',
|
||||
adminOptions: []
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
datevalue: "setTimeRange",
|
||||
filterOrgText(val) {
|
||||
this.$refs.tree.filter(val)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
datevalue: 'setTimeRange'
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getListc();
|
||||
this.getSubjectAll();
|
||||
this.getWorkScopeAll();
|
||||
this.getConsumerRoleAll();
|
||||
this.getAdminOptions();
|
||||
this.getList()
|
||||
this.getListc()
|
||||
this.getSubjectAll()
|
||||
this.getWorkScopeAll()
|
||||
this.getConsumerRoleAll()
|
||||
this.getAdminOptions()
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
handleAvatarSuccess(res, file) {
|
||||
this.consumer.avatar = res.data.path
|
||||
},
|
||||
beforeAvatarUpload(file) {
|
||||
const isLt2M = file.size / 1024 / 1024 < 2
|
||||
if (!isLt2M) {
|
||||
this.$message.error('上传图片大小不能超过 2MB!')
|
||||
}
|
||||
return isLt2M
|
||||
},
|
||||
handleUploadSuccess(res, file) {
|
||||
if (res.code == 200) {
|
||||
const loading = this.$loading({ text: "正在导入中..." });
|
||||
const loading = this.$loading({ text: '正在导入中...' })
|
||||
importConsumer(res.data).then((response) => {
|
||||
loading.close();
|
||||
loading.close()
|
||||
if (response.code == 200) {
|
||||
this.$message({
|
||||
message: "导入成功",
|
||||
type: "success",
|
||||
});
|
||||
this.getList(listQuery);
|
||||
message: '导入成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.getList(listQuery)
|
||||
} else if (response.code == 206) {
|
||||
this.$message({
|
||||
message: "部分未成功" + response.data,
|
||||
type: "success",
|
||||
});
|
||||
this.getList(listQuery);
|
||||
message: '部分未成功' + response.data,
|
||||
type: 'success'
|
||||
})
|
||||
this.getList(listQuery)
|
||||
} else {
|
||||
this.$message.error(response.msg);
|
||||
this.$message.error(response.msg)
|
||||
}
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.$message.error("Excel上传失败!");
|
||||
this.$message.error('Excel上传失败!')
|
||||
}
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
if (!value) return true
|
||||
return data.label.indexOf(value) !== -1
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
this.listLoading = true
|
||||
getConsumerList(this.listQuery).then((response) => {
|
||||
this.consumerList = response.data.results;
|
||||
this.total = response.data.count;
|
||||
this.listLoading = false;
|
||||
});
|
||||
this.consumerList = response.data.results
|
||||
this.total = response.data.count
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getListc() {
|
||||
this.listLoadingc = true;
|
||||
this.listLoadingc = true
|
||||
getCompanyList(this.listQueryc).then((response) => {
|
||||
this.tableDatac = response.data;
|
||||
this.listLoadingc = false;
|
||||
});
|
||||
this.tableDatac = response.data
|
||||
this.listLoadingc = false
|
||||
})
|
||||
},
|
||||
// getCompanyList() {
|
||||
// this.treeLoding = true;
|
||||
|
@ -580,126 +607,126 @@ export default {
|
|||
// },
|
||||
getSubjectAll() {
|
||||
getSubjectAll().then((response) => {
|
||||
this.subjectData = genTree(response.data);
|
||||
});
|
||||
this.subjectData = genTree(response.data)
|
||||
})
|
||||
},
|
||||
getWorkScopeAll() {
|
||||
getWorkScopeAll().then((response) => {
|
||||
this.workscopeData = genTree(response.data);
|
||||
});
|
||||
this.workscopeData = genTree(response.data)
|
||||
})
|
||||
},
|
||||
getConsumerRoleAll() {
|
||||
getConsumerRoleAll().then((response) => {
|
||||
this.roleData = genTree(response.data);
|
||||
});
|
||||
this.roleData = genTree(response.data)
|
||||
})
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
search: "",
|
||||
};
|
||||
this.getList();
|
||||
search: ''
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
this.listQuery.page = 1
|
||||
this.getList()
|
||||
},
|
||||
handleAddUser() {
|
||||
this.consumer = Object.assign({}, defaultConsumer);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.consumer = Object.assign({}, defaultConsumer)
|
||||
this.dialogType = 'new'
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs["consumerForm"].clearValidate();
|
||||
});
|
||||
this.$refs['consumerForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
handleEdit(scope) {
|
||||
this.consumer = Object.assign({}, scope.row); // copy obj
|
||||
this.consumer = Object.assign({}, scope.row) // copy obj
|
||||
if (this.consumer.company_ == null) {
|
||||
this.consumer.company_ = {};
|
||||
this.consumer.company_ = {}
|
||||
}
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
this.dialogType = 'edit'
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs["consumerForm"].clearValidate();
|
||||
});
|
||||
this.$refs['consumerForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
handleUnbind(scope) {
|
||||
this.$confirm("确认解除该账户的微信绑定吗!", "警告", {
|
||||
type: "warning",
|
||||
this.$confirm('确认解除该账户的微信绑定吗!', '警告', {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
unbindConsumer(scope.row.id)
|
||||
.then((res) => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "解绑成功!",
|
||||
});
|
||||
this.getList();
|
||||
type: 'success',
|
||||
message: '解绑成功!'
|
||||
})
|
||||
this.getList()
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
console.error(err)
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
console.error(err)
|
||||
})
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除该用户吗?将丢失数据!", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
this.$confirm('确认删除该用户吗?将丢失数据!', '警告', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'error'
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteConsumer(scope.row.id);
|
||||
this.consumerList.splice(scope.row.index, 1);
|
||||
.then(async() => {
|
||||
await deleteConsumer(scope.row.id)
|
||||
this.consumerList.splice(scope.row.index, 1)
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "成功删除!",
|
||||
});
|
||||
type: 'success',
|
||||
message: '成功删除!'
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
console.error(err)
|
||||
})
|
||||
},
|
||||
handleDeletes() {
|
||||
if (this.selects.length) {
|
||||
this.$confirm(
|
||||
"确认删除这" + this.selects.length + "位用户吗?将丢失数据!",
|
||||
"警告",
|
||||
'确认删除这' + this.selects.length + '位用户吗?将丢失数据!',
|
||||
'警告',
|
||||
{
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'error'
|
||||
}
|
||||
)
|
||||
.then(async () => {
|
||||
const { code } = await deleteConsumers({ ids: this.selects });
|
||||
.then(async() => {
|
||||
const { code } = await deleteConsumers({ ids: this.selects })
|
||||
if (code >= 200) {
|
||||
this.getList();
|
||||
this.getList()
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "成功删除!",
|
||||
});
|
||||
type: 'success',
|
||||
message: '成功删除!'
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
console.error(err)
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
message: "请先选择",
|
||||
type: "warning",
|
||||
});
|
||||
message: '请先选择',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
},
|
||||
async confirmUser(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
const isEdit = this.dialogType === 'edit'
|
||||
if (isEdit) {
|
||||
let consumer = this.consumer;
|
||||
const consumer = this.consumer
|
||||
updateConsumer(this.consumer.id, consumer).then((res) => {
|
||||
// for (let index = 0; index < this.consumerList.length; index++) {
|
||||
// if (this.consumerList[index].id === this.consumer.id) {
|
||||
|
@ -711,71 +738,70 @@ export default {
|
|||
// break;
|
||||
// }
|
||||
// }
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.getList()
|
||||
this.dialogVisible = false
|
||||
this.$message.success('成功')
|
||||
|
||||
});
|
||||
})
|
||||
} else {
|
||||
createConsumer(this.consumer).then((res) => {
|
||||
// this.consumer = res.data
|
||||
// this.consumerList.unshift(this.consumer)
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.getList()
|
||||
this.dialogVisible = false
|
||||
this.$message.success('成功')
|
||||
});
|
||||
})
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
exportConsumer() {
|
||||
const loading = this.$loading();
|
||||
const loading = this.$loading()
|
||||
exportConsumer(this.listQuery).then((response) => {
|
||||
loading.close();
|
||||
window.open(response.data.path, "_blank");
|
||||
}).catch(()=>{loading.close()});
|
||||
loading.close()
|
||||
window.open(response.data.path, '_blank')
|
||||
}).catch(() => { loading.close() })
|
||||
},
|
||||
changeSort(val) {
|
||||
if (val.order == "ascending") {
|
||||
this.listQuery.ordering = val.prop;
|
||||
if (val.order == 'ascending') {
|
||||
this.listQuery.ordering = val.prop
|
||||
} else {
|
||||
this.listQuery.ordering = "-" + val.prop;
|
||||
this.listQuery.ordering = '-' + val.prop
|
||||
}
|
||||
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
let selects = [];
|
||||
const selects = []
|
||||
for (var i = 0; i < val.length; i++) {
|
||||
selects.push(val[i].id);
|
||||
selects.push(val[i].id)
|
||||
}
|
||||
this.selects = selects;
|
||||
this.selects = selects
|
||||
},
|
||||
setTimeRange() {
|
||||
(this.listQuery.min_create = this.datevalue[0]),
|
||||
(this.listQuery.max_create = this.datevalue[1]),
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
getAdminOptions() {
|
||||
if (checkPermission(["admin"])) {
|
||||
getUserList({pageoff:true}).then((res) => {
|
||||
this.adminOptions = res.data;
|
||||
});
|
||||
if (checkPermission(['admin'])) {
|
||||
getUserList({ pageoff: true }).then((res) => {
|
||||
this.adminOptions = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
choose() {
|
||||
this.dgVisiable = true;
|
||||
this.dgVisiable = true
|
||||
},
|
||||
chooseComplete(val) {
|
||||
this.dgVisiable = false;
|
||||
this.dgVisiable = false
|
||||
if (val) {
|
||||
this.consumer.company_ = val;
|
||||
this.consumer.company = val.id;
|
||||
this.consumer.company_ = val
|
||||
this.consumer.company = val.id
|
||||
}
|
||||
},
|
||||
handleCompanyClick(row, column, event){
|
||||
handleCompanyClick(row, column, event) {
|
||||
this.listQuery.company = row.id
|
||||
this.getList()
|
||||
},
|
||||
|
@ -784,22 +810,22 @@ export default {
|
|||
this.dateVisible = true
|
||||
} else {
|
||||
this.$message({
|
||||
message: "请先选择",
|
||||
type: "warning",
|
||||
});
|
||||
message: '请先选择',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
},
|
||||
confirmupdateend(){
|
||||
if(this.exceed_date.length>0){
|
||||
updateendConsumers({ ids: this.selects,exceed_date:this.exceed_date }).then(res=>{
|
||||
confirmupdateend() {
|
||||
if (this.exceed_date.length > 0) {
|
||||
updateendConsumers({ ids: this.selects, exceed_date: this.exceed_date }).then(res => {
|
||||
this.getList()
|
||||
this.dateVisible = false
|
||||
this.$message.success('成功')
|
||||
}).catch(e=>{
|
||||
}).catch(e => {
|
||||
this.dateVisible = false
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -38,12 +38,18 @@
|
|||
<el-table-column label="姓名">
|
||||
<template slot-scope="scope">{{ scope.row.consumer_name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="性别">
|
||||
<template slot-scope="scope">{{ scope.row.gender }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="身份证号">
|
||||
<template slot-scope="scope">{{ scope.row.ID_number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工作类别">
|
||||
<template slot-scope="scope">{{ scope.row.workscope_name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="职业等级">
|
||||
<template slot-scope="scope">{{ scope.row.opllevel }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位">
|
||||
<template slot-scope="scope">{{ scope.row.company_name }}</template>
|
||||
</el-table-column>
|
||||
|
@ -118,6 +124,9 @@
|
|||
<el-form-item label="姓名" prop="consumer_name">
|
||||
<el-input v-model="candidate.consumer_name" placeholder="姓名" />
|
||||
</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-input v-model="candidate.ID_number" placeholder="身份证号" />
|
||||
</el-form-item>
|
||||
|
@ -127,12 +136,11 @@
|
|||
placeholder="工作类别"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="单位" prop="company_name">
|
||||
<el-input v-model="candidate.company_name" placeholder="单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门" prop="deptname">
|
||||
<el-input v-model="candidate.deptname" placeholder="部门" />
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="发证日期" prop="issue_date">
|
||||
|
@ -167,23 +175,18 @@
|
|||
value-format="yyyy-MM-dd"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="照片" prop="photo">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="upUrl"
|
||||
accept="image/jpeg, image/gif, image/png, image/bmp"
|
||||
:show-file-list="false"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
:headers="upHeaders"
|
||||
>
|
||||
<img
|
||||
v-if="candidate.photo"
|
||||
:src="candidate.photo"
|
||||
class="avatar"
|
||||
>
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
||||
</el-upload>
|
||||
<el-form-item label="职业等级" prop="opllevel">
|
||||
<el-select v-model="candidate.opllevel" 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="deptname">
|
||||
<el-input v-model="candidate.deptname" placeholder="部门" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -276,7 +279,15 @@ export default {
|
|||
candidate: { photo: '' },
|
||||
candidateRule: {
|
||||
number: [{ required: true, message: '请输入编号', trigger: 'blur' }]
|
||||
}
|
||||
},
|
||||
typeOption:[
|
||||
{ name: '初级工', value: '初级工' },
|
||||
{ name: '中级工', value: '中级工'},
|
||||
{ name: '高级工', value: '高级工' },
|
||||
{ name: '技师', value: '技师'},
|
||||
{ name: '高级技师', value: '高级技师' }
|
||||
],
|
||||
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
|
@ -322,19 +333,16 @@ export default {
|
|||
},
|
||||
// 气味分析证书展示
|
||||
handleDialogissue(scope) {
|
||||
if(scope.row.photo==null)
|
||||
{
|
||||
if (scope.row.photo == null) {
|
||||
this.$message({
|
||||
message: '请先点击编辑上传证书人员照片!',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
else{
|
||||
})
|
||||
} else {
|
||||
this.dialogVisibleissue = true
|
||||
this.src = 'https://qw.ctc-zc.com' + scope.row.path
|
||||
this.name = scope.row.workscope_name
|
||||
}
|
||||
|
||||
},
|
||||
handleAdd() {
|
||||
this.dialogVisible = true
|
||||
|
@ -375,10 +383,10 @@ export default {
|
|||
},
|
||||
// 下载证书
|
||||
downCandidate() {
|
||||
var a = document.createElement('a');
|
||||
a.href = this.src ;
|
||||
a.download = this.src ;
|
||||
a.target="_blank"
|
||||
var a = document.createElement('a')
|
||||
a.href = this.src
|
||||
a.download = this.src
|
||||
a.target = '_blank'
|
||||
a.click()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<!-- <img class="logo" src="../../assets/logo.png" /> -->
|
||||
</div>
|
||||
<div class="title-container">
|
||||
<h3 class="title">中科辐射小程序后台管理</h3>
|
||||
<h3 class="title">小程序后台管理</h3>
|
||||
</div>
|
||||
<el-form-item prop="username">
|
||||
<span class="svg-container">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div style="margin-top: 10px;">
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="名称/描述"
|
||||
|
@ -17,28 +18,27 @@
|
|||
@click="resetFilter"
|
||||
>刷新重置</el-button>
|
||||
</div>
|
||||
<div style="margin-top:6px">
|
||||
<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-header>
|
||||
<el-main>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="materialList.results"
|
||||
style="width: 100%;margin-top:10px;"
|
||||
style="width: 100%;margin-top:30px;"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="名称">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="scope.row.path"
|
||||
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>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<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 label="分类" prop="cate" />
|
||||
<el-table-column align="header-center" label="排序码">
|
||||
<template slot-scope="scope">{{ scope.row.sort }}</template>
|
||||
</el-table-column>
|
||||
|
@ -82,6 +82,7 @@
|
|||
:limit.sync="listQuery.limit"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-main>
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
:title="dialogType==='update'?'编辑':'新增'"
|
||||
|
@ -117,7 +118,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="description">
|
||||
<el-input-number v-model="material.sort" :min="1"></el-input-number>
|
||||
<el-input-number v-model="material.sort" :min="1" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="封面" prop="poster" v-if="material.type=='视频'">
|
||||
<el-upload
|
||||
|
@ -133,7 +134,7 @@
|
|||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
</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
|
||||
v-if="material.type=='文档'"
|
||||
:on-preview="handlePreview"
|
||||
|
@ -183,8 +184,9 @@
|
|||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
|
@ -215,20 +217,20 @@ import {
|
|||
getMaterialList,
|
||||
createMaterial,
|
||||
updateMaterial,
|
||||
deleteMaterial,
|
||||
} from "@/api/cms";
|
||||
import { upUrl, upHeaders } from "@/api/file";
|
||||
import Pagination from "@/components/Pagination";
|
||||
import checkPermission from "@/utils/permission";
|
||||
deleteMaterial
|
||||
} from '@/api/cms'
|
||||
import { upUrl, upHeaders } from '@/api/file'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import checkPermission from '@/utils/permission'
|
||||
const defaultmaterial = {
|
||||
id: null,
|
||||
name: null,
|
||||
description: null,
|
||||
path: null,
|
||||
poster: null,
|
||||
type: "文档",
|
||||
cate:null,
|
||||
};
|
||||
type: '文档',
|
||||
cate: null
|
||||
}
|
||||
export default {
|
||||
components: { Pagination },
|
||||
data() {
|
||||
|
@ -240,143 +242,143 @@ export default {
|
|||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
limit: 20
|
||||
},
|
||||
cateData:['标准文件','文献','指南'],
|
||||
cateData: ['标准文件', '文献', '指南'],
|
||||
dialogVisible: false,
|
||||
dialogType: "create",
|
||||
dialogType: 'create',
|
||||
rule1: {
|
||||
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
||||
path: [{ required: true, message: "请上传文件", trigger: "blur" }],
|
||||
cate: [{ required: true, message: "请选择文件分类", trigger: "blur" }],
|
||||
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
||||
path: [{ required: true, message: '请上传文件', trigger: 'blur' }],
|
||||
cate: [{ required: true, message: '请选择文件分类', trigger: 'blur' }]
|
||||
},
|
||||
fileList: [],
|
||||
videoFlag:false,
|
||||
upVideoPercent:0
|
||||
};
|
||||
videoFlag: false,
|
||||
upVideoPercent: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
this.listLoading = true
|
||||
getMaterialList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.materialList = response.data;
|
||||
this.materialList = response.data
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
};
|
||||
this.getList();
|
||||
limit: 20
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
this.listQuery.page = 1
|
||||
this.getList()
|
||||
},
|
||||
handleDelete(scope) {
|
||||
deleteMaterial(scope.row.id).then((res) => {
|
||||
this.getList();
|
||||
});
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
handleCreate(val) {
|
||||
this.material = Object.assign({}, defaultmaterial);
|
||||
this.material.type = val;
|
||||
this.fileList = [];
|
||||
this.dialogType = "create";
|
||||
this.dialogVisible = true;
|
||||
this.material = Object.assign({}, defaultmaterial)
|
||||
this.material.type = val
|
||||
this.fileList = []
|
||||
this.dialogType = 'create'
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
this.$refs['Form'].clearValidate()
|
||||
})
|
||||
},
|
||||
handleUpdate(scope) {
|
||||
this.material = Object.assign({}, scope.row); // copy obj
|
||||
this.material = Object.assign({}, scope.row) // copy obj
|
||||
if (this.material.path) {
|
||||
this.fileList = [
|
||||
{
|
||||
name:
|
||||
this.material.name +
|
||||
"." +
|
||||
this.material.path.split(".")[
|
||||
this.material.path.split(".").length - 1
|
||||
'.' +
|
||||
this.material.path.split('.')[
|
||||
this.material.path.split('.').length - 1
|
||||
],
|
||||
url: this.material.path,
|
||||
},
|
||||
];
|
||||
url: this.material.path
|
||||
}
|
||||
this.dialogType = "update";
|
||||
this.dialogVisible = true;
|
||||
]
|
||||
}
|
||||
this.dialogType = 'update'
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
this.$refs['Form'].clearValidate()
|
||||
})
|
||||
},
|
||||
handlePreview(file) {
|
||||
if ("url" in file) {
|
||||
window.open(file.url);
|
||||
if ('url' in file) {
|
||||
window.open(file.url)
|
||||
} else {
|
||||
window.open(file.response.data.path);
|
||||
window.open(file.response.data.path)
|
||||
}
|
||||
},
|
||||
beforeUploadP(file) {
|
||||
const isLt1M = file.size / 1024 / 1024 < 1;
|
||||
const isLt1M = file.size / 1024 / 1024 < 1
|
||||
if (!isLt1M) {
|
||||
this.$message.error("上传封面大小不能超过 1MB!");
|
||||
this.$message.error('上传封面大小不能超过 1MB!')
|
||||
}
|
||||
return isLt1M;
|
||||
return isLt1M
|
||||
},
|
||||
beforeUploadV(file) {
|
||||
const isLt1M = file.size / 1024 / 1024 < 100;
|
||||
const isLt1M = file.size / 1024 / 1024 < 100
|
||||
if (!isLt1M) {
|
||||
this.$message.error("上传视频大小不能超过 100MB!");
|
||||
this.$message.error('上传视频大小不能超过 100MB!')
|
||||
}
|
||||
return isLt1M;
|
||||
return isLt1M
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.material.path = response.data.path;
|
||||
this.material.path = response.data.path
|
||||
},
|
||||
handleSuccessV(response, file, fileList) {
|
||||
this.videoFlag = false
|
||||
this.material.path = response.data.path;
|
||||
this.material.path = response.data.path
|
||||
},
|
||||
handleSuccessP(response, file, fileList) {
|
||||
this.material.poster = response.data.path;
|
||||
this.material.poster = response.data.path
|
||||
},
|
||||
upVideoProgess(event, file, fileList){
|
||||
this.videoFlag = true;
|
||||
this.upVideoPercent = file.percentage.toFixed(0);
|
||||
upVideoProgess(event, file, fileList) {
|
||||
this.videoFlag = true
|
||||
this.upVideoPercent = file.percentage.toFixed(0)
|
||||
},
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "update";
|
||||
const isEdit = this.dialogType === 'update'
|
||||
if (isEdit) {
|
||||
updateMaterial(this.material.id, this.material).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.getList()
|
||||
this.dialogVisible = false
|
||||
this.$message.success('成功')
|
||||
}
|
||||
});
|
||||
})
|
||||
} else {
|
||||
createMaterial(this.material)
|
||||
.then((res) => {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.getList()
|
||||
this.dialogVisible = false
|
||||
this.$message.success('成功')
|
||||
})
|
||||
.catch((error) => {});
|
||||
.catch((error) => {})
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
<el-table-column align="left" label="标题">
|
||||
<template slot-scope="scope">{{ scope.row.title }}</template>
|
||||
</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="来源">
|
||||
<template slot-scope="scope">{{ scope.row.ifrom }}</template>
|
||||
</el-table-column>
|
||||
|
@ -107,10 +110,13 @@ export default {
|
|||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
type_: {1:"技能大赛",2:"铺装工匠",3:"培训信息",4:"大赛信息"},
|
||||
|
||||
listQuery: Object.assign({}, listQuery),
|
||||
tableData: {
|
||||
count:0,
|
||||
results:[],
|
||||
|
||||
},
|
||||
listLoading: true,
|
||||
};
|
||||
|
|
|
@ -2,26 +2,37 @@
|
|||
<div class="app-container">
|
||||
<div>
|
||||
<el-form
|
||||
ref="Form"
|
||||
:model="Form"
|
||||
:rules="rules"
|
||||
ref="Form"
|
||||
label-width="100px"
|
||||
status-icon
|
||||
>
|
||||
<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 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-input v-model="Form.ifrom" style="width: 80%"></el-input>
|
||||
<el-input v-model="Form.ifrom" style="width: 80%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="外部链接" prop="elink" >
|
||||
<el-input v-model="Form.elink" style="width: 80%"></el-input>
|
||||
<el-form-item label="外部链接" prop="elink">
|
||||
<el-input v-model="Form.elink" style="width: 80%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="内容" prop="content" v-show="is_show">
|
||||
<tinymce v-model="Form.content" :height="400" width="80%"/>
|
||||
|
||||
<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" @click="submitForm('Form')" :loading="submitLoding">立即创建</el-button>
|
||||
<el-button type="primary" :loading="submitLoding" @click="submitForm('Form')">立即创建</el-button>
|
||||
<el-button type="warning" @click="goBack()">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -32,35 +43,41 @@
|
|||
|
||||
<script>
|
||||
import Tinymce from '@/components/Tinymce'
|
||||
import {createArticle} from "@/api/cms";
|
||||
import { createArticle } from '@/api/cms'
|
||||
|
||||
export default {
|
||||
name: 'TinymceDemo',
|
||||
components: { Tinymce },
|
||||
data() {
|
||||
return {
|
||||
Form:{
|
||||
title:'',
|
||||
ifrom:'',
|
||||
elink:'',
|
||||
content:''
|
||||
typeOption: [
|
||||
{ name: '技能大赛', value: 1 },
|
||||
{ name: '铺装工匠', value: 2 },
|
||||
{ name: '培训信息', value: 3 },
|
||||
{ name: '大赛信息', value: 4 }
|
||||
],
|
||||
Form: {
|
||||
title: '',
|
||||
ifrom: '',
|
||||
elink: '',
|
||||
content: ''
|
||||
},
|
||||
submitLoding: false,
|
||||
rules: {
|
||||
title: [
|
||||
{ required: true, message: "请输入", trigger: "blur" }
|
||||
{ required: true, message: '请输入', trigger: 'blur' }
|
||||
],
|
||||
ifrom: [
|
||||
{ required: true, message: "请输入", trigger: "blur" }
|
||||
],
|
||||
{ required: true, message: '请输入', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
is_show: true
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'Form.elink':'showEditor'
|
||||
watch: {
|
||||
'Form.elink': 'showEditor'
|
||||
},
|
||||
methods:{
|
||||
methods: {
|
||||
goBack() {
|
||||
this.$router.go(-1)
|
||||
},
|
||||
|
@ -70,26 +87,24 @@ export default {
|
|||
// this.submitLoding = true
|
||||
createArticle(this.Form).then(response => {
|
||||
this.submitLoding = false
|
||||
if(response.code >= 200){
|
||||
if (response.code >= 200) {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "新建成功!"
|
||||
});
|
||||
type: 'success',
|
||||
message: '新建成功!'
|
||||
})
|
||||
this.goBack()
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
showEditor(){
|
||||
if(this.Form.elink){
|
||||
showEditor() {
|
||||
if (this.Form.elink) {
|
||||
this.Form.content = ''
|
||||
this.is_show = false
|
||||
}else{
|
||||
} else {
|
||||
this.is_show = true
|
||||
}
|
||||
}
|
||||
|
@ -97,5 +112,3 @@ export default {
|
|||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,16 @@
|
|||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="Form.title" style="width: 80%"></el-input>
|
||||
</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-input v-model="Form.ifrom" style="width: 80%"></el-input>
|
||||
</el-form-item>
|
||||
|
@ -45,6 +55,12 @@ export default {
|
|||
elink:'',
|
||||
content:''
|
||||
},
|
||||
typeOption: [
|
||||
{ name: '技能大赛', value: 1 },
|
||||
{ name: '铺装工匠', value: 2 },
|
||||
{ name: '培训信息', value: 3 },
|
||||
{ name: '大赛信息', value: 4 }
|
||||
],
|
||||
submitLoding: false,
|
||||
rules: {
|
||||
title: [
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div style="margin-top:10px" >
|
||||
地坪技能大赛详细信心
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
|
@ -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>
|
Loading…
Reference in New Issue