some update

This commit is contained in:
caoqianming 2020-09-28 11:48:01 +08:00
parent 0be314cdbf
commit 7742e4f3f7
26 changed files with 2384 additions and 520 deletions

View File

@ -69,3 +69,18 @@ export function deleteUser(id, data) {
data
})
}
export function resetUserpw(id) {
return request({
url: `/system/user/${id}/resetpw/`,
method: 'put',
})
}
export function changePassword(data) {
return request({
url: '/system/user/password/',
method: 'put',
data
})
}

View File

@ -16,6 +16,11 @@
首页
</el-dropdown-item>
</router-link>
<router-link to="/changepassword">
<el-dropdown-item divided>
修改密码
</el-dropdown-item>
</router-link>
<!-- <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">
<el-dropdown-item>Github</el-dropdown-item>
</a>

View File

@ -6,7 +6,6 @@
<h1 v-else class="sidebar-title">{{ title }} </h1>
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo">
<h1 class="sidebar-title">{{ title }} </h1>
</router-link>
</transition>
@ -24,8 +23,9 @@ export default {
},
data() {
return {
title: '能力检索',
logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'
title: '国检集团检测能力查询平台',
// logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'
logo:'http://testsearch.ctc.ac.cn:8000/media/default/avatar.png'
}
}
}

View File

