忘记密码和修改商户列表

master
CJYXTX\27961 8 months ago
parent bc77460904
commit 2fbf0c94f6

@ -110,6 +110,7 @@ gateway:
- /api/permission/Organize
- /api/permission/Organize/POST
- /api/permission/Organize/check
- /api/permission/Users/Actions/ResetPasswordForget
exclude-url:
# # 配置示例

@ -25,6 +25,7 @@ import jnpf.permission.entity.*;
import jnpf.permission.model.user.UserIdListVo;
import jnpf.permission.model.user.WorkHandoverModel;
import jnpf.permission.model.user.form.UserCrForm;
import jnpf.permission.model.user.form.UserResetPasswordForgeForm;
import jnpf.permission.model.user.form.UserResetPasswordForm;
import jnpf.permission.model.user.form.UserUpForm;
import jnpf.permission.model.user.mod.*;
@ -721,6 +722,43 @@ public class UserController extends SuperController<UserService, UserEntity> {
return ActionResult.success("操作失败,用户不存在");
}
/**
*
*
* @param
* @param
* @return ignore
*/
@UserPermission
@Operation(summary = "首页修改用户密码")
@Parameters({
@Parameter(name = "userResetPasswordForm", description = "修改密码模型", required = true)
})
@SaCheckPermission("permission.user")
@PostMapping("/Actions/ResetPasswordForget")
public ActionResult<String> modifyPasswordForget( @RequestBody @Valid UserResetPasswordForgeForm userResetPasswordForgeForm) {
QueryWrapper<UserEntity> userEntityQueryWrapper = new QueryWrapper<>();
userEntityQueryWrapper.lambda().eq(UserEntity::getAccount,userResetPasswordForgeForm.getAccount());
// userEntityQueryWrapper.lambda().eq(UserEntity::getOrganizeId,userResetPasswordForgeForm.id);
// userEntityQueryWrapper.lambda().select(UserEntity::getId);
// List<String> useList = userService.listObjs(userEntityQueryWrapper).stream().map(o -> (String) o).collect(Collectors.toList());
List<UserEntity> userEntityList = userService.list(userEntityQueryWrapper);
if (userEntityList.size()>0){
UserEntity entity = userService.getInfo(userEntityList.get(0).getId());
if (entity != null) {
entity.setPassword(userResetPasswordForgeForm.getUserPassword());
userService.updatePassword(entity);
userService.delCurUser(entity.getId());
PullUserUtil.syncUser(entity, "modifyPassword", userProvider.get().getTenantId());
return ActionResult.success(MsgCode.SU005.get());
}
}
return ActionResult.success("操作失败,用户不存在");
}
/**
*
*

@ -0,0 +1,29 @@
package jnpf.permission.model.user.form;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
*
* @author JNPF
* @version V3.1.0
* @copyright
* @date 2021/3/12 15:31
*/
@Data
public class UserResetPasswordForgeForm {
@Schema(description = "用户id")
private String id;
@Schema(description = "新密码,需要 MD5 加密后传输")
private String account;
@Schema(description = "新密码,需要 MD5 加密后传输")
private String userPassword;
@Schema(description = "重复新密码")
private String validatePassword;
}

@ -330,26 +330,31 @@ public class EnterpriseAccountBillServiceImpl extends ServiceImpl<EnterpriseAcco
return countRecover;
}
/**
* ()
* @param id
* @param enterpriseAccountBillForm
* @return
*/
* ()
* @param id
* @param enterpriseAccountBillForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(EnterpriseAccountBillForm enterpriseAccountBillForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
enterpriseAccountBillForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(EnterpriseAccountBillConstant.getFormData(),enterpriseAccountBillForm),EnterpriseAccountBillForm.class);
generaterSwapUtil.swapDatetime(EnterpriseAccountBillConstant.getFormData(),enterpriseAccountBillForm),EnterpriseAccountBillForm.class);
EnterpriseAccountBillEntity entity = JsonUtil.getJsonToBean(enterpriseAccountBillForm, EnterpriseAccountBillEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setBillNumber(generaterSwapUtil.getBillNumber("QBGL", false));
entity.setId(mainId);
entity.setVersion(0);
}else{
entity.setBillNumber(generaterSwapUtil.getBillNumber("QBGL", false));
}
this.saveOrUpdate(entity);
}
}

@ -60,4 +60,7 @@ public class EnterpriseAccountBillEntity {
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_VERSION")
private Integer version;
}

@ -82,6 +82,15 @@ export const resetUserPassword = (data) => {
})
}
// 修改用户密码
export const resetUserPasswordForge = (data) => {
return request({
url: `/api/permission/Users/Actions/ResetPasswordForget`,
method: 'POST',
data
})
}
// 更新用户状态
export const updateUserState = (id) => {
return request({

File diff suppressed because one or more lines are too long

@ -5,85 +5,148 @@
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建':'编辑'" />
<el-page-header
@back="goBack"
:content="!dataForm.id ? '新建' : '编辑'"
/>
<div class="options">
<el-dropdown class="dropdown" placement="bottom">
<el-button style="width:70px">
<el-button style="width: 70px">
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<template v-if="dataForm.id">
<el-dropdown-item @click.native="prev" :disabled='prevDis'>
{{'上一条'}}
<el-dropdown-item @click.native="prev" :disabled="prevDis">
{{ "上一条" }}
</el-dropdown-item>
<el-dropdown-item @click.native="next" :disabled='nextDis'>
{{'下一条'}}
<el-dropdown-item @click.native="next" :disabled="nextDis">
{{ "下一条" }}
</el-dropdown-item>
</template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)"
:loading="continueBtnLoading" :disabled='btnLoading'>
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-dropdown-item>
<el-dropdown-item
type="primary"
@click.native="dataFormSubmit(2)"
:loading="continueBtnLoading"
:disabled="btnLoading"
>
{{
!dataForm.id ? "确定并新增" : "确定并继续"
}}</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"
:disabled='continueBtnLoading'> </el-button>
<el-button
type="primary"
@click="dataFormSubmit()"
:loading="btnLoading"
:disabled="continueBtnLoading"
>
</el-button
>
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right">
<el-row
:gutter="15"
class="main"
:style="{ margin: '0 auto', width: '100%' }"
>
<el-form
ref="formRef"
:model="dataForm"
:rules="dataRule"
size="small"
label-width="100px"
label-position="right"
>
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="8">
<jnpf-form-tip-item label="流水编号" prop="billNumber">
<JnpfInput v-model="dataForm.billNumber" @change="changeData('billNumber',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
<JnpfInput
v-model="dataForm.billNumber"
@change="changeData('billNumber', -1)"
placeholder="系统自动生成"
readonly
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="订单编号" prop="orderNumber">
<JnpfInput v-model="dataForm.orderNumber" @change="changeData('orderNumber',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
<JnpfInput
v-model="dataForm.orderNumber"
@change="changeData('orderNumber', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="订单类型" prop="orderTypeId">
<JnpfSelect v-model="dataForm.orderTypeId" @change="changeData('orderTypeId',-1)"
placeholder="请选择" clearable :style='{"width":"100%"}'
:options="orderTypeIdOptions" :props="orderTypeIdProps">
<JnpfSelect
v-model="dataForm.orderTypeId"
@change="changeData('orderTypeId', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="orderTypeIdOptions"
:props="orderTypeIdProps"
>
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="单据状态" prop="billStatusId">
<JnpfSelect v-model="dataForm.billStatusId" @change="changeData('billStatusId',-1)"
placeholder="请选择" clearable :style='{"width":"100%"}'
:options="billStatusIdOptions" :props="billStatusIdProps">
<JnpfSelect
v-model="dataForm.billStatusId"
@change="changeData('billStatusId', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="billStatusIdOptions"
:props="billStatusIdProps"
>
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="收入(元)" prop="incomeAmount">
<JnpfInput v-model="dataForm.incomeAmount" @change="changeData('incomeAmount',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
<JnpfInput
v-model="dataForm.incomeAmount"
@change="changeData('incomeAmount', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="支出(元)" prop="payoutAmount">
<JnpfInput v-model="dataForm.payoutAmount" @change="changeData('payoutAmount',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
<JnpfInput
v-model="dataForm.payoutAmount"
@change="changeData('payoutAmount', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="余额(元)" prop="accountBalance">
<JnpfInput v-model="dataForm.accountBalance"
@change="changeData('accountBalance',-1)" placeholder="请输入" clearable
:style='{"width":"100%"}'>
<JnpfInput
v-model="dataForm.accountBalance"
@change="changeData('accountBalance', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
@ -106,17 +169,29 @@
</el-col> -->
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remark">
<JnpfTextarea v-model="dataForm.remark" @change="changeData('remark',-1)"
placeholder="请输入" :style='{"width":"100%"}' true type="textarea"
:autosize='{"minRows":4,"maxRows":4}'>
<JnpfTextarea
v-model="dataForm.remark"
@change="changeData('remark', -1)"
placeholder="请输入"
:style="{ width: '100%' }"
true
type="textarea"
:autosize="{ minRows: 4, maxRows: 4 }"
>
</JnpfTextarea>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false" />
<SelectDialog
v-if="selectDialogVisible"
:config="currTableConf"
:formData="dataForm"
ref="selectDialog"
@select="addForSelect"
@close="selectDialogVisible = false"
/>
</el-row>
</div>
</transition>
@ -124,14 +199,20 @@
<script>
import request from '@/utils/request'
import request from "@/utils/request";
import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
import { getDataInterfaceRes } from "@/api/systemData/dataInterface";
import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import { getDefaultCurrentValueUserId } from "@/api/permission/user";
import { getDefaultCurrentValueDepartmentId } from "@/api/permission/organize";
import {
getDateDay,
getLaterData,
getBeforeData,
getBeforeTime,
getLaterTime,
} from "@/components/Generator/utils/index.js";
import { thousandsFormat } from "@/components/Generator/utils/index";
export default {
components: {},
props: [],
@ -146,20 +227,17 @@ export default {
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
formRef: "formRef",
setting: {},
eventType: '',
eventType: "",
userBoxVisible: false,
selectDialogVisible: false,
currTableConf: {},
dataValueAll: {},
addTableConf: {
},
addTableConf: {},
//
ableAll: {
},
tableRows: {
},
ableAll: {},
tableRows: {},
Vmodel: "",
currVmodel: "",
dataForm: {
@ -175,13 +253,11 @@ export default {
remark: undefined,
},
tableRequiredData: {},
dataRule:
{
},
dataRule: {},
orderTypeIdOptions: [],
orderTypeIdProps: { "label": "fullName", "value": "id" },
orderTypeIdProps: { label: "fullName", value: "id" },
billStatusIdOptions: [],
billStatusIdProps: { "label": "fullName", "value": "id" },
billStatusIdProps: { label: "fullName", value: "id" },
childIndex: -1,
isEdit: false,
interfaceRes: {
@ -196,60 +272,60 @@ export default {
creatorTime: [],
remark: [],
},
}
};
},
computed: {
...mapGetters(['userInfo'])
...mapGetters(["userInfo"]),
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
this.dataAll();
this.initDefaultData();
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
},
mounted() { },
mounted() {},
methods: {
prev() {
this.index--
this.index--;
if (this.index === 0) {
this.prevDis = true
this.prevDis = true;
}
this.nextDis = false
this.nextDis = false;
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
this.getInfo(element.id);
}
}
},
next() {
this.index++
this.index++;
if (this.index === this.allList.length - 1) {
this.nextDis = true
this.nextDis = true;
}
this.prevDis = false
this.prevDis = false;
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
this.getInfo(element.id);
}
}
},
getInfo(id) {
request({
url: '/api/scm/EnterpriseAccountBill/' + id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
url: "/api/scm/EnterpriseAccountBill/" + id,
method: "get",
}).then((res) => {
this.dataInfo(res.data);
});
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
this.visible = false;
this.$emit("refreshDataList", true);
},
changeData(model, index) {
this.isEdit = false
this.childIndex = index
this.isEdit = false;
this.childIndex = index;
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
@ -257,14 +333,14 @@ export default {
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
let faceReList = this.interfaceRes[key];
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
let options = "get" + key + "Options";
if (this[options]) {
this[options]()
this[options]();
}
this.changeData(key, index)
this.changeData(key, index);
}
}
}
@ -275,13 +351,13 @@ export default {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
this.dataForm[data][i][model] = defaultValue;
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
this.dataForm[data][i][model] = defaultValue;
}
}
} else {
this.dataForm[data] = defaultValue
this.dataForm[data] = defaultValue;
}
}
},
@ -290,202 +366,205 @@ export default {
this.getbillStatusIdOptions();
},
getorderTypeIdOptions() {
getDictionaryDataSelector('520193298627825989').then(res => {
this.orderTypeIdOptions = res.data.list
})
getDictionaryDataSelector("520193298627825989").then((res) => {
this.orderTypeIdOptions = res.data.list;
});
},
getbillStatusIdOptions() {
getDictionaryDataSelector('521683590119955205').then(res => {
this.billStatusIdOptions = res.data.list
})
getDictionaryDataSelector("521683590119955205").then((res) => {
this.billStatusIdOptions = res.data.list;
});
},
goBack() {
this.$emit('refresh')
this.$emit("refresh");
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
},
init(id, isDetail, allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
this.prevDis = false;
this.nextDis = false;
this.allList = allList || [];
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
this.index = this.allList.findIndex((item) => item.id === id);
if (this.index == 0) {
this.prevDis = true
this.prevDis = true;
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
this.nextDis = true;
}
} else {
this.prevDis = true
this.nextDis = true
this.prevDis = true;
this.nextDis = true;
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
this.loading = true;
request({
url: '/api/scm/EnterpriseAccountBill/' + this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
url: "/api/scm/EnterpriseAccountBill/" + this.dataForm.id,
method: "get",
}).then((res) => {
this.dataInfo(res.data);
this.loading = false;
});
} else {
this.clearData()
this.initDefaultData()
this.clearData();
this.initDefaultData();
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
this.$store.commit("generator/UPDATE_RELATION_DATA", {});
},
//
initDefaultData() {
},
initDefaultData() {},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate((valid) => {
this.dataFormSubmitType = type ? type : 0;
this.$refs["formRef"].validate((valid) => {
if (valid) {
this.request()
this.request();
}
})
});
},
request() {
let _data = this.dataList()
let _data = this.dataList();
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
this.continueBtnLoading = true;
} else {
this.btnLoading = true
this.btnLoading = true;
}
if (!this.dataForm.id) {
request({
url: '/api/scm/EnterpriseAccountBill',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData()
this.initDefaultData()
})
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
url: "/api/scm/EnterpriseAccountBill",
method: "post",
data: _data,
})
.then((res) => {
this.$message({
message: res.msg,
type: "success",
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData();
this.initDefaultData();
});
this.continueBtnLoading = false;
return;
}
this.visible = false;
this.btnLoading = false;
this.$emit("refresh", true);
},
});
})
.catch(() => {
this.btnLoading = false;
this.continueBtnLoading = false;
});
} else {
request({
url: '/api/scm/EnterpriseAccountBill/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
url: "/api/scm/EnterpriseAccountBill/" + this.dataForm.id,
method: "PUT",
data: _data,
})
.then((res) => {
this.$message({
message: res.msg,
type: "success",
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2)
return (this.continueBtnLoading = false);
this.visible = false;
this.btnLoading = false;
this.$emit("refresh", true);
},
});
})
.catch(() => {
this.btnLoading = false;
this.continueBtnLoading = false;
});
}
},
openSelectDialog(key) {
this.currTableConf = this.addTableConf[key]
this.currVmodel = key
this.selectDialogVisible = true
this.currTableConf = this.addTableConf[key];
this.currVmodel = key;
this.selectDialogVisible = true;
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
this.$refs.selectDialog.init();
});
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if (this['get' + this.currVmodel]) {
this['get' + this.currVmodel](t)
let t = data[i];
if (this["get" + this.currVmodel]) {
this["get" + this.currVmodel](t);
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
let timeValue = Number(timeValueData);
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
timeDataValue = timeValue;
} else if (timeType == 2) {
timeDataValue = dataValue
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
timeDataValue = new Date().getTime();
} else if (timeType == 4) {
let previousDate = '';
let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
previousDate = getBeforeData(timeValue);
timeDataValue = new Date(previousDate).getTime();
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime();
}
} else if (timeType == 5) {
let previousDate = '';
let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
previousDate = getLaterData(timeValue);
timeDataValue = new Date(previousDate).getTime();
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
timeDataValue = getLaterTime(timeTarget, timeValue).getTime();
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
let format = formatType == "HH:mm" ? "HH:mm:00" : formatType;
let timeDataValue = null;
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
timeDataValue = timeValue || "00:00:00";
if (timeDataValue.split(":").length == 3) {
timeDataValue = timeDataValue;
} else {
timeDataValue = timeDataValue + ':00'
timeDataValue = timeDataValue + ":00";
}
} else if (timeType == 2) {
timeDataValue = dataValue
timeDataValue = dataValue;
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
timeDataValue = this.jnpf.toDate(new Date(), format);
} else if (timeType == 4) {
let previousDate = '';
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
let previousDate = "";
previousDate = getBeforeTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format);
} else if (timeType == 5) {
let previousDate = '';
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
let previousDate = "";
previousDate = getLaterTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format);
}
}
return timeDataValue;
@ -495,13 +574,12 @@ export default {
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
this.childIndex = -1
let _dataAll = dataAll;
this.dataForm = _dataAll;
this.isEdit = true;
this.dataAll();
this.childIndex = -1;
},
},
}
};
</script>

