Commit b56807a9 authored by sixiaofeng's avatar sixiaofeng

1

parent 24154def
File added
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue from 'vue'
import { isAppEnv } from './util/Bridge' import { isAppEnv, close } from './util/Bridge'
import {postMessage} from '@/util/PostMessage' import {postMessage} from '@/util/PostMessage'
import { PostMsg } from './Interface' import { PostMsg } from './Interface'
...@@ -22,22 +22,33 @@ export default Vue.extend({ ...@@ -22,22 +22,33 @@ export default Vue.extend({
} }
}, },
created() { created() {
console.log(isAppEnv(), 'env')
if (!isAppEnv()) { if (!isAppEnv()) {
this.intervalHandler() this.intervalHandler()
this.timer = setInterval(this.intervalHandler, 60 * 1000) this.timer = setInterval(this.intervalHandler, 60 * 1000)
} }
if (window.history) {
window.addEventListener('popstate', this.handler)
}
}, },
beforeDestroy() { beforeDestroy() {
if (!isAppEnv()) { if (!isAppEnv()) {
clearInterval(this.timer) clearInterval(this.timer)
} }
window.removeEventListener('popstate', this.handler)
}, },
methods: { methods: {
handler(e:PopStateEvent) {
if(this.$route.path === '/team/team-frame') {
close()
}
if(this.$route.path === '/team/two-code') {
console.log('two-code')
window.history.pushState(null, '', window.origin + '/team/team-frame')
}
},
intervalHandler() { intervalHandler() {
postMessage(PostMsg.GET_AUTH).then((data: any) => { postMessage(PostMsg.GET_AUTH).then((data: any) => {
if (data.method === PostMsg.GET_AUTH) { if (data.method === PostMsg.GET_AUTH) {
console.log(data, 'getAuth')
this.$global.sig = data.data this.$global.sig = data.data
} }
}) })
......
...@@ -37,8 +37,11 @@ export interface Department { ...@@ -37,8 +37,11 @@ export interface Department {
entId: string, entId: string,
id: string, id: string,
leaderId: string, leaderId: string,
leaderName?: string,
name: string, name: string,
parentId: string, parentId: string,
hasSubDep: boolean,
staffNum: number,
children?: Array<Department> children?: Array<Department>
} }
......
...@@ -30,7 +30,6 @@ export default class BaseService { ...@@ -30,7 +30,6 @@ export default class BaseService {
(res)=>{ (res)=>{
if (!isAppEnv()) { if (!isAppEnv()) {
// from pc // from pc
console.log('request')
res.headers['FZM-SIGNATURE'] = global.sig || 'MOCK' res.headers['FZM-SIGNATURE'] = global.sig || 'MOCK'
} }
return res return res
......
...@@ -42,6 +42,7 @@ enum BridgeMethods { ...@@ -42,6 +42,7 @@ enum BridgeMethods {
export function isAppEnv() { export function isAppEnv() {
const env = window.navigator.userAgent || navigator.userAgent const env = window.navigator.userAgent || navigator.userAgent
console.log(env, env.includes(';FZM-3SYXIN;'), 'appEnv')
if (env.includes(';FZM-3SYXIN;')) { if (env.includes(';FZM-3SYXIN;')) {
return true return true
} else { } else {
...@@ -51,7 +52,6 @@ export function isAppEnv() { ...@@ -51,7 +52,6 @@ export function isAppEnv() {
export function appNavBack() { export function appNavBack() {
const appEnv = isAppEnv() const appEnv = isAppEnv()
console.log(111, appEnv)
if (appEnv) { if (appEnv) {
goBack() goBack()
} else { } else {
......
export function postMessage(method: string, body?: any ): Promise<any> { export function postMessage(method: string, body?: any): Promise<any> {
console.log(method, 'post message')
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
window.parent.postMessage({ window.parent.postMessage({
appId: '3syxin', appId: '3syxin',
...@@ -7,10 +6,8 @@ export function postMessage(method: string, body?: any ): Promise<any> { ...@@ -7,10 +6,8 @@ export function postMessage(method: string, body?: any ): Promise<any> {
body body
}, '*') }, '*')
window.addEventListener('message', handler) window.addEventListener('message', handler)
function handler(e: MessageEvent) { function handler(e: MessageEvent) {
const {data} = e const { data } = e
console.log(data.body, 'message body')
resolve({ resolve({
method, method,
data: data.body data: data.body
......
export function transferFile(base64Str: string, fileName: string) {
let arr = base64Str.split(','),
mime = (arr[0].match(/:(.*?);/) as any)[1], //base64解析出来的图片类型
bstr = atob(arr[1]) , //对base64串进行操作,去掉url头,并转换为byte atob为window内置方法
len = bstr.length,
ab = new ArrayBuffer(len), //将ASCII码小于0的转换为大于0
u8arr = new Uint8Array(ab) //
while (len--) {
u8arr[len] = bstr.charCodeAt(len)
}
// 创建新的 File 对象实例[utf-8内容,文件名称或者路径,[可选参数,type:文件中的内容mime类型]]
return new File([u8arr], fileName, {
type: mime
})
}
\ No newline at end of file
...@@ -75,20 +75,6 @@ export default Vue.extend({ ...@@ -75,20 +75,6 @@ export default Vue.extend({
name: '', name: '',
parentId: '' parentId: ''
} }
const depTree: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: ''
}
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: ''
}
return { return {
name: '', name: '',
check: false, check: false,
...@@ -103,7 +89,7 @@ export default Vue.extend({ ...@@ -103,7 +89,7 @@ export default Vue.extend({
selectedLeaderId: [] as Array<string>, selectedLeaderId: [] as Array<string>,
showMemberSelector: false, showMemberSelector: false,
entId: '', entId: '',
depTree, depTree: {} as Department,
selectedDepId: '', selectedDepId: '',
contacts: {}, contacts: {},
loading: false, loading: false,
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
color="#4F62C1" color="#4F62C1"
:show-confirm="true" :show-confirm="true"
:style="{ height: '100%' }" :style="{ height: '100%' }"
:min-date="new Date(1900,1,1)" :min-date="new Date(1971,1,1)"
@confirm="selectJoinTime" @confirm="selectJoinTime"
/> />
<!-- 选择部门 --> <!-- 选择部门 -->
...@@ -130,20 +130,6 @@ export default Vue.extend({ ...@@ -130,20 +130,6 @@ export default Vue.extend({
}) })
}, },
data() { data() {
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: '',
}
const depTree: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: ''
}
const acceptJoin: AcceptJoinDTO = { const acceptJoin: AcceptJoinDTO = {
expiration: 0, expiration: 0,
inviterId: '', inviterId: '',
...@@ -164,12 +150,12 @@ export default Vue.extend({ ...@@ -164,12 +150,12 @@ export default Vue.extend({
depId: '', depId: '',
entId: '', entId: '',
selectedDepId: '', selectedDepId: '',
currentDep, currentDep: {} as Department,
loading: false, loading: false,
acceptJoin, acceptJoin,
updateStaff: {} as UpdateStaffDTO, updateStaff: {} as UpdateStaffDTO,
showDepSelector: false, showDepSelector: false,
depTree, depTree: {} as Department,
pageTitle: '添加成员', pageTitle: '添加成员',
isEdit: false, isEdit: false,
usrId: '', usrId: '',
......
...@@ -114,9 +114,9 @@ export default Vue.extend({ ...@@ -114,9 +114,9 @@ export default Vue.extend({
// 添加管理员 // 添加管理员
confirm(arr: string[]) { confirm(arr: string[]) {
if (arr.length === 0) return if (arr.length === 0) return
this.changeRole(arr[0], 1) this.changeRole(arr[0], 1, 'add')
}, },
changeRole(id: string, role: number) { changeRole(id: string, role: number, action: string) {
this.loading=true this.loading=true
return this.$service.staff.changeRole({ return this.$service.staff.changeRole({
entId: this.entInfo.id, entId: this.entInfo.id,
...@@ -126,7 +126,7 @@ export default Vue.extend({ ...@@ -126,7 +126,7 @@ export default Vue.extend({
const {data} = res const {data} = res
this.loading=false this.loading=false
if (data.code === this.$global.success) { if (data.code === this.$global.success) {
this.$toast('添加成功') this.$toast(action === 'remove' ? '删除成功' : '添加成功')
// this.getSub() // this.getSub()
this.$router.push('/team/team-management') this.$router.push('/team/team-management')
} else { } else {
...@@ -156,18 +156,7 @@ export default Vue.extend({ ...@@ -156,18 +156,7 @@ export default Vue.extend({
removeManager(id: string) { removeManager(id: string) {
// this.list = this.list.filter(item => item.id !== id) // this.list = this.list.filter(item => item.id !== id)
this.loading = true this.loading = true
this.changeRole(id, 3).then((res: any) => { this.changeRole(id, 3, 'remove')
const {data} = res
this.loading = false
if (data.code === this.$global.success) {
// 移除成功
this.$toast('删除成功')
// this.getSub()
this.$router.push('/team/team-management')
} else {
this.$toast(data.msg)
}
}).catch(() => this.loading = false)
}, },
addManager() { addManager() {
this.selectedLeaderId = [] this.selectedLeaderId = []
......
<template> <template>
<!-- 头像 --> <!-- 头像 -->
<div v-if="show" class="w-full h-screen overflow-y-scroll relative z-2001 bg-black pb-4"> <div v-if="show" class="w-full h-screen overflow-y-scroll relative z-2001 bg-black pb-4">
<van-action-sheet <div class="header w-full px-4 bg-black fixed top-0 left-0 z-2001 h-12 flex items-center justify-between">
v-model="showActionSheet" <app-icon
cancel-text="取消" class-name="w-6.5 h-6.5"
close-on-click-action icon-name="left-arrow-white"
> @click="goBack"
/>
<div class="text-white">团队头像</div>
<div class=""> <div class="">
<!-- <div class="px-4 py-3 text-center">拍照</div> --> <!-- <div class="px-4 py-3 text-center">拍照</div> -->
<div class="px-4 py-3 text-center" @click="uploadFile"> <div @click="uploadFile">
<div>从手机相册中选择</div> <app-icon
class-name="w-6.5 h-6.5"
icon-name="photo"
/>
<input <input
type="file" type="file"
id="uploadFile" id="uploadFile"
...@@ -20,19 +25,11 @@ ...@@ -20,19 +25,11 @@
/> />
</div> </div>
</div> </div>
</van-action-sheet> <!-- <app-icon
<div class="header w-full px-4 bg-black fixed top-0 left-0 z-2001 h-12 flex items-center justify-between">
<app-icon
class-name="w-6.5 h-6.5"
icon-name="left-arrow-white"
@click="goBack"
/>
<div class="text-white">团队头像</div>
<app-icon
class-name="w-5 h-1" class-name="w-5 h-1"
icon-name="dot-h" icon-name="dot-h"
@click="showActionSheet=true" @click="showActionSheet=true"
/> /> -->
</div> </div>
<div class="py-16 px-6"> <div class="py-16 px-6">
<!-- 默认头像 --> <!-- 默认头像 -->
...@@ -87,16 +84,11 @@ export default Vue.extend({ ...@@ -87,16 +84,11 @@ export default Vue.extend({
cameraHeight: 0, cameraHeight: 0,
stream: {} as any, stream: {} as any,
myCropper: {} as Cropper, myCropper: {} as Cropper,
showActionSheet: false,
// showVideo: false, // showVideo: false,
showCropper: false, showCropper: false,
showCamera: false, showCamera: false,
showDefault: true, showDefault: true,
img: '', img: '',
actions: [
// {name: '拍照', action: 'photo'},
{name: '从手机相册选择', action: 'file'}
],
defaultImg: '' defaultImg: ''
} }
}, },
...@@ -118,32 +110,22 @@ export default Vue.extend({ ...@@ -118,32 +110,22 @@ export default Vue.extend({
reader.readAsDataURL(file) reader.readAsDataURL(file)
reader.onloadend = () => { reader.onloadend = () => {
this.img = reader.result as string this.img = reader.result as string
this.showCropper = true this.defaultImg = reader.result as string
this.showDefault = false // this.showCropper = true
this.$nextTick(() => { // this.showDefault = false
this.initCropper() // this.$nextTick(() => {
}) // this.initCropper()
// })
} }
} }
}, },
uploadFile() { uploadFile() {
const fileInput = this.$refs.uploadFile as HTMLInputElement const fileInput = this.$refs.uploadFile as HTMLInputElement
fileInput.click() fileInput.click()
this.showActionSheet = false
}, },
goBack() { goBack() {
this.$emit('update:show', false) this.$emit('update:show', false)
}, },
onSelect(item: {name: string, action: string}) {
if (item.action === 'photo') {
this.showCamera = true
this.showDefault = false
// this.showVideo=true
this.$nextTick(() => {
this.openCamera()
})
}
},
// 保存头像 // 保存头像
saveImage() { saveImage() {
this.showCropper = false this.showCropper = false
...@@ -173,6 +155,7 @@ export default Vue.extend({ ...@@ -173,6 +155,7 @@ export default Vue.extend({
alert("你的浏览器不支持访问用户媒体设备") alert("你的浏览器不支持访问用户媒体设备")
} }
}, },
// 图片裁剪
initCropper() { initCropper() {
this.myCropper.destroy && this.myCropper.destroy() this.myCropper.destroy && this.myCropper.destroy()
this.myCropper = new Cropper(this.$refs.image as HTMLImageElement, { this.myCropper = new Cropper(this.$refs.image as HTMLImageElement, {
...@@ -243,7 +226,7 @@ export default Vue.extend({ ...@@ -243,7 +226,7 @@ export default Vue.extend({
this.showCropper = false this.showCropper = false
this.myCropper.destroy() this.myCropper.destroy()
}, },
// 摄像头读取头像 // 保存摄像头读取头像
saveImg() { saveImg() {
this.readImg() this.readImg()
this.stream.getTracks().forEach(function(track: any){ this.stream.getTracks().forEach(function(track: any){
...@@ -255,6 +238,7 @@ export default Vue.extend({ ...@@ -255,6 +238,7 @@ export default Vue.extend({
this.initCropper() this.initCropper()
}) })
}, },
// 摄像头拍照
readImg() { readImg() {
let video = this.$refs.video as HTMLVideoElement, let video = this.$refs.video as HTMLVideoElement,
canvas = this.$refs.canvas as HTMLCanvasElement, canvas = this.$refs.canvas as HTMLCanvasElement,
......
...@@ -92,7 +92,7 @@ export default Vue.extend({ ...@@ -92,7 +92,7 @@ export default Vue.extend({
loading: false, loading: false,
changed: false, changed: false,
changedVal, changedVal,
checkedMember: [] as string[], checkedMember: [] as string[]
} }
}, },
watch: { watch: {
......
...@@ -39,10 +39,11 @@ ...@@ -39,10 +39,11 @@
/> />
</div> </div>
<div class="title flex-1 truncate py-3 ml-6"> <div class="title flex-1 truncate py-3 ml-6">
{{ t.name }}{{ t.children && t.children.length > 0 ? ` (${t.children.length}) ` : '' }} {{ t.name }}{{ t.staffNum ? ` (${t.staffNum}) ` : '' }}
</div> </div>
</div> </div>
<div <div
v-if="t.hasSubDep"
class="flex-shrink-0 flex items-center text-color-primary py-3" class="flex-shrink-0 flex items-center text-color-primary py-3"
@click="goNext(t)" @click="goNext(t)"
> >
...@@ -86,21 +87,13 @@ export default Vue.extend({ ...@@ -86,21 +87,13 @@ export default Vue.extend({
selected: String, selected: String,
}, },
data() { data() {
// const selectedIds: Array<Department> = [] // const selectedIds: Array<Department> = []}
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: '',
children: []
}
return { return {
checked: '', checked: '',
loading: false, loading: false,
entId: '', entId: '',
depId: '', depId: '',
currentDep, currentDep: {} as Department,
teams: [] as Department[], teams: [] as Department[],
depList: [] as Department[] depList: [] as Department[]
} }
...@@ -140,7 +133,6 @@ export default Vue.extend({ ...@@ -140,7 +133,6 @@ export default Vue.extend({
this.currentDep.children = data.data.subDepList this.currentDep.children = data.data.subDepList
const index = this.teams.findIndex(d => d.id === this.depId) const index = this.teams.findIndex(d => d.id === this.depId)
this.depList = data.data.subDepList || [] this.depList = data.data.subDepList || []
console.log(index, 'idex')
if (index < 0) { if (index < 0) {
this.teams.push(data.data.dep) this.teams.push(data.data.dep)
} else { } else {
......
...@@ -57,10 +57,8 @@ ...@@ -57,10 +57,8 @@
<script lang="ts"> <script lang="ts">
import Vue, {PropType} from 'vue' import Vue, {PropType} from 'vue'
import { useLocalStorageState } from 'ahooks-vue'
import { getUserInfo, openCompanyUserInfo } from '@/util/Bridge'
import { getContacts } from '@/util/Contact'
import { Department, Staff } from '@/Interface' import { Department, Staff } from '@/Interface'
import { Role } from '@/service/moudles/service.dto'
// import {openCompanyUserInfo} from '@/util/Bridge' // import {openCompanyUserInfo} from '@/util/Bridge'
export default Vue.extend({ export default Vue.extend({
...@@ -98,13 +96,6 @@ export default Vue.extend({ ...@@ -98,13 +96,6 @@ export default Vue.extend({
}, },
data() { data() {
const tree: Array<Department> = [] const tree: Array<Department> = []
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: ''
}
return { return {
tree, tree,
teamArr: [] as Department[], teamArr: [] as Department[],
...@@ -113,11 +104,11 @@ export default Vue.extend({ ...@@ -113,11 +104,11 @@ export default Vue.extend({
parentId: '', parentId: '',
entId: '', entId: '',
ifContainChildDep: true, ifContainChildDep: true,
currentDep, currentDep: {} as Department,
checkedMember: [] as string[], checkedMember: [] as string[],
showRadio: true, showRadio: true,
leaders: {} as{list: Staff[], title?: string}, leaders: {} as{list: Staff[], title?: string}
} }
}, },
mounted() { mounted() {
...@@ -215,13 +206,18 @@ export default Vue.extend({ ...@@ -215,13 +206,18 @@ export default Vue.extend({
// 负责人/管理员 // 负责人/管理员
if (this.isNotDepRoot) { if (this.isNotDepRoot) {
// 不在架构根目录 // 不在架构根目录
const leader = {...data.data.leader, isDepAdmin: true} const leader = data.data.leader
this.leaders.list = [leader] if (typeof leader !== 'undefined' && leader.id !== '') {
const staff = {...data.data.leader, isDepAdmin: true}
this.leaders.list = [staff]
} else {
this.leaders.list = []
}
} else { } else {
this.leaders.list = data.data.staffList?.filter((i: Staff) => i.role !== 3) this.leaders.list = data.data.staffList?.filter((i: Staff) => i.role !== Role.COMMON_MEMBER).sort((a: Staff, b: Staff) => a.role - b.role)
} }
// 普通成员 // 普通成员
this.contacts = data.data.staffList?.filter((i: Staff) => i.role === 3) this.contacts = data.data.staffList || []
// 部门树 // 部门树
const depTree = data.data.dep const depTree = data.data.dep
const index = this.teamArr.findIndex(d => d.id === this.parentId) const index = this.teamArr.findIndex(d => d.id === this.parentId)
......
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
<template v-if="Object.keys(list).length > 0 || (leader.list && leader.list.length > 0)"> <template v-if="Object.keys(list).length > 0 || (leader.list && leader.list.length > 0)">
<!-- 主管负责人 --> <!-- 主管负责人 -->
<div class="leaders" v-if="leader.list.length > 0"> <div class="leaders" v-if="leader.list.length > 0">
<div class="text-text-secondary py-1">管理员</div> <div class="text-text-secondary py-1">{{sectionTitleLeader}}</div>
<div <div
v-for="(l, index) in leader.list" v-for="(l, index) in leader.list"
:key="index" :key="index"
class="flex items-center color-color-primary font-normal" class="flex items-center color-color-primary font-normal"
> >
<!-- 设置radio --> <!-- 设置radio -->
<template v-if="radio"> <template v-if="radio && canSelectLeader(l)">
<div class="w-8 h-8 flex items-center justify-start" @click="handleCheck(l)"> <div class="w-8 h-8 flex items-center justify-start" @click="handleCheck(l)">
<template v-if="checked.indexOf(l.id) > -1"> <template v-if="checked.indexOf(l.id) > -1">
<app-icon <app-icon
...@@ -126,7 +126,11 @@ export default Vue.extend({ ...@@ -126,7 +126,11 @@ export default Vue.extend({
type: Boolean, type: Boolean,
default: false default: false
}, },
containerId: String containerId: String,
sectionTitleLeader: {
type: String,
default: '权限管理'
}
}, },
components:{ components:{
'app-icon':()=>import('@/components/common/Icon.vue'), 'app-icon':()=>import('@/components/common/Icon.vue'),
...@@ -190,6 +194,9 @@ export default Vue.extend({ ...@@ -190,6 +194,9 @@ export default Vue.extend({
} }
}, },
methods: { methods: {
canSelectLeader(leader: Staff) {
return this.contactList.findIndex((l: Staff) => l.id === leader.id) > -1
},
debounce(fn: ()=>void, delay: number) { debounce(fn: ()=>void, delay: number) {
let timer: number | null let timer: number | null
return function() { return function() {
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<!-- 横线 --> <!-- 横线 -->
<div class="absolute w-3 h-0.5 left-3 bg-border-lighter top-1/2 transform -translate-y-1/2" /> <div class="absolute w-3 h-0.5 left-3 bg-border-lighter top-1/2 transform -translate-y-1/2" />
<!-- 标题 --> <!-- 标题 -->
<div class="title">{{ t.name }} {{ t.children && t.children.length ? `(${t.children.length})` : "" }}</div> <div class="title">{{ t.name }} {{ t.staffNum ? `(${t.staffNum})` : "" }}</div>
<!-- icon --> <!-- icon -->
<div <div
class="dot absolute right-3 top-1/2 transform -translate-y-1/2" class="dot absolute right-3 top-1/2 transform -translate-y-1/2"
......
...@@ -68,8 +68,10 @@ ...@@ -68,8 +68,10 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue from 'vue'
// import { Dialog } from 'vant' // import { Dialog } from 'vant'
import { getUserInfo, goBack, refreshCompanyState } from '@/util/Bridge' import { getUserInfo, goBack, isAppEnv, refreshCompanyState } from '@/util/Bridge'
import { trim } from '@/util/Common' import { trim } from '@/util/Common'
import { postMessage } from '@/util/PostMessage'
import { PostMsg } from '@/Interface'
export default Vue.extend({ export default Vue.extend({
name: 'Createteam', name: 'Createteam',
...@@ -94,7 +96,9 @@ export default Vue.extend({ ...@@ -94,7 +96,9 @@ export default Vue.extend({
IMServer: '', IMServer: '',
nodeServer: '', nodeServer: '',
oaServer: 'http://172.16.101.107:20000', oaServer: 'http://172.16.101.107:20000',
showServerList: false // oaServer: '',
showServerList: false,
entId: ''
} }
}, },
computed: { computed: {
...@@ -106,8 +110,19 @@ export default Vue.extend({ ...@@ -106,8 +110,19 @@ export default Vue.extend({
} }
} }
}, },
created() { async created() {
console.log(getUserInfo(), 'ss') // if (process.env.NODE_ENV === 'production') {
// if (!isAppEnv()) {
// const usrData = await postMessage(PostMsg.GET_USER_INFO)
// this.entId = usrData.data.entId
// } else {
// this.entId = JSON.parse(getUserInfo() as string).entId
// }
// } else {
// this.entId = '168398222891421696'
// }
// console.log(JSON.parse(getUserInfo() as string), this.entId, 'entId')
// this.getEntInfo()
this.$service.common.getServer().then((res: any) => { this.$service.common.getServer().then((res: any) => {
const { data } = res const { data } = res
if (data.code === 0) { if (data.code === 0) {
...@@ -119,6 +134,19 @@ export default Vue.extend({ ...@@ -119,6 +134,19 @@ export default Vue.extend({
}) })
}, },
methods: { methods: {
// getEntInfo() {
// this.$service.enterprise.getEnterpriseInfo({
// id: this.entId
// }).then((res: any) => {
// const { data } = res
// if (data.code === this.$global.success) {
// localStorage.setItem('ENT_INFO', JSON.stringify(data.data))
// this.oaServer=data.data.oaServer
// } else {
// this.$toast(data.msg)
// }
// })
// },
goBack, goBack,
handleClickLeft() { handleClickLeft() {
console.log('click left') console.log('click left')
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<contact-selector <contact-selector
:contact-title="contactTitle" :contact-title="contactTitle"
:ent-id="entId" :ent-id="entId"
:dep="depInfo" :dep="currentDep"
:title="contactSelectorTitle" :title="contactSelectorTitle"
:show.sync="showContactSelector" :show.sync="showContactSelector"
:multiple="multiple" :multiple="multiple"
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/> />
<div class="pt-14 px-4"> <div class="pt-14 px-4">
<input-cell <input-cell
v-model="depInfo.name" v-model="depName"
required required
:limit="20" :limit="20"
label="部门名称" label="部门名称"
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<c-cell <c-cell
dot dot
title="部门主管" title="部门主管"
:content="leaderInfo.name" :content="leaderInfo.leaderName"
class="mt-4" class="mt-4"
@click="selectLeader" @click="selectLeader"
/> />
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
import { Department, Staff } from '@/Interface' import { Department, Staff } from '@/Interface'
import Vue from 'vue' import Vue from 'vue'
import { getContacts, getLeaders } from '@/util/Contact' import { getContacts, getLeaders } from '@/util/Contact'
import { Role } from '@/service/moudles/service.dto'
export default Vue.extend({ export default Vue.extend({
name: 'DepartmentManagement', name: 'DepartmentManagement',
...@@ -108,8 +109,11 @@ export default Vue.extend({ ...@@ -108,8 +109,11 @@ export default Vue.extend({
depId: '', depId: '',
depName: '', depName: '',
entId: '', entId: '',
depInfo: {} as Department, depInfo: {} as Department, // 上级部门
leaderInfo: {} as Staff, leaderInfo: {
leaderName: '',
leaderId: ''
}, // 领导信息
showMemberSelector: false, showMemberSelector: false,
containChild: true, containChild: true,
...@@ -118,7 +122,7 @@ export default Vue.extend({ ...@@ -118,7 +122,7 @@ export default Vue.extend({
multiple: false, multiple: false,
contacts: [] as Array<Staff>, contacts: [] as Array<Staff>,
leader: {} as {list: Staff[], title?:string}, leader: {} as {list: Staff[]},
showContactSelector: false, showContactSelector: false,
contactSelectorTitle: '', contactSelectorTitle: '',
actionType: 'add', actionType: 'add',
...@@ -127,23 +131,29 @@ export default Vue.extend({ ...@@ -127,23 +131,29 @@ export default Vue.extend({
showDepSelector: false, showDepSelector: false,
selectedDepId: '', selectedDepId: '',
// currentDepId: '', // 当前部门id // currentDepId: '', // 当前部门id
currentDep: {} as Department
} }
}, },
async created() { async created() {
// 获取修改的部门id
this.depId = this.$route.params.id this.depId = this.$route.params.id
this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id
this.depInfo = await this.getDepInfo(this.depId) // 当前部门
this.depName = this.depInfo.name this.currentDep = await this.getDepInfo(this.depId)
if (this.depInfo.parentId === '-1') {
this.depName = this.currentDep.name
// 主管信息
this.leaderInfo.leaderName = this.currentDep.leaderName!
this.leaderInfo.leaderId = this.currentDep.leaderId
// 上级部门信息
if (this.currentDep.parentId === '-1') {
// 父级部门parentId -1 上级部门显示企业名称 // 父级部门parentId -1 上级部门显示企业名称
this.depInfo = JSON.parse(localStorage.getItem('ENT_INFO') as string) this.depInfo = JSON.parse(localStorage.getItem('ENT_INFO') as string)
} else { } else {
// 查询上级部门显示 // 查询上级部门显示
this.depInfo = await this.getDepInfo(this.depInfo.parentId) this.depInfo = await this.getDepInfo(this.currentDep.parentId)
} }
this.selectedDepId = this.depInfo.id this.selectedDepId = this.depInfo.id
// 获取成员信息
this.getStaffInfo(this.depInfo.leaderId)
}, },
methods: { methods: {
selectParentDep() { selectParentDep() {
...@@ -173,7 +183,8 @@ export default Vue.extend({ ...@@ -173,7 +183,8 @@ export default Vue.extend({
const {data} = res const {data} = res
this.loading = false this.loading = false
if (data.code === this.$global.success) { if (data.code === this.$global.success) {
this.leaderInfo = data.data this.leaderInfo.leaderId = data.data.id
this.leaderInfo.leaderName = data.data.name
}else { }else {
this.$toast(data.msg) this.$toast(data.msg)
} }
...@@ -194,12 +205,16 @@ export default Vue.extend({ ...@@ -194,12 +205,16 @@ export default Vue.extend({
// 通讯录 // 通讯录
this.contacts = data.data.staffList || [] this.contacts = data.data.staffList || []
if (this.actionType === 'add') { if (this.actionType === 'add') {
this.leader.list = data.data.staffList?.filter((i: Staff) => i.role !== 3) this.leader.list = data.data.staffList?.filter((i: Staff) => i.role !== Role.COMMON_MEMBER).sort((a: Staff, b: Staff) => a.role - b.role)
this.leader.title = ''
this.contactTitle = JSON.parse(localStorage.getItem('ENT_INFO') as string).name this.contactTitle = JSON.parse(localStorage.getItem('ENT_INFO') as string).name
} else { } else {
this.leader.list = typeof data.data.leader === 'undefined' ? [] : [data.data.leader] const leader = data.data.leader
this.leader.title='主管' if (typeof leader === 'undefined' || leader.id === '') {
this.leader.list = []
} else {
const staff = {...data.data.leader, isDepAdmin: true}
this.leader.list = typeof data.data.leader === 'undefined' ? [] : [staff]
}
} }
} else { } else {
this.$toast(data.msg) this.$toast(data.msg)
...@@ -211,7 +226,7 @@ export default Vue.extend({ ...@@ -211,7 +226,7 @@ export default Vue.extend({
this.multiple=false this.multiple=false
this.actionType='select' this.actionType='select'
this.memberSelectorTitle='选择主管' this.memberSelectorTitle='选择主管'
this.selectedMemberId = [this.leaderInfo.id] this.selectedMemberId = [this.leaderInfo.leaderId]
}, },
addMember() { addMember() {
this.showMemberSelector = true this.showMemberSelector = true
...@@ -225,7 +240,8 @@ export default Vue.extend({ ...@@ -225,7 +240,8 @@ export default Vue.extend({
this.actionType="remove" this.actionType="remove"
this.contactSelectorTitle = '移除成员' this.contactSelectorTitle = '移除成员'
this.multiple = true this.multiple = true
this.getStaff(this.depInfo.id, true) // 查询当前部门的成员
this.getStaff(this.currentDep.id, true)
}, },
deleteDep() { deleteDep() {
this.$dialog.confirm({ this.$dialog.confirm({
...@@ -235,7 +251,7 @@ export default Vue.extend({ ...@@ -235,7 +251,7 @@ export default Vue.extend({
}).then(() => { }).then(() => {
const data = { const data = {
entId: this.entId, entId: this.entId,
id: this.depInfo.id id: this.currentDep.id
} }
this.loading=true this.loading=true
this.$service.department.deleteDep(data).then((res:any) => { this.$service.department.deleteDep(data).then((res:any) => {
...@@ -261,7 +277,7 @@ export default Vue.extend({ ...@@ -261,7 +277,7 @@ export default Vue.extend({
const data = { const data = {
name: this.depName, name: this.depName,
id: this.depId, id: this.depId,
leaderId: this.leaderInfo.id, leaderId: this.leaderInfo.leaderId,
entId: this.entId, entId: this.entId,
parentId: this.depInfo.id parentId: this.depInfo.id
} }
...@@ -284,8 +300,17 @@ export default Vue.extend({ ...@@ -284,8 +300,17 @@ export default Vue.extend({
} }
}, },
async selectedDepId(val: string) { async selectedDepId(val: string) {
if (val !== this.depInfo.id) {
this.depInfo = await this.getDepInfo(val) this.depInfo = await this.getDepInfo(val)
} }
},
// async showContactSelector(val) {
// if (!val && this.actionType === 'remove') {
// const data = await this.getDepInfo(this.currentDep.id)
// this.leaderInfo.leaderName = data.leaderName!
// this.leaderInfo.leaderId = data.leaderId
// }
// }
} }
}) })
</script> </script>
......
...@@ -97,21 +97,13 @@ export default Vue.extend({ ...@@ -97,21 +97,13 @@ export default Vue.extend({
}) })
}, },
data() { data() {
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: '',
children: []
}
return { return {
checked: '', checked: '',
fromPath: '', fromPath: '',
loading: false, loading: false,
entId: '', entId: '',
depId: '', depId: '',
currentDep, currentDep: {} as Department,
entName: '' entName: ''
} }
}, },
......
...@@ -100,13 +100,6 @@ export default Vue.extend({ ...@@ -100,13 +100,6 @@ export default Vue.extend({
}, },
data() { data() {
const tree: Department[]= [] const tree: Department[]= []
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: ''
}
return { return {
title: '导航', title: '导航',
tree, tree,
...@@ -115,7 +108,7 @@ export default Vue.extend({ ...@@ -115,7 +108,7 @@ export default Vue.extend({
parentId: '', parentId: '',
entId: '', entId: '',
ifContainChildDep: true, ifContainChildDep: true,
currentDep, currentDep: {} as Department,
// 是否显示check // 是否显示check
checkedMemberId: [], checkedMemberId: [],
role:3, role:3,
...@@ -280,13 +273,18 @@ export default Vue.extend({ ...@@ -280,13 +273,18 @@ export default Vue.extend({
// 负责人/管理员 // 负责人/管理员
if (this.isNotDepRoot) { if (this.isNotDepRoot) {
// 不在架构根目录 // 不在架构根目录
const leader = {...data.data.leader, isDepAdmin: true} const leader = data.data.leader
this.leaders.list = [leader] if (typeof leader !== 'undefined' && leader.id !== '') {
const staff = {...data.data.leader, isDepAdmin: true}
this.leaders.list = [staff]
} else {
this.leaders.list = []
}
} else { } else {
this.leaders.list = data.data.staffList?.filter((i: Staff) => i.role !== 3) this.leaders.list = data.data.staffList?.filter((i: Staff) => i.role !== Role.COMMON_MEMBER).sort((a: Staff, b: Staff) => a.role - b.role)
} }
// 普通成员 // 普通成员
this.commonMember = data.data.staffList?.filter((i: Staff) => i.role === 3) this.commonMember = data.data.staffList
// 部门树 // 部门树
const depTree = data.data.dep const depTree = data.data.dep
const index = this.teamArr.findIndex(d => d.id === this.parentId) const index = this.teamArr.findIndex(d => d.id === this.parentId)
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
class="mt-4" class="mt-4"
v-model="updateInfo.description" v-model="updateInfo.description"
:limit="300" :limit="300"
required
type="textarea" type="textarea"
label="团队描述" label="团队描述"
placeholder="请输入团队描述" placeholder="请输入团队描述"
...@@ -47,14 +46,10 @@ ...@@ -47,14 +46,10 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue from 'vue'
import {updateEnterpriseDTO} from '@/service/moudles/service.dto' import {updateEnterpriseDTO} from '@/service/moudles/service.dto'
import {ActionSheet} from 'vant'
import axios from 'axios' import axios from 'axios'
import { isAppEnv, signAuth } from '@/util/Bridge' import { isAppEnv, refreshCompanyState, signAuth } from '@/util/Bridge'
import { EnterpriseInfo } from '@/store/store.dto' import { EnterpriseInfo } from '@/store/store.dto'
import { PostMsg } from '@/Interface' import {transferFile} from '@/util/TransferFile'
import {postMessage} from '@/util/PostMessage'
Vue.use(ActionSheet)
export default Vue.extend({ export default Vue.extend({
name: 'TeamInfo', name: 'TeamInfo',
...@@ -69,7 +64,6 @@ export default Vue.extend({ ...@@ -69,7 +64,6 @@ export default Vue.extend({
data() { data() {
return { return {
updateInfo: {} as updateEnterpriseDTO, updateInfo: {} as updateEnterpriseDTO,
showActionSheet: false,
defaultImg: require('@/assets/qrcode.png'), defaultImg: require('@/assets/qrcode.png'),
showEditor: false, showEditor: false,
loading: false, loading: false,
...@@ -80,7 +74,6 @@ export default Vue.extend({ ...@@ -80,7 +74,6 @@ export default Vue.extend({
// const service = new BaseService() // const service = new BaseService()
// service.useService // service.useService
this.entInfo = {...JSON.parse(localStorage.getItem('ENT_INFO') as string)} this.entInfo = {...JSON.parse(localStorage.getItem('ENT_INFO') as string)}
console.log(this.entInfo, 'inf')
const {id, avatar, description, name} = this.entInfo const {id, avatar, description, name} = this.entInfo
this.updateInfo = { this.updateInfo = {
id, id,
...@@ -91,26 +84,10 @@ export default Vue.extend({ ...@@ -91,26 +84,10 @@ export default Vue.extend({
this.defaultImg = avatar this.defaultImg = avatar
}, },
methods: { methods: {
// base64 转 file
transferFile(base64Str: string, fileName: string) {
let arr = base64Str.split(','),
mime = (arr[0].match(/:(.*?);/) as any)[1], //base64解析出来的图片类型
bstr = atob(arr[1]) , //对base64串进行操作,去掉url头,并转换为byte atob为window内置方法
len = bstr.length,
ab = new ArrayBuffer(len), //将ASCII码小于0的转换为大于0
u8arr = new Uint8Array(ab) //
while (len--) {
u8arr[len] = bstr.charCodeAt(len)
}
// 创建新的 File 对象实例[utf-8内容,文件名称或者路径,[可选参数,type:文件中的内容mime类型]]
return new File([u8arr], fileName, {
type: mime
})
},
async getImgUrl() { async getImgUrl() {
const imServer = JSON.parse(localStorage.getItem('ENT_INFO') as string).imServer const imServer = JSON.parse(localStorage.getItem('ENT_INFO') as string).imServer
let token = '' let token = ''
if (process.env.NODE_ENV) { if (process.env.NODE_ENV === 'production') {
if (!isAppEnv()) { if (!isAppEnv()) {
token = this.$global.sig token = this.$global.sig
} else { } else {
...@@ -119,14 +96,14 @@ export default Vue.extend({ ...@@ -119,14 +96,14 @@ export default Vue.extend({
} else { } else {
token = 'MOCK' token = 'MOCK'
} }
const file = this.transferFile(this.defaultImg, 'text') const file = transferFile(this.defaultImg, 'text')
const formData = new FormData() const formData = new FormData()
formData.append('appId', 'dtalk') formData.append('appId', 'dtalk')
formData.append('key', `oa/${this.entInfo.id}`) formData.append('key', `oa/${this.entInfo.id + new Date().getTime()}`)
formData.append('file', file) formData.append('file', file)
return axios({ return axios({
method: 'post', method: 'post',
url: `${imServer}/oss/upload`, url: `/oss/upload`,
data: formData, data: formData,
headers: { headers: {
'content-type': 'multipart/form-data', 'content-type': 'multipart/form-data',
...@@ -137,8 +114,7 @@ export default Vue.extend({ ...@@ -137,8 +114,7 @@ export default Vue.extend({
}) })
}, },
async save() { async save() {
const {description, name} = this.updateInfo if (!this.updateInfo.name) {
if (!description || !name || !this.defaultImg) {
this.$toast('请检查填写信息') this.$toast('请检查填写信息')
return return
} }
...@@ -164,15 +140,16 @@ export default Vue.extend({ ...@@ -164,15 +140,16 @@ export default Vue.extend({
getEntInfo(id: string) { getEntInfo(id: string) {
this.loading = true this.loading = true
this.$service.enterprise.getEnterpriseInfo({id}) this.$service.enterprise.getEnterpriseInfo({id})
.then((res: any) => { .then(async (res: any) => {
const {data} = res const {data} = res
this.loading=false this.loading=false
if (data.code === this.$global.success) { if (data.code === this.$global.success) {
localStorage.setItem('ENT_INFO', JSON.stringify(data.data)) localStorage.setItem('ENT_INFO', JSON.stringify(data.data))
this.entInfo = data.data this.entInfo = data.data
this.defaultImg = data.data.avatar this.defaultImg = data.data.avatar
// await refreshCompanyState()
} }
}) }).catch(() => this.loading = false)
} }
} }
}) })
...@@ -188,3 +165,4 @@ export default Vue.extend({ ...@@ -188,3 +165,4 @@ export default Vue.extend({
// border: 1px solid red; // border: 1px solid red;
} }
</style> </style>
...@@ -216,7 +216,7 @@ export default Vue.extend({ ...@@ -216,7 +216,7 @@ export default Vue.extend({
if (arr.length === 0) return if (arr.length === 0) return
this.loading = true this.loading = true
const newLeaderId = arr[0] const newLeaderId = arr[0]
const id = JSON.parse(localStorage.getItem('USR_INFO') as string).id const id = JSON.parse(localStorage.getItem('ENT_INFO') as string).id
this.$service.enterprise.updateLeader({ this.$service.enterprise.updateLeader({
id, id,
newLeaderId newLeaderId
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
/> --> /> -->
<div class="w-32 h-32"> <div class="w-32 h-32">
<vue-qr <vue-qr
:logoSrc="require('@/assets/icons/ssyx.png')" :logoSrc="require('@/assets/icons/js.png')"
:text="qrCodeText" :text="qrCodeText"
:margin="2" :margin="2"
:size="400" :size="400"
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
@click="copy">复制</c-button> @click="copy">复制</c-button>
</div> </div>
</div> </div>
<c-button type="secondary" class="mt-4" @click="handleClickLeft">进入团队工作台</c-button> <c-button type="secondary" class="mt-4" @click="handleClickLeft">进入组织架构</c-button>
</div> </div>
</main-page> </main-page>
</div> </div>
...@@ -70,6 +70,7 @@ import { formatDate } from '@/util/FormatDate' ...@@ -70,6 +70,7 @@ import { formatDate } from '@/util/FormatDate'
import VueQr from 'vue-qr' import VueQr from 'vue-qr'
import html2canvas from 'html2canvas' import html2canvas from 'html2canvas'
import { Department } from '@/Interface' import { Department } from '@/Interface'
import { transferFile } from '@/util/TransferFile'
interface JoinInfoType{ interface JoinInfoType{
depId: string depId: string
entId:string entId:string
...@@ -92,7 +93,8 @@ export default Vue.extend({ ...@@ -92,7 +93,8 @@ export default Vue.extend({
joinInfo: {} as JoinInfoType, joinInfo: {} as JoinInfoType,
qrCodeText:'', qrCodeText:'',
loading: false, loading: false,
depInfo: {} as Department depInfo: {} as Department,
imgUrl: ''
} }
}, },
components: { components: {
...@@ -119,7 +121,7 @@ export default Vue.extend({ ...@@ -119,7 +121,7 @@ export default Vue.extend({
}, },
computed: { computed: {
copyText(): string { copyText(): string {
return `我和${this.entName}的小伙伴都在三生有信等你,用这个专属链接加入我们吧!${this.qrCodeText}` return `我和${this.entName}的小伙伴都在警书等你,用这个专属链接加入我们吧! ${this.qrCodeText}`
} }
}, },
methods: { methods: {
...@@ -133,13 +135,12 @@ export default Vue.extend({ ...@@ -133,13 +135,12 @@ export default Vue.extend({
}else{ }else{
string = `${i[0]}=${encodeURIComponent(i[1])}` string = `${i[0]}=${encodeURIComponent(i[1])}`
} }
res += string res += string
}) })
return res return res
}, },
handleClickLeft() { handleClickLeft() {
this.$router.replace('/team/team-frame') this.$router.push('/team/team-frame')
}, },
dpr() { dpr() {
if (window.devicePixelRatio && window.devicePixelRatio > 1) { if (window.devicePixelRatio && window.devicePixelRatio > 1) {
...@@ -148,6 +149,7 @@ export default Vue.extend({ ...@@ -148,6 +149,7 @@ export default Vue.extend({
return 1 return 1
}, },
async drawCanvas(selector: string) { async drawCanvas(selector: string) {
this.imgUrl = ''
// 获取节点 // 获取节点
const dom = document.getElementById(selector) as HTMLDivElement const dom = document.getElementById(selector) as HTMLDivElement
// 获取节点高度 // 获取节点高度
...@@ -164,6 +166,9 @@ export default Vue.extend({ ...@@ -164,6 +166,9 @@ export default Vue.extend({
// context?.scale(1, 1) // context?.scale(1, 1)
return await html2canvas(dom, {canvas}).then(() => { return await html2canvas(dom, {canvas}).then(() => {
const url = canvas.toDataURL('image/png') const url = canvas.toDataURL('image/png')
// const file = transferFile(url, 'file')
// const imgUrl = URL.createObjectURL(file)
this.imgUrl = url
const a =document.createElement('a') const a =document.createElement('a')
const event = new MouseEvent('click') const event = new MouseEvent('click')
a.download = '邀请码' a.download = '邀请码'
...@@ -192,7 +197,6 @@ export default Vue.extend({ ...@@ -192,7 +197,6 @@ export default Vue.extend({
this.loading=false this.loading=false
const {data} = res const {data} = res
if(data.code === this.$global.success) { if(data.code === this.$global.success) {
console.log('xxx')
this.depInfo = data.data this.depInfo = data.data
}else { }else {
this.$toast(data.msg) this.$toast(data.msg)
......
...@@ -30,6 +30,14 @@ module.exports = { ...@@ -30,6 +30,14 @@ module.exports = {
pathRewrite: { pathRewrite: {
'^/proxyApi': '' '^/proxyApi': ''
} }
},
'/oss': {
target: 'http://172.16.101.107:8888',
// target: 'http://' + "124.71.183.184:8093",
changeOrigin: true,
// pathRewrite: {
// '^/proxyApi': ''
// }
} }
} }
}, },
...@@ -41,7 +49,7 @@ module.exports = { ...@@ -41,7 +49,7 @@ module.exports = {
parallel: true, parallel: true,
terserOptions: { terserOptions: {
compress: { compress: {
drop_console: false, // 默认false -- 移除console.*(console.log、console.error等等) drop_console: true, // 默认false -- 移除console.*(console.log、console.error等等)
}, },
}, },
}), }),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment