Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

This commit is contained in:
qinjie 2021-09-13 09:33:56 +08:00
commit 2053181a9d
18 changed files with 1234 additions and 218 deletions

69
src/api/person/person.js Normal file
View File

@ -0,0 +1,69 @@
import request from '@/utils/request'
const personApi = {
addOrUpdate: 'person/addOrUpdate',
del: 'person/del',
get: 'person/get',
page: 'person/pageList',
transferOrg: 'person/transferOrg',
quit: 'person/quit',
resetPwd: 'person/resetPwd',
setAdmin: 'person/setAdmin',
}
export function personAddOrUpdate (params) {
return request({
url: personApi.addOrUpdate,
method: 'post',
data: params
})
}
export function personGet (params) {
return request({
url: personApi.get,
method: 'get',
params: params
})
}
export function personDel (params) {
return request({
url: personApi.del,
method: 'post',
params: params
})
}
export function personPage (params) {
return request({
url: personApi.page,
method: 'get',
params: params
})
}
export function personTransferOrg (params) {
return request({
url: personApi.transferOrg,
method: 'get',
params: params
})
}
export function personQuit (params) {
return request({
url: personApi.quit,
method: 'get',
params: params
})
}
export function personResetPwd (params) {
return request({
url: personApi.resetPwd,
method: 'get',
params: params
})
}
export function personSetAdmin (params) {
return request({
url: personApi.setAdmin,
method: 'get',
params: params
})
}

View File

@ -14,8 +14,7 @@ export function actionToObject (json) {
*/ */
export function hasBtnPermission (permission) { export function hasBtnPermission (permission) {
const myBtns = store.getters.buttons const myBtns = store.getters.buttons
const name = store.getters.name if (myBtns.indexOf('*:*:*') > -1) {
if (name == 'admin') {
return true return true
} }
return myBtns.indexOf(permission) > -1 return myBtns.indexOf(permission) > -1

View File

@ -96,15 +96,15 @@
sm: { span: 15 } sm: { span: 15 }
}, },
orgTree: [], orgTree: [],
modalTitle: "新增机构", modalTitle: '新增机构',
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
formLoading: true, formLoading: true,
replaceFields: { replaceFields: {
children:'children', children: 'children',
title:'name', title: 'name',
key:'id', key: 'id',
value:'id' value: 'id'
}, },
form: this.$form.createForm(this) form: this.$form.createForm(this)
} }
@ -140,7 +140,7 @@
getOrgTree () { getOrgTree () {
orgList().then((res) => { orgList().then((res) => {
this.formLoading = false this.formLoading = false
if (!res.code === 200) { if (!res.code === 200 || !res.data.length) {
this.orgTree = [] this.orgTree = []
return return
} }
@ -190,7 +190,6 @@
this.confirmLoading = false this.confirmLoading = false
}) })
} }
} else { } else {
this.confirmLoading = false this.confirmLoading = false
} }

124
src/views/org/OrgTree.vue Normal file
View File