@ -12,49 +12,85 @@
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="流水编号">
<el-input v-model="query.billNumber" placeholder="请输入" clearable> </el-input>
<el-input
v-model="query.billNumber"
placeholder="请输入"
clearable
>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="订单编号">
<el-input v-model="query.orderNumber" placeholder="请输入" clearable> </el-input>
<el-input
v-model="query.orderNumber"
placeholder="请输入"
clearable
>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="订单类型">
<JnpfSelect v-model="query.orderTypeId" placeholder="请选择" clearable
:options="orderTypeIdOptions" :props="orderTypeIdProps" multiple>
<JnpfSelect
v-model="query.orderTypeId"
placeholder="请选择"
clearable
:options="orderTypeIdOptions"
:props="orderTypeIdProps"
multiple
>
</JnpfSelect>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="单据状态">
<JnpfSelect v-model="query.billStatusId" placeholder="请选择" clearable
:options="billStatusIdOptions" :props="billStatusIdProps" multiple>
<JnpfSelect
v-model="query.billStatusId"
placeholder="请选择"
clearable
:options="billStatusIdOptions"
:props="billStatusIdProps"
multiple
>
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="备注">
<el-input v-model="query.remark" placeholder="请输入" clearable> </el-input>
<el-input v-model="query.remark" placeholder="请输入" clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item label="创建用户">
<el-input v-model="query.creatorUserId" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
</el-col> -->
</template>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
<el-button type="text" icon="el-icon-arrow-down" @click="showAll=true"
v-if="!showAll">
<el-button type="primary" icon="el-icon-search" @click="search()"
>查询</el-button
>
<el-button icon="el-icon-refresh-right" @click="reset()"
>重置</el-button
>
<el-button
type="text"
icon="el-icon-arrow-down"
@click="showAll = true"
v-if="!showAll"
>
展开
</el-button>
<el-button type="text" icon="el-icon-arrow-up" @click="showAll=false" v-else>
<el-button
type="text"
icon="el-icon-arrow-up"
@click="showAll = false"
v-else
>
收起
</el-button>
</el-form-item>
@ -64,22 +100,40 @@
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">
<el-button
type="primary"
icon="icon-ym icon-ym-btn-add"
@click="addOrUpdateHandle()"
>新增
</el-button>
</div>
<div class="JNPF-common-head-right">
<el-tooltip content="高级查询" placement="top" v-if="true">
<el-link icon="icon-ym icon-ym-filter JNPF-common-head-icon" :underline="false"
@click="openSuperQuery()" />
<el-link
icon="icon-ym icon-ym-filter JNPF-common-head-icon"
:underline="false"
@click="openSuperQuery()"
/>
</el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
<el-tooltip
effect="dark"
:content="$t('common.refresh')"
placement="top"
>
<el-link
icon="icon-ym icon-ym-Refresh JNPF-common-head-icon"
:underline="false"
@click="initData()"
/>
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange'
:span-method="arraySpanMethod">
<JNPF-table
v-loading="listLoading"
:data="list"
@sort-change="sortChange"
:span-method="arraySpanMethod"
>
<el-table-column prop="billNumber" label="流水编号" align="left">
</el-table-column>
<el-table-column prop="orderNumber" label="订单编号" align="left">
@ -90,83 +144,118 @@
</el-table-column>
<el-table-column prop="incomeAmount" label="收入(元)" align="left">
<template slot-scope="scope">
<span v-if="scope.row.incomeAmount != null || scope.row.incomeAmount != undefined">
+{{scope.row.incomeAmount}}
<span
v-if="
scope.row.incomeAmount != null ||
scope.row.incomeAmount != undefined
"
>
+{{ scope.row.incomeAmount }}
</span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column prop="payoutAmount" label="支出(元)" align="left">
<template slot-scope="scope">
<span v-if="scope.row.payoutAmount != null || scope.row.payoutAmount != undefined">
-{{scope.row.payoutAmount}}
<span
v-if="
scope.row.payoutAmount != null ||
scope.row.payoutAmount != undefined
"
>
-{{ scope.row.payoutAmount }}
</span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column prop="accountBalance" label="余额(元)" align="left">
<el-table-column
prop="accountBalance"
label="余额(元)"
align="left"
>
</el-table-column>
<el-table-column prop="remark" label="备注" align="left">
</el-table-column>
<el-table-column prop="creatorUserId" label="创建用户" align="left">
</el-table-column>
<!-- <el-table-column prop="creatorUserId" label="创建用户" align="left">
</el-table-column> -->
<el-table-column prop="creatorTime" label="创建时间" align="left">
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)">
<el-button type="text" @click="addOrUpdateHandle(scope.row)"
>编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">
<el-button
type="text"
class="JNPF-table-delBtn"
@click="handleDel(scope.row.id)"
>删除
</el-button>
<el-button type="text" @click="goDetail(scope.row.id)">
<el-button type="text" @click="goDetail(scope.row.id)"
>详情
</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
<pagination
:total="total"
:page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize"
@pagination="initData"
/>
</div>
</div>
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh" />
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" />
<ImportBox v-if="uploadBoxVisible" ref="UploadBox" @refresh="initData" />
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false" />
<ToFormDetail v-if="toFormDetailVisible" ref="toFormDetail"
@close="toFormDetailVisible = false" />
<SuperQuery v-if="superQueryVisible" ref="SuperQuery" :columnOptions="superQueryJson"
@superQuery="superQuery" />
<Detail
v-if="detailVisible"
ref="Detail"
@refresh="detailVisible = false"
/>
<ToFormDetail
v-if="toFormDetailVisible"
ref="toFormDetail"
@close="toFormDetailVisible = false"
/>
<SuperQuery
v-if="superQueryVisible"
ref="SuperQuery"
:columnOptions="superQueryJson"
@superQuery="superQuery"
/>
</div>
</template>
<script>
import request from '@/utils/request'
import request from "@/utils/request";
import { mapGetters } from "vuex";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import JNPFForm from './form'
import Detail from './Detail'
import ExportBox from '@/components/ExportBox'
import ToFormDetail from '@/views/basic/dynamicModel/list/detail'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getConfigData } from '@/api/onlineDev/visualDev'
import { getDefaultCurrentValueUserIdAsync } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentIdAsync } from '@/api/permission/organize'
import columnList from './columnList'
import { thousandsFormat } from "@/components/Generator/utils/index"
import SuperQuery from '@/components/SuperQuery'
import superQueryJson from './superQueryJson'
import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import JNPFForm from "./form";
import Detail from "./Detail";
import ExportBox from "@/components/ExportBox";
import ToFormDetail from "@/views/basic/dynamicModel/list/detail";
import { getDataInterfaceRes } from "@/api/systemData/dataInterface";
import { getConfigData } from "@/api/onlineDev/visualDev";
import { getDefaultCurrentValueUserIdAsync } from "@/api/permission/user";
import { getDefaultCurrentValueDepartmentIdAsync } from "@/api/permission/organize";
import columnList from "./columnList";
import { thousandsFormat } from "@/components/Generator/utils/index";
import SuperQuery from "@/components/SuperQuery";
import superQueryJson from "./superQueryJson";
export default {
components: {
JNPFForm,
Detail,
ExportBox, ToFormDetail, SuperQuery
ExportBox,
ToFormDetail,
SuperQuery,
},
data() {
return {
keyword: '',
keyword: "",
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
@ -190,17 +279,17 @@ export default {
creatorUserId: undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf'
children: "children",
label: "fullName",
value: "id",
isLeaf: "isLeaf",
},
list: [],
listLoading: true,
total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
superQueryJson: "",
currentPage: 1,
pageSize: 20,
sort: "desc",
@ -212,202 +301,200 @@ export default {
flowList: [],
exportBoxVisible: false,
orderTypeIdOptions: [],
orderTypeIdProps: { "label": "fullName", "value": "id" },
orderTypeIdProps: { label: "fullName", value: "id" },
billStatusIdOptions: [],
billStatusIdProps: { "label": "fullName", "value": "id" },
interfaceRes: {
},
}
billStatusIdProps: { label: "fullName", value: "id" },
interfaceRes: {},
};
},
computed: {
...mapGetters(['userInfo']),
...mapGetters(["userInfo"]),
menuId() {
return this.$route.meta.modelId || ''
}
return this.$route.meta.modelId || "";
},
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.getColumnList(), this.initSearchDataAndListData();
this.getorderTypeIdOptions();
this.getbillStatusIdOptions();
this.queryData = JSON.parse(JSON.stringify(this.query))
this.queryData = JSON.parse(JSON.stringify(this.query));
},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.toFormDetailVisible = true
if (!defaultValue) return;
getConfigData(modelId).then((res) => {
if (!res.data || !res.data.formData) return;
let formData = JSON.parse(res.data.formData);
formData.popupType = "general";
this.toFormDetailVisible = true;
this.$nextTick(() => {
this.$refs.toFormDetail.init(formData, modelId, defaultValue)
})
})
this.$refs.toFormDetail.init(formData, modelId, defaultValue);
});
});
},
toggleTreeExpand(expands) {
this.refreshTree = false
this.expandsTree = expands
this.refreshTree = false;
this.expandsTree = expands;
this.$nextTick(() => {
this.refreshTree = true
this.refreshTree = true;
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(null)
})
})
this.$refs.treeBox.setCurrentKey(null);
});
});
},
filterNode(value, data) {
if (!value) return true;
return data[this.treeProps.label].indexOf(value) !== -1;
},
loadNode(node, resolve) {
const nodeData = node.data
const nodeData = node.data;
const config = {
treeInterfaceId: "",
treeTemplateJson: []
}
treeTemplateJson: [],
};
if (config.treeInterfaceId) {
//
if (config.treeTemplateJson && config.treeTemplateJson.length) {
for (let i = 0; i < config.treeTemplateJson.length; i++) {
const element = config.treeTemplateJson[i];
element.defaultValue = nodeData[element.relationField] || ''
element.defaultValue = nodeData[element.relationField] || "";
}
}
//
let query = {
paramList: config.treeTemplateJson || [],
}
};
//
getDataInterfaceRes(config.treeInterfaceId, query).then(res => {
let data = res.data
getDataInterfaceRes(config.treeInterfaceId, query).then((res) => {
let data = res.data;
if (Array.isArray(data)) {
resolve(data);
} else {
resolve([]);
}
})
});
}
},
getColumnList() {
//
this.columnOptions = this.transformColumnList(this.columnList)
this.columnOptions = this.transformColumnList(this.columnList);
},
transformColumnList(columnList) {
let list = []
let list = [];
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e)
if (!e.prop.includes("-")) {
list.push(e);
} else {
let prop = e.prop.split('-')[0]
let label = e.label.split('-')[0]
let vModel = e.prop.split('-')[1]
let prop = e.prop.split("-")[0];
let label = e.label.split("-")[0];
let vModel = e.prop.split("-")[1];
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
e.vModel = vModel
if (!this.expandObj.hasOwnProperty(`${prop}Expand`)) this.$set(this.expandObj, `${prop}Expand`, false)
if (!list.some(o => o.prop === prop)) list.push(newItem)
children: [],
};
e.vModel = vModel;
if (!this.expandObj.hasOwnProperty(`${prop}Expand`))
this.$set(this.expandObj, `${prop}Expand`, false);
if (!list.some((o) => o.prop === prop)) list.push(newItem);
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e)
break
list[i].children.push(e);
break;
}
}
}
}
this.getMergeList(list)
this.getExportList(list)
return list
this.getMergeList(list);
this.getExportList(list);
return list;
},
arraySpanMethod({ column }) {
for (let i = 0; i < this.mergeList.length; i++) {
if (column.property == this.mergeList[i].prop) {
return [this.mergeList[i].rowspan, this.mergeList[i].colspan]
return [this.mergeList[i].rowspan, this.mergeList[i].colspan];
}
}
},
getMergeList(list) {
let newList = JSON.parse(JSON.stringify(list))
newList.forEach(item => {
let newList = JSON.parse(JSON.stringify(list));
newList.forEach((item) => {
if (item.children && item.children.length) {
let child = {
prop: item.prop + '-child-first'
}
item.children.unshift(child)
prop: item.prop + "-child-first",
};
item.children.unshift(child);
}
})
newList.forEach(item => {
});
newList.forEach((item) => {
if (item.children && item.children.length) {
item.children.forEach((child, index) => {
if (index == 0) {
this.mergeList.push({
prop: child.prop,
rowspan: 1,
colspan: item.children.length
})
colspan: item.children.length,
});
} else {
this.mergeList.push({
prop: child.prop,
rowspan: 0,
colspan: 0
})
colspan: 0,
});
}
})
});
} else {
this.mergeList.push({
prop: item.prop,
rowspan: 1,
colspan: 1
})
colspan: 1,
});
}
})
});
},
getExportList(list) {
let exportList = []
let exportList = [];
for (let i = 0; i < list.length; i++) {
if (list[i].jnpfKey === 'table') {
if (list[i].jnpfKey === "table") {
for (let j = 0; j < list[i].children.length; j++) {
exportList.push(list[i].children[j])
exportList.push(list[i].children[j]);
}
} else {
exportList.push(list[i])
exportList.push(list[i]);
}
}
this.exportList = exportList
this.exportList = exportList;
},
getorderTypeIdOptions() {
getDictionaryDataSelector('520193298627825989').then(res => {
this.orderTypeIdOptions = res.data.list
})
getDictionaryDataSelector("520193298627825989").then((res) => {
this.orderTypeIdOptions = res.data.list;
});
},
getbillStatusIdOptions() {
getDictionaryDataSelector('521683590119955205').then(res => {
this.billStatusIdOptions = res.data.list
})
getDictionaryDataSelector("521683590119955205").then((res) => {
this.billStatusIdOptions = res.data.list;
});
},
goDetail(id) {
this.detailVisible = true
this.detailVisible = true;
this.$nextTick(() => {
this.$refs.Detail.init(id)
})
this.$refs.Detail.init(id);
});
},
sortChange({ column, prop, order }) {
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
this.listQuery.sidx = !order ? '' : prop
this.initData()
this.listQuery.sort = order == "ascending" ? "asc" : "desc";
this.listQuery.sidx = !order ? "" : prop;
this.initData();
},
async initSearchDataAndListData() {
await this.initSearchData()
this.initData()
await this.initSearchData();
this.initData();
},
//
async initSearchData() {
},
async initSearchData() {},
initData() {
this.listLoading = true;
let _query = {
@ -416,104 +503,110 @@ export default {
keyword: this.keyword,
dataType: 0,
menuId: this.menuId,
moduleId: '521683377103837957',
moduleId: "521683377103837957",
type: 1,
};
request({
url: `/api/scm/EnterpriseAccountBill/getList`,
method: 'post',
data: _query
}).then(res => {
method: "post",
data: _query,
}).then((res) => {
var _list = res.data.list;
this.list = _list.map(o => ({
this.list = _list.map((o) => ({
...o,
...this.expandObj,
}))
this.total = res.data.pagination.total
this.listLoading = false
})
}));
this.total = res.data.pagination.total;
this.listLoading = false;
});
},
handleDel(id) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/EnterpriseAccountBill/${id}`,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
type: "warning",
})
.then(() => {
request({
url: `/api/scm/EnterpriseAccountBill/${id}`,
method: "DELETE",
}).then((res) => {
this.$message({
type: "success",
message: res.msg,
onClose: () => {
this.initData();
},
});
});
})
}).catch(() => {
});
.catch(() => {});
},
handelUpload() {
this.uploadBoxVisible = true
this.uploadBoxVisible = true;
this.$nextTick(() => {
this.$refs.UploadBox.init("", "scm/EnterpriseAccountBill")
})
this.$refs.UploadBox.init("", "scm/EnterpriseAccountBill");
});
},
openSuperQuery() {
this.superQueryVisible = true
this.superQueryVisible = true;
this.$nextTick(() => {
this.$refs.SuperQuery.init()
})
this.$refs.SuperQuery.init();
});
},
superQuery(queryJson) {
this.listQuery.superQueryJson = queryJson
this.listQuery.currentPage = 1
this.initData()
this.listQuery.superQueryJson = queryJson;
this.listQuery.currentPage = 1;
this.initData();
},
addOrUpdateHandle(row, isDetail) {
let id = row ? row.id : ""
this.formVisible = true
let id = row ? row.id : "";
this.formVisible = true;
this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail, this.list)
})
this.$refs.JNPFForm.init(id, isDetail, this.list);
});
},
exportData() {
this.exportBoxVisible = true
this.exportBoxVisible = true;
this.$nextTick(() => {
this.$refs.ExportBox.init(this.exportList)
})
this.$refs.ExportBox.init(this.exportList);
});
},
download(data) {
let query = { ...data, ...this.listQuery, ...this.query, menuId: this.menuId }
let query = {
...data,
...this.listQuery,
...this.query,
menuId: this.menuId,
};
request({
url: `/api/scm/EnterpriseAccountBill/Actions/Export`,
method: 'post',
data: query
}).then(res => {
if (!res.data.url) return
this.jnpf.downloadFile(res.data.url)
this.$refs.ExportBox.visible = false
this.exportBoxVisible = false
})
method: "post",
data: query,
}).then((res) => {
if (!res.data.url) return;
this.jnpf.downloadFile(res.data.url);
this.$refs.ExportBox.visible = false;
this.exportBoxVisible = false;
});
},
search() {
this.listQuery.currentPage = 1
this.listQuery.pageSize = 20
this.listQuery.sort = "desc"
this.listQuery.sidx = ""
this.initData()
this.listQuery.currentPage = 1;
this.listQuery.pageSize = 20;
this.listQuery.sort = "desc";
this.listQuery.sidx = "";
this.initData();
},
refresh(isrRefresh) {
this.formVisible = false
if (isrRefresh) this.reset()
this.formVisible = false;
if (isrRefresh) this.reset();
},
reset() {
this.query = JSON.parse(JSON.stringify(this.queryData))
this.search()
this.query = JSON.parse(JSON.stringify(this.queryData));
this.search();
},
colseFlow(isrRefresh) {
this.flowVisible = false
if (isrRefresh) this.reset()
this.flowVisible = false;
if (isrRefresh) this.reset();
},
}
}
},
};
</script>

File diff suppressed because one or more lines are too long

@ -6,83 +6,139 @@
:show-close="false"
:modal="false"
:close-on-click-modal="false"
:visible="dialogVisible">
:visible="dialogVisible"
>
<div class="cont">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="160px" class="demo-ruleForm">
<el-form-item label="账号" prop="people">
<el-input v-model="ruleForm.iphone"></el-input>
</el-form-item>
<el-form-item label="短信验证码" prop="code">
<el-input v-model="ruleForm.code"></el-input>
</el-form-item>
<el-form-item label="输入新密码" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
</el-form>
<el-form
:model="dataForm"
:rules="rules"
ref="dataForm"
label-width="160px"
class="demo-dataForm"
>
<!-- {{ dataForm }} -->
<el-form-item label="账号" prop="account">
<el-input v-model="dataForm.account"></el-input>
</el-form-item>
<el-form-item label="短信验证码" prop="code">
<el-input v-model="dataForm.code"></el-input>
</el-form-item>
<el-form-item label="输入新密码" prop="userPassword">
<el-input v-model="dataForm.userPassword"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false">确认修改</el-button>
<!-- <el-button type="primary" @click="dialogVisible = false">确认修改</el-button> -->
<el-button type="primary" @click="dataFormSubmit()"></el-button>
</span>
</el-dialog>
<div class="foot">Copyright © 上海长江云息数字科技有限公司 © 2012 - 2023 All Rights Reserved 专业的数字信息解决方案专家</div>
<div class="foot">
Copyright © 上海长江云息数字科技有限公司 © 2012 - 2023 All Rights Reserved
专业的数字信息解决方案专家
</div>
</div>
</template>
<script>
import { resetUserPasswordForge } from "@/api/permission/user";
export default {
name: 'login-resiter',
name: "login-resiter",
mixins: [],
components: {},
data() {
const validateUserPassword = (rule, value, callback) => {
if (value === "") {
callback(new Error("新密码不能为空"));
} else {
if (this.dataForm.password2 !== "") {
this.$refs.dataForm.validateField("password2");
}
callback();
}
};
return {
dialogVisible: true,
active: 1,
ruleForm: {
dataForm: {
id: "",
account: "",
userPassword: "",
},
rules: {
rules: {},
dataRule: {
userPassword: [
{ required: true, validator: validateUserPassword, trigger: "blur" },
],
},
}
};
},
methods: {
download(row) {
this.downloadFormVisible = true
this.downloadFormVisible = true;
this.$nextTick(() => {
this.$refs.downloadForm.init(row.tables, row.id, 0, row.hasPackage)
})
this.$refs.downloadForm.init(row.tables, row.id, 0, row.hasPackage);
});
},
pre(row) {
this.active -= 1
this.active -= 1;
},
next() {
this.active += 1
this.active += 1;
},
complete() {
this.$router.push({
path: '/login',
query: ''
})
}
}
}
path: "/login",
query: "",
});
},
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (valid) {
this.btnLoading = true;
const formData = {
account: this.dataForm.account,
userPassword: md5(this.dataForm.userPassword),
};
resetUserPasswordForge(formData)
.then((res) => {
this.$message({
message: res.msg,
type: "success",
duration: 1500,
onClose: () => {
this.visible = false;
this.btnLoading = false;
this.$emit("refreshDataList");
},
});
})
.catch(() => {
this.btnLoading = false;
});
}
});
},
},
};
</script>
<style lang="scss" scoped>
.JNPF-common-reister {
width: 100vw;
height: 100vh;
position: fixed;
background: linear-gradient(90deg, #9064FF 3%, #5996FD 97%);
background: linear-gradient(90deg, #9064ff 3%, #5996fd 97%);
padding: 40px;
>>>.el-dialog {
>>> .el-dialog {
.el-dialog__body {
height: 400px;
overflow: auto;
}
}
.cont {}
.cont {
}
.foot {
position: absolute;

@ -0,0 +1,382 @@
<template>
<div class="app-container JNPF-flex-main authorize-container">
<div class="JNPF-common-head">
<div class="btn-group">
<el-dropdown style="margin-right: 8px">
<el-button plain>
{{$t('authorize.operation')}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleCheck('checkAll')">
{{$t('authorize.checkAll')}}
</el-dropdown-item>
<el-dropdown-item @click.native="handleCheck('cancelCheckAll')">
{{$t('authorize.deselectAll')}}</el-dropdown-item>
<el-dropdown-item @click.native="setAllExpand('open')">{{$t('authorize.expandAll')}}
</el-dropdown-item>
<el-dropdown-item @click.native="setAllExpand('close')">{{$t('authorize.foldAll')}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button :disabled="active <= 0 || treeLoading" @click="handlePrevStep">
{{$t('common.prev')}}</el-button>
<el-button :disabled="active >= 6 || treeLoading" @click="handleNextStep">
{{$t('common.next')}}</el-button>
<el-button type="primary" :loading="btnLoading" :disabled="active < 6"
@click="handleConfirm()">{{$t('common.confirmButton')}}</el-button>
</div>
</div>
<el-steps :active="active" finish-status="success" simple>
<el-step :title="$t('authorize.systemPermission')"></el-step>
<el-step :title="$t('authorize.menuPermission')"></el-step>
<el-step :title="$t('authorize.buttonPermission')"></el-step>
<el-step :title="$t('authorize.listPermission')"></el-step>
<el-step :title="$t('authorize.formPermission')"></el-step>
<el-step :title="$t('authorize.dataPermission')"></el-step>
<el-step :title="$t('authorize.selectRoles')"></el-step>
</el-steps>
<div class="authorize-bd">
<div v-if="active < 6">
<el-tree :data="authorizeTreeData" ref="authorizeTree" v-loading="treeLoading" show-checkbox
default-expand-all node-key="id" :check-strictly="checkStrictly" check-on-click-node
:props="defaultProps" :expand-on-click-node="false" @check-change="selectTreeNodeClick">
<span slot-scope="{ node, data }">
<i :class="data.icon" />
<span style="padding-left: 4px;">{{ node.label }}</span>
</span>
</el-tree>
</div>
<div class="authorize-selectbox" v-else>
<el-tree :data="roleTreeAllData" ref="roleTree" v-loading="roleTreeLoading" show-checkbox
default-expand-all node-key="onlyId" :props="defaultProps" check-on-click-node
:expand-on-click-node="false" @check-change="selectTreeNodeClick">
<span slot-scope="{ node, data }">
<i :class="data.icon" />
<span style="padding-left: 4px;">{{ node.label }}</span>
</span>
</el-tree>
</div>
</div>
</div>
</template>
<script>
import { getRoleSelectorByPermission } from '@/api/permission/role'
import { getAuthorizeValues, updateBatchAuthorize } from '@/api/permission/authorize'
export default {
name: 'permission-authorize',
data() {
return {
active: 0,
roleTreeLoading: false,
treeLoading: false,
btnLoading: false,
checkStrictly: true,
objectId: 0,
params: {
type: 'system',
moduleIds: ''
},
dataForm: {
roleIds: [],
module: [],
systemIds: [],
button: [],
column: [],
form: [],
resource: []
},
systemIds: '',
roleTreeAllData: [],
roleAllIds: [],
positionTreeData: [],
authorizeTreeData: [],
systemTreeData: [],
systemAuthorizeTree: [],
moduleAuthorizeTree: [],
buttonAuthorizeTree: [],
columnAuthorizeTree: [],
formAuthorizeTree: [],
resourceAuthorizeTree: [],
systemAllData: [],
moduleAllData: [],
buttonAllData: [],
columnAllData: [],
formAllData: [],
resourceAllData: [],
moduleIdsTemp: [],
defaultProps: { //
value: 'id',
label: 'fullName',
children: 'children',
disabled: 'disabled'
}
}
},
created() {
this.initData()
},
methods: {
initData() {
Object.assign(this.$data, this.$options.data())
this.getAuthorizeList()
},
getRoleList() {
this.roleTreeLoading = true
getRoleSelectorByPermission().then(res => {
let ids = []
const loop = list => {
for (let i = 0; i < list.length; i++) {
const item = list[i]
ids.push(item.onlyId)
if (item.children && item.children.length) {
loop(item.children)
}
}
}
loop(res.data.list)
this.roleAllIds = ids
this.roleTreeAllData = res.data.list
this.roleTreeLoading = false
}).catch(() => {
this.roleTreeLoading = false
})
},
getAuthorizeList() {
this.treeLoading = true
this.authorizeTreeData = []
getAuthorizeValues(this.objectId, this.params).then(res => {
switch (this.active) {
case 0:
this.systemAuthorizeTree = res.data.list
this.systemAllData = res.data.all
this.authorizeTreeData = this.systemAuthorizeTree
this.dataForm.systemIds = [...this.moduleIdsTemp, ...res.data.ids]
this.dataForm.systemIds = [...new Set(this.dataForm.systemIds)]
this.moduleIdsTemp = this.dataForm.systemIds
this.systemIds = this.moduleIdsTemp
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.systemIds)
break
case 1:
this.moduleAuthorizeTree = res.data.list
this.moduleAllData = res.data.all
this.authorizeTreeData = this.moduleAuthorizeTree
const moduleIds = [...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.module = [...new Set(moduleIds)]
this.moduleIdsTemp = this.dataForm.module
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.module)
break
case 2:
this.buttonAuthorizeTree = res.data.list
this.buttonAllData = res.data.all
this.authorizeTreeData = this.buttonAuthorizeTree
this.dataForm.button = [...this.dataForm.button, ...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.button = [...new Set(this.dataForm.button)]
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.button)
break
case 3:
this.columnAuthorizeTree = res.data.list
this.columnAllData = res.data.all
this.authorizeTreeData = this.columnAuthorizeTree
this.dataForm.column = [...this.dataForm.column, ...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.column = [...new Set(this.dataForm.column)]
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.column)
break
case 4:
this.formAuthorizeTree = res.data.list
this.formAllData = res.data.all
this.authorizeTreeData = this.formAuthorizeTree
this.dataForm.form = [...this.dataForm.form, ...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.form = [...new Set(this.dataForm.form)]
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.form)
break
case 5:
this.resourceAuthorizeTree = res.data.list
this.resourceAllData = res.data.all
this.authorizeTreeData = this.resourceAuthorizeTree
this.dataForm.resource = [...this.dataForm.resource, ...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.resource = [...new Set(this.dataForm.resource)]
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.resource)
break
}
this.checkStrictly = false
this.treeLoading = false
}).catch(() => {
this.treeLoading = false
})
},
// /
handleCheck(val) {
if (val === 'checkAll') {
switch (this.active) {
case 0:
this.$refs.authorizeTree.setCheckedKeys(this.systemAllData)
break
case 1:
this.$refs.authorizeTree.setCheckedKeys(this.moduleAllData)
break
case 2:
this.$refs.authorizeTree.setCheckedKeys(this.buttonAllData)
break
case 3:
this.$refs.authorizeTree.setCheckedKeys(this.columnAllData)
break
case 4:
this.$refs.authorizeTree.setCheckedKeys(this.formAllData)
break
case 5:
this.$refs.authorizeTree.setCheckedKeys(this.resourceAllData)
break
case 6:
this.$refs.roleTree.setCheckedKeys(this.roleAllIds)
}
}
if (val === 'cancelCheckAll') {
if (this.active === 6) {
this.$refs.roleTree.setCheckedKeys([])
} else {
this.$refs.authorizeTree.setCheckedKeys([])
}
}
},
//
setAllExpand(state) {
let result
if (state === 'open') {
result = true
}
if (state === 'close') {
result = false
}
let nodes
if (this.active === 6) {
nodes = this.$refs.roleTree.store.nodesMap
} else {
nodes = this.$refs.authorizeTree.store.nodesMap
}
for (let i in nodes) {
nodes[i].expanded = result
}
},
//
handlePrevStep() {
this.active -= 1
this.handleInitData()
},
//
handleNextStep() {
if (this.active++ > 6) this.active = 0
this.handleInitData()
},
handleInitData() {
this.checkStrictly = true
this.treeLoading = true
switch (this.active) {
case 0:
this.params.type = 'system'
break
case 1:
this.params.type = 'module'
this.params.moduleIds = (this.systemIds).toString()
break
case 2:
this.params.type = 'button'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
case 3:
this.params.type = 'column'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
case 4:
this.params.type = 'form'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
case 5:
this.params.type = 'resource'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
case 6:
this.getRoleList()
this.$nextTick(() => {
this.$refs.roleTree.setCheckedKeys(this.dataForm.roleIds)
})
break
}
if (this.active !== 6) {
this.getAuthorizeList()
} else {
this.treeLoading = false
}
},
//
selectTreeNodeClick() {
let dataIds = []
if (this.active !== 6) {
const parentIds = this.$refs.authorizeTree.getHalfCheckedKeys()
const childrenIds = this.$refs.authorizeTree.getCheckedKeys()
const newIds = [...parentIds, ...childrenIds]
dataIds = [...new Set(newIds)]
}
switch (this.active) {
case 0:
this.dataForm.systemIds = dataIds
this.moduleIdsTemp = this.dataForm.systemIds
this.systemIds = this.moduleIdsTemp
break
case 1:
this.dataForm.module = dataIds
this.moduleIdsTemp = this.dataForm.module
break
case 2:
this.dataForm.button = dataIds
break
case 3:
this.dataForm.column = dataIds
break
case 4:
this.dataForm.form = dataIds
break
case 5:
this.dataForm.resource = dataIds
break
case 6:
let nodes = this.$refs.roleTree.getCheckedNodes()
this.dataForm.roleIds = nodes.map(o => o.id)
break
}
},
handleConfirm() {
this.btnLoading = true
updateBatchAuthorize(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.btnLoading = false
this.active = 0
this.initData()
}
})
}).catch(() => {
this.btnLoading = false
})
}
}
}
</script>
<style lang="scss" scoped>
.authorize-container {
padding: 0;
.el-steps {
border-radius: 0;
padding: 13px 45px !important;
}
}
.authorize-bd {
padding: 20px;
height: calc(100% - 50px);
font-size: 14px;
overflow: auto;
overflow-x: hidden;
}
</style>

@ -0,0 +1,346 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main authorize-bd">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="title" />
<div class="options">
<el-dropdown style="margin-right: 8px">
<el-button plain>
{{$t('authorize.operation')}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleCheck('checkAll')">
{{$t('authorize.checkAll')}}</el-dropdown-item>
<el-dropdown-item @click.native="handleCheck('cancelCheckAll')">
{{$t('authorize.deselectAll')}}
</el-dropdown-item>
<el-dropdown-item @click.native="setAllExpand('open')">{{$t('authorize.expandAll')}}
</el-dropdown-item>
<el-dropdown-item @click.native="setAllExpand('close')">{{$t('authorize.foldAll')}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button :disabled="active <= 0 || treeLoading" @click="handlePrevStep">
{{$t('common.prev')}}
</el-button>
<el-button :disabled="active >= 5 || treeLoading" @click="handleNextStep">
{{$t('common.next')}}
</el-button>
<el-button type="primary" :loading="btnLoading" :disabled="active < 5"
@click="handleConfirm()">{{$t('common.confirmButton')}}</el-button>
<el-button @click="goBack">{{$t('common.cancelButton')}}</el-button>
</div>
</div>
<el-steps :active="active" finish-status="success" simple>
<el-step :title="$t('authorize.systemPermission')"></el-step>
<el-step :title="$t('authorize.menuPermission')"></el-step>
<el-step :title="$t('authorize.buttonPermission')"></el-step>
<el-step :title="$t('authorize.listPermission')"></el-step>
<el-step :title="$t('authorize.formPermission')"></el-step>
<el-step :title="$t('authorize.dataPermission')"></el-step>
</el-steps>
<div class="main">
<el-form ref="dataForm" :model="dataForm" @keyup.enter.native="handleConfirm()">
<el-form-item>
<el-tree :data="authorizeTreeData" ref="authorizeTree" v-loading="treeLoading"
show-checkbox default-expand-all node-key="id" :check-strictly="checkStrictly"
check-on-click-node :props="defaultProps" :expand-on-click-node="false"
@check-change="selectTreeNodeClick">
<div slot-scope="{ node, data }">
<i :class="data.icon" />
<span style="padding-left: 4px;">{{ node.label }}</span>
</div>
</el-tree>
</el-form-item>
</el-form>
</div>
</div>
</transition>
</template>
<script>
import {
getAuthorizeValues,
updateAuthorizeList
} from '@/api/permission/authorize'
export default {
data() {
return {
visible: false,
treeLoading: false,
btnLoading: false,
checkStrictly: true,
objectId: '',
dataForm: {
objectType: '',
module: [],
systemIds: [],
button: [],
column: [],
form: [],
resource: []
},
params: {
type: 'system',
moduleIds: ''
},
systemIds: '',
title: '',
active: 0,
systemAllData: [],
authorizeTreeData: [],
moduleAuthorizeTree: [],
buttonAuthorizeTree: [],
columnAuthorizeTree: [],
formAuthorizeTree: [],
resourceAuthorizeTree: [],
systemAllData: [],
moduleAllData: [],
buttonAllData: [],
columnAllData: [],
formAllData: [],
resourceAllData: [],
moduleIdsTemp: [],
defaultProps: { //
value: 'id',
label: 'fullName',
children: 'children'
}
}
},
methods: {
init(id, fullName, type) {
Object.assign(this.$data, this.$options.data())
this.visible = true
this.objectId = id
this.dataForm.objectType = type
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (type === 'User') {
this.title = this.$t(`user.userPermission`) + ' - ' + fullName
} else if (type === 'Position') {
this.title = this.$t(`position.postPermission`) + '- ' + fullName
} else if (type === 'Role') {
this.title = fullName
}
this.getAuthorizeList()
})
},
getAuthorizeList() {
this.treeLoading = true
this.authorizeTreeData = []
getAuthorizeValues(this.objectId, this.params).then(res => {
switch (this.active) {
case 0:
this.systemAuthorizeTree = res.data.list
this.systemAllData = res.data.all
this.authorizeTreeData = this.systemAuthorizeTree
this.dataForm.systemIds = [...this.moduleIdsTemp, ...res.data.ids]
this.dataForm.systemIds = [...new Set(this.dataForm.systemIds)]
this.moduleIdsTemp = this.dataForm.systemIds
this.systemIds = this.moduleIdsTemp
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.systemIds)
break
case 1:
this.moduleAuthorizeTree = res.data.list
this.moduleAllData = res.data.all
this.authorizeTreeData = this.moduleAuthorizeTree
const moduleIds = [...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.module = [...new Set(moduleIds)]
this.moduleIdsTemp = this.dataForm.module
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.module)
break
case 2:
this.buttonAuthorizeTree = res.data.list
this.buttonAllData = res.data.all
this.authorizeTreeData = this.buttonAuthorizeTree
this.dataForm.button = [...this.dataForm.button, ...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.button = [...new Set(this.dataForm.button)]
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.button)
break
case 3:
this.columnAuthorizeTree = res.data.list
this.columnAllData = res.data.all
this.authorizeTreeData = this.columnAuthorizeTree
this.dataForm.column = [...this.dataForm.column, ...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.column = [...new Set(this.dataForm.column)]
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.column)
break
case 4:
this.formAuthorizeTree = res.data.list
this.formAllData = res.data.all
this.authorizeTreeData = this.formAuthorizeTree
this.dataForm.form = [...this.dataForm.form, ...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.form = [...new Set(this.dataForm.form)]
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.form)
break
case 5:
this.resourceAuthorizeTree = res.data.list
this.resourceAllData = res.data.all
this.authorizeTreeData = this.resourceAuthorizeTree
this.dataForm.resource = [...this.dataForm.resource, ...res.data.ids, ...this.moduleIdsTemp]
this.dataForm.resource = [...new Set(this.dataForm.resource)]
this.$refs.authorizeTree.setCheckedKeys(this.dataForm.resource)
break
}
this.checkStrictly = false
this.treeLoading = false
}).catch(() => {
this.treeLoading = false
})
},
goBack() {
this.$emit('close')
},
// /
handleCheck(val) {
if (val === 'checkAll') {
switch (this.active) {
case 0:
this.$refs.authorizeTree.setCheckedKeys(this.systemAllData)
break
case 1:
this.$refs.authorizeTree.setCheckedKeys(this.moduleAllData)
break
case 2:
this.$refs.authorizeTree.setCheckedKeys(this.buttonAllData)
break
case 3:
this.$refs.authorizeTree.setCheckedKeys(this.columnAllData)
break
case 4:
this.$refs.authorizeTree.setCheckedKeys(this.formAllData)
break
case 5:
this.$refs.authorizeTree.setCheckedKeys(this.resourceAllData)
break
}
}
if (val === 'cancelCheckAll') {
this.$refs.authorizeTree.setCheckedKeys([])
}
},
//
setAllExpand(state) {
let result
if (state === 'open') {
result = true
}
if (state === 'close') {
result = false
}
const nodes = this.$refs.authorizeTree.store.nodesMap
for (let i in nodes) {
nodes[i].expanded = result
}
},
//
handlePrevStep() {
this.active -= 1
this.handelInitData()
},
//
handleNextStep() {
if (this.active++ > 4) this.active = 0
this.handelInitData()
},
handelInitData() {
this.checkStrictly = true
this.treeLoading = true
switch (this.active) {
case 0:
this.params.type = 'system'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
case 1:
this.params.type = 'module'
this.params.moduleIds = (this.systemIds).toString()
break
case 2:
this.params.type = 'button'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
case 3:
this.params.type = 'column'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
case 4:
this.params.type = 'form'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
case 5:
this.params.type = 'resource'
this.params.moduleIds = (this.moduleIdsTemp).toString()
break
}
this.getAuthorizeList()
},
//
selectTreeNodeClick() {
const parentIds = this.$refs.authorizeTree.getHalfCheckedKeys()
const childrenIds = this.$refs.authorizeTree.getCheckedKeys()
const newIds = [...parentIds, ...childrenIds]
const dataIds = [...new Set(newIds)]
switch (this.active) {
case 0:
this.dataForm.systemIds = dataIds
this.moduleIdsTemp = this.dataForm.systemIds
this.systemIds = this.moduleIdsTemp
break
case 1:
this.dataForm.module = dataIds
this.moduleIdsTemp = this.dataForm.module
break
case 2:
this.dataForm.button = dataIds
break
case 3:
this.dataForm.column = dataIds
break
case 4:
this.dataForm.form = dataIds
break
case 5:
this.dataForm.resource = dataIds
break
}
},
handleConfirm() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.btnLoading = true
updateAuthorizeList(this.objectId, this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$emit('close', true)
}
})
}).catch(() => {
this.btnLoading = false
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.authorize-bd {
.JNPF-common-page-header {
border-bottom: none;
}
.el-steps {
border-radius: 0;
padding: 13px 45px !important;
}
}
.main {
padding: 20px;
}
</style>

@ -0,0 +1,103 @@
<template>
<div>
<el-dialog :title="!dataForm.id ? '新建权限' : '编辑权限'" :close-on-click-modal="false"
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="600px">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" v-loading="loading"
label-width="100px">
<el-form-item label="权限组名称" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="请输入权限组名称" maxlength="100">
</el-input>
</el-form-item>
<el-form-item label="权限组编码" prop="enCode">
<el-input v-model="dataForm.enCode" placeholder="请输入权限组编码" maxlength="50">
</el-input>
</el-form-item>
<el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode"
controls-position="right" />
</el-form-item>
<el-form-item label="状态" prop="enabledMark">
<el-switch v-model="dataForm.enabledMark" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入说明" type="textarea" :rows="3" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getAuthorizeInfo, Update, Create } from '@/api/permission/authorize'
export default {
components: {},
data() {
return {
visible: false,
loading: false,
btnLoading: false,
dataForm: {
id: '',
fullName: '',
enCode: '',
sortCode: 0,
enabledMark: 1,
description: ''
},
dataRule: {
fullName: [
{ required: true, message: '权限组名称不能为空', trigger: 'blur' },
],
enCode: [
{ required: true, message: '权限组编码不能为空', trigger: 'blur' },
{ validator: this.formValidate('enCode'), trigger: 'blur' },
],
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.btnLoading = false
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.loading = true
getAuthorizeInfo(this.dataForm.id).then(res => {
this.dataForm = res.data
this.loading = false
}).catch(() => {
this.loading = false
})
}
})
},
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) return
const formMethod = this.dataForm.id ? Update : Create
formMethod(this.dataForm).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.btnLoading = false
this.visible = false
this.$emit('close', true)
}
})
}).catch(() => {
this.btnLoading = false
})
})
}
}
}
</script>

@ -0,0 +1,208 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="关键词">
<el-input v-model="keyword" placeholder="请输入关键词查询" clearable
@keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<topOpts @add="addOrUpdateHandle" addText="新建">
</topOpts>
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list">
<el-table-column prop="fullName" label="权限组名称" show-overflow-tooltip min-width="200" />
<el-table-column prop="enCode" label="权限组编码" width="200" />
<el-table-column prop="creatorTime" label="创建时间" :formatter="jnpf.tableDateFormat"
width="120" />
<el-table-column prop="sortCode" label="排序" width="70" align="center" />
<el-table-column prop="enabledMark" label="状态" width="70" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.enabledMark == 1 ? 'success' : 'danger'" disable-transitions>
{{scope.row.enabledMark==1?'启用':'禁用'}}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)">
<el-dropdown>
<span class="el-dropdown-link">
<el-button type="text" size="mini">{{$t('common.moreBtn')}}<i
class="el-icon-arrow-down el-icon--right"></i>
</el-button>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="setUserAuthorize(scope.row.id)">权限成员
</el-dropdown-item>
<el-dropdown-item
@click.native="handleAuthorize(scope.row.id,scope.row.fullName)">权限授权
</el-dropdown-item>
<el-dropdown-item @click.native="copyAuthorize(scope.row.id)">复制权限
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</tableOpts>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
</div>
<Form v-if="formVisible" ref="form" @close="closeForm" />
<userTransfer v-if="userVisible" ref="transfer" :permissionGroupId="authorizeId" multiple
@confirm="closeUser" />
<AuthorizeForm v-if="authorizeFormVisible" ref="AuthorizeForm" @close="removeAuthorizeForm" />
</div>
</template>
<script>
import { getAuthorizeList, Delete, CopyPermissions } from '@/api/permission/authorize'
import Form from './Form'
import userTransfer from './permissionGroup'
import AuthorizeForm from './AuthorizeForm'
export default {
name: 'onlineDev-visualPortal',
components: { Form, userTransfer, AuthorizeForm },
data() {
return {
list: [],
keyword: '',
listQuery: {
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
},
total: 0,
drawerVisible: false,
listLoading: false,
formVisible: false,
selectedData: [],
authorizeFormVisible: false,
authorizeId: '',
userVisible: false,
}
},
created() {
this.initData()
},
methods: {
reset() {
this.keyword = ''
this.category = ''
this.type = ''
this.enabledLock = ''
this.search()
},
search() {
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
}
this.initData()
},
initData() {
this.listLoading = true
let query = {
...this.listQuery,
keyword: this.keyword,
}
getAuthorizeList(query).then(res => {
this.list = res.data.list
this.total = res.data.pagination.total
this.listLoading = false
})
},
copyAuthorize(id) {
this.$confirm('您确定要复制该功能权限, 是否继续?', this.$t('common.tipTitle'), {
type: 'warning'
}).then(() => {
CopyPermissions(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
this.initData()
}
});
})
}).catch(() => { });
},
handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), {
type: 'warning'
}).then(() => {
Delete(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
this.initData()
}
});
})
}).catch(() => { });
},
addOrUpdateHandle(id) {
this.dialogVisible = false
this.formVisible = true
this.$nextTick(() => {
this.$refs.form.init(id)
})
},
closeForm(isRefresh) {
this.formVisible = false
if (isRefresh) this.initData()
},
closeUser(isRefresh) {
this.userVisible = false
if (isRefresh) this.initData()
},
setUserAuthorize(id) {
this.authorizeId = id || ''
this.userVisible = true
this.$nextTick(() => {
this.$refs.transfer.init()
})
},
handleAuthorize(id, fullName) {
this.authorizeFormVisible = true
fullName = '权限授权-' + fullName
this.$nextTick(() => {
this.$refs.AuthorizeForm.init(id, fullName, 'Role')
})
},
removeAuthorizeForm(isRefresh) {
this.authorizeFormVisible = false
if (isRefresh) {
this.initData()
}
},
}
}
</script>

@ -0,0 +1,415 @@
<template>
<div>
<el-dialog title="选择用户" :close-on-click-modal="false" :visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center transfer-dialog" lock-scroll append-to-body
width='800px'>
<div class="transfer__body" v-loading="allLoading" :style="{height}">
<div class="transfer-pane">
<div class="transfer-pane__tools">
<el-input placeholder="输入关键词进行搜索" v-model="pagination.keyword"
@keyup.enter.native="search" clearable>
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
<div class="transfer-pane__body left-pane">
<el-tabs v-model="activeName" class="transfer-pane__body-tab hasSys-tab">
<el-tab-pane label="部门" name="department">
<el-tree :data="treeData" :props="props" check-on-click-node
:expand-on-click-node="false" @node-click="handleNodeClick"
class="JNPF-common-el-tree" node-key="id" v-loading="loading" lazy
:load="loadNode" v-if="!this.isAsync">
<span class="custom-tree-node" slot-scope="{ node, data }">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
<div class="single-list" ref="infiniteBody" v-if="this.isAsync"
v-loading="loading && pagination.currentPage==1">
<template v-if="treeData.length">
<div v-for="(item,index) in treeData" :key="index" class="selected-item-user"
@click="handleNodeClick(item)">
<div class="selected-item-main">
<el-avatar :size="36" :src="define.comUrl+item.headIcon"
class="selected-item-headIcon">
</el-avatar>
<div class="selected-item-text">
<p class="name">{{item.fullName}}</p>
<p class="organize" :title="item.organize">{{item.organize}}</p>
</div>
</div>
</div>
</template>
<el-empty description="暂无数据" :image-size="120" v-else></el-empty>
</div>
</el-tab-pane>
<el-tab-pane label="角色" name="role" v-if="multiple">
<el-tree :data="treeData2" :props="props" :expand-on-click-node="false"
default-expand-all check-on-click-node @node-click="handleNodeClick"
class="JNPF-common-el-tree" node-key="id" v-loading="roleLoading" ref="roleTree"
:filter-node-method="filterNode">
<span class="custom-tree-node" slot-scope="{ node, data }">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</el-tab-pane>
<el-tab-pane label="岗位" name="position" v-if="multiple">
<el-tree :data="treeData3" :props="props" :expand-on-click-node="false"
default-expand-all check-on-click-node @node-click="handleNodeClick"
class="JNPF-common-el-tree" node-key="id" v-loading="positionLoading"
ref="positionTree" :filter-node-method="filterNode">
<span class="custom-tree-node" slot-scope="{ node, data }">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</el-tab-pane>
<el-tab-pane label="分组" name="group" v-if="multiple">
<el-tree :data="treeData4" :props="props" :expand-on-click-node="false"
default-expand-all check-on-click-node @node-click="handleNodeClick"
class="JNPF-common-el-tree" node-key="id" v-loading="groupLoading" ref="groupTree"
:filter-node-method="filterNode">
<span class="custom-tree-node" slot-scope="{ node, data }">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</el-tab-pane>
</el-tabs>
</div>
</div>
<div class="transfer-pane">
<div class="transfer-pane__tools">
<span>已选</span>
<el-button @click="removeAll" type="text" class="removeAllBtn">清空列表</el-button>
</div>
<div class="transfer-pane__body shadow right-pane">
<template v-if="selectedList.length">
<div v-for="(item,index) in selectedList" :key="index"
class="selected-item-user-multiple">
<template v-if="item.children.length">
<p class="selected-item-title">
<i :class="item.icon"></i><span>{{item.fullName}}</span>
</p>
<div class="selected-item-main" v-for="(child,i) in item.children" :key="i">
<el-avatar :size="36" :src="define.comUrl+child.headIcon"
class="selected-item-headIcon" v-if="child.type==='user'">
</el-avatar>
<div class="selected-item-icon" v-else>{{child.fullName.substring(0,1)}}</div>
<div class="selected-item-text">
<p class="name">{{child.fullName}}</p>
<p class="organize" :title="child.organize">{{child.organize}}</p>
</div>
<i class="el-icon-delete delete" @click="removeData(child.id)"></i>
</div>
</template>
</div>
</template>
<el-empty description="暂无数据" :image-size="120" v-else></el-empty>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="visible=false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading"
@click="confirm">{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getImUserSelector, getSelectedList } from '@/api/permission/user'
import { getPositionSelector } from '@/api/permission/position'
import { getRoleSelector } from '@/api/permission/role'
import { getGroupSelector } from '@/api/permission/group'
import { getPermissionMember, savePermissionMember } from '@/api/permission/authorize'
const defaultSelectedList = [
{
id: "department",
type: "department",
fullName: "部门",
icon: "icon-ym icon-ym-tree-department1",
children: []
},
{
id: "position",
type: "position",
fullName: "岗位",
icon: "icon-ym icon-ym-tree-position1",
children: []
},
{
id: "user",
type: "user",
fullName: "用户",
icon: "icon-ym icon-ym-tree-user2",
children: []
},
{
id: "group",
type: "group",
fullName: "分组",
icon: "icon-ym icon-ym-generator-group1",
children: []
},
{
id: "role",
type: "role",
fullName: "角色",
icon: "icon-ym icon-ym-generator-role",
children: []
}
]
export default {
name: 'JNPF-userTransfer',
data() {
return {
allLoading: false,
loading: false,
roleLoading: true,
positionLoading: true,
groupLoading: true,
activeName: '',
treeData: [],
treeData2: [],
treeData3: [],
treeData4: [],
selectedData: [],
props: {
children: 'children',
label: 'fullName',
isLeaf: 'isLeaf'
},
nodeId: '0',
ids: [],
total: 0,
isAsync: false,
finish: false,
pagination: {
keyword: '',
currentPage: 1,
pageSize: 20,
},
permissionData: [],
visible: false,
btnLoading: false,
selectedList: defaultSelectedList
}
},
props: {
height: {
type: String,
default: "400px"
},
// allLoading: {
// type: Boolean,
// default: false
// },
permissionGroupId: {
type: String,
default: ""
},
value: {
type: Array,
default: () => []
},
multiple: {
type: Boolean,
default: false
},
},
watch: {
activeName(val) {
this.pagination.keyword = ''
this.isAsync = false
if (!val) return
this.nodeId = '0'
this.treeData = []
this.getData()
},
selectedData(val) {
if (!this.multiple) return
this.selectedList = JSON.parse(JSON.stringify(defaultSelectedList))
for (let i = 0; i < this.selectedData.length; i++) {
const item = this.selectedData[i];
const type = item.type == 'company' ? 'department' : item.type
this.selectedList.map(res => {
if (res.type == type) {
const obj = {
fullName: item.fullName,
type: type,
headIcon: item.headIcon,
organize: item.organize,
id: item.id
}
res.children.push(obj)
}
})
}
}
},
methods: {
init() {
this.visible = true
this.getOtherData()
this.selectedData = []
this.ids = []
this.pagination.keyword = ''
this.activeName = ''
this.nodeId = '0'
this.isAsync = false
this.finish = false
this.$nextTick(() => {
this.activeName = 'department'
this.initData()
})
},
bindScroll() {
let _this = this,
vBody = _this.$refs.infiniteBody;
vBody.addEventListener("scroll", function () {
if (vBody.scrollHeight - vBody.clientHeight - vBody.scrollTop <= 200 && !_this.loading && !_this.finish) {
_this.pagination.currentPage += 1
_this.getList()
}
});
},
confirm() {
this.btnLoading = true
let query = {
ids: this.ids,
id: this.permissionGroupId
}
savePermissionMember(query).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.$emit('confirm', true)
this.visible = false
this.btnLoading = false
}
})
}).catch()
},
getData() {
if (this.activeName === 'department') {
this.getList()
} else if (['role', 'position', 'group'].includes(this.activeName)) {
this.$refs[this.activeName + 'Tree'] && this.$refs[this.activeName + 'Tree'].filter(this.pagination.keyword)
} else {
this.loading = false
}
},
getSelectList() {
this.allLoading = true
if (!this.permissionData.length) return this.allLoading = false
getSelectedList(this.permissionData).then(res => {
this.selectedData = res.data.list.map(o => ({ ...o, id: o.type ? o.id + '--' + o.type : o.id }))
this.ids = this.selectedData.map(o => o.id)
this.allLoading = false
})
},
initData() {
getPermissionMember(this.permissionGroupId).then(res => {
let list = res.data.list || []
console.log(res.data.list)
this.permissionData = list.map(res => {
return res.id + '--' + res.type
})
this.getSelectList()
}).catch(() => { })
},
getOtherData() {
this.roleLoading = true
this.positionLoading = true
this.groupLoading = true
getRoleSelector().then(res => {
this.treeData2 = res.data.list
this.roleLoading = false
})
getPositionSelector().then(res => {
this.treeData3 = res.data.list
this.positionLoading = false
})
getGroupSelector().then(res => {
this.treeData4 = res.data
this.groupLoading = false
})
},
search() {
this.nodeId = '0'
this.treeData = []
this.pagination.currentPage = 1
this.isAsync = !!this.pagination.keyword
this.finish = false
if (this.isAsync && this.activeName === 'department') {
this.$nextTick(() => {
this.bindScroll()
})
}
this.getData()
},
filterNode(value, data) {
if (!value) return true;
return data[this.props.label].indexOf(value) !== -1;
},
getList() {
this.loading = true
if (this.pagination.keyword) this.nodeId = '0'
getImUserSelector(this.nodeId, this.pagination).then(res => {
if (this.pagination.keyword) {
if (res.data.list.length < this.pagination.pageSize) {
this.finish = true
}
this.treeData = [...this.treeData, ...res.data.list]
this.total = res.data.pagination.total
} else {
this.treeData = res.data.list
}
this.loading = false
})
},
loadNode(node, resolve) {
if (node.level === 0) {
this.nodeId = '0'
return resolve(this.treeData)
}
this.nodeId = node.data.id
getImUserSelector(this.nodeId).then(res => {
resolve(res.data.list)
})
},
handleNodeClick(data) {
const usableList = this.multiple ? ['company', 'department', 'role', 'position', 'group', 'user'] : ['user']
if (!usableList.includes(data.type)) return
const boo = this.selectedData.some(o => o.id === data.id + '--' + data.type)
let item = JSON.parse(JSON.stringify(data))
item.id += '--' + item.type
if (boo) return
this.multiple ? this.selectedData.push(item) : this.selectedData = [item]
this.multiple ? this.ids.push(item.id) : this.ids = [item.id]
this.$emit('input', this.ids)
this.$emit('getValue', this.ids, this.selectedData)
},
removeAll() {
this.selectedData = []
this.ids = []
this.$emit('input', this.ids)
this.$emit('getValue', this.ids, this.selectedData)
},
removeData(id) {
const index = this.selectedData.findIndex((item) => {
return item.id == id
})
if (index != -1) {
this.selectedData.splice(index, 1)
this.ids.splice(index, 1)
}
this.$emit('input', this.ids)
this.$emit('getValue', this.ids, this.selectedData)
},
}
};
</script>

@ -0,0 +1,461 @@
<template>
<el-dialog
:title="!dataForm.id ? '新建分管' : '编辑分管'"
:close-on-click-modal="false"
:visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
width="900px"
>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
v-loading="formLoading"
label-width="100px"
class="JNPF-dialog-gradeManage"
>
<el-alert
title="设置当前组织部门的管理员和相关操作权限"
type="warning"
:closable="false"
show-icon
class="mb-20"
>
</el-alert>
<el-form-item
label="设置管理员"
prop="userId"
v-if="!dataForm.id && userInfo.isAdministrator"
>
<JnpfUserSelect
v-model="dataForm.userId"
placeholder="请选择管理员"
@change="onChange"
:key="key"
/>
</el-form-item>
<el-form-item
label="设置管理员"
prop="userId"
v-if="!dataForm.id && !userInfo.isAdministrator"
>
<grade-user-select
v-model="dataForm.userId"
placeholder="请选择管理员"
@change="onChange"
:key="key"
/>
</el-form-item>
<el-form-item label="设置管理员" prop="userId" v-if="dataForm.id">
<JnpfUserSelect
v-model="dataForm.userId"
placeholder="请选择管理员"
@change="onChange"
:key="key"
disabled
/>
</el-form-item>
<template>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="后台菜单" name="module"></el-tab-pane>
<el-tab-pane label="应用权限" name="system"></el-tab-pane>
<el-tab-pane label="组织权限" name="gradeManage"></el-tab-pane>
</el-tabs>
</template>
<template v-if="activeName != 'gradeManage'">
<el-tree
:data="treeData"
ref="treeData"
v-loading="treeLoading"
show-checkbox
default-expand-all
node-key="id"
:check-strictly="checkStrictly"
check-on-click-node
:props="defaultProps"
:expand-on-click-node="false"
@check-change="selectTreeNodeClick"
style="height: 400px; overflow: auto"
>
<span slot-scope="{ node, data }">
<i :class="data.icon" />
<span style="padding-left: 4px">{{ node.label }}</span>
</span>
</el-tree>
</template>
<template v-else-if="activeName == 'gradeManage'">
<el-table
v-loading="listLoading"
:data="treeList"
row-key="organizeId"
default-expand-all
:tree-props="{ children: 'children', hasChildren: '' }"
style="height: 400px; overflow: auto"
>
<el-table-column prop="fullName" label="组织架构">
<template slot-scope="scope">
<i :class="scope.row.icon"></i>
{{ scope.row.fullName }}
</template>
</el-table-column>
<el-table-column label="组织操作权限(本层级)" width="280">
<template slot-scope="scope">
<template v-if="scope.row.thisLayerSelect === 2">
<el-checkbox checked disabled>查看</el-checkbox>
</template>
<template v-if="scope.row.thisLayerSelect === 3">
<el-checkbox disabled>查看</el-checkbox>
</template>
<template
v-if="
scope.row.thisLayerSelect === 0 ||
scope.row.thisLayerSelect === 1
"
>
<el-checkbox
v-model="scope.row.thisLayerSelect"
:true-label="1"
:false-label="0"
@change="onThisLayerSelectChange($event, scope.row)"
>查看</el-checkbox
>
</template>
<template v-if="scope.row.thisLayerAdd === 2">
<el-checkbox checked disabled>添加</el-checkbox>
</template>
<template v-if="scope.row.thisLayerAdd === 3">
<el-checkbox disabled>添加</el-checkbox>
</template>
<template
v-if="
scope.row.thisLayerAdd === 0 || scope.row.thisLayerAdd === 1
"
>
<el-checkbox
v-model="scope.row.thisLayerAdd"
:true-label="1"
:false-label="0"
:disabled="scope.row.thisLayerSelect === 0"
>添加</el-checkbox
>
</template>
<template v-if="scope.row.thisLayerEdit === 2">
<el-checkbox checked disabled>编辑</el-checkbox>
</template>
<template v-if="scope.row.thisLayerEdit === 3">
<el-checkbox disabled>编辑</el-checkbox>
</template>
<template
v-if="
scope.row.thisLayerEdit === 0 || scope.row.thisLayerEdit === 1
"
>
<el-checkbox
v-model="scope.row.thisLayerEdit"
:true-label="1"
:false-label="0"
:disabled="scope.row.thisLayerSelect === 0"
>编辑</el-checkbox
>
</template>
<template v-if="scope.row.thisLayerDelete === 2">
<el-checkbox checked disabled>删除</el-checkbox>
</template>
<template v-if="scope.row.thisLayerDelete === 3">
<el-checkbox disabled>删除</el-checkbox>
</template>
<template
v-if="
scope.row.thisLayerDelete === 0 ||
scope.row.thisLayerDelete === 1
"
>
<el-checkbox
v-model="scope.row.thisLayerDelete"
:true-label="1"
:false-label="0"
:disabled="scope.row.thisLayerSelect === 0"
>删除</el-checkbox
>
</template>
</template>
</el-table-column>
<el-table-column label="子组织操作权限(子层级)" width="280">
<template slot-scope="scope">
<template v-if="scope.row.subLayerSelect === 2">
<el-checkbox checked disabled>查看</el-checkbox>
</template>
<template v-if="scope.row.subLayerSelect === 3">
<el-checkbox disabled>查看</el-checkbox>
</template>
<template
v-if="
scope.row.subLayerSelect === 0 ||
scope.row.subLayerSelect === 1
"
>
<el-checkbox
v-model="scope.row.subLayerSelect"
:true-label="1"
:false-label="0"
@change="onSubLayerSelectChange($event, scope.row)"
>查看</el-checkbox
>
</template>
<template v-if="scope.row.subLayerAdd === 2">
<el-checkbox checked disabled>添加</el-checkbox>
</template>
<template v-if="scope.row.subLayerAdd === 3">
<el-checkbox disabled>添加</el-checkbox>
</template>
<template
v-if="
scope.row.subLayerAdd === 0 || scope.row.subLayerAdd === 1
"
>
<el-checkbox
v-model="scope.row.subLayerAdd"
:true-label="1"
:false-label="0"
:disabled="scope.row.subLayerSelect === 0"
>添加</el-checkbox
>
</template>
<template v-if="scope.row.subLayerEdit === 2">
<el-checkbox checked disabled>编辑</el-checkbox>
</template>
<template v-if="scope.row.subLayerEdit === 3">
<el-checkbox disabled>编辑</el-checkbox>
</template>
<template
v-if="
scope.row.subLayerEdit === 0 || scope.row.subLayerEdit === 1
"
>
<el-checkbox
v-model="scope.row.subLayerEdit"
:true-label="1"
:false-label="0"
:disabled="scope.row.subLayerSelect === 0"
>编辑</el-checkbox
>
</template>
<template v-if="scope.row.subLayerDelete === 2">
<el-checkbox checked disabled>删除</el-checkbox>
</template>
<template v-if="scope.row.subLayerDelete === 3">
<el-checkbox disabled>删除</el-checkbox>
</template>
<template
v-if="
scope.row.subLayerDelete === 0 ||
scope.row.subLayerDelete === 1
"
>
<el-checkbox
v-model="scope.row.subLayerDelete"
:true-label="1"
:false-label="0"
:disabled="scope.row.subLayerSelect === 0"
>删除</el-checkbox
>
</template>
</template>
</el-table-column>
</el-table>
</template>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{
$t("common.cancelButton")
}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{ $t("common.confirmButton") }}</el-button
>
</span>
</el-dialog>
</template>
<script>
import gradeUserSelect from "./GradeUserSelect";
import { mapGetters } from "vuex";
import {
getSelectorOrgList,
saveGradeManage,
} from "@/api/permission/gradeManage";
export default {
components: { gradeUserSelect },
data() {
return {
visible: false,
formLoading: false,
btnLoading: false,
dataForm: {
id: "",
userId: "",
},
activeName: "module",
listLoading: false,
refreshTable: true,
treeList: [],
dataRule: {
userId: [{ required: true, message: "请选择管理员", trigger: "click" }],
},
treeData: [],
menuTreeData: [],
systemData: [],
checkStrictly: false,
treeLoading: false,
defaultProps: {
//
value: "id",
label: "fullName",
children: "children",
},
moduleIds: [],
systemIds: [],
key: +new Date(),
};
},
computed: {
...mapGetters(["userInfo"]),
},
methods: {
onChange(val) {
if (!val) return;
this.initData();
},
handleClick() {
if (this.activeName === "gradeManage") return;
this.$nextTick(() => {
this.treeData =
this.activeName == "module" ? this.menuTreeData : this.systemData;
const parentIds = this.parentIds(this.treeData);
const childrenIds = this[this.activeName + "Ids"].filter(
(id) => !parentIds.includes(id)
);
this.$refs.treeData.setCheckedKeys(childrenIds);
});
},
parentIds(treeDate) {
const arr = [];
const loop = (list) => {
for (let i = 0; i < list.length; i++) {
const e = list[i];
const children = e.children;
if (children && children.length > 0) {
arr.push(e.id);
loop(children);
}
}
};
loop(treeDate);
return arr;
},
//
selectTreeNodeClick() {
const parentIds = this.$refs.treeData.getHalfCheckedKeys();
const childrenIds = this.$refs.treeData.getCheckedKeys();
const newIds = [...parentIds, ...childrenIds];
const dataIds = [...new Set(newIds)];
this[this.activeName + "Ids"] = dataIds;
},
initData() {
this.activeName = "module";
if (this.dataForm.userId) this.treeLoading = true;
this.listLoading = true;
getSelectorOrgList(this.dataForm.userId || "")
.then((res) => {
this.treeList = res.data.orgAdminList || [];
this.menuTreeData = res.data.modulePermissionList || [];
this.systemData = res.data.systemPermissionList || [];
this.moduleIds = res.data.moduleIds || [];
this.systemIds = res.data.systemIds || [];
this.handleClick();
this.listLoading = false;
this.btnLoading = false;
this.treeLoading = false;
})
.catch(() => {
this.listLoading = false;
this.btnLoading = false;
this.treeLoading = false;
this.dataForm.userId = "";
this.key = +new Date();
});
},
onThisLayerSelectChange(val, row) {
if (val) return;
if (row.thisLayerAdd === 1) this.$set(row, "thisLayerAdd", 0);
if (row.thisLayerEdit === 1) this.$set(row, "thisLayerEdit", 0);
if (row.thisLayerDelete === 1) this.$set(row, "thisLayerDelete", 0);
},
onSubLayerSelectChange(val, row) {
if (val) return;
if (row.subLayerAdd === 1) this.$set(row, "subLayerAdd", 0);
if (row.subLayerEdit === 1) this.$set(row, "subLayerEdit", 0);
if (row.subLayerDelete === 1) this.$set(row, "subLayerDelete", 0);
},
init(id) {
this.treeList = [];
this.treeData = [];
this.dataForm.id = id || "";
this.dataForm.userId = id || "";
this.visible = true;
this.formLoading = true;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
this.dataForm.id = id || "";
this.dataForm.userId = id || "";
this.initData();
this.formLoading = false;
});
this.formLoading = false;
},
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (valid) {
let query = {
...this.dataForm,
orgAdminModel: this.treeList,
systemIds: this.systemIds,
moduleIds: this.moduleIds,
};
this.btnLoading = true;
saveGradeManage(query)
.then((res) => {
this.$message({
message: res.msg,
type: "success",
duration: 1500,
onClose: () => {
this.visible = false;
this.btnLoading = false;
this.$emit("refreshDataList");
},
});
})
.catch(() => {
this.btnLoading = false;
});
}
});
},
},
};
</script>
<style lang="scss" scoped>
.JNPF-dialog-gradeManage {
height: 60vh;
}
.el-checkbox {
margin-right: 0;
}
.el-checkbox + .el-checkbox {
margin-left: 10px;
}
>>> .el-dialog .el-dialog__body {
padding: 20px 20px 2px !important;
}
</style>

@ -0,0 +1,388 @@
<template>
<div class="popupSelect-container">
<div class="el-select" @click.stop="openDialog">
<div class="el-select__tags" v-if="multiple" ref="tags"
:style="{ 'max-width': inputWidth - 32 + 'px', width: '100%',cursor:'pointer' }">
<span v-if="collapseTags && tagsList.length">
<el-tag :closable="!selectDisabled" :size="collapseTagSize" type="info"
@close="deleteTag($event, 0)" disable-transitions>
<span class="el-select__tags-text">{{ tagsList[0].fullName }}</span>
</el-tag>
<el-tag v-if="tagsList.length > 1" :closable="false" type="info" disable-transitions>
<span class="el-select__tags-text">+ {{ tagsList.length - 1 }}</span>
</el-tag>
</span>
<transition-group @after-leave="resetInputHeight" v-if="!collapseTags">
<el-tag v-for="(item,i) in tagsList" :key="item.id" :size="collapseTagSize"
:closable="!selectDisabled" type="info" @close="deleteTag($event, i)"
disable-transitions>
<span class="el-select__tags-text">{{ item.fullName }}</span>
</el-tag>
</transition-group>
</div>
<el-input ref="reference" v-model="innerValue" type="text" :placeholder="currentPlaceholder"
:disabled="selectDisabled" readonly :validate-event="false"
:tabindex="(multiple) ? '-1' : null" @mouseenter.native="inputHovering = true"
@mouseleave.native="inputHovering = false">
<template slot="suffix">
<i v-show="!showClose"
:class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up']"></i>
<i v-if="showClose" class="el-select__caret el-input__icon el-icon-circle-close"
@click="handleClearClick"></i>
</template>
</el-input>
</div>
<el-dialog title="选择用户" :close-on-click-modal="false" :visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center transfer-dialog" lock-scroll append-to-body
width="800px" :modal-append-to-body="false" @close="onClose">
<div class="transfer__body">
<div class="transfer-pane">
<div class="transfer-pane__tools">
<el-input placeholder="请输入关键词查询" v-model="keyword" @keyup.enter.native="getData"
clearable class="search-input">
<el-button slot="append" icon="el-icon-search" @click="getData"></el-button>
</el-input>
</div>
<div class="transfer-pane__body">
<el-tree :data="treeData" :props="props" check-on-click-node
@node-click="handleNodeClick" class="JNPF-common-el-tree" node-key="id"
v-loading="loading" lazy :load="loadNode">
<span class="custom-tree-node" slot-scope="{ node, data }" :title="node.label">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</div>
</div>
<div class="transfer-pane">
<div class="transfer-pane__tools">
<span>已选</span>
<el-button @click="removeAll" type="text" class="removeAllBtn">清空列表</el-button>
</div>
<div class="transfer-pane__body shadow right-pane">
<template v-if="selectedData.length">
<div v-for="(item,index) in selectedData" :key="index" class="selected-item-user">
<div class="selected-item-main">
<el-avatar :size="36" :src="define.comUrl+item.headIcon"
class="selected-item-headIcon">
</el-avatar>
<div class="selected-item-text">
<p class="name">{{item.fullName}}
<i class="el-icon-delete" @click="removeData(index)"></i>
</p>
<p class="organize" :title="item.organize">{{item.organize}}</p>
</div>
</div>
</div>
</template>
<el-empty description="暂无数据" :image-size="120" v-else></el-empty>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="visible=false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" @click="confirm">{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getUserInfoList, getListByAuthorize } from '@/api/permission/user'
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
export default {
name: 'useSelect',
inject: {
elForm: {
default: ''
},
elFormItem: {
default: ''
}
},
props: {
value: {
type: [String, Array],
default: ''
},
placeholder: {
type: String,
default: '请选择'
},
disabled: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
},
collapseTags: {
type: Boolean,
default: false
},
clearable: {
type: Boolean,
default: true
},
hasSys: {
type: Boolean,
default: false
},
size: String,
},
data() {
return {
visible: false,
keyword: '',
activeName: '',
nodeId: '',
innerValue: '',
loading: false,
props: {
children: 'children',
label: 'fullName',
isLeaf: 'isLeaf'
},
treeData: [],
treeData2: [],
treeData3: [],
treeData4: [{
id: 'currentUser',
fullName: '当前用户'
}],
selectedData: [],
tagsList: [],
inputHovering: false,
inputWidth: 0,
initialInputHeight: 0,
}
},
watch: {
value(val) {
this.setDefault()
},
selectDisabled() {
this.$nextTick(() => {
this.resetInputHeight();
});
},
activeName(val) {
this.keyword = ''
if (!val) return
this.nodeId = '0'
this.treeData = []
this.treeData2 = []
this.treeData3 = []
this.getData()
}
},
computed: {
showClose() {
let hasValue = this.multiple
? Array.isArray(this.value) && this.value.length > 0
: this.value !== undefined && this.value !== null && this.value !== '';
let criteria = this.clearable &&
!this.selectDisabled &&
this.inputHovering &&
hasValue;
return criteria;
},
currentPlaceholder() {
if (this.multiple && Array.isArray(this.value) && this.value.length) {
return ''
} else {
return this.placeholder
}
},
selectDisabled() {
return this.disabled || (this.elForm || {}).disabled;
},
_elFormItemSize() {
return (this.elFormItem || {}).elFormItemSize;
},
selectSize() {
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
},
collapseTagSize() {
return ['small', 'mini'].indexOf(this.selectSize) > -1
? 'mini'
: 'small';
},
},
created() {
this.setDefault()
},
mounted() {
addResizeListener(this.$el, this.handleResize);
const reference = this.$refs.reference;
if (reference && reference.$el) {
const sizeMap = {
medium: 36,
small: 32,
mini: 28
};
const input = reference.$el.querySelector('input');
this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
}
if (this.multiple) {
this.resetInputHeight();
}
this.$nextTick(() => {
if (reference && reference.$el) {
this.inputWidth = reference.$el.getBoundingClientRect().width;
}
});
this.setDefault()
},
beforeDestroy() {
if (this.$el && this.handleResize) removeResizeListener(this.$el, this.handleResize);
},
methods: {
onClose() {
this.activeName = ''
},
openDialog() {
if (this.selectDisabled) return
this.visible = true
this.activeName = 'all'
this.keyword = ''
this.nodeId = '0'
this.selectedData = []
this.setDefault()
},
confirm() {
if (this.multiple) {
this.innerValue = ''
this.tagsList = JSON.parse(JSON.stringify(this.selectedData))
let selectedIds = this.selectedData.map(o => o.id)
this.$emit('input', selectedIds)
this.$emit('change', selectedIds, this.selectedData)
} else {
if (!this.selectedData.length) {
this.innerValue = ''
this.$emit('input', '')
this.$emit('change', '', {})
this.visible = false
return
}
this.innerValue = this.selectedData[0].fullName
let selectedIds = this.selectedData.map(o => o.id)
this.$emit('input', selectedIds[0])
this.$emit('change', selectedIds[0], this.selectedData[0])
}
this.visible = false
},
setDefault() {
if (!this.value || !this.value.length) {
this.innerValue = ''
this.selectedData = []
this.tagsList = []
return
}
const arr = this.multiple ? this.value : [this.value]
const hasSysItem = arr.some(o => o === 'currentUser')
getUserInfoList(arr).then(res => {
this.selectedData = res.data.list
if (hasSysItem) {
this.selectedData.push({
id: 'currentUser',
fullName: '当前用户'
})
}
if (this.multiple) {
this.innerValue = ''
this.tagsList = JSON.parse(JSON.stringify(this.selectedData))
} else {
this.innerValue = this.selectedData.length ? this.selectedData[0].fullName : ''
}
this.$nextTick(() => {
if (this.multiple) {
this.resetInputHeight();
}
});
})
},
getData() {
this.nodeId = '0'
this.getAllList()
},
getAllList() {
this.loading = true
if (this.keyword) this.nodeId = '0'
getListByAuthorize(this.nodeId, this.keyword).then(res => {
this.treeData = res.data.list
this.loading = false
})
},
loadNode(node, resolve) {
if (node.level === 0) {
this.nodeId = '0'
return resolve(this.treeData)
}
this.nodeId = node.data.id
getListByAuthorize(this.nodeId).then(res => {
resolve(res.data.list)
})
},
handleNodeClick(data) {
if (data.type !== 'user') return
this.handleNodeClick2(data)
},
handleNodeClick2(data) {
const boo = this.selectedData.some(o => o.id === data.id)
if (boo) return
this.multiple ? this.selectedData.push(data) : this.selectedData = [data]
},
removeAll() {
this.selectedData = []
},
removeData(index) {
this.selectedData.splice(index, 1)
},
deleteTag(event, index) {
this.selectedData.splice(index, 1)
this.confirm()
event.stopPropagation();
},
handleClearClick(event) {
this.selectedData = []
this.confirm()
event.stopPropagation();
},
resetInputWidth() {
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
},
handleResize() {
this.resetInputWidth();
if (this.multiple) this.resetInputHeight();
},
resetInputHeight() {
if (this.collapseTags) return;
this.$nextTick(() => {
if (!this.$refs.reference) return;
let inputChildNodes = this.$refs.reference.$el.childNodes;
let input = [].filter.call(inputChildNodes, item => item.tagName === 'INPUT')[0];
const tags = this.$refs.tags;
const tagsHeight = tags ? Math.round(tags.getBoundingClientRect().height) : 0;
const sizeInMap = this.initialInputHeight || 40;
input.style.height = this.selectedData.length === 0
? sizeInMap + 'px'
: Math.max(
tags ? (tagsHeight + (tagsHeight > sizeInMap ? 6 : 0)) : 0,
sizeInMap
) + 'px';
});
},
resetInputWidth() {
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
},
handleResize() {
this.resetInputWidth();
if (this.multiple) this.resetInputHeight();
}
},
}
</script>

@ -0,0 +1,139 @@
<template>
<div class="JNPF-common-layout JNPF-flex-main">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item :label="$t('common.keyword')">
<el-input v-model="keyword" :placeholder="$t('common.enterKeyword')" clearable
@keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<topOpts @add="addOrUpdateHandle()"></topOpts>
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list">
<el-table-column prop="account" label="账号" width="100" />
<el-table-column prop="realName" label="姓名" width="100" />
<el-table-column prop="gender" label="性别" width="90" align="center">
<template slot-scope="scope" sortable>
<span>{{ scope.row.gender ==1 ? '男': ( scope.row.gender == 2 ? '女' : '保密') }}</span>
</template>
</el-table-column>
<el-table-column prop="mobilePhone" label="手机" width="120" />
<el-table-column prop="organizeId" label="所属组织" min-width="200" show-overflow-tooltip />
<el-table-column prop="creatorTime" label="创建时间" :formatter="jnpf.tableDateFormat"
width="120" />
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)">
</tableOpts>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
<Form v-if="formVisible" ref="Form" @refreshDataList="initData" />
</div>
</div>
</template>
<script>
import { getGradeManageList, delGradeManage } from '@/api/permission/gradeManage'
import Form from './Form'
export default {
components: {
Form
},
name: 'permission-grade',
data() {
return {
list: [],
categoryList: [],
keyword: '',
listQuery: {
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
},
total: 0,
listLoading: true,
formVisible: false,
}
},
created() {
this.initData()
},
methods: {
reset() {
this.keyword = ''
this.search()
},
search() {
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
}
this.initData()
},
initData() {
this.listLoading = true
let query = {
...this.listQuery,
keyword: this.keyword
}
getGradeManageList(query).then(res => {
this.list = res.data.list
this.total = res.data.pagination.total
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
addOrUpdateHandle(id) {
this.formVisible = true
this.$nextTick(() => {
this.$refs.Form.init(id)
})
},
handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), {
type: 'warning'
}).then(() => {
delGradeManage(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.initData()
}
})
})
}).catch(() => { })
},
}
}
</script>

@ -0,0 +1,116 @@
<template>
<el-dialog :title="!dataForm.id?'新建分组':'编辑分组'" :close-on-click-modal="false"
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="600px">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" v-loading="formLoading"
label-width="100px">
<el-form-item label="分组名称" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="输入分组名称" maxlength="50" />
</el-form-item>
<el-form-item label="分组编码" prop="enCode">
<el-input v-model="dataForm.enCode" placeholder="输入分组编码" />
</el-form-item>
<el-form-item label="分组类型" prop="type">
<el-select v-model="dataForm.type" placeholder="请选择分组类型" filterable>
<el-option v-for="item in typeOptions" :key="item.id" :label="item.fullName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode"
controls-position="right" />
</el-form-item>
<el-form-item label="状态" prop="enabledMark">
<el-switch v-model="dataForm.enabledMark" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" type="textarea" :rows="3" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getGroupInfo, createGroup, updateGroup } from '@/api/permission/group'
export default {
data() {
return {
visible: false,
formLoading: false,
btnLoading: false,
typeOptions: [],
dataForm: {
id: '',
fullName: '',
enCode: '',
type: '',
sortCode: 0,
enabledMark: 1,
description: ''
},
dataRule: {
fullName: [
{ required: true, message: '请输入分组名称', trigger: 'blur' },
{ validator: this.formValidate('fullName', '分组名称不能含有特殊符号'), trigger: 'blur' }
],
enCode: [
{ required: true, message: '请输入分组编码', trigger: 'blur' },
{ validator: this.formValidate('enCode', '分组编码只能输入英文、数字和小数点且小数点不能放在首尾'), trigger: 'blur' },
{ max: 50, message: '分组编码最多为50个字符', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择分组类型', trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.formLoading = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.$store.dispatch('base/getDictionaryData', { sort: 'groupType' }).then(res => {
this.typeOptions = res
})
if (this.dataForm.id) {
getGroupInfo(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
this.formLoading = false
},
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.btnLoading = true
const formMethod = this.dataForm.id ? updateGroup : createGroup
formMethod(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.$store.commit('generator/SET_GROUP_TREE', [])
this.visible = false
this.btnLoading = false
this.$emit('refreshDataList')
}
})
}).catch(() => {
this.btnLoading = false
})
}
})
}
}
}
</script>

@ -0,0 +1,172 @@
<template>
<div class="JNPF-common-layout JNPF-flex-main">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item :label="$t('common.keyword')">
<el-input v-model="keyword" :placeholder="$t('common.enterKeyword')" clearable
@keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<topOpts @add="addOrUpdateHandle()"></topOpts>
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list">
<el-table-column prop="fullName" label="分组名称" width="200" />
<el-table-column prop="enCode" label="分组编码" width="150" />
<el-table-column prop="type" label="分组类型" width="150" />
<el-table-column prop="description" label="说明" min-width="100" show-overflow-tooltip />
<el-table-column prop="creatorTime" label="创建时间" :formatter="jnpf.tableDateFormat"
width="120" />
<el-table-column prop="enabledMark" label="状态" width="70" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.enabledMark == 1 ? 'success' : 'danger'" disable-transitions>
{{scope.row.enabledMark==1?'启用':'禁用'}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="sortCode" label="排序" width="70" align="center" />
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)">
<el-dropdown hide-on-click>
<span class="el-dropdown-link">
<el-button type="text" size="mini">
{{$t('common.moreBtn')}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
@click.native="handleUserRelation(scope.row.id, scope.row.fullName)">
组内成员
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</tableOpts>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
<Form v-if="formVisible" ref="Form" @refreshDataList="initData" />
<UserRelationList v-if="userRelationListVisible" ref="UserRelationList"
@refreshDataList="initData" />
</div>
</div>
</template>
<script>
import { getGroupList, delGroup } from '@/api/permission/group'
import Form from './Form'
import UserRelationList from '@/views/permission/userRelation/Selector'
export default {
components: {
Form,
UserRelationList
},
name: 'permission-group',
data() {
return {
list: [],
categoryList: [],
keyword: '',
listQuery: {
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
},
total: 0,
listLoading: true,
formVisible: false,
userRelationListVisible: false
}
},
created() {
this.initData()
},
methods: {
reset() {
this.keyword = ''
this.search()
},
search() {
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
}
this.initData()
},
initData() {
this.listLoading = true
let query = {
...this.listQuery,
keyword: this.keyword
}
getGroupList(query).then(res => {
this.list = res.data.list
this.total = res.data.pagination.total
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
addOrUpdateHandle(id) {
this.formVisible = true
this.$nextTick(() => {
this.$refs.Form.init(id)
})
},
removeUserRelationList(isRefresh) {
this.userRelationListVisible = false
if (isRefresh) {
this.initData()
}
},
handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), {
type: 'warning'
}).then(() => {
delGroup(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.$store.commit('generator/SET_GROUP_TREE', [])
this.initData()
}
})
})
}).catch(() => { })
},
handleUserRelation(id, fullName) {
this.userRelationListVisible = true
this.$nextTick(() => {
this.$refs.UserRelationList.init(id, fullName, 'Group')
})
}
}
}
</script>

@ -0,0 +1,264 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main org-form">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack"
:content="!dataForm.id ? $t(`Organize.addCompany`) : $t(`Organize.editCompany`)" />
<div class="options">
<el-button type="primary" :loading="btnLoading" @click="handleConfirm()">
{{$t('common.confirmButton')}}</el-button>
<el-button @click="goBack">{{$t('common.cancelButton')}}</el-button>
</div>
</div>
<div class="main" v-loading="formLoading">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="80px">
<div class="JNPF-common-title mb-20">
<h2 class="bold">基础信息</h2>
</div>
<el-row :gutter="20" class="custom-row">
<el-col :sm="12" :xs="24">
<el-form-item label="上级公司" prop="parentId">
<JnpfOrganizeSelect v-model="organizeIdTree" placeholder="选择上级公司" auth isOnlyOrg
@change="onOrganizeChange" :currOrgId="dataForm.id||'0'"
:parentId="parentId||'0'" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="公司名称" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="输入名称" maxlength="50" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="公司编码" prop="enCode">
<el-input v-model="dataForm.enCode" placeholder="输入公司编码" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="公司简称" prop="propertyJson.shortName">
<el-input v-model="dataForm.propertyJson.shortName" placeholder="输入公司简称" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="公司性质" prop="propertyJson.enterpriseNature">
<JnpfTreeSelect v-model="dataForm.propertyJson.enterpriseNature"
:options="natureData" placeholder="请选择公司性质" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="所属行业" prop="propertyJson.industry">
<JnpfTreeSelect v-model="dataForm.propertyJson.industry" :options="industryData"
placeholder="请选择所属行业" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="成立时间" prop="propertyJson.foundedTime">
<el-date-picker v-model="dataForm.propertyJson.foundedTime" type="date"
value-format="timestamp" placeholder="选择日期" :picker-options="pickerOptions"
style="width: 100%">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="公司电话" prop="propertyJson.telePhone">
<el-input v-model="dataForm.propertyJson.telePhone" placeholder="输入公司电话" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="公司传真" prop="propertyJson.fax">
<el-input v-model="dataForm.propertyJson.fax" placeholder="输入公司传真" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="公司主页" prop="propertyJson.webSite">
<el-input v-model="dataForm.propertyJson.webSite" placeholder="输入公司主页" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="公司地址" prop="propertyJson.address">
<el-input v-model="dataForm.propertyJson.address" placeholder="输入公司地址" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode"
controls-position="right" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" type="textarea" :rows="3" />
</el-form-item>
</el-col>
</el-row>
<div class="JNPF-common-title mb-20">
<h2 class="bold">经营信息</h2>
</div>
<el-row :gutter="20" class="custom-row">
<el-col :sm="12" :xs="24">
<el-form-item label="公司法人" prop="propertyJson.managerName">
<el-input v-model="dataForm.propertyJson.managerName" placeholder="输入公司法人" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="联系电话" prop="propertyJson.managerTelePhone">
<el-input v-model="dataForm.propertyJson.managerTelePhone" placeholder="输入联系电话" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="联系手机" prop="propertyJson.managerMobilePhone">
<el-input v-model="dataForm.propertyJson.managerMobilePhone" placeholder="输入联系手机" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="联系邮箱" prop="propertyJson.manageEmail">
<el-input v-model="dataForm.propertyJson.manageEmail" placeholder="输入联系邮箱" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="开户银行" prop="propertyJson.bankName">
<el-input v-model="dataForm.propertyJson.bankName" placeholder="输入开户银行" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="银行账户" prop="propertyJson.bankAccount">
<el-input v-model="dataForm.propertyJson.bankAccount" placeholder="输入银行账户" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="经营范围" prop="propertyJson.businessscope">
<el-input v-model="dataForm.propertyJson.businessscope" type="textarea" :rows="3" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</transition>
</template>
<script>
import { createOrganize, updateOrganize, getOrganizeInfo } from '@/api/permission/organize'
export default {
data() {
return {
visible: false,
btnLoading: false,
formLoading: false,
dataForm: {
id: '',
parentId: '',
fullName: '',
enCode: '',
enabledMark: 1,
sortCode: 0,
description: '',
propertyJson: {
shortName: '',
enterpriseNature: '',
industry: '',
foundedTime: '',
telePhone: '',
fax: '',
webSite: '',
address: '',
managerName: '',
managerTelePhone: '',
managerMobilePhone: '',
manageEmail: '',
bankName: '',
bankAccount: '',
businessscope: ''
}
},
parentId: '',
organizeIdTree: [],
natureData: [],
industryData: [],
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
}
},
dataRule: {
parentId: [
{ required: true, message: '上级公司不能为空', trigger: 'change' }
],
fullName: [
{ required: true, message: '请输入公司名称', trigger: 'blur' }
],
enCode: [
{ required: true, message: '请输入公司编码', trigger: 'blur' },
{ validator: this.formValidate('enCode', '公司编码只能输入英文、数字和小数点且小数点不能放在首尾'), trigger: 'blur' },
{ max: 50, message: '公司编码最多为50个字符', trigger: 'blur' }
],
}
}
},
methods: {
init(id, parentId) {
this.visible = true
this.dataForm.id = id || ''
this.parentId = parentId || ''
this.organizeIdTree = []
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
//
this.$store.dispatch('base/getDictionaryData', { sort: 'EnterpriseNature' }).then(res => {
this.natureData = res
})
//
this.$store.dispatch('base/getDictionaryData', { sort: 'IndustryType' }).then(res => {
this.industryData = res
})
if (this.dataForm.id) {
this.formLoading = true
getOrganizeInfo(this.dataForm.id).then(res => {
this.dataForm = res.data
this.organizeIdTree = res.data.organizeIdTree || []
const propertyJson = res.data.propertyJson ? JSON.parse(res.data.propertyJson) : {}
this.dataForm.propertyJson = propertyJson
this.formLoading = false
}).catch(() => { this.formLoading = false })
}
})
},
goBack() {
this.$emit('close')
},
onOrganizeChange(val) {
if (!val || !val.length) return this.dataForm.parentId = ''
this.dataForm.parentId = val[val.length - 1]
},
handleConfirm() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.btnLoading = true
const formMethod = this.dataForm.id ? updateOrganize : createOrganize
formMethod(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$store.commit('generator/SET_COMPANY_TREE', [])
this.$store.commit('generator/SET_DEP_TREE', [])
this.$emit('close', true)
}
})
}).catch(() => {
this.btnLoading = false
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.main {
padding: 10px 30px 0;
}
</style>

@ -0,0 +1,142 @@
<template>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center transfer-dialog" lock-scroll append-to-body width="600px"
:modal-append-to-body="false">
<div class="transfer__body">
<div class="transfer-pane">
<div class="transfer-pane__tools">
<el-input placeholder="请输入关键词查询" v-model="listQuery.keyword" @keyup.enter.native="search"
clearable class="search-input">
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
<div class="transfer-pane__body shadow right-pane"
v-loading="loading && listQuery.currentPage==1" ref="list">
<template v-if="list.length">
<div v-for="(item,index) in list" :key="index" class="selected-item-user">
<div class="selected-item-main">
<el-avatar :size="36" :src="define.comUrl+item.headIcon"
class="selected-item-headIcon">
</el-avatar>
<div class="selected-item-text">
<p class="name">{{item.realName}}/{{item.account}}
</p>
<p class="organize" :title="item.organize">{{item.organize}}</p>
</div>
</div>
</div>
</template>
<el-empty description="暂无数据" :image-size="120" v-else></el-empty>
</div>
</div>
</div>
</el-dialog>
</template>
<script>
import {
getUserList
} from '@/api/permission/user'
import { removeResizeListener } from 'element-ui/src/utils/resize-event';
export default {
name: 'useSelect',
data() {
return {
visible: false,
title: '',
list: [],
listQuery: {
organizeId: '',
keyword: '',
currentPage: 1,
pageSize: 20
},
finish: false,
loading: false
}
},
beforeDestroy() {
if (this.$el && this.handleResize) removeResizeListener(this.$el, this.handleResize);
},
methods: {
init(id, name) {
this.visible = true
this.list = []
this.title = '查看成员 - ' + name || ''
this.listQuery.organizeId = id
this.listQuery.keyword = ''
this.listQuery.currentPage = 1
this.finish = false
this.loading = false
this.initData()
this.$nextTick(() => {
this.bindScroll()
})
},
search() {
this.list = []
this.finish = false
this.loading = false
this.listQuery.currentPage = 1
this.listQuery.sort = 'desc'
this.initData()
},
reset() {
this.listQuery.keyword = ''
this.search()
},
initData() {
this.loading = true
getUserList(this.listQuery).then(res => {
if (res.data.list.length < this.listQuery.pageSize) this.finish = true
this.list = [...this.list, ...res.data.list]
this.loading = false
}).catch(() => {
this.loading = false
})
},
bindScroll() {
let _this = this,
vBody = _this.$refs.list;
vBody.addEventListener("scroll", function () {
if (vBody.scrollHeight - vBody.clientHeight - vBody.scrollTop <= 200 && !_this.loading && !_this.finish) {
_this.listQuery.currentPage += 1
_this.initData()
}
});
},
confirm() {
this.visible = false
},
handleResize() {
this.resetInputWidth();
if (this.multiple) this.resetInputHeight();
},
},
}
</script>
<style lang="scss" scoped>
>>> .transfer__body {
line-height: 32px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-pack: distribute;
justify-content: space-around;
margin-top: -10px;
height: 400px;
}
.transfer__body .transfer-pane {
width: 570px;
}
.transfer__body .selected-item-user .selected-item-text {
width: 480px;
margin-left: 10px;
}
.JNPF-dialog.JNPF-dialog_center .el-dialog .el-dialog__body {
overflow: auto;
overflow-x: hidden;
max-height: 90vh;
padding: 20px 50px 2px;
}
</style>

@ -0,0 +1,123 @@
<template>
<el-dialog
:title="!dataForm.id ? $t(`department.addDepartment`) : $t(`department.editDepartment`)"
:close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="visible" lock-scroll
class="JNPF-dialog JNPF-dialog_center" width="600px">
<el-form ref="dataForm" v-loading="formLoading" :model="dataForm" :rules="dataRule"
label-width="80px">
<el-form-item label="所属组织" prop="parentId">
<JnpfOrganizeSelect v-model="organizeIdTree" placeholder="选择所属组织" auth
@change="onOrganizeChange" :currOrgId="dataForm.id||'0'" />
</el-form-item>
<el-form-item label="部门名称" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="输入名称" />
</el-form-item>
<el-form-item label="部门编码" prop="enCode">
<el-input v-model="dataForm.enCode" placeholder="输入编码" />
</el-form-item>
<el-form-item label="部门主管" prop="managerId">
<JnpfUserSelect v-model="dataForm.managerId" placeholder="选择部门主管" />
</el-form-item>
<el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode"
controls-position="right" />
</el-form-item>
<el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" type="textarea" :rows="3" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { createDepartment, updateDepartment, getDepartmentInfo } from '@/api/permission/department'
export default {
data() {
return {
visible: false,
formLoading: false,
btnLoading: false,
dataForm: {
id: '',
parentId: '',
managerId: '',
fullName: '',
enCode: '',
sortCode: 0,
enabledMark: 1,
description: ''
},
organizeIdTree: [],
dataRule: {
parentId: [
{ required: true, message: '所属组织不能为空', trigger: 'change' }
],
fullName: [
{ required: true, message: '请输入部门名称', trigger: 'blur' },
{ validator: this.formValidate('fullName', '部门名称不能含有特殊符号'), trigger: 'blur' },
{ max: 50, message: '部门名称最多为50个字符', trigger: 'blur' }
],
enCode: [
{ required: true, message: '请输入部门编码', trigger: 'blur' },
{ validator: this.formValidate('enCode', '部门编码只能输入英文、数字和小数点且小数点不能放在首尾'), trigger: 'blur' },
{ max: 50, message: '部门编码最多为50个字符', trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.visible = true
this.dataForm.id = id || ''
this.organizeIdTree = []
this.formLoading = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
getDepartmentInfo(this.dataForm.id).then(res => {
this.dataForm = res.data
this.organizeIdTree = res.data.organizeIdTree
this.formLoading = false
})
} else {
this.formLoading = false
}
})
},
onOrganizeChange(val) {
if (!val || !val.length) return this.dataForm.parentId = ''
this.dataForm.parentId = val[val.length - 1]
},
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.btnLoading = true
const formMethod = this.dataForm.id ? updateDepartment : createDepartment
formMethod(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$store.commit('generator/SET_COMPANY_TREE', [])
this.$store.commit('generator/SET_DEP_TREE', [])
this.$emit('close', true)
}
})
}).catch(() => {
this.btnLoading = false
})
}
})
}
}
}
</script>

@ -0,0 +1,228 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-center JNPF-flex-main">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item :label="$t('common.keyword')">
<el-input v-model="listQuery.keyword" :placeholder="$t('common.enterKeyword')"
clearable @keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<el-dropdown>
<el-button type="primary" icon="el-icon-plus">
新建<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="addOrUpdateHandle('','company')">新建公司
</el-dropdown-item>
<el-dropdown-item @click.native="addOrUpdateHandle()">新建部门</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" content="展开" placement="top">
<el-link v-show="!expands" type="text"
icon="icon-ym icon-ym-btn-expand JNPF-common-head-icon" :underline="false"
@click="toggleExpand()" />
</el-tooltip>
<el-tooltip effect="dark" content="折叠" placement="top">
<el-link v-show="expands" type="text"
icon="icon-ym icon-ym-btn-collapse JNPF-common-head-icon" :underline="false"
@click="toggleExpand()" />
</el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="treeList" row-key="id" v-if="refreshTable"
:default-expand-all="expands" :tree-props="{children: 'children', hasChildren: ''}">
<el-table-column prop="fullName" label="名称">
<template slot-scope="scope">
<i :class="'table-icon icon-my '+scope.row.icon"></i>{{scope.row.fullName}}
</template>
</el-table-column>
<el-table-column prop="enCode" label="编码" />
<el-table-column prop="index" label="层级" width="100" align="center" />
<el-table-column prop="type" label="类型" width="100" align="center">
<template slot-scope="scope">
{{scope.row.type==='company'?'公司':'部门'}}
</template>
</el-table-column>
<el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间"
width="120" />
<el-table-column prop="sortCode" label="排序" width="70" align="center" />
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id,scope.row.type,scope.row.parentId)"
@del="handleDel(scope.row.id)">
<el-dropdown>
<span class="el-dropdown-link">
<el-button type="text" size="mini">{{$t('common.moreBtn')}}<i
class="el-icon-arrow-down el-icon--right"></i>
</el-button>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="checkMembers(scope.row.id,scope.row.fullName)">
查看成员</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</tableOpts>
</template>
</el-table-column>
</JNPF-table>
</div>
</div>
<Form v-show="formVisible" ref="Form" @close="closeForm" />
<DepForm v-if="depFormVisible" ref="depForm" @close="closeDepForm" />
<CheckUser v-if="checkUserFormVisible" ref="checkUserForm"
@close="checkUserFormVisible=false" />
</div>
</template>
<script>
import { getOrganizeList, delOrganize } from '@/api/permission/organize'
import Form from './Form'
import DepForm from './depForm'
import CheckUser from './checkUser.vue'
export default {
name: 'permission-organize',
components: { Form, DepForm, CheckUser },
data() {
return {
listQuery: {
keyword: ''
},
treeList: [],
expands: true,
refreshTable: true,
btnLoading: false,
listLoading: true,
formVisible: false,
depFormVisible: false,
checkUserFormVisible: false
}
},
created() {
this.initData()
},
methods: {
initData() {
this.loading = true
getOrganizeList(this.listQuery).then(res => {
this.treeList = res.data.list
if (this.treeList.length > 0) this.setTableIndex(this.treeList);
this.listLoading = false
this.btnLoading = false
}).catch(() => {
this.listLoading = false
this.btnLoading = false
})
},
search() {
this.initData()
},
// index
setTableIndex(arr, index) {
arr.forEach((item) => {
item.index = 1;
if (index) item.index = index + 1;
if (item.children) this.setTableIndex(item.children, item.index);
});
},
reset() {
this.listQuery.keyword = ''
this.initData()
},
addOrUpdateHandle(id, type, parentId) {
if (type === 'company') {
this.addOrUpdateOrganize(id, parentId)
} else {
this.addOrUpdateDep(id)
}
},
addOrUpdateOrganize(id, parentId) {
this.formVisible = true
this.$nextTick(() => {
this.$refs.Form.init(id, parentId)
})
},
addOrUpdateDep(id) {
this.depFormVisible = true
this.$nextTick(() => {
this.$refs.depForm.init(id)
})
},
closeForm(isRefresh) {
this.formVisible = false
if (isRefresh) {
this.keyword = ''
this.initData()
}
},
closeDepForm(isRefresh) {
this.depFormVisible = false
if (isRefresh) {
this.keyword = ''
this.initData()
}
},
checkMembers(id, name) {
this.checkUserFormVisible = true
this.$nextTick(() => {
this.$refs.checkUserForm.init(id, name)
})
},
checkUser() {
},
toggleExpand() {
this.refreshTable = false;
this.expands = !this.expands;
this.$nextTick(() => {
this.refreshTable = true;
});
},
handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), {
type: 'warning'
}).then(() => {
delOrganize(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.$store.commit('generator/SET_COMPANY_TREE', [])
this.$store.commit('generator/SET_DEP_TREE', [])
this.initData()
}
})
})
}).catch(() => { })
}
}
}
</script>
<style lang="scss" scoped>
.table-icon {
vertical-align: bottom;
font-size: 16px;
margin-right: 6px;
line-height: 23px;
}
</style>

@ -0,0 +1,133 @@
<template>
<el-dialog :title="!dataForm.id ? $t(`position.newPost`) : $t(`position.editPost`)"
:close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="visible" lock-scroll
class="JNPF-dialog JNPF-dialog_center" width="600px">
<el-form ref="dataForm" v-loading="formLoading" :model="dataForm" :rules="dataRule"
label-width="90px">
<el-form-item label="所属组织" prop="organizeId">
<JnpfOrganizeSelect v-model="organizeIdTree" placeholder="选择所属组织" auth
@change="onOrganizeChange" />
</el-form-item>
<el-form-item label="岗位名称" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="输入名称" />
</el-form-item>
<el-form-item label="岗位编码" prop="enCode">
<el-input v-model="dataForm.enCode" placeholder="输入编码" />
</el-form-item>
<el-form-item label="岗位类型" prop="type">
<el-select v-model="dataForm.type" placeholder="请选择类型" filterable>
<el-option v-for="item in typeOptions" :key="item.enCode" :label="item.fullName"
:value="item.enCode">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode"
controls-position="right" />
</el-form-item>
<el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" type="textarea" :rows="3" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { createPosition, updatePosition, getPositionInfo } from '@/api/permission/position'
export default {
data() {
return {
visible: false,
formLoading: false,
btnLoading: false,
typeOptions: [],
dataForm: {
id: '',
organizeId: '',
fullName: '',
type: '',
enCode: '',
enabledMark: 1,
sortCode: 0,
description: ''
},
organizeIdTree: [],
dataRule: {
organizeId: [
{ required: true, message: '所属组织不能为空', trigger: 'change' }
],
fullName: [
{ required: true, message: '请输入岗位名称', trigger: 'blur' },
{ validator: this.formValidate('fullName', '岗位名称不能含有特殊符号'), trigger: 'blur' },
{ max: 50, message: '岗位名称最多为50个字符', trigger: 'blur' }
],
enCode: [
{ required: true, message: '请输入岗位编码', trigger: 'blur' },
{ validator: this.formValidate('userAccount', '岗位编码只能是数字、英文'), trigger: 'blur' },
{ max: 50, message: '岗位编码最多为50个字符', trigger: 'blur' }
],
type: [
{ required: true, message: '岗位类型不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init(id, organizeId, organizeIdTree) {
this.visible = true
this.dataForm.id = id || ''
this.organizeIdTree = []
this.formLoading = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
//
this.$store.dispatch('base/getDictionaryData', { sort: 'PositionType' }).then(res => {
this.typeOptions = res
})
if (this.dataForm.id) {
getPositionInfo(this.dataForm.id).then(res => {
this.dataForm = res.data
this.organizeIdTree = res.data.organizeIdTree
})
} else {
this.dataForm.organizeId = organizeId
this.organizeIdTree = organizeIdTree
}
this.formLoading = false
})
},
onOrganizeChange(val) {
if (!val || !val.length) return this.dataForm.organizeId = ''
this.dataForm.organizeId = val[val.length - 1]
},
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.btnLoading = true
const formMethod = this.dataForm.id ? updatePosition : createPosition
formMethod(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$emit('refreshDataList')
}
})
}).catch(() => {
this.btnLoading = false
})
}
})
}
}
}
</script>

@ -0,0 +1,263 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-left">
<div class="JNPF-common-title">
<h2>{{$t('common.organization')}}</h2>
<span class="options">
<el-dropdown>
<el-link icon="icon-ym icon-ym-mpMenu" :underline="false" />
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="getOrganizeList()">刷新数据</el-dropdown-item>
<el-dropdown-item @click.native="toggleExpand(true)">展开全部</el-dropdown-item>
<el-dropdown-item @click.native="toggleExpand(false)">折叠全部</el-dropdown-item>
<el-dropdown-item @click.native="showDiagram">架构图</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</div>
<div class="JNPF-common-tree-search-box">
<el-input placeholder="输入关键字" v-model="filterText" suffix-icon="el-icon-search" clearable />
</div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps" :default-expand-all="expands"
highlight-current :expand-on-click-node="false" node-key="id"
@node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode">
<span class="custom-tree-node" slot-scope="{ data }" :title="data.fullName">
<i :class="data.icon" />
<span class="text" :title="data.fullName">{{data.fullName}}</span>
</span>
</el-tree>
</el-scrollbar>
</div>
<div class="JNPF-common-layout-center JNPF-flex-main">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item :label="$t('common.keyword')">
<el-input v-model="listQuery.keyword" :placeholder="$t('common.enterKeyword')"
clearable @keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<topOpts @add="addOrUpdateHandle()" />
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="tableData">
<el-table-column prop="fullName" label="岗位名称" width="200" />
<el-table-column prop="enCode" label="岗位编码" width="150" />
<el-table-column prop="type" label="岗位类型" width="100" />
<el-table-column prop="department" label="所属组织" min-width="150" show-overflow-tooltip />
<el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间"
width="120" />
<el-table-column prop="sortCode" label="排序" width="70" align="center" />
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)">
<el-dropdown hide-on-click>
<span class="el-dropdown-link">
<el-button type="text" size="mini">
{{$t('common.moreBtn')}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
@click.native="handleUserRelation(scope.row.id, scope.row.fullName)">
{{$t('position.postMember')}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</tableOpts>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
</div>
<Form v-if="formVisible" ref="Form" @refreshDataList="initData" />
<Diagram v-if="diagramVisible" ref="Diagram" @close="diagramVisible = false" />
<UserRelationList v-if="userRelationListVisible" ref="UserRelationList"
@refreshDataList="getOrganizeList" />
</div>
</template>
<script>
import { getDepartmentSelectorByAuth } from '@/api/permission/department'
import { getPositionList, delPosition } from '@/api/permission/position'
import Form from './Form'
import Diagram from '@/views/permission/user/Diagram'
import UserRelationList from './userRelation'
export default {
name: 'permission-position',
components: { Form, UserRelationList, Diagram },
data() {
return {
treeData: [],
tableData: [],
treeLoading: false,
listLoading: false,
authorizeFormVisible: false,
userRelationListVisible: false,
organizeIdTree: [],
listQuery: {
organizeId: '',
keyword: '',
currentPage: 1,
pageSize: 20
},
defaultProps: {
children: 'children',
label: 'fullName'
},
total: 0,
diagramVisible: false,
formVisible: false,
expands: true,
refreshTree: true,
filterText: ''
}
},
watch: {
filterText(val) {
this.$refs.treeBox.filter(val)
}
},
created() {
this.getOrganizeList(true)
},
methods: {
showDiagram() {
this.diagramVisible = true
this.$nextTick(() => {
this.$refs.Diagram.init()
})
},
toggleExpand(expands) {
this.filterText = ''
this.refreshTree = false
this.expands = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(this.companyId)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data.fullName.indexOf(value) !== -1;
},
getOrganizeList(isInit) {
this.filterText = ''
this.treeLoading = true
getDepartmentSelectorByAuth().then(res => {
this.treeData = res.data.list
this.$nextTick(() => {
this.treeLoading = false
if (isInit) this.initData()
})
}).catch(() => {
this.treeLoading = false
})
},
initData() {
this.listLoading = true
getPositionList(this.listQuery).then(res => {
this.tableData = res.data.list
this.total = res.data.pagination.total
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
search() {
this.listQuery = {
...this.listQuery,
currentPage: 1,
pageSize: 20
}
this.initData()
},
reset() {
this.listQuery.keyword = ''
this.search()
},
handleNodeClick(data, node) {
if (this.listQuery.organizeId === data.id) return
this.listQuery.organizeId = data.id
const nodePath = this.getNodePath(node)
this.organizeIdTree = nodePath.map(o => o.id)
this.reset()
},
getNodePath(node) {
let fullPath = []
const loop = (node) => {
if (node.level) fullPath.unshift(node.data)
if (node.parent) loop(node.parent)
}
loop(node)
return fullPath
},
addOrUpdateHandle(id) {
this.formVisible = true
this.$nextTick(() => {
this.$refs.Form.init(id, this.listQuery.organizeId, this.organizeIdTree)
})
},
removeUserRelationList(isRefresh) {
this.userRelationListVisible = false
if (isRefresh) {
this.keyword = ''
this.initData()
}
},
removeAuthorizeForm(isRefresh) {
this.authorizeFormVisible = false
if (isRefresh) {
this.keyword = ''
this.initData()
}
},
handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), {
type: 'warning'
}).then(() => {
delPosition(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.initData()
}
})
})
}).catch(() => { })
},
handleUserRelation(id, fullName) {
this.userRelationListVisible = true
this.$nextTick(() => {
this.$refs.UserRelationList.init(id, fullName)
})
}
}
}
</script>

@ -0,0 +1,152 @@
<template>
<el-dialog :title="pageTitle" :close-on-click-modal="false" :close-on-press-escape="false"
:visible.sync="visible" lock-scroll append-to-body
class="JNPF-dialog JNPF-dialog_center transfer-dialog" width="800px">
<div class="transfer__body" v-loading="allLoading">
<div class="transfer-pane">
<div class="transfer-pane__tools">
<el-input placeholder="请输入关键词查询" v-model="keyword" @keyup.enter.native="search" clearable
class="search-input">
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
<div class="transfer-pane__body left-pane">
<el-tree :data="treeData" :props="props" check-on-click-node @node-click="handleNodeClick"
class="JNPF-common-el-tree" node-key="id" v-loading="loading" default-expand-all
:filter-node-method="filterNode" ref="tree">
<span class="custom-tree-node" slot-scope="{ node, data }">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</div>
</div>
<div class="transfer-pane">
<div class="transfer-pane__tools">
<span>已选</span>
<el-button @click="removeAll" type="text" class="removeAllBtn">清空列表</el-button>
</div>
<div class="transfer-pane__body shadow right-pane">
<template v-if="selectedData.length">
<div v-for="(item,index) in selectedData" :key="index" class="selected-item-user">
<div class="selected-item-main">
<el-avatar :size="36" :src="define.comUrl+item.headIcon"
class="selected-item-headIcon">
</el-avatar>
<div class="selected-item-text">
<p class="name">{{item.fullName}}</p>
<p class="organize" :title="item.organize">{{item.organize}}</p>
</div>
<i class="el-icon-delete" @click="removeData(index)"></i>
</div>
</div>
</template>
<el-empty description="暂无数据" :image-size="120" v-else></el-empty>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getUserRelationList, createUserRelation } from '@/api/permission/userRelation'
import { getUserInfoList, getUsersByPositionId } from '@/api/permission/user'
export default {
data() {
return {
visible: false,
loading: false,
btnLoading: false,
allLoading: false,
pageTitle: '',
dataForm: {
objectId: '',
objectType: 'Position',
userIds: []
},
treeData: [],
selectedData: [],
keyword: '',
props: {
children: 'children',
label: 'fullName',
isLeaf: 'isLeaf'
},
}
},
methods: {
init(id, fullName) {
this.visible = true
this.dataForm.objectId = id
this.dataForm.userIds = []
this.list = []
this.selectedData = []
this.keyword = ''
this.$nextTick(() => {
this.pageTitle = this.$t(`position.postMember`) + ' - ' + fullName
this.allLoading = true
this.initData()
getUserRelationList(this.dataForm.objectId).then(res => {
this.dataForm.userIds = res.data.ids
this.getSelectList()
})
})
},
getSelectList() {
if (!this.dataForm.userIds.length) return this.allLoading = false
getUserInfoList(this.dataForm.userIds).then(res => {
this.selectedData = res.data.list
this.allLoading = false
})
},
search() {
this.$refs.tree && this.$refs.tree.filter(this.keyword)
},
filterNode(value, data) {
if (!value) return true;
return data[this.props.label].indexOf(value) !== -1;
},
initData() {
this.loading = true
getUsersByPositionId({ positionId: this.dataForm.objectId }).then(res => {
this.treeData = res.data
this.loading = false
})
},
handleNodeClick(data) {
if (data.type !== 'user') return
const boo = this.selectedData.some(o => o.id === data.id)
if (boo) return
this.selectedData.push(data)
},
removeAll() {
this.selectedData = []
},
removeData(index) {
this.selectedData.splice(index, 1)
},
dataFormSubmit() {
this.btnLoading = true
this.dataForm.userIds = this.selectedData.map(o => o.id)
createUserRelation(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
}
})
}).catch(() => {
this.btnLoading = false
})
}
}
}
</script>

@ -0,0 +1,121 @@
<template>
<el-dialog :title="!dataForm.id ? $t(`role.addRole`) : $t(`role.editRole`)"
:close-on-click-modal="false" :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center"
lock-scroll width="600px">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" v-loading="formLoading"
label-width="100px">
<el-form-item label="角色名称" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="输入角色名称" maxlength="50" />
</el-form-item>
<el-form-item label="角色编码" prop="enCode">
<el-input v-model="dataForm.enCode" placeholder="输入角色编码" />
</el-form-item>
<el-form-item label="角色类型" prop="globalMark">
<el-select v-model="dataForm.globalMark" placeholder="请选择角色类型"
@change="dataForm.organizeIdsTree = []">
<el-option label="全局" :value="1"></el-option>
<el-option label="组织" :value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属组织" prop="organizeIdsTree" v-if="dataForm.globalMark===0">
<JnpfOrganizeSelect v-model="dataForm.organizeIdsTree" placeholder="选择所属组织" multiple
clearable auth />
</el-form-item>
<el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode"
controls-position="right" />
</el-form-item>
<el-form-item label="状态" prop="enabledMark">
<el-switch v-model="dataForm.enabledMark" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" type="textarea" :rows="3" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getRoleInfo, createRole, updateRole } from '@/api/permission/role'
export default {
data() {
return {
visible: false,
formLoading: false,
btnLoading: false,
dataForm: {
fullName: '',
enCode: '',
type: '',
enabledMark: 1,
globalMark: null,
organizeIdsTree: [],
sortCode: 0,
description: ''
},
dataRule: {
fullName: [
{ required: true, message: '请输入角色名称', trigger: 'blur' },
{ validator: this.formValidate('fullName', '角色名称不能含有特殊符号'), trigger: 'blur' },
{ max: 50, message: '角色名称最多为50个字符', trigger: 'blur' }
],
enCode: [
{ required: true, message: '请输入角色编码', trigger: 'blur' },
{ validator: this.formValidate('enCode', '角色编码只能输入英文、数字和小数点且小数点不能放在首尾'), trigger: 'blur' },
{ max: 50, message: '角色编码最多为50个字符', trigger: 'blur' }
],
globalMark: [
{ required: true, message: '请选择角色类型', trigger: 'change' }
],
organizeIdsTree: [
{ required: true, message: '请选择所属组织', trigger: 'click', type: 'array' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.formLoading = true
getRoleInfo(this.dataForm.id).then(res => {
this.dataForm = res.data
this.formLoading = false
})
}
})
},
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.btnLoading = true
const formMethod = this.dataForm.id ? updateRole : createRole
formMethod(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$emit('refreshDataList')
}
})
}).catch(() => {
this.btnLoading = false
})
}
})
}
}
}
</script>

@ -0,0 +1,287 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-left">
<div class="JNPF-common-title">
<h2>{{$t('common.organization')}}</h2>
<span class="options">
<el-dropdown>
<el-link icon="icon-ym icon-ym-mpMenu" :underline="false" />
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="getOrganizeList()">刷新数据</el-dropdown-item>
<el-dropdown-item @click.native="toggleExpand(true)">展开全部</el-dropdown-item>
<el-dropdown-item @click.native="toggleExpand(false)">折叠全部</el-dropdown-item>
<el-dropdown-item @click.native="showDiagram">架构图</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</div>
<div class="JNPF-common-tree-search-box">
<el-input placeholder="输入关键字" v-model="filterText" suffix-icon="el-icon-search" clearable />
</div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps" :default-expand-all="expands"
highlight-current :expand-on-click-node="false" node-key="id"
@node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode">
<span class=" custom-tree-node" slot-scope="{ data }" :title="data.fullName">
<i :class="data.icon" />
<span class="text" :title="data.fullName">{{data.fullName}}</span>
</span>
</el-tree>
</el-scrollbar>
</div>
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item :label="$t('common.keyword')">
<el-input v-model="listQuery.keyword" :placeholder="$t('common.enterKeyword')"
clearable @keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<topOpts @add="addOrUpdateHandle()"></topOpts>
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list">
<el-table-column prop="fullName" label="角色名称" width="200" />
<el-table-column prop="enCode" label="角色编码" width="150" />
<el-table-column prop="type" label="角色类型" width="70" align="center" />
<el-table-column prop="organizeInfo" label="所属组织" min-width="150" show-overflow-tooltip />
<el-table-column prop="creatorTime" label="创建时间" :formatter="jnpf.tableDateFormat"
width="120" />
<el-table-column prop="sortCode" label="排序" width="70" align="center" />
<el-table-column prop="enabledMark" label="状态" width="70" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.enabledMark == 1 ? 'success' : 'danger'" disable-transitions>
{{scope.row.enabledMark==1?'启用':'禁用'}}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="150" fixed="right">
<template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)">
<el-dropdown hide-on-click>
<span class="el-dropdown-link">
<el-button type="text" size="mini">
{{$t('common.moreBtn')}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleUserRelation(scope.row)">
{{$t('role.roleMember')}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</tableOpts>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
<Form v-if="formVisible" ref="Form" @refreshDataList="initData" />
<Diagram v-if="diagramVisible" ref="Diagram" @close="diagramVisible = false" />
<component :is="currentView" v-if="userRelationListVisible" ref="UserRelationList"
@refreshDataList="initData" @closeDialog="userRelationListVisible=false" />
</div>
</div>
</template>
<script>
import { getDepartmentSelectorByAuth } from '@/api/permission/department'
import { getRoleList, delRole, updateRoleState } from '@/api/permission/role'
import Form from './Form'
import UserRelationList from './userRelation'
import GlobalUserRelationList from '@/views/permission/userRelation/Selector'
import Diagram from '@/views/permission/user/Diagram'
import { mapGetters } from "vuex";
export default {
components: { Form, UserRelationList, GlobalUserRelationList, Diagram },
name: 'permission-role',
data() {
return {
treeData: [],
defaultProps: {
children: 'children',
label: 'fullName'
},
list: [],
listQuery: {
organizeId: '',
keyword: '',
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
},
total: 0,
listLoading: true,
treeLoading: false,
formVisible: false,
diagramVisible: false,
userRelationListVisible: false,
currentView: null,
expands: true,
refreshTree: true,
filterText: ''
}
},
watch: {
filterText(val) {
this.$refs.treeBox.filter(val)
}
},
computed: {
...mapGetters(['userInfo'])
},
created() {
this.getOrganizeList(true)
},
methods: {
reset() {
this.listQuery.keyword = ''
this.search()
},
search() {
this.listQuery = {
...this.listQuery,
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
}
this.initData()
},
showDiagram() {
this.diagramVisible = true
this.$nextTick(() => {
this.$refs.Diagram.init()
})
},
toggleExpand(expands) {
this.filterText = ''
this.refreshTree = false
this.expands = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(this.companyId)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data.fullName.indexOf(value) !== -1;
},
getOrganizeList(isInit) {
this.filterText = ''
this.treeLoading = true
getDepartmentSelectorByAuth().then(res => {
if (this.userInfo.isAdministrator) {
let globalItem = {
fullName: "全局",
hasChildren: false,
id: "0",
parentId: "-1",
icon: 'icon-ym icon-ym-global-role'
}
this.treeData = [...res.data.list, globalItem]
} else {
this.treeData = res.data.list || []
}
this.$nextTick(() => {
this.treeLoading = false
if (isInit) this.initData()
})
}).catch(() => {
this.treeLoading = false
})
},
initData() {
this.listLoading = true
getRoleList(this.listQuery).then(res => {
this.list = res.data.list
this.total = res.data.pagination.total
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
addOrUpdateHandle(id) {
this.formVisible = true
this.$nextTick(() => {
this.$refs.Form.init(id)
})
},
handleNodeClick(data) {
if (this.listQuery.organizeId === data.id) return
this.listQuery.organizeId = data.id
this.reset()
},
removeUserRelationList(isRefresh) {
this.userRelationListVisible = false
if (isRefresh) {
this.initData()
}
},
handleUpdateState(row) {
const txt = row.enabledMark ? '禁用' : '开启'
this.$confirm(`您确定要${txt}当前角色吗, 是否继续?`, '提示', {
type: 'warning'
}).then(() => {
updateRoleState(row.id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
row.enabledMark = row.enabledMark ? 0 : 1
}
})
})
}).catch(() => { })
},
handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), {
type: 'warning'
}).then(() => {
delRole(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.initData()
}
})
})
}).catch(() => { })
},
handleUserRelation(row) {
this.currentView = row.type === '全局' ? GlobalUserRelationList : UserRelationList
this.$nextTick(() => {
this.userRelationListVisible = true
this.$nextTick(() => {
this.$refs.UserRelationList.init(row.id, row.fullName, 'Role')
})
})
},
}
}
</script>

@ -0,0 +1,174 @@
<template>
<el-dialog :title="pageTitle" :close-on-click-modal="false" :close-on-press-escape="false"
:visible.sync="visible" lock-scroll append-to-body
class="JNPF-dialog JNPF-dialog_center transfer-dialog" width="800px">
<div class="transfer__body" v-loading="allLoading">
<div class="transfer-pane">
<div class="transfer-pane__tools">
<el-input placeholder="请输入关键词查询" v-model="keyword" @keyup.enter.native="search" clearable
class="search-input">
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
<div class="transfer-pane__body left-pane">
<el-tree :data="treeData" :props="props" check-on-click-node @node-click="handleNodeClick"
class="JNPF-common-el-tree" node-key="id" v-loading="loading" lazy :load="loadNode">
<span class="custom-tree-node" slot-scope="{ node, data }" :title="node.label">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</div>
</div>
<div class="transfer-pane">
<div class="transfer-pane__tools">
<span>已选</span>
<el-button @click="removeAll" type="text" class="removeAllBtn">清空列表</el-button>
</div>
<div class="transfer-pane__body shadow right-pane">
<template v-if="selectedData.length">
<div v-for="(item,index) in selectedData" :key="index" class="selected-item-user">
<div class="selected-item-main">
<el-avatar :size="36" :src="define.comUrl+item.headIcon"
class="selected-item-headIcon">
</el-avatar>
<div class="selected-item-text">
<p class="name">{{item.fullName}}</p>
<p class="organize" :title="item.organize">{{item.organize}}</p>
</div>
<i class="el-icon-delete" @click="removeData(index)"></i>
</div>
</div>
</template>
<el-empty description="暂无数据" :image-size="120" v-else></el-empty>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getUserRelationList, createUserRelation } from '@/api/permission/userRelation'
import { getUserInfoList, getUsersByRoleId, getUsersByRoleOrgId } from '@/api/permission/user'
export default {
data() {
return {
visible: false,
btnLoading: false,
allLoading: false,
pageTitle: '',
dataForm: {
objectId: '',
objectType: 'Role',
userIds: []
},
selectedData: [],
treeData: [],
nodeId: '0',
props: {
children: 'children',
label: 'fullName',
isLeaf: 'isLeaf'
},
keyword: '',
loading: true
}
},
watch: {
visible(val) {
if (val) return
this.$emit('closeDialog')
}
},
methods: {
init(id, fullName) {
this.visible = true
this.dataForm.objectId = id
this.dataForm.userIds = []
this.selectedData = []
this.$nextTick(() => {
this.pageTitle = this.$t(`role.roleMember`) + ' - ' + fullName
this.allLoading = true
this.initData()
getUserRelationList(this.dataForm.objectId).then(res => {
this.dataForm.userIds = res.data.ids
this.getSelectList()
})
})
},
getSelectList() {
if (!this.dataForm.userIds.length) return this.allLoading = false
getUserInfoList(this.dataForm.userIds).then(res => {
this.selectedData = res.data.list
this.allLoading = false
})
},
search() {
this.nodeId = '0'
this.initData()
},
initData() {
this.loading = true
if (this.keyword) this.nodeId = '0'
const query = {
keyword: this.keyword,
organizeId: this.nodeId,
roleId: this.dataForm.objectId
}
getUsersByRoleOrgId(query).then(res => {
this.treeData = res.data
this.loading = false
})
},
loadNode(node, resolve) {
if (node.level === 0) {
this.nodeId = '0'
return resolve(this.treeData)
}
this.nodeId = node.data.id
const query = {
keyword: this.keyword,
organizeId: this.nodeId,
roleId: this.dataForm.objectId
}
getUsersByRoleOrgId(query).then(res => {
resolve(res.data)
})
},
handleNodeClick(data) {
if (data.type !== 'user') return
const boo = this.selectedData.some(o => o.id === data.id)
if (boo) return
this.selectedData.push(data)
},
removeAll() {
this.selectedData = []
},
removeData(index) {
this.selectedData.splice(index, 1)
},
dataFormSubmit() {
this.btnLoading = true
this.dataForm.userIds = this.selectedData.map(o => o.id)
createUserRelation(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
}
})
}).catch(() => {
this.btnLoading = false
})
}
}
}
</script>

@ -0,0 +1,105 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main user-form">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" content="组织架构图" />
<div class="options">
<el-button @click="goBack">{{$t('common.cancelButton')}} </el-button>
</div>
</div>
<div class="main" v-loading="loading">
<organization-chart :datasource="ds"></organization-chart>
</div>
</div>
</transition>
</template>
<script>
import { getDepartmentSelector } from '@/api/permission/department'
import OrganizationChart from 'vue-organization-chart'
import 'vue-organization-chart/dist/orgchart.css'
export default {
components: {
OrganizationChart
},
data() {
return {
loading: false,
ds: {}
}
},
methods: {
init() {
this.loading = true
getDepartmentSelector().then(res => {
let data = res.data.list
let _this = this
const loop = list => {
for (let i = 0; i < list.length; i++) {
_this.$set(list[i], 'name', list[i].fullName)
if (list[i].children && Array.isArray(list[i].children) && list[i].children.length) {
loop(list[i].children)
}
}
}
loop(data)
this.$nextTick(() => {
if (data.length >= 1) {
data = {
name: '组织架构图',
children: data
}
}
this.ds = data
this.loading = false
})
}).catch(() => { this.loading = false })
},
goBack() {
this.$emit('close')
}
}
}
</script>
<style lang="scss" scoped>
.main {
padding-bottom: 0;
overflow: hidden;
}
>>> .orgchart-container {
height: 100%;
border: none !important;
padding: 0;
width: 100%;
.orgchart {
background: none !important;
padding: 0;
.node {
&:hover {
background-color: transparent !important;
}
.title {
background-color: #1890ff;
}
.content {
border: 1px solid #1890ff;
}
}
}
.orgchart .lines {
.rightLine {
border-right: 1px solid #1890ff;
}
.leftLine {
border-left: 1px solid #1890ff;
}
.topLine {
border-top: 2px solid #1890ff;
}
.downLine {
background-color: #1890ff;
}
}
}
</style>

@ -0,0 +1,106 @@
<template>
<el-dialog title="导出数据" :close-on-click-modal="false" :visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center JNPF-dialog-export" lock-scroll width="600px">
<el-form label-position="top">
<el-form-item>
<el-radio-group v-model="type">
<el-radio :label="0">当前页面数据</el-radio>
<el-radio :label="1">全部页面数据</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item class="export-line">
<p slot="label" class="export-label">列表数据<span>请选择导出字段</span></p>
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll"
@change="handleCheckAllChange">全选</el-checkbox>
<el-checkbox-group v-model="columns" @change="handleCheckedChange">
<el-checkbox v-for="item in columnList" :label="item.prop" :key="item.prop"
class="column-item">
{{item.label}}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<p class="footer-tip">提示:系统将导出列表中选中的数据</p>
<el-button @click="visible=false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" @click="downLoad" :loading="btnLoading"> </el-button>
</span>
</el-dialog>
</template>
<script>
import { ExportExcel } from '@/api/permission/user'
export default {
data() {
return {
visible: false,
btnLoading: false,
type: 0,
columns: [],
columnList: [
{ label: "账户", prop: "account" },
{ label: "姓名", prop: "realName" },
{ label: "性别", prop: "gender" },
{ label: "电子邮箱", prop: "email" },
{ label: "所属组织", prop: "organizeId" },
{ label: "直属主管", prop: "managerId" },
{ label: "岗位", prop: "positionId" },
{ label: "角色", prop: "roleId" },
{ label: "排序", prop: "sortCode" },
{ label: "状态", prop: "enabledMark" },
{ label: "说明", prop: "description" },
{ label: "民族", prop: "nation" },
{ label: "籍贯", prop: "nativePlace" },
{ label: "入职时间", prop: "entryDate" },
{ label: "证件类型", prop: "certificatesType" },
{ label: "证件号码", prop: "certificatesNumber" },
{ label: "文化程度", prop: "education" },
{ label: "出生年月", prop: "birthday" },
{ label: "办公电话", prop: "telePhone" },
{ label: "办公座机", prop: "landline" },
{ label: "手机号码", prop: "mobilePhone" },
{ label: "紧急联系", prop: "urgentContacts" },
{ label: "紧急电话", prop: "urgentTelePhone" },
{ label: "通讯地址", prop: "postalAddress" }
],
listQuery: {},
checkAll: true,
isIndeterminate: false
}
},
methods: {
init(listQuery) {
this.visible = true
this.checkAll = true
this.isIndeterminate = false
this.btnLoading = false
this.listQuery = listQuery
this.columns = this.columnList.map(o => o.prop)
},
handleCheckAllChange(val) {
this.columns = val ? this.columnList.map(o => o.prop) : [];
this.isIndeterminate = false;
},
handleCheckedChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.columnList.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.columnList.length;
},
downLoad() {
if (!this.columns.length) return this.$message.warning(`请至少选择一个导出字段`)
this.btnLoading = true
let query = {
...this.listQuery,
dataType: this.type,
selectKey: this.columns.join(',')
}
ExportExcel(query).then(res => {
this.btnLoading = false
if (!res.data.url) return
this.jnpf.downloadFile(res.data.url)
this.visible = false
}).catch(() => { this.btnLoading = false })
}
}
}
</script>

@ -0,0 +1,431 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main user-form">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack"
:content="!dataForm.id ?$t(`user.addUser`) : $t(`user.editUser`)" />
<div class="options">
<el-button type="primary" :loading="btnLoading" @click="handleConfirm()">
{{$t('common.confirmButton')}}</el-button>
<el-button @click="goBack">{{$t('common.cancelButton')}} </el-button>
</div>
</div>
<div class="main" v-loading="formLoading">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="80px">
<div class="JNPF-common-title mb-20">
<h2 class="bold">账户信息
<el-tooltip effect="dark" content="新用户初始密码默认是0000" placement="top">
<a class="el-icon-question tooltip-question"></a>
</el-tooltip>
</h2>
</div>
<el-row :gutter="20" class="custom-row">
<el-col :sm="12" :xs="24">
<el-form-item label="账户" prop="account">
<el-input v-model="dataForm.account" placeholder="账户名称" :readonly="!!dataForm.id" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="姓名" prop="realName">
<el-input v-model="dataForm.realName" placeholder="真实姓名" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="性别" prop="gender">
<el-select v-model="dataForm.gender" placeholder="选择性别">
<el-option v-for="item in genderTreeData" :key="item.enCode"
:label="item.fullName" :value="item.enCode" />
</el-select>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="电子邮箱" prop="email">
<el-input v-model="dataForm.email" placeholder="电子邮箱" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="所属组织" prop="organizeIdTree">
<JnpfOrganizeSelect v-model="dataForm.organizeIdTree" placeholder="选择所属组织" multiple
@change="onOrganizeChange" clearable auth />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="直属主管" prop="managerId">
<JnpfUserSelect v-model="dataForm.managerId" placeholder="选择直属主管" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="岗位" prop="positionId">
<el-select v-model="positionId" placeholder="选择岗位" @change="onChange('positionId')"
@visible-change="visibleChange" multiple filterable clearable>
<el-option-group v-for="group in positionTreeData" :key="group.id"
:label="group.fullName+(group.num?'【'+group.num+'】':'')">
<el-option v-for="item in group.children" :key="group.id+item.id"
:label="item.fullName" :value="item.id">
</el-option>
</el-option-group>
</el-select>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="角色" prop="roleId">
<el-select v-model="roleId" placeholder="选择角色" @change="onChange('roleId')"
@visible-change="visibleChange" multiple filterable clearable>
<el-option-group v-for="group in roleTreeData" :key="group.id"
:label="group.fullName+(group.num?'【'+group.num+'】':'')">
<el-option v-for="item in group.children" :key="group.id+item.id"
:label="item.fullName" :value="item.id">
</el-option>
</el-option-group>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode"
controls-position="right" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="enabledMark">
<el-select v-model="dataForm.enabledMark" placeholder="选择状态">
<el-option label="启用" :value="1" />
<el-option label="锁定" :value="2" />
<el-option label="禁用" :value="0" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" type="textarea" :rows="3" />
</el-form-item>
</el-col>
</el-row>
<div class="JNPF-common-title mb-20">
<h2 class="bold">个人资料</h2>
</div>
<el-row :gutter="20" class="custom-row">
<el-col :span="24">
<el-form-item label="头像" prop="headIcon">
<el-upload class="avatar-uploader" :headers="uploadHeaders"
:action="define.comUploadUrl+'/userAvatar'" :show-file-list="false"
:on-success="handleAvatarSuccess" accept="image/*">
<img v-if="dataForm.headIcon" :src="define.comUrl+dataForm.headIcon"
class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon" />
</el-upload>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="民族" prop="nation">
<el-select v-model="dataForm.nation" placeholder="选择民族" filterable>
<el-option v-for="item in nationTreeData" :key="item.id" :label="item.fullName"
:value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="籍贯" prop="nativePlace">
<el-input v-model="dataForm.nativePlace" placeholder="籍贯" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="证件类型" prop="certificatesType">
<el-select v-model="dataForm.certificatesType" placeholder="选择证件类型" filterable>
<el-option v-for="item in certificatesTypeTreeData" :key="item.id"
:label="item.fullName" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="入职时间" prop="entryDate">
<el-date-picker v-model="dataForm.entryDate" type="date" placeholder="选择入职时间"
value-format="timestamp">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="证件号码" prop="certificatesNumber">
<el-input v-model="dataForm.certificatesNumber" placeholder="证件号码" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="文化程度" prop="education">
<el-select v-model="dataForm.education" placeholder="选择文化程度">
<el-option v-for="item in educationTreeData" :key="item.id" :label="item.fullName"
:value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="出生年月" prop="birthday">
<el-date-picker v-model="dataForm.birthday" type="date" placeholder="选择出生年月"
value-format="timestamp">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="办公电话" prop="telePhone">
<el-input v-model="dataForm.telePhone" placeholder="办公电话" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="办公座机" prop="landline">
<el-input v-model="dataForm.landline" placeholder="办公座机" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="手机号码" prop="mobilePhone">
<el-input v-model="dataForm.mobilePhone" placeholder="手机号码" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="紧急联系" prop="urgentContacts">
<el-input v-model="dataForm.urgentContacts" placeholder="紧急联系人" />
</el-form-item>
</el-col>
<el-col :sm="12" :xs="24">
<el-form-item label="紧急电话" prop="urgentTelePhone">
<el-input v-model="dataForm.urgentTelePhone" placeholder="紧急联系人电话" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="通讯地址" prop="postalAddress">
<el-input v-model="dataForm.postalAddress" type="textarea" :rows="3" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</transition>
</template>
<script>
import { getPositionByOrganize } from '@/api/permission/position'
import { getRoleByOrganize } from '@/api/permission/role'
import { getGroupSelector } from '@/api/permission/group'
import { createUser, updateUser, getUserInfo } from '@/api/permission/user'
export default {
data() {
return {
visible: false,
btnLoading: false,
dataForm: {
id: '',
sortCode: 0,
enabledMark: 1,
account: '',
realName: '',
organizeId: '',
organizeIdTree: [],
managerId: '',
positionId: '',
roleId: '',
groupId: '',
description: '',
headIcon: '',
gender: null,
nation: '',
nativePlace: '',
entryDate: null,
certificatesType: '',
certificatesNumber: '',
education: '',
birthday: null,
telePhone: '',
landline: '',
mobilePhone: '',
email: '',
urgentContacts: '',
urgentTelePhone: '',
postalAddress: ''
},
roleId: [],
groupId: [],
positionId: [],
positionTreeData: [],
roleTreeData: [],
groupTreeData: [],
genderTreeData: [],
nationTreeData: [],
educationTreeData: [],
certificatesTypeTreeData: [],
uploadHeaders: { Authorization: this.$store.getters.token },
formLoading: false,
genderProps: {
value: 'enCode',
label: 'fullName'
},
dataRule: {
account: [
{ required: true, message: '请输入账户', trigger: 'blur' },
{ validator: this.formValidate('fullName', '账户不能含有特殊符号'), trigger: 'blur' },
{ max: 50, message: '账户最多为50个字符', trigger: 'blur' }
],
realName: [
{ required: true, message: '请输入真实姓名', trigger: 'blur' },
{ validator: this.formValidate('fullName', '真实姓名不能含有特殊符号'), trigger: 'blur' },
{ max: 50, message: '真实姓名最多为50个字符', trigger: 'blur' }
],
gender: [
{ required: true, message: '请选择性别', trigger: 'change' }
],
organizeIdTree: [
{ required: true, message: '请选择所属组织', trigger: 'click', type: 'array' }
]
}
}
},
methods: {
init(id, organizeIdTree) {
this.visible = true
this.dataForm.id = id || ''
this.roleId = []
this.groupId = []
this.positionId = []
this.positionTreeData = []
this.roleTreeData = []
this.dataForm.organizeIdTree = []
this.$nextTick(() => {
this.formLoading = true
this.$refs['dataForm'].resetFields()
//
getGroupSelector().then(res => {
this.groupTreeData = res.data
})
//
this.$store.dispatch('base/getDictionaryData', { sort: 'Nation' }).then(res => {
this.nationTreeData = res
//
this.$store.dispatch('base/getDictionaryData', { sort: 'Education' }).then(res => {
this.educationTreeData = res
})
//
this.$store.dispatch('base/getDictionaryData', { sort: 'certificateType' }).then(res => {
this.certificatesTypeTreeData = res
})
//
this.$store.dispatch('base/getDictionaryData', { sort: 'sex' }).then(res => {
this.genderTreeData = res
})
})
if (this.dataForm.id) {
getUserInfo(this.dataForm.id).then(res => {
this.dataForm = res.data
if (this.dataForm.roleId) this.roleId = this.dataForm.roleId.split(',')
if (this.dataForm.groupId) this.groupId = this.dataForm.groupId.split(',')
if (this.dataForm.positionId) this.positionId = this.dataForm.positionId.split(',')
if (this.dataForm.organizeIdTree && this.dataForm.organizeIdTree.length) {
this.getOptionsByOrgIds(this.dataForm.organizeIdTree)
}
this.formLoading = false
}).catch(() => this.formLoading = false)
} else {
this.dataForm.organizeIdTree = organizeIdTree.length ? [organizeIdTree] : []
if (this.dataForm.organizeIdTree && this.dataForm.organizeIdTree.length) {
this.getOptionsByOrgIds(this.dataForm.organizeIdTree)
}
this.formLoading = false
}
})
},
goBack() {
this.$emit('close')
},
onChange(key) {
this.dataForm[key] = this[key].join()
},
onOrganizeChange(val) {
this.dataForm.positionId = ''
this.dataForm.roleId = ''
this.dataForm.organizeId = ''
this.positionId = []
this.roleId = []
if (!val || !val.length) return
this.getOptionsByOrgIds(val)
},
getOptionsByOrgIds(organizeIdTree) {
const organizeIds = organizeIdTree.map(o => o[o.length - 1])
this.dataForm.organizeId = organizeIds.join()
getPositionByOrganize(organizeIds).then(res => {
this.positionTreeData = res.data.list.filter(o => o.children && Array.isArray(o.children) && o.children.length)
})
getRoleByOrganize(organizeIds).then(res => {
this.roleTreeData = res.data.list.filter(o => o.children && Array.isArray(o.children) && o.children.length)
})
},
visibleChange(val) {
if (!val) return
if (!this.dataForm.organizeIdTree || !this.dataForm.organizeIdTree.length) this.$message.warning('请先选择所属组织')
},
handleAvatarSuccess(res) {
if (res.code === 200 && res.data && res.data.url) {
this.dataForm.headIcon = res.data.url
} else {
this.$message.error('头像上传失败');
}
},
handleConfirm() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.btnLoading = true
const formMethod = this.dataForm.id ? updateUser : createUser
formMethod(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$emit('close', true)
}
})
}).catch(() => {
this.btnLoading = false
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.user-form {
.main {
padding: 10px 30px 0;
}
>>> .el-select,
>>> .el-cascader,
>>> .el-date-editor {
width: 100%;
}
>>> .avatar-uploader {
.el-upload {
border: 1px dashed #dcdfe6;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.el-upload:hover {
border-color: #409eff;
}
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 130px;
height: 130px;
line-height: 130px;
text-align: center;
}
.avatar {
width: 130px;
height: 130px;
display: block;
}
}
</style>

@ -0,0 +1,326 @@
<template>
<el-dialog title="批量导入" :close-on-click-modal="false" :visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center JNPF-dialog-import" lock-scroll width="1000px">
<el-steps :active="active" align-center>
<el-step title="上传文件"></el-step>
<el-step title="数据预览"></el-step>
<el-step title="导入数据"></el-step>
</el-steps>
<div class="import-main" v-show="active==1">
<div class="upload">
<div class="up_left">
<img src="@/assets/images/upload.png">
</div>
<div class="up_right">
<p class="title">上传填好的数据表</p>
<p class="tip">文件后缀名必须是xls或xlsx文件大小不超过500KB最多支持导入1000条数据</p>
<el-upload :action="define.comUrl+'/api/permission/Users/Uploader'"
:headers="{ Authorization: $store.getters.token}" :on-success="handleSuccess"
:on-remove="handleRemove" :before-remove="beforeRemove" :on-change="handleChange"
:file-list="fileList" accept=".xls,.xlsx" :before-upload="beforeUpload"
class="upload-area">
<el-button type="text">上传文件</el-button>
</el-upload>
</div>
</div>
<div class="upload">
<div class="up_left">
<img src="@/assets/images/import.png">
</div>
<div class="up_right">
<p class="title">填写导入数据信息</p>
<p class="tip">请按照数据模板的格式准备导入数据模板中的表头名称不可更改表头行不能删除</p>
<el-button type="text" @click="templateDownload"></el-button>
</div>
</div>
</div>
<div class="import-main" v-show="active==2">
<JNPF-table v-loading="listLoading" :data="list">
<el-table-column prop="account" label="账户" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.account" />
</template>
</el-table-column>
<el-table-column prop="realName" label="姓名" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.realName" />
</template>
</el-table-column>
<el-table-column prop="gender" label="性别" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.gender" />
</template>
</el-table-column>
<el-table-column prop="email" label="电子邮箱" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.email" />
</template>
</el-table-column>
<el-table-column prop="organizeId" label="所属组织" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.organizeId" />
</template>
</el-table-column>
<el-table-column prop="managerId" label="直属主管" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.managerId" />
</template>
</el-table-column>
<el-table-column prop="positionId" label="岗位" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.positionId" />
</template>
</el-table-column>
<el-table-column prop="roleId" label="角色" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.roleId" />
</template>
</el-table-column>
<el-table-column prop="sortCode" label="排序" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.sortCode" />
</template>
</el-table-column>
<el-table-column prop="enabledMark" label="状态" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.enabledMark" />
</template>
</el-table-column>
<el-table-column prop="description" label="说明" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.description" />
</template>
</el-table-column>
<el-table-column prop="nation" label="民族" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.nation" />
</template>
</el-table-column>
<el-table-column prop="nativePlace" label="籍贯" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.nativePlace" />
</template>
</el-table-column>
<el-table-column prop="entryDate" label="入职时间" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.entryDate" />
</template>
</el-table-column>
<el-table-column prop="certificatesType" label="证件类型" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.certificatesType" />
</template>
</el-table-column>
<el-table-column prop="certificatesNumber" label="证件号码" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.certificatesNumber" />
</template>
</el-table-column>
<el-table-column prop="education" label="文化程度" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.education" />
</template>
</el-table-column>
<el-table-column prop="birthday" label="出生年月" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.birthday" />
</template>
</el-table-column>
<el-table-column prop="telePhone" label="办公电话" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.telePhone" />
</template>
</el-table-column>
<el-table-column prop="landline" label="办公座机" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.landline" />
</template>
</el-table-column>
<el-table-column prop="mobilePhone" label="手机号码" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.mobilePhone" />
</template>
</el-table-column>
<el-table-column prop="urgentContacts" label="紧急联系" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.urgentContacts" />
</template>
</el-table-column>
<el-table-column prop="urgentTelePhone" label="紧急电话" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.urgentTelePhone" />
</template>
</el-table-column>
<el-table-column prop="postalAddress" label="通讯地址" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.postalAddress" />
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="handleDel(scope.$index)">删除</el-button>
</template>
</el-table-column>
</JNPF-table>
</div>
<div class="import-main" v-show="active==3">
<div class="success" v-if="!result.resultType">
<img src="@/assets/images/success.png" alt="">
<p class="success-title">批量导入成功</p>
<p class="success-tip">您已成功导入{{result.snum}}条数据</p>
</div>
<div class="unsuccess" v-if="result.resultType">
<el-alert title="错误提醒:导入失败数据展示" type="warning" show-icon :closable="false" />
<div class="upload error-show">
<div class="up_left">
<img class="" src="@/assets/images/tip.png">
</div>
<div class="up_right">
<p class="tip">正常数量条数<el-link type="success" :underline="false">{{result.snum}}
</el-link>
</p>
<p class="tip">异常数量条数<el-link type="danger" :underline="false">{{result.fnum}}
</el-link>
</p>
</div>
</div>
<div class="contips">
<p>以下文件数据为导入异常数据</p>
<el-button type="text" icon="el-icon-upload2" @click="exportExceptionData">
</el-button>
</div>
<JNPF-table :data="resultList" height="280px">
<el-table-column prop="account" label="账户" width="150" />
<el-table-column prop="realName" label="姓名" width="150" />
<el-table-column prop="gender" label="性别" width="150" />
<el-table-column prop="email" label="电子邮箱" width="150" />
<el-table-column prop="organizeId" label="所属组织" width="150" />
<el-table-column prop="managerId" label="直属主管" width="150" />
<el-table-column prop="positionId" label="岗位" width="150" />
<el-table-column prop="roleId" label="角色" width="150" />
<el-table-column prop="sortCode" label="排序" width="150" />
<el-table-column prop="enabledMark" label="状态" width="150" />
<el-table-column prop="description" label="说明" width="150" />
<el-table-column prop="nation" label="民族" width="150" />
<el-table-column prop="nativePlace" label="籍贯" width="150" />
<el-table-column prop="entryDate" label="入职时间" width="150" />
<el-table-column prop="certificatesType" label="证件类型" width="150" />
<el-table-column prop="certificatesNumber" label="证件号码" width="150" />
<el-table-column prop="education" label="文化程度" width="150" />
<el-table-column prop="birthday" label="出生年月" width="150" />
<el-table-column prop="telePhone" label="办公电话" width="150" />
<el-table-column prop="landline" label="办公座机" width="150" />
<el-table-column prop="mobilePhone" label="手机号码" width="150" />
<el-table-column prop="urgentContacts" label="紧急联系" width="150" />
<el-table-column prop="urgentTelePhone" label="紧急电话" width="150" />
<el-table-column prop="postalAddress" label="通讯地址" width="150" />
</JNPF-table>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="cancel()" v-if="active == 1"> </el-button>
<el-button @click="prev" v-if="active == 2"></el-button>
<el-button @click="next" type="primary" v-if="active < 3" :loading="btnLoading"
:disabled="active == 1 && !fileName">下一步
</el-button>
<el-button @click="cancel(true)" type="primary" v-else> </el-button>
</span>
</el-dialog>
</template>
<script>
import { TemplateDownload, ImportData, ImportPreview, ExportExceptionData } from '@/api/permission/user'
export default {
data() {
return {
visible: false,
btnLoading: false,
listLoading: false,
fileName: '',
fileList: [],
active: 1,
list: [],
resultList: [],
result: {
resultType: 0,
snum: 0,
fnum: 0
}
}
},
methods: {
prev() {
if (this.active == 1) return
this.active--
},
next() {
if (this.active == 2) {
if (!this.list.length) return this.$message({ message: '导入数据为空', type: 'warning' })
this.btnLoading = true
ImportData({ list: this.list }).then(res => {
this.result = res.data
this.resultList = res.data.failResult
this.btnLoading = false
this.active++
}).catch(() => { this.btnLoading = false })
}
if (this.active == 1) {
if (!this.fileList.length || !this.fileName) return this.$message({ message: '请先上传文件', type: 'warning' })
this.btnLoading = true
ImportPreview({ fileName: this.fileName }).then(res => {
this.list = res.data.dataRow
this.btnLoading = false
this.active++
}).catch(() => { this.btnLoading = false })
}
},
cancel(isRefresh) {
this.visible = false
if (isRefresh) this.$emit('refresh')
},
init() {
this.active = 1
this.fileList = []
this.fileName = ''
this.visible = true
},
handleDel(index) {
this.list.splice(index, 1)
},
templateDownload() {
TemplateDownload().then(res => {
this.jnpf.downloadFile(res.data.url)
})
},
exportExceptionData() {
ExportExceptionData({ list: this.resultList }).then(res => {
this.jnpf.downloadFile(res.data.url)
})
},
beforeUpload(file) {
let isRightSize = file.size / 1024 < 500
if (!isRightSize) this.$message.error(`文件大小不能超过500KB`)
return isRightSize
},
handleRemove(file, fileList) {
this.fileList = []
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`).then(() => { })
},
handleChange(file, fileList) {
this.fileList = fileList.slice(-1)
},
handleSuccess(res, file, fileList) {
if (res.code == 200) {
this.fileList = fileList.slice(-1)
this.fileName = res.data.name
} else {
this.fileList = fileList.filter(o => o.uid != file.uid)
this.$message({ message: res.msg, type: 'error', duration: 1000 })
}
}
}
}
</script>