@ -36,34 +36,33 @@ export const constantRoutes = [
component: () => import('@/views/login/index'),
hidden: true
},
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [{
path: 'dashboard',
name: 'Dashboard',
component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'dashboard' }
}]
},
{
path: '/404',
component: () => import('@/views/404'),
hidden: true
},
{
path: '/',
path: '/cma',
component: Layout,
redirect: '/cma',
children: [{
path: 'cma',
path: '',
name: 'CMA',
component: () => import('@/views/ability/cma'),
meta: { title: '检测能力(总部)', icon: 'table' }
}]
},
{
path: '/qualification',
component: Layout,
redirect: '/qualification',
children: [{
path: '',
name: 'Qualification',
component: () => import('@/views/ability/qualification'),
meta: { title: '资质检索', icon: 'table' }
}]
},
{
path: '/cma2',
component: Layout,
@ -73,20 +72,20 @@ export const constantRoutes = [
name: 'CMA2',
component: () => import('@/views/ability/cma2'),
meta: { title: '检测能力(分子公司)', icon: 'table' }
}
]
},
{
path: '/qualification',
component: Layout,
redirect: '/qualification',
children: [{
path: '',
name: 'Qualification',
component: () => import('@/views/ability/qualification'),
meta: { title: '资质查询', icon: 'table' }
}]
}
// {
// path: '/',
// component: Layout,
// redirect: '/dashboard',
// children: [{
// path: 'dashboard',
// name: 'Dashboard',
// component: () => import('@/views/dashboard/index'),
// meta: { title: '首页', icon: 'dashboard' }
// }]
// }
},
]
/**
@ -184,6 +183,23 @@ export const asyncRoutes = [
}
]
},
{
path: '/changepassword',
component: Layout,
redirect: '/changepassword',
name: 'ChangePW',
meta: { title: '修改密码', icon: 'tree' },
hidden:true,
children: [
{
path: '',
name: 'ChangePassword',
component: () => import('@/views/system/changepassword'),
meta: { title: '修改密码', noCache: true, icon: ''},
hidden: true
},
]
},
// 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true }
]

View File

@ -1,6 +1,6 @@
module.exports = {
title: '管理系统',
title: '',
/**
* @type {boolean} true | false

View File

@ -1,31 +1,31 @@
<template>
<div class="app-container">
<el-row :gutter="6">
<el-col :xs="24" :md="16">
<el-input
v-model="listQuery.search"
placeholder="项目/标准/编号/中心"
style="width: 100%"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
</el-col>
<el-col :xs="24" :md="8" >
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新重置</el-button
>
</el-col>
<el-col :xs="24" :md="16">
<el-input
v-model="listQuery.search"
placeholder="项目/标准/编号/中心"
style="width: 100%"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
</el-col>
<el-col :xs="24" :md="8">
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新</el-button
>
</el-col>
</el-row>
<div style="margin-top: 10px">
<!-- <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="checkPermission(['cma_create'])">新增</el-button> -->
@ -83,48 +83,62 @@
</el-popover>
</div>
<el-card style="margin-top: 6px">
<el-table
v-loading="listLoading"
:data="cmaList.results"
style="width: 100%; "
border
fit
stripe
highlight-current-row
max-height="320"
ref="filterTable"
@filter-change="filterChange"
>
<el-table-column type="index" width="50" />
<el-table-column align="center" label="大类名称">
<template slot-scope="scope">{{ scope.row.dlmc }}</template>
</el-table-column>
<el-table-column align="header-center" label="类别名称">
<template slot-scope="scope">{{ scope.row.lbmc }}</template>
</el-table-column>
<el-table-column align="header-center" label="项目序号">
<template slot-scope="scope">{{ scope.row.xmxh }}</template>
</el-table-column>
<el-table-column align="header-center" label="项目名称">
<template slot-scope="scope">{{ scope.row.xmmc }}</template>
</el-table-column>
<el-table-column align="header-center" label="标准名称">
<template slot-scope="scope">{{ scope.row.bzmc }}</template>
</el-table-column>
<el-table-column align="header-center" label="标准编号">
<template slot-scope="scope">{{ scope.row.bzbh }}</template>
</el-table-column>
<el-table-column
align="header-center"
label="所属中心"
prop="sszx"
column-key="sszx"
:filters="groupBy.sszx"
:filter-multiple="false"
<el-table
v-loading="listLoading"
:data="cmaList.results"
style="width: 100%"
border
fit
stripe
highlight-current-row
max-height="320"
ref="filterTable"
@filter-change="filterChange"
>
<template slot-scope="scope">{{ scope.row.sszx }}</template>
</el-table-column>
<!-- <el-table-column align="center" label="操作">
<el-table-column type="index" width="50" />
<el-table-column align="center" label="大类名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.dlmc)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="类别名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.lbmc)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="项目序号">
<template slot-scope="scope"
><span v-html="showlight(scope.row.xmxh)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="项目名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.xmmc)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="标准名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.bzmc)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="标准编号">
<template slot-scope="scope"
><span v-html="showlight(scope.row.bzbh)"></span
></template>
</el-table-column>
<el-table-column
align="header-center"
label="所属中心"
prop="sszx"
column-key="sszx"
:filters="groupBy.sszx"
:filter-multiple="false"
>
<template slot-scope="scope"
><span v-html="showlight(scope.row.sszx)"></span
></template>
</el-table-column>
<!-- <el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
:disabled="!checkPermission(['cma_update'])"
@ -142,47 +156,59 @@
/>
</template>
</el-table-column> -->
</el-table>
</el-table>
<pagination
v-show="cmaList.count > 0"
:total="cmaList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
<pagination
v-show="cmaList.count > 0"
:total="cmaList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
<el-card style="margin-top:6px">
<el-table
v-loading="listLoading2"
:data="cnasList.results"
style="width: 100%;"
border
fit
stripe
highlight-current-row
max-height="320"
>
<el-table-column type="index" width="50" />
<el-table-column align="header-center" label="类别名称">
<template slot-scope="scope">{{ scope.row.lbmc }}</template>
</el-table-column>
<el-table-column align="header-center" label="项目名称">
<template slot-scope="scope">{{ scope.row.xmmc }}</template>
</el-table-column>
<el-table-column align="header-center" label="标准名称">
<template slot-scope="scope">{{ scope.row.bzmc }}</template>
</el-table-column>
<el-table-column align="header-center" label="标准编号">
<template slot-scope="scope">{{ scope.row.bzbh }}</template>
</el-table-column>
<el-table-column align="header-center" label="标准条款">
<template slot-scope="scope">{{ scope.row.bztk }}</template>
</el-table-column>
<el-table-column align="header-center" label="所属中心">
<template slot-scope="scope">{{ scope.row.sszx }}</template>
</el-table-column>
<!-- <el-table-column align="center" label="操作">
<el-card style="margin-top: 6px">
<el-table
v-loading="listLoading2"
:data="cnasList.results"
style="width: 100%"
border
fit
stripe
highlight-current-row
max-height="320"
>
<el-table-column type="index" width="50" />
<el-table-column align="header-center" label="类别名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.lbmc)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="项目名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.xmmc)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="标准名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.bzmc)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="标准编号">
<template slot-scope="scope"
><span v-html="showlight(scope.row.bzbh)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="标准条款">
<template slot-scope="scope"
><span v-html="showlight(scope.row.bztk)"></span
></template>
</el-table-column>
<el-table-column align="header-center" label="所属中心">
<template slot-scope="scope"
><span v-html="showlight(scope.row.sszx)"></span
></template>
</el-table-column>
<!-- <el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
:disabled="!checkPermission(['cnas_update'])"
@ -200,15 +226,15 @@
/>
</template>
</el-table-column> -->
</el-table>
</el-table>
<pagination
v-show="cnasList.count > 0"
:total="cnasList.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.page_size"
@pagination="getList2"
/>
<pagination
v-show="cnasList.count > 0"
:total="cnasList.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.page_size"
@pagination="getList2"
/>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
@ -264,6 +290,7 @@ const dflistQuery = {
page: 1,
page_size: 20,
type: "center",
search: "",
};
export default {
components: { Pagination },
@ -300,6 +327,23 @@ export default {
this.getList2();
},
methods: {
showlight(val) {
val = val + "";
if (this.listQuery.search != "") {
let searchList = this.listQuery.search.split(" ");
for (var i = 0; i < searchList.length; i++) {
val = val.replace(
searchList[i],
'<span style="color:red;font-weight:bold">' +
searchList[i] +
"</span>"
);
}
return val;
} else {
return val;
}
},
checkPermission,
handleUploadSuccess(res, file) {
const loading = this.openLoading();

View File

@ -1,123 +1,158 @@
<template>
<div class="app-container">
<el-row :gutter="6">
<el-col :xs="24" :md="4">
<el-select v-model="listQuery.sszx" placeholder="所属中心" @change="handleFilter2" clearable style="width: 100%;">
<el-option
v-for="item in groupBy.sszx"
:key="item.value"
:label="item.text"
:value="item.value">
</el-option>
</el-select>
</el-col>
<el-col :xs="24" :md="8">
<el-input
v-model="listQuery.search"
placeholder="项目/标准/编号/中心"
style="width: 100%;"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
</el-col>
<el-col :xs="24" :md="6">
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新重置</el-button>
</el-col>
</el-row>
<div style="margin-top:10px">
<!-- <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="checkPermission(['cma_create'])">新增</el-button> -->
<el-popover
placement="top"
width="160"
v-if="checkPermission(['ability_import'])"
v-model="popovervisible"
>
<p>导入能力列表压缩包.</p>
<div style="text-align: left; margin: 0;">
<el-upload
:action="upUrl"
:on-success="handleUploadSuccess"
accept=".rar,.zip"
:headers="upHeaders"
:show-file-list ="false"
>
<el-button size="small" type="primary" @click="popovervisible = false">上传导入</el-button>
</el-upload>
</div>
<el-button slot="reference">导入分子公司能力</el-button>
</el-popover>
</div>
<el-table
v-loading="listLoading"
:data="cmaList.results"
style="width: 100%;margin-top:10px;"
border
fit
stripe
highlight-current-row
max-height="700"
ref="filterTable"
@filter-change="filterChange"
<el-col :xs="24" :md="4">
<el-select
v-model="listQuery.sszx"
placeholder="所属公司"
@change="handleFilter2"
clearable
style="width: 100%"
>
<el-table-column type="index" width="50" />
<el-table-column label="大类名称">
<template slot-scope="scope">{{ scope.row.dlmc }}</template>
</el-table-column>
<el-table-column label="类别名称">
<template slot-scope="scope">{{ scope.row.lbmc }}</template>
</el-table-column>
<el-table-column label="项目序号">
<template slot-scope="scope">{{ scope.row.xmxh }}</template>
</el-table-column>
<el-table-column label="项目名称">
<template slot-scope="scope">{{ scope.row.xmmc }}</template>
</el-table-column>
<el-table-column label="标准名称" width="300">
<template slot-scope="scope">{{ scope.row.bzmc }}</template>
</el-table-column>
<el-table-column label="标准编号">
<template slot-scope="scope">{{ scope.row.bzbh }}</template>
</el-table-column>
<el-table-column label="限制范围">
<template slot-scope="scope">{{ scope.row.xzfw }}</template>
</el-table-column>
<el-table-column label="创建日期">
<template slot-scope="scope">{{ scope.row.create_time.substring(0,10) }}</template>
</el-table-column>
<el-table-column label="变更日期">
<template slot-scope="scope">{{ scope.row.update_time.substring(0,10) }}</template>
</el-table-column>
<el-table-column label="关联资质" prop="glzz"
column-key="glzz"
:filters="groupBy.glzz"
:filter-multiple="false">
<template slot-scope="scope"
>{{ scope.row.glzz }}</template>
</el-table-column>
<el-table-column align="header-center" label="所属中心"
prop="sszx"
column-key="sszx"
:filters="groupBy.sszx"
:filter-multiple="false"
fixed="right"
<el-option
v-for="item in groupBy.sszx"
:key="item.value"
:label="item.text"
:value="item.value"
>
<template slot-scope="scope">{{ scope.row.sszx }}</template>
</el-table-column>
<!-- <el-table-column align="center" label="操作">
</el-option>
</el-select>
</el-col>
<el-col :xs="24" :md="8">
<el-input
v-model="listQuery.search"
placeholder="项目/标准/编号/公司"
style="width: 100%"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
</el-col>
<el-col :xs="24" :md="6">
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新</el-button
>
</el-col>
</el-row>
<div style="margin-top: 10px">
<!-- <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="checkPermission(['cma_create'])">新增</el-button> -->
<el-popover
placement="top"
width="160"
v-if="checkPermission(['ability_import'])"
v-model="popovervisible"
>
<p>导入能力列表压缩包.</p>
<div style="text-align: left; margin: 0">
<el-upload
:action="upUrl"
:on-success="handleUploadSuccess"
accept=".rar,.zip"
:headers="upHeaders"
:show-file-list="false"
>
<el-button
size="small"
type="primary"
@click="popovervisible = false"
>上传导入</el-button
>
</el-upload>
</div>
<el-button slot="reference">导入分子公司能力</el-button>
</el-popover>
</div>
<el-table
v-loading="listLoading"
:data="cmaList.results"
style="width: 100%; margin-top: 10px"
border
fit
stripe
highlight-current-row
max-height="700"
ref="filterTable"
@filter-change="filterChange"
>
<el-table-column type="index" width="50" />
<el-table-column label="大类名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.dlmc)"></span
></template>
</el-table-column>
<el-table-column label="类别名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.lbmc)"></span
></template>
</el-table-column>
<el-table-column label="项目序号">
<template slot-scope="scope"
><span v-html="showlight(scope.row.xmxh)"></span
></template>
</el-table-column>
<el-table-column label="项目名称">
<template slot-scope="scope"
><span v-html="showlight(scope.row.xmmc)"></span
></template>
</el-table-column>
<el-table-column label="标准名称" width="300">
<template slot-scope="scope"
><span v-html="showlight(scope.row.bzmc)"></span
></template>
</el-table-column>
<el-table-column label="标准编号">
<template slot-scope="scope"
><span v-html="showlight(scope.row.bzbh)"></span
></template>
</el-table-column>
<el-table-column label="限制范围">
<template slot-scope="scope"
><span v-html="showlight(scope.row.xzfw)" v-if="scope.row.xzfw"></span
></template>
</el-table-column>
<el-table-column label="创建日期">
<template slot-scope="scope">{{
scope.row.create_time.substring(0, 10)
}}</template>
</el-table-column>
<el-table-column label="变更日期">
<template slot-scope="scope">{{
scope.row.update_time.substring(0, 10)
}}</template>
</el-table-column>
<el-table-column
label="关联资质"
prop="glzz"
column-key="glzz"
:filters="groupBy.glzz"
:filter-multiple="false"
>
<template slot-scope="scope">{{ scope.row.glzz }}</template>
</el-table-column>
<el-table-column
align="header-center"
label="所属中心"
prop="sszx"
column-key="sszx"
:filters="groupBy.sszx"
:filter-multiple="false"
fixed="right"
>
<template slot-scope="scope">{{ scope.row.sszx }}</template>
</el-table-column>
<!-- <el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
:disabled="!checkPermission(['cma_update'])"
@ -135,18 +170,26 @@
/>
</template>
</el-table-column> -->
</el-table>
</el-table>
<pagination
v-show="cmaList.count>0"
:total="cmaList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
<pagination
v-show="cmaList.count > 0"
:total="cmaList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑':'新增'">
<el-form ref="Form" :model="cma" label-width="80px" label-position="right" >
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑' : '新增'"
>
<el-form
ref="Form"
:model="cma"
label-width="80px"
label-position="right"
>
<el-form-item label="姓名" prop="name">
<el-input v-model="cma.name" placeholder="姓名" />
</el-form-item>
@ -154,36 +197,45 @@
<el-input v-model="cma.username" placeholder="账户" />
</el-form-item>
</el-form>
<div style="text-align:right;">
<el-button type="danger" @click="dialogVisible=false">取消</el-button>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<style >
.el-table-filter{
width:400px;
.el-table-filter {
width: 400px;
max-height: 300px;
overflow-y: auto;
}
</style>
<script>
import { getCMAList, createCMA, deleteCMA, updateCMA, importCMA2, getCNASList, importCNAS, getCMAGroup } from "@/api/cma";
import checkPermission from "@/utils/permission"
import { upUrl, upHeaders } from "@/api/file"
import Pagination from "@/components/Pagination" // secondary package based on el-pagination
import {
getCMAList,
createCMA,
deleteCMA,
updateCMA,
importCMA2,
getCNASList,
importCNAS,
getCMAGroup,
} from "@/api/cma";
import checkPermission from "@/utils/permission";
import { upUrl, upHeaders } from "@/api/file";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultCMA = {
id: "",
dlxh:null,
dlmc:null,
dlxh: null,
dlmc: null,
};
const dflistQuery = {
page: 1,
page_size: 20,
type:'sub'
}
type: "sub",
search: "",
};
export default {
components: { Pagination },
data() {
@ -191,13 +243,13 @@ export default {
cma: defaultCMA,
upHeaders: upHeaders(),
upUrl: upUrl(),
groupBy:{sszx:[], glzz:[]},
cmaList: {count:0},
groupBy: { sszx: [], glzz: [] },
cmaList: { count: 0 },
listLoading: true,
listQuery: Object.assign({}, dflistQuery),
enabledOptions: [
{ key: "true", display_name: "激活" },
{ key: "false", display_name: "禁用" }
{ key: "false", display_name: "禁用" },
],
dialogVisible: false,
dialogType: "new",
@ -205,106 +257,125 @@ export default {
};
},
computed: {},
watch: {
},
watch: {},
created() {
this.getList()
this.getGroup()
this.getList();
this.getGroup();
},
methods: {
showlight(val) {
val = val + "";
if (this.listQuery.search != "") {
let searchList = this.listQuery.search.split(" ");
for (var i = 0; i < searchList.length; i++) {
val = val.replace(
searchList[i],
'<span style="color:red;font-weight:bold">' +
searchList[i] +
"</span>"
);
}
return val;
} else {
return val;
}
},
checkPermission,
handleUploadSuccess(res, file) {
const loading = this.openLoading()
let data = {path:res.data.path}
importCMA2(data).then(res=>{
this.$message({
message: '导入成功',
type: 'success'
const loading = this.openLoading();
let data = { path: res.data.path };
importCMA2(data)
.then((res) => {
this.$message({
message: "导入成功",
type: "success",
});
loading.close();
this.resetFilter();
})
loading.close()
this.resetFilter()
}).catch(error=>{loading.close()})
.catch((error) => {
loading.close();
});
},
getList() {
this.listLoading = true;
getCMAList(this.listQuery).then(response => {
getCMAList(this.listQuery).then((response) => {
if (response.data) {
this.cmaList = response.data
this.cmaList = response.data;
}
this.listLoading = false
})
this.listLoading = false;
});
},
getGroup() {
for(let key in this.groupBy){
let data = Object.assign({}, this.listQuery)
data.group_by = key
getCMAGroup(data).then(response => {
this.groupBy[key] = response.data
console.log(this.groupBy)
})
for (let key in this.groupBy) {
let data = Object.assign({}, this.listQuery);
data.group_by = key;
getCMAGroup(data).then((response) => {
this.groupBy[key] = response.data;
console.log(this.groupBy);
});
}
},
resetFilter() {
this.listQuery = Object.assign({}, dflistQuery),
this.getList()
this.getGroup()
(this.listQuery = Object.assign({}, dflistQuery)), this.getList();
this.getGroup();
},
handleFilter() {
this.listQuery.page = 1
this.getList()
this.getGroup()
this.listQuery.page = 1;
this.getList();
this.getGroup();
},
handleFilter2() {
this.listQuery.page = 1
this.getList()
this.listQuery.page = 1;
this.getList();
},
handleAdd() {
this.cma = Object.assign({}, defaultCMA)
this.dialogType = "new"
this.dialogVisible = true
this.cma = Object.assign({}, defaultCMA);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate()
})
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.cma = Object.assign({}, scope.row) // copy obj
this.dialogType = "edit"
this.dialogVisible = true
this.cma = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate()
})
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error"
type: "error",
})
.then(async () => {
await deleteCMA(scope.row.id);
this.cmaList.splice(scope.row.index, 1);
this.$message({
type: "success",
message: "成功删除!"
message: "成功删除!",
});
})
.catch(err => {
.catch((err) => {
console.error(err);
});
},
filterChange (obj) {
for(let key in obj){
this.listQuery[key] = obj[key][0]
}
this.listQuery.page=1
this.getList()
},
filterChange(obj) {
for (let key in obj) {
this.listQuery[key] = obj[key][0];
}
this.listQuery.page = 1;
this.getList();
},
async confirm(form) {
this.$refs[form].validate(valid => {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateCMA(this.cma.id, this.cma).then(res => {
updateCMA(this.cma.id, this.cma).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
@ -312,12 +383,12 @@ this.getList()
title: "成功",
message: "编辑成功",
type: "success",
duration: 2000
duration: 2000,
});
}
});
} else {
createCMA(this.cma).then(res => {
createCMA(this.cma).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
@ -325,7 +396,7 @@ this.getList()
title: "成功",
message: "新增成功",
type: "success",
duration: 2000
duration: 2000,
});
}
});
@ -334,7 +405,7 @@ this.getList()
return false;
}
});
}
}
},
},
};
</script>

View File

@ -81,16 +81,24 @@
<template slot-scope="scope">{{ scope.row.sszx }}</template>
</el-table-column>
<el-table-column label="CMA资质">
<template slot-scope="scope">{{ scope.row.cma }}</template>
<template slot-scope="scope">
<span v-html="showlight(scope.row.cma)"></span>
</template>
</el-table-column>
<el-table-column label="CNAS资质">
<template slot-scope="scope">{{ scope.row.cnas }}</template>
<template slot-scope="scope">
<span v-html="showlight(scope.row.cnas)"></span>
</template>
</el-table-column>
<el-table-column label="其它资质">
<template slot-scope="scope">{{ scope.row.other }}</template>
<template slot-scope="scope">
<span v-html="showlight(scope.row.other)"></span>
</template>
</el-table-column>
<el-table-column label="主要服务">
<template slot-scope="scope">{{ scope.row.service }}</template>
<template slot-scope="scope">
<span v-html="showlight(scope.row.service)"></span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
@ -172,6 +180,7 @@ const defaultCMA = {
const dflistQuery = {
page: 1,
page_size: 20,
search:''
}
export default {
components: { Pagination },
@ -343,7 +352,19 @@ this.getList()
return false;
}
});
},
showlight(val) {
val = val + "";
if (this.listQuery.search != "") {
let searchList = this.listQuery.search.split(' ')
for(var i=0;i<searchList.length;i++){
val = val.replace(searchList[i], '<span style="color:red;font-weight:bold">' + searchList[i] + "</span>");
}
return val
} else {
return val;
}
},
}
};
</script>

View File

@ -0,0 +1,102 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
const animationDuration = 6000
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器坐标轴触发有效
type: 'shadow' // 默认为直线可选为'line' | 'shadow'
}
},
grid: {
top: 10,
left: '2%',
right: '2%',
bottom: '3%',
containLabel: true
},
xAxis: [{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisTick: {
alignWithLabel: true
}
}],
yAxis: [{
type: 'value',
axisTick: {
show: false
}
}],
series: [{
name: 'pageA',
type: 'bar',
stack: 'vistors',
barWidth: '60%',
data: [79, 52, 200, 334, 390, 330, 220],
animationDuration
}, {
name: 'pageB',
type: 'bar',
stack: 'vistors',
barWidth: '60%',
data: [80, 52, 200, 334, 390, 330, 220],
animationDuration
}, {
name: 'pageC',
type: 'bar',
stack: 'vistors',
barWidth: '60%',
data: [30, 52, 200, 334, 390, 330, 220],
animationDuration
}]
})
}
}
}
</script>

View File

@ -0,0 +1,118 @@
<template>
<el-card class="box-card-component" style="margin-left:8px;">
<div slot="header" class="box-card-header">
<img src="https://wpimg.wallstcn.com/e7d23d71-cf19-4b90-a1cc-f56af8c0903d.png">
</div>
<div style="position:relative;">
<pan-thumb :image="avatar" class="panThumb" />
<mallki class-name="mallki-text" text="vue-element-admin" />
<div style="padding-top:35px;" class="progress-item">
<span>Vue</span>
<el-progress :percentage="70" />
</div>
<div class="progress-item">
<span>JavaScript</span>
<el-progress :percentage="18" />
</div>
<div class="progress-item">
<span>Css</span>
<el-progress :percentage="12" />
</div>
<div class="progress-item">
<span>ESLint</span>
<el-progress :percentage="100" status="success" />
</div>
</div>
</el-card>
</template>
<script>
import { mapGetters } from 'vuex'
import PanThumb from '@/components/PanThumb'
import Mallki from '@/components/TextHoverEffect/Mallki'
export default {
components: { PanThumb, Mallki },
filters: {
statusFilter(status) {
const statusMap = {
success: 'success',
pending: 'danger'
}
return statusMap[status]
}
},
data() {
return {
statisticsData: {
article_count: 1024,
pageviews_count: 1024
}
}
},
computed: {
...mapGetters([
'name',
'avatar',
'roles'
])
}
}
</script>
<style lang="scss" >
.box-card-component{
.el-card__header {
padding: 0px!important;
}
}
</style>
<style lang="scss" scoped>
.box-card-component {
.box-card-header {
position: relative;
height: 220px;
img {
width: 100%;
height: 100%;
transition: all 0.2s linear;
&:hover {
transform: scale(1.1, 1.1);
filter: contrast(130%);
}
}
}
.mallki-text {
position: absolute;
top: 0px;
right: 0px;
font-size: 20px;
font-weight: bold;
}
.panThumb {
z-index: 100;
height: 70px!important;
width: 70px!important;
position: absolute!important;
top: -45px;
left: 0px;
border: 5px solid #ffffff;
background-color: #fff;
margin: auto;
box-shadow: none!important;
/deep/ .pan-info {
box-shadow: none!important;
}
}
.progress-item {
margin-bottom: 10px;
font-size: 14px;
}
@media only screen and (max-width: 1510px){
.mallki-text{
display: none;
}
}
}
</style>

View File

@ -0,0 +1,135 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '350px'
},
autoResize: {
type: Boolean,
default: true
},
chartData: {
type: Object,
required: true
}
},
data() {
return {
chart: null
}
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.setOptions(this.chartData)
},
setOptions({ expectedData, actualData } = {}) {
this.chart.setOption({
xAxis: {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
boundaryGap: false,
axisTick: {
show: false
}
},
grid: {
left: 10,
right: 10,
bottom: 20,
top: 30,
containLabel: true
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
},
padding: [5, 10]
},
yAxis: {
axisTick: {
show: false
}
},
legend: {
data: ['expected', 'actual']
},
series: [{
name: 'expected', itemStyle: {
normal: {
color: '#FF005A',
lineStyle: {
color: '#FF005A',
width: 2
}
}
},
smooth: true,
type: 'line',
data: expectedData,
animationDuration: 2800,
animationEasing: 'cubicInOut'
},
{
name: 'actual',
smooth: true,
type: 'line',
itemStyle: {
normal: {
color: '#3888fa',
lineStyle: {
color: '#3888fa',
width: 2
},
areaStyle: {
color: '#f3f8ff'
}
}
},
data: actualData,
animationDuration: 2800,
animationEasing: 'quadraticOut'
}]
})
}
}
}
</script>

View File

@ -0,0 +1,200 @@
<template>
<el-row :gutter="40" class="panel-group">
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('访问用户')">
<div class="card-panel-icon-wrapper icon-people">
<svg-icon icon-class="peoples" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
访问用户
</div>
<count-to :start-val="0" v-bind:end-val="ret.consumer1_count" :duration="1600" class="card-panel-num" />
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('缴费用户')">
<div class="card-panel-icon-wrapper icon-message">
<svg-icon icon-class="people" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
缴费用户
</div>
<count-to :start-val="0" v-bind:end-val="ret.consumer2_count" :duration="1600" class="card-panel-num" />
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('模考次数')">
<div class="card-panel-icon-wrapper icon-money">
<svg-icon icon-class="chart" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
模考次数
</div>
<count-to :start-val="0" v-bind:end-val="ret.test_count" :duration="1600" class="card-panel-num" />
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('题目总数')">
<div class="card-panel-icon-wrapper icon-shopping">
<svg-icon icon-class="form" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
题目总数
</div>
<count-to :start-val="0" v-bind:end-val="ret.question_count" :duration="1600" class="card-panel-num" />
</div>
</div>
</el-col>
</el-row>
</template>
<script>
import CountTo from 'vue-count-to'
import { getBasicCount } from '@/api/analyse'
export default {
components: {
CountTo
},
data() {
return {
ret:{
consumer1_count:0,
consumer2_count:0,
test_count:0,
question_count:0
}
};
},
created() {
this.getBasicCount();
},
methods: {
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
},
getBasicCount() {
this.listLoading = true;
getBasicCount().then(response => {
this.ret = response.data;
});
},
}
}
</script>
<style lang="scss" scoped>
.panel-group {
margin-top: 18px;
.card-panel-col {
margin-bottom: 32px;
}
.card-panel {
height: 108px;
cursor: pointer;
font-size: 12px;
position: relative;
overflow: hidden;
color: #666;
background: #fff;
box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
border-color: rgba(0, 0, 0, .05);
&:hover {
.card-panel-icon-wrapper {
color: #fff;
}
.icon-people {
background: #40c9c6;
}
.icon-message {
background: #36a3f7;
}
.icon-money {
background: #f4516c;
}
.icon-shopping {
background: #34bfa3
}
}
.icon-people {
color: #40c9c6;
}
.icon-message {
color: #36a3f7;
}
.icon-money {
color: #f4516c;
}
.icon-shopping {
color: #34bfa3
}
.card-panel-icon-wrapper {
float: left;
margin: 14px 0 0 14px;
padding: 16px;
transition: all 0.38s ease-out;
border-radius: 6px;
}
.card-panel-icon {
float: left;
font-size: 48px;
}
.card-panel-description {
float: right;
font-weight: bold;
margin: 26px;
margin-left: 0px;
.card-panel-text {
line-height: 18px;
color: rgba(0, 0, 0, 0.45);
font-size: 16px;
margin-bottom: 12px;
}
.card-panel-num {
font-size: 20px;
}
}
}
}
@media (max-width:550px) {
.card-panel-description {
display: none;
}
.card-panel-icon-wrapper {
float: none !important;
width: 100%;
height: 100%;
margin: 0 !important;
.svg-icon {
display: block;
margin: 14px auto !important;
float: none !important;
}
}
}
</style>

View File

@ -0,0 +1,79 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
left: 'center',
bottom: '10',
data: ['Industries', 'Technology', 'Forex', 'Gold', 'Forecasts']
},
series: [
{
name: 'WEEKLY WRITE ARTICLES',
type: 'pie',
roseType: 'radius',
radius: [15, 95],
center: ['50%', '38%'],
data: [
{ value: 320, name: 'Industries' },
{ value: 240, name: 'Technology' },
{ value: 149, name: 'Forex' },
{ value: 100, name: 'Gold' },
{ value: 59, name: 'Forecasts' }
],
animationEasing: 'cubicInOut',
animationDuration: 2600
}
]
})
}
}
}
</script>

View File

@ -0,0 +1,116 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
const animationDuration = 3000
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器坐标轴触发有效
type: 'shadow' // 默认为直线可选为'line' | 'shadow'
}
},
radar: {
radius: '66%',
center: ['50%', '42%'],
splitNumber: 8,
splitArea: {
areaStyle: {
color: 'rgba(127,95,132,.3)',
opacity: 1,
shadowBlur: 45,
shadowColor: 'rgba(0,0,0,.5)',
shadowOffsetX: 0,
shadowOffsetY: 15
}
},
indicator: [
{ name: 'Sales', max: 10000 },
{ name: 'Administration', max: 20000 },
{ name: 'Information Techology', max: 20000 },
{ name: 'Customer Support', max: 20000 },
{ name: 'Development', max: 20000 },
{ name: 'Marketing', max: 20000 }
]
},
legend: {
left: 'center',
bottom: '10',
data: ['Allocated Budget', 'Expected Spending', 'Actual Spending']
},
series: [{
type: 'radar',
symbolSize: 0,
areaStyle: {
normal: {
shadowBlur: 13,
shadowColor: 'rgba(0,0,0,.2)',
shadowOffsetX: 0,
shadowOffsetY: 10,
opacity: 1
}
},
data: [
{
value: [5000, 7000, 12000, 11000, 15000, 14000],
name: 'Allocated Budget'
},
{
value: [4000, 9000, 15000, 15000, 13000, 11000],
name: 'Expected Spending'
},
{
value: [5500, 11000, 12000, 15000, 12000, 12000],
name: 'Actual Spending'
}
],
animationDuration: animationDuration
}]
})
}
}
}
</script>

View File

@ -0,0 +1,81 @@
<template>
<li :class="{ completed: todo.done, editing: editing }" class="todo">
<div class="view">
<input
:checked="todo.done"
class="toggle"
type="checkbox"
@change="toggleTodo( todo)"
>
<label @dblclick="editing = true" v-text="todo.text" />
<button class="destroy" @click="deleteTodo( todo )" />
</div>
<input
v-show="editing"
v-focus="editing"
:value="todo.text"
class="edit"
@keyup.enter="doneEdit"
@keyup.esc="cancelEdit"
@blur="doneEdit"
>
</li>
</template>
<script>
export default {
name: 'Todo',
directives: {
focus(el, { value }, { context }) {
if (value) {
context.$nextTick(() => {
el.focus()
})
}
}
},
props: {
todo: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
editing: false
}
},
methods: {
deleteTodo(todo) {
this.$emit('deleteTodo', todo)
},
editTodo({ todo, value }) {
this.$emit('editTodo', { todo, value })
},
toggleTodo(todo) {
this.$emit('toggleTodo', todo)
},
doneEdit(e) {
const value = e.target.value.trim()
const { todo } = this
if (!value) {
this.deleteTodo({
todo
})
} else if (this.editing) {
this.editTodo({
todo,
value
})
this.editing = false
}
},
cancelEdit(e) {
e.target.value = this.todo.text
this.editing = false
}
}
}
</script>

View File

@ -0,0 +1,320 @@
.todoapp {
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.4em;
color: #4d4d4d;
min-width: 230px;
max-width: 550px;
margin: 0 auto ;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-weight: 300;
background: #fff;
z-index: 1;
position: relative;
button {
margin: 0;
padding: 0;
border: 0;
background: none;
font-size: 100%;
vertical-align: baseline;
font-family: inherit;
font-weight: inherit;
color: inherit;
-webkit-appearance: none;
appearance: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
:focus {
outline: 0;
}
.hidden {
display: none;
}
.todoapp {
background: #fff;
margin: 130px 0 40px 0;
position: relative;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.todoapp input::-webkit-input-placeholder {
font-style: italic;
font-weight: 300;
color: #e6e6e6;
}
.todoapp input::-moz-placeholder {
font-style: italic;
font-weight: 300;
color: #e6e6e6;
}
.todoapp input::input-placeholder {
font-style: italic;
font-weight: 300;
color: #e6e6e6;
}
.todoapp h1 {
position: absolute;
top: -155px;
width: 100%;
font-size: 100px;
font-weight: 100;
text-align: center;
color: rgba(175, 47, 47, 0.15);
-webkit-text-rendering: optimizeLegibility;
-moz-text-rendering: optimizeLegibility;
text-rendering: optimizeLegibility;
}
.new-todo,
.edit {
position: relative;
margin: 0;
width: 100%;
font-size: 18px;
font-family: inherit;
font-weight: inherit;
line-height: 1.4em;
border: 0;
color: inherit;
padding: 6px;
border: 1px solid #999;
box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2);
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.new-todo {
padding: 10px 16px 16px 60px;
border: none;
background: rgba(0, 0, 0, 0.003);
box-shadow: inset 0 -2px 1px rgba(0, 0, 0, 0.03);
}
.main {
position: relative;
z-index: 2;
border-top: 1px solid #e6e6e6;
}
.toggle-all {
text-align: center;
border: none;
/* Mobile Safari */
opacity: 0;
position: absolute;
}
.toggle-all+label {
width: 60px;
height: 34px;
font-size: 0;
position: absolute;
top: -52px;
left: -13px;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
}
.toggle-all+label:before {
content: '';
font-size: 22px;
color: #e6e6e6;
padding: 10px 27px 10px 27px;
}
.toggle-all:checked+label:before {
color: #737373;
}
.todo-list {
margin: 0;
padding: 0;
list-style: none;
}
.todo-list li {
position: relative;
font-size: 24px;
border-bottom: 1px solid #ededed;
}
.todo-list li:last-child {
border-bottom: none;
}
.todo-list li.editing {
border-bottom: none;
padding: 0;
}
.todo-list li.editing .edit {
display: block;
width: 506px;
padding: 12px 16px;
margin: 0 0 0 43px;
}
.todo-list li.editing .view {
display: none;
}
.todo-list li .toggle {
text-align: center;
width: 40px;
/* auto, since non-WebKit browsers doesn't support input styling */
height: auto;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
border: none;
/* Mobile Safari */
-webkit-appearance: none;
appearance: none;
}
.todo-list li .toggle {
opacity: 0;
}
.todo-list li .toggle+label {
/*
Firefox requires `#` to be escaped - https://bugzilla.mozilla.org/show_bug.cgi?id=922433
IE and Edge requires *everything* to be escaped to render, so we do that instead of just the `#` - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7157459/
*/
background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E');
background-repeat: no-repeat;
background-position: center left;
background-size: 36px;
}
.todo-list li .toggle:checked+label {
background-size: 36px;
background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22/%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22/%3E%3C/svg%3E');
}
.todo-list li label {
word-break: break-all;
padding: 15px 15px 15px 50px;
display: block;
line-height: 1.0;
font-size: 14px;
transition: color 0.4s;
}
.todo-list li.completed label {
color: #d9d9d9;
text-decoration: line-through;
}
.todo-list li .destroy {
display: none;
position: absolute;
top: 0;
right: 10px;
bottom: 0;
width: 40px;
height: 40px;
margin: auto 0;
font-size: 30px;
color: #cc9a9a;
transition: color 0.2s ease-out;
cursor: pointer;
}
.todo-list li .destroy:hover {
color: #af5b5e;
}
.todo-list li .destroy:after {
content: '×';
}
.todo-list li:hover .destroy {
display: block;
}
.todo-list li .edit {
display: none;
}
.todo-list li.editing:last-child {
margin-bottom: -1px;
}
.footer {
color: #777;
position: relative;
padding: 10px 15px;
height: 40px;
text-align: center;
border-top: 1px solid #e6e6e6;
}
.footer:before {
content: '';
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 40px;
overflow: hidden;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6, 0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6, 0 17px 2px -6px rgba(0, 0, 0, 0.2);
}
.todo-count {
float: left;
text-align: left;
}
.todo-count strong {
font-weight: 300;
}
.filters {
margin: 0;
padding: 0;
position: relative;
z-index: 1;
list-style: none;
}
.filters li {
display: inline;
}
.filters li a {
color: inherit;
font-size: 12px;
padding: 3px 7px;
text-decoration: none;
border: 1px solid transparent;
border-radius: 3px;
}
.filters li a:hover {
border-color: rgba(175, 47, 47, 0.1);
}
.filters li a.selected {
border-color: rgba(175, 47, 47, 0.2);
}
.clear-completed,
html .clear-completed:active {
float: right;
position: relative;
line-height: 20px;
text-decoration: none;
cursor: pointer;
}
.clear-completed:hover {
text-decoration: underline;
}
.info {
margin: 65px auto 0;
color: #bfbfbf;
font-size: 10px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
text-align: center;
}
.info p {
line-height: 1;
}
.info a {
color: inherit;
text-decoration: none;
font-weight: 400;
}
.info a:hover {
text-decoration: underline;
}
/*
Hack to remove background from Mobile Safari.
Can't use it globally since it destroys checkboxes in Firefox
*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
.toggle-all,
.todo-list li .toggle {
background: none;
}
.todo-list li .toggle {
height: 40px;
}
}
@media (max-width: 430px) {
.footer {
height: 50px;
}
.filters {
bottom: 10px;
}
}
}

View File

@ -0,0 +1,127 @@
<template>
<section class="todoapp">
<!-- header -->
<header class="header">
<input class="new-todo" autocomplete="off" placeholder="Todo List" @keyup.enter="addTodo">
</header>
<!-- main section -->
<section v-show="todos.length" class="main">
<input id="toggle-all" :checked="allChecked" class="toggle-all" type="checkbox" @change="toggleAll({ done: !allChecked })">
<label for="toggle-all" />
<ul class="todo-list">
<todo
v-for="(todo, index) in filteredTodos"
:key="index"
:todo="todo"
@toggleTodo="toggleTodo"
@editTodo="editTodo"
@deleteTodo="deleteTodo"
/>
</ul>
</section>
<!-- footer -->
<footer v-show="todos.length" class="footer">
<span class="todo-count">
<strong>{{ remaining }}</strong>
{{ remaining | pluralize('item') }} left
</span>
<ul class="filters">
<li v-for="(val, key) in filters" :key="key">
<a :class="{ selected: visibility === key }" @click.prevent="visibility = key">{{ key | capitalize }}</a>
</li>
</ul>
<!-- <button class="clear-completed" v-show="todos.length > remaining" @click="clearCompleted">
Clear completed
</button> -->
</footer>
</section>
</template>
<script>
import Todo from './Todo.vue'
const STORAGE_KEY = 'todos'
const filters = {
all: todos => todos,
active: todos => todos.filter(todo => !todo.done),
completed: todos => todos.filter(todo => todo.done)
}
const defalutList = [
{ text: 'star this repository', done: false },
{ text: 'fork this repository', done: false },
{ text: 'follow author', done: false },
{ text: 'vue-element-admin', done: true },
{ text: 'vue', done: true },
{ text: 'element-ui', done: true },
{ text: 'axios', done: true },
{ text: 'webpack', done: true }
]
export default {
components: { Todo },
filters: {
pluralize: (n, w) => n === 1 ? w : w + 's',
capitalize: s => s.charAt(0).toUpperCase() + s.slice(1)
},
data() {
return {
visibility: 'all',
filters,
// todos: JSON.parse(window.localStorage.getItem(STORAGE_KEY)) || defalutList
todos: defalutList
}
},
computed: {
allChecked() {
return this.todos.every(todo => todo.done)
},
filteredTodos() {
return filters[this.visibility](this.todos)
},
remaining() {
return this.todos.filter(todo => !todo.done).length
}
},
methods: {
setLocalStorage() {
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(this.todos))
},
addTodo(e) {
const text = e.target.value
if (text.trim()) {
this.todos.push({
text,
done: false
})
this.setLocalStorage()
}
e.target.value = ''
},
toggleTodo(val) {
val.done = !val.done
this.setLocalStorage()
},
deleteTodo(todo) {
this.todos.splice(this.todos.indexOf(todo), 1)
this.setLocalStorage()
},
editTodo({ todo, value }) {
todo.text = value
this.setLocalStorage()
},
clearCompleted() {
this.todos = this.todos.filter(todo => !todo.done)
this.setLocalStorage()
},
toggleAll({ done }) {
this.todos.forEach(todo => {
todo.done = done
this.setLocalStorage()
})
}
}
}
</script>
<style lang="scss">
@import './index.scss';
</style>

View File

@ -0,0 +1,55 @@
<template>
<el-table :data="list" style="width: 100%;padding-top: 15px;">
<el-table-column label="Order_No" min-width="200">
<template slot-scope="scope">
{{ scope.row.order_no | orderNoFilter }}
</template>
</el-table-column>
<el-table-column label="Price" width="195" align="center">
<template slot-scope="scope">
¥{{ scope.row.price | toThousandFilter }}
</template>
</el-table-column>
<el-table-column label="Status" width="100" align="center">
<template slot-scope="{row}">
<el-tag :type="row.status | statusFilter">
{{ row.status }}
</el-tag>
</template>
</el-table-column>
</el-table>
</template>
<script>
import { transactionList } from '@/api/remote-search'
export default {
filters: {
statusFilter(status) {
const statusMap = {
success: 'success',
pending: 'danger'
}
return statusMap[status]
},
orderNoFilter(str) {
return str.substring(0, 30)
}
},
data() {
return {
list: null
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
transactionList().then(response => {
this.list = response.data.items.slice(0, 8)
})
}
}
}
</script>

View File

@ -0,0 +1,55 @@
import { debounce } from '@/utils'
export default {
data() {
return {
$_sidebarElm: null,
$_resizeHandler: null
}
},
mounted() {
this.$_resizeHandler = debounce(() => {
if (this.chart) {
this.chart.resize()
}
}, 100)
this.$_initResizeEvent()
this.$_initSidebarResizeEvent()
},
beforeDestroy() {
this.$_destroyResizeEvent()
this.$_destroySidebarResizeEvent()
},
// to fixed bug when cached by keep-alive
// https://github.com/PanJiaChen/vue-element-admin/issues/2116
activated() {
this.$_initResizeEvent()
this.$_initSidebarResizeEvent()
},
deactivated() {
this.$_destroyResizeEvent()
this.$_destroySidebarResizeEvent()
},
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_initResizeEvent() {
window.addEventListener('resize', this.$_resizeHandler)
},
$_destroyResizeEvent() {
window.removeEventListener('resize', this.$_resizeHandler)
},
$_sidebarResizeHandler(e) {
if (e.propertyName === 'width') {
this.$_resizeHandler()
}
},
$_initSidebarResizeEvent() {
this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
},
$_destroySidebarResizeEvent() {
this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
}
}
}

View File

@ -1,7 +1,46 @@
<template>
<div class="dashboard-container">
<div class="dashboard-text">name: {{ name }}</div>
<div class="dashboard-text">perms: <span v-for="perm in perms" :key="perm">{{ perm }}</span></div>
<el-row :gutter="40" class="panel-group">
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="toPath('/cma')">
<div class="card-panel-icon-wrapper icon-people">
<svg-icon icon-class="table" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
检测能力(总部)
</div>
<!-- <count-to :start-val="0" v-bind:end-val="ret.consumer1_count" :duration="1600" class="card-panel-num" /> -->
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="toPath('/cma2')">
<div class="card-panel-icon-wrapper icon-message">
<svg-icon icon-class="table" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
检测能力(分子公司)
</div>
<!-- <count-to :start-val="0" v-bind:end-val="ret.consumer2_count" :duration="1600" class="card-panel-num" /> -->
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="toPath('/qualification')">
<div class="card-panel-icon-wrapper icon-money">
<svg-icon icon-class="table" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
资质查询
</div>
<!-- <count-to :start-val="0" v-bind:end-val="ret.test_count" :duration="1600" class="card-panel-num" /> -->
</div>
</div>
</el-col>
</el-row>
</div>
</template>
@ -15,6 +54,11 @@ export default {
'name',
'perms'
])
},
methods:{
toPath(val) {
this.$router.push({path:val})
}
}
}
</script>
@ -29,4 +73,116 @@ export default {
line-height: 46px;
}
}
.panel-group {
margin-top: 18px;
.card-panel-col {
margin-bottom: 32px;
}
.card-panel {
height: 108px;
cursor: pointer;
font-size: 12px;
position: relative;
overflow: hidden;
color: #666;
background: #fff;
box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
border-color: rgba(0, 0, 0, .05);
&:hover {
.card-panel-icon-wrapper {
color: #fff;
}
.icon-people {
background: #40c9c6;
}
.icon-message {
background: #36a3f7;
}
.icon-money {
background: #f4516c;
}
.icon-shopping {
background: #34bfa3
}
}
.icon-people {
color: #40c9c6;
}
.icon-message {
color: #36a3f7;
}
.icon-money {
color: #f4516c;
}
.icon-shopping {
color: #34bfa3
}
.card-panel-icon-wrapper {
float: left;
margin: 14px 0 0 14px;
padding: 16px;
transition: all 0.38s ease-out;
border-radius: 6px;
}
.card-panel-icon {
float: left;
font-size: 48px;
}
.card-panel-description {
float: right;
font-weight: bold;
margin: 26px;
margin-left: 0px;
.card-panel-text {
line-height: 18px;
color: rgba(0, 0, 0, 0.45);
font-size: 16px;
margin-bottom: 12px;
}
.card-panel-num {
font-size: 20px;
}
}
}
}
@media (max-width:550px) {
.card-panel-icon-wrapper {
float: none !important;
width: 100%;
height: 50%;
margin: 0 !important;
.svg-icon {
display: block;
margin: 0px auto !important;
float: none !important;
}
}
.card-panel-description {
margin:0px !important;
float: none !important;
font-weight: bold;
/* margin: 26px; */
margin-top: 20px !important;
text-align: center;
/* margin-left: 0px; */
}
}
</style>