@ -0,0 +1,124 @@
<template>
<a-modal v-model="isShowOrg" title="选择机构" :footer="null" >
<div>
<a-input-search style="margin-bottom: 8px" placeholder="搜索名称" @change="onChange" />
<a-tree
:disable-branch-nodes="true"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:tree-data="orgList"
@expand="onExpand"
@select="onSelect"
:replaceFields="{
children:'children',
title:'name',
key:'id'
}"
>
<template slot="name" slot-scope="{ name }">
<span v-if="name.indexOf(searchValue) > -1">
{{ name.substr(0, name.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>
{{ name.substr(name.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ name }}</span>
</template>
</a-tree>
</div>
</a-modal>
</template>
<script>
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
const rootParentId = 0
// dataList,便
const dataList = []
const generateList = data => {
for (let i = 0; i < data.length; i++) {
const node = data[i]
// ,
node.scopedSlots = { title: 'name' }
const id = node.id
const name = node.name
dataList.push({ id, name })
if (node.children) {
generateList(node.children)
}
}
}
// id
const getParentKey = (id, tree) => {
let parentKey
for (let i = 0; i < tree.length; i++) {
const node = tree[i]
if (node.children) {
if (node.children.some(item => item.id === id)) {
parentKey = node.id
} else if (getParentKey(id, node.children)) {
parentKey = getParentKey(id, node.children)
}
}
}
return parentKey
}
export default {
data () {
return {
expandedKeys: [],
searchValue: '',
autoExpandParent: true,
orgList: [],
isShowOrg: false
}
},
methods: {
onExpand (expandedKeys) {
this.expandedKeys = expandedKeys
this.autoExpandParent = false
},
onSelect (selectedKeys, info) {
var orgInfo = info.node.dataRef
const org = { id: orgInfo.id, name: orgInfo.name }
this.$emit('selectOrg', org)
this.isShowOrg = false
},
onChange (e) {
const value = e.target.value
//
const expandedKeys = dataList
.map(item => {
if (item.name.indexOf(value) > -1) {
return getParentKey(item.id, this.orgList)
}
return null
})
.filter((item, i, self) => item && self.indexOf(item) === i)
// ,
Object.assign(this, {
expandedKeys,
searchValue: value,
autoExpandParent: true
})
},
loadOrg () {
orgList().then(res => {
if (!res.code === 200 || !res.data.length) {
return
}
const orgTree = listToTree(res.data, [], rootParentId)
for (var item of orgTree) {
if (item.pid === 0) {
this.expandedKeys.push(item.id)
}
}
generateList(orgTree)
this.orgList = orgTree
})
this.isShowOrg = true
}
}
}
</script>

View File

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@ -0,0 +1,332 @@
<template>
<a-modal
:title="modalTitle"
:width="900"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading">
<a-divider orientation="left">基本信息</a-divider>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item style="display: none;">
<a-input v-decorator="['id']" />
</a-form-item>
<a-form-item style="display: none;">
<a-input v-decorator="['userId']" />
</a-form-item>
<a-form-item
label="用户名"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入用户名" v-decorator="['userName', {rules: [{required: true, min: 5, message: '请输入至少五个字符的账号'}]}]" />
</a-form-item>
</a-form>
</a-col>
<a-col :md="12" :sm="24" >
<a-form :form="form">
<a-form-item
label="姓名"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入姓名" v-decorator="['name', {rules: [{required: true, message: '请输入姓名'}]}]" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="身份证"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入身份证" v-decorator="['idCardNo', {rules: [{required: true, message: '请输入身份证'}]}]" @blur="idCardNoBlur"/>
</a-form-item>
</a-form>
</a-col>
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="年龄"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input readOnly v-decorator="['age']" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="性别"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
>
<a-radio-group readOnly v-decorator="['sex',{rules: [{ required: true, message: '请选择性别' }]}]" >
<a-radio :value="1"></a-radio>
<a-radio :value="2"></a-radio>
</a-radio-group>
</a-form-item>
</a-form>
</a-col>
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="手机号"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入手机号" v-decorator="['phone',{rules: [{ required: true, message: '请输入手机号' }]}]" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="24" :sm="24">
<a-form :form="form">
<a-form-item
label="岗位"
:labelCol="{span: 3}"
:wrapperCol="{span: 20}"
has-feedback
>
<a-input v-decorator="['jobs',{rules: [{ required: true, message: '请输入岗位' }]}]" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="工种"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input v-decorator="['workType',{rules: [{ required: true, message: '请输入工种' }]}]" />
</a-form-item>
</a-form>
</a-col>
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="学历"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input v-decorator="['degreeId',{rules: [{ required: true, message: '请输入工种' }]}]" />
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="24" :sm="24">
<a-form :form="form">
<a-form-item
label="人员类型"
:labelCol="{span: 3}"
:wrapperCol="{span: 20}"
>
<a-checkbox-group v-decorator="['type',{rules: [{ required: true, message: '请选择人员类型!' }]}]">
<a-checkbox value="1" name="type">
单位主要负责人
</a-checkbox>
<a-checkbox value="2" name="type">
安全管理员
</a-checkbox>
<a-checkbox value="3" name="type">
班组长
</a-checkbox>
<a-checkbox value="4" name="type">
特种作业人员
</a-checkbox>
<a-checkbox value="5" name="type">
其他
</a-checkbox>
</a-checkbox-group>
</a-form-item>
</a-form>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :md="12" :sm="24">
<a-form :form="form">
<a-form-item
label="部门信息"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input readOnly @click="openOrgTree" v-decorator="['orgName',{rules: [{ required: true, message: '请选择机构' }]}]" />
</a-form-item>
<a-form-item style="display: none;">
<a-input v-decorator="['orgId']" />
</a-form-item>
</a-form>
</a-col>
</a-row>
</a-spin>
<org-tree @selectOrg="selectOrg($event)" ref="orgModal"/>
</a-modal>
</template>
<script>
import { personAddOrUpdate, personGet } from '@/api/person/person'
import OrgTree from '../org/OrgTree'
export default {
components: {
OrgTree
},
data () {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
modalTitle: '新增人员',
visible: false,
confirmLoading: false,
form: this.$form.createForm(this)
}
},
methods: {
//
add () {
this.modalTitle = '新增人员'
this.visible = true
},
//
edit (record) {
this.modalTitle = '编辑人员'
this.confirmLoading = true
this.visible = true
//
personGet({id: record.id}).then((res) => {
if (res.code === 200) {
const data = res.data
//
const type = data.type.split(',')
this.form.getFieldDecorator('type', { valuePropName: 'checked', initialValue: type })
this.form.setFieldsValue(
{
id: data.id,
userId: data.userId,
name: data.name,
userName: data.userName,
idCardNo: data.idCardNo,
// age: data.age,
// sex: data.sex,
phone: data.phone,
jobs: data.jobs,
workType: data.workType,
degreeId: data.degreeId,
orgId: data.orgId,
orgName: data.orgName
}
)
//
this.analyzeIdCardNo(data.idCardNo)
} else {
this.$message.error('查询失败:' + res.msg)
}
})
this.confirmLoading = false
},
handleSubmit () {
const { form: { validateFields } } = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
values.type = values.type.join(',')
console.log(values)
personAddOrUpdate(values).then((res) => {
this.confirmLoading = false
if (res.code === 200) {
this.$message.success('操作成功')
this.$emit('ok', values)
this.handleCancel()
} else {
this.$message.error('操作失败:' + res.msg)
}
}).finally((res) => {
this.confirmLoading = false
})
} else {
this.confirmLoading = false
}
})
},
idCardNoBlur (event) {
const idCardNo = event.target.value
this.analyzeIdCardNo(idCardNo)
},
analyzeIdCardNo (idCardNo) {
// undefined
if (!idCardNo) {
return
}
//
if (parseInt(idCardNo.substr(16, 1)) % 2 === 1) {
this.form.setFieldsValue({ sex: 1 })
} else {
console.log('sex 2')
this.form.setFieldsValue({ sex: 2 })
}
//
var yearBirth = idCardNo.substring(6, 10)
var monthBirth = idCardNo.substring(10, 12)
var dayBirth = idCardNo.substring(12, 14)
//
var myDate = new Date()
var monthNow = myDate.getMonth() + 1
var dayNow = myDate.getDate()
var age = myDate.getFullYear() - yearBirth
if (monthNow < monthBirth || (monthNow === monthBirth && dayNow < dayBirth)) {
age--
}
console.log(age)
//
this.form.setFieldsValue({ age })
},
openOrgTree () {
this.$refs.orgModal.loadOrg()
},
selectOrg (orgData) {
console.log(orgData)
this.form.setFieldsValue({ orgId: orgData.id })
this.form.setFieldsValue({ orgName: orgData.name })
},
handleCancel () {
this.form.resetFields()
this.visible = false
}
}
}
</script>

View File

@ -0,0 +1,347 @@
<template>
<a-row :gutter="24">
<a-col :md="5" :sm="24">
<a-card :bordered="false" :loading="treeLoading">
<div v-if="this.orgTree != ''">
<a-tree
:treeData="orgTree"
v-if="orgTree.length"
@select="handleClick"
:defaultExpandAll="true"
:defaultExpandedKeys="defaultExpandedKeys"
:replaceFields="replaceFields" />
</div>
<div v-else>
<a-empty :image="simpleImage" />
</div>
</a-card>
</a-col>
<a-col :md="19" :sm="24">
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :md="8" :sm="24">
<a-form-item label="姓名" >
<a-input v-model="queryParam.name" allow-clear placeholder="请输入姓名"/>
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-form-item label="用户名" >
<a-input v-model="queryParam.userName" allow-clear placeholder="请输入用户名"/>
</a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
</a-card>
<a-card :bordered="false">
<div class="table-operator">
<a-button @click="$refs.personForm.add()" icon="plus" type="primary" v-if="hasPerm('person:add')">新增人员</a-button>
<a-button @click="transfer" type="primary" v-if="hasPerm('person:transfer')">转移部门</a-button>
<a-button @click="quit" type="primary" v-if="hasPerm('person:quit')">离职</a-button>
<!-- <a-button @click="export" type="primary" >导出</a-button> -->
<a-button @click="setAdmin" type="primary" v-if="hasPerm('person:setAdmin')">设置管理员</a-button>
<!-- <a-button @click="import" type="primary" v-if="hasPerm('person:import')">批量导入</a-button> -->
</div>
<div class="table-operator">
<div class='person-type'>
<a-radio-group v-model="queryParam.isAdmin" @change="onRadioChange">
<a-radio :value="2">学员</a-radio>
<a-radio :value="1">管理员</a-radio>
</a-radio-group>
</div>
</div>
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
>
<template slot="registerDate" slot-scope="text, record">
{{ record.registerDate | moment('YYYY-MM-DD') }}
</template>
<span slot="action" slot-scope="text, record">
<a v-if="hasPerm('person:detail')" @click="$refs.personDetail.detial(record)">详情</a>
<a-divider type="vertical" v-if="hasPerm('person:detail')" />
<a-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')">
<a class="ant-dropdown-link">
更多 <a-icon type="down" />
</a>
<a-menu slot="overlay">
<a-menu-item v-if="hasPerm('person:edit')">
<a @click="$refs.personForm.edit(record)">编辑</a>
</a-menu-item>
<a-menu-item v-if="hasPerm('person:resetPwd')">
<a-popconfirm placement="topRight" title="确认重置密码?" @confirm="() => resetPwd(record)">
<a>重置密码</a>
</a-popconfirm>
</a-menu-item>
<a-menu-item v-if="hasPerm('person:del')">
<a-popconfirm placement="topRight" title="确认删除?" @confirm="() => personDelete(record)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</s-table>
<person-form ref="personForm" @ok="handleOk" />
<person-detail ref="personDetail" @ok="handleOk" />
<org-tree @selectOrg="selectOrg($event)" ref="orgModal"/>
</a-card>
</a-col>
</a-row>
</template>
<script>
import { STable } from '@/components'
import { Empty } from 'ant-design-vue'
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
import { personPage, personDel, personQuit, personTransferOrg, personSetAdmin, personResetPwd } from '@/api/person/person'
import PersonForm from './PersonForm'
import PersonDetail from './PersonDetail'
import OrgTree from '../org/OrgTree'
const rootParentId = 0
export default {
components: {
STable,
PersonForm,
PersonDetail,
OrgTree
},
data () {
return {
//
queryParam: {isAdmin: 2},
//
columns: [
{
title: '姓名',
dataIndex: 'name'
},
{
title: '用户名',
dataIndex: 'userName'
},
{
title: '单位信息',
dataIndex: 'unit'
},
{
title: '部门信息',
dataIndex: 'dept'
},
{
title: '年度学时要求',
dataIndex: 'classHours'
},
{
title: '注册时间',
dataIndex: 'registerDate',
scopedSlots: { customRender: 'registerDate' }
}
],
// Promise
loadData: parameter => {
return personPage(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},
orgTree: [],
selectedRowKeys: [],
selectedRows: [],
defaultExpandedKeys: [],
treeLoading: true,
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
replaceFields: {
children: 'children',
title: 'name',
key: 'id',
value: 'id'
}
}
},
created () {
/**
* 获取到机构树展开顶级下树节点考虑到后期数据量变大不建议全部展开
*/
orgList().then(res => {
this.treeLoading = false
if (!res.code === 200 || !res.data.length) {
return
}
this.orgTree = listToTree(res.data, [], rootParentId)
for (var item of this.orgTree) {
if (item.pid === 0) {
this.defaultExpandedKeys.push(item.id)
}
}
})
if (this.hasPerm('person:edit') || this.hasPerm('person:resetPwd') || this.hasPerm('person:del')) {
this.columns.push({
title: '操作',
width: '150px',
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
})
}
},
methods: {
/**
* 重置密码
*/
resetPwd (record) {
personResetPwd({ id: record.id }).then(res => {
if (res.code === 200) {
this.$message.success('重置成功')
// this.$refs.table.refresh()
} else {
this.$message.error('重置失败:' + res.message)
}
})
},
/**
* 删除用户
*/
personDelete (record) {
personDel({ id: record.id, deleteReason: '' }).then((res) => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$refs.table.refresh()
} else {
this.$message.error('删除失败:' + res.message)
}
}).catch((err) => {
this.$message.error('删除错误:' + err.message)
})
},
quit () {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
}
this.$confirm({
title: '提示',
content: '确认离职吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { 'ids': paramIds }
personQuit(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.message)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.message)
})
},
onCancel () {
}
})
},
transfer () {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
}
this.$refs.orgModal.loadOrg()
},
selectOrg (orgData) {
this.$confirm({
title: '提示',
content: '确认转移部门至'+ orgData.name +'吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { ids: paramIds,targetOrgId: orgData.id }
personTransferOrg(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.message)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.message)
})
},
onCancel () {
}
})
},
setAdmin () {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
}
this.$confirm({
title: '提示',
content: '确认设置为管理员吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { 'ids': paramIds }
personSetAdmin(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.message)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.message)
})
},
onCancel () {
}
})
},
/**
* 点击左侧机构树查询列表
*/
handleClick (e) {
this.queryParam = {
'orgId': e.toString()
}
this.$refs.table.refresh(true)
},
handleOk () {
this.$refs.table.refresh()
},
onRadioChange(e) {
this.queryParam.isAdmin = e.target.value
this.$refs.table.refresh(true)
},
onSelectChange (selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.selectedRows = selectedRows
}
}
}
</script>
<style lang="less">
.table-operator {
margin-bottom: 18px;
}
button {
margin-right: 8px;
}
.person-type span{
font-size: 24px;
}
</style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <a-card :bordered="false" title="人员档案">
<a-space direction="vertical" style="width: 100%"> <a-space direction="vertical" style="width: 100%">
<a-space direction="horizontal"> <a-space direction="horizontal">
项目名: 项目名:
@ -39,16 +39,10 @@
</a-space> </a-space>
<a-space class="table-operator" direction="horizontal"> <a-space class="table-operator" direction="horizontal">
<a-button v-if="hasPerm('project:add')" type="primary" icon="plus" @click="$refs.projectStepForm.add()">新增项目</a-button> <a-button v-if="hasPerm('project:add')" type="primary" icon="plus" @click="handledCreate">新增项目</a-button>
</a-space> </a-space>
<s-table <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.projectPageNum) || 1">
ref="table"
size="default"
rowKey="id"
:columns="columns"
:data="loadData"
>
<span slot="serial" slot-scope="text, record, index"> <span slot="serial" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
</span> </span>
@ -65,20 +59,17 @@
</template> </template>
</span> </span>
</s-table> </s-table>
<project-step-form ref="projectStepForm"></project-step-form>
</a-space> </a-space>
</div> </a-card>
</template> </template>
<script> <script>
import { STable } from '@/components' import { STable } from '@/components'
import { getProjectList } from '@/api/project/project' import { getProjectList } from '@/api/project/project'
import projectStepForm from './ProjectStepForm'
export default { export default {
components: { components: {
STable, STable,
projectStepForm,
}, },
data() { data() {
return { return {
@ -141,14 +132,17 @@ export default {
created() {}, created() {},
methods: { methods: {
// //
handledCreate() { handledCreate(record) {
return this.$router.push( this.$router.push({
// {name: 'ProjectForm'} path: '/project/projectStepForm',
{ path: 'project/project/add' } query: {
) id: record.id,
}, projectQueryParam: this.queryParam,
projectPageNum: this.$refs.table.localPagination.current
}
});
}
} }
} }
// @
</script> </script>

View File

@ -1,32 +1,21 @@
<template> <template>
<!-- PageHeader 第二种使用方式 (v-slot) -->
<a-modal <a-card :bordered="false" :title="title">
:title="modalTitle" <a-steps class="steps" :current="currentTab">
:width="1200" <a-step title="基本信息" />
:visible="visible" <a-step title="选择单位" />
:confirmLoading="confirmLoading" <a-step v-if="['2', '3', '4'].includes(form.trainWay)" title="选择课程" />
:destroyOnClose="true" <a-step title="选择人员" />
@ok="handleSubmit" <a-step title="完成" />
@cancel="handleCancel" </a-steps>
> <div class="content">
<!-- PageHeader 第二种使用方式 (v-slot) --> <step1 v-if="currentTab === 0" @nextStep="nextStep" />
<a-card :bordered="false"> <step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep" />
<a-steps class="steps" :current="currentTab"> <step3 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep" />
<a-step title="基本信息" /> <step4 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep" />
<a-step title="选择单位" /> <step5 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish" />
<a-step title="选择课程" /> </div>
<a-step title="选择人员" /> </a-card>
<a-step title="完成" />
</a-steps>
<div class="content">
<step1 v-if="currentTab === 0" @nextStep="nextStep"/>
<step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep"/>
<step3 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep"/>
<step4 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep"/>
<step5 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish"/>
</div>
</a-card>
</a-modal>
</template> </template>
<script> <script>
@ -40,8 +29,9 @@ export default {
Step2, Step2,
Step3, Step3,
}, },
data () { data() {
return { return {
title:'',
currentTab: 0, currentTab: 0,
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@ -55,54 +45,52 @@ export default {
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
type: '', type: '',
form: null form: {},
} }
}, },
methods: { methods: {
// //
add (type) { add(type) {
this.modalTitle = "新增项目" this.modalTitle = '新增项目'
this.visible = true this.visible = true
this.formLoading = false this.formLoading = false
}, },
// //
edit (record) { edit(record) {
console.log(record) console.log(record)
this.modalTitle = "编辑项目" this.modalTitle = '编辑项目'
this.visible = true this.visible = true
this.formLoading = false this.formLoading = false
}, },
// handler // handler
// //
nextStep () { nextStep() {
if (this.currentTab < 5) { if (this.currentTab < 5) {
this.currentTab += 1 this.currentTab += 1
} }
}, },
// //
prevStep () { prevStep() {
console.log("返回上一步") console.log('返回上一步')
if (this.currentTab > 0) { if (this.currentTab > 0) {
this.currentTab -= 1 this.currentTab -= 1
} }
}, },
finish () { finish() {
this.currentTab = 0 this.currentTab = 0
}, },
handleSubmit() { handleSubmit() {},
},
handleCancel() { handleCancel() {
this.visible = false; this.visible = false
} },
} },
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.steps { .steps {
max-width: 750px; max-width: 750px;
margin: 16px auto; margin: 16px auto;
} }
</style> </style>

View File

@ -73,26 +73,22 @@ export default {
this.visible = true this.visible = true
}, },
handleOk(e) { handleOk(e) {
this.$refs.ClassForm.validate((valid) => { this.confirmLoading = true
if (valid) { classAdd(this.form).then((res) => {
this.confirmLoading = true if (res.code == 200) {
classAdd(this.form).then((res) => { this.$message.success('新增成功')
if (res.code == 200) { this.confirmLoading = false
this.$message.success('新增成功') this.handleCancel()
this.confirmLoading = false
this.handleCancel()
} else {
this.$message.error('新增失败:' + res.msg)
}
})
} else { } else {
return false this.$message.error('新增失败:' + res.msg)
this.handleCancel()
} }
}) })
}, },
handleCancel(e) { handleCancel(e) {
// console.log('Clicked cancel button') // console.log('Clicked cancel button')
this.$refs.table.refresh() // this.$refs.table.refresh()
this.$parent.handleRefresh(false)
this.visible = false this.visible = false
}, },
}, },

View File

@ -50,15 +50,19 @@ export default {
}, },
methods: { methods: {
handledDel(record) { handledDel(record) {
console.log("delete-id",record) console.log('delete-id', record)
classDel({ids:record.id}).then((res) => { classDel({ ids: record.id }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$message.success('删除成功') this.$message.success('删除成功')
this.$refs.table.refresh(true) this.handleRefresh(false)
} }
}) })
}, },
getData() {}, getData() {},
//
handleRefresh(bool) {
this.$refs.table.refresh(bool)
},
}, },
created: {}, created: {},
} }

