chore: 企业端 项目 开放添加项目人员操作;

This commit is contained in:
nieli 2022-11-23 16:20:05 +08:00
parent 6db7e7bb8c
commit 9f83463f67
5 changed files with 400 additions and 111 deletions

View File

@ -17,7 +17,7 @@ project:space:remove --- 项目-空间-删除
project:space:edit --- 项目-空间-编辑
project:space:device --- 项目-空间-设备管理
project:device:add --- 项目-空间-设备-添加
project:device:relieve --- 项目-空间-设备-
project:device:relieve --- 项目-空间-设备-
project:price:add --- 项目-能源-合同-删除
project:price:edit --- 项目-能源-合同-编辑
@ -28,3 +28,6 @@ project:scene:edit --- 项目-场景-编辑
project:scene:remove --- 项目-场景-删除
project:scene:run --- 项目-场景-执行一次
project:scene:status --- 项目-场景-禁用/启用
project:user:add --- 项目-租户-人员-新增
project:user:relieve --- 项目-租户-人员-解除

View File

@ -9,6 +9,10 @@
<e-object-tenant v-if="activeName === 'tenant'" :infoData="projectInfo || {}"/>
</el-tab-pane>
<el-tab-pane label="项目人员" name="user" v-if="!isShowUserTable">
<e-tenant-user v-if="activeName === 'user'" :projectId="projectInfo.projectId"></e-tenant-user>
</el-tab-pane>
<el-tab-pane label="空间" name="space">
<e-object-space v-if="activeName === 'space'" :infoData="projectInfo || {}"/>
</el-tab-pane>
@ -17,6 +21,7 @@
</template>
<script>
import EObjectInfo from './EObjectInfo'
import ETenantUser from './ETenantUser'
import EObjectSpace from './EObjectSpace'
import EObjectTenant from './EObjectTenant'
export default {
@ -24,7 +29,8 @@ export default {
components: {
EObjectInfo,
EObjectSpace,
EObjectTenant
EObjectTenant,
ETenantUser
},
props: {
projectInfo: {

View File

@ -35,18 +35,12 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" plain icon="el-icon-plus" v-hasPermi="['project:space:add']" @click="handleAdd">新增</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" v-hasPermi="['project:space:add']" @click="handleAdd">新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="spaceList"
@ -56,8 +50,6 @@
>
<el-table-column type="index" label="序号" align="center" :index="indexFormatter" width="80px"></el-table-column>
<el-table-column label="空间名称" align="left" prop="spaceName" />
<!-- <el-table-column label="空间ID" align="left" prop="spaceId" />
<el-table-column label="空间编码" align="left" prop="spaceCode" />-->
<el-table-column label="空间类型" align="center" prop="spaceType" :formatter="statusFormat" />
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">

View File

@ -0,0 +1,385 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" plain icon="el-icon-plus" v-hasPermi="['project:user:add']" @click="handleAdd">新增</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="project_tenantList"
:default-sort="{prop: 'expirationTime', order: 'descending'}"
@sort-change="sortChange"
>
<el-table-column type="index" label="序号" align="center" :index="indexFormatter" width="80px"></el-table-column>
<el-table-column label="用户昵称" align="center" prop="nickName" />
<el-table-column label="手机号码" align="center" prop="phoneNumber" />
<el-table-column label="邮箱" align="center" prop="email" />
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<span v-text="scope.row.status === '0' ? '正常' : '停用'"></span>
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
sortable="custom"
prop="createTime"
width="160"
/>
<el-table-column
label="操作"
align="center"
width="200px"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['project:user:relieve']"
@click="handleDelete(scope.row)"
>解除用户</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog
title="选择用户"
:visible.sync="selectTableShow"
width="50%"
top="10vh"
class="select-table-dialog"
:close-on-click-modal="false"
append-to-body
>
<select-table-wrap
v-if="selectTableShow"
:tableOption="tableSelectOption.tableOpt"
:queryOption="tableSelectOption.queryOpt"
:tableList="tableSelectOption.tableList"
@parentGetList="childGetList($event)"
:otherOption="tableSelectOption.otherOption"
@returnEvent="returnEvent($event)"
/>
<div slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" @click="submitForm"> </el-button>
<el-button size="mini" @click="() =>{selectTableShow = false}"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listProjectUser,
delProjectUser,
addProjectUser,
exportProjectUser,
listProjectNotUsed
} from "@/api/tenant/projectUser";
import SelectTableWrap from "@/components/SelectTable/index";
export default {
name: "ProjectTenant",
components: {
SelectTableWrap
},
props: ["projectId"],
data() {
return {
selectTableShow: false,
tableSelectOption: {},
selectResult: {},
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
project_tenantList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
orderByColumn: "createTime",
isAsc: "desc"
},
//
form: {},
//
rules: {},
//
statusOptions: [],
tenantTypeOptions: []
};
},
created() {
this.getDicts("sys_tenant_type").then(response => {
this.tenantTypeOptions = response.data;
});
this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data;
});
this.getList();
},
methods: {
sortChange(column) {
const sort = {
isAsc: column.order === "descending" ? "desc" : "asc",
orderByColumn: column.prop
};
this.queryParams = Object.assign(this.queryParams, sort);
this.handleQuery();
},
indexFormatter(val) {
return (
val + 1 + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
);
},
//
handleDetails() {
this.selectResult = {};
this.tableSelectOption = {
otherOption: {
tableType: "device"
},
queryOpt: {
disable: false,
labelWidth: "68px",
params: {
projectId: this.projectId,
tenantName: ""
},
page: {
pageSize: 10,
pageNum: 1,
total: 0
},
inline: true,
queryChilds: [
{
style: "",
placeholder: "用户昵称",
clearable: true,
label: "用户昵称",
type: "input",
key: "nickName",
size: "small",
value: ""
}
]
},
tableOpt: {
loading: false,
rowKey: "deviceId",
selection: false,
maxHeight: "45vh",
childs: [
{
style: "",
label: "用户昵称",
type: "",
prop: "nickName",
align: "left",
width: "",
"show-overflow-tooltip": false,
tempType: "span"
},
{
style: "",
label: "手机号码",
type: "",
prop: "phoneNumber",
align: "left",
width: "",
"show-overflow-tooltip": false,
tempType: "span"
},
{
style: "",
label: "邮箱",
type: "",
prop: "email",
align: "left",
width: "",
"show-overflow-tooltip": false,
tempType: "span"
},
{
style: "",
label: "创建时间",
type: "time",
prop: "createTime",
align: "center",
width: "180",
"show-overflow-tooltip": false,
tempType: "span"
}
],
tableList: {
type: Array
}
},
tableList: []
};
this.selectTableShow = true;
},
childGetList(data) {
listProjectNotUsed(Object.assign(data.page, data.param)).then(
response => {
this.tableSelectOption.tableList = response.rows;
this.tableSelectOption.queryOpt.page.total = Number(response.total);
}
);
},
returnEvent(data) {
if (data.type === "dblclick") {
this.form.userId = data.value.userId;
this.form.tenantId = data.value.tenantId;
this.submitForm();
} else if (data.type === "click") {
this.form.userId = data.value.userId;
this.form.tenantId = data.value.tenantId;
}
},
//
statusFormat(row, column) {
var rulesStr = "";
this.statusOptions.forEach(v => {
if (v.dictValue === row.status) {
rulesStr = v.dictLabel;
}
});
return rulesStr;
},
tenantTypeFormat(row, column) {
var rulesStr = "";
this.tenantTypeOptions.forEach(v => {
if (v.dictValue === row.status) {
rulesStr = v.dictLabel;
}
});
return rulesStr;
},
/** 查询项目用户关系列表 */
getList() {
this.loading = true;
this.queryParams.projectId = this.projectId;
listProjectUser(this.queryParams).then(response => {
this.project_tenantList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
projectId: this.projectId,
userId: null,
tenantId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.handleDetails();
},
/** 提交按钮 */
submitForm() {
addProjectUser(this.form).then(response => {
this.msgSuccess("新增成功");
this.selectTableShow = false;
this.getList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const projectIds = this.projectId;
const userId = row.userId;
this.$confirm("是否确认解除当前人员?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(function() {
return delProjectUser(projectIds, userId);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有项目用户关系数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(function() {
return exportProjectUser(queryParams);
})
.then(response => {
this.download(response.msg);
});
}
}
};
</script>

View File

@ -165,105 +165,8 @@
</div>
</el-col>
</el-row>
<!-- <div class="info-left">
<el-descriptions class="margin-top" title="" :column="2">
<el-descriptions-item label="行业类型:">{{
statusFormat(infoData)
}}</el-descriptions-item>
<el-descriptions-item label="联系人1">
{{ infoData["contacts1"] || "--" }}
</el-descriptions-item>
<el-descriptions-item label="联系人2">
{{ infoData["contacts2"] || "--" }}
</el-descriptions-item>
<el-descriptions-item label="联系人3">
{{ infoData["contacts3"] || "--" }}
</el-descriptions-item>
<el-descriptions-item label="项目地址:">
<div class="e-descriptions-address">
<span class="e-address-span" :title="infoData.projectAddress">
{{ infoData.projectAddress }}
</span>
<i
class="el-icon-map-location e-i-custom"
@click="mapClick"
></i>
<el-popover
placement="bottom"
title="项目地址坐标"
width="1080"
trigger="manual"
v-model="visible"
style="top: 30px; left: -85%; position: relative"
>
<slot>
<el-row>
<el-col :span="10">
<span>经度{{ mapForm.lng }}</span>
</el-col>
<el-col :span="10">
<span>纬度{{ mapForm.lat }}</span>
</el-col>
</el-row>
<shop-location
v-if="visible === true"
style="height: 450px; margin-top: 10px"
:mapCenter="mapCenter"
:draggable="false"
@mapEvent="mapEvent"
:zoom="zoom"
/>
<div
style="
width: 100%;
height: 35px;
display: flex;
align-items: center;
justify-content: flex-end;
margin-top: 5px;
"
>
<el-button
type="primary"
size="mini"
@click="visible = false"
> </el-button
>
</div>
</slot>
</el-popover>
</div>
</el-descriptions-item>
</el-descriptions>
</div> -->
<!-- <div class="info-divider"></div>
<div class="info-right">
<div>
<e-census-cards
:propList="censusCardList"
:result="projectStatistics"
/>
</div>
</div> -->
</div>
<div class="container-main">
<!-- <e-nav-menu
v-model="activeType"
:activeList="activeList"
@eventShrink="
(data) => {
isShrink = data ? true : false;
}
"
@input="
(data) => {
activeName = data['template'];
activeType = data['key'];
}
"
/> -->
<div
class="main-block"
:style="isShrink ? 'width: 100%;' : 'width: calc(100% - 150px);'"