@ -0,0 +1,116 @@
<template>
<el-dialog :title="$t(`user.resetPassword`)" :close-on-click-modal="false"
:close-on-press-escape="false" :visible.sync="visible" lock-scroll
class="JNPF-dialog JNPF-dialog_center" width="600px">
<el-form ref="dataForm" v-loading="formLoading" :model="dataForm" :rules="dataRule"
label-width="100px">
<el-form-item label="账户" prop="account">
<el-input v-model="dataForm.account" placeholder="账户" readonly />
</el-form-item>
<el-form-item label="新密码" prop="userPassword">
<el-input v-model="dataForm.userPassword" type="password" autocomplete="off"
placeholder="输入新密码" />
</el-form-item>
<el-form-item label="确认新密码" prop="validatePassword">
<el-input v-model="dataForm.validatePassword" type="password" autocomplete="off"
placeholder="确认新密码" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import {
resetUserPassword
} from '@/api/permission/user'
import md5 from 'js-md5'
import { getSystemConfig } from '@/api/system/sysConfig'
export default {
data() {
const validateUserPassword = (rule, value, callback) => {
if (value === '') {
callback(new Error('新密码不能为空'));
}else{
if (this.dataForm.password2 !== '') {
this.$refs.dataForm.validateField('password2');
}
callback();
}
}
const validatePassword = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入新密码'));
} else if (value !== this.dataForm.userPassword) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
}
return {
visible: false,
formLoading: false,
btnLoading: false,
dataForm: {
id: '',
account: '',
userPassword: '',
validatePassword: ''
},
dataRule: {
userPassword: [
{ required: true, validator: validateUserPassword, trigger: 'blur' }
],
validatePassword: [
{ required: true, validator: validatePassword, trigger: 'blur' }
]
}
}
},
methods: {
init(id, account) {
this.visible = true
this.formLoading = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.dataForm.id = id
this.dataForm.account = account
this.formLoading = false
})
},
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.btnLoading = true
const formData = {
id: this.dataForm.id,
userPassword: md5(this.dataForm.userPassword),
validatePassword: md5(this.dataForm.validatePassword)
}
resetUserPassword(formData).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
this.$emit('refreshDataList')
}
})
}).catch(() => {
this.btnLoading = false
})
}
})
}
}
}
</script>

@ -0,0 +1,116 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" content="第三方服务绑定管理" />
<div class="options">
<el-button @click="goBack()">{{$t('common.cancelButton')}}</el-button>
</div>
</div>
<div class="main">
<el-col :span="22" :offset="1" class="mt-20">
<template v-for="(item,i) in socialsList">
<el-row :key="i">
<el-col :span="1" class="col-img">
<img v-if="item.enname" :src="item.logo" alt="" class="row-img" />
<img v-if="!item.enname" src="" alt="" class="row-img" />
</el-col>
<el-col :span="21">
<div class="tag-group-div">
<span class="tag-group-span">{{item.name}}</span>
</div>
<div class="tag-group-con"> <span>{{item.describetion}}</span>
</div>
</el-col>
<el-col :span="1" class="col-line-height">
<el-button size="small" type="" v-if="item.entity"
@click="deleteSocials(item.entity.id)">解绑</el-button>
</el-col>
</el-row>
<el-divider class="divider-margin" :key="i"></el-divider>
</template>
</el-col>
</div>
</div>
</transition>
</template>
<script>
import { getSocialsUserListByUser, deleteSocials } from '@/api/permission/socialsUser'
export default {
data() {
return {
userId: "",
socialsList: [],
}
},
methods: {
init(rowdata) {
this.userId = rowdata.id;
this.initList()
},
initList() {
getSocialsUserListByUser(this.userId).then(res => {
this.socialsList = res.data;
})
},
goBack() {
this.$emit('close')
},
deleteSocials(id) {
this.$confirm('确定要解除该账号绑定?', '提示', {
type: 'warning'
}).then(() => {
deleteSocials(this.userId, id).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.initList()
}
})
})
}).catch(() => {
this.initList()
});
},
}
}
</script>
<style scoped>
.col-img {
margin: 0px 10px;
}
.tag-group-div {
height: 24px;
line-height: 24px;
}
.row-img {
height: 50px;
width: 50px;
}
.tag-group-span {
height: 24px;
line-height: 24px;
margin-right: 20px;
font-weight: bolder;
font-size: 16px;
}
.tag-group-con {
font-size: 14px;
margin: 5px 0;
}
.divider-margin {
margin: 15px 0px;
}
.tag-group-button {
height: 24px;
line-height: 24px;
}
.col-line-height {
line-height: 50px;
}
</style>

@ -0,0 +1,199 @@
<template>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="visible"
lock-scroll class="JNPF-dialog JNPF-dialog_center" width="700px">
<el-form ref="dataForm" v-loading="formLoading" :model="dataForm" label-width="100px">
<el-form-item label="工作移交人" prop="account">
<el-input v-model="dataForm.account" placeholder="请输入工作移交人" readonly />
</el-form-item>
<el-form-item label="工作交接人" prop="handoverId">
<JnpfUserSelect v-model="dataForm.managerId" placeholder="请选择工作交接人" @change="changeUser"
:key="key" />
</el-form-item>
<el-form-item label="交接内容" prop="handoverContent">
<template>
<div class="tabs-box">
<el-tabs v-model="activeName">
<el-tab-pane label="流程列表" name="flow">
<el-alert title="转交内容:发起节点、审批节点、抄送人是移交人的流程" type="warning" show-icon>
</el-alert>
<div class="tabs-box-inner">
<el-tree :data="treeData.flow" :props="props" show-checkbox default-expand-all
@check-change="handleCheckChange(1)" node-key="id" ref="handoverContentTree1"
check-on-click-node :expand-on-click-node="false">
<span class="custom-tree-node" slot-scope="{ node, data }" :title="node.label">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</div>
</el-tab-pane>
<el-tab-pane label="我的待办" name="wait">
<el-alert title="转交内容:包含移交人未处理的待办和已处理的待办" type="warning" show-icon>
</el-alert>
<div class="tabs-box-inner">
<el-tree :data="treeData.wait" :props="props" show-checkbox default-expand-all
@check-change="handleCheckChange(2)" node-key="id" ref="handoverContentTree2"
check-on-click-node :expand-on-click-node="false">
<span class="custom-tree-node" slot-scope="{ node, data }" :title="node.label">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</div>
</el-tab-pane>
<el-tab-pane label="权限组" name="permission">
<el-alert title="转交内容:移交人的权限组" type="warning" show-icon>
</el-alert>
<div class="tabs-box-inner">
<el-tree :data="treeData.permission" :props="props" show-checkbox
default-expand-all @check-change="handleCheckChange(3)" node-key="id"
ref="handoverContentTree3" check-on-click-node :expand-on-click-node="false">
<span class="custom-tree-node" slot-scope="{ node, data }" :title="node.label">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()"></el-button>
</span>
</el-dialog>
</template>
<script>
import {
getWorkHandover,
getWorkByUser
} from '@/api/permission/user'
import { mapGetters } from "vuex"
export default {
data() {
return {
key: +new Date(),
visible: false,
formLoading: false,
btnLoading: false,
activeName: 'flow',
treeData: [],
props: {
children: 'children',
label: 'fullName',
isLeaf: 'isLeaf',
icon: 'icon',
value: 'id',
disabled: 'disabled'
},
workHandoverPersonnelData: {},
fromId: '',
dataForm: {
id: '',
account: '',
managerId: '',
waitList: [],
flowList: [],
permissionList: []
}
}
},
computed: {
...mapGetters(['userInfo'])
},
methods: {
changeUser(id, item) {
if (this.workHandoverPersonnelData.id === id || item.isAdministrator == 1) {
this.$message.warning(this.workHandoverPersonnelData.id === id ? '工作交接无法转交给本人' : '工作交接无法转交给管理员')
this.dataForm.managerId = "";
this.key = +new Date();
}
},
init(data) {
this.workHandoverPersonnelData = data
this.dataForm.account = data.realName + '/' + data.account
this.visible = true
this.activeName = 'flow'
this.dataForm.managerId = ''
this.dataForm.waitList = []
this.dataForm.flowList = []
this.dataForm.permissionList = []
this.fromId = data.id
getWorkByUser(this.fromId).then(res => {
this.treeData = res.data || []
})
},
handleCheckChange(type) {
const dataName = type == 1 ? 'flowList' : type == 2 ? 'waitList' : 'permissionList'
const treeRef = this.$refs['handoverContentTree' + type];
const parentIds = treeRef.getHalfCheckedKeys();
const childrenIds = treeRef.getCheckedKeys();
const dataIds = [...new Set([...parentIds, ...childrenIds])];
this.dataForm[dataName] = dataIds
},
dataFormSubmit() {
//
if (this.workHandoverPersonnelData.id === this.dataForm.managerId) {
this.dataForm.managerId = "";
this.$message.warning("工作交接无法转交给本人");
this.key = +new Date();
return;
}
//
if (!this.dataForm.managerId) {
return this.$message.warning("请先选择工作交接人");
}
//
if (
!this.dataForm.waitList.length &&
!this.dataForm.flowList.length &&
!this.dataForm.permissionList.length
) {
return this.$message.warning("请先选择交接内容");
}
this.btnLoading = true;
const query = {
waitList: this.dataForm.waitList,
flowList: this.dataForm.flowList,
permissionList: this.dataForm.permissionList,
toId: this.dataForm.managerId,
fromId: this.fromId
};
getWorkHandover(query)
.then(() => {
this.$message.success("工作交接成功");
setTimeout(() => {
this.visible = false;
this.btnLoading = false;
this.$emit("complete");
}, 1000);
})
.catch(() => {
this.btnLoading = false;
});
}
}
}
</script>
<style lang="scss">
.JNPF-dialog_center {
.tabs-box {
border: 1px solid #dcdfe6;
min-height: 300px;
padding: 0 10px;
border-radius: 4px;
.el-tabs {
.el-tabs__header {
margin: 0 0 6px !important;
}
}
.tabs-box-inner {
max-height: 200px;
overflow-y: scroll;
}
}
}
</style>