View File

@ -1,24 +1,41 @@
<template> <template>
<a-modal <a-modal
id="modal"
:title="modalTitle" :title="modalTitle"
:width="1000" :width="1200"
:visible="visible" :visible="visible"
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
:destroyOnClose="true" :destroyOnClose="true"
@ok="handleSubmit" @ok="handleSubmit"
@cancel="handleCancel" @cancel="handleCancel"
> >
<a-layout> <a-row type="flex" justify="center" align="top">
<a-layout-sider> <a-col :span="6">
<a-menu v-model="current" mode="horizontal"> <a-menu v-model="current" mode="horizontal">
<a-menu-item key="mail"> <a-icon type="mail" />系统课程</a-menu-item> <a-menu-item key="mail"> <a-icon type="mail" />系统课程</a-menu-item>
<a-menu-item key="app"> <a-icon type="appstore" />自制课程</a-menu-item> <a-menu-item key="app"> <a-icon type="appstore" />自制课程</a-menu-item>
</a-menu> </a-menu>
</a-layout-sider> <a-input-search style="margin-bottom: 8px" placeholder="Search" @change="onChange" />
<a-layout> <a-tree
<a-layout-content>Content</a-layout-content> :expanded-keys="expandedKeys"
</a-layout> :auto-expand-parent="autoExpandParent"
</a-layout> :tree-data="gData"
@expand="onExpand"
>
<template slot="title" slot-scope="{ title }">
<span v-if="title.indexOf(searchValue) > -1">
{{ title.substr(0, title.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>
{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ title }}</span>
</template>
</a-tree>
</a-col>
<a-col :span="18">
<p class="height-50">col-4</p>
</a-col>
</a-row>
</a-modal> </a-modal>
</template> </template>
@ -26,6 +43,10 @@
//jsjsjson //jsjsjson
//import from '' //import from ''
/**------------------------------------------------------------ */
/**----------------------------------------------------------------- */
export default { export default {
//import使 //import使
components: {}, components: {},
@ -36,6 +57,11 @@ export default {
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
current: ['mail'], current: ['mail'],
expandedKeys: [],
searchValue: '',
autoExpandParent: true,
gData,
} }
}, },
// data // data
@ -61,6 +87,27 @@ export default {
this.visible = false this.visible = false
this.formLoading = false this.formLoading = false
}, },
onExpand(expandedKeys) {
this.expandedKeys = expandedKeys
this.autoExpandParent = false
},
onChange(e) {
console.log(this.gData)
const value = e.target.value
const expandedKeys = dataList
.map((item) => {
if (item.title.indexOf(value) > -1) {
return getParentKey(item.key, gData)
}
return null
})
.filter((item, i, self) => item && self.indexOf(item) === i)
Object.assign(this, {
expandedKeys,
searchValue: value,
autoExpandParent: true,
})
},
}, },
created() {}, // - 访this created() {}, // - 访this
mounted() {}, // - 访DOM mounted() {}, // - 访DOM
@ -74,24 +121,4 @@ export default {
} }
</script> </script>
<style scoped> <style scoped>
#components-layout-demo-basic {
text-align: center;
}
#components-layout-demo-basic .ant-layout-sider {
background: #3ba0e9;
color: #fff;
line-height: 150px;
}
#components-layout-demo-basic .ant-layout-content {
background: rgba(16, 142, 233, 1);
color: #fff;
min-height: 1100px;
line-height: 120px;
}
#components-layout-demo-basic > .ant-layout {
margin-bottom: 48px;
}
#components-layout-demo-basic > .ant-layout:last-child {
margin: 0;
}
</style> </style>

