pc端修改

This commit is contained in:
caoqianming 2021-06-14 22:10:11 +08:00
parent ee8c64f169
commit 0a357b3765
10 changed files with 231 additions and 23 deletions

View File

@ -0,0 +1,9 @@
import request from '@/utils/request'
export function getCandidateList(query) {
return request({
url: '/crm/candidate/',
method: 'get',
params:query
})
}

View File

@ -252,13 +252,19 @@ export const asyncRoutes = [
component: Layout,
redirect: '/exammanage/index',
name: 'Exammanage',
meta: { title: '考管理', icon: ''},
meta: { title: '考管理', icon: 'component'},
children: [
{
path: 'index',
name: 'exam',
component: () => import('@/views/exam/index.vue'),
meta: { title: '考试管理', icon: 'component', perms: ['exam_view'] }
meta: { title: '正式考试', perms: ['exam_view'] }
},
{
path: 'issue',
name: 'issue',
component: () => import('@/views/exam/issue.vue'),
meta: { title: '出证记录', perms: ['candidate_view'] }
},
]
},

View File

@ -0,0 +1,126 @@
<template>
<div class="app-container">
<div style="margin-top:10px">
<el-input
v-model="listQuery.search"
placeholder="输入关键词进行搜索"
style="width: 300px;"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新重置</el-button>
</div>
<el-table
:data="tableData.results"
style="width: 100%;margin-top:10px;"
border
fit
v-loading="listLoading"
highlight-current-row
max-height="600"
row-key="id"
default-expand-all
>
<el-table-column label="证书号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<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.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.company_name }}</template>
</el-table-column>
<el-table-column label="有效期始">
<template slot-scope="scope">{{ scope.row.start_date }}</template>
</el-table-column>
<el-table-column label="有效期止">
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column label="创建人">
<template slot-scope="scope">
<span>{{ scope.row.create_admin_username }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" fixed="right">
<template slot-scope="scope">
<el-button
type="primary"
size="small"
@click="handleView(scope)"
>查看证书</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="tableData.count>0"
:total="tableData.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="getList"
/>
</div>
</template>
<script>
import { getCandidateList } from "@/api/candidate";
import { deepClone } from "@/utils";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"
const listQuery = {
page: 1,
limit: 20,
search: ""
}
export default {
components: { Pagination },
data() {
return {
listQuery:listQuery,
tableData: {count:0},
listLoading: true,
};
},
computed: {},
created() {
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true
getCandidateList(this.listQuery).then(response => {
this.tableData = response.data
this.listLoading = false
});
},
resetFilter() {
this.listQuery = {
page: 1,
limit: 20,
search: ""
};
this.getList();
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
handleView(scope){
window.open('https://apitest.ahctc.cn/crm/candidate/img?id='+scope.row.id)
}
}
};
</script>

View File

@ -70,9 +70,9 @@ App({
globalData: {
userInfo: {},
userinfo: {}, // 服务器传回的消费者信息
//host: 'https://apitest.ahctc.cn',
host: 'https://apitest.ahctc.cn',
mediahost: 'https://apitest.ahctc.cn',
host: 'http://127.0.0.1:8000',
//host: 'http://127.0.0.1:8000',
//mediahost: 'http://127.0.0.1:8000',
token : '',
rlogin:true

View File

@ -6,7 +6,10 @@ Page({
* 页面的初始数据
*/
data: {
exam:{},
exam:{
qdimgs:[],
xcimgs:[]
},
tests:[]
},
@ -16,7 +19,7 @@ Page({
onLoad: function (options) {
if(options.id){
let id = options.id
that.data.exam.id = id
this.data.exam.id = id
api.requesta('/examtest/examtest/', 'GET', {exam:id, pageoff:true}).then(res=>{
this.setData({
tests:res.data
@ -27,11 +30,31 @@ Page({
getExam: function(){
let id = this.data.exam.id
api.requesta(`/examtest/exam/${id}/`, 'GET').then(res=>{
let exam = res.data
for(var i=0;i<exam.qdimgs.length;i++){
exam.qdimgs[i] = getApp().globalData.host+exam.qdimgs[i]
}
for(var i=0;i<exam.xcimgs.length;i++){
exam.xcimgs[i] = getApp().globalData.host+exam.xcimgs[i]
}
this.setData({
exam:res.data
exam:exam
})
})
},
previewImage: function (e) {
if(e.currentTarget.dataset.type=='qdimgs'){
wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.exam.qdimgs // 需要预览的图片http链接列表
})
}else{
wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.exam.xcimgs // 需要预览的图片http链接列表
})
}
},
issue: function(){
wx.showLoading({
title: '正在生成...',

View File

@ -19,9 +19,52 @@
监考人:{{exam.proctor_name}}-{{exam.proctor_phone}}
</view>
</view>
<view style="text-align:right;padding-right:8rpx">
<button type="primary" size="mini" bindtap="upImg" data-id="{{exam.id}}">上传图片</button>
</view>
<view style="text-align:right;padding-right:8rpx" wx:if="{{exam.qdimgs.length==0}}">
<button type="primary" size="mini" bindtap="upImg" data-id="{{exam.id}}">上传图片</button>
</view>
<view class="weui-cell" style="padding:8px;font-size:14px;" wx:if="{{exam.qdimgs.length>0}}">
<view class="weui-cell__bd">
<view class="weui-uploader">
<view class="weui-uploader__hd">
<view class="weui-uploader__overview">
<view class="weui-uploader__title">签到表图片</view>
</view>
</view>
<view class="weui-uploader__bd">
<view class="weui-uploader__files" id="uploaderFiles">
<block wx:for="{{exam.qdimgs}}" wx:key="*this">
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}" data-type="qdimgs"
data-index="{{index}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
</view>
</block>
</view>
</view>
</view>
</view>
</view>
<view class="weui-cell" style="padding:8px;font-size:14px;" wx:if="{{exam.xcimgs.length>0}}">
<view class="weui-cell__bd">
<view class="weui-uploader">
<view class="weui-uploader__hd">
<view class="weui-uploader__overview">
<view class="weui-uploader__title">现场照片</view>
</view>
</view>
<view class="weui-uploader__bd">
<view class="weui-uploader__files" id="uploaderFiles">
<block wx:for="{{exam.xcimgs}}" wx:key="*this">
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}" data-type="xcimgs"
data-index="{{index}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
</view>
</block>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="weui-panel weui-panel_access">

View File

@ -63,15 +63,6 @@
</view>
</view>
<view class="weui-cells weui-cells_after-title" style="margin-top:6px">
<navigator url="/pages/quota/quota" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="/images/quota.svg" style="margin-right: 16px;vertical-align: middle;width:20px; height: 20px;"></image>
</view>
<view class="weui-cell__bd">考核名额监控</view>
<view class="weui-cell__ft weui-cell__ft_in-access" style="color:red">
<!-- <span wx:if="{{to_read}}">{{to_read}}条未读</span> -->
</view>
</navigator>
<navigator url="/pages/candidate/index" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="/images/candidate.svg" style="margin-right: 16px;vertical-align: middle;width:20px; height: 20px;"></image>

View File

@ -71,6 +71,15 @@
<view class="weui-cell__bd">个人防护用品检测(铅当量)</view>
<view class="weui-cell__ft weui-cell__ft_in-access" style="color:red"></view>
</navigator>
<navigator url="/pages/quota/quota" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="/images/quota.svg" style="margin-right: 16px;vertical-align: middle;width:20px; height: 20px;"></image>
</view>
<view class="weui-cell__bd">考核名额监控</view>
<view class="weui-cell__ft weui-cell__ft_in-access" style="color:red">
<!-- <span wx:if="{{to_read}}">{{to_read}}条未读</span> -->
</view>
</navigator>
</view>
<view class="weui-cells__title">管理员操作台</view>
<view class="weui-cells weui-cells_after-title">
@ -79,10 +88,10 @@
<view class="weui-cell__ft weui-cell__ft_in-access" style="color:red"></view>
</navigator>
</view>
<view class="weui-footer weui-footer_fixed-bottom">
<!-- <view class="weui-footer__text" bindtap="intro">点击下载系统/小程序文档介绍</view> -->
<!-- <view class="weui-footer weui-footer_fixed-bottom">
<view class="weui-footer__text">更多服务请联系课程顾问</view>
</view>
</view> -->
</view>

View File

@ -105,7 +105,7 @@ class SendCode(CommonModel):
code = models.CharField(max_length=4, verbose_name= '验证码')
class Candidate(CommonModel):
consumer = models.ForeignKey(Consumer, on_delete=models.CASCADE, related_name='candidate_consumer')
consumer = models.ForeignKey(Consumer, on_delete=models.DO_NOTHING, related_name='candidate_consumer')
workscope = models.ForeignKey(WorkScope, on_delete=models.DO_NOTHING, related_name='candidate_workscope')

View File

@ -76,6 +76,7 @@ class ConsumerDetailSerializer(serializers.ModelSerializer):
class CandidateSerializer(serializers.ModelSerializer):
create_admin_username = serializers.StringRelatedField(source='create_admin', read_only=True)
class Meta:
model = Candidate
fields = '__all__'