@ -0,0 +1,379 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-left">
<div class="JNPF-common-title">
<h2>{{$t('common.organization')}}</h2>
<span class="options">
<el-dropdown>
<el-link icon="icon-ym icon-ym-mpMenu" :underline="false" />
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="getOrganizeList()">刷新数据</el-dropdown-item>
<el-dropdown-item @click.native="toggleExpand(true)">展开全部</el-dropdown-item>
<el-dropdown-item @click.native="toggleExpand(false)">折叠全部</el-dropdown-item>
<el-dropdown-item @click.native="showDiagram">架构图</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</div>
<div class="JNPF-common-tree-search-box">
<el-input placeholder="输入关键字" v-model="filterText" suffix-icon="el-icon-search" clearable />
</div>
<el-scrollbar class="JNPF-common-el-tree-scrollbar" v-loading="treeLoading">
<el-tree ref="treeBox" :data="treeData" :props="defaultProps" :default-expand-all="expands"
highlight-current :expand-on-click-node="false" node-key="id"
@node-click="handleNodeClick" class="JNPF-common-el-tree" v-if="refreshTree"
:filter-node-method="filterNode">
<span class="custom-tree-node" slot-scope="{ data, node }" :title="data.fullName">
<i :class="data.icon" />
<span class="text" :title="data.fullName">{{node.label}}</span>
</span>
</el-tree>
</el-scrollbar>
</div>
<div class="JNPF-common-layout-center JNPF-flex-main">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item :label="$t('common.keyword')">
<el-input v-model="listQuery.keyword" :placeholder="$t('common.enterKeyword')"
clearable @keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<topOpts @add="addOrUpdateHandle()">
<el-button type="text" icon="el-icon-download" @click="exportForm"></el-button>
<el-button type="text" icon="el-icon-upload2" @click="uploadForm"></el-button>
<el-button type="text" icon="icon-ym icon-ym-synForThird"
@click="handleSync">第三方同步</el-button>
</topOpts>
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="tableData">
<el-table-column prop="account" label="账号" width="100" />
<el-table-column prop="realName" label="姓名" width="100" />
<el-table-column prop="gender" label="性别" width="90" align="center">
<template slot-scope="scope">
<span>{{ scope.row.gender ==1 ? '男': ( scope.row.gender == 2 ? '女' : '保密') }}</span>
</template>
</el-table-column>
<el-table-column prop="mobilePhone" label="手机" width="120" />
<el-table-column prop="organize" label="所属组织" min-width="200" show-overflow-tooltip />
<el-table-column prop="creatorTime" label="创建时间" :formatter="jnpf.tableDateFormat"
width="120" />
<el-table-column prop="sortCode" label="排序" width="70" align="center" />
<el-table-column prop="enabledMark" label="状态" width="70" align="center">
<template slot-scope="scope">
<el-tag type="success" disable-transitions v-if="scope.row.enabledMark == 1">
</el-tag>
<el-tag type="warning" disable-transitions v-else-if="scope.row.enabledMark == 2">锁定
</el-tag>
<el-tag type="danger" disable-transitions v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="150">
<template slot-scope="scope" v-if="!scope.row.isAdministrator">
<tableOpts @edit="addOrUpdateHandle(scope.row.id)" @del="handleDel(scope.row.id)">
<el-dropdown hide-on-click>
<span class="el-dropdown-link">
<el-button size="mini" type="text">
{{$t('common.moreBtn')}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
@click.native="handleResetPwd(scope.row.id, scope.row.account)">
{{$t('user.resetPassword')}}
</el-dropdown-item>
<el-dropdown-item @click.native="unlockUser(scope.row.id)"
v-if="scope.row.enabledMark == 2">解除锁定</el-dropdown-item>
<el-dropdown-item @click.native="socialsBindBtn(scope.row)" v-if="useSocials">
绑定管理
</el-dropdown-item>
<el-dropdown-item @click.native="workHandover(scope.row)"
:disabled="scope.row.enabledMark == 1 || scope.row.enabledMark == 2">
工作交接
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</tableOpts>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
</div>
<Form v-show="formVisible" ref="Form" @close="removeForm" />
<Diagram v-if="diagramVisible" ref="Diagram" @close="diagramVisible = false" />
<ResetPwdForm v-if="resetFormVisible" ref="ResetPwdForm" @refreshDataList="initData" />
<ExportForm v-if="exportFormVisible" ref="exportForm" />
<ImportForm v-if="importFormVisible" ref="importForm" @refresh="reset()" />
<SocialsBind v-if="socialsVisible" ref="SocialsBind" @close="socialsVisible=false" />
<WorkHandoverForm v-if="workHandoverVisible" ref="WorkHandoverForm" @complete="initData" />
</div>
</template>
<script>
import { getDepartmentSelectorByAuth } from '@/api/permission/department'
import { getUserList, updateUserState, unlockUser, delUser } from '@/api/permission/user'
import Form from './Form'
import Diagram from './Diagram'
import ResetPwdForm from './ResetPassword'
import ImportForm from './ImportForm'
import ExportForm from './ExportForm'
import SocialsBind from './SocialsBind'
import WorkHandoverForm from './WorkHandoverForm.vue'
import { mapGetters } from "vuex"
export default {
name: 'permission-user',
components: {
Form,
Diagram,
ResetPwdForm,
ExportForm,
ImportForm,
SocialsBind,
WorkHandoverForm
},
data() {
return {
keyword: '',
treeData: [],
tableData: [],
treeLoading: false,
listLoading: true,
listQuery: {
organizeId: '',
keyword: '',
currentPage: 1,
pageSize: 20
},
defaultProps: {
children: 'children',
label: 'fullName'
},
total: 0,
type: '',
formVisible: false,
diagramVisible: false,
resetFormVisible: false,
authorizeFormVisible: false,
importFormVisible: false,
exportFormVisible: false,
expands: true,
refreshTree: true,
filterText: '',
socialsVisible: false,
workHandoverVisible: false,
organizeIdTree: [],
}
},
watch: {
filterText(val) {
this.$refs.treeBox.filter(val)
}
},
computed: {
...mapGetters(['userInfo']),
useSocials() {
return localStorage.getItem('useSocials') && localStorage.getItem('useSocials') != '0'
}
},
created() {
this.getOrganizeList(true)
},
methods: {
workHandover(data) {
this.workHandoverVisible = true
this.$nextTick(() => {
this.$refs.WorkHandoverForm.init(data)
})
},
showDiagram() {
this.diagramVisible = true
this.$nextTick(() => {
this.$refs.Diagram.init()
})
},
search() {
this.listQuery.currentPage = 1
this.listQuery.pageSize = 20
this.listQuery.sort = 'desc'
this.initData()
},
reset() {
this.listQuery.keyword = ''
this.search()
},
toggleExpand(expands) {
this.filterText = ''
this.refreshTree = false
this.expands = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(this.companyId)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data.fullName.indexOf(value) !== -1;
},
getOrganizeList(isInit) {
this.filterText = ''
this.treeLoading = true
getDepartmentSelectorByAuth().then(res => {
this.treeData = res.data.list
this.treeLoading = false
if (isInit) this.initData()
}).catch(() => {
this.treeLoading = false
})
},
initData() {
this.listLoading = true
getUserList(this.listQuery).then(res => {
this.tableData = res.data.list
this.total = res.data.pagination.total
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
getNodePath(node) {
let fullPath = []
const loop = (node) => {
if (node.level) fullPath.unshift(node.data)
if (node.parent) loop(node.parent)
}
loop(node)
return fullPath
},
handleNodeClick(data, node) {
if (this.listQuery.organizeId === data.id) return
this.listQuery.organizeId = data.id
this.type = data.type
const nodePath = this.getNodePath(node)
this.organizeIdTree = nodePath.map(o => o.id)
this.reset()
},
addOrUpdateHandle(id) {
this.formVisible = true
this.$nextTick(() => {
this.$refs.Form.init(id, this.organizeIdTree || [])
})
},
removeForm(isRefresh) {
this.formVisible = false
if (isRefresh) {
this.keyword = ''
this.initData()
}
},
removeAuthorizeForm(isRefresh) {
this.authorizeFormVisible = false
if (isRefresh) {
this.keyword = ''
this.initData()
}
},
handleUpdateState(row) {
const txt = row.enabledMark ? '禁用' : '开启'
this.$confirm(`您确定要${txt}当前用户吗, 是否继续?`, '提示', {
type: 'warning'
}).then(() => {
updateUserState(row.id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1000,
onClose: () => {
row.enabledMark = row.enabledMark ? 0 : 1
}
})
})
}).catch(() => { })
},
handleDel(id) {
this.$confirm('此操作将永久删除该用户, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
delUser(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.initData()
}
})
})
}).catch(() => { })
},
unlockUser(id) {
this.$confirm('此操作将解除该账户锁定, 是否继续?', '解除锁定', {
type: 'warning'
}).then(() => {
unlockUser(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.initData()
}
})
})
}).catch(() => { })
},
exportForm() {
this.exportFormVisible = true
this.$nextTick(() => {
this.$refs.exportForm.init(this.listQuery)
})
},
uploadForm() {
this.importFormVisible = true
this.$nextTick(() => {
this.$refs.importForm.init()
})
},
handleResetPwd(id, account) {
this.resetFormVisible = true
this.$nextTick(() => {
this.$refs.ResetPwdForm.init(id, account)
})
},
socialsBindBtn(data) {
this.socialsVisible = true
this.$nextTick(() => {
this.$refs.SocialsBind.init(data)
})
},
handleSync() {
this.$router.push({ path: `/system/sysConfig?type=1` })
}
}
}
</script>
<style lang="scss" scoped>
>>> .icon-ym {
font-size: 12px !important;
}
</style>

