fix: 统一调整
This commit is contained in:
parent
abb2cbd6a7
commit
5f04b4b693
|
@ -0,0 +1,16 @@
|
||||||
|
# 本地环境
|
||||||
|
NODE_ENV = development
|
||||||
|
|
||||||
|
# 标题
|
||||||
|
VUE_APP_TITLE = ''
|
||||||
|
VUE_APP_PJ = ''
|
||||||
|
|
||||||
|
# 接口地址
|
||||||
|
VUE_APP_API_BASEURL = http://127.0.0.1:226/api
|
||||||
|
VUE_APP_BASEURL = http://127.0.0.1:226
|
||||||
|
|
||||||
|
# 本地端口
|
||||||
|
VUE_APP_PORT = 2800
|
||||||
|
|
||||||
|
# 是否开启代理
|
||||||
|
VUE_APP_PROXY = true
|
|
@ -0,0 +1,11 @@
|
||||||
|
# 生产环境
|
||||||
|
NODE_ENV = production
|
||||||
|
|
||||||
|
# 标题
|
||||||
|
VUE_APP_TITLE = '星途后台管理系统'
|
||||||
|
VUE_APP_TITLE = ''
|
||||||
|
|
||||||
|
|
||||||
|
# 接口地址
|
||||||
|
VUE_APP_API_BASEURL = http://127.0.0.1:226/api
|
||||||
|
VUE_APP_BASEURL = http://127.0.0.1:226
|
|
@ -6,8 +6,6 @@ node_modules
|
||||||
# local env files
|
# local env files
|
||||||
.env.local
|
.env.local
|
||||||
.env.*.local
|
.env.*.local
|
||||||
.env.production
|
|
||||||
.env.development
|
|
||||||
|
|
||||||
# Log files
|
# Log files
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "scui",
|
"name": "xt_scui",
|
||||||
"version": "1.6.9",
|
"version": "1.6.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -4,30 +4,23 @@ import http from "@/utils/request"
|
||||||
export default {
|
export default {
|
||||||
logs: {
|
logs: {
|
||||||
list: {
|
list: {
|
||||||
url: `${config.API_URL}/monitor/request_log/`,
|
url: `${config.API_URL}/ops/request_log/`,
|
||||||
name: "请求日志",
|
name: "请求日志",
|
||||||
req: async function(data){
|
req: async function(data){
|
||||||
return await http.get(this.url, data);
|
return await http.get(this.url, data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
audit: {
|
|
||||||
url: `${config.API_URL}/monitor/auditlog/`,
|
|
||||||
name: "审计日志",
|
|
||||||
req: async function(data){
|
|
||||||
return await http.get(this.url, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
dbbackup: {
|
dbbackup: {
|
||||||
list: {
|
list: {
|
||||||
url: `${config.API_URL}/monitor/dbbackup/`,
|
url: `${config.API_URL}/ops/dbbackup/`,
|
||||||
name: "数据库备份",
|
name: "数据库备份",
|
||||||
req: async function(data){
|
req: async function(data){
|
||||||
return await http.get(this.url, data);
|
return await http.get(this.url, data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deletes: {
|
deletes: {
|
||||||
url: `${config.API_URL}/monitor/dbbackup/`,
|
url: `${config.API_URL}/ops/dbbackup/`,
|
||||||
name: "数据库备份",
|
name: "数据库备份",
|
||||||
req: async function(data){
|
req: async function(data){
|
||||||
return await http.delete(this.url, data);
|
return await http.delete(this.url, data);
|
||||||
|
@ -36,7 +29,7 @@ export default {
|
||||||
},
|
},
|
||||||
file_logs: {
|
file_logs: {
|
||||||
list: {
|
list: {
|
||||||
url: `${config.API_URL}/monitor/log/`,
|
url: `${config.API_URL}/ops/log/`,
|
||||||
name: "文件日志",
|
name: "文件日志",
|
||||||
req: async function(data){
|
req: async function(data){
|
||||||
return await http.get(this.url, data);
|
return await http.get(this.url, data);
|
||||||
|
@ -45,15 +38,27 @@ export default {
|
||||||
detail: {
|
detail: {
|
||||||
name: "文件日志",
|
name: "文件日志",
|
||||||
req: async function(name){
|
req: async function(name){
|
||||||
return await http.get(`${config.API_URL}/monitor/log/${name}/`);
|
return await http.get(`${config.API_URL}/ops/log/${name}/`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
info: {
|
cpu: {
|
||||||
name: "服务器状态",
|
name: "cpu状态",
|
||||||
req: async function(name){
|
req: async function(name){
|
||||||
return await http.get(`${config.API_URL}/monitor/server/`);
|
return await http.get(`${config.API_URL}/ops/server/cpu/`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
memory: {
|
||||||
|
name: "memory状态",
|
||||||
|
req: async function(name){
|
||||||
|
return await http.get(`${config.API_URL}/ops/server/memory/`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
disk: {
|
||||||
|
name: "disk状态",
|
||||||
|
req: async function(name){
|
||||||
|
return await http.get(`${config.API_URL}/ops/server/disk/`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -61,7 +66,7 @@ export default {
|
||||||
info: {
|
info: {
|
||||||
name: "celery状态",
|
name: "celery状态",
|
||||||
req: async function(name){
|
req: async function(name){
|
||||||
return await http.get(`${config.API_URL}/monitor/celery/`);
|
return await http.get(`${config.API_URL}/ops/celery/`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -69,7 +74,7 @@ export default {
|
||||||
info: {
|
info: {
|
||||||
name: "redis状态",
|
name: "redis状态",
|
||||||
req: async function(name){
|
req: async function(name){
|
||||||
return await http.get(`${config.API_URL}/monitor/redis/`);
|
return await http.get(`${config.API_URL}/ops/redis/`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,386 +0,0 @@
|
||||||
<template>
|
|
||||||
<div style="display:flex;row nowrap">
|
|
||||||
<!-- <el-tag
|
|
||||||
v-for="user in userData"
|
|
||||||
:key="user.id"
|
|
||||||
>
|
|
||||||
{{ user.name }}
|
|
||||||
</el-tag>-->
|
|
||||||
<el-button
|
|
||||||
v-if="selectable"
|
|
||||||
type="primary"
|
|
||||||
circle
|
|
||||||
size="mini"
|
|
||||||
icon="el-icon-plus"
|
|
||||||
@click="showDialog()"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-dialog
|
|
||||||
title="选择人员"
|
|
||||||
width="70%"
|
|
||||||
v-model="dialoguser"
|
|
||||||
:before-close="handleClose"
|
|
||||||
:append-to-body="true"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
>
|
|
||||||
<el-row :gutter="4">
|
|
||||||
<el-col :md="multiple?18:24" :sm="24">
|
|
||||||
<el-card header="人员列表" shadow="never">
|
|
||||||
<el-row >
|
|
||||||
<!-- <el-col :md="6" :sm="24">
|
|
||||||
<el-select v-model="query.type" placeholder="人员类型" @change="handleTypeChange">
|
|
||||||
<el-option v-for="item in choseTypeOptions" :key="item" :label="item.label"
|
|
||||||
:value="item.value"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-col> -->
|
|
||||||
<!-- <el-col :md="8" :sm="24">
|
|
||||||
<el-cascader style="width:90%" v-model="query.depts" :options="deptdata" clearable placeholder="部门/单位" @change="handleQuery" :show-all-levels="false" :props="{emitPath:false,checkStrictly: true}"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="8" :sm="24">
|
|
||||||
<el-cascader style="width:90%" v-model="query.posts" :options="postdata" clearable placeholder="岗位" @change="handleQuery" :show-all-levels="false" :props="{emitPath:false}"/>
|
|
||||||
</el-col> -->
|
|
||||||
<el-col :md="8" :sm="24">
|
|
||||||
<div style="display:flex">
|
|
||||||
<el-input
|
|
||||||
v-model="query.search"
|
|
||||||
placeholder="姓名/身份证号"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
></el-input>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
icon="el-icon-search"
|
|
||||||
@click="handleQuery"
|
|
||||||
></el-button>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
|
|
||||||
<scTable
|
|
||||||
ref="table"
|
|
||||||
:apiObj="apiObj"
|
|
||||||
:params="params"
|
|
||||||
row-key="id"
|
|
||||||
@selection-change="selectionChange"
|
|
||||||
stripe
|
|
||||||
hideDo
|
|
||||||
height="400px"
|
|
||||||
@resetQuery="resetQuery"
|
|
||||||
@row-click="rowClick"
|
|
||||||
>
|
|
||||||
<el-table-column type="selection" width="50" v-if="multiple" :reserve-selection="true"></el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="#"
|
|
||||||
type="index"
|
|
||||||
width="50"
|
|
||||||
></el-table-column>
|
|
||||||
<el-table-column label="姓名" prop="name"></el-table-column>
|
|
||||||
<el-table-column label="身份证号" prop="id_number"></el-table-column>
|
|
||||||
<el-table-column label="手机号" prop="phone"></el-table-column>
|
|
||||||
<el-table-column label="部门/单位" prop="belong_dept">
|
|
||||||
<template #default="scope">
|
|
||||||
<span v-if="scope.row.belong_dept_">{{
|
|
||||||
scope.row.belong_dept_.name
|
|
||||||
}}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="人员类型" prop="type">
|
|
||||||
<template #default="scope">
|
|
||||||
<span>{{userTypeOptions[scope.row.type]}}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</scTable>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="6" :sm="24" v-if="multiple">
|
|
||||||
<el-card shadow="never">
|
|
||||||
<template #header>
|
|
||||||
<div class="card-header">
|
|
||||||
<span>已选人员</span>
|
|
||||||
<el-button type="danger" @click="clearChose" size="small">清空</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<el-tag v-for="item, index in selection" v-bind:key="item.id" style="margin-right:4px; margin-top: 4px" size="large">{{index+1}}-{{item.name}}</el-tag>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<!-- <el-row>
|
|
||||||
<el-col :md="16" :sm="24">
|
|
||||||
<el-header style="border-bottom: none">
|
|
||||||
<div class="left-panel">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="right-panel">
|
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="addUser" v-if="multiple"
|
|
||||||
>添加选择</el-button>
|
|
||||||
</div>
|
|
||||||
</el-header>
|
|
||||||
<el-main class="nopadding">
|
|
||||||
</el-main>
|
|
||||||
<el-row style="padding-top: 8px">
|
|
||||||
<el-col :md="16" :sm="24" v-if="multiple">
|
|
||||||
<span style="font-weight:bold">已选人员:</span>{{username}}
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="8" :sm="24">
|
|
||||||
<el-main class="nopadding">
|
|
||||||
<el-tabs type="border-card" stretch="true">
|
|
||||||
<el-tab-pane label="按部门分类">
|
|
||||||
<el-input placeholder="输入关键字进行过滤" v-model="filterText">
|
|
||||||
</el-input>
|
|
||||||
|
|
||||||
<el-tree
|
|
||||||
class="filter-tree"
|
|
||||||
style="padding-top: 15px"
|
|
||||||
:data="deptdata"
|
|
||||||
default-expand-all
|
|
||||||
:filter-node-method="filterNode"
|
|
||||||
ref="tree"
|
|
||||||
@node-click="handleNodeClick"
|
|
||||||
>
|
|
||||||
</el-tree>
|
|
||||||
</el-tab-pane>
|
|
||||||
<el-tab-pane label="按岗位分类">
|
|
||||||
<el-input placeholder="输入关键字进行过滤" v-model="filterTexts">
|
|
||||||
</el-input>
|
|
||||||
|
|
||||||
<el-tree
|
|
||||||
class="filter-tree"
|
|
||||||
style="padding-top: 15px"
|
|
||||||
:data="postdata"
|
|
||||||
default-expand-all
|
|
||||||
:filter-node-method="filterNodes"
|
|
||||||
ref="tree"
|
|
||||||
@node-click="handleNodeClicks"
|
|
||||||
>
|
|
||||||
</el-tree>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
</el-main>
|
|
||||||
</el-col>
|
|
||||||
</el-row> -->
|
|
||||||
<template #footer v-if="multiple">
|
|
||||||
<el-button @click="dialoguser = false"
|
|
||||||
>取消</el-button>
|
|
||||||
<el-button
|
|
||||||
v-if="mode != 'show'"
|
|
||||||
type="primary"
|
|
||||||
:loading="isSaveing"
|
|
||||||
@click="confirm()"
|
|
||||||
>确定</el-button >
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import { genTree } from "@/utils/verificate";
|
|
||||||
export default {
|
|
||||||
name: "userChoose",
|
|
||||||
components: {},
|
|
||||||
props: {
|
|
||||||
value: {
|
|
||||||
// 接受外部v-model传入的值
|
|
||||||
type: [String],
|
|
||||||
default: "",
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
// 接受外部v-model传入的值
|
|
||||||
type: [String],
|
|
||||||
default: "",
|
|
||||||
},
|
|
||||||
closable: {
|
|
||||||
// 是否可以关闭标签
|
|
||||||
type: Boolean,
|
|
||||||
default: () => {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selectable: {
|
|
||||||
// 是否可选人员
|
|
||||||
type: Boolean,
|
|
||||||
default: () => {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
multiple: {
|
|
||||||
// 是否多选,默认可以多选
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
apiObj: this.$API.hrm.employee.list,
|
|
||||||
params: {},
|
|
||||||
query: {},
|
|
||||||
selection: [],
|
|
||||||
filterText: "",
|
|
||||||
filterTexts: "",
|
|
||||||
deptdata: [],
|
|
||||||
postdata: [],
|
|
||||||
username: [],
|
|
||||||
userData: [],
|
|
||||||
dialoguser: false,
|
|
||||||
dataValue: this.value,
|
|
||||||
choseData: {},
|
|
||||||
// choseType: 'employee',
|
|
||||||
// choseTypeOptions: [
|
|
||||||
// {
|
|
||||||
// value: 'employee',
|
|
||||||
// label: '正式员工'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// value: 'remployee',
|
|
||||||
// label: '相关方'
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
userTypeOptions :{
|
|
||||||
'employee': '正式员工',
|
|
||||||
'remployee': '相关方',
|
|
||||||
'visitor': '访客'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
// this.getDept();
|
|
||||||
// this.getPost();
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
filterText(val) {
|
|
||||||
this.$refs.tree.filter(val);
|
|
||||||
},
|
|
||||||
filterTexts(val) {
|
|
||||||
this.$refs.tree.filter(val);
|
|
||||||
},
|
|
||||||
dataValue(val) {
|
|
||||||
this.$emit("input", val);
|
|
||||||
console.log(val);
|
|
||||||
},
|
|
||||||
userData(val) {
|
|
||||||
if (val) {
|
|
||||||
this.change();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
showDialog() {
|
|
||||||
this.dialoguser = true;
|
|
||||||
// this.$nextTick(function () {
|
|
||||||
// this.apiObj.map((item) => {
|
|
||||||
// if (item.id === this.user) {
|
|
||||||
// this.$refs.table.toggleRowSelection(item, true);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
//加载人员
|
|
||||||
handleQuery() {
|
|
||||||
this.$refs.table.queryData(this.query)
|
|
||||||
},
|
|
||||||
//加载部门树数据
|
|
||||||
async getDept() {
|
|
||||||
let res = await this.$API.system.dept.list.req({ page: 0 });
|
|
||||||
this.deptdata = genTree(res);
|
|
||||||
},
|
|
||||||
//加载岗位树数据
|
|
||||||
async getPost() {
|
|
||||||
let res = await this.$API.system.post.list.req({ page: 0 });
|
|
||||||
this.postdata = genTree(res);
|
|
||||||
},
|
|
||||||
// filterNode(value, data) {
|
|
||||||
// console.log(value);
|
|
||||||
// if (!value) return true;
|
|
||||||
// return data.label.indexOf(value) !== -1;
|
|
||||||
// },
|
|
||||||
// filterNodes(value, data) {
|
|
||||||
// console.log(value);
|
|
||||||
// if (!value) return true;
|
|
||||||
// return data.label.indexOf(value) !== -1;
|
|
||||||
// },
|
|
||||||
// //部门点击显示对应的人员
|
|
||||||
// handleNodeClick(data) {
|
|
||||||
// this.query.depts = data.id
|
|
||||||
// this.handleQuery()
|
|
||||||
// },
|
|
||||||
// //岗位点击显示对应的人员
|
|
||||||
// handleNodeClicks(data) {
|
|
||||||
// this.query.posts = data.id
|
|
||||||
// this.handleQuery()
|
|
||||||
// },
|
|
||||||
rowClick(row, column, event){
|
|
||||||
if(!this.multiple){
|
|
||||||
this.choseData = {'id': row.id, 'name': row.name}
|
|
||||||
this.$emit("submit", this.choseData);
|
|
||||||
this.dialoguser=false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//表格选择后回调事件
|
|
||||||
selectionChange(selection) {
|
|
||||||
this.selection = selection;
|
|
||||||
},
|
|
||||||
//删除Tag
|
|
||||||
// closeTag(name) {
|
|
||||||
// this.userData.splice(this.userData.indexOf(name), 1);
|
|
||||||
// },
|
|
||||||
|
|
||||||
// addUser() {
|
|
||||||
// this.username = [];
|
|
||||||
// this.userData = [];
|
|
||||||
// if (!this.multiple && this.selection.length > 1) {
|
|
||||||
// this.$message.error("对应的人员只允许选择一人!");
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (!this.selection || this.selection.length === 0) {
|
|
||||||
// this.msgError("请选择至少一个人员!");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// this.selection.forEach((item) => {
|
|
||||||
// this.username.push(item.name);
|
|
||||||
|
|
||||||
// this.userData.push({ id: item.id, name: item.name });
|
|
||||||
// });
|
|
||||||
// console.log(this.userData);
|
|
||||||
// },
|
|
||||||
|
|
||||||
// change() {
|
|
||||||
// if (this.tags) {
|
|
||||||
// alert(1);
|
|
||||||
// this.dataValue = this.userData.map((e) => e.id).join(",");
|
|
||||||
// console.log(this.dataValue);
|
|
||||||
// this.$emit("change", this.dataValue);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
clearChose() {
|
|
||||||
this.$refs.table.clearSelection()
|
|
||||||
},
|
|
||||||
confirm() {
|
|
||||||
this.dialoguser = false;
|
|
||||||
// this.change(); // 触发值变化
|
|
||||||
// this.dataValue = this.userData.map((e) => e.id).join(",");
|
|
||||||
this.$emit("submit", this.selection);
|
|
||||||
},
|
|
||||||
//权限设置
|
|
||||||
// permission() {
|
|
||||||
// this.dialog.permission = true;
|
|
||||||
// this.$nextTick(() => {
|
|
||||||
// this.$refs.permissionDialog.open();
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
|
|
||||||
resetQuery() {
|
|
||||||
this.query = {};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<style scoped>
|
|
||||||
.card-header{
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
|
@ -1,124 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="sc-select">
|
|
||||||
<div v-if="initloading" class="sc-select-loading">
|
|
||||||
<el-icon class="is-loading"><el-icon-loading /></el-icon>
|
|
||||||
</div>
|
|
||||||
<el-select
|
|
||||||
v-bind="$attrs"
|
|
||||||
:loading="loading"
|
|
||||||
@visible-change="visibleChange"
|
|
||||||
:value-on-clear="null"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in options"
|
|
||||||
:key="item[id]"
|
|
||||||
:label="item[name]"
|
|
||||||
:value="objValueType ? item : item[id]"
|
|
||||||
>
|
|
||||||
<slot name="option" :data="item"></slot>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
apiObj: { type: Object, default: () => {} },
|
|
||||||
objValueType: { type: Boolean, default: false },
|
|
||||||
params: { type: Object, default: () => ({}) },
|
|
||||||
id: { type: String, default: "id" },
|
|
||||||
name: { type: String, default: "name" },
|
|
||||||
showName: { type: String, default: null },
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading: false,
|
|
||||||
options: [],
|
|
||||||
initloading: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
//如果有默认值就去请求接口获取options
|
|
||||||
if (this.hasValue()) {
|
|
||||||
this.initloading = true;
|
|
||||||
this.getRemoteData();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
//选项显示隐藏事件
|
|
||||||
visibleChange(ispoen) {
|
|
||||||
if (ispoen && this.options.length == 0 && this.apiObj) {
|
|
||||||
this.getRemoteData();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//获取数据
|
|
||||||
async getRemoteData() {
|
|
||||||
this.loading = true;
|
|
||||||
var query = Object.assign({ page: 0 }, this.params);
|
|
||||||
var res = await this.apiObj.req(query);
|
|
||||||
this.loading = false;
|
|
||||||
this.initloading = false;
|
|
||||||
if (
|
|
||||||
this.$attrs.modelValue !== null &&
|
|
||||||
!res.some(
|
|
||||||
(option) => option[this.id] === this.$attrs.modelValue
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
this.options = [
|
|
||||||
{
|
|
||||||
[this.id]: this.$attrs.modelValue,
|
|
||||||
[this.name]: this.showName,
|
|
||||||
},
|
|
||||||
...res,
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
this.options = res;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//判断是否有回显默认值
|
|
||||||
hasValue() {
|
|
||||||
if (
|
|
||||||
Array.isArray(this.$attrs.modelValue) &&
|
|
||||||
this.$attrs.modelValue.length <= 0
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
} else if (this.$attrs.modelValue) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.sc-select {
|
|
||||||
display: inline-block;
|
|
||||||
position: relative;
|
|
||||||
min-width: 120px;
|
|
||||||
}
|
|
||||||
.sc-select-loading {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: #fff;
|
|
||||||
z-index: 100;
|
|
||||||
border-radius: 5px;
|
|
||||||
border: 1px solid #ebeef5;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
.sc-select-loading i {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .sc-select-loading {
|
|
||||||
background: var(--el-bg-color-overlay);
|
|
||||||
border-color: var(--el-border-color-light);
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,225 +0,0 @@
|
||||||
<template>
|
|
||||||
<el-select style="width: 200px" ref="select" v-model="defaultValue" :size="size" :clearable="clearable" :multiple="multiple" :collapse-tags="collapseTags" :collapse-tags-tooltip="collapseTagsTooltip" :filterable="filterable" :placeholder="placeholder" :disabled="disabled" :filter-method="filterMethod" @remove-tag="removeTag" @visible-change="visibleChange" @clear="clear">
|
|
||||||
<template #empty>
|
|
||||||
<div class="sc-table-select__table" :style="{width: tableWidth+'px'}" v-loading="loading">
|
|
||||||
<div class="sc-table-select__header">
|
|
||||||
<slot name="header" :form="formData" :submit="formSubmit"></slot>
|
|
||||||
</div>
|
|
||||||
<el-table ref="table" :data="tableData" :height="245" :highlight-current-row="!multiple" @row-click="click" @select="select" @select-all="selectAll">
|
|
||||||
<el-table-column v-if="multiple" type="selection" width="45"></el-table-column>
|
|
||||||
<el-table-column v-else type="index" width="45">
|
|
||||||
<template #default="scope"><span>{{scope.$index+(currentPage - 1) * pageSize + 1}}</span></template>
|
|
||||||
</el-table-column>
|
|
||||||
<slot></slot>
|
|
||||||
</el-table>
|
|
||||||
<div class="sc-table-select__page">
|
|
||||||
<el-pagination small background layout="prev, pager, next" :total="total" :page-size="pageSize" v-model:currentPage="currentPage" @current-change="reload"></el-pagination>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import config from "@/config/tableSelect";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
modelValue: null,
|
|
||||||
apiObj: { type: Object, default: () => {} },
|
|
||||||
params: { type: Object, default: () => {} },
|
|
||||||
placeholder: { type: String, default: "请选择" },
|
|
||||||
size: { type: String, default: "default" },
|
|
||||||
clearable: { type: Boolean, default: false },
|
|
||||||
multiple: { type: Boolean, default: false },
|
|
||||||
filterable: { type: Boolean, default: false },
|
|
||||||
collapseTags: { type: Boolean, default: false },
|
|
||||||
collapseTagsTooltip: { type: Boolean, default: false },
|
|
||||||
disabled: { type: Boolean, default: false },
|
|
||||||
tableWidth: {type: Number, default: 400},
|
|
||||||
mode: { type: String, default: "popover" },
|
|
||||||
props: { type: Object, default: () => {} }
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading: false,
|
|
||||||
keyword: null,
|
|
||||||
defaultValue: [],
|
|
||||||
tableData: [],
|
|
||||||
pageSize: config.pageSize,
|
|
||||||
total: 0,
|
|
||||||
currentPage: 1,
|
|
||||||
defaultProps: {
|
|
||||||
label: config.props.label,
|
|
||||||
value: config.props.value,
|
|
||||||
page: config.request.page,
|
|
||||||
pageSize: config.request.pageSize,
|
|
||||||
keyword: config.request.keyword
|
|
||||||
},
|
|
||||||
formData: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
modelValue:{
|
|
||||||
handler(){
|
|
||||||
this.defaultValue = this.modelValue
|
|
||||||
this.autoCurrentLabel()
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.defaultProps = Object.assign(this.defaultProps, this.props);
|
|
||||||
this.defaultValue = this.modelValue
|
|
||||||
this.autoCurrentLabel()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
//表格显示隐藏回调
|
|
||||||
visibleChange(visible){
|
|
||||||
if(visible){
|
|
||||||
this.currentPage = 1
|
|
||||||
this.keyword = null
|
|
||||||
this.formData = {}
|
|
||||||
this.getData()
|
|
||||||
}else{
|
|
||||||
this.autoCurrentLabel()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//获取表格数据
|
|
||||||
async getData(){
|
|
||||||
this.loading = true;
|
|
||||||
var reqData = {
|
|
||||||
[this.defaultProps.page]: this.currentPage,
|
|
||||||
[this.defaultProps.pageSize]: this.pageSize,
|
|
||||||
[this.defaultProps.keyword]: this.keyword
|
|
||||||
}
|
|
||||||
Object.assign(reqData, this.params, this.formData)
|
|
||||||
var res = await this.apiObj.req(reqData);
|
|
||||||
var parseData = config.parseData(res)
|
|
||||||
this.tableData = parseData.rows;
|
|
||||||
this.total = parseData.total;
|
|
||||||
this.loading = false;
|
|
||||||
//表格默认赋值
|
|
||||||
this.$nextTick(() => {
|
|
||||||
if(this.multiple){
|
|
||||||
this.defaultValue.forEach(row => {
|
|
||||||
var setrow = this.tableData.filter(item => item[this.defaultProps.value]===row[this.defaultProps.value] )
|
|
||||||
if(setrow.length > 0){
|
|
||||||
this.$refs.table.toggleRowSelection(setrow[0], true);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
var setrow = this.tableData.filter(item => item[this.defaultProps.value]===this.defaultValue[this.defaultProps.value] )
|
|
||||||
this.$refs.table.setCurrentRow(setrow[0]);
|
|
||||||
}
|
|
||||||
this.$refs.table.setScrollTop(0)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
//插糟表单提交
|
|
||||||
formSubmit(){
|
|
||||||
this.currentPage = 1
|
|
||||||
this.keyword = null
|
|
||||||
this.getData()
|
|
||||||
},
|
|
||||||
//分页刷新表格
|
|
||||||
reload(){
|
|
||||||
this.getData()
|
|
||||||
},
|
|
||||||
//自动模拟options赋值
|
|
||||||
autoCurrentLabel(){
|
|
||||||
this.$nextTick(() => {
|
|
||||||
if(this.multiple){
|
|
||||||
this.$refs.select.selected.forEach(item => {
|
|
||||||
item.currentLabel = item.value[this.defaultProps.label]
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
this.$refs.select.selectedLabel = this.defaultValue[this.defaultProps.label]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
//表格勾选事件
|
|
||||||
select(rows, row){
|
|
||||||
var isSelect = rows.length && rows.indexOf(row) !== -1
|
|
||||||
if(isSelect){
|
|
||||||
this.defaultValue.push(row)
|
|
||||||
}else{
|
|
||||||
this.defaultValue.splice(this.defaultValue.findIndex(item => item[this.defaultProps.value] == row[this.defaultProps.value]), 1)
|
|
||||||
}
|
|
||||||
this.autoCurrentLabel()
|
|
||||||
this.$emit('update:modelValue', this.defaultValue);
|
|
||||||
this.$emit('change', this.defaultValue);
|
|
||||||
},
|
|
||||||
//表格全选事件
|
|
||||||
selectAll(rows){
|
|
||||||
var isAllSelect = rows.length > 0
|
|
||||||
if(isAllSelect){
|
|
||||||
rows.forEach(row => {
|
|
||||||
var isHas = this.defaultValue.find(item => item[this.defaultProps.value] == row[this.defaultProps.value])
|
|
||||||
if(!isHas){
|
|
||||||
this.defaultValue.push(row)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
this.tableData.forEach(row => {
|
|
||||||
var isHas = this.defaultValue.find(item => item[this.defaultProps.value] == row[this.defaultProps.value])
|
|
||||||
if(isHas){
|
|
||||||
this.defaultValue.splice(this.defaultValue.findIndex(item => item[this.defaultProps.value] == row[this.defaultProps.value]), 1)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.autoCurrentLabel()
|
|
||||||
this.$emit('update:modelValue', this.defaultValue);
|
|
||||||
this.$emit('change', this.defaultValue);
|
|
||||||
},
|
|
||||||
click(row){
|
|
||||||
if(this.multiple){
|
|
||||||
//处理多选点击行
|
|
||||||
}else{
|
|
||||||
this.defaultValue = row
|
|
||||||
this.$refs.select.blur()
|
|
||||||
this.autoCurrentLabel()
|
|
||||||
this.$emit('update:modelValue', this.defaultValue);
|
|
||||||
this.$emit('change', this.defaultValue);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//tags删除后回调
|
|
||||||
removeTag(tag){
|
|
||||||
var row = this.findRowByKey(tag[this.defaultProps.value])
|
|
||||||
this.$refs.table.toggleRowSelection(row, false);
|
|
||||||
this.$emit('update:modelValue', this.defaultValue);
|
|
||||||
},
|
|
||||||
//清空后的回调
|
|
||||||
clear(){
|
|
||||||
this.$emit('update:modelValue', this.defaultValue);
|
|
||||||
},
|
|
||||||
// 关键值查询表格数据行
|
|
||||||
findRowByKey (value) {
|
|
||||||
return this.tableData.find(item => item[this.defaultProps.value] === value)
|
|
||||||
},
|
|
||||||
filterMethod(keyword){
|
|
||||||
if(!keyword){
|
|
||||||
this.keyword = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.keyword = keyword;
|
|
||||||
this.getData()
|
|
||||||
},
|
|
||||||
// 触发select隐藏
|
|
||||||
blur(){
|
|
||||||
this.$refs.select.blur();
|
|
||||||
},
|
|
||||||
// 触发select显示
|
|
||||||
focus(){
|
|
||||||
this.$refs.select.focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.sc-table-select__table {padding:4px;}
|
|
||||||
.sc-table-select__page {padding-top: 4px;}
|
|
||||||
</style>
|
|
|
@ -1,427 +0,0 @@
|
||||||
<template>
|
|
||||||
<div style="display:flex;row nowrap">
|
|
||||||
<!-- <el-tag
|
|
||||||
v-for="user in userData"
|
|
||||||
:key="user.id"
|
|
||||||
>
|
|
||||||
{{ user.name }}
|
|
||||||
</el-tag>-->
|
|
||||||
<el-button
|
|
||||||
v-if="selectable"
|
|
||||||
type="primary"
|
|
||||||
circle
|
|
||||||
size="mini"
|
|
||||||
icon="el-icon-plus"
|
|
||||||
@click="showDialog()"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-dialog
|
|
||||||
title="选择账号"
|
|
||||||
width="70%"
|
|
||||||
v-model="dialoguser"
|
|
||||||
:before-close="handleClose"
|
|
||||||
:append-to-body="true"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
>
|
|
||||||
<el-row :gutter="4">
|
|
||||||
<el-col :md="multiple?18:24" :sm="24">
|
|
||||||
<el-card header="账号列表" shadow="never">
|
|
||||||
<el-row >
|
|
||||||
<el-col :md="6" :sm="24">
|
|
||||||
<el-select v-model="userTypeChecked" placeholder="人员类型" @change="handleQuery" :multiple="true">
|
|
||||||
<el-option v-for="item in choseTypeOptions" :key="item" :label="item.label"
|
|
||||||
:value="item.value"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="6" :sm="24">
|
|
||||||
<el-cascader style="width:90%" v-model="query.depts" :options="deptdata" clearable placeholder="部门/单位" @change="handleQuery" :show-all-levels="false" :props="{emitPath:false,checkStrictly: true}"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="6" :sm="24">
|
|
||||||
<el-cascader style="width:90%" v-model="query.posts" :options="postdata" clearable placeholder="岗位" @change="handleQuery" :show-all-levels="false" :props="{emitPath:false}"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="6" :sm="24">
|
|
||||||
<div style="display:flex">
|
|
||||||
<el-input
|
|
||||||
v-model="query.search"
|
|
||||||
placeholder="账户/姓名"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
></el-input>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
icon="el-icon-search"
|
|
||||||
@click="handleQuery"
|
|
||||||
></el-button>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
|
|
||||||
<scTable
|
|
||||||
ref="table"
|
|
||||||
:apiObj="apiObj"
|
|
||||||
:params="params"
|
|
||||||
row-key="id"
|
|
||||||
@selection-change="selectionChange"
|
|
||||||
stripe
|
|
||||||
hideDo
|
|
||||||
height="400px"
|
|
||||||
@resetQuery="resetQuery"
|
|
||||||
@row-click="rowClick"
|
|
||||||
>
|
|
||||||
<el-table-column type="selection" width="50" v-if="multiple" :reserve-selection="true"></el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="#"
|
|
||||||
type="index"
|
|
||||||
width="50"
|
|
||||||
></el-table-column>
|
|
||||||
<el-table-column label="姓名" prop="name"></el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="手机号" prop="phone"></el-table-column>
|
|
||||||
<el-table-column label="部门" prop="belong_dept_name"></el-table-column>
|
|
||||||
<el-table-column label="账号类型" prop="type">
|
|
||||||
<template #default="scope">
|
|
||||||
<span>{{userTypeOptions[scope.row.type]}}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="创建时间"
|
|
||||||
prop="create_time"
|
|
||||||
></el-table-column>
|
|
||||||
</scTable>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="6" :sm="24" v-if="multiple">
|
|
||||||
<el-card shadow="never">
|
|
||||||
<template #header>
|
|
||||||
<div class="card-header">
|
|
||||||
<span>已选人员</span>
|
|
||||||
<el-button type="danger" @click="clearChose" size="small">清空</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<el-tag v-for="item, index in selection" v-bind:key="item.id" style="margin-right:4px; margin-top: 4px" size="large">{{index+1}}-{{item.name}}</el-tag>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<!-- <el-row>
|
|
||||||
<el-col :md="16" :sm="24">
|
|
||||||
<el-header style="border-bottom: none">
|
|
||||||
<div class="left-panel">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="right-panel">
|
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="addUser" v-if="multiple"
|
|
||||||
>添加选择</el-button>
|
|
||||||
</div>
|
|
||||||
</el-header>
|
|
||||||
<el-main class="nopadding">
|
|
||||||
</el-main>
|
|
||||||
<el-row style="padding-top: 8px">
|
|
||||||
<el-col :md="16" :sm="24" v-if="multiple">
|
|
||||||
<span style="font-weight:bold">已选人员:</span>{{username}}
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="8" :sm="24">
|
|
||||||
<el-main class="nopadding">
|
|
||||||
<el-tabs type="border-card" stretch="true">
|
|
||||||
<el-tab-pane label="按部门分类">
|
|
||||||
<el-input placeholder="输入关键字进行过滤" v-model="filterText">
|
|
||||||
</el-input>
|
|
||||||
|
|
||||||
<el-tree
|
|
||||||
class="filter-tree"
|
|
||||||
style="padding-top: 15px"
|
|
||||||
:data="deptdata"
|
|
||||||
default-expand-all
|
|
||||||
:filter-node-method="filterNode"
|
|
||||||
ref="tree"
|
|
||||||
@node-click="handleNodeClick"
|
|
||||||
>
|
|
||||||
</el-tree>
|
|
||||||
</el-tab-pane>
|
|
||||||
<el-tab-pane label="按岗位分类">
|
|
||||||
<el-input placeholder="输入关键字进行过滤" v-model="filterTexts">
|
|
||||||
</el-input>
|
|
||||||
|
|
||||||
<el-tree
|
|
||||||
class="filter-tree"
|
|
||||||
style="padding-top: 15px"
|
|
||||||
:data="postdata"
|
|
||||||
default-expand-all
|
|
||||||
:filter-node-method="filterNodes"
|
|
||||||
ref="tree"
|
|
||||||
@node-click="handleNodeClicks"
|
|
||||||
>
|
|
||||||
</el-tree>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
</el-main>
|
|
||||||
</el-col>
|
|
||||||
</el-row> -->
|
|
||||||
<template #footer v-if="multiple">
|
|
||||||
<el-button @click="dialoguser = false"
|
|
||||||
>取消</el-button>
|
|
||||||
<el-button
|
|
||||||
v-if="mode != 'show'"
|
|
||||||
type="primary"
|
|
||||||
:loading="isSaveing"
|
|
||||||
@click="confirm()"
|
|
||||||
>确定</el-button >
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import { genTree } from "@/utils/verificate";
|
|
||||||
export default {
|
|
||||||
name: "userChoose",
|
|
||||||
components: {},
|
|
||||||
props: {
|
|
||||||
value: {
|
|
||||||
// 接受外部v-model传入的值
|
|
||||||
type: [String],
|
|
||||||
default: "",
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
// 接受外部v-model传入的值
|
|
||||||
type: [String],
|
|
||||||
default: "",
|
|
||||||
},
|
|
||||||
closable: {
|
|
||||||
// 是否可以关闭标签
|
|
||||||
type: Boolean,
|
|
||||||
default: () => {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
selectable: {
|
|
||||||
// 是否可选人员
|
|
||||||
type: Boolean,
|
|
||||||
default: () => {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
listIndex:{
|
|
||||||
// index
|
|
||||||
type: Number,
|
|
||||||
default: () => {
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
multiple: {
|
|
||||||
// 是否多选,默认可以多选
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
apiObj: this.$API.system.user.list,
|
|
||||||
params: {is_active:true},
|
|
||||||
query: {
|
|
||||||
is_active:true,
|
|
||||||
},
|
|
||||||
selection: [],
|
|
||||||
filterText: "",
|
|
||||||
filterTexts: "",
|
|
||||||
deptdata: [],
|
|
||||||
postdata: [],
|
|
||||||
username: [],
|
|
||||||
userData: [],
|
|
||||||
dialoguser: false,
|
|
||||||
dataValue: this.value,
|
|
||||||
choseData: {},
|
|
||||||
userTypeChecked: [],
|
|
||||||
choseTypeOptions: [
|
|
||||||
{
|
|
||||||
value: 'employee',
|
|
||||||
label: '正式员工'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'remployee',
|
|
||||||
label: '相关方'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'visitor',
|
|
||||||
label: '访客'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'driver',
|
|
||||||
label: '货车司机'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
userTypeOptions :{
|
|
||||||
'employee': '正式员工',
|
|
||||||
'remployee': '相关方',
|
|
||||||
'visitor': '访客'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
debugger;
|
|
||||||
console.log('this.listIndex')
|
|
||||||
console.log(this.listIndex)
|
|
||||||
this.getDept();
|
|
||||||
this.getPost();
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
filterText(val) {
|
|
||||||
this.$refs.tree.filter(val);
|
|
||||||
},
|
|
||||||
filterTexts(val) {
|
|
||||||
this.$refs.tree.filter(val);
|
|
||||||
},
|
|
||||||
dataValue(val) {
|
|
||||||
this.$emit("input", val);
|
|
||||||
console.log(val);
|
|
||||||
},
|
|
||||||
userData(val) {
|
|
||||||
if (val) {
|
|
||||||
this.change();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
showDialog() {
|
|
||||||
this.dialoguser = true;
|
|
||||||
// this.$nextTick(function () {
|
|
||||||
// this.apiObj.map((item) => {
|
|
||||||
// if (item.id === this.user) {
|
|
||||||
// this.$refs.table.toggleRowSelection(item, true);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
//加载人员
|
|
||||||
handleQuery() {
|
|
||||||
this.query.type__in = null;
|
|
||||||
if(this.userTypeChecked){
|
|
||||||
this.query.type__in = this.userTypeChecked.join(',')
|
|
||||||
}
|
|
||||||
this.$refs.table.queryData(this.query)
|
|
||||||
},
|
|
||||||
//加载部门树数据
|
|
||||||
async getDept() {
|
|
||||||
let res = await this.$API.system.dept.list.req({ page: 0, type__in:'dept, rparty' });
|
|
||||||
this.deptdata = genTree(res);
|
|
||||||
},
|
|
||||||
//加载岗位树数据
|
|
||||||
async getPost() {
|
|
||||||
let res = await this.$API.system.post.list.req({ page: 0 });
|
|
||||||
this.postdata = genTree(res);
|
|
||||||
},
|
|
||||||
// filterNode(value, data) {
|
|
||||||
// console.log(value);
|
|
||||||
// if (!value) return true;
|
|
||||||
// return data.label.indexOf(value) !== -1;
|
|
||||||
// },
|
|
||||||
// filterNodes(value, data) {
|
|
||||||
// console.log(value);
|
|
||||||
// if (!value) return true;
|
|
||||||
// return data.label.indexOf(value) !== -1;
|
|
||||||
// },
|
|
||||||
// //部门点击显示对应的人员
|
|
||||||
// handleNodeClick(data) {
|
|
||||||
// this.query.depts = data.id
|
|
||||||
// this.handleQuery()
|
|
||||||
// },
|
|
||||||
// //岗位点击显示对应的人员
|
|
||||||
// handleNodeClicks(data) {
|
|
||||||
// this.query.posts = data.id
|
|
||||||
// this.handleQuery()
|
|
||||||
// },
|
|
||||||
rowClick(row, column, event){
|
|
||||||
if(!this.multiple){
|
|
||||||
if(this.listIndex!==null){
|
|
||||||
data.
|
|
||||||
this.choseData = row;
|
|
||||||
this.choseData.listIndex = this.listIndex;
|
|
||||||
this.$emit("submit", this.choseData);
|
|
||||||
this.dialoguser=false
|
|
||||||
}else{
|
|
||||||
this.choseData = row;
|
|
||||||
this.$emit("submit", this.choseData);
|
|
||||||
this.dialoguser=false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//表格选择后回调事件
|
|
||||||
selectionChange(selection) {
|
|
||||||
this.selection = selection;
|
|
||||||
},
|
|
||||||
//删除Tag
|
|
||||||
// closeTag(name) {
|
|
||||||
// this.userData.splice(this.userData.indexOf(name), 1);
|
|
||||||
// },
|
|
||||||
|
|
||||||
// addUser() {
|
|
||||||
// this.username = [];
|
|
||||||
// this.userData = [];
|
|
||||||
// if (!this.multiple && this.selection.length > 1) {
|
|
||||||
// this.$message.error("对应的人员只允许选择一人!");
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (!this.selection || this.selection.length === 0) {
|
|
||||||
// this.msgError("请选择至少一个人员!");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// this.selection.forEach((item) => {
|
|
||||||
// this.username.push(item.name);
|
|
||||||
|
|
||||||
// this.userData.push({ id: item.id, name: item.name });
|
|
||||||
// });
|
|
||||||
// console.log(this.userData);
|
|
||||||
// },
|
|
||||||
|
|
||||||
// change() {
|
|
||||||
// if (this.tags) {
|
|
||||||
// alert(1);
|
|
||||||
// this.dataValue = this.userData.map((e) => e.id).join(",");
|
|
||||||
// console.log(this.dataValue);
|
|
||||||
// this.$emit("change", this.dataValue);
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
clearChose() {
|
|
||||||
this.$refs.table.clearSelection()
|
|
||||||
},
|
|
||||||
confirm() {
|
|
||||||
this.dialoguser = false;
|
|
||||||
// this.change(); // 触发值变化
|
|
||||||
// this.dataValue = this.userData.map((e) => e.id).join(",");
|
|
||||||
let data = this.selection;
|
|
||||||
if(this.listIndex!==null){
|
|
||||||
data.listIndex = this.listIndex;
|
|
||||||
debugger;
|
|
||||||
console.log(this.listIndex);
|
|
||||||
console.log(data);
|
|
||||||
this.$emit("submit",data);
|
|
||||||
}else{
|
|
||||||
this.$emit("submit",data);
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
//权限设置
|
|
||||||
// permission() {
|
|
||||||
// this.dialog.permission = true;
|
|
||||||
// this.$nextTick(() => {
|
|
||||||
// this.$refs.permissionDialog.open();
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
|
|
||||||
resetQuery() {
|
|
||||||
this.query = {};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<style scoped>
|
|
||||||
.card-header{
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
|
@ -92,6 +92,7 @@ export default {
|
||||||
tableName: { type: String, default: "" },
|
tableName: { type: String, default: "" },
|
||||||
apiObj: { type: Object, default: () => { } },
|
apiObj: { type: Object, default: () => { } },
|
||||||
params: { type: Object, default: () => ({}) },
|
params: { type: Object, default: () => ({}) },
|
||||||
|
query: { type: Object, default: () => ({}) },
|
||||||
data: { type: Object, default: () => { } },
|
data: { type: Object, default: () => { } },
|
||||||
height: { type: [String, Number], default: "100%" },
|
height: { type: [String, Number], default: "100%" },
|
||||||
size: { type: String, default: "default" },
|
size: { type: String, default: "default" },
|
||||||
|
|
10
src/my.js
10
src/my.js
|
@ -1,10 +0,0 @@
|
||||||
import myUserSelect from './components/mySelect/userselect'
|
|
||||||
import mySelect from './components/mySelect/select'
|
|
||||||
import myTableSelect from './components/mySelect/tableSelect'
|
|
||||||
export default {
|
|
||||||
install(app) {
|
|
||||||
app.component('myUserSelect', myUserSelect);
|
|
||||||
app.component('mySelect', mySelect);
|
|
||||||
app.component('myTableSelect', myTableSelect);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@
|
||||||
<el-main>
|
<el-main>
|
||||||
<el-row :gutter="4">
|
<el-row :gutter="4">
|
||||||
<el-col :md="5" :sm="24">
|
<el-col :md="5" :sm="24">
|
||||||
<el-card header="CPU" v-loading="loading">
|
<el-card header="CPU">
|
||||||
<el-descriptions :column="1" border>
|
<el-descriptions :column="1" border>
|
||||||
<el-descriptions-item label="物理核心数">{{
|
<el-descriptions-item label="物理核心数">{{
|
||||||
cpuData.count
|
cpuData.count
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="5" :sm="24">
|
<el-col :md="5" :sm="24">
|
||||||
<el-card header="内存" v-loading="loading">
|
<el-card header="内存">
|
||||||
<el-descriptions :column="1" border>
|
<el-descriptions :column="1" border>
|
||||||
<el-descriptions-item label="总内存">{{ memoryData.total }}GB</el-descriptions-item>
|
<el-descriptions-item label="总内存">{{ memoryData.total }}GB</el-descriptions-item>
|
||||||
<el-descriptions-item label="已用内存">{{ memoryData.used }}GB</el-descriptions-item>
|
<el-descriptions-item label="已用内存">{{ memoryData.used }}GB</el-descriptions-item>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="5" :sm="24">
|
<el-col :md="5" :sm="24">
|
||||||
<el-card header="硬盘" v-loading="loading">
|
<el-card header="硬盘">
|
||||||
<el-descriptions :column="1" border>
|
<el-descriptions :column="1" border>
|
||||||
<el-descriptions-item label="总大小">{{ diskData.total }}GB</el-descriptions-item>
|
<el-descriptions-item label="总大小">{{ diskData.total }}GB</el-descriptions-item>
|
||||||
<el-descriptions-item label="已用大小">{{ diskData.used }}GB</el-descriptions-item>
|
<el-descriptions-item label="已用大小">{{ diskData.used }}GB</el-descriptions-item>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="9" :sm="24">
|
<el-col :md="9" :sm="24">
|
||||||
<el-card header="Celery&Redis" v-loading="loading">
|
<el-card header="Celery&Redis">
|
||||||
<el-descriptions :column="2" border>
|
<el-descriptions :column="2" border>
|
||||||
<el-descriptions-item label="注册任务数">{{ celeryData.count_registered_task }}</el-descriptions-item>
|
<el-descriptions-item label="注册任务数">{{ celeryData.count_registered_task }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="Redis内存使用">{{ redisData.used_memory_human }}</el-descriptions-item>
|
<el-descriptions-item label="Redis内存使用">{{ redisData.used_memory_human }}</el-descriptions-item>
|
||||||
|
@ -69,7 +69,6 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
|
||||||
cpuData: {},
|
cpuData: {},
|
||||||
diskData: {},
|
diskData: {},
|
||||||
memoryData: {},
|
memoryData: {},
|
||||||
|
@ -96,18 +95,9 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
serverInfo() {
|
serverInfo() {
|
||||||
this.loading = true;
|
this.$API.ops.server.cpu.req().then(res=>{this.cpuData = res})
|
||||||
this.$API.ops.server.info
|
this.$API.ops.server.memory.req().then(res=>{this.memoryData = res})
|
||||||
.req()
|
this.$API.ops.server.disk.req().then(res=>{this.diskData = res})
|
||||||
.then((res) => {
|
|
||||||
this.loading = false;
|
|
||||||
this.cpuData = res.cpu;
|
|
||||||
this.diskData = res.disk;
|
|
||||||
this.memoryData = res.memory;
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.query = {};
|
this.query = {};
|
||||||
|
|
|
@ -100,7 +100,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
apiObj: this.$API.third.thirdLog,
|
apiObj: this.$API.ops.thirdLog,
|
||||||
query: {},
|
query: {},
|
||||||
logLists: [],
|
logLists: [],
|
||||||
infoDrawer: false,
|
infoDrawer: false,
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
import ehsUserSelect from './components/ehsSelect/userselect'
|
|
||||||
import ehsEpSelect from './components/ehsSelect/epselect'
|
|
||||||
import ehsSelect from './components/ehsSelect/select'
|
|
||||||
import ehsTableSelect from './components/ehsSelect/tableSelect'
|
|
||||||
import xtSelect from './components/xtSelect/index.vue'
|
import xtSelect from './components/xtSelect/index.vue'
|
||||||
export default {
|
export default {
|
||||||
install(app) {
|
install(app) {
|
||||||
app.component('ehsUserSelect', ehsUserSelect);
|
|
||||||
app.component('ehsEpSelect', ehsEpSelect);
|
|
||||||
app.component('ehsSelect', ehsSelect);
|
|
||||||
app.component('ehsTableSelect', ehsTableSelect);
|
|
||||||
app.component('xtSelect', xtSelect);
|
app.component('xtSelect', xtSelect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ module.exports = defineConfig({
|
||||||
},
|
},
|
||||||
client: {
|
client: {
|
||||||
overlay: {
|
overlay: {
|
||||||
// runtimeErrors: false,
|
runtimeErrors: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue