选择人员调整完毕

This commit is contained in:
aixianling
2021-11-23 16:07:39 +08:00
parent b5ba96c0f3
commit a03bebaf38
3 changed files with 356 additions and 312 deletions

View File

@@ -9,13 +9,17 @@
<header><em>*</em>起止时间</header>
<u-row justify="between">
<div class="time" @click="pick(0)">
<span>{{form.startTime.time}}</span>
<span>{{form.startTime.year}}{{form.startTime.month}}{{form.startTime.day}} {{form.startTime.weekday}}</span>
<span>{{ form.startTime.time }}</span>
<span>{{ form.startTime.year }}{{ form.startTime.month }}{{
form.startTime.day
}} {{ form.startTime.weekday }}</span>
</div>
<div class="arrow"></div>
<div class="time" @click="pick(1)">
<span>{{form.endTime.time}}</span>
<span>{{form.endTime.year}}{{form.endTime.month}}{{form.endTime.day}} {{form.endTime.weekday}}</span>
<span>{{ form.endTime.time }}</span>
<span>{{ form.endTime.year }}{{ form.endTime.month }}{{ form.endTime.day }} {{
form.endTime.weekday
}}</span>
</div>
</u-row>
</div>
@@ -34,14 +38,16 @@
</div>
<div class="card item-wrap" @click="select">
<u-row justify="between" class="item" @click="userSelect=true">
<u-row justify="between" class="item" @click="handleSelectUser">
<header><em>*</em>参会人</header>
<div class="right">
<template v-if="!form.attendees.length">
<span>请选择</span>
</template>
<template v-else>
已选择<em>{{form.attendees.map(e=>e.name).slice(0,2).join("、")}}</em><em>{{form.attendees.length}}</em>
已选择<em>{{ form.attendees.map(e => e.name).slice(0, 2).join("、") }}</em><em>{{
form.attendees.length
}}</em>
</template>
<div class="right-arrow"></div>
</div>
@@ -52,7 +58,9 @@
<header>参会提醒</header>
<picker class="right" @change="beforeNoticeChange" :value="form.noticeBefore" range-key="dictName"
:range="$dict.getDict('meetingNoticeBefore')">
<span>{{ form.noticeBefore !=null ? $dict.getDict('meetingNoticeBefore')[form.noticeBefore]["dictName"] : "请选择"}}</span>
<span>{{
form.noticeBefore != null ? $dict.getDict('meetingNoticeBefore')[form.noticeBefore]["dictName"] : "请选择"
}}</span>
<div class="right-arrow"></div>
</picker>
</u-row>
@@ -62,7 +70,9 @@
<header>确认提醒</header>
<picker class="right" @change="afterNoticeChange" :value="form.noticeAfter" range-key="dictName"
:range="$dict.getDict('meetingNoticeAfter')">
<span>{{form.noticeAfter !=null ? $dict.getDict('meetingNoticeAfter')[form.noticeAfter]["dictName"] : "请选择"}}</span>
<span>{{
form.noticeAfter != null ? $dict.getDict('meetingNoticeAfter')[form.noticeAfter]["dictName"] : "请选择"
}}</span>
<div class="right-arrow"></div>
</picker>
</u-row>
@@ -80,321 +90,328 @@
</template>
<script>
import AiBack from "../../../components/AiBack";
import AiSelectEnterprise from "../../../components/AiSelectEnterprise";
import AiUploader from "../../../components/AiUploader";
import AiBack from "../../../components/AiBack";
import AiSelectEnterprise from "../../../components/AiSelectEnterprise";
import AiUploader from "../../../components/AiUploader";
import {mapActions} from "vuex";
export default {
name: "addMeeting",
components: {AiBack, AiSelectEnterprise, AiUploader},
data() {
const initTime = {
time: "",
year: "",
month: "",
day: "",
weekday: "",
timestamp: "",
}
export default {
name: "addMeeting",
components: {AiBack, AiSelectEnterprise, AiUploader},
data() {
const initTime = {
time: "",
year: "",
month: "",
day: "",
weekday: "",
timestamp: "",
}
return {
show: false,
index: 0,
list: [],
form: {
id: null,
title: "",
startTime: {...initTime},
endTime: {...initTime},
address: "",
content: "",
attendees: [],
noticeBefore: 4,
noticeAfter: 0,
files: [],
},
userSelect: false,
value: Number(new Date())
}
},
onLoad(opt) {
if (opt.id) {
this.form.id = opt.id
this.getDetail()
}
this.$nextTick(() => {
let date = new Date();
this.form.startTime.time = date.getHours()?.toString()?.padStart(2, "0") + ":" + date.getMinutes()?.toString()?.padStart(2, "0")
this.form.startTime.year = date.getFullYear()
this.form.startTime.month = (date.getMonth() + 1)?.toString()?.padStart(2, "0")
this.form.startTime.day = date.getDate()
this.form.startTime.weekday = '日一二三四五六'.charAt(date.getDay())
this.form.endTime = {...this.form.startTime}
})
},
computed: {
params() {
return {
show: false,
index: 0,
list: [],
form: {
id: null,
title: "",
startTime: {...initTime},
endTime: {...initTime},
address: "",
content: "",
attendees: [],
noticeBefore: 4,
noticeAfter: 0,
files: [],
},
userSelect: false,
value: Number(new Date())
year: true,
month: true,
day: true,
hour: true,
minute: true,
timestamp: true,
}
},
onLoad(opt) {
if (opt.id) {
this.form.id = opt.id
this.getDetail()
}
this.$nextTick(() => {
let date = new Date();
this.form.startTime.time = date.getHours()?.toString()?.padStart(2, "0") + ":" + date.getMinutes()?.toString()?.padStart(2, "0")
this.form.startTime.year = date.getFullYear()
this.form.startTime.month = (date.getMonth() + 1)?.toString()?.padStart(2, "0")
this.form.startTime.day = date.getDate()
this.form.startTime.weekday = '日一二三四五六'.charAt(date.getDay())
this.form.endTime = {...this.form.startTime}
}
},
methods: {
...mapActions(['selectEnterpriseContact']),
handleSelectUser() {
this.selectEnterpriseContact().then(res => {
this.change(res?.userList || [])
})
},
computed: {
params() {
return {
year: true,
month: true,
day: true,
hour: true,
minute: true,
timestamp: true,
fileList(e) {
this.form.files = e
},
change(e) {
this.form.attendees = e
},
beforeNoticeChange(e) {
this.form.noticeBefore = e.detail.value
},
afterNoticeChange(e) {
this.form.noticeAfter = e.detail.value
},
getDetail() {
this.$http.post("/app/appmeetinginfo/info-id", null, {
params: {
id: this.form.id
}
}).then(res => {
if (res && res.data) {
this.form.title = res.data.title
this.form.address = res.data.address
this.form.content = res.data.content
this.form.attendees = res.data.attendees
this.form.noticeBefore = res.data.noticeBefore
this.form.noticeAfter = res.data.noticeAfter
this.form.files = res.data.files
this.form.startTime.time = res.data.startTime.split(" ")[1].substr(0, 5)
this.form.startTime.year = res.data.startTime.split(" ")[0].split("-")[0]
this.form.startTime.month = res.data.startTime.split(" ")[0].split("-")[1]
this.form.startTime.day = res.data.startTime.split(" ")[0].split("-")[2]
this.form.startTime.weekday = '日一二三四五六'.charAt(new Date(res.data.startTime.split(" ")[0]).getDay())
this.form.startTime.timestamp = new Date(res.data.startTime).getTime()
this.form.endTime.time = res.data.endTime.split(" ")[1].substr(0, 5)
this.form.endTime.year = res.data.endTime.split(" ")[0].split("-")[0]
this.form.endTime.month = res.data.endTime.split(" ")[0].split("-")[1]
this.form.endTime.day = res.data.endTime.split(" ")[0].split("-")[2]
this.form.endTime.weekday = '日一二三四五六'.charAt(new Date(res.data.endTime.split(" ")[0]).getDay())
this.form.endTime.timestamp = new Date(res.data.endTime).getTime()
}
})
},
confirm(e) {
if (new Date().getTime() / 1000 > e.timestamp) return this.$u.toast("选择时间不能小于当前时间")
if (this.index == 0) {
this.form.startTime = {...e}
this.form.startTime.time = e.hour + ":" + (e.minute.length > 1 ? e.minute : ("0" + e.minute))
this.form.startTime.weekday = '日一二三四五六'.charAt(new Date(e.timestamp * 1000).getDay())
} else {
if (this.form.startTime.timestamp >= e.timestamp) {
return this.$u.toast("结束时间不能小于开始时间");
}
this.form.endTime = {...e}
this.form.endTime.time = e.hour + ":" + (e.minute.length > 1 ? e.minute : ("0" + e.minute))
this.form.endTime.weekday = '日一二三四五六'.charAt(new Date(e.timestamp * 1000).getDay())
}
},
methods: {
fileList(e) {
this.form.files = e
},
change(e) {
this.form.attendees = e
},
beforeNoticeChange(e) {
this.form.noticeBefore = e.detail.value
},
afterNoticeChange(e) {
this.form.noticeAfter = e.detail.value
},
getDetail() {
this.$http.post("/app/appmeetinginfo/info-id", null, {
params: {
id: this.form.id
}
}).then(res => {
if (res && res.data) {
this.form.title = res.data.title
this.form.address = res.data.address
this.form.content = res.data.content
this.form.attendees = res.data.attendees
this.form.noticeBefore = res.data.noticeBefore
this.form.noticeAfter = res.data.noticeAfter
this.form.files = res.data.files
this.form.startTime.time = res.data.startTime.split(" ")[1].substr(0, 5)
this.form.startTime.year = res.data.startTime.split(" ")[0].split("-")[0]
this.form.startTime.month = res.data.startTime.split(" ")[0].split("-")[1]
this.form.startTime.day = res.data.startTime.split(" ")[0].split("-")[2]
this.form.startTime.weekday = '日一二三四五六'.charAt(new Date(res.data.startTime.split(" ")[0]).getDay())
this.form.startTime.timestamp = new Date(res.data.startTime).getTime()
add(status) {
if (status == 1) {
if (!this.form.title) return this.$u.toast("请输入会议标题")
this.form.endTime.time = res.data.endTime.split(" ")[1].substr(0, 5)
this.form.endTime.year = res.data.endTime.split(" ")[0].split("-")[0]
this.form.endTime.month = res.data.endTime.split(" ")[0].split("-")[1]
this.form.endTime.day = res.data.endTime.split(" ")[0].split("-")[2]
this.form.endTime.weekday = '日一二三四五六'.charAt(new Date(res.data.endTime.split(" ")[0]).getDay())
this.form.endTime.timestamp = new Date(res.data.endTime).getTime()
}
})
},
confirm(e) {
if (new Date().getTime() / 1000 > e.timestamp) return this.$u.toast("选择时间不能小于当前时间")
if (this.index == 0) {
this.form.startTime = {...e}
this.form.startTime.time = e.hour + ":" + (e.minute.length > 1 ? e.minute : ("0" + e.minute))
this.form.startTime.weekday = '日一二三四五六'.charAt(new Date(e.timestamp * 1000).getDay())
} else {
if (this.form.startTime.timestamp >= e.timestamp) {
return this.$u.toast("结束时间不能小于开始时间");
}
this.form.endTime = {...e}
this.form.endTime.time = e.hour + ":" + (e.minute.length > 1 ? e.minute : ("0" + e.minute))
this.form.endTime.weekday = '日一二三四五六'.charAt(new Date(e.timestamp * 1000).getDay())
}
},
if (this.form.startTime.timestamp >= this.form.endTime.timestamp) return this.$u.toast("结束时间不能小于开始时间")
add(status) {
if (status == 1) {
if (!this.form.title) return this.$u.toast("请输入会议标题")
if (!this.form.address) return this.$u.toast("请输入会议地点")
if (this.form.startTime.timestamp >= this.form.endTime.timestamp) return this.$u.toast("结束时间不能小于开始时间")
if (!this.form.content) return this.$u.toast("请输入会议内容")
if (!this.form.address) return this.$u.toast("请输入会议地点")
if (!this.form.content) return this.$u.toast("请输入会议内容")
if (!this.form.attendees.length) return this.$u.toast("请选择参会人")
}
this.$http.post("/app/appmeetinginfo/add-update", {
...this.form,
files: this.form.files.map(e => e.id),
status,
startTime: this.form.startTime.year + "-" + this.form.startTime.month + "-" + this.form.startTime.day + " " + this.form.startTime.time + ":00",
endTime: this.form.endTime.year + "-" + this.form.endTime.month + "-" + this.form.endTime.day + " " + this.form.endTime.time + ":00",
}).then(res => {
if (res.code == 0) {
this.$u.toast(status == 1 ? "发布成功" : "保存成功")
this.$refs["aiBack"].back()
}
})
},
pick(index) {
this.index = index
this.show = true
},
select() {
uni.navigateTo({
url: "/pages/meetingNotice/components/notice"
})
if (!this.form.attendees.length) return this.$u.toast("请选择参会人")
}
this.$http.post("/app/appmeetinginfo/add-update", {
...this.form,
files: this.form.files.map(e => e.id),
status,
startTime: this.form.startTime.year + "-" + this.form.startTime.month + "-" + this.form.startTime.day + " " + this.form.startTime.time + ":00",
endTime: this.form.endTime.year + "-" + this.form.endTime.month + "-" + this.form.endTime.day + " " + this.form.endTime.time + ":00",
}).then(res => {
if (res.code == 0) {
this.$u.toast(status == 1 ? "发布成功" : "保存成功")
this.$refs["aiBack"].back()
}
})
},
}
pick(index) {
this.index = index
this.show = true
},
select() {
uni.navigateTo({
url: "/pages/meetingNotice/components/notice"
})
}
},
}
</script>
<style lang="scss" scoped>
.add-meeting {
min-height: 100%;
background: #F5F5F5;
padding-bottom: 140px;
.add-meeting {
min-height: 100%;
background: #F5F5F5;
padding-bottom: 140px;
.card {
background-color: #FFFFFF;
box-sizing: border-box;
padding: 32px;
margin-top: 16px;
.card {
background-color: #FFFFFF;
box-sizing: border-box;
padding: 32px;
margin-top: 16px;
header {
header {
font-size: 32px;
font-weight: 400;
color: #333333;
em {
font-style: normal;
font-size: 32px;
font-weight: 400;
color: #333333;
color: #FF4466;
margin-right: 8px;
vertical-align: middle;
}
}
input {
margin: 32px 0 16px;
box-sizing: border-box;
padding: 0 16px;
}
textarea {
width: 100%;
height: 160px;
margin: 32px 0 16px;
box-sizing: border-box;
padding: 0 16px;
}
.u-row {
margin-top: 34px;
.time {
display: flex;
flex-direction: column;
& > span:first-child {
font-size: 60px;
font-weight: 600;
color: #333333;
line-height: 84px;
}
& > span:last-child {
font-size: 22px;
color: #333333;
}
}
.arrow {
width: 28px;
height: 68px;
overflow: hidden;
position: relative;
transform: rotate(180deg);
&:before, &:after {
content: "";
width: 50px;
height: 50px;
position: absolute;
transform: scaleY(1.3) translate(30%, -40px) rotate(45deg);
}
&:before {
top: 59px;
background-color: #CCCCCC;
}
&:after {
left: 7px;
top: 59px;
background-color: #FFFFFF;
}
}
}
.item {
height: 112px;
box-shadow: 0px -1px 0px 0px #D8DDE6;
margin-top: 0;
.right {
font-size: 28px;
color: #999999;
display: flex;
align-items: center;
em {
font-style: normal;
font-size: 32px;
color: #FF4466;
margin-right: 8px;
vertical-align: middle;
color: #1365DD;
}
}
input {
margin: 32px 0 16px;
box-sizing: border-box;
padding: 0 16px;
}
textarea {
width: 100%;
height: 160px;
margin: 32px 0 16px;
box-sizing: border-box;
padding: 0 16px;
}
.u-row {
margin-top: 34px;
.time {
display: flex;
flex-direction: column;
& > span:first-child {
font-size: 60px;
font-weight: 600;
color: #333333;
line-height: 84px;
}
& > span:last-child {
font-size: 22px;
color: #333333;
}
}
.arrow {
width: 28px;
height: 68px;
overflow: hidden;
position: relative;
transform: rotate(180deg);
&:before, &:after {
content: "";
width: 50px;
height: 50px;
position: absolute;
transform: scaleY(1.3) translate(30%, -40px) rotate(45deg);
}
&:before {
top: 59px;
background-color: #CCCCCC;
}
&:after {
left: 7px;
top: 59px;
background-color: #FFFFFF;
}
}
}
.item {
height: 112px;
box-shadow: 0px -1px 0px 0px #D8DDE6;
margin-top: 0;
.right {
font-size: 28px;
color: #999999;
display: flex;
align-items: center;
em {
font-style: normal;
color: #1365DD;
}
}
.right-arrow {
width: 16px;
height: 16px;
display: inline-block;
border-top: 5px solid #CCCCCC;
border-right: 5px solid #CCCCCC;
transform: rotate(45deg);
}
}
}
.item-wrap {
padding: 0 32px;
}
.footer {
height: 112px;
width: 100%;
position: fixed;
left: 0;
bottom: 0;
background-color: #FFFFFF;
display: flex;
align-items: center;
& > div {
font-size: 36px;
color: #333333;
}
& > div:first-child {
width: 270px;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
& > div:last-child {
width: calc(100% - 270px);
height: 100%;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
background-color: #1365DD;
.right-arrow {
width: 16px;
height: 16px;
display: inline-block;
border-top: 5px solid #CCCCCC;
border-right: 5px solid #CCCCCC;
transform: rotate(45deg);
}
}
}
.item-wrap {
padding: 0 32px;
}
.footer {
height: 112px;
width: 100%;
position: fixed;
left: 0;
bottom: 0;
background-color: #FFFFFF;
display: flex;
align-items: center;
& > div {
font-size: 36px;
color: #333333;
}
& > div:first-child {
width: 270px;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
& > div:last-child {
width: calc(100% - 270px);
height: 100%;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
background-color: #1365DD;
}
}
}
</style>

View File

@@ -33,7 +33,7 @@ export default {
}
},
methods: {
...mapActions(['getToken', 'getAccount', 'agentSign', 'getUserInfo', 'getCode', 'closeAgent']),
...mapActions(['agentSign']),
redirectTo(path) {
let {query, hash} = this.$route
delete query.app
@@ -60,6 +60,9 @@ export default {
})
}
},
onLoad() {
this.agentSign(this.$route.query)
},
onShow() {
this.getApps()
this.result = {

View File

@@ -5,7 +5,7 @@ import http from '../common/axios'
import CryptoJS from '../utils/crypto-js'
Vue.use(Vuex)
let agentSignURL = "", apiList = [], agentConfig = {}
let agentSignURL = "", apiList = []
const store = new Vuex.Store({
state: {
token: "",
@@ -30,7 +30,7 @@ const store = new Vuex.Store({
state.openUser = user
},
getConfig(state, params) {
Object.keys(params).map(e => state[e] = params[e])
state.config = params
},
bindAccount(state, params) {
//具备解决二次登录,绑定手机,token等问题
@@ -61,7 +61,7 @@ const store = new Vuex.Store({
},
redirectCode(state, url = location.href) {
let REDIRECT_URI = encodeURIComponent(url),
corpid = state.corpId || agentConfig?.corpid
corpid = state.corpId
const redirectTo = cid => {
location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=CORPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base#wechat_redirect'
.replace(/CORPID/g, cid)
@@ -71,7 +71,7 @@ const store = new Vuex.Store({
redirectTo(corpid)
} else {
store.dispatch("agentSign").then(() => {
corpid = state.corpId || agentConfig?.corpid
corpid = state.corpId
redirectTo(corpid)
})
}
@@ -198,7 +198,7 @@ const store = new Vuex.Store({
})
},
getCode(store, url) {
if (agentConfig?.corpid) {
if (store.state.config?.corpid) {
store.commit('redirectCode', url)
} else {
store.dispatch('agentSign').then(() => {
@@ -232,17 +232,20 @@ const store = new Vuex.Store({
})
}
},
agentSign(state) {
let url = window.location.href
agentSign(state, params) {
let url = window.location.href,
{corpId, suiteId} = state.state.config
if (agentSignURL == url) {
return Promise.resolve()
} else {
agentSignURL = url
return http.post("/app/wxcp/portal/agentSign", null, {
params: {url}
params = params || {corpId, suiteId}
return http.post("/app/wxcptp/portal/agentSign", null, {
params: {...params, url}
}).then(res => {
if (res?.data) {
let params = {
let config = {
...params,
debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
beta: true,// 必须这么写否则wx.invoke调用形式的jsapi会有问题
corpid: res.data.corpid, // 必填企业微信的corpid必须与当前登录的企业一致
@@ -252,8 +255,8 @@ const store = new Vuex.Store({
signature: res.data.signature,// 必填,签名,见 附录-JS-SDK使用权限签名算法
...res.data,
}
agentConfig = params
state.commit("getConfig", {corpId: params.corpid})
state.commit("getConfig", config)
return config
}
}).catch(err => {
console.error(err)
@@ -261,11 +264,11 @@ const store = new Vuex.Store({
}
},
injectJWeixin(state, ops) {
const inject = jsApiList => new Promise((resolve, reject) => {
const inject = (jsApiList, config = state.state.config) => new Promise((resolve, reject) => {
setTimeout(() => {
let sdk = wx?.agentConfig ? wx : jWeixin
sdk?.agentConfig({
...agentConfig, jsApiList,
...config, jsApiList,
success: res => resolve(res),
fail: err => {
console.error(err)
@@ -275,7 +278,7 @@ const store = new Vuex.Store({
}, 500)
})
return new Promise((resolve, reject) => {
state.dispatch("agentSign").then(() => {
state.dispatch("agentSign").then(config => {
if (typeof ops == "object") {
ops?.map(api => {
if (!apiList?.includes(api)) apiList.push(api)
@@ -283,7 +286,7 @@ const store = new Vuex.Store({
} else {
if (!apiList?.includes(ops)) apiList.push(ops)
}
inject(apiList).then(r => resolve(r)).catch(err => reject(err))
inject(apiList, config).then(r => resolve(r)).catch(err => reject(err))
})
})
},
@@ -318,6 +321,27 @@ const store = new Vuex.Store({
}, 500)
})
},
selectEnterpriseContact(state) {
return new Promise(resolve => {
state.dispatch("injectJWeixin", "selectEnterpriseContact").then(() => {
setTimeout(() => {
let sdk = typeof wx?.invoke == 'function' ? wx : jWeixin
sdk?.invoke("selectEnterpriseContact", {
fromDepartmentId: -1,
mode: "multi",
type: ["user"]
}, res => {
if (res.err_msg == "selectEnterpriseContact:ok") {
if (typeof res.result == 'string') {
res.result = JSON.parse(res.result)
}
resolve(res.result)
}
})
}, 500)
})
})
},
},
getters: {
getDict: state => key => {