first commit

This commit is contained in:
2026-09-08 19:49:21 +08:00
commit ebffbab428
7320 changed files with 1477614 additions and 0 deletions
@@ -0,0 +1,554 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
#app {
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
background-color: #f0f2f5;
}
.box-card {
width: calc(100% - 20px);
height: calc(100% - 20px);
position: relative;
}
.box-card .el-card__body {
height: calc(100% - 67px - 20px);
position: relative;
}
.box-card-title {
font-size: 20px;
}
.card-body {
display: flex;
justify-content: center;
height: 100%;
position: relative;
}
.card-body-center {
width: 60%;
min-width: 800px;
height: 100%;
position: relative;
}
.card-body-center-bottom {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
display: flex;
justify-content: center;
}
.card-body-center-bottom button {
margin: 0 10px;
}
.card-body-center > .el-carousel {
height: calc(100% - 120px);
position: relative;
overflow-y: hidden;
margin-top: 10px;
}
.card-body-center > .el-carousel > .el-carousel__container {
height: 100%;
}
.carousel-table-item {
display: flex;
justify-content: center;
width: 100%;
height: 100%;
padding: 10px 0;
}
.carousel-table-item-center {
height: 100%;
width: 90%;
min-width: 800px;
position: relative;
}
.carousel-table-item-center .card-body {
position: relative;
}
.checkGroup {
display: flex;
flex-direction: column;
overflow-y: scroll;
padding-right: 10px;
height: 100%;
}
.checkGroup .el-radio, .checkGroup .el-checkbox {
padding: 12px;
margin: 0 !important;
margin-top: 15px !important;
}
.checkGroup .el-checkbox__label {
width: calc(100% - 16px);
}
.carousel-table-item-relation .el-card__body {
position: relative;
height: 100%;
}
.carousel-table-item-form .el-card__body {
position: relative;
height: 100%;
overflow-y: auto;
}
</style>
<div id="app" v-cloak>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="box-card-title">DataKid</span>
</div>
<div class="card-body">
<div class="card-body-center">
<el-steps :active="active" align-center>
<el-step title="选择数据表" icon="el-icon-document-copy"></el-step>
<el-step title="选择数据列" icon="el-icon-s-unfold"></el-step>
<el-step title="数据列对应" icon="el-icon-s-operation"></el-step>
<el-step title="提交数据" icon="el-icon-upload"></el-step>
<el-step title="导入结果" icon="el-icon-bell"></el-step>
</el-steps>
<el-carousel indicator-position="none" :autoplay="false" arrow="never" ref="carousel"
direction="vertical">
<!--表选择-->
<el-carousel-item class="carousel-table-item">
<el-card class="carousel-table-item-center">
<div slot="header" class="clearfix">
<el-input style="width: 200px" v-model="tableNameKeyWord" placeholder="请输入关键字查询"
clearable></el-input>
<el-button type="primary" icon="el-icon-search" @click="tableNameSearch"></el-button>
<el-button v-if="formData.tableName" style="float: right; padding: 10px 0" type="text">
当前选中:{{formData.tableName}}
</el-button>
</div>
<el-radio-group class="checkGroup" v-model="formData.tableName">
<el-radio v-for="item in tableOptionsClone" :key="item.table_name"
:label="item.table_name" border>
{{item.table_name}}{{item.table_comment?' ( '+item.table_comment+' )':''}}<span
style="float: right;color: #F56C6C">rows: {{item.table_rows}}</span>
</el-radio>
</el-radio-group>
</el-card>
</el-carousel-item>
<!--列选择-->
<el-carousel-item class="carousel-table-item">
<el-card class="carousel-table-item-center">
<div slot="header" class="clearfix">
<el-input style="width: 200px" v-model="columnNameKeyWord" placeholder="请输入关键字查询"
clearable></el-input>
<el-button type="primary" icon="el-icon-search" @click="columnSearch"></el-button>
<el-button style="float: right; padding: 10px 0" type="text">
{{formData.tableName}}
</el-button>
</div>
<el-checkbox-group class="checkGroup" v-model="formData.columns">
<el-checkbox v-for="item in columnOptionsClone" :key="item.column_name"
:label="item.column_name" border>
{{item.column_name}}{{item.column_comment?' ( '+item.column_comment+' )':''}}<span
style="float: right;color: #F56C6C">{{item.column_type}}</span>
</el-checkbox>
</el-checkbox-group>
</el-card>
</el-carousel-item>
<!--列对应-->
<el-carousel-item style="padding: 10px" class="carousel-table-item">
<el-card style="width: 100%" class="carousel-table-item-relation">
<el-table
:data="relation" height="100%"
style="width: 100%" border size="medium">
<el-table-column
prop="column_name"
label="列名">
</el-table-column>
<el-table-column
prop="column_comment"
label="描述" show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="is_nullable"
label="可为空">
</el-table-column>
<el-table-column
prop="column_type"
label="类型">
</el-table-column>
<el-table-column
prop="column_key"
label="key">
</el-table-column>
<el-table-column min-width="200px">
<template slot="header" slot-scope="scope">
目标列
<el-popover
placement="top-start"
title="提示"
trigger="hover"
content="excel对应的表头名称,用于和表数据列对应">
<i slot="reference" class="el-icon-question"></i>
</el-popover>
</template>
<template slot-scope="{row}">
<el-input
v-model="row.relation"
size="medium"
placeholder="目标列"/>
</template>
</el-table-column>
</el-table>
</el-card>
</el-carousel-item>
<!--提交-->
<el-carousel-item style="padding: 10px" class="carousel-table-item">
<el-card style="width: 100%" class="carousel-table-item-form">
<el-form label-width="120px" :model="formData" ref="form" :rules="formRules">
<el-form-item label="&emsp;" label-width="135px" class="view-header">
</el-form-item>
<el-form-item prop="method" label="导入方式">
<el-radio-group v-model="formData.method">
<el-radio-button :label="1">追加或更新</el-radio-button>
<el-radio-button :label="2">仅追加</el-radio-button>
<el-radio-button :label="3">仅更新</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-if="[1,3].includes(formData.method)" prop="field" label="关键字段">
<el-select v-model="formData.field" placeholder="请选择" style="width:50%">
<el-option
v-for="item in relation"
:key="item.column_name"
:label="item.column_name"
:value="item.column_name">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="plugins" label="可选插件">
<el-checkbox-group v-model="formData.plugins">
<el-checkbox v-for="v in plugins" :label="v.name" border>{{v.description}}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="文&emsp;&emsp;件" class="is-required">
<el-upload
drag
name="file"
ref="upload"
action="****"
:on-remove="handleRemove"
:on-change="handleChange"
:auto-upload="false"
:limit="1"
:file-list="fileList">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip" style="color: #F56C6C">
只能上传 xls/xlsx 文件
</div>
</el-upload>
</el-form-item>
</el-form>
</el-card>
</el-carousel-item>
<!--结果-->
<el-carousel-item style="padding: 10px">
<el-card style="width: 100%">
<div style="display: flex;justify-content: center;align-items: center;flex-direction:column ">
<el-progress type="circle" :percentage="result.success/result.total*100"
status="success"></el-progress>
<div style="font-size: 12px;color: rgb(100,100,100);margin-top: 20px">总记录数
{{result.total}} 条,成功
{{result.success}} 条!
</div>
<div style="margin-top: 5px" v-if="result.cacheKey">
<el-link type="primary" style="font-size: 12px;"
:href="loc()+'/exportErrors?cacheKey='+result.cacheKey">下载错误记录
</el-link>
</div>
</div>
</el-card>
</el-carousel-item>
</el-carousel>
<div class="card-body-center-bottom">
<el-button size="medium" @click="prev" :disabled="active==0||loading">上一步</el-button>
<el-button type="primary" size="medium" :loading="loading" @click="active<4?next():carry()">
{{active<4?'下一步':'完成'}}
</el-button>
</div>
</div>
</div>
</el-card>
</div>
<script>
var vue = new Vue({
el: '#app',
data() {
return {
active: 0,
result: {success: 0, total: 0},
loading: false,
/*提交数据*/
/*start*/
fileList: [],
plugins: {},
formRules: {
method: [{required: true, message: '必填', trigger: ['blur', 'change']}],
field: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
/*end*/
/*列对应*/
/*start*/
relation: [],
/*end*/
/*tableColumn*/
/*start*/
columnOptions: [],
columnOptionsClone: [],
columnNameKeyWord: '',
/*end*/
/*tableName*/
/*start*/
tableNameKeyWord: '',
tableOptions: [],
tableOptionsClone: [],
cacheTableName: '',
/*end*/
formData: {
tableName: '',
columns: [],
method: 1,
plugins: [],
}
}
},
components: {},
filters: {},
methods: {
carry() {
this.formData = {
tableName: '',
columns: [],
method: 1,
plugins: [],
}
this.relation = []
this.fileList = []
this.active = 0
this.$refs.carousel.next()
},
async next() {
const {active} = this
if (active == 0) {
if (!this.formData.tableName) {
this.$notify({
title: '警告',
message: '请选择数据表',
type: 'warning'
});
return
}
if (this.cacheTableName != this.formData.tableName) {
this.loadColumn()
this.formData.columns = []
this.cacheTableName = this.formData.tableName
}
} else if (active == 1) {
if (!this.formData.columns || !this.formData.columns.length) {
this.$notify({
title: '警告',
message: '请选择数据列',
type: 'warning'
});
return
}
this.genRelation()
} else if (active == 2) {
if (this.relation.find(v => !v.relation)) {
this.$notify({
title: '警告',
message: '存在未填写的目标列',
type: 'warning'
});
return
}
} else if (active == 3) {
await this.doSubmit()
}
this.$refs.carousel.next()
this.active++
},
prev() {
this.$refs.carousel.prev()
this.active--
},
async doSubmit() {
let Break = false
this.$refs["form"].validate((valid) => {
if (!valid || !this.fileList.length) {
this.$notify({
title: '警告',
message: '存在未填写的必填项',
type: 'warning'
});
Break = true
return
}
})
if (Break) return
this.loading = true
let formData = new FormData()
for (let key in this.formData) {
formData.append(key, this.formData[key])
}
formData.append("relation", JSON.stringify(this.relation))
this.fileList.forEach((val) => {
formData.append("file", val.raw, val.raw.name);
});
const {code, data, msg} = await $.ajax({
url: loc() + "/importData",
type: "post",
data: formData,
processData: false,
contentType: false,
});
this.loading = false
if (code) {
this.$notify.error({
title: '错误',
message: msg
});
this.result = {success: 0, total: 0}
return
}
this.result = data
},
/*提交数据*/
/*start*/
handleRemove(file, fileList) {
this.fileList = fileList;
},
handleChange(file, fileList) {
const remove = () => {
for (let i = 0; i < fileList.length; i++) {
if (file == fileList[i]) {
fileList.splice(i, 1);
}
}
}
if (file.size == 0) {
this.$message.warning("您选择的是空文件!");
remove()
}
const type = ['xls', 'xlsx'].includes(file.name.split('.').pop().toLowerCase())
if (!type) {
this.$message.warning('上传文件只能是' + ['xls', 'xlsx'].map(v => v.toLowerCase()).join("/") + '格式!');
remove()
}
this.fileList = fileList;
},
async loadPlugins() {
this.plugins = await getEnumOptions("DataImportPluginHandle")
},
/*end*/
/*数据列对应*/
/*start*/
genRelation() {
this.relation = this.columnOptions.filter(v => this.formData.columns.includes(v.column_name))
},
/*end*/
/*tableName*/
/*start*/
columnSearch() {
if (!this.columnNameKeyWord) {
this.columnOptionsClone = clone(this.columnOptions)
return
}
this.columnOptionsClone = this.columnOptions.filter(v => v.column_name.toLowerCase().indexOf(this.columnNameKeyWord.toLowerCase()) != -1 || v.column_comment.toLowerCase().indexOf(this.columnNameKeyWord.toLowerCase()) != -1)
},
async loadColumn() {
const {tableName} = this.formData
const {data} = await $.get(loc() + '/columns', {tableName})
this.columnOptions = data
this.columnOptionsClone = clone(data)
},
/*end*/
/*tableName*/
/*start*/
tableNameSearch() {
if (!this.tableNameKeyWord) {
this.tableOptionsClone = clone(this.tableOptions)
return
}
this.tableOptionsClone = this.tableOptions.filter(v => v.table_name.toLowerCase().indexOf(this.tableNameKeyWord.toLowerCase()) != -1 || v.table_comment.toLowerCase().indexOf(this.tableNameKeyWord.toLowerCase()) != -1)
},
async loadTableName() {
const {data} = await $.get(loc() + '/tableNames')
this.tableOptions = data
this.tableOptionsClone = clone(data)
}
/*end*/
},
created() {
this.loadTableName()
this.loadPlugins()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,544 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-transfer {
text-align: center;
}
.el-transfer-panel {
text-align: left;
width: 35%;
height: 400px;
}
.el-transfer-panel__list.is-filterable {
height: 300px;
}
.v-tree-layout-left {
overflow: unset !important;
}
.v-tree-layout-left .v-tree {
width: 100%;
height: calc(100vh - 170px);
overflow-y: auto;
}
.v-tree:hover::-webkit-scrollbar {
width: 3px;
background-color: transparent;
}
.v-tree-layout-left .custom-tree-node {
width: 90%;
position: relative;
display: flex;
align-items: center;
}
.v-tree-layout-left .v-tree .v-node {
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::-webkit-scrollbar {
/*width: 3px;*/
/*background-color: transparent;*/
display: none;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
border-radius: 10px;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never" style="height: calc(100vh - 70px)">
<tree-layout>
<template #tree>
<div style="padding:0 20px 20px;">
<el-input placeholder="输入单位名称进行过滤" v-model="filterText"></el-input>
</div>
<el-tree ref="tree" :data="treeData" class="v-tree" v-loading="treeLoading" node-key="id"
:props="defaultProps"
default-expand-all :expand-on-click-node="false"
@node-click="handleNodeClick" accordion @node-expand="nodeExpand"
highlight-current :filter-node-method="filterNode">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="node.level==1" style="font-size: 16px;" class="v-node"><i
class="el-icon-s-home"></i>&nbsp;
{{ data.name }}
</div>
<div v-if="node.level==2"
style="font-size: 15px" :title="data.name" class="v-node">
<i class="el-icon-star-on" v-if="checkData.name==data.name"></i>
<i class="el-icon-star-off" v-else></i>
&nbsp; {{ data.name }}
</div>
<div v-if="node.level==3"
style="font-size: 14px" :title="data.name" class="v-node">
<i class="fa fa-dot-circle-o" v-if="checkData.name==data.name"></i>
<i class="fa fa-circle-o" v-else></i>
&nbsp; {{ data.name }}
</div>
<div v-if="node.level>3"
style="font-size: 14px" :title="data.name" class="v-node">
<i class="fa fa-dot-circle-o" v-if="checkData.name==data.name"></i>
<i class="fa fa-circle-o" v-else></i>
&nbsp; {{ data.name }}
</div>
</div>
</el-tree>
</template>
<template>
<div style="padding:0 10px">
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch">
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
style="width: 120px;">
<el-option label="单位名称" value="name"></el-option>
<el-option label="单位代码" value="unitcode"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button mt5">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
</div>
<div class="pull-right offscreen-right mt5">
<div class="btn-group tool-button" v-if="checkNode.level==1">
<!--#if(@shiro.hasRole('sysadmin')){#-->
<el-button icon="el-icon-refresh" :loading="loading" @click="dataUpdate"
type="primary">更新组织机构
</el-button>
<!--#}#-->
</div>
<!-- <div class="btn-group tool-button">-->
<!-- <el-button icon="el-icon-plus" @click="openAdd">新建单位</el-button>-->
<!-- </div>-->
</div>
</el-card>
<el-card shadow="never" class="mt10">
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
height="638px"
v-loading="tabLoading" size="medium">
<el-table-column align="center" :key="1" header-align="center" label="序号"
type="index">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="单位名称"
prop="name"></el-table-column>
<el-table-column align="center" header-align="center" label="单位代码"
prop="unitcode"></el-table-column>
<el-table-column label="单位等级" header-align="center" prop="unitlevel"
:show-overflow-tooltip="true" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.unitlevel==1" size="mini" type="success" round
style=" vertical-align: middle;">1级
</el-button>
<el-button v-if="scope.row.unitlevel==2" size="mini" type="warning" round
style=" vertical-align: middle;">2级
</el-button>
<el-button v-if="scope.row.unitlevel==3" size="mini" type="danger" round
style=" vertical-align: middle;">3级
</el-button>
<el-button v-if="scope.row.unitlevel>3" size="mini" type="info" round
style=" vertical-align: middle;">{{scope.row.unitlevel}}级
</el-button>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作"
width="200px">
<template slot-scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="{type:'view',data:row}">-->
<!-- 查看-->
<!-- </el-dropdown-item>-->
<el-dropdown-item :command="{type:'edit',data:row}">
编辑
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete',data:row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
@size-change="pageSizeChange"
@current-change="pageNumberChange"
:current-page="pageForm.pageNumber"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="pageForm.totalCount">
</el-pagination>
</el-row>
</el-card>
</div>
</template>
</tree-layout>
</el-card>
<template #edit>
<el-divider content-position="left"><span style="color: rgb(121, 187, 255)">请填写以下单位信息</span>
</el-divider>
<el-form :model="formData" ref="form" :rules="formRules" label-position="top"
label-width="120px"
style="padding: 0 30px">
<el-row gutter="30">
<el-col :span="24">
<el-form-item label="上级单位">
<el-input maxlength="100" disabled :value="checkData.name"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位名称" prop="name">
<el-input maxlength="100" placeholder="请输入单位名称" v-model="formData.name"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位代码" prop="unitcode">
<el-input maxlength="100" placeholder="请输入社团编码" v-model="formData.unitcode"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位简称" prop="aliasName">
<el-input maxlength="100" placeholder="请输入单位简称" v-model="formData.aliasName"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="telephone">
<el-input maxlength="100" placeholder="请输入联系电话" v-model="formData.telephone"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位邮箱" prop="email">
<el-input maxlength="100" placeholder="请输入单位邮箱" v-model="formData.email"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位网站" prop="website">
<el-input maxlength="100" placeholder="请输入单位网站" v-model="formData.website"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="单位地址" prop="address">
<el-input maxlength="100" placeholder="请输入单位地址" v-model="formData.address"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="单位介绍" prop="note">
<el-input maxlength="500" type="textarea" placeholder="请输入单位介绍"
v-model="formData.note"></el-input>
</el-form-item>
</el-col>
</el-row>
<div style="display: flex;justify-content:flex-end;margin-top: 30px">
<el-button type="primary" :loading="loading" @click="!formData.id?doAdd():doEdit()">提 交
</el-button>
</div>
</el-form>
</template>
</guava>
</div>
<script>
var vue = new Vue({
el: '#app',
data() {
return {
loading: false,
filterText: '',
defaultProps: {
children: 'child',
label: 'name',
},
exKeys: ['0'],
activeName: [],
typeOptions: [],
treeLoading: true,
tabLoading: false,
formData: {},
detailData: {},
treeData: [],
tableData: [],
pageForm: {
searchName: "name",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
},
formRules: {
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
code: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
checkNode: {level: 1},
checkData: {},
campusOptions: [],
loading: false,
}
},
components: {
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
'guava': httpVueLoader('/components/plugins/Guava.vue'),
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
}
},
methods: {
//单位数据更新
async dataUpdate() {
this.$confirm('您确定要更新组织机构吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.loading = true;
const resp = await $.get(loc() + "/dataUpdate")
if (resp.code == 0) {
this.loading = false;
this.$message({
message: '更新成功',
type: 'success'
});
this.pageData();
} else {
this.loading = false;
this.$message.error('更新失败');
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消更新'
});
});
},
dropdownCommand: function (command) {
const {type, data} = command
if (type == 'view') {
} else if (type == 'edit') {
this.openEdit(data.id)
} else if (type == 'delete') {
this.doDelete(data.id)
}
},
filterNode(value, data, node) {
if (!value) return true;
return data.name.indexOf(value) !== -1
return false
},
nodeExpand(data, node, e) {
},
async handleNodeClick(data, node) {
this.checkData = data
this.checkNode = node
this.doSearch()
},
doDelete(id) {
this.$confirm('确定要删除该单位吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: (a, b) => {
if ("confirm" == a) {//确认后再执行
$.post(loc() + "/doDelete", {id}, (data) => {
if (data.code == 0) {
this.$message({
message: data.msg,
type: 'success'
});
this.loadTree(false)
this.pageData()
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
}
}
});
},
doEdit() {
this.$refs["form"].validate(async (valid) => {
if (valid) {
this.loading = true
const resp = await $.post(loc() + "/doEdit", this.formData)
this.loading = false
if(resp.code===0){
this.loadTree(false)
this.pageData();
this.$refs.guava.index()
}else{
this.notifyWarning(resp.msg)
}
}
});
},
async openEdit(id) {
const resp = await $.get(loc() + "/findOne", {id})
if(resp.code===0){
this.formData = data
this.$refs.guava.edit()
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
}else{
this.notifyWarning(resp.msg)
}
},
doAdd() {
this.$refs["form"].validate(async (valid) => {
if (valid) {
this.loading = true
const resp = await $.post(loc() + "/doAdd", this.formData)
this.loading = false
if(resp.code===0){
this.loadTree(false)
this.pageData();
this.$refs.guava.index()
}else{
this.notifyWarning(resp.msg)
}
}
});
},
openAdd() {
const {id, unitlevel} = this.checkData
this.formData = {
parentId: id,
unitlevel: unitlevel + 1
}
this.$refs.guava.edit()
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
doSearch() {
this.tabKey = new Date().getTime()
this.pageForm.pageNumber = 1
this.pageData()
}
,
pageOrder(column) {//按字段排序
this.pageForm.pageOrderName = column.prop;
this.pageForm.pageOrderBy = column.order;
this.pageData();
}
,
pageNumberChange(val) {//页码更新操作
this.pageForm.pageNumber = val;
this.pageData();
}
,
pageSizeChange(val) {//分页大小更新操作
this.pageForm.pageSize = val;
this.pageData();
}
,
pageData() {//加载分页数据
sublime.showLoadingbar();//显示loading
this.tabLoading = true
this.pageForm.parentId = this.checkData.id
$.post(base + "/platform/sys/unit/pageData", this.pageForm, (data) => {
sublime.closeLoadingbar();//关闭loading
this.tabLoading = false
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
},
async loadTree(flush) {
this.treeLoading = true
const {code, data, msg} = await $.get("/platform/sys/unit/getUnitTreeData")
this.treeLoading = false
if (code == 0) {
this.treeData = data
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
if (flush && code == 0) {
this.checkData = data[0]
this.pageData();
}
},
},
async created() {
this.loadTree(true)
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,335 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-tabs__content {
padding-top: 20px;
}
.sourceCheckBox .el-checkbox__label {
width: 100%;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-date-picker
style="width: 150px"
v-model="pageForm.importDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="拉取日期">
</el-date-picker>
</div>
<div class="btn-group tool-button mt5">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch">
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
style="width: 100px;">
<el-option label="姓名" value="username"></el-option>
<el-option label="工号" value="loginname"></el-option>
</el-select>
</el-input>
</div>
<el-row class="btn-group tool-button mt5">
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 200px;" clearable="true"
filterable="true">
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-row>
<div class="btn-group tool-button mt5">
<dict-select v-model="pageForm.personType" style="width: 200px" clearable placeholder="人员类型"
code="UserType"></dict-select>
</div>
<div class="btn-group tool-button mt5">
<dict-select v-model="pageForm.userState" style="width: 200px" clearable placeholder="在职状态"
code="UserState"></dict-select>
</div>
<div class="btn-group tool-button mt5">
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
<span style="color: red">温馨提醒:对接数据方式是拉取</span>
</div>
<div class="pull-right offscreen-right mt5">
<div class="btn-group tool-button" v-show="!selection.length">
<el-button icon="el-icon-delete" type="danger" @click="openDeleteUser">删除
</el-button>
</div>
<div class="btn-group tool-button" v-show="selection.length">
<el-button icon="el-icon-delete" type="danger" :loading="delLoading" @click="doDeleteUsers">删除
</el-button>
</div>
<div class="btn-group tool-button">
<el-button type="primary" :loading="pullLoading" @click="pull">
拉取<i class="el-icon-download"></i>
</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
v-loading="tableLoading" ref="table" @selection-change="handleSelectionChange">
<el-table-column :reserve-selection="true"
type="selection"
width="30">
</el-table-column>
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="70px"></el-table-column>
<el-table-column label="工号" prop="loginname" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="姓名" prop="username" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="性别" prop="sex" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="联系电话" prop="mobile" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="出生日期" prop="birthday" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="身份证" prop="idcard" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="人员类型" prop="personType" header-align="center" sortable
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="在职状态" prop="userState" header-align="center" sortable
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="所属单位" prop="unitid" header-align="center"
align="center" show-overflow-tooltip sortable>
<template scope="{row}">
<span v-if="row.unitid"> {{row.unitname}}({{row.unitid}})</span>
</template>
</el-table-column>
<el-table-column label="拉取时间" prop="pullTime" min-width="100px" header-align="center" sortable
align="center" show-overflow-tooltip></el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center" label="操作"
min-width="80px">
<template scope="scope">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:scope.row}">
查看
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete',data:scope.row}">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<el-tabs v-model="active">
<el-tab-pane label="个人信息" name="info">
<member ref="memberInfo" source="user_source" :id="userId" view></member>
</el-tab-pane>
</el-tabs>
</template>
</guava>
<el-dialog
title="选择数据源"
:visible.sync="dialogVisible"
width="30%">
<el-checkbox-group class="checkGroup" v-model="sourceTime" style="width: 100%">
<el-row v-for="item in latelyDeleteTimes" style="margin-bottom: 10px" class="sourceCheckBox">
<el-checkbox :key="item.pullTime" style="width: 100%"
:label="item.pullTime" border>
时间:{{item.pullTime}}<span
style="float: right;color: #F56C6C">rows: {{item.num}}</span>
</el-checkbox>
</el-row>
</el-checkbox-group>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" :loading="deleteLoading" @click="doDeleteUser">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
dialogVisible: false,
deleteLoading: false,
sourceTime: [],
active: 'info',
pullLoading: false,
pageForm: {
searchName: "username",
},
latelyDeleteTimes: [],
userId: "",
unions: [],
units: [],
active: 'info',
delLoading: false,
selection: [],
}
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.3'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'mem-change-records': httpVueLoader('/components/member/MemChangeRecords.vue?v=1.0.2'),
},
methods: {
doDeleteUser() {
if (this.sourceTime.length === 0) {
this.$notify({
title: '警告',
message: '请选择数据源',
type: 'warning'
});
return
}
this.$confirm('是否确定删除用户数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.deleteLoading = true
const resp = await $.post(loc() + '/deleteUser', {sourceTime: JSON.stringify(this.sourceTime)})
this.deleteLoading = false
if (resp.code === 0) {
this.notifySuccess((resp.msg))
this.pageData()
this.getLatelyUpdateTimes()
this.dialogVisible = false
} else {
this.notifyWarning(resp.msg)
}
})
},
async getLatelyUpdateTimes() {
const resp = await $.get("/platform/data/user/update/latelyUpdateTimes")
if(resp.code===0){
this.latelyDeleteTimes = resp.data
}else{
this.notifyWarning(resp.msg)
}
},
openDeleteUser() {
if (!this.latelyDeleteTimes.length) {
this.$notify({
title: '警告',
message: '没有可供删除的数据源',
type: 'warning'
});
return
}
this.sourceTime = []
this.dialogVisible = true
},
handleCommand(command) {
this.pull(command === 'increment')
},
async doDeleteUsers() {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.delLoading = true
const resp = await $.post(loc() + "/delete", {ids: JSON.stringify(this.selection.map(v => v.id))})
this.delLoading = false
if (resp.code === 0) {
this.$refs.table.clearSelection();
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
})
},
handleSelectionChange(val) {
this.selection = val;
},
pull(isIncrement) {
this.$confirm('确定要从数据中心拉取数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.pullLoading = true
const resp = await $.post(loc() + '/pull')
this.pullLoading = false
if(resp.code===0){
this.pageData()
}else{
this.notifyWarning(resp.msg)
}
})
},
doDelete(userId) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
if ("confirm" == a) {//确认后再执行
const resp = await $.post(loc() + "/delete", {ids: JSON.stringify([userId])});
if(resp.code===0){
this.pageData()
}else{
this.notifyWarning(resp.msg)
}
}
}
});
},
openView(userId) {
this.active = 'info'
this.userId = userId
this.$refs.guava.view()
},
dropdownCommand(command) {
const {type, data} = command
if (type == 'view') {
this.openView(data.id)
} else if (type == 'delete') {
this.doDelete(data.id)
}
},
},
async created() {
this.pageData();
this.units = await getUnits()
await this.getLatelyUpdateTimes()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,553 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.query-row {
height: 60px;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
}
.query-row:not(:last-child) {
border-bottom: 1px dashed rgb(230, 230, 230);
}
/*.query-row:not(:last-child,:first-child) {*/
/* height: 70px;*/
/*}*/
.query-row-title {
width: 100px;
}
.el-table__header-wrapper th {
padding: 5px 0 !important;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never"
style="margin-bottom: 5px;padding: 0px 10px 5px;">
<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-title">基础查询:</el-col>
<el-col class="query-row-content">
<div class="btn-group tool-button">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch">
<el-select v-model="pageForm.searchName" slot="prepend"
placeholder="查询类型"
style="width: 100px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
<el-row class="btn-group tool-button">
<el-select placeholder="所属单位" v-model="pageForm.unitId"
style="width: 200px;"
clearable="true"
filterable="true">
<el-option v-for="item in units" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-row>
<div class="btn-group tool-button">
<dict-select v-model="pageForm.personType" style="width: 200px"
clearable placeholder="人员类型"
code="UserType"></dict-select>
</div>
<div class="btn-group tool-button">
<dict-select v-model="pageForm.userState" style="width: 200px" clearable
placeholder="在职状态"
code="UserState"></dict-select>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="doSearch"></el-button>
</div>
<div class="pull-right offscreen-right">
<div class="btn-group tool-button">
<el-button @click="clearHistory" slot="reference"
type="primary">
清空历史记录
</el-button>
<el-button :loading="updateBirthdayLoading" @click="updateBirthday"
slot="reference" type="primary">
根据身份证号设置出生日期
</el-button>
<el-button slot="reference" type="primary"
@click="checkSource" :loading="updateLoading">
更新
</el-button>
</div>
</div>
</el-col>
</el-row>
<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-title">异动查询:</el-col>
<el-col class="query-row-content">
<div class="btn-group tool-button">
<el-date-picker
style="width: 200px"
v-model="pageForm.changeDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="更新日期">
</el-date-picker>
</div>
<div class="btn-group tool-button">
<enum-select v-model="pageForm.changeType" value="code"
label="description"
style="width: 200px"
clearable placeholder="异动类型"
enum="UserChangeType"></enum-select>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="doSearch"></el-button>
<el-button type="primary" @click="exportChange">导出异动人员</el-button>
</div>
</el-col>
</el-row>
</el-card>
<el-card shadow="never">
<el-table :data="tableData" style="width: 100%" row-key="id"
@sort-change="pageOrder" :key="tableKey"
v-loading="tableLoading"
lazy
:load="load"
:tree-props="{hasChildren: 'hasHis'}"
border
>
<el-table-column align="center" header-align="center" type="index"
:index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column label="工号" prop="loginname" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="姓名" prop="username" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="性别" prop="sex" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="联系电话" prop="mobile" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<!-- <el-table-column label="出生日期" prop="birthday" header-align="center"-->
<!-- align="center" show-overflow-tooltip></el-table-column>-->
<!-- <el-table-column label="身份证" prop="idcard" header-align="center"-->
<!-- align="center" show-overflow-tooltip></el-table-column>-->
<el-table-column label="人员类型" prop="personType" header-align="center" sortable
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="在职状态" prop="userState" header-align="center" sortable
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="所属单位" prop="unitid" header-align="center"
align="center" show-overflow-tooltip sortable>
<template scope="{row}">
<span v-if="row.unitid"> {{row.unitname}}({{row.unitid}})</span>
</template>
</el-table-column>
<el-table-column label="异动信息" header-align="center">
<el-table-column label="更新时间" prop="changeTime" min-width="100px"
header-align="center" sortable
align="center" show-overflow-tooltip>
<!-- <template scope="{row:{changeTime}}">
{{changeTime?changeTime:'暂无'}}
</template>-->
</el-table-column>
<el-table-column label="异动类型" prop="changeType" header-align="center"
align="center" show-overflow-tooltip sortable>
<template scope="{row}">
<span style="color: #0e78c5">{{changeType[row.changeType]}}</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center"
label="操作"
min-width="80px">
<template scope="scope">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:scope.row}">
查看
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<el-tabs v-model="active">
<el-tab-pane label="个人信息" name="info">
<member ref="memberInfo" :source="source" :id="userId" view></member>
</el-tab-pane>
</el-tabs>
</template>
</guava>
<el-dialog
title="选择数据源"
:visible.sync="dialogVisible"
width="50%">
<el-timeline>
<el-timeline-item timestamp="数据源" placement="top">
<el-radio-group class="checkGroup" v-model="sourceTime" style="width: 100%">
<el-row v-for="item in latelyUpdateTimes" style="margin-bottom: 10px">
<el-radio :key="item.pullTime" style="width: 100%"
:label="item.pullTime" border>
时间:{{item.pullTime}}<span
style="float: right;color: #F56C6C">rows: {{item.num}}</span>
</el-radio>
</el-row>
</el-radio-group>
</el-timeline-item>
<el-timeline-item timestamp="更新方式" placement="top">
<el-radio-group class="checkGroup" style="width: 100%" v-model="sourceType">
<el-row>
<el-radio border label="all">全部更新</el-radio>
<el-radio border label="add">仅更新新增人员</el-radio>
<el-radio border label="part">部分更新</el-radio>
</el-row>
</el-radio-group>
</el-timeline-item>
<el-timeline-item timestamp="选择更新组别" placement="top" v-if="sourceType=='part'">
<el-row class="query-row">
<el-col span="12">
<el-select v-model="partGroupId" clearable filterable
placeholder="请选择更新组别" style="width: 100%">
<el-option
v-for="column in partGroupInfos"
:key="column.groupId"
:label="column.groupName"
:value="column.groupId">
</el-option>
</el-select>
</el-col>
<el-col>
<el-checkbox style="margin-left: 10px;margin-top: 4px" v-model="isInvert" label="是否更新此组别之外人员" border></el-checkbox>
<el-button style="margin-left: 10px;margin-top: 4px" type="primary" @click="partUpdate(sourceType)">设置部分更新人员</el-button>
</el-col>
</el-row>
</el-timeline-item>
<el-timeline-item timestamp="过滤字段" placement="top" v-if="sourceType=='part'">
<el-row class="query-row">
<el-col class="query-title" span="6">过滤字段:</el-col>
<el-col style="justify-content: end;margin-left: 10px">
<el-select v-model="columnNames" clearable filterable
placeholder="请选择字段" style="width: 100%" multiple>
<el-option
v-for="column in columnInfos"
:key="column.COLUMN_NAME"
:label="column.COLUMN_COMMENT"
:value="column.COLUMN_NAME">
</el-option>
</el-select>
</el-col>
<el-col class="query-row">
<span style="color: red;margin-left: 10px">该条件为更新时忽略某字段,如无需忽略请勿填充该条件</span>
</el-col>
</el-row>
</el-timeline-item>
</el-timeline>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" :loading="updateLoading" @click="doUpdate">确 定</el-button>
</span>
</el-dialog>
<el-drawer
title="我是标题" size="78%"
:visible.sync="userScopeDialog"
:append-to-body="true"
:with-header="false">
<div style="padding: 0px 16px;" class="clearfix">
<el-button icon="el-icon-back" style="font-size: 16px" type="text"
@click="doBack()">返回
</el-button>
</div>
<guava>
<el-tabs tab-position="top" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="人员设置" name="1">
<template>
<user-upset ref="userUpset"></user-upset>
</template>
</el-tab-pane>
<el-tab-pane label="人员查看" name="2">
<template>
<user-upset-data ref="userUpsetData"></user-upset-data>
</template>
</el-tab-pane>
</el-tabs>
</guava>
</el-drawer>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
active: 'info',
updateLoading: false,
updateBirthdayLoading: false,
pageForm: {
searchName: "u.username",
},
userId: "",
unions: [],
units: [],
latelyUpdateTimes: [],
dialogVisible: false,
sourceTime: "",
changeType: {},
source: 'sys_user',
sourceType: null,
activeName: '1',
userScopeDialog: false,
columnNames: [],
columnInfos: [],
upDataCount: '0',
isUpSet: '0',
partGroupId: '',
partGroupInfos: [],
isInvert:'',
}
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.3'),
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'mem-change-records': httpVueLoader('/components/member/MemChangeRecords.vue?v=1.0.2'),
'enum-select': httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'),
'user-upset': httpVueLoader('/components/userpartupdate/UserPartUpdateSet.vue'),
'user-upset-data': httpVueLoader('/components/userpartupdate/UserDataPartUpSet.vue'),
},
methods: {
async getColumnInfo() {
const {data, msg, code} = await $.post('/platform/activity/basic/scope/getUserTableColumnInfo')
if (code !== 0) {
this.$notify.warning(msg)
return
}
this.columnInfos = data
},
clearHistory() {
this.$confirm('您确定要清空历史记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post(loc() + '/clearHistory')
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
})
},
async updateBirthday() {
const confirm = await this.$confirm('是否确定根据身份证号更新出生日期?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
this.updateBirthdayLoading = true
const resp = await $.post(loc() + '/updateBirthday')
this.updateBirthdayLoading = false
}
},
async load(tree, treeNode, resolve) {
const {loginname} = tree
const resp = await $.get(loc() + "/historyUsers", {loginname})
if (resp.code === 0) {
resolve(resp.data)
} else {
resolve([])
}
},
checkSource() {
if (!this.latelyUpdateTimes.length) {
this.$notify({
title: '警告',
message: '没有可供更新的数据源',
type: 'warning'
});
return
}
this.sourceTime = ''
this.dialogVisible = true
// this.doUpdate()
},
doUpdate() {
if (!this.sourceTime) {
this.$notify({
title: '警告',
message: '请选择数据源',
type: 'warning'
});
return
}
if (!this.sourceType) {
this.$notify({
title: '警告',
message: '请选择更新范围',
type: 'warning'
});
return
}
if (this.sourceType == 'part' && !this.partGroupId) {
this.$notify({
title: '警告',
message: '部分更新请选择更新组别',
type: 'warning'
});
return;
}
this.$confirm('是否确定更新用户数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.updateLoading = true
const resp = await $.post(loc() + '/update', {
sourceTime: this.sourceTime,
sourceType: this.sourceType,
columnNames: JSON.stringify(this.columnNames),
isUpSet: this.isUpSet,
partGroupId: this.partGroupId,
isInvert: this.isInvert,
})
this.updateLoading = false
if (resp.code === 0) {
this.tableKey = new Date().getTime()
this.pageData()
this.dialogVisible = false
this.reset()
} else {
this.notifyWarning(resp.msg)
}
})
},
reset(){
this.isInvert = ''
this.sourceType = ''
this.partGroupId = ''
},
openView({id, flag}) {
this.active = 'info'
this.userId = id
this.source = flag ? 'sys_user' : 'user_history'
this.$refs.guava.view()
},
dropdownCommand(command) {
const {type, data} = command
if (type == 'view') {
this.openView(data)
}
},
async getLatelyUpdateTimes() {
const resp = await $.get(loc() + "/latelyUpdateTimes")
if (resp.code === 0) {
this.latelyUpdateTimes = resp.data
}
},
async getChangeType() {
const changeType = {}
const changeTypeOptions = await getEnumOptions("UserChangeType")
changeTypeOptions.forEach(v => {
changeType[v.code] = v.description
})
return changeType
},
exportChange() {
const {
searchName,
searchKeyword,
unitId,
personType,
changeDate,
userState
} = this.pageForm
window.open(loc() + '/exportChangePeo?searchName=' + searchName + '&searchKeyword=' + searchKeyword + '&unitId=' + (unitId ? unitId : '') +
'&userState=' + (userState ? userState : '') + '&personType=' + (personType ? personType : '') + '&changeDate=' + (changeDate ? changeDate : ''))
},
async getPartCount() {
const resp = await $.get('/platform/user/part/update/getPartCount')
this.upDataCount = resp.data
},
partUpdate(sourceType) {
if (sourceType === 'part') {
this.userScopeDialog = true
}
this.getPartCount()
},
handleClick() {
if (this.activeName === "2") {
this.$refs.userUpsetData.pageData();
this.$refs.userUpsetData.getActivityGroup();
}
},
async getPartGroupInfos() {
const resp = await $.get('/platform/user/part/update/getUserPart')
this.partGroupInfos = resp.data
},
doBack(){
this.userScopeDialog = false
this.getPartGroupInfos();
}
},
async created() {
this.pageData();
this.units = await getUnits()
await this.getLatelyUpdateTimes()
this.changeType = await this.getChangeType()
await this.getColumnInfo()
await this.getPartGroupInfos()
}
})
</script>
<!--#
}
#-->