View File

@ -2,7 +2,7 @@
<div class="login-container">
<div class="login-form">
<div class="title-container">
<h3 class="title">ctc能力检索</h3>
<h3 class="title">国检集团检测能力查询平台</h3>
</div>
<el-tabs v-model="activeName" :stretch="true">
<el-tab-pane label="验证码登陆" name="msg">
@ -59,7 +59,7 @@
</el-tab-pane>
<el-tab-pane label="账户密码登陆" name="pwd">
<el-tab-pane label="密码登陆" name="pwd">
<el-form
ref="loginForm"
:model="loginForm"

View File

@ -0,0 +1,78 @@
<template>
<div class="app-container">
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
<el-form-item label="旧密码" prop="old_password">
<el-input v-model="formData.old_password" placeholder="请输入旧密码" clearable show-password
:style="{width: '100%'}"></el-input>
</el-form-item>
<el-form-item label="新密码" prop="new_password1">
<el-input v-model="formData.new_password1" placeholder="请输入新密码" clearable show-password
:style="{width: '100%'}"></el-input>
</el-form-item>
<el-form-item label="新密码" prop="new_password2">
<el-input v-model="formData.new_password2" placeholder="请再次输入新密码" clearable show-password
:style="{width: '100%'}"></el-input>
</el-form-item>
<el-form-item size="large">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="resetForm">重置</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { changePassword } from "@/api/user"
export default {
components: {},
props: [],
data() {
return {
formData: {
old_password: undefined,
new_password1: undefined,
new_password2: undefined,
},
rules: {
old_password: [{
required: true,
message: '请输入旧密码',
trigger: 'blur'
}],
new_password1: [{
required: true,
message: '请输入新密码',
trigger: 'blur'
}],
new_password2: [{
required: true,
message: '请再次输入新密码',
trigger: 'blur'
}],
},
}
},
computed: {},
watch: {},
created() {},
mounted() {},
methods: {
submitForm() {
this.$refs['elForm'].validate(valid => {
if (!valid) return
// TODO 提交表单
changePassword(this.formData).then(async(res)=>{
this.$message({
message: '密码修改成功,请重新登陆',
type: 'success'
})
await this.$store.dispatch('user/logout')
this.$router.push(`/login`)
})
})
},
resetForm() {
this.$refs['elForm'].resetFields()
},
}
}
</script>

