地坪项目

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

@ -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'
}) })
} }
@ -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: '/',
@ -95,6 +96,25 @@ export const asyncRoutes = [
} }
] ]
}, },
// 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,
@ -202,13 +222,13 @@ export const asyncRoutes = [
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',
@ -286,7 +306,7 @@ 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',
@ -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',
@ -393,7 +413,7 @@ export const asyncRoutes = [
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

@ -5,15 +5,15 @@
<span>单位</span> <span>单位</span>
</div> </div>
<el-table <el-table
v-loading="listLoadingc"
:data="tableDatac.results" :data="tableDatac.results"
style="width: 100%;" style="width: 100%;"
border border
fit fit
v-loading="listLoadingc"
highlight-current-row highlight-current-row
height="160" height="160"
row-key="id" row-key="id"
@row-click = 'handleCompanyClick' @row-click="handleCompanyClick"
> >
<el-table-column label="单位名称"> <el-table-column label="单位名称">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
@ -93,7 +93,7 @@
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
:picker-options="pickerOptions" :picker-options="pickerOptions"
></el-date-picker> />
<!-- <el-select <!-- <el-select
v-model="listQuery.is_paid" v-model="listQuery.is_paid"
placeholder="是否缴费" placeholder="是否缴费"
@ -126,21 +126,21 @@
</div> </div>
<div style="margin-top:10px"> <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 <el-popover
v-if="checkPermission(['consumer_import'])"
v-model="popovervisible"
type="primary" type="primary"
placement="top" placement="top"
width="160" width="160"
v-if="checkPermission(['consumer_import'])"
v-model="popovervisible"
> >
<p>导入用户前,请下载模板并按格式录入.</p> <p>导入用户前,请下载模板并按格式录入.</p>
<div style="text-align: left; margin: 0;"> <div style="text-align: left; margin: 0;">
<el-link <el-link
href="/media/muban/user.xlsx" href="/media/muban/user.xlsx"
target="_blank" target="_blank"
@click="popovervisible = false"
type="primary" type="primary"
@click="popovervisible = false"
>下载模板</el-link> >下载模板</el-link>
<el-upload <el-upload
:action="upUrl" :action="upUrl"
@ -155,20 +155,20 @@
<el-button slot="reference" icon="el-icon-upload2">Excel导入</el-button> <el-button slot="reference" icon="el-icon-upload2">Excel导入</el-button>
</el-popover> </el-popover>
<el-button <el-button
v-if="checkPermission(['consumer__export'])"
type="primary" type="primary"
icon="el-icon-download" icon="el-icon-download"
@click="exportConsumer" @click="exportConsumer"
v-if="checkPermission(['consumer__export'])"
>导出Excel</el-button> >导出Excel</el-button>
<el-button <el-button
v-if="checkPermission(['consumer__deletes'])"
type="danger" type="danger"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDeletes" @click="handleDeletes"
v-if="checkPermission(['consumer__deletes'])"
>批量删除</el-button> >批量删除</el-button>
<el-button <el-button
@click="handleUpdateends"
v-if="checkPermission(['consumer_exceeddates'])" v-if="checkPermission(['consumer_exceeddates'])"
@click="handleUpdateends"
>批量修改到期</el-button> >批量修改到期</el-button>
<!-- <el-button <!-- <el-button
type="primary" type="primary"
@ -186,17 +186,17 @@
</div> </div>
<el-table <el-table
v-loading="listLoading"
:data="consumerList" :data="consumerList"
style="width: 100%;margin-top:10px;" style="width: 100%;margin-top:10px;"
border border
fit fit
v-loading="listLoading"
highlight-current-row highlight-current-row
height="400" height="400"
@sort-change="changeSort" @sort-change="changeSort"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55"></el-table-column> <el-table-column type="selection" width="55" />
<el-table-column label="姓名"> <el-table-column label="姓名">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
@ -226,7 +226,7 @@
<el-tag v-if="scope.row.workscope_name">{{ scope.row.workscope_name }}</el-tag> <el-tag v-if="scope.row.workscope_name">{{ scope.row.workscope_name }}</el-tag>
</template> </template>
</el-table-column> --> </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"> <template slot-scope="scope">
<span v-if="scope.row.create_admin_">{{ scope.row.create_admin_.username }}/</span> <span v-if="scope.row.create_admin_">{{ scope.row.create_admin_.username }}/</span>
<span>{{ scope.row.create_time.substring(0,10) }}</span> <span>{{ scope.row.create_time.substring(0,10) }}</span>
@ -239,24 +239,24 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button-group> <el-button-group>
<el-button <el-button
v-if="checkPermission(['consumer_update'])"
type="primary" type="primary"
size="small" size="small"
@click="handleEdit(scope)"
icon="el-icon-edit" icon="el-icon-edit"
v-if="checkPermission(['consumer_update'])" @click="handleEdit(scope)"
></el-button> />
<el-button <el-button
v-if="checkPermission(['consumer_delete'])"
type="danger" type="danger"
size="small" size="small"
@click="handleDelete(scope)"
icon="el-icon-delete" icon="el-icon-delete"
v-if="checkPermission(['consumer_delete'])" @click="handleDelete(scope)"
></el-button> />
<el-button <el-button
v-if="scope.row.username&&scope.row.openid&&checkPermission(['consumer_unbind'])"
type="primary" type="primary"
size="small" size="small"
@click="handleUnbind(scope)" @click="handleUnbind(scope)"
v-if="scope.row.username&&scope.row.openid&&checkPermission(['consumer_unbind'])"
>解微</el-button> >解微</el-button>
</el-button-group> </el-button-group>
</template> </template>
@ -271,24 +271,24 @@
@pagination="getList" @pagination="getList"
/> />
</el-card> </el-card>
<el-dialog :visible.sync="dateVisible" title='修改截止期限'> <el-dialog :visible.sync="dateVisible" title="修改截止期限">
<el-date-picker <el-date-picker
v-model="exceed_date" v-model="exceed_date"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
value-format="yyyy-MM-dd"> value-format="yyyy-MM-dd"
</el-date-picker> />
<div style="text-align:right;"> <div style="text-align:right;">
<el-button type="primary" @click="confirmupdateend">确认</el-button> <el-button type="primary" @click="confirmupdateend">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑用户':'新增用户'"> <el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑用户':'新增用户'">
<el-form <el-form
ref="consumerForm"
:model="consumer" :model="consumer"
label-width="80px" label-width="80px"
label-position="right" label-position="right"
:rules="rule1" :rules="rule1"
ref="consumerForm"
> >
<el-form-item label="姓名" prop="name"> <el-form-item label="姓名" prop="name">
<el-input v-model="consumer.name" placeholder="姓名" /> <el-input v-model="consumer.name" placeholder="姓名" />
@ -297,8 +297,8 @@
<el-input v-model="consumer.username" placeholder="手机号" /> <el-input v-model="consumer.username" placeholder="手机号" />
</el-form-item> </el-form-item>
<el-form-item label="单位" prop="company"> <el-form-item label="单位" prop="company">
<el-input placeholder="单位" v-model="consumer.company_.name" readonly> <el-input v-model="consumer.company_.name" placeholder="单位" readonly>
<el-button slot="append" icon="el-icon-search" @click="choose()"></el-button> <el-button slot="append" icon="el-icon-search" @click="choose()" />
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="单位(自填)" prop="companyname"> <el-form-item label="单位(自填)" prop="companyname">
@ -311,7 +311,7 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="工作类别" prop="workscope"> <el-form-item label="工作类别" prop="workscope">
@ -321,7 +321,7 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="用户类型" prop="role"> <el-form-item label="用户类型" prop="role">
@ -331,7 +331,7 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
></el-option> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="账号过期" prop="exceed_date"> <el-form-item label="账号过期" prop="exceed_date">
@ -339,12 +339,27 @@
v-model="consumer.exceed_date" v-model="consumer.exceed_date"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
value-format="yyyy-MM-dd"> value-format="yyyy-MM-dd"
</el-date-picker> />
</el-form-item> </el-form-item>
<el-form-item label="身份证号" prop="ID_number1"> <el-form-item label="身份证号" prop="ID_number1">
<el-input v-model="consumer.ID_number1" placeholder="身份证号" /> <el-input v-model="consumer.ID_number1" placeholder="身份证号" />
</el-form-item> </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> </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>
@ -358,7 +373,7 @@
width="80%" width="80%"
:append-to-body="true" :append-to-body="true"
> >
<Companychose ref="Companychose" @handleChose="chooseComplete"></Companychose> <Companychose ref="Companychose" @handleChose="chooseComplete" />
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -375,39 +390,36 @@ import {
unbindConsumer, unbindConsumer,
getConsumerRoleAll, getConsumerRoleAll,
updateendConsumers updateendConsumers
} from "@/api/crm"; } from '@/api/crm'
import { getSubjectAll } from "@/api/question"; import { getSubjectAll } from '@/api/question'
import { getWorkScopeAll } from "@/api/examtest"; import { getWorkScopeAll } from '@/api/examtest'
import { getCompanyList } from "@/api/crm"; import { getCompanyList } from '@/api/crm'
import { genTree, deepClone } from "@/utils"; import { genTree, deepClone } from '@/utils'
import checkPermission from "@/utils/permission"; import checkPermission from '@/utils/permission'
import { upUrl } from "@/api/file";
import { getUserList } from "@/api/user"; import { upUrl, upHeaders } from '@/api/file'
import { getToken } from "@/utils/auth"; import { getUserList } from '@/api/user'
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import { getToken } from '@/utils/auth'
import Companychose from "@/views/crm/companychose"; import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import Companychose from '@/views/crm/companychose'
const defaultConsumer = { const defaultConsumer = {
id: "", id: '',
name: "", name: '',
username: "", username: '',
company: null, company: null,
company_: {}, company_: {},
subjects: [], subjects: [],
workscope: null, workscope: null,
role: 3, role: 3,
}; avatar: ''
}
const listQuery = { const listQuery = {
page: 1, page: 1,
limit: 20, limit: 20,
search: "", search: ''
}; }
export default { export default {
components: { Pagination, Companychose }, components: { Pagination, Companychose },
watch: {
filterOrgText(val) {
this.$refs.tree.filter(val);
},
},
data() { data() {
return { return {
dateVisible: false, dateVisible: false,
@ -418,7 +430,7 @@ export default {
upUrl: upUrl(), upUrl: upUrl(),
popovervisible: false, popovervisible: false,
consumer: defaultConsumer, consumer: defaultConsumer,
upHeaders: { Authorization: "JWT " + getToken() }, upHeaders: { Authorization: 'JWT ' + getToken() },
consumerList: [], consumerList: [],
total: 0, total: 0,
listLoading: true, listLoading: true,
@ -426,36 +438,36 @@ export default {
listQuery: { listQuery: {
page: 1, page: 1,
limit: 20, limit: 20,
search: "", search: ''
}, },
listQueryc: { listQueryc: {
page: 1, page: 1,
limit: 20, limit: 20,
search: "", search: ''
}, },
tableDatac: { count: 0 }, tableDatac: { count: 0 },
enabledOptions: [ enabledOptions: [
{ key: "true", display_name: "已缴" }, { key: 'true', display_name: '已缴' },
{ key: "false", display_name: "未缴" }, { key: 'false', display_name: '未缴' }
], ],
dialogVisible: false, dialogVisible: false,
dialogType: "new", dialogType: 'new',
rule1: { rule1: {
name: [{ required: true, message: "请输入姓名", trigger: "blur" }], name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
username: [ username: [
{ {
required: true, required: true,
message: "请输入手机号", message: '请输入手机号',
trigger: "change", trigger: 'change',
pattern: /^1[3456789]\d{9}$/, pattern: /^1[3456789]\d{9}$/
}, }
], ],
role: [{ required: true, message: "请选择", trigger: "change" }], role: [{ required: true, message: '请选择', trigger: 'change' }],
workscope: [{ required: true, message: "请选择", trigger: "change" }], workscope: [{ required: true, message: '请选择', trigger: 'change' }],
subjects: [{ required: true, message: "请选择", trigger: "change" }], subjects: [{ required: true, message: '请选择', trigger: 'change' }],
exceed_date: [{ required: true, message: "请选择", trigger: "change" }], exceed_date: [{ required: true, message: '请选择', trigger: 'change' }]
}, },
filterOrgText: "", filterOrgText: '',
treeLoding: false, treeLoding: false,
companyData: [], companyData: [],
subjectData: [], subjectData: [],
@ -465,104 +477,119 @@ export default {
pickerOptions: { pickerOptions: {
shortcuts: [ shortcuts: [
{ {
text: "最近一天", text: '最近一天',
onClick(picker) { onClick(picker) {
const end = new Date(); const end = new Date()
const start = new Date(); const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24); start.setTime(start.getTime() - 3600 * 1000 * 24)
picker.$emit("pick", [start, end]); picker.$emit('pick', [start, end])
}, }
}, },
{ {
text: "最近一周", text: '最近一周',
onClick(picker) { onClick(picker) {
const end = new Date(); const end = new Date()
const start = new Date(); const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit("pick", [start, end]); picker.$emit('pick', [start, end])
}, }
}, },
{ {
text: "最近一个月", text: '最近一个月',
onClick(picker) { onClick(picker) {
const end = new Date(); const end = new Date()
const start = new Date(); const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit("pick", [start, end]); picker.$emit('pick', [start, end])
}, }
}, },
{ {
text: "最近三个月", text: '最近三个月',
onClick(picker) { onClick(picker) {
const end = new Date(); const end = new Date()
const start = new Date(); const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit("pick", [start, end]); picker.$emit('pick', [start, end])
}
}
]
}, },
}, datevalue: '',
], adminOptions: []
}, }
datevalue: "",
adminOptions: [],
};
}, },
computed: {}, computed: {},
watch: { watch: {
datevalue: "setTimeRange", filterOrgText(val) {
this.$refs.tree.filter(val)
}
},
watch: {
datevalue: 'setTimeRange'
}, },
created() { created() {
this.getList(); this.getList()
this.getListc(); this.getListc()
this.getSubjectAll(); this.getSubjectAll()
this.getWorkScopeAll(); this.getWorkScopeAll()
this.getConsumerRoleAll(); this.getConsumerRoleAll()
this.getAdminOptions(); this.getAdminOptions()
}, },
methods: { methods: {
checkPermission, 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) { handleUploadSuccess(res, file) {
if (res.code == 200) { if (res.code == 200) {
const loading = this.$loading({ text: "正在导入中..." }); const loading = this.$loading({ text: '正在导入中...' })
importConsumer(res.data).then((response) => { importConsumer(res.data).then((response) => {
loading.close(); loading.close()
if (response.code == 200) { if (response.code == 200) {
this.$message({ this.$message({
message: "导入成功", message: '导入成功',
type: "success", type: 'success'
}); })
this.getList(listQuery); this.getList(listQuery)
} else if (response.code == 206) { } else if (response.code == 206) {
this.$message({ this.$message({
message: "部分未成功" + response.data, message: '部分未成功' + response.data,
type: "success", type: 'success'
}); })
this.getList(listQuery); this.getList(listQuery)
} else { } else {
this.$message.error(response.msg); this.$message.error(response.msg)
} }
}); })
} else { } else {
this.$message.error("Excel上传失败!"); this.$message.error('Excel上传失败!')
} }
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1
}, },
getList() { getList() {
this.listLoading = true; this.listLoading = true
getConsumerList(this.listQuery).then((response) => { getConsumerList(this.listQuery).then((response) => {
this.consumerList = response.data.results; this.consumerList = response.data.results
this.total = response.data.count; this.total = response.data.count
this.listLoading = false; this.listLoading = false
}); })
}, },
getListc() { getListc() {
this.listLoadingc = true; this.listLoadingc = true
getCompanyList(this.listQueryc).then((response) => { getCompanyList(this.listQueryc).then((response) => {
this.tableDatac = response.data; this.tableDatac = response.data
this.listLoadingc = false; this.listLoadingc = false
}); })
}, },
// getCompanyList() { // getCompanyList() {
// this.treeLoding = true; // this.treeLoding = true;
@ -580,126 +607,126 @@ export default {
// }, // },
getSubjectAll() { getSubjectAll() {
getSubjectAll().then((response) => { getSubjectAll().then((response) => {
this.subjectData = genTree(response.data); this.subjectData = genTree(response.data)
}); })
}, },
getWorkScopeAll() { getWorkScopeAll() {
getWorkScopeAll().then((response) => { getWorkScopeAll().then((response) => {
this.workscopeData = genTree(response.data); this.workscopeData = genTree(response.data)
}); })
}, },
getConsumerRoleAll() { getConsumerRoleAll() {
getConsumerRoleAll().then((response) => { getConsumerRoleAll().then((response) => {
this.roleData = genTree(response.data); this.roleData = genTree(response.data)
}); })
}, },
resetFilter() { resetFilter() {
this.listQuery = { this.listQuery = {
page: 1, page: 1,
limit: 20, limit: 20,
search: "", search: ''
}; }
this.getList(); this.getList()
}, },
handleFilter() { handleFilter() {
this.listQuery.page = 1; this.listQuery.page = 1
this.getList(); this.getList()
}, },
handleAddUser() { handleAddUser() {
this.consumer = Object.assign({}, defaultConsumer); this.consumer = Object.assign({}, defaultConsumer)
this.dialogType = "new"; this.dialogType = 'new'
this.dialogVisible = true; this.dialogVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["consumerForm"].clearValidate(); this.$refs['consumerForm'].clearValidate()
}); })
}, },
handleEdit(scope) { handleEdit(scope) {
this.consumer = Object.assign({}, scope.row); // copy obj this.consumer = Object.assign({}, scope.row) // copy obj
if (this.consumer.company_ == null) { if (this.consumer.company_ == null) {
this.consumer.company_ = {}; this.consumer.company_ = {}
} }
this.dialogType = "edit"; this.dialogType = 'edit'
this.dialogVisible = true; this.dialogVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["consumerForm"].clearValidate(); this.$refs['consumerForm'].clearValidate()
}); })
}, },
handleUnbind(scope) { handleUnbind(scope) {
this.$confirm("确认解除该账户的微信绑定吗!", "警告", { this.$confirm('确认解除该账户的微信绑定吗!', '警告', {
type: "warning", type: 'warning'
}) })
.then(() => { .then(() => {
unbindConsumer(scope.row.id) unbindConsumer(scope.row.id)
.then((res) => { .then((res) => {
this.$message({ this.$message({
type: "success", type: 'success',
message: "解绑成功!", message: '解绑成功!'
}); })
this.getList(); this.getList()
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err)
}); })
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err)
}); })
}, },
handleDelete(scope) { handleDelete(scope) {
this.$confirm("确认删除该用户吗?将丢失数据!", "警告", { this.$confirm('确认删除该用户吗?将丢失数据!', '警告', {
confirmButtonText: "确认", confirmButtonText: '确认',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "error", type: 'error'
}) })
.then(async() => { .then(async() => {
await deleteConsumer(scope.row.id); await deleteConsumer(scope.row.id)
this.consumerList.splice(scope.row.index, 1); this.consumerList.splice(scope.row.index, 1)
this.$message({ this.$message({
type: "success", type: 'success',
message: "成功删除!", message: '成功删除!'
}); })
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err)
}); })
}, },
handleDeletes() { handleDeletes() {
if (this.selects.length) { if (this.selects.length) {
this.$confirm( this.$confirm(
"确认删除这" + this.selects.length + "位用户吗?将丢失数据!", '确认删除这' + this.selects.length + '位用户吗?将丢失数据!',
"警告", '警告',
{ {
confirmButtonText: "确认", confirmButtonText: '确认',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "error", type: 'error'
} }
) )
.then(async() => { .then(async() => {
const { code } = await deleteConsumers({ ids: this.selects }); const { code } = await deleteConsumers({ ids: this.selects })
if (code >= 200) { if (code >= 200) {
this.getList(); this.getList()
this.$message({ this.$message({
type: "success", type: 'success',
message: "成功删除!", message: '成功删除!'
}); })
} }
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err)
}); })
} else { } else {
this.$message({ this.$message({
message: "请先选择", message: '请先选择',
type: "warning", type: 'warning'
}); })
} }
}, },
async confirmUser(form) { async confirmUser(form) {
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
const isEdit = this.dialogType === "edit"; const isEdit = this.dialogType === 'edit'
if (isEdit) { if (isEdit) {
let consumer = this.consumer; const consumer = this.consumer
updateConsumer(this.consumer.id, consumer).then((res) => { updateConsumer(this.consumer.id, consumer).then((res) => {
// for (let index = 0; index < this.consumerList.length; index++) { // for (let index = 0; index < this.consumerList.length; index++) {
// if (this.consumerList[index].id === this.consumer.id) { // if (this.consumerList[index].id === this.consumer.id) {
@ -711,68 +738,67 @@ export default {
// break; // break;
// } // }
// } // }
this.getList(); this.getList()
this.dialogVisible = false; this.dialogVisible = false
this.$message.success('成功') this.$message.success('成功')
})
});
} else { } else {
createConsumer(this.consumer).then((res) => { createConsumer(this.consumer).then((res) => {
// this.consumer = res.data // this.consumer = res.data
// this.consumerList.unshift(this.consumer) // this.consumerList.unshift(this.consumer)
this.getList(); this.getList()
this.dialogVisible = false; this.dialogVisible = false
this.$message.success('成功') this.$message.success('成功')
}); })
} }
} else { } else {
return false; return false
} }
}); })
}, },
exportConsumer() { exportConsumer() {
const loading = this.$loading(); const loading = this.$loading()
exportConsumer(this.listQuery).then((response) => { exportConsumer(this.listQuery).then((response) => {
loading.close(); loading.close()
window.open(response.data.path, "_blank"); window.open(response.data.path, '_blank')
}).catch(()=>{loading.close()}); }).catch(() => { loading.close() })
}, },
changeSort(val) { changeSort(val) {
if (val.order == "ascending") { if (val.order == 'ascending') {
this.listQuery.ordering = val.prop; this.listQuery.ordering = val.prop
} else { } else {
this.listQuery.ordering = "-" + val.prop; this.listQuery.ordering = '-' + val.prop
} }
this.getList(); this.getList()
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
let selects = []; const selects = []
for (var i = 0; i < val.length; i++) { 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() { setTimeRange() {
(this.listQuery.min_create = this.datevalue[0]), (this.listQuery.min_create = this.datevalue[0]),
(this.listQuery.max_create = this.datevalue[1]), (this.listQuery.max_create = this.datevalue[1]),
this.getList(); this.getList()
}, },
getAdminOptions() { getAdminOptions() {
if (checkPermission(["admin"])) { if (checkPermission(['admin'])) {
getUserList({ pageoff: true }).then((res) => { getUserList({ pageoff: true }).then((res) => {
this.adminOptions = res.data; this.adminOptions = res.data
}); })
} }
}, },
choose() { choose() {
this.dgVisiable = true; this.dgVisiable = true
}, },
chooseComplete(val) { chooseComplete(val) {
this.dgVisiable = false; this.dgVisiable = false
if (val) { if (val) {
this.consumer.company_ = val; this.consumer.company_ = val
this.consumer.company = val.id; this.consumer.company = val.id
} }
}, },
handleCompanyClick(row, column, event) { handleCompanyClick(row, column, event) {
@ -784,9 +810,9 @@ export default {
this.dateVisible = true this.dateVisible = true
} else { } else {
this.$message({ this.$message({
message: "请先选择", message: '请先选择',
type: "warning", type: 'warning'
}); })
} }
}, },
confirmupdateend() { confirmupdateend() {
@ -800,6 +826,6 @@ export default {
}) })
} }
} }
}, }
}; }
</script> </script>

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>
@ -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 {
else{
this.dialogVisibleissue = true this.dialogVisibleissue = true
this.src = 'https://qw.ctc-zc.com' + scope.row.path this.src = 'https://qw.ctc-zc.com' + scope.row.path
this.name = scope.row.workscope_name this.name = scope.row.workscope_name
} }
}, },
handleAdd() { handleAdd() {
this.dialogVisible = true this.dialogVisible = true
@ -375,10 +383,10 @@ 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

@ -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,6 +1,7 @@
<template> <template>
<div class="app-container"> <el-container>
<div> <el-header>
<div style="margin-top: 10px;">
<el-input <el-input
v-model="listQuery.search" v-model="listQuery.search"
placeholder="名称/描述" placeholder="名称/描述"
@ -17,28 +18,27 @@
@click="resetFilter" @click="resetFilter"
>刷新重置</el-button> >刷新重置</el-button>
</div> </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>
<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> </div>
</el-header>
<el-main>
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="materialList.results" :data="materialList.results"
style="width: 100%;margin-top:10px;" style="width: 100%;margin-top:30px;"
border border
fit
stripe
highlight-current-row
max-height="600" max-height="600"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="名称"> <el-table-column label="名称">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="scope.row.path"
type="primary" type="primary"
:href="scope.row.path" :href="scope.row.path"
target="_blank" target="_blank"
v-if="scope.row.path"
>{{ scope.row.name }}</el-link> >{{ scope.row.name }}</el-link>
<span v-else>{{ scope.row.name }}</span> <span v-else>{{ scope.row.name }}</span>
</template> </template>
@ -49,7 +49,7 @@
<el-table-column label="上传时间"> <el-table-column label="上传时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template> <template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column> </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="排序码"> <el-table-column align="header-center" label="排序码">
<template slot-scope="scope">{{ scope.row.sort }}</template> <template slot-scope="scope">{{ scope.row.sort }}</template>
</el-table-column> </el-table-column>
@ -82,6 +82,7 @@
:limit.sync="listQuery.limit" :limit.sync="listQuery.limit"
@pagination="getList" @pagination="getList"
/> />
</el-main>
<el-dialog <el-dialog
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:title="dialogType==='update'?'编辑':'新增'" :title="dialogType==='update'?'编辑':'新增'"
@ -117,7 +118,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="description"> <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>
<!-- <el-form-item label="封面" prop="poster" v-if="material.type=='视频'"> <!-- <el-form-item label="封面" prop="poster" v-if="material.type=='视频'">
<el-upload <el-upload
@ -133,7 +134,7 @@
<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"
@ -183,8 +184,9 @@
<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.dialogVisible = true; }
this.dialogType = 'update'
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

@ -2,26 +2,37 @@
<div class="app-container"> <div class="app-container">
<div> <div>
<el-form <el-form
ref="Form"
:model="Form" :model="Form"
:rules="rules" :rules="rules"
ref="Form"
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 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>
<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-form-item> </el-form-item>
<el-form-item label="外部链接" prop="elink"> <el-form-item label="外部链接" prop="elink">
<el-input v-model="Form.elink" style="width: 80%"></el-input> <el-input v-model="Form.elink" style="width: 80%" />
</el-form-item> </el-form-item>
<el-form-item label="内容" prop="content" v-show="is_show">
<el-form-item v-show="is_show" label="内容" prop="content">
<tinymce v-model="Form.content" :height="400" width="80%" /> <tinymce v-model="Form.content" :height="400" width="80%" />
</el-form-item> </el-form-item>
<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-button type="warning" @click="goBack()">返回</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -32,13 +43,19 @@
<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 {
typeOption: [
{ name: '技能大赛', value: 1 },
{ name: '铺装工匠', value: 2 },
{ name: '培训信息', value: 3 },
{ name: '大赛信息', value: 4 }
],
Form: { Form: {
title: '', title: '',
ifrom: '', ifrom: '',
@ -48,11 +65,11 @@ export default {
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
} }
@ -72,18 +89,16 @@ export default {
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) {
@ -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>
@ -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: [

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>