1261 lines
38 KiB
Vue
1261 lines
38 KiB
Vue
<template>
|
||
<div class="fullHeight">
|
||
<div class="searchBox whiteBlock">
|
||
<el-form :inline="true" size="medium">
|
||
<!-- <el-form-item>
|
||
<el-input
|
||
v-model="queryInfo.name"
|
||
:placeholder="$t('message.personnelAccess.id')"
|
||
></el-input
|
||
></el-form-item>
|
||
<el-form-item>
|
||
<el-input
|
||
v-model="queryInfo.name"
|
||
:placeholder="$t('message.personnelAccess.name')"
|
||
></el-input>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-select
|
||
v-model="queryInfo.alarmTypeId"
|
||
:placeholder="$t('message.personnelAccess.juese')"
|
||
>
|
||
<el-option
|
||
v-for="item in option"
|
||
:key="item.id"
|
||
:label="item.label"
|
||
:value="item.id"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item> -->
|
||
|
||
<el-form-item label="单位类型">
|
||
<!-- 筛选 -->
|
||
<el-select
|
||
v-model="screenStr"
|
||
class="screen"
|
||
placeholder="请选择"
|
||
clearable
|
||
>
|
||
<el-option
|
||
v-for="item in screen"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="姓名">
|
||
<!-- 请输入姓名 -->
|
||
<el-input
|
||
style="display: inline-block"
|
||
v-model="workerName"
|
||
:placeholder="
|
||
$t('message.projectInfo.placeholder') +
|
||
$t('message.projectInfo.name')
|
||
"
|
||
></el-input>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<!-- 查询-->
|
||
<el-button type="primary" plain @click="query">{{
|
||
$t("message.alarmWarning.query")
|
||
}}</el-button>
|
||
|
||
<!-- <el-button type="primary" info @click="filter">{{
|
||
$t("message.alarmWarning.query")
|
||
}}</el-button> -->
|
||
<!-- //刷新-->
|
||
<el-button type="warning" plain @click="refresh">{{
|
||
$t("message.alarmValueSet.refresh")
|
||
}}</el-button>
|
||
<!-- 新增-->
|
||
<el-button type="primary" @click="add">{{
|
||
$t("message.videoManage.add")
|
||
}}</el-button>
|
||
<!-- <el-dropdown class="screen" size="medium" @command="handleCommand">
|
||
<el-button type="success" plain>
|
||
{{$t("message.videoManage.screen")}}
|
||
</el-button>
|
||
<el-dropdown-menu slot="dropdown">
|
||
<el-dropdown-item v-for="(item) in screen" :key="item.id" :command="item.id">{{item.name}}</el-dropdown-item>
|
||
</el-dropdown-menu>
|
||
</el-dropdown> -->
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
<div class="table_wrap whiteBlock">
|
||
<!-- <vue-scroll style="height: calc(100% - 20px)"> -->
|
||
<el-table
|
||
class="tables"
|
||
style="height: calc(100% - 20px); max-height: calc(100% - 20px)"
|
||
:data="List"
|
||
>
|
||
<el-table-column
|
||
prop="account"
|
||
:label="$t('message.personnelAccess.Labid')"
|
||
></el-table-column>
|
||
<el-table-column prop="projectOrgName" label="组织名称">
|
||
<template slot-scope="scope">
|
||
<div>{{ scope.row.projectOrgName }}</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="workerName"
|
||
:label="$t('message.personnelAccess.Labname')"
|
||
align="center"
|
||
></el-table-column>
|
||
<el-table-column
|
||
prop="personMail"
|
||
label="邮箱"
|
||
align="center"
|
||
></el-table-column>
|
||
<el-table-column
|
||
prop="roleName"
|
||
:label="$t('message.personnelAccess.Labjuese')"
|
||
align="center"
|
||
>
|
||
</el-table-column>
|
||
<el-table-column
|
||
width="600px"
|
||
:label="$t('message.alarmValueSet.operation')"
|
||
align="center"
|
||
>
|
||
<template slot-scope="scope">
|
||
<div class="tableBtns">
|
||
<!-- <el-button
|
||
size="mini"
|
||
type="primary"
|
||
class="operationText"
|
||
@click="configFn(scope.row)"
|
||
>
|
||
配置企业
|
||
{{ $t("message.projectInfo.configCompany") }}
|
||
</el-button> -->
|
||
<el-button
|
||
size="mini"
|
||
type="primary"
|
||
class="operationText"
|
||
@click="configTreeFn(scope.row)"
|
||
>
|
||
<!-- 配置企业 -->
|
||
{{ $t("message.projectInfo.configCompany") }}
|
||
</el-button>
|
||
<el-button
|
||
size="mini"
|
||
type="warning"
|
||
class="operationText"
|
||
@click="configFn2(scope.row, 1)"
|
||
>
|
||
<!-- 配置闸机 -->
|
||
{{ $t("message.projectInfo.configGate") }}
|
||
</el-button>
|
||
<el-button
|
||
size="mini"
|
||
type="success"
|
||
class="operationText"
|
||
@click="configFn2(scope.row, 2)"
|
||
>
|
||
<!-- 配置视频 -->
|
||
{{ $t("message.projectInfo.configVideo") }}
|
||
</el-button>
|
||
<div @click="edit(scope.row)" class="operationText">
|
||
<img
|
||
src="@/assets/images/icon-edit.png"
|
||
width="15px"
|
||
height="15px"
|
||
/>
|
||
<span>{{ $t("message.alarmValueSet.edit") }}</span>
|
||
</div>
|
||
<div @click="deleteDev(scope.row)" class="operationText">
|
||
<img
|
||
src="@/assets/images/icon-delete.png"
|
||
width="15px"
|
||
height="15px"
|
||
/>
|
||
<span>{{ $t("message.alarmValueSet.delete") }}</span>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<!-- </vue-scroll> -->
|
||
<!-- <el-pagination
|
||
class="pagerBox"
|
||
@size-change="SizeChange"
|
||
@current-change="CurrentChange"
|
||
:current-page="pagInfo.pageNo"
|
||
:page-sizes="$store.state.PAGESIZRS"
|
||
:page-size="pagInfo.pageSize"
|
||
layout="total, sizes, prev, pager, next"
|
||
:total="pagInfo.total"
|
||
background
|
||
></el-pagination> -->
|
||
</div>
|
||
<el-dialog
|
||
:modal-append-to-body="false"
|
||
@close="close"
|
||
:title="$t('message.roleManage.Popup_title')[Popup.type]"
|
||
:visible.sync="Popup.show"
|
||
width="667px"
|
||
>
|
||
<div class="dialog_content">
|
||
<el-form
|
||
v-if="Popup.type === 'add' || Popup.type === 'edit'"
|
||
size="medium"
|
||
:model="addEditForm"
|
||
ref="addEditForm"
|
||
label-width="120px"
|
||
class="dialogFormBox"
|
||
:rules="formRules"
|
||
>
|
||
<el-form-item
|
||
:label="$t('message.personnelAccess.Labid')"
|
||
prop="account"
|
||
>
|
||
<el-input
|
||
v-model="addEditForm.account"
|
||
:placeholder="$t('message.personnelAccess.id')"
|
||
></el-input>
|
||
</el-form-item>
|
||
<el-form-item
|
||
style="margin-bottom: 30px"
|
||
:label="$t('message.personnelAccess.LabPwd')"
|
||
prop="password"
|
||
v-if="!addEditForm.showPassword && addEditForm.showPassword != ''"
|
||
>
|
||
<el-input
|
||
type="password"
|
||
show-password
|
||
v-model="addEditForm.password"
|
||
:placeholder="$t('message.personnelAccess.pwd')"
|
||
></el-input>
|
||
</el-form-item>
|
||
<el-form-item
|
||
style="margin-bottom: 30px"
|
||
:label="$t('message.personnelAccess.LabPwd')"
|
||
prop="showPassword"
|
||
v-else
|
||
><!--必填-->
|
||
<el-input
|
||
type="password"
|
||
show-password
|
||
v-model="addEditForm.showPassword"
|
||
:placeholder="$t('message.companyDiagram.PleaseEnter')"
|
||
></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="选择组织" prop="xzProjectOrgId">
|
||
<el-select v-model="selectVal" placeholder="请选择">
|
||
<el-option style="height: auto" :value="[]">
|
||
<el-tree
|
||
:data="treeList"
|
||
node-key="id"
|
||
ref="groupTree"
|
||
highlight-current
|
||
:default-expanded-keys="defaultExpandArr"
|
||
:props="defaultProps"
|
||
:default-expand-all="false"
|
||
@node-click="treeClick"
|
||
>
|
||
</el-tree>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item
|
||
:label="$t('message.personnelAccess.Labjuese')"
|
||
prop="roleId"
|
||
>
|
||
<el-select
|
||
v-model="addEditForm.roleId"
|
||
filterable
|
||
:placeholder="$t('message.personnelAccess.juese')"
|
||
>
|
||
<el-option
|
||
v-for="item in roleList"
|
||
:key="item.roleId"
|
||
:label="item.roleName"
|
||
:value="item.roleId"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item
|
||
:label="$t('message.personnelAccess.Labname')"
|
||
prop="workerId"
|
||
>
|
||
<el-select
|
||
v-model="addEditForm.workerId"
|
||
filterable
|
||
:placeholder="$t('message.projectInfo.pleaseChoosePeople')"
|
||
@change="workerSelect"
|
||
>
|
||
<el-option
|
||
v-for="item in personList"
|
||
:key="item.id"
|
||
:label="item.workerName"
|
||
:value="item.id"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- 邮箱 -->
|
||
<el-form-item label="邮箱" prop="personMail">
|
||
<el-input disabled v-model="addEditForm.personMail"></el-input>
|
||
</el-form-item>
|
||
<!-- 外部登录标识 -->
|
||
<el-form-item
|
||
:label="$t('message.projectInfo.externalAccount')"
|
||
prop="externalAccount"
|
||
>
|
||
<el-input
|
||
v-model="addEditForm.externalAccount"
|
||
:placeholder="$t('message.projectInfo.placeholder')"
|
||
></el-input>
|
||
</el-form-item>
|
||
<div class="dialog-footer">
|
||
<el-button
|
||
class="cancleBtn"
|
||
@click="Popup.show = false"
|
||
icon="el-icon-circle-close"
|
||
size="medium"
|
||
>{{ $t("message.alarmValueSet.cancel") }}
|
||
</el-button>
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-circle-check"
|
||
@click="submit"
|
||
size="medium"
|
||
>{{ $t("message.alarmValueSet.save") }}
|
||
</el-button>
|
||
</div>
|
||
</el-form>
|
||
</div>
|
||
</el-dialog>
|
||
<!-- 选择可查看的企业 -->
|
||
<!-- 树形选择版 -->
|
||
<el-dialog
|
||
:title="$t('message.projectInfo.chooseCanLookCompany')"
|
||
:modal-append-to-body="false"
|
||
kbox__label
|
||
:visible.sync="companyDialog"
|
||
width="667px"
|
||
>
|
||
<div class="dialog_tree_content">
|
||
<vue-scroll style="height: 500px; width: 600px">
|
||
<div class="selectAll-title">
|
||
<el-checkbox
|
||
:indeterminate="isIndeterminate"
|
||
v-model="checkAll"
|
||
@change="handleTreeCheckAllChange"
|
||
>
|
||
<!-- {{ $t("message.projectInfo.allChoose") }} -->
|
||
</el-checkbox>
|
||
<span>{{ $t("message.projectInfo.allChoose") }}</span>
|
||
</div>
|
||
<div style="margin: 15px 0"></div>
|
||
<el-tree
|
||
ref="treeRef"
|
||
:default-expand-all="false"
|
||
:data="treeDatas"
|
||
show-checkbox
|
||
node-key="id"
|
||
:props="defaultTreeProps"
|
||
@check-change="testCheckChange"
|
||
>
|
||
</el-tree>
|
||
</vue-scroll>
|
||
<div class="dialog-footer">
|
||
<el-button
|
||
class="cancleBtn"
|
||
@click="companyDialog = false"
|
||
icon="el-icon-circle-close"
|
||
size="medium"
|
||
>{{ $t("message.alarmValueSet.cancel") }}
|
||
</el-button>
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-circle-check"
|
||
@click="saveTreeCompanyFn"
|
||
size="medium"
|
||
>{{ $t("message.alarmValueSet.save") }}
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
</el-dialog>
|
||
<!-- 按钮组版 -->
|
||
<!-- <el-dialog
|
||
:title="$t('message.projectInfo.chooseCanLookCompany')"
|
||
:modal-append-to-body="false"
|
||
kbox__label
|
||
:visible.sync="companyDialog"
|
||
width="667px"
|
||
>
|
||
<div class="dialog_content">
|
||
<vue-scroll style="height: 500px; width: 600px">
|
||
<el-checkbox
|
||
:indeterminate="isIndeterminate"
|
||
v-model="checkAll"
|
||
@change="handleCheckAllChange"
|
||
>
|
||
全选
|
||
{{ $t("message.projectInfo.allChoose") }}
|
||
</el-checkbox>
|
||
<div style="margin: 15px 0"></div>
|
||
<el-checkbox-group
|
||
v-model="selectCompanyData"
|
||
@change="handleCheckedCompanyChange"
|
||
>
|
||
<el-checkbox
|
||
class="el-checkbox-widthOne"
|
||
v-for="city in enterpriseListData"
|
||
:label="city.id + ''"
|
||
:key="city.id"
|
||
:title="city.enterpriseName"
|
||
>{{ city.enterpriseName }}</el-checkbox
|
||
>
|
||
</el-checkbox-group>
|
||
</vue-scroll>
|
||
<div class="dialog-footer">
|
||
<el-button
|
||
class="cancleBtn"
|
||
@click="companyDialog = false"
|
||
icon="el-icon-circle-close"
|
||
size="medium"
|
||
>{{ $t("message.alarmValueSet.cancel") }}
|
||
</el-button>
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-circle-check"
|
||
@click="saveCompanyFn"
|
||
size="medium"
|
||
>{{ $t("message.alarmValueSet.save") }}
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
</el-dialog> -->
|
||
<!-- 选择可查看的视频 -->
|
||
<el-dialog
|
||
:modal-append-to-body="false"
|
||
:title="
|
||
configDevType == 2
|
||
? $t('message.projectInfo.chooseCanLookVideo')
|
||
: $t('message.projectInfo.configCanManageDev')
|
||
"
|
||
:visible.sync="configDevDialog"
|
||
width="667px"
|
||
>
|
||
<div class="dialog_content">
|
||
<vue-scroll style="height: 500px; width: 600px">
|
||
<el-checkbox
|
||
:indeterminate="isIndeterminate"
|
||
v-model="checkAll"
|
||
@change="handleCheckAllChange"
|
||
>
|
||
<!-- 全选 -->
|
||
{{ $t("message.projectInfo.allChoose") }}
|
||
</el-checkbox>
|
||
<div style="margin: 15px 0"></div>
|
||
<div v-if="configDevType == 2">
|
||
<el-checkbox-group
|
||
v-model="selectCompanyData"
|
||
@change="handleCheckedCompanyChange"
|
||
>
|
||
<el-checkbox
|
||
class="el-checkbox-widthOne"
|
||
v-for="city in allVideoDev"
|
||
:label="city.itemId + ''"
|
||
:key="city.itemId"
|
||
:title="city.videoName"
|
||
>{{ city.videoName }}</el-checkbox
|
||
>
|
||
</el-checkbox-group>
|
||
</div>
|
||
<div v-else>
|
||
<el-checkbox-group
|
||
v-model="selectCompanyData"
|
||
@change="handleCheckedCompanyChange"
|
||
>
|
||
<el-checkbox
|
||
class="el-checkbox-widthOne"
|
||
v-for="city in allUfaceDev"
|
||
:label="city.id + ''"
|
||
:key="city.id"
|
||
:title="city.devName"
|
||
>{{ city.devName }}</el-checkbox
|
||
>
|
||
</el-checkbox-group>
|
||
</div>
|
||
</vue-scroll>
|
||
|
||
<div class="dialog-footer">
|
||
<el-button
|
||
class="cancleBtn"
|
||
@click="configDevDialog = false"
|
||
icon="el-icon-circle-close"
|
||
size="medium"
|
||
>{{ $t("message.alarmValueSet.cancel") }}
|
||
</el-button>
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-circle-check"
|
||
@click="saveDevConfigDataFn"
|
||
size="medium"
|
||
>{{ $t("message.alarmValueSet.save") }}
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
<script>
|
||
import {
|
||
addProjectUserApi,
|
||
editProjectUserApi,
|
||
getProjectChilderSystemUserListApi,
|
||
getLaborManagementInfoListApi,
|
||
getBaseRoleListApi,
|
||
selectUserEnterpriseByUserIdApi,
|
||
addOrEditUserEnterpriseApi,
|
||
selectUserDevAuthorityByUserIdApi,
|
||
addOrEditUserDevAuthorityApi,
|
||
selecAllVideoListApi,
|
||
getTreeGroupApi,
|
||
} from "@/assets/js/api/configManage";
|
||
import {
|
||
getEnterpriseInfoList,
|
||
ufaceDevList,
|
||
selectHierarchyEnterpriseListApi,
|
||
} from "@/assets/js/api/laborPerson";
|
||
import { deleteSystemUserApi } from "@/assets/js/api/account";
|
||
export default {
|
||
created() {
|
||
this.getRoleList();
|
||
this.getMachineList();
|
||
this.getAllVideo();
|
||
this.loadPersonList();
|
||
this.getList();
|
||
this.getProjectList();
|
||
this.getTreeList();
|
||
this.getTreeEnterpriseList();
|
||
},
|
||
data() {
|
||
return {
|
||
treeDatas: [],
|
||
groupName: "",
|
||
defaultExpandArr: [],
|
||
// 树形对应的字段
|
||
defaultTreeProps: {
|
||
children: "children",
|
||
label: "enterpriseName",
|
||
},
|
||
// 对应的字段
|
||
defaultProps: {
|
||
children: "children",
|
||
label: "deptName",
|
||
},
|
||
treeList: [],
|
||
selectVal: "",
|
||
selectTreeData: {},
|
||
workerName: "",
|
||
addEditForm: {
|
||
account: "",
|
||
password: "",
|
||
xzProjectOrgId: "",
|
||
roleId: "",
|
||
userId: "",
|
||
externalAccount: "",
|
||
},
|
||
screen: [
|
||
// {id:0,name:" "},
|
||
{ id: 1, name: "专业分包" },
|
||
{ id: 2, name: "设备分包" },
|
||
{ id: 3, name: "材料分包" },
|
||
{ id: 4, name: "后勤服务" },
|
||
{ id: 5, name: "特殊设备" },
|
||
{ id: 6, name: "劳务分包" },
|
||
{ id: 7, name: "监理单位" },
|
||
{ id: 8, name: "建设单位" },
|
||
{ id: 9, name: "总承包单位" },
|
||
{ id: 10, name: "勘查单位" },
|
||
{ id: 11, name: "设计单位" },
|
||
{ id: 12, name: "其他" },
|
||
],
|
||
screenStr: "",
|
||
formRules: {
|
||
account: [
|
||
{
|
||
required: true,
|
||
message: this.$t("message.personnelPosition.required"),
|
||
trigger: "blur",
|
||
},
|
||
],
|
||
password: [
|
||
{
|
||
required: true,
|
||
message: this.$t("message.personnelPosition.required"),
|
||
trigger: "blur",
|
||
},
|
||
{
|
||
pattern:
|
||
/^(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+~`\-={}[\]:";'<>?,./])[a-zA-Z\d!@#$%^&*()_+~`\-={}[\]:";'<>?,./]{8,}$/,
|
||
message:
|
||
"密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数",
|
||
trigger: "blur",
|
||
},
|
||
],
|
||
showPassword: [
|
||
{
|
||
required: true,
|
||
message: this.$t("message.personnelPosition.required"),
|
||
trigger: "blur",
|
||
},
|
||
{
|
||
pattern:
|
||
/^(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+~`\-={}[\]:";'<>?,./])[a-zA-Z\d!@#$%^&*()_+~`\-={}[\]:";'<>?,./]{8,}$/,
|
||
message:
|
||
"密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数",
|
||
trigger: "blur",
|
||
},
|
||
],
|
||
xzProjectOrgId: [
|
||
{
|
||
required: true,
|
||
message: "请选择",
|
||
trigger: "blur",
|
||
},
|
||
],
|
||
userId: [
|
||
{
|
||
required: true,
|
||
message: this.$t("message.personnelPosition.required"),
|
||
trigger: "change",
|
||
},
|
||
],
|
||
roleId: [
|
||
{
|
||
required: true,
|
||
message: this.$t("message.personnelPosition.required"),
|
||
trigger: "change",
|
||
},
|
||
],
|
||
workerId: [
|
||
{
|
||
required: true,
|
||
message: this.$t("message.personnelPosition.required"),
|
||
trigger: "blur",
|
||
},
|
||
],
|
||
},
|
||
List: [],
|
||
Popup: {
|
||
type: "add",
|
||
show: false,
|
||
},
|
||
queryInfo: {},
|
||
pagInfo: {
|
||
pageNo: 1, //页数
|
||
pageSize: 10, //条数
|
||
total: 0, //总条数
|
||
},
|
||
personList: [],
|
||
roleList: [],
|
||
enterpriseListData: [],
|
||
selectCompanyData: [],
|
||
companyDialog: false,
|
||
checkAll: false,
|
||
isIndeterminate: false,
|
||
editComapnyDataId: "",
|
||
//配置可查看或管理的设备相关参数
|
||
allUfaceDev: [],
|
||
allVideoDev: [],
|
||
configDevDialog: false,
|
||
configDevType: 1, //1人脸设备,2视频监控
|
||
};
|
||
},
|
||
methods: {
|
||
// getItemByIdInTree(value,path=""){
|
||
// for(var i=0;i<this.treeList.length;i++){
|
||
// let tempPath = path
|
||
// tempPath = `${tempPath ? tempPath + '/' : tempPath}${this.treeList[i].name}` // 避免出现在最前面的/
|
||
// if(this.treeList[i].id == value){
|
||
// return tempPath
|
||
// } else if(this.treeList[i].children){
|
||
// let reuslt = this.getItemByIdInTree(this.treeList[i].children,value,tempPath)
|
||
// if(reuslt){
|
||
// return reuslt
|
||
// }
|
||
// }
|
||
// }
|
||
// },
|
||
// groupNameFilter(val){
|
||
// console.log(val)
|
||
// this.treeList.map(item => {
|
||
// this.filterNameFunc(val,item)
|
||
// })
|
||
// // let name = this.filterNameFunc(val,this.treeList);
|
||
// // if(name){
|
||
// // return name;
|
||
// // } else {
|
||
// // return "";
|
||
// // }
|
||
// return this.groupName;
|
||
// },
|
||
// filterNameFunc(val,obj){
|
||
// console.log(val,obj,666777888)
|
||
// if (obj.children && obj.children.length > 0) {
|
||
// this.groupName = this.groupName + '-' + obj.deptName
|
||
// obj.children.map((item) => {
|
||
// this.filterNameFunc(val,obj.children);
|
||
// });
|
||
// } else {
|
||
// if(obj.id == val){
|
||
// this.groupName = this.groupName + obj.deptName
|
||
// }
|
||
// }
|
||
// },
|
||
handleTreeCheckAllChange(val) {
|
||
this.isIndeterminate = false;
|
||
if (this.checkAll == true) {
|
||
for (let i = 0; i < this.treeDatas.length; i++) {
|
||
this.$refs.treeRef.setChecked(this.treeDatas[i].id, true, true);
|
||
}
|
||
} else {
|
||
this.$refs.treeRef.setCheckedKeys([]);
|
||
}
|
||
},
|
||
// 获取当前选中的节点
|
||
testCheckChange() {
|
||
const tree = this.$refs.treeRef;
|
||
let checkedCount = 0;
|
||
let disabledCount = 0;
|
||
let indeterminateFlag = false;
|
||
for (let i = 0; i < this.treeDatas.length; i++) {
|
||
if (tree.getNode(this.treeDatas[i]).disabled == true) {
|
||
disabledCount += 1; // 如果有置灰的节点,置灰变量加1
|
||
}
|
||
if (tree.getNode(this.treeDatas[i]).checked == true) {
|
||
checkedCount += 1; // 如果有勾选的节点,勾选变量加1
|
||
}
|
||
if (tree.getNode(this.treeDatas[i]).indeterminate == true) {
|
||
indeterminateFlag = true; // 如果有半选的节点,半选变量设为true
|
||
}
|
||
}
|
||
if (checkedCount == 0) {
|
||
this.isIndeterminate = false;
|
||
this.checkAll = false; // 如果勾选的一级节点数为0,则设置全选按钮样式不为半选样式,全选的值为false
|
||
if (indeterminateFlag == true) {
|
||
this.isIndeterminate = true;
|
||
this.checkAll = false;
|
||
}
|
||
} else if (checkedCount + disabledCount == this.treeDatas.length) {
|
||
this.isIndeterminate = false;
|
||
this.checkAll = true;
|
||
} else {
|
||
this.isIndeterminate = true;
|
||
this.checkAll = false;
|
||
}
|
||
return;
|
||
},
|
||
getTreeEnterpriseList() {
|
||
selectHierarchyEnterpriseListApi({
|
||
projectSn: this.$store.state.projectSn,
|
||
}).then((result) => {
|
||
if (result.success) {
|
||
this.treeDatas = result.result;
|
||
}
|
||
});
|
||
},
|
||
workerSelect() {
|
||
let findItem = this.personList.find((item) => {
|
||
return item.id == this.addEditForm.workerId;
|
||
});
|
||
if (findItem) {
|
||
this.addEditForm.personMail = findItem.personMail;
|
||
} else {
|
||
this.addEditForm.personMail = "";
|
||
}
|
||
},
|
||
getTreeList() {
|
||
getTreeGroupApi({
|
||
projectSn: this.$store.state.projectSn,
|
||
}).then((result) => {
|
||
if (result.success) {
|
||
this.treeList = result.result;
|
||
}
|
||
});
|
||
},
|
||
// 树形控件点击
|
||
treeClick(data) {
|
||
console.log(data);
|
||
if (data.status == 1) {
|
||
this.$message.warning("无法选中已禁用组织");
|
||
} else {
|
||
this.selectVal = data.deptName;
|
||
this.selectTreeData = data;
|
||
this.addEditForm.xzProjectOrgId = data.id;
|
||
// this.$refs.addEditForm.validateField("xzProjectOrgId")
|
||
}
|
||
},
|
||
// 配置树形配置
|
||
configTreeFn(item) {
|
||
this.companyDialog = true;
|
||
this.addEditForm = JSON.parse(JSON.stringify(item));
|
||
selectUserEnterpriseByUserIdApi({ userId: item.userId }).then((res) => {
|
||
let arr = [];
|
||
if (res.result) {
|
||
let id = res.result.enterpriseId;
|
||
for (let i = 0; i < id.split(",").length; i++) {
|
||
arr.push(id.split(",")[i]);
|
||
}
|
||
console.log(arr, 777888);
|
||
this.$nextTick(() => {
|
||
this.$refs.treeRef.setCheckedKeys([]);
|
||
arr.map((item) => {
|
||
this.$refs.treeRef.setChecked(this.findNodeById(item),true);
|
||
});
|
||
});
|
||
}
|
||
});
|
||
},
|
||
findNodeById(id) {
|
||
function findNode(nodes, id) {
|
||
for(let i = 0;i<nodes.length;i++){
|
||
if (nodes[i].id === id) {
|
||
return { node: nodes[i], hasChildren: !!nodes[i].children && nodes[i].children.length > 0 };
|
||
}
|
||
if (nodes[i].children && nodes[i].children.length > 0) {
|
||
const found = findNode(nodes[i].children, id);
|
||
if (found) return found;
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
const result = findNode(this.treeDatas, id);
|
||
if (!result.hasChildren) {
|
||
return id;
|
||
} else {
|
||
return ""
|
||
}
|
||
},
|
||
// configFn(item) {
|
||
// this.companyDialog = true;
|
||
// this.addEditForm = JSON.parse(JSON.stringify(item));
|
||
// selectUserEnterpriseByUserIdApi({ userId: item.userId }).then((res) => {
|
||
// if (res.result) {
|
||
// let id = res.result.enterpriseId;
|
||
// console.log(id);
|
||
// this.editComapnyDataId = res.result.id;
|
||
// if (id.indexOf(",") != -1) {
|
||
// let arr = [];
|
||
// this.enterpriseListData.forEach((item) => {
|
||
// for (let i = 0; i < id.split(",").length; i++) {
|
||
// if (item.id == id.split(",")[i]) {
|
||
// arr.push(id.split(",")[i]);
|
||
// }
|
||
// }
|
||
// });
|
||
// this.selectCompanyData = arr;
|
||
// } else {
|
||
// this.selectCompanyData = [id];
|
||
// }
|
||
// } else {
|
||
// this.selectCompanyData = [];
|
||
// this.editComapnyDataId = "";
|
||
// }
|
||
// this.$nextTick(() => {
|
||
// this.handleCheckedCompanyChange();
|
||
// });
|
||
// });
|
||
// },
|
||
configFn2(item, devType) {
|
||
this.configDevDialog = true;
|
||
this.configDevType = devType;
|
||
this.addEditForm = JSON.parse(JSON.stringify(item));
|
||
selectUserDevAuthorityByUserIdApi({
|
||
userId: item.userId,
|
||
devType: devType,
|
||
}).then((res) => {
|
||
if (res.result) {
|
||
let id = res.result.devId;
|
||
console.log(res.result.devId);
|
||
this.editComapnyDataId = res.result.id;
|
||
if (id.indexOf(",") != -1) {
|
||
let arr = [];
|
||
console.log(this.allUfaceDev, this.allVideoDev);
|
||
if (this.configDevType == 1) {
|
||
this.allUfaceDev.forEach((item) => {
|
||
for (let i = 0; i < id.split(",").length; i++) {
|
||
if (item.id == id.split(",")[i]) {
|
||
arr.push(id.split(",")[i]);
|
||
}
|
||
}
|
||
});
|
||
} else {
|
||
this.allVideoDev.forEach((item) => {
|
||
for (let i = 0; i < id.split(",").length; i++) {
|
||
if (item.itemId == id.split(",")[i]) {
|
||
arr.push(id.split(",")[i]);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
console.log(arr, id);
|
||
this.selectCompanyData = arr;
|
||
// this.selectCompanyData = id.split(",");
|
||
} else {
|
||
this.selectCompanyData = [id];
|
||
}
|
||
} else {
|
||
this.selectCompanyData = [];
|
||
this.editComapnyDataId = "";
|
||
}
|
||
this.$nextTick(() => {
|
||
this.handleCheckedCompanyChange();
|
||
});
|
||
});
|
||
},
|
||
handleCheckAllChange(val) {
|
||
let arr = [];
|
||
if (this.companyDialog) {
|
||
arr = this.enterpriseListData.map((item) => String(item.id));
|
||
} else {
|
||
if (this.configDevType == 1) {
|
||
arr = this.allUfaceDev.map((item) => String(item.id));
|
||
} else {
|
||
arr = this.allVideoDev.map((item) => String(item.itemId));
|
||
}
|
||
}
|
||
this.selectCompanyData = val ? arr : [];
|
||
this.isIndeterminate = false;
|
||
},
|
||
handleCheckedCompanyChange(value) {
|
||
// console.log('handleCheckedCompanyChange')
|
||
var arr = [];
|
||
if (this.companyDialog) {
|
||
arr = this.enterpriseListData;
|
||
} else {
|
||
if (this.configDevType == 1) {
|
||
arr = this.allUfaceDev;
|
||
} else {
|
||
arr = this.allVideoDev;
|
||
}
|
||
}
|
||
// console.log(arr)
|
||
//
|
||
let checkedCount = this.selectCompanyData.length;
|
||
console.log(this.selectCompanyData);
|
||
this.checkAll = checkedCount === arr.length;
|
||
console.log((this.checkAll = checkedCount === arr.length));
|
||
console.log(checkedCount, checkedCount, arr.length);
|
||
this.isIndeterminate = checkedCount > 0 && checkedCount < arr.length;
|
||
},
|
||
// saveCompanyFn() {
|
||
// let ids = "";
|
||
// if (this.selectCompanyData.length > 0) {
|
||
// ids = this.selectCompanyData.join(",");
|
||
// }
|
||
// addOrEditUserEnterpriseApi({
|
||
// enterpriseId: ids,
|
||
// userId: this.addEditForm.userId,
|
||
// id: this.editComapnyDataId,
|
||
// }).then((result) => {
|
||
// this.companyDialog = false;
|
||
// });
|
||
// },
|
||
saveTreeCompanyFn() {
|
||
const checked = this.$refs.treeRef.getCheckedNodes();
|
||
const halfChecked = this.$refs.treeRef.getHalfCheckedNodes();
|
||
const concatArr = checked.concat(halfChecked);
|
||
let ids = [];
|
||
concatArr.map((item) => {
|
||
ids.push(item.id);
|
||
});
|
||
addOrEditUserEnterpriseApi({
|
||
enterpriseId: ids.join(","),
|
||
userId: this.addEditForm.userId,
|
||
id: this.editComapnyDataId,
|
||
}).then((result) => {
|
||
this.companyDialog = false;
|
||
});
|
||
},
|
||
saveDevConfigDataFn() {
|
||
let ids = "";
|
||
if (this.selectCompanyData.length > 0) {
|
||
ids = this.selectCompanyData.join(",");
|
||
}
|
||
addOrEditUserDevAuthorityApi({
|
||
devId: ids,
|
||
userId: this.addEditForm.userId,
|
||
id: this.editComapnyDataId,
|
||
devType: this.configDevType,
|
||
}).then((result) => {
|
||
this.configDevDialog = false;
|
||
});
|
||
},
|
||
//获取企业 || 劳务公司 列表
|
||
getProjectList() {
|
||
let data = {
|
||
projectSn: this.$store.state.projectSn,
|
||
// enterpriseName: this.enterpriseName,
|
||
};
|
||
getEnterpriseInfoList(data).then((res) => {
|
||
this.enterpriseListData = res.result;
|
||
// console.log(res.result);
|
||
});
|
||
},
|
||
//获取所有的闸机设备
|
||
getMachineList() {
|
||
ufaceDevList({ projectSn: this.$store.state.projectSn }).then((list) => {
|
||
this.allUfaceDev = list.result;
|
||
});
|
||
},
|
||
//获取所有视频设备
|
||
getAllVideo() {
|
||
selecAllVideoListApi({ projectSn: this.$store.state.projectSn }).then(
|
||
(result) => {
|
||
this.allVideoDev = result.result;
|
||
}
|
||
);
|
||
},
|
||
//获取所有角色
|
||
getRoleList() {
|
||
getBaseRoleListApi({ projectSn: this.$store.state.projectSn }).then(
|
||
(result) => {
|
||
this.roleList = result.result;
|
||
}
|
||
);
|
||
},
|
||
loadPersonList() {
|
||
getLaborManagementInfoListApi({
|
||
projectSn: this.$store.state.projectSn,
|
||
}).then((res) => {
|
||
this.personList = res.result;
|
||
});
|
||
},
|
||
handle(type, show) {
|
||
//打开弹窗前的统一处理
|
||
this.Popup = {
|
||
type: type,
|
||
show: show,
|
||
};
|
||
},
|
||
query() {
|
||
console.log("查询的参数", this.queryInfo);
|
||
this.getList();
|
||
},
|
||
filter() {
|
||
console.log(this.queryInfo.enterpriseTypeId);
|
||
getProjectChilderSystemUserListApi({
|
||
projectSn: this.$store.state.projectSn,
|
||
enterpriseTypeId: this.queryInfo.enterpriseTypeId,
|
||
}).then((res) => {
|
||
console.log("筛选参数" + res);
|
||
});
|
||
},
|
||
add() {
|
||
this.handle("add", true);
|
||
this.$nextTick(() => {
|
||
this.selectTreeData = {};
|
||
this.selectVal = "";
|
||
this.defaultExpandArr = [];
|
||
this.$refs.groupTree.setCurrentKey("");
|
||
});
|
||
},
|
||
edit(obj) {
|
||
console.log("编辑", obj);
|
||
this.addEditForm = JSON.parse(JSON.stringify(obj));
|
||
if (
|
||
typeof obj.alarmPushWorkerId === "string" &&
|
||
obj.alarmPushWorkerId != ""
|
||
) {
|
||
this.addEditForm.alarmPushWorkerId = obj.alarmPushWorkerId
|
||
.split(",")
|
||
.map(Number);
|
||
}
|
||
if (this.addEditForm.xzProjectOrgObj) {
|
||
this.selectTreeData = JSON.parse(this.addEditForm.xzProjectOrgObj);
|
||
this.selectVal = this.selectTreeData.deptName;
|
||
this.defaultExpandArr = [this.selectTreeData.id];
|
||
} else {
|
||
this.selectTreeData = {};
|
||
this.selectVal = "";
|
||
this.defaultExpandArr = [];
|
||
}
|
||
this.handle("edit", true);
|
||
this.$nextTick(() => {
|
||
if (this.addEditForm.xzProjectOrgObj) {
|
||
this.$refs.groupTree.setCurrentKey(this.addEditForm.xzProjectOrgId);
|
||
this.$refs.addEditForm.clearValidate();
|
||
}
|
||
});
|
||
},
|
||
deleteDev(obj) {
|
||
console.log("删除", obj);
|
||
this.$confirm(
|
||
this.$t("message.personnelPosition.beaconManage.table.confirmText") +
|
||
"【" +
|
||
obj.workerName +
|
||
"】?",
|
||
this.$t("message.personnelPosition.beaconManage.table.Tips"),
|
||
{
|
||
confirmButtonText: this.$t(
|
||
"message.personnelPosition.confirmButtonText"
|
||
),
|
||
cancelButtonText: this.$t(
|
||
"message.personnelPosition.cancelButtonText"
|
||
),
|
||
type: "warning",
|
||
}
|
||
)
|
||
.then(() => {
|
||
deleteSystemUserApi({ id: obj.userId }).then((result) => {
|
||
if (result.success) {
|
||
this.$message.success(result.message);
|
||
this.getList();
|
||
}
|
||
});
|
||
})
|
||
.catch(() => {});
|
||
},
|
||
submit() {
|
||
this.$refs["addEditForm"].validate((valid) => {
|
||
if (valid) {
|
||
let params = this.addEditForm;
|
||
// params.alarmPushWorkerId = this.addEditForm.alarmPushWorkerId.join(',');
|
||
params.sn = this.$store.state.projectSn;
|
||
if (this.selectVal) {
|
||
params.xzProjectOrgObj = JSON.stringify(this.selectTreeData);
|
||
}
|
||
if (this.Popup.type === "add") {
|
||
addProjectUserApi(params).then((result) => {
|
||
if (result.success) {
|
||
this.$message.success(result.message);
|
||
this.getList();
|
||
this.Popup.show = false;
|
||
}
|
||
});
|
||
} else if (this.Popup.type === "edit") {
|
||
console.log("编辑信息", this.addEditForm);
|
||
editProjectUserApi(params).then((result) => {
|
||
if (result.success) {
|
||
this.$message.success(result.message);
|
||
this.getList();
|
||
this.Popup.show = false;
|
||
}
|
||
});
|
||
}
|
||
} else {
|
||
console.log("error submit!!");
|
||
return false;
|
||
}
|
||
});
|
||
},
|
||
refresh() {
|
||
this.workerName = "";
|
||
this.screenStr = "";
|
||
this.getList();
|
||
},
|
||
getList() {
|
||
getProjectChilderSystemUserListApi({
|
||
projectSn: this.$store.state.projectSn,
|
||
enterpriseTypeId: this.screenStr,
|
||
workerName: this.workerName,
|
||
}).then((result) => {
|
||
if (result.success) {
|
||
this.List = result.result;
|
||
console.log("列表", result);
|
||
}
|
||
});
|
||
},
|
||
close() {
|
||
this.addEditForm = {};
|
||
this.$nextTick(() => {
|
||
this.$refs.addEditForm.clearValidate();
|
||
});
|
||
},
|
||
SizeChange(val) {
|
||
this.pagInfo.pageSize = val;
|
||
this.getList();
|
||
},
|
||
CurrentChange(val) {
|
||
this.pagInfo.pageNo = val;
|
||
this.getList();
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
<style lang="less" scoped>
|
||
.dialog_content {
|
||
width: 600px;
|
||
height: auto;
|
||
}
|
||
.dialog_tree_content {
|
||
width: 600px;
|
||
height: auto;
|
||
::v-deep .el-checkbox__input {
|
||
position: static;
|
||
}
|
||
.selectAll-title {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-left: 24px;
|
||
span {
|
||
margin-left: 10px;
|
||
}
|
||
}
|
||
}
|
||
.el-checkbox-group {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
overflow: auto;
|
||
}
|
||
.el-checkbox-widthOne {
|
||
width: 260px;
|
||
height: 50px;
|
||
white-space: pre-wrap;
|
||
}
|
||
.el-checkbox-width {
|
||
width: 250px;
|
||
white-space: pre-wrap;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.el-checkbox-widthTwo {
|
||
width: 260px;
|
||
height: 50px;
|
||
white-space: pre-wrap;
|
||
}
|
||
.searchBox > div {
|
||
margin-right: 15px;
|
||
}
|
||
|
||
.tableBtns {
|
||
display: flex;
|
||
justify-content: center;
|
||
}
|
||
|
||
.yj-dialogFormBox {
|
||
width: 462px;
|
||
}
|
||
::v-deep .el-checkbox__label {
|
||
width: 260px;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
padding-left: 22px;
|
||
line-height: 15px;
|
||
}
|
||
::v-deep .el-checkbox__input {
|
||
position: absolute;
|
||
}
|
||
/deep/.el-select-dropdown__item.hover,
|
||
.el-select-dropdown__item.hover,
|
||
.el-select-dropdown__item:hover {
|
||
background-color: transparent;
|
||
}
|
||
.screen {
|
||
margin-left: 10px;
|
||
}
|
||
</style>
|