View File

@ -1,142 +1,169 @@
<template>
<div class="app-container">
<el-row :gutter="6">
<el-col :xs="24" :md="6">
<el-card>
<div slot="header" class="clearfix">
<span>部门</span>
</div>
<el-input v-model="filterOrgText" placeholder="输入部门名进行过滤" />
<el-tree
ref="tree"
v-loading="treeLoding"
class="filter-tree"
:data="orgData"
default-expand-all
highlight-current
:expand-on-click-node="false"
:filter-node-method="filterNode"
style="margin-top:10px;"
@node-click="handleOrgClick"
/>
<span>部门</span>
</div>
<el-input v-model="filterOrgText" placeholder="输入部门名进行过滤" />
<el-tree
ref="tree"
v-loading="treeLoding"
class="filter-tree"
:data="orgData"
default-expand-all
highlight-current
:expand-on-click-node="false"
:filter-node-method="filterNode"
style="margin-top: 10px"
@node-click="handleOrgClick"
/>
</el-card>
</el-col>
<el-col :xs="24" :md="18">
<el-card>
<div slot="header" class="clearfix">
<span>用户</span>
</div>
<div>
<el-select
v-model="listQuery.is_active"
placeholder="状态"
clearable
style="width: 90px"
class="filter-item"
@change="handleFilter"
>
<el-option
v-for="item in enabledOptions"
:key="item.key"
:label="item.display_name"
:value="item.key"
<span>用户</span>
</div>
<div>
<el-select
v-model="listQuery.is_active"
placeholder="状态"
clearable
style="width: 90px"
class="filter-item"
@change="handleFilter"
>
<el-option
v-for="item in enabledOptions"
:key="item.key"
:label="item.display_name"
:value="item.key"
/>
</el-select>
<el-input
v-model="listQuery.name"
placeholder="姓名"
style="width: 200px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
</el-select>
<el-input
v-model="listQuery.name"
placeholder="姓名"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button>
<el-button
class="filter-item"
style="margin-left: 10px;"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新重置</el-button>
</div>
<div style="margin-top:10px">
<el-button type="primary" icon="el-icon-plus" @click="handleAddUser">新增</el-button>
</div>
<el-table
v-loading="listLoading"
:data="userList.results"
style="width: 100%;margin-top:10px;"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column align="center" label="姓名">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column align="header-center" label="账户">
<template slot-scope="scope">{{ scope.row.username }}</template>
</el-table-column>
<el-table-column align="header-center" label="部门">
<template
v-if="scope.row.dept_name != null"
slot-scope="scope"
>{{ scope.row.dept_name }}</template>
</el-table-column>
<el-table-column align="header-center" label="角色" >
<template slot-scope="scope">
<el-tag style="margin:2px" effect="plain" v-for="(item, index) in scope.row.roles_" :key="index">
{{item.name}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="创建日期">
<template slot-scope="scope">
<span>{{ scope.row.date_joined }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
v-if="!scope.row.is_superuser"
:disabled="!checkPermission(['user_update'])"
type="primary"
size="small"
icon="el-icon-edit"
@click="handleEdit(scope)"
/>
<el-button
v-if="!scope.row.is_superuser"
:disabled="!checkPermission(['user_delete'])"
type="danger"
size="small"
icon="el-icon-delete"
@click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
style="margin-left: 10px"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新重置</el-button
>
</div>
<div style="margin-top: 10px">
<el-button type="primary" icon="el-icon-plus" @click="handleAddUser"
>新增</el-button
>
</div>
<el-table
v-loading="listLoading"
:data="userList.results"
style="width: 100%; margin-top: 10px"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column align="center" label="姓名">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column align="header-center" label="账户">
<template slot-scope="scope">{{ scope.row.username }}</template>
</el-table-column>
<el-table-column align="header-center" label="部门">
<template v-if="scope.row.dept_name != null" slot-scope="scope">{{
scope.row.dept_name
}}</template>
</el-table-column>
<el-table-column align="header-center" label="角色">
<template slot-scope="scope">
<el-tag
style="margin: 2px"
effect="plain"
v-for="(item, index) in scope.row.roles_"
:key="index"
>
{{ item.name }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="创建日期">
<template slot-scope="scope">
<span>{{ scope.row.date_joined }}</span>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="200px"
fixed="right"
>
<template slot-scope="scope">
<el-button
v-if="checkPermission(['admin'])"
type="primary"
size="small"
@click="handeReset(scope)"
>重置密码</el-button
>
<el-button
:disabled="!checkPermission(['user_update'])"
type="primary"
size="small"
icon="el-icon-edit"
@click="handleEdit(scope)"
/>
<el-button
v-if="!scope.row.is_superuser"
:disabled="!checkPermission(['user_delete'])"
type="danger"
size="small"
icon="el-icon-delete"
@click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
<pagination
v-show="userList.count>0"
:total="userList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
<pagination
v-show="userList.count > 0"
:total="userList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</el-col>
</el-row>
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑用户':'新增用户'">
<el-form ref="Form" :model="user" label-width="80px" label-position="right" :rules="rule1">
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑用户' : '新增用户'"
>
<el-form
ref="Form"
:model="user"
label-width="80px"
label-position="right"
:rules="rule1"
>
<el-form-item label="姓名" prop="name">
<el-input v-model="user.name" placeholder="姓名" />
</el-form-item>
@ -144,10 +171,20 @@
<el-input v-model="user.username" placeholder="账户" />
</el-form-item>
<el-form-item label="所属部门" prop="dept">
<treeselect v-model="user.dept" :multiple="false" :options="orgData" placeholder="所属部门"/>
<treeselect
v-model="user.dept"
:multiple="false"
:options="orgData"
placeholder="所属部门"
/>
</el-form-item>
<el-form-item label="角色" prop="roles">
<el-select v-model="user.roles" multiple placeholder="请选择" style="width:100%">
<el-select
v-model="user.roles"
multiple
placeholder="请选择"
style="width: 100%"
>
<el-option
v-for="item in roles"
:key="item.value"
@ -171,8 +208,8 @@
</el-upload>
</el-form-item>
</el-form>
<div style="text-align:right;">
<el-button type="danger" @click="dialogVisible=false">取消</el-button>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
@ -204,21 +241,27 @@
}
</style>
<script>
import { getUserList, createUser, deleteUser, updateUser } from "@/api/user";
import { getOrgAll } from "@/api/org"
import { getRoleAll } from "@/api/role"
import { genTree } from "@/utils"
import checkPermission from "@/utils/permission"
import { upUrl, upHeaders } from "@/api/file"
import Pagination from "@/components/Pagination" // secondary package based on el-pagination
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {
getUserList,
createUser,
deleteUser,
updateUser,
resetUserpw,
} from "@/api/user";
import { getOrgAll } from "@/api/org";
import { getRoleAll } from "@/api/role";
import { genTree } from "@/utils";
import checkPermission from "@/utils/permission";
import { upUrl, upHeaders } from "@/api/file";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
const defaultUser = {
id: "",
name: "",
username: "",
dept: null,
avatar: "/media/default/avatar.png"
avatar: "/media/default/avatar.png",
};
export default {
components: { Pagination, Treeselect },
@ -227,37 +270,39 @@ export default {
user: defaultUser,
upHeaders: upHeaders(),
upUrl: upUrl(),
userList: {count:0},
userList: { count: 0 },
roles: [],
listLoading: true,
listQuery: {
page: 1,
page_size: 20
page_size: 20,
},
enabledOptions: [
{ key: "true", display_name: "激活" },
{ key: "false", display_name: "禁用" }
{ key: "false", display_name: "禁用" },
],
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
username: [{ required: true, message: "请输入账号", trigger: "change" }],
roles: [{ required: true, message: "请选择角色", trigger: "change" }]
username: [
{ required: true, message: "请输入账号", trigger: "change" },
],
roles: [{ required: true, message: "请选择角色", trigger: "change" }],
// password: [
// { required: true, message: '请输入密码', trigger: 'change' }
// ],
},
filterOrgText: "",
treeLoding: false,
orgData: []
orgData: [],
};
},
computed: {},
watch: {
filterOrgText(val) {
this.$refs.tree.filter(val);
}
},
},
created() {
this.getList();
@ -268,9 +313,9 @@ export default {
checkPermission,
handleAvatarSuccess(res, file) {
if (res.code >= 200) {
this.user.avatar = res.data.path
this.user.avatar = res.data.path;
} else {
this.$message.error("头像上传失败!")
this.$message.error("头像上传失败!");
}
},
beforeAvatarUpload(file) {
@ -291,29 +336,29 @@ export default {
},
getList() {
this.listLoading = true;
getUserList(this.listQuery).then(response => {
getUserList(this.listQuery).then((response) => {
if (response.data) {
this.userList = response.data
this.userList = response.data;
}
this.listLoading = false;
});
},
getOrgAll() {
this.treeLoding = true;
getOrgAll().then(response => {
getOrgAll().then((response) => {
this.orgData = genTree(response.data);
this.treeLoding = false;
});
},
getRoleAll() {
getRoleAll().then(response => {
getRoleAll().then((response) => {
this.roles = genTree(response.data);
});
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20
page_size: 20,
};
this.getList();
},
@ -341,35 +386,35 @@ export default {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error"
type: "error",
})
.then(async () => {
await deleteUser(scope.row.id);
this.userList.splice(scope.row.index, 1);
this.$message.success('成功')
this.$message.success("成功");
})
.catch(err => {
.catch((err) => {
console.error(err);
});
},
async confirm(form) {
this.$refs[form].validate(valid => {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateUser(this.user.id, this.user).then(res => {
updateUser(this.user.id, this.user).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success('成功')
this.$message.success("成功");
}
});
} else {
createUser(this.user).then(res => {
createUser(this.user).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success('成功')
this.$message.success("成功");
}
});
}
@ -377,7 +422,20 @@ export default {
return false;
}
});
}
}
},
handeReset(scope) {
this.$confirm("确认重置密码为0000吗?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
resetUserpw(scope.row.id)
.then((res) => {
this.$message.success('成功');
})
.catch((e) => {});
});
},
},
};
</script>