View File

@ -5,7 +5,7 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-form-model-item label="项目名称"> <a-form-model-item label="项目名称">
<a-input v-decorator="['projectName',{rules: [{required: true, min: 1, message: '请输入项目名称'}]}]" /> <a-input v-model="form.projectName" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
@ -129,7 +129,7 @@ export default {
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
personType: [], personType: [],
form: this.$form.createForm(this, { name: 'project' }), form: {},
modalTitle: '新增项目', modalTitle: '新增项目',
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,

View File

@ -0,0 +1,135 @@
<template>
<a-card :bordered="false" title="终端培训列表">
<div class="table-page-search-wrapper">
<SearchCom
:form="queryParam"
:list="queryOptions"
@search="handleRefresh"
@reset="
() => {
;(queryParam = {}), handleRefresh()
}
"
></SearchCom>
</div>
<s-table ref="table" size="small" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.archivesUserPageNum) || 1">
<template slot="action" slot-scope="text, record">
<a href="javascript:;" @click="handleRefresh()">项目档案</a>
<a-divider type="vertical" />
<a href="javascript:;" @click="handleRefresh()">自学档案</a>
<br />
<a href="javascript:;" @click="handleRefresh()">违章档案</a>
<a-divider type="vertical" />
<a-popconfirm title="确认导出?" cancelText="取消" okText="确认" @confirm="() => handleDelete(record)">
<a href="javascript:;"> 导出 </a>
</a-popconfirm>
</template>
</s-table>
</a-card>
</template>
<script>
//jsjsjson
//import from ''
import {SearchCom} from '@/components/SearchCom'
export default {
//import使
components: { SearchCom },
props: {},
data() {
//
return {
queryParam: {
status: this.$route.query.terminalTrainQueryProjectStatus || '',
projectName: this.$route.query.terminalTrainQueryProjectName || '',
startDate: this.$route.query.terminalTrainQueryStartDate || '',
endDate: this.$route.query.terminalTrainQueryEndDate || '',
},
columns: [
{ title: '项目名称', width: 'auto', align: 'center', dataIndex: 'projectName', key: 'projectName' },
{ title: '项目时间', width: 'auto', align: 'center', dataIndex: 'projectData', key: 'projectData' },
{ title: '受训角色', width: 'auto', align: 'center', dataIndex: 'roleName', key: 'roleName' },
{ title: '应修学时', width: 'auto', align: 'center', dataIndex: 'mustClassHour', key: 'mustClassHour' },
{ title: '已修学时', width: 'auto', align: 'center', dataIndex: 'alreadyClassHour', key: 'alreadyClassHour' },
{
title: '完成状态',
width: 'auto',
align: 'center',
dataIndex: 'finishState',
key: 'finishState',
customRender: (text, record, index) => {
// 0- 1-
if (text == 0) return '未完成'
else if (text == 1) return '已完成'
},
},
{ title: '总练习题量', width: 'auto', align: 'center', dataIndex: 'addUpExercises', key: 'addUpExercises' },
{ title: '已练习题量', width: 'auto', align: 'center', dataIndex: 'alreadyExercises', key: 'alreadyExercises' },
{ title: '答对题量', width: 'auto', align: 'center', dataIndex: 'yesTopic', key: 'yesTopic' },
{ title: '正确率', width: 'auto', align: 'center', dataIndex: 'yesRate', key: 'yesRate' },
{ title: '考试成绩', width: 'auto', align: 'center', dataIndex: 'testResult', key: 'testResult' },
{ title: '补考成绩', width: 'auto', align: 'center', dataIndex: 'mendTestResult', key: 'mendTestResult' },
{ title: '考试耗时', width: 'auto', align: 'center', dataIndex: 'testTime', key: 'testTime' },
{
title: '考试状态',
width: 'auto',
align: 'center',
dataIndex: 'testState',
key: 'testState',
customRender: (text, record, index) => {
// 0- 1-
if (text == 0) return '不合格'
else if (text == 1) return '合格'
},
},
{ title: '操作', width: '90px', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } },
],
loadData: parameter => { return getArchivesUserList(Object.assign(parameter, this.queryParam)).then(res => { return res }) }
}
},
// data
computed: {
queryOptions: function () {
return [
{ type: 'input', placeholder: '项目名称', key: 'projectName' },
/** 培训状态1-未发布 2-未开始 3-进行中 4-已结束 5-已中止 */
{
type: 'select',
placeholder: '项目状态',
key: 'status',
options: [
{ id: '', name: '全部' },
{ id: '1', name: '未发布' },
{ id: '2', name: '未开始' },
{ id: '3', name: '进行中' },
{ id: '4', name: '已结束' },
{ id: '5', name: '已终止' },
],
},
{ type: 'date', placeholder: '开始时间', key: 'startDate' },
{ type: 'date', placeholder: '结束时间', key: 'endDate' },
]
},
},
//data
watch: {},
//
methods: {
handleRefresh() {
console.log('handleRefresh')
},
},
created() {}, // - 访this
mounted() {}, // - 访DOM
beforeCreate() {}, // -
beforeMount() {}, // -
beforeUpdate() {}, // -
updated() {}, // -
beforeDestroy() {}, // -
destroyed() {}, // -
activated() {}, //keep-alive
}
</script>
<style scoped>
</style>

