eslint; 收入合同

This commit is contained in:
zhaoxiao
2021-09-03 19:27:41 +08:00
parent c53de39b40
commit 303c1026f8
164 changed files with 5964 additions and 4788 deletions
+159 -159
View File
@@ -165,19 +165,19 @@
import pick from 'lodash.pick'
import moment from 'moment'
import Vue from 'vue'
import {ACCESS_TOKEN} from "@/store/mutation-types"
import {ACCESS_TOKEN} from '@/store/mutation-types'
import {getAction} from '@/api/manage'
import {addUser, editUser, queryUserRole, queryall,queryallRoles, queryDepartTreeList} from '@/api/api'
import {disabledAuthFilter} from "@/utils/authFilter"
import {disabledAuthFilter} from '@/utils/authFilter'
import {duplicateCheck} from '@/api/api'
import { isEmail, passwordReg} from "@/utils/validate";
import {checkPhone,checkEmail,checkUserName} from "@/utils/validateOnly";
import { getRSAPublicKey } from "@/api/login.js";
import {encrypt} from "@/utils/util";
import { isEmail, passwordReg} from '@/utils/validate'
import {checkPhone,checkEmail,checkUserName} from '@/utils/validateOnly'
import { getRSAPublicKey } from '@/api/login.js'
import {encrypt} from '@/utils/util'
export default {
name: "UserModal",
name: 'UserModal',
data() {
return {
departDisabled: false, //是否是我的部门调用该页面
@@ -193,12 +193,12 @@ export default {
selectedDepartKeys: [], //保存用户选择部门id
checkedDepartKeys: [],
checkedDepartNames: [], // 保存部门的名称 =>title
checkedDepartNameString: "", // 保存部门的名称 =>title
checkedDepartNameString: '', // 保存部门的名称 =>title
resultDepartOptions: [],
userId: "", //保存用户id
userId: '', //保存用户id
disableSubmit: false,
userDepartModel: {userId: '', departIdList: []}, // 保存SysUserDepart的用户部门中间表数据需要的对象
dateFormat: "YYYY-MM-DD",
dateFormat: 'YYYY-MM-DD',
validatorRules: {
username: {
rules: [{
@@ -232,13 +232,13 @@ export default {
},],
validateTrigger: 'blur'
},
selectedroles:{rules: [{required: true, message:"请选择角色类型"}], validateTrigger: ['blur','change']},
selecteddeparts:{rules: [{required: true, message:"请选择组织机构"}], validateTrigger: ['blur','change']}
selectedroles:{rules: [{required: true, message:'请选择角色类型'}], validateTrigger: ['blur','change']},
selecteddeparts:{rules: [{required: true, message:'请选择组织机构'}], validateTrigger: ['blur','change']}
// sex:{initialValue:((!this.model.sex)?"": (this.model.sex+""))}
},
departIdShow: false,
departIds: [], //负责部门id
title: "操作",
title: '操作',
visible: false,
model: {},
roleList: [],
@@ -255,36 +255,36 @@ export default {
confirmLoading: false,
headers: {},
form: this.$form.createForm(this),
picUrl: "",
picUrl: '',
url: {
fileUpload: window._CONFIG['domianURL'] + "/sys/common/upload",
userWithDepart: "/sys/user/userDepartList", // 引入为指定用户查看部门信息需要的url
userId: "/sys/user/generateUserId", // 引入生成添加用户情况下的url
syncUserByUserName: "/act/process/extActProcess/doSyncUserByUserName",//同步用户到工作流
fileUpload: window._CONFIG['domianURL'] + '/sys/common/upload',
userWithDepart: '/sys/user/userDepartList', // 引入为指定用户查看部门信息需要的url
userId: '/sys/user/generateUserId', // 引入生成添加用户情况下的url
syncUserByUserName: '/act/process/extActProcess/doSyncUserByUserName',//同步用户到工作流
// queryTenantList: '/sys/tenant/queryList'
},
identity: "1",
identity: '1',
fileList: [],
tenantList: [],
currentTenant: [],
// 公钥
rsaPublicKey:""
rsaPublicKey:''
}
},
created() {
const token = Vue.ls.get(ACCESS_TOKEN);
this.headers = {"X-Access-Token": token}
const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = {'X-Access-Token': token}
// this.initTenantList()
},
computed: {
uploadAction: function () {
return this.url.fileUpload;
return this.url.fileUpload
}
},
methods: {
isDisabledAuth(code) {
return disabledAuthFilter(code);
return disabledAuthFilter(code)
},
// initTenantList() {
// getAction(this.url.queryTenantList).then(res => {
@@ -296,20 +296,20 @@ export default {
//窗口最大化切换
toggleScreen() {
if (this.modaltoggleFlag) {
this.modalWidth = window.innerWidth;
this.modalWidth = window.innerWidth
} else {
this.modalWidth = 800;
this.modalWidth = 800
}
this.modaltoggleFlag = !this.modaltoggleFlag;
this.modaltoggleFlag = !this.modaltoggleFlag
},
initialRoleList() {
queryall().then((res) => {
if (res.success) {
this.roleList = res.result;
this.roleList = res.result
} else {
console.log(res.message);
console.log(res.message)
}
});
})
},
loadUserRoles(userid) {
return new Promise(resolve => {
@@ -317,74 +317,74 @@ export default {
if (res.success) {
resolve(res.result)
} else {
console.log(res.message);
console.log(res.message)
}
});
})
})
},
refresh() {
this.selectedDepartKeys = [];
this.checkedDepartKeys = [];
this.checkedDepartNames = [];
this.checkedDepartNameString = "";
this.userId = ""
this.resultDepartOptions = [];
this.departId = [];
this.departIdShow = false;
this.selectedDepartKeys = []
this.checkedDepartKeys = []
this.checkedDepartNames = []
this.checkedDepartNameString = ''
this.userId = ''
this.resultDepartOptions = []
this.departId = []
this.departIdShow = false
this.currentTenant = []
},
add() {
this.picUrl = "";
this.refresh();
this.edit({activitiSync: '1'});
this.picUrl = ''
this.refresh()
this.edit({activitiSync: '1'})
},
edit(record) {
this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
this.resetScreenSize() // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
// 加载组织机构数据
this.loadDepartTreeData()
// 加载角色数据
this.loadRolesTreeData()
// 获取公钥
this.getPublicKey()
let that = this;
that.initialRoleList();
that.checkedDepartNameString = "";
that.form.resetFields();
if (record.hasOwnProperty("id")) {
let that = this
that.initialRoleList()
that.checkedDepartNameString = ''
that.form.resetFields()
if (record.hasOwnProperty('id')) {
that.loadUserRoles(record.id).then(res => {
that.form.setFieldsValue({selectedroles:res})
});
})
setTimeout(() => {
this.fileList = record.avatar;
this.fileList = record.avatar
}, 5)
}
that.userId = record.id;
that.visible = true;
that.model = Object.assign({}, record);
that.userId = record.id
that.visible = true
that.model = Object.assign({}, record)
if(record.departIds !== '' && record.id){
that.model.selecteddeparts = record.departIds.split(',')
}
that.$nextTick(() => {
that.form.setFieldsValue(pick(this.model, 'username', 'realname', 'email', 'phone', 'post','selecteddeparts'))
});
})
//身份为上级显示负责部门,否则不显示
if (this.model.userIdentity == "2") {
this.identity = "2";
this.departIdShow = true;
if (this.model.userIdentity == '2') {
this.identity = '2'
this.departIdShow = true
} else {
this.identity = "1";
this.departIdShow = false;
this.identity = '1'
this.departIdShow = false
}
// 调用查询用户对应的部门信息的方法
that.checkedDepartKeys = [];
that.loadCheckedDeparts();
that.checkedDepartKeys = []
that.loadCheckedDeparts()
//update-begin-author:taoyan date:2020710 for:多租户配置
if (!record.relTenantIds || record.relTenantIds.length == 0) {
this.currentTenant = []
} else {
this.currentTenant = record.relTenantIds.split(',').map(Number);
this.currentTenant = record.relTenantIds.split(',').map(Number)
}
//update-end-author:taoyan date:2020710 for:多租户配置
},
@@ -393,12 +393,12 @@ export default {
const that = this
queryDepartTreeList().then((res) => {
if(res.success){
that.treeDepartData = [];
that.treeDepartData = []
let treeList = res.result
for(let a=0;a<treeList.length;a++){
let temp = treeList[a];
temp.isLeaf = temp.leaf;
that.treeDepartData.push(temp);
let temp = treeList[a]
temp.isLeaf = temp.leaf
that.treeDepartData.push(temp)
}
}
})
@@ -408,12 +408,12 @@ export default {
const that = this
queryallRoles().then((res) => {
if(res.success){
that.treeRoleData = [];
that.treeRoleData = []
let treeList = res.result
for(let a=0;a<treeList.length;a++){
let temp = treeList[a];
temp.isLeaf = temp.leaf;
that.treeRoleData.push(temp);
let temp = treeList[a]
temp.isLeaf = temp.leaf
that.treeRoleData.push(temp)
}
}
})
@@ -421,23 +421,23 @@ export default {
getPublicKey() {
// 获取公钥
getRSAPublicKey().then(res => {
this.rsaPublicKey = res.result;
});
this.rsaPublicKey = res.result
})
},
loadCheckedDeparts() {
let that = this;
let that = this
if (!that.userId) {
return
}
getAction(that.url.userWithDepart, {userId: that.userId}).then((res) => {
that.checkedDepartNames = [];
that.checkedDepartNames = []
if (res.success) {
var depart = [];
var departId = [];
var depart = []
var departId = []
for (let i = 0; i < res.result.length; i++) {
that.checkedDepartNames.push(res.result[i].title);
this.checkedDepartNameString = this.checkedDepartNames.join(",");
that.checkedDepartKeys.push(res.result[i].key);
that.checkedDepartNames.push(res.result[i].title)
this.checkedDepartNameString = this.checkedDepartNames.join(',')
that.checkedDepartKeys.push(res.result[i].key)
//新增负责部门选择下拉框
depart.push({
key: res.result[i].key,
@@ -445,48 +445,48 @@ export default {
})
departId.push(res.result[i].key)
}
that.resultDepartOptions = depart;
that.resultDepartOptions = depart
//判断部门id是否存在,不存在择直接默认当前所在部门
if (this.model.departIds) {
this.departIds = this.model.departIds.split(",");
this.departIds = this.model.departIds.split(',')
} else {
this.departIds = departId;
this.departIds = departId
}
that.userDepartModel.departIdList = that.checkedDepartKeys
} else {
console.log(res.message);
console.log(res.message)
}
})
},
close() {
this.$emit('close');
this.visible = false;
this.disableSubmit = false;
this.selectedRole = [];
this.userDepartModel = {userId: '', departIdList: []};
this.checkedDepartNames = [];
this.checkedDepartNameString = '';
this.checkedDepartKeys = [];
this.selectedDepartKeys = [];
this.resultDepartOptions = [];
this.departIds = [];
this.departIdShow = false;
this.identity = "1";
this.fileList = [];
this.$emit('close')
this.visible = false
this.disableSubmit = false
this.selectedRole = []
this.userDepartModel = {userId: '', departIdList: []}
this.checkedDepartNames = []
this.checkedDepartNameString = ''
this.checkedDepartKeys = []
this.selectedDepartKeys = []
this.resultDepartOptions = []
this.departIds = []
this.departIdShow = false
this.identity = '1'
this.fileList = []
},
moment,
handleSubmit() {
console.log("username",this.form.getFieldValue('username'))
const that = this;
that.confirmLoading = true;
console.log('username',this.form.getFieldValue('username'))
const that = this
that.confirmLoading = true
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
let formData = Object.assign(this.model, values);
let formData = Object.assign(this.model, values)
if (that.fileList != '') {
formData.avatar = that.fileList;
formData.avatar = that.fileList
} else {
formData.avatar = null;
formData.avatar = null
}
// 公钥参数
formData.rsaPublicKey = that.rsaPublicKey
@@ -498,39 +498,39 @@ export default {
//update-begin-author:taoyan date:2020710 for:多租户配置
formData.relTenantIds = this.currentTenant.length > 0 ? this.currentTenant.join(',') : ''
//update-end-author:taoyan date:2020710 for:多租户配置
formData.selectedroles = values.selectedroles.length > 0 ? values.selectedroles.join(",") : '';
formData.selecteddeparts = values.selecteddeparts.length > 0 ? values.selecteddeparts.join(",") : '';
formData.userIdentity = this.identity;
formData.selectedroles = values.selectedroles.length > 0 ? values.selectedroles.join(',') : ''
formData.selecteddeparts = values.selecteddeparts.length > 0 ? values.selecteddeparts.join(',') : ''
formData.userIdentity = this.identity
//如果是上级择传入departIds,否则为空
if (this.identity === "2") {
formData.departIds = this.departIds.join(",");
if (this.identity === '2') {
formData.departIds = this.departIds.join(',')
} else {
formData.departIds = "";
formData.departIds = ''
}
// that.addDepartsToUser(that,formData); // 调用根据当前用户添加部门信息的方法
let obj;
let obj
if (!this.model.id) {
formData.id = this.userId;
obj = addUser(formData);
formData.id = this.userId
obj = addUser(formData)
} else {
obj = editUser(formData);
obj = editUser(formData)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message);
that.$emit('ok');
that.close();
that.$message.success(res.message)
that.$emit('ok')
that.close()
} else {
that.$message.warning(res.message);
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false;
that.checkedDepartNames = [];
that.userDepartModel.departIdList = {userId: '', departIdList: []};
that.confirmLoading = false
that.checkedDepartNames = []
that.userDepartModel.departIdList = {userId: '', departIdList: []}
})
}else {
that.confirmLoading = false;
that.confirmLoading = false
}
})
},
@@ -538,7 +538,7 @@ export default {
this.close()
},
validateToNextPassword(rule, value, callback) {
const form = this.form;
const form = this.form
if (!value) {
callback()
}
@@ -548,12 +548,12 @@ export default {
if (value && this.confirmDirty) {
form.validateFields(['confirm'], {force: true})
}
callback();
callback()
},
compareToFirstPassword(rule, value, callback) {
const form = this.form;
const form = this.form
if (value && value !== form.getFieldValue('password')) {
callback('两次输入的密码不一样!');
callback('两次输入的密码不一样!')
} else {
callback()
}
@@ -586,62 +586,62 @@ export default {
})
},
handleConfirmBlur(e) {
const value = e.target.value;
const value = e.target.value
this.confirmDirty = this.confirmDirty || !!value
},
normFile(e) {
console.log('Upload event:', e);
console.log('Upload event:', e)
if (Array.isArray(e)) {
return e
}
return e && e.fileList
},
beforeUpload: function (file) {
var fileType = file.type;
var fileType = file.type
if (fileType.indexOf('image') < 0) {
this.$message.warning('请上传图片');
return false;
this.$message.warning('请上传图片')
return false
}
//TODO 验证文件大小
},
handleChange(info) {
this.picUrl = "";
this.picUrl = ''
if (info.file.status === 'uploading') {
this.uploadLoading = true;
this.uploadLoading = true
return
}
if (info.file.status === 'done') {
var response = info.file.response;
this.uploadLoading = false;
console.log(response);
var response = info.file.response
this.uploadLoading = false
console.log(response)
if (response.success) {
this.model.avatar = response.message;
this.picUrl = "Has no pic url yet";
this.model.avatar = response.message
this.picUrl = 'Has no pic url yet'
} else {
this.$message.warning(response.message);
this.$message.warning(response.message)
}
}
},
// 搜索用户对应的部门API
onSearch() {
this.$refs.departWindow.add(this.checkedDepartKeys, this.userId);
this.$refs.departWindow.add(this.checkedDepartKeys, this.userId)
},
// 获取用户对应部门弹出框提交给返回的数据
modalFormOk(formData) {
this.checkedDepartNames = [];
this.selectedDepartKeys = [];
this.checkedDepartNameString = '';
this.userId = formData.userId;
this.userDepartModel.userId = formData.userId;
this.departIds = [];
this.resultDepartOptions = [];
var depart = [];
this.checkedDepartNames = []
this.selectedDepartKeys = []
this.checkedDepartNameString = ''
this.userId = formData.userId
this.userDepartModel.userId = formData.userId
this.departIds = []
this.resultDepartOptions = []
var depart = []
for (let i = 0; i < formData.departIdList.length; i++) {
this.selectedDepartKeys.push(formData.departIdList[i].key);
this.checkedDepartNames.push(formData.departIdList[i].title);
this.checkedDepartNameString = this.checkedDepartNames.join(",");
this.selectedDepartKeys.push(formData.departIdList[i].key)
this.checkedDepartNames.push(formData.departIdList[i].title)
this.checkedDepartNameString = this.checkedDepartNames.join(',')
//新增部门选择,如果上面部门选择后不为空直接付给负责部门
depart.push({
key: formData.departIdList[i].key,
@@ -649,24 +649,24 @@ export default {
})
this.departIds.push(formData.departIdList[i].key)
}
this.resultDepartOptions = depart;
this.userDepartModel.departIdList = this.selectedDepartKeys;
this.resultDepartOptions = depart
this.userDepartModel.departIdList = this.selectedDepartKeys
this.checkedDepartKeys = this.selectedDepartKeys //更新当前的选择keys
},
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize() {
let screenWidth = document.body.clientWidth;
let screenWidth = document.body.clientWidth
if (screenWidth < 500) {
this.drawerWidth = screenWidth;
this.drawerWidth = screenWidth
} else {
this.drawerWidth = 700;
this.drawerWidth = 700
}
},
identityChange(e) {
if (e.target.value === "1") {
this.departIdShow = false;
if (e.target.value === '1') {
this.departIdShow = false
} else {
this.departIdShow = true;
this.departIdShow = true
}
}
}