@ -0,0 +1,144 @@
<template>
<div class="JNPF-common-layout JNPF-flex-main">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item :label="$t('common.keyword')">
<el-input v-model="listQuery.keyword" :placeholder="$t('common.enterKeyword')"
clearable @change="initData()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="initData()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="danger" size="small" @click="batchDel">线</el-button>
</div>
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="tableDataList" has-c
@selection-change="handleSelectionChange">
<el-table-column prop="userName" label="在线用户" width="120" />
<el-table-column prop="loginIPAddress" label="登录IP" width="120" />
<el-table-column prop="loginTime" label="登录时间" width="150" />
<el-table-column prop="loginPlatForm" label="登录设备" show-overflow-tooltip />
<el-table-column label="操作" width="90">
<template slot-scope="scope">
<el-button slot="reference" type="text" class="JNPF-table-delBtn"
@click="handleDel(scope.row.userId)">
{{$t('userOnline.forcedOffline')}}
</el-button>
</template>
</el-table-column>
</JNPF-table>
</div>
</div>
</div>
</template>
<script>
import {
getOnlineUser,
batchDelOnlineUser,
deleteOnlineUser
} from '@/api/permission/onlineUser'
export default {
name: 'permission-userOnline',
data() {
return {
formVisible: false,
tableDataList: [],
refreshLoading: false,
listLoading: true,
multipleSelection: [],
listQuery: {
keyword: ''
}
}
},
created() {
this.initData()
},
methods: {
reset() {
this.listQuery.keyword = ''
this.initData()
},
initData() {
this.listLoading = true
let query = {
...this.listQuery,
keyword: this.keyword
}
getOnlineUser(this.listQuery).then(res => {
this.tableDataList = res.data
this.listLoading = false
this.refreshLoading = false
}).catch(() => {
this.listLoading = false
this.refreshLoading = false
})
},
handleSelectionChange(val) {
const res = val.map(item => item.userId)
this.multipleSelection = res
},
batchDel() {
if (!this.multipleSelection.length) {
this.$message({
type: 'error',
message: '请选择一条数据',
duration: 1500,
})
return
}
this.$confirm('您确定要强制下线这些用户吗, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
batchDelOnlineUser(this.multipleSelection).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.initData()
}
})
})
}).catch(() => { })
},
handleDel(userId) {
this.$confirm(this.$t(`userOnline.cancelAccountTip`), this.$t(`common.tipTitle`), {
type: 'warning'
}).then(() => {
deleteOnlineUser(userId).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.initData()
}
})
})
}).catch(() => { })
}
}
}
</script>