View File

@ -229,9 +229,7 @@
this.meneTypeFunc(record.type.toString()) this.meneTypeFunc(record.type.toString())
// //
// eslint-disable-next-line no-unused-vars
const visibleDef = false const visibleDef = false
// eslint-disable-next-line eqeqeq
if (record.visible == 1) { if (record.visible == 1) {
this.visibleDef = true this.visibleDef = true
} }

View File

@ -48,7 +48,7 @@
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a v-if="hasPerm('sys:user:edit')" @click="$refs.userForm.edit(record)">编辑</a> <a v-if="hasPerm('sys:user:edit')" @click="$refs.userForm.edit(record)">编辑</a>
<a-divider type="vertical" v-if="hasPerm('sys:user:edit')" /> <a-divider type="vertical" v-if="hasPerm('sys:user:edit')" />
<a-dropdown v-if="hasPerm('sys:user:resetPwd') || hasPerm('sys:user:grantRole') || hasPerm('sys:user:delete')"> <a-dropdown v-if="hasPerm('sys:user:resetPwd') || hasPerm('sys:user:grantRole') || hasPerm('sys:user:del')">
<a class="ant-dropdown-link"> <a class="ant-dropdown-link">
更多 <a-icon type="down" /> 更多 <a-icon type="down" />
</a> </a>
@ -138,7 +138,7 @@ export default {
}, },
created () { created () {
// //
if (this.hasPerm('sys:user:edit') || this.hasPerm('sys:user:resetPwd') || this.hasPerm('sys:user:grantRole') || this.hasPerm('sys:user:delete')) { if (this.hasPerm('sys:user:edit') || this.hasPerm('sys:user:resetPwd') || this.hasPerm('sys:user:grantRole') || this.hasPerm('sys:user:del')) {
this.columns.push({ this.columns.push({
title: '操作', title: '操作',
width: '150px', width: '150px',

View File

@ -1,36 +1,34 @@
<template> <template>
<page-header-wrapper :title="false"> <a-card :bordered="false">
<a-card :bordered="false"> <div class="table-page-search-wrapper">
<div class="table-page-search-wrapper"> <SearchCom
<SearchCom :form="queryParam"
:form="queryParam" :list="queryOptions"
:list="queryOptions" @search="handleRefresh"
@search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}" >
@reset="() => {queryParam = {}, handleRefresh()}" > </SearchCom>
</SearchCom> </div>
</div> <s-table
<s-table ref="table"
ref="table" size="default"
size="default" rowKey="id"
rowKey="id" :columns="columns"
:columns="columns" :data="loadData"
:data="loadData" >
> <template slot="action" slot-scope="text, record">
<template slot="action" slot-scope="text, record"> <a href="javascript:;" @click="handleEdit(record)">修改</a>
<a href="javascript:;" @click="handleEdit(record)">修改</a> <a-divider type="vertical" />
<a-divider type="vertical" /> <a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)"> <a href="javascript:;">删除</a>
<a href="javascript:;">删除</a> </a-popconfirm>
</a-popconfirm> <a-divider type="vertical" />
<a-divider type="vertical" /> <a href="javascript:;" @click="handleDetail(record)">详情</a>
<a href="javascript:;" @click="handleDetail(record)">详情</a> <a-divider type="vertical" />
<a-divider type="vertical" /> <router-link :to="'/dictionary/dictionaryItem/list/' + record.dictionaryCode">词典项</router-link>
<router-link :to="'/dictionary/dictionaryItem/list/' + record.dictionaryCode">词典项</router-link> </template>
</template> </s-table>
</s-table> <dictionary-form ref="modal" @ok="handleOk" />
<dictionary-form ref="modal" @ok="handleOk" /> </a-card>
</a-card>
</page-header-wrapper>
</template> </template>
<script> <script>

View File

@ -1,49 +1,47 @@
<template> <template>
<page-header-wrapper :title="false"> <a-card :bordered="false">
<a-card :bordered="false"> <div class="table-page-search-wrapper">
<div class="table-page-search-wrapper"> <a-form layout="inline">
<a-form layout="inline"> <a-row :gutter="48">
<a-row :gutter="48"> <a-col :md="6" :sm="24">
<a-col :md="6" :sm="24"> <a-form-item label="词典项名称">
<a-form-item label="词典项名称"> <a-input v-model="queryParam.name" placeholder="词典项名称" @pressEnter="handleRefresh"/>
<a-input v-model="queryParam.name" placeholder="词典项名称" @pressEnter="handleRefresh"/> </a-form-item>
</a-form-item> </a-col>
</a-col> <a-col :md="6" :sm="24">
<a-col :md="6" :sm="24"> <a-form-item label="词典项值">
<a-form-item label="词典项值"> <a-input v-model="queryParam.value" placeholder="请输入词典项值" @pressEnter="handleRefresh"/>
<a-input v-model="queryParam.value" placeholder="请输入词典项值" @pressEnter="handleRefresh"/> </a-form-item>
</a-form-item> </a-col>
</a-col> <a-col :md="6" :sm="24">
<a-col :md="6" :sm="24"> <a-button type="primary" @click="handleRefresh">查询</a-button>
<a-button type="primary" @click="handleRefresh">查询</a-button> <a-button @click="() => {queryParam = { dictionaryCode: this.$route.params.id }, handleRefresh()}">重置</a-button>
<a-button @click="() => {queryParam = { dictionaryCode: this.$route.params.id }, handleRefresh()}">重置</a-button> </a-col>
</a-col> <a-col :md="6" :sm="24" align="right" >
<a-col :md="6" :sm="24" align="right" > <a-button type="primary" @click="handleCreate">新增</a-button>
<a-button type="primary" @click="handleCreate">新增</a-button> </a-col>
</a-col> </a-row>
</a-row> </a-form>
</a-form> </div>
</div> <s-table
<s-table ref="table"
ref="table" size="default"
size="default" rowKey="id"
rowKey="id" :columns="columns"
:columns="columns" :data="loadData"
:data="loadData" >
> <template slot="action" slot-scope="text, record">
<template slot="action" slot-scope="text, record"> <a href="javascript:;" @click="handleEdit(record)">修改</a>
<a href="javascript:;" @click="handleEdit(record)">修改</a> <a-divider type="vertical" />
<a-divider type="vertical" /> <a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)"> <a href="javascript:;">删除</a>
<a href="javascript:;">删除</a> </a-popconfirm>
</a-popconfirm> <a-divider type="vertical" />
<a-divider type="vertical" /> <a href="javascript:;" @click="handleDetail(record)">详情</a>
<a href="javascript:;" @click="handleDetail(record)">详情</a> </template>
</template> </s-table>
</s-table> <dictionaryItem-form ref="modal" @ok="handleOk" />
<dictionaryItem-form ref="modal" @ok="handleOk" /> </a-card>
</a-card>
</page-header-wrapper>
</template> </template>
<script> <script>
@ -107,7 +105,7 @@ export default {
}, },
// //
handleDelete (record) { handleDelete (record) {
dictionaryItemDel({ ids: record.id, deleteReason: "" }).then(() => { dictionaryItemDel({ ids: record.id, deleteReason: '' }).then(() => {
this.$refs.table.refresh() this.$refs.table.refresh()
}) })
}, },