View File

@ -19,7 +19,7 @@ class CMAViewSet(ModelViewSet):
'put': 'cma_update', 'delete': 'cma_delete'}
queryset = CMA.objects.all()
serializer_class = CMASerializer
search_fields = ['bzbh', 'bzmc', 'sszx', 'xmmc', 'glzz']
search_fields = ['bzbh', 'bzmc', 'sszx', 'xmmc', 'glzz', 'dlmc']
filterset_fields = ['sszx', 'type', 'glzz']
ordering_fields = ['xmxh']
ordering = 'sszx'

View File

@ -83,7 +83,7 @@ class UserListSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'name', 'phone', 'email', 'position',
'username', 'is_active', 'date_joined', 'dept_name', 'dept', 'roles', 'avatar','roles_')
'username', 'is_active', 'date_joined', 'dept_name', 'dept', 'roles', 'avatar','roles_', 'is_superuser')
@staticmethod
def setup_eager_loading(queryset):

View File

@ -88,11 +88,11 @@ class sendMsg(APIView):
return Response('该账户不存在', status=status.HTTP_400_BAD_REQUEST)
try:
# 邮件内容
msg=MIMEText('ctc能力检索本次验证码为' + str(code),'plain','utf-8')
msg=MIMEText('您好,能力查询本次登陆验证码为' + str(code),'plain','utf-8')
# 括号里的对应发件人邮箱昵称、发件人邮箱账号
msg['From']=formataddr(["国检集团能力检索",my_sender])
msg['From']=formataddr(["国检集团检测能力查询平台",my_sender])
# 括号里的对应收件人邮箱昵称、收件人邮箱账号
msg['To']=formataddr(["国检集团",my_user])
msg['To']=formataddr(["",my_user])
# 邮件的主题
msg['Subject'] = Header(str(code), 'utf-8').encode()
@ -244,13 +244,13 @@ class UserViewSet(ModelViewSet):
serializer.save(password=password)
return Response(serializer.data)
@action(methods=['put'], detail=True, permission_classes=[IsAuthenticated],
@action(methods=['put'], detail=False, permission_classes=[IsAuthenticated],
url_name='change_password')
def password(self, request, pk=None):
"""
修改密码
用户修改密码
"""
user = User.objects.get(id=pk)
user = request.user
old_password = request.data['old_password']
if check_password(old_password, user.password):
new_password1 = request.data['new_password1']
@ -283,6 +283,18 @@ class UserViewSet(ModelViewSet):
}
return Response(data)
@action(methods=['put'], detail=True, url_name='userpw_reset', perms_map={'put':'userpw_reset'})
def resetpw(self, request, pk=None):
"""
重置密码
"""
if request.user.is_superuser:
user = self.get_object()
user.set_password('0000')
user.save()
return Response('密码已重置为0000', status=status.HTTP_200_OK)
return Response('权限不足', status=status.HTTP_400_BAD_REQUEST)
from django.conf import settings
from rest_framework.parsers import (FileUploadParser, JSONParser,
MultiPartParser)