@ -0,0 +1,76 @@
<template>
<el-dialog :title="pageTitle" :close-on-click-modal="false" :close-on-press-escape="false"
:visible.sync="visible" lock-scroll append-to-body destroy-on-close
class="JNPF-dialog JNPF-dialog_center transfer-dialog" width="800px">
<userTransfer v-model="dataForm.userIds" ref="userTransfer" multiple />
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" :loading="btnLoading" @click="dataFormSubmit()">
{{$t('common.confirmButton')}}</el-button>
</span>
</el-dialog>
</template>
<script>
import { getUserRelationList, createUserRelation } from '@/api/permission/userRelation'
import userTransfer from '@/components/JNPF-userTransfer'
export default {
components: { userTransfer },
data() {
return {
visible: false,
btnLoading: false,
pageTitle: '',
dataForm: {
objectId: '',
objectType: '',
userIds: []
},
}
},
watch: {
visible(val) {
if (val) return
this.$emit('closeDialog')
}
},
methods: {
init(id, fullName, type) {
this.visible = true
this.dataForm.objectId = id
this.dataForm.objectType = type
this.dataForm.userIds = []
this.$nextTick(() => {
if (type === 'Position') {
this.pageTitle = this.$t(`position.postMember`) + ' - ' + fullName
} else if (type === 'Role') {
this.pageTitle = this.$t(`role.roleMember`) + ' - ' + fullName
} else if (type === 'Group') {
this.pageTitle = '组内成员 - ' + fullName
}
this.$refs.userTransfer && (this.$refs.userTransfer.allLoading = true)
getUserRelationList(this.dataForm.objectId).then(res => {
this.dataForm.userIds = res.data.ids
this.$refs.userTransfer && this.$refs.userTransfer.init()
})
})
},
dataFormSubmit() {
this.btnLoading = true
createUserRelation(this.dataForm).then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.btnLoading = false
}
})
}).catch(() => {
this.btnLoading = false
})
}
}
}
</script>
Loading…
Cancel
Save