Commit a59d4e44 authored by sixiaofeng's avatar sixiaofeng

合并

parents e5f4b2f3 e4d7f2ce
VUE_APP_OSS_TEMPLATE=https://ccccchy-test.obs.cn-east-3.myhuaweicloud.com/oa/员工导入模板.xlsx
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -31,3 +31,15 @@ export interface Department {
parentId: string,
children?: Array<Department>
}
export interface LocalStore{
avatar:string
description:string
id: string
imServer: string
name: string
nodeServer: string
oaServer: string
rootDepId:string
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ import service from './service'
import { global } from '@/const/Global'
import dsbridge from 'dsbridge'
import { Dialog, Toast, Notify } from 'vant'
// import VConsole from 'vconsole'
import VConsole from 'vconsole'
Vue.config.productionTip = false
Vue.use(Dialog).use(Toast).use(Notify)
......@@ -20,7 +20,7 @@ Vue.use(utils).use(service)
Vue.prototype.$dsbridge = dsbridge
Vue.prototype.$global = global
// new VConsole()
new VConsole()
new Vue({
router,
......
......@@ -8,8 +8,8 @@ import { generateToken } from "@/util/Sign";
import { signAuth } from "@/util/Bridge";
const Account = {
entId: '166910771849072640',
export const Account = {
entId: '166961152260050944',
staffId: '1FKxgaEh5fuSm7a35BfUnKYAmradowpiTR'
}
interface RouterConfig{
......@@ -34,7 +34,7 @@ export default class BaseService {
}
)
}
public async useService(routerConfig: RouterConfig,payload?:any){
public async useService(routerConfig: RouterConfig,payload?:any, ext?: {onUploadProgress?: (e: ProgressEvent)=>any}){
let token;
let headerItems:{[key:string]:string|number} ={}
if(!routerConfig.method) routerConfig.method = 'post'
......@@ -46,7 +46,8 @@ export default class BaseService {
headerItems[i[0]] = i[1]
})
const res = await this.service.post(routerConfig.path,payload,{
headers:headerItems
headers:headerItems,
onUploadProgress: ext?.onUploadProgress
})
return res
}
......
......@@ -4,7 +4,7 @@ import { AcceptJoinDTO, CreateEnterpriseDTO, DeleteEnterpriseDTO, DeleteSubDTO,
export default class Enterprise extends BaseService {
router= {
accept: { path: '/v1/enterprise/accept-join', crediential: true, headers: [['df', '1']] },
accept: { path: '/v1/enterprise/accept-join', crediential: true },
create: { path: '/v1/enterprise/create', crediential: true },
delete: { path: '/v1/enterprise/delete', crediential: true },
info: { path: '/v1/enterprise/info', crediential: true },
......
......@@ -3,8 +3,16 @@ import BaseService from '../base'
import { ChangeDepDTO, ChangeRoleDTO, GetRroupDTO, GetStaffInfoDTO, ResignDTO, UpdateStaffDTO } from './service.dto'
export default class Staff extends BaseService {
static instance: Staff
static getInstance(){
if(!Staff.instance){
Staff.instance = new Staff();
}
return Staff.instance;
}
router = {
addexcel:{path:'/v1/staff/add-staffs-by-excel',crediential: true, headers:[['key','val']]},
addexcel:{path:'/v1/staff/add-staffs-by-excel',crediential: true, headers:[['content-type','multipart/form-data']]},
changeDep: { path: '/v1/staff/change-dep', crediential: true },
changeRole: { path: '/v1/staff/change-role', crediential: true },
getGroup: { path: '/v1/staff/get-group', crediential: true },
......@@ -16,6 +24,13 @@ export default class Staff extends BaseService {
super()
}
async addExcel(data:File, entId: string, onUploadProgress: (e: ProgressEvent)=>any) {
const fd = new FormData();
fd.append('file_data', data)
fd.append('entId', entId)
return await this.useService(this.router.addexcel, fd, {onUploadProgress})
}
/**
* 变更员工部门
* @param {ChangeDepDTO} data {ChangeDepDTO}
......
......@@ -7,6 +7,20 @@ import router from '@/router';
import { AcceptJoinDTO } from '@/service/moudles/service.dto'
import dsbridge from 'dsbridge'
interface GETUSERINFO{
    "company": any,
    "depId": string,
    "entId": string,
    "id": string,
    "joinTime":number,
    "name": string,
    "phone": string,
    "position": string,
    "role": number
}
enum BridgeMethods{
SIGN_AUTH='signAuth',
GET_USERINFO='getUserInfo',
......@@ -28,6 +42,8 @@ export function isAppEnv() {
export function appNavBack(){
const appEnv = isAppEnv()
console.log(111);
if(appEnv){
goBack()
}else{
......@@ -40,7 +56,7 @@ export function appNavBack(){
* 获取用户的资料
* @returns
*/
export function getUserInfo() {
export function getUserInfo():GETUSERINFO {
const data = dsbridge.call(BridgeMethods.GET_USERINFO, {}, (res) => {
return res
})
......
......@@ -5,3 +5,13 @@ export function trim(str: string) {
export function generateTree(arr: Array<any>, rootId: string) {
console.log(arr, rootId)
}
export function formatFileSize(size: number) {
const kb = size / 1024
const mb = kb / 1024
if (mb > 1) {
return mb.toFixed(3) + 'MB'
} else {
return kb.toFixed(3) + 'KB'
}
}
......@@ -6,11 +6,12 @@
:ent-id="entId"
:selected.sync="selectedDepId"
/>
<main-page
left-arrow
:loading="loading"
@click-left="handleClickLeft"
>
<main-page left-arrow :loading="loading" @click-left="handleClickLeft">
<template #right>
<div @click="$router.push({ name: 'Import' })">
<img class="w-6 h-6" src="@/assets/icons/add_many_people.png" alt />
</div>
</template>
<div class="px-4 pt-14 pb-16">
<!-- 姓名/职位 -->
<input-cell
......@@ -45,7 +46,7 @@
title="员工编号"
placeholder="请输入员工编号"
type="input"
/> -->
/>-->
<c-cell
v-model="date"
dot
......@@ -59,24 +60,16 @@
:round="false"
color="#4F62C1"
:show-confirm="true"
:style="{ height:'100%'}"
:style="{ height: '100%' }"
@confirm="selectJoinTime"
/>
<!-- 选择部门 -->
<group-cell
dot
required
class="mt-4"
title="所属部门"
@click="selectDep"
>
<group-cell dot required class="mt-4" title="所属部门" @click.native="selectDep">
<c-cell :title="currentDep.name" />
</group-cell>
<!--按钮-->
<div class="fixed bottom-0 left-0 w-full px-4 py-1.5 bg-common-bg">
<c-button @click="generateQrCode">
生成邀请二维码
</c-button>
<c-button @click="generateQrCode">生成邀请二维码</c-button>
</div>
</div>
</main-page>
......@@ -86,13 +79,14 @@
<script lang="ts">
import Vue from 'vue'
import { Calendar,Overlay } from 'vant'
import { Calendar, Overlay } from 'vant'
import { AcceptJoinDTO } from '@/service/moudles/service.dto'
import { trim } from '@/util/Contact'
import {Department} from '@/Interface'
import { Department, LocalStore } from '@/Interface'
import { useLocalStorageState } from 'ahooks-vue'
import {formatDate} from '@/util/FormatDate'
import { formatDate } from '@/util/FormatDate'
import DepSelector from '@/views/team/components/dep-selector.vue'
import { getSign, getUserInfo } from '@/util/Bridge'
Vue.use(Calendar).use(Overlay)
export default Vue.extend({
......@@ -152,6 +146,7 @@ export default Vue.extend({
// this.acceptJoin = Object.assign(this.acceptJoin, this.$store.state.acceptJoin)
const dep = await this.getSub(this.depId)
this.currentDep = dep.dep
this.date = this.formatDate(new Date())
},
methods: {
async selectDep() {
......@@ -167,7 +162,7 @@ export default Vue.extend({
entId: this.entId,
parentId: parentId
}).then((res: any) => {
const {data}=res
const { data } = res
this.loading = false
if (data.code === this.$global.success) {
return data.data
......@@ -182,7 +177,7 @@ export default Vue.extend({
entId: this.entId,
id: depId
}).then((res: any) => {
const {data}=res
const { data } = res
this.loading = false
if (data.code === this.$global.success) {
this.currentDep = data.data
......@@ -204,7 +199,7 @@ export default Vue.extend({
this.$router.go(-1)
},
// 入职日期
selectJoinTime(date:Date) {
selectJoinTime(date: Date) {
this.acceptJoin.joinTime = new Date(date).getTime()
this.show = false
this.date = this.formatDate(date)
......@@ -220,12 +215,17 @@ export default Vue.extend({
}).then(() => {
this.acceptJoin.entId = this.entId
this.acceptJoin.depId = this.selectedDepId
this.acceptJoin.expiration = this.acceptJoin.joinTime
this.acceptJoin.inviterId ="1FKxgaEh5fuSm7a35BfUnKYAmradowpiTR"
this.acceptJoin.oaServer = 'http://172.16.101.107:20000'
this.acceptJoin.expiration = this.acceptJoin.joinTime + 6000000
this.acceptJoin.inviterId = process.env.NODE_ENV ==='production'? getUserInfo().id: "1FKxgaEh5fuSm7a35BfUnKYAmradowpiTR"
this.acceptJoin.oaServer = localStorage.getItem('ENT_INFO')? JSON.parse(localStorage.getItem('ENT_INFO') as any).oaServer : 'http://172.16.101.107:20000'
const {depId,entId,expiration,inviterId,joinTime,name,oaServer,phone,position} = this.acceptJoin
this.acceptJoin.hash = getSign({
depId,entId,expiration,inviterId,joinTime,name,oaServer,phone,position
})
this.$store.commit('setAcceptJoin', this.acceptJoin)
this.$router.push('/team/two-code')
}).catch(() => {})
}).catch(() => { })
}
},
watch: {
......@@ -237,5 +237,4 @@ export default Vue.extend({
</script>
<style lang="less">
</style>
<template>
<!-- 加入/创建团队 -->
<div class="team-frame">
<main-page
left-arrow
@click-left="$router.go(-1)"
>
<main-page left-arrow @click-left="$router.go(-1)">
<div class="px-4 pt-14 pb-4">
<div class="rounded bg-indigo-100 text-indigo-500 px-2 py-2 text-sm">批量导入需要先下载下方的批量导入模版,将成员信息全部按要求完成填写后,可选择下方上传信息表,自动识别并添加所有成员。</div>
<div >
<div class="flex justify-between items-center bg-white rounded px-4 py-3 my-4" >
<div
class="rounded bg-indigo-100 text-indigo-500 px-2 py-2 text-sm"
>批量导入需要先下载下方的批量导入模版,将成员信息全部按要求完成填写后,可选择下方上传信息表,自动识别并添加所有成员。</div>
<div>
<div
class="flex justify-between items-center bg-white rounded px-4 py-3 my-4"
@click="clickDownload"
>
<div>下载模板</div>
<app-icon
slot="right"
icon-name="dot"
class-name="w-1 h-1 flex items-center"
/>
<app-icon slot="right" icon-name="dot" class-name="w-1 h-1 flex items-center" />
</div>
<div class="flex justify-between items-center bg-white rounded px-4 py-3" @click='uploadFile'>
<div class="bg-white rounded px-4 py-3" @click="!file && uploadFile()">
<div class="flex justify-between items-center">
<div>上传信息表</div>
<input type="file" id="uploadFile" ref='uploadFile' class="hidden" @change='fileHandler'>
<app-icon
slot="right"
icon-name="dot"
class-name="w-1 h-1 flex items-center"
<input
type="file"
id="uploadFile"
ref="uploadFile"
accept=".xlsx"
class="hidden"
@input="fileHandler"
/>
<app-icon slot="right" icon-name="dot" class-name="w-1 h-1 flex items-center" />
</div>
<div v-if="file" class="mt-3">
<div class="flex items-center">
<div
class="w-10 h-10 rounded-md bg-green-600 text-white text-3xl flex items-center justify-center"
>X</div>
<div class="ml-2">
<div>{{ file.name }}</div>
<div class="text-gray-500 text-sm">
<span class="mr-2">{{ formatDate(new Date(file.lastModified), 'YYYY/MM/DD') }}</span>
<span>{{ formatFileSize(file.size) }}</span>
</div>
</div>
</div>
<div class="flex justify-around mt-2">
<div class="flex flex-col items-center" @click.stop="clickUpload">
<img src="@/assets/icons/upload.png" alt />
<div class="text-gray-500 text-sm">上传</div>
</div>
<div class="absolute flex justify-center bottom-1/4 inset-x-0 " v-show="show">
<div class="flex flex-col items-center" @click.stop="clickDelete">
<img src="@/assets/icons/delete.png" alt />
<div class="text-gray-500 text-sm">删除</div>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="absolute flex justify-center bottom-1/4 inset-x-0" v-show="show">
<div class="bg-gray-700 text-white px-4 py-4 rounded w-1/3 text-center">下载已完成</div>
<div class="bg-gray-700 text-white px-4 py-4 rounded w-1/3 ml-4 text-center">上传成功</div>
</div>
</div>-->
<van-popup v-model="show" position="bottom" class="px-4 py-3">
<div v-show="show" class="w-full rounded-full py-2 px-2 text-center bg-gray-500 text-white">上传中...</div>
<div v-show="show" class="w-full rounded-full py-2 px-2 text-center bg-gray-500 mt-3 text-white">下载中...</div>
<div
v-show="show1"
class="w-full rounded-full py-2 px-2 text-center bg-gray-500 text-white"
>上传中{{ progress }}%</div>
<div
v-show="show2"
class="w-full rounded-full py-2 px-2 text-center bg-gray-500 mt-3 text-white"
>下载中...</div>
</van-popup>
<van-overlay :show="show" />
</div>
</main-page>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import { Overlay } from 'vant';
import { Overlay, Toast } from 'vant';
import { Popup } from 'vant';
import Staff from '@/service/moudles/Staff';
import { Account } from '@/service/base';
import { formatDate } from '@/util/FormatDate';
import { formatFileSize } from '@/util/Common';
Vue.use(Popup);
Vue.use(Overlay);
......@@ -58,25 +95,61 @@ export default Vue.extend({
},
data() {
return {
show:true,
show: false,
show1: false,
show2: false,
file: undefined as undefined | File,
progress: undefined as undefined | number,
}
},
methods: {
fileHandler(item:any){
console.log(item);
clickDownload() {
const downloadUrl = process.env.VUE_APP_OSS_TEMPLATE as string;
const ele = document.createElement('a');
ele.target = "_self"
ele.href = downloadUrl;
document.body.appendChild(ele)
ele.click();
ele.remove();
},
formatDate,
formatFileSize,
clickDelete() {
this.file = undefined;
const fileInput = this.$refs.uploadFile as HTMLInputElement
fileInput.value = '';
},
onProgressChange(e: ProgressEvent) {
const percent = (e.loaded / e.total);
this.progress = Number.parseFloat((percent * 100).toFixed(1))
},
uploadFile(){
clickUpload() {
if (!this.file) return;
this.show = true;
this.show1 = true;
this.progress = 0;
Staff.getInstance().addExcel(this.file, Account.entId, this.onProgressChange).then(() => {
this.$router.push({ name: "Team" })
}).catch((err) => {
Toast.fail(err)
})
},
fileHandler(e: InputEvent) {
const target = e.target as HTMLInputElement
if (target.files && target.files?.length !== 0) {
console.log(target.files);
const file = target.files[0];
this.file = file;
}
},
uploadFile() {
console.log(this.$refs);
const fileInput = this.$refs.uploadFile as HTMLInputElement
fileInput.click()
console.log(fileInput);
}
}
})
</script>
<style lang="less">
</style>
\ No newline at end of file
......@@ -7,12 +7,12 @@
:loading="loading"
>
<!-- 顶部左侧插槽 -->
<!-- <app-icon
<app-icon
slot="left"
class-name="w-6.5 w-6.5"
icon-name="left-arrow-white"
@click="$router.go(-1)"
/> -->
@click="appNavBack()"
/>
<div class="relative w-full h-40 bg-color-primary">
<!-- 背景图 -->
<!-- <img class="w-82 absolute top-0 right-0" src="@/assets/images/header-bg.png" alt=""> -->
......@@ -77,6 +77,7 @@
import Vue from 'vue'
import {formatDate} from '@/util/FormatDate'
import {AcceptJoinDTO} from '@/service/moudles/service.dto'
import { appNavBack, getSign } from '@/util/Bridge'
export default Vue.extend({
name: 'JoinTeam',
......@@ -111,14 +112,15 @@ export default Vue.extend({
created() {
this.info = this.$route.query as unknown as AcceptJoinDTO
// item = JSON.parse(query as string)
this.getDepInfo(this.info)
},
methods: {
submit() {
appNavBack,
async submit() {
console.log('申请')
this.loading = true
this.$service.enterprise.acceptJoin(this.info)
.then((res: any) => {
const {data} = res
......
......@@ -154,7 +154,7 @@ export default Vue.extend({
console.log('添加部门')
},
clickMember(member: Member) {
openCompanyUserInfo(JSON.stringify(member.id))
openCompanyUserInfo(String(member.id))
// this.$router.push(`/team/team-member/${member.id}`)
},
setDepartment() {
......
......@@ -175,7 +175,14 @@ export default Vue.extend({
})
},
clickMember(member: Staff) {
<<<<<<< HEAD
openCompanyUserInfo(JSON.stringify(member))
=======
console.log(member.id,'dfjdsfkl');
openCompanyUserInfo(String(member.id))
// this.$router.push(`/team/team-member/${member.id}`)
>>>>>>> origin/main
},
clickItem(val: Department) {
this.parentId = val.id
......
......@@ -93,17 +93,10 @@ export default Vue.extend({
async created() {
// console.log(Mock, 'mock')
this.joinInfo = this.$store.state.acceptJoin
const urloutput = this.outputUrl(this.joinInfo)
console.log(urloutput);
this.qrCodeText = JSON.stringify(this.joinInfo)
let url = window.location.origin + '/team/confirm-join'
this.qrCodeText = `${url}?${urloutput}`
console.log( this.qrCodeText,'output');
this.dpr()
// this.drawCanvas()
},
......@@ -114,7 +107,12 @@ export default Vue.extend({
const arr = Object.entries(item)
arr.map((i,index)=>{
let string
index+1<arr.length? string = `${i[0]}=${i[1]}&`:string = `${i[0]}=${i[1]}`
if(index+1<arr.length){
string = `${i[0]}=${encodeURIComponent(i[1])}&`
}else{
string = `${i[0]}=${encodeURIComponent(i[1])}`
}
res += string
})
......@@ -128,6 +126,7 @@ export default Vue.extend({
if (window.devicePixelRatio && window.devicePixelRatio > 1) {
return window.devicePixelRatio
}
return 1
},
async drawCanvas(selector: string) {
......
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