Ver código fonte

我的团队接口联调完成

htc 2 dias atrás
pai
commit
8924f1bf1f

+ 2 - 2
App.vue

@@ -169,11 +169,11 @@
 		width: 100%;
 		height: 88rpx;
 		border-radius: 44rpx;
-		border: 1rpx solid #E0E4E7;
+		background: rgba(25, 156, 156, 0.06);
 		font-family: PingFang-SC, PingFang-SC;
 		font-weight: bold;
 		font-size: 32rpx;
-		color: #002846;
+		color: #009191;
 		line-height: 88rpx;
 		text-align: center;
 		letter-spacing: 2rpx;

+ 3 - 0
components/CusSelect/index.vue

@@ -73,6 +73,9 @@
 					this.$set(this.originList[i],'select',i===index)
 				})
 			},
+			addTeam(){
+				this.$emit('addTeam')
+			},
 			confirmTeam(){
 				this.$emit('confirmTeam',this.current)
 			}

+ 4 - 1
components/CusTeamInfoFill/index.vue

@@ -57,7 +57,7 @@
 			</view>
 		</view>
 		<view class="box">
-			<view class="box-title">团队介</view>
+			<view class="box-title">团队介</view>
 			<view class="box-textarea">
 				<u-textarea border="none" height="320rpx" maxlength="-1" fontSize="28rpx" color="#002846" v-model="teamInfo.brief" placeholder="示例:这是一个为公司ERP系统升级而组建的36人团队,成员由公司副总经理、各部门总监以及各部门核心骨干组成。团队成员工作地点分布在香港、上海、苏州、深圳和东莞等地。团队成员年龄在35-50岁之间,男女比例比较均衡,大部份成员在该公司同事超过十年。"></u-textarea>
 			</view>
@@ -125,6 +125,9 @@
 					this.teamLevelData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
 				})
 			},
+			setTeamInfo(info){
+				this.teamInfo = info;
+			},
 			confirm(e) {
 				const { value } = e;
 				this.areaText = value.map(item => item.label).join('-');

+ 12 - 0
pages.json

@@ -206,6 +206,18 @@
 					"style": {
 						"navigationStyle": "custom"
 					}
+				},
+				{
+					"path": "team",
+					"style": {
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "teamEdit",
+					"style": {
+						"navigationStyle": "custom"
+					}
 				}
 			]
 		}

+ 2 - 2
pages/home.vue

@@ -144,8 +144,8 @@
 			}
 			
 			if(uni.getStorageSync('token')){
-				this.getWjList();
-				this.getReportList();
+				// this.getWjList();
+				// this.getReportList();
 			}
 			
 			if(uni.getStorageSync('newUser')) this.newUserFreeShow = true;

+ 2 - 2
pages/my.vue

@@ -73,8 +73,8 @@
 					},
 					{
 						img:this.$imgBase+'my_program.png',
-						title:'我的项目',
-						path:''
+						title:'我的团队',
+						path:'/pagesMy/team'
 					},
 					{
 						img:this.$imgBase+'my_teamusers.png',

+ 1 - 1
pagesHome/components/createList.vue

@@ -162,7 +162,7 @@
 			handleMenuClick(type){
 				if(type===0){
 					uni.navigateTo({
-						url:'/pagesHome/questionnaireEdit?id='+this.dto.id||''
+						url:`/pagesHome/questionnaireEdit?teamQuestionnaireId=${this.dto.teamQuestionnaireId}&type=${this.dto.type}&questionnaireName=${this.dto.title}`
 					})
 				}else if(type===1){
 					

+ 59 - 27
pagesHome/questionnaireEdit.vue

@@ -4,17 +4,17 @@
 		<view class="box adfacjb" style="padding: 32rpx 24rpx 40rpx;">
 			<view class="box-left">
 				<view class="box-title">问卷名称</view>
-				<view class="box-tip" style="margin-top: 32rpx;">{{'GW+MC PREILL36测评题库版本'}}</view>
+				<view class="box-tip" style="margin-top: 32rpx;">{{questionnaireName}}</view>
 			</view>
 			<view class="box-right adfac" @click="handlePreview">
 				<text>预览</text>
 				<image :src="imgBase+'my_arrow_right.png'"></image>
 			</view>
 		</view>
-		<view class="box" style="padding: 32rpx 24rpx;">
+		<view class="box" style="padding: 32rpx 24rpx;" @click="showTeam">
 			<view class="box-title">选择团队</view>
-			<view class="box-team adfacjb" @click="teamShow=true">
-				<view class="box-tip">{{'甜梦2025一期团队'}}</view>
+			<view class="box-team adfacjb" @click="showTeam">
+				<view class="box-tip">{{teamName}}</view>
 				<image :src="imgBase+'my_arrow_right.png'"></image>
 			</view>
 		</view>
@@ -23,14 +23,14 @@
 			<view class="box-time adfacjb" style="margin-top: 32rpx;" @click="startShow=true">
 				<view class="box-time-left">开始时间</view>
 				<view class="box-time-right adfac">
-					<text>{{'2025-10-13 00:00'}}</text>
+					<text>{{dto.startTime}}</text>
 					<image :src="imgBase+'my_arrow_right.png'"></image>
 				</view>
 			</view>
 			<view class="box-time adfacjb">
 				<view class="box-time-left">截止时间</view>
 				<view class="box-time-right adfac" @click="endShow=true">
-					<text>{{'2025-10-20 00:00'}}</text>
+					<text>{{dto.endTime}}</text>
 					<image :src="imgBase+'my_arrow_right.png'"></image>
 				</view>
 			</view>
@@ -40,23 +40,23 @@
 				<text>限制每位用户提交次数</text>
 				<u-switch v-model="limit" activeColor="#199C9C" size="38"></u-switch>
 			</view>
-			<view class="box-num adfacjb">
+			<view class="box-num adfacjb" v-if="limit">
 				<view class="box-num-title">可提交次数</view>
 				<view class="box-num-right">
-					<cus-number-box :min="1" :number="dto.submitNum" @valChange="valChange"></cus-number-box>
+					<cus-number-box :min="1" :number="dto.answerSetting" @valChange="valChange"></cus-number-box>
 				</view>
 			</view>
 		</view>
-		<view class="box" style="padding: 30rpx 24rpx 0;">
+		<view class="box" style="padding: 30rpx 24rpx 0;" v-if="type>1">
 			<view class="box-title adfacjb">
 				<text>团队人员</text>
-				<view class="box-add">+ 添加</view>
+				<view class="box-add" @click="addTeamUser">+ 添加</view>
 			</view>
 			<view class="box-user">
-				<view class="box-user-item adfacjb" v-for="(item,index) in dto.userList" :key="index">
+				<view class="box-user-item adfacjb" v-for="(item,index) in dto.memberInfos" :key="index">
 					<view class="box-user-item-left">
 						<view class="box-user-item-left-name adfac">
-							<text>{{'吴亦可'}}</text>
+							<text>{{item.realName}}</text>
 							<view class="type">{{'赞助人Sponsor'}}</view>
 						</view>
 						<view class="box-user-item-left-email">{{'123456789@qq.com'}}</view>
@@ -68,7 +68,8 @@
 		<view class="bottom">
 			<view class="zt_btn" @click="confirmPublish">确认发布</view>
 		</view>
-		<cus-select :show="teamShow" :list="teamList" :addShow="true" @close="teamShow=false" @confirmTeam="confirmTeam"></cus-select>
+		<cus-select :show="teamShow" :list="teamList" :addShow="true" 
+			@close="teamShow=false" @addTeam="addTeam" @confirmTeam="confirmTeam"></cus-select>
 		<u-datetime-picker ref="datetimePicker1" title="开始时间" :minDate="minStartTime" itemHeight="88" :show="startShow" v-model="dto.startTime" mode="datetime" :formatter="formatter" @cancel="startShow=false" @confirm="startConfirm"></u-datetime-picker>
 		<u-datetime-picker ref="datetimePicker2" title="结束时间" :minDate="minEndTime" itemHeight="88" :show="endShow" v-model="dto.endTime" mode="datetime" :formatter="formatter" @cancel="endShow=false" @confirm="endConfirm"></u-datetime-picker>
 	</view>
@@ -81,21 +82,16 @@
 		components:{ CusNumberBox, CusSelect },
 		data(){
 			return {
+				id:'',
+				type:'',
+				questionnaireName:'',
 				limit:true,
 				teamShow:false,
 				startShow:false,
 				endShow:false,
-				dto:{
-					submitNum:1,
-					userList:[1,1,1,1],
-					startTime:'',
-					endTime:''
-				},
-				teamList:[
-					{id:1,name:'甜梦巧克力有限公司',select:false},
-					{id:2,name:'美银证券',select:false},
-					{id:3,name:'中国银行',select:false}
-				],
+				dto:{},
+				teamName:'',
+				teamList:[],
 				minStartTime:new Date().getTime(),
 				minEndTime:''
 			}
@@ -104,6 +100,12 @@
 			this.$refs.datetimePicker1.setFormatter(this.formatter)
 			this.$refs.datetimePicker2.setFormatter(this.formatter)
 		},
+		onLoad(options) {
+			this.teamQuestionnaireId = options.teamQuestionnaireId;
+			this.type = options.type;
+			this.questionnaireName = options.questionnaireName;
+			this.getDetail()
+		},
 		methods:{
 			formatter(type, value) {
 				if (type === 'year') {
@@ -120,6 +122,25 @@
 			valChange(e){
 				this.dto.submitNum = e;
 			},
+			getDetail(){
+				this.$api.get('/core/team/questionnaire/'+this.teamQuestionnaireId).then(({data:res})=>{
+					if(res.code!==0) return this.$showToast(res.msg)
+					this.dto = {...this.dto,...res.data}
+					this.teamName = res.data.teamName;
+				})
+			},
+			showTeam(){
+				this.teamShow = true;
+				this.$api.get('/core/user/team/page',{
+					page:1,
+					limit:-1,
+					coachId:JSON.parse(uni.getStorageSync('userInfo')).id
+				}).then(({data:res})=>{
+					if(res.code!==0) return this.$showToast(res.msg)
+					this.teamList = res.data.list;
+					this.teamList.forEach(t=>t.name=t.teamName)
+				})
+			},
 			handlePreview(){
 				uni.navigateTo({
 					url:'/pagesPublish/questionnairePreview'
@@ -135,7 +156,12 @@
 					}
 				})
 			},
-			confirmTeam(){
+			addTeamUser(){
+				
+			},
+			confirmTeam(item){
+				this.teamName = item.teamName;
+				this.dto.teamId = item.id;
 				this.teamShow = false;
 			},
 			startConfirm(e){
@@ -148,8 +174,14 @@
 				this.endShow = false;
 			},
 			confirmPublish(){
-				uni.navigateTo({
-					url:'/pagesPublish/publishResult'
+				let params = JSON.parse(JSON.stringify(this.dto));
+				params.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
+				params.type = this.type;
+				this.$api.get('/core/team/questionnaire',params).then(({data:res})=>{
+					if(res.code!==0) return this.$showToast(res.msg)
+					uni.navigateTo({
+						url:'/pagesPublish/publishResult'
+					})
 				})
 			}
 		}

+ 217 - 0
pagesMy/team.vue

@@ -0,0 +1,217 @@
+<template>
+	<view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
+		<cus-header title='我的团队'></cus-header>
+		<div class="list">
+			<div class="list-item" v-for="(item,index) in list" :key="item.id">
+				<image class="list-item-icon" :src="imgBase+'team_icon.png'"></image>
+				<image class="list-item-edit" :src="imgBase+'team_edit.png'" @click="handleEdit(item)"></image>
+				<div class="list-item-top">
+					<div class="list-item-top-title">{{item.teamName}}</div>
+					<div class="list-item-top-pre adf" style="margin-top: 36rpx;">
+						<div class="list-item-top-pre-left">所属地区:</div>
+						<div class="list-item-top-pre-right">{{item.provinceName+item.cityName}}</div>
+					</div>
+					<div class="list-item-top-pre adf">
+						<div class="list-item-top-pre-left">所属行业:</div>
+						<div class="list-item-top-pre-right">{{item.industryName||''}}</div>
+					</div>
+					<div class="list-item-top-pre adf">
+						<div class="list-item-top-pre-left">团队职能类型:</div>
+						<div class="list-item-top-pre-right">{{item.functionNames||''}}</div>
+					</div>
+					<div class="list-item-top-pre adf">
+						<div class="list-item-top-pre-left">团队结构类型:</div>
+						<div class="list-item-top-pre-right">{{item.orgNames||''}}</div>
+					</div>
+					<div class="list-item-top-pre adf">
+						<div class="list-item-top-pre-left">团队规模:</div>
+						<div class="list-item-top-pre-right">{{item.scaleName||''}}</div>
+					</div>
+					<div class="list-item-top-pre adf">
+						<div class="list-item-top-pre-left">团队层级:</div>
+						<div class="list-item-top-pre-right">{{item.hierarchyName||''}}</div>
+					</div>
+				</div>
+				<!-- <div class="list-item-bottom adfacjb" @click="handleReivew">
+					<div class="list-item-bottom-left">关联问卷:</div>
+					<div class="list-item-bottom-right adfacjb">
+						<div class="list-item-bottom-right-num">{{item.queNum||0}}条</div>
+						<div class="list-item-bottom-right-review adfac">
+							<text>查看</text>
+							<image :src="imgBase+'my_arrow_right.png'"></image>
+						</div>
+					</div>
+				</div> -->
+			</div>
+		</div>
+	</view>
+</template>
+
+<script>
+	export default {
+		data(){
+			return {
+				list:[],
+				query:{
+					page:1,
+					limit:10,
+					coachId:''
+				},
+				isOver:false,
+				scaleMap:new Map(),
+				hierarchyMap:new Map()
+			}
+		},
+		async onLoad() {
+			this.query.coachId = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo')).id||'';
+			await this.getTeamScaleData();
+			await this.getTeamHierarchyData();
+			this.getList()
+		},
+		onReachBottom() {
+			if(this.isOver) return
+			this.getList()
+		},
+		methods:{
+			getTeamScaleData(){
+				return new Promise((resolve,reject)=>{
+					this.$api.get('/getListByType/team_scale').then(({data:res})=>{
+						if(res.code!==0) return this.$showToast(res.msg)
+						res.data.forEach(d=>{
+							this.scaleMap.set(d.dictValue,d)
+						})
+						resolve()
+					})
+				})
+			},
+			getTeamHierarchyData(){
+				return new Promise((resolve,reject)=>{
+					this.$api.get('/getListByType/team_hierarchy').then(({data:res})=>{
+						if(res.code!==0) return this.$showToast(res.msg)
+						res.data.forEach(d=>{
+							this.hierarchyMap.set(d.dictValue,d)
+						})
+						resolve()
+					})
+				})
+			},
+			getList(){
+				this.$api.get('/core/user/team/page',this.query).then(({data:res})=>{
+					if(res.code!==0) return this.$showToast(res.msg)
+					this.list = [...this.list,...res.data.list]
+					this.list.forEach(l=>{
+						l.functionNames = l.functions.map(f=>f.functionName).join('、');
+						l.orgNames = l.organizations.map(f=>f.orgName).join('、');
+						l.scaleName = this.scaleMap.get(l.scale).dictLabel;
+						l.hierarchyName = this.hierarchyMap.get(l.hierarchy).dictLabel;
+					})
+					this.query.page++;
+					if(this.list.length>=res.data.total) this.isOver = true;
+				})
+			},
+			handleEdit(item){
+				uni.navigateTo({
+					url:`/pagesMy/teamEdit?id=${item.id}&scaleName=${item.scaleName}&hierarchyName=${item.hierarchyName}`
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.default_page{
+		background: #F7F7F7;
+		padding: 0 24rpx 40rpx;
+		box-sizing: border-box;
+		.list{
+			overflow: hidden;
+			&-item{
+				margin-top: 20rpx;
+				background: #FFFFFF;
+				border-radius: 24rpx;
+				position: relative;
+				padding-bottom: 20rpx;
+				&-icon{
+					width: 40rpx;
+					height: 40rpx;
+					position: absolute;
+					top: 36rpx;
+					left: 24rpx;
+				}
+				&-edit{
+					width: 80rpx;
+					height: 56rpx;
+					position: absolute;
+					top: 36rpx;
+					right: 24rpx;
+				}
+				&-top{
+					padding: 40rpx 80rpx 24rpx;
+					&-title{
+						padding-right: 100rpx;
+						font-family: PingFang-SC, PingFang-SC;
+						font-weight: bold;
+						font-size: 32rpx;
+						color: #002846;
+						line-height: 32rpx;
+					}
+					&-pre{
+						margin-top: 24rpx;
+						&-left{
+							width: 202rpx;
+							font-family: PingFangSC, PingFang SC;
+							font-weight: 400;
+							font-size: 24rpx;
+							color: #6B7280;
+							line-height: 32rpx;
+						}
+						&-right{
+							width: calc(100% - 202rpx);
+							font-family: PingFangSC, PingFang SC;
+							font-weight: 400;
+							font-size: 24rpx;
+							color: #6B7280;
+							line-height: 32rpx;
+						}
+					}
+				}
+				&-bottom{
+					padding: 24rpx 24rpx 24rpx 80rpx;
+					border-top: 1rpx solid #E5E7EB;
+					&-left{
+						width: 202rpx;
+						font-family: PingFangSC, PingFang SC;
+						font-weight: 400;
+						font-size: 24rpx;
+						color: #393939;
+						line-height: 32rpx;
+					}
+					&-right{
+						width: calc(100% - 202rpx);
+						&-num{
+							font-family: PingFang-SC, PingFang-SC;
+							font-weight: bold;
+							font-size: 26rpx;
+							color: #199C9C;
+							line-height: 32rpx;
+						}
+						&-review{
+							text{
+								font-family: PingFangSC, PingFang SC;
+								font-weight: 400;
+								font-size: 24rpx;
+								color: #A6A6A6;
+								line-height: 32rpx;
+							}
+							image{
+								width: 32rpx;
+								height: 32rpx;
+								margin-left: 8rpx;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+</style>

+ 119 - 0
pagesMy/teamEdit.vue

@@ -0,0 +1,119 @@
+<template>
+	<view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
+		<cus-header title='编辑团队'></cus-header>
+		<cus-team-info-fill ref="teamRef" @handleConfirm="handleConfirm" :confirmText="confirmText"></cus-team-info-fill>
+		<view class="dialog adffcacjc" v-if="show">
+			<view class="dbox">
+				<view class="dbox-title">温馨提示</view>
+				<view class="dbox-content">本次团队配置修改将在本团队<span>所有激活状态下的PERILL问卷中</span>生效,确定提交吗?</view>
+				<view class="dbox-btns adfacjb">
+					<view class="zt_btn" @click="editConfirm">确定</view>
+					<view class="qx_btn" @click="show=false">取消</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import CusTeamInfoFill from '@/components/CusTeamInfoFill/index.vue'
+	export default {
+		components:{ CusTeamInfoFill },
+		data(){
+			return {
+				id:'',
+				teamInfo:null,
+				confirmText:'确定',
+				scaleName:'',
+				hierarchyName:'',
+				submitDto:null,
+				show:false
+			}
+		},
+		onLoad(options) {
+			this.id = options.id;
+			this.scaleName = options.scaleName;
+			this.hierarchyName = options.hierarchyName;
+			this.getDetail()
+		},
+		methods:{
+			getDetail(){
+				this.$api.get(`/core/user/team/${this.id}`).then(({data:res})=>{
+					if(res.code!==0) return this.$showToast(res.msg)
+					this.teamInfo = res.data;
+					this.$refs.teamRef.setTeamInfo(res.data)
+					this.$refs.teamRef.teamInfo.functionIds = res.data.functions.map(f=>f.id);
+					this.$refs.teamRef.teamInfo.orgIds = res.data.organizations.map(o=>o.id);
+					this.$refs.teamRef.areaText = res.data.provinceName+res.data.cityName;
+					this.$refs.teamRef.industryText = res.data.industryName;
+					this.$refs.teamRef.functionTypeText = res.data.functions.map(f=>f.functionName).join('、');
+					this.$refs.teamRef.architectureTypeText = res.data.organizations.map(f=>f.orgName).join('、');
+					this.$refs.teamRef.teamScaleText = this.scaleName;
+					this.$refs.teamRef.teamLevelText = this.hierarchyName;
+				})
+			},
+			handleConfirm(data){
+				data.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
+				this.submitDto = data;
+				this.show = true;
+			},
+			editConfirm(){
+				this.$api.put('/core/user/team',this.submitDto).then(({data:res})=>{
+					if(res.code!==0) return this.$showToast(res.msg)
+					this.$showToast('编辑成功')
+					setTimeout(()=>{
+						uni.redirectTo({
+							url:'/pagesMy/team'
+						})
+					},1500)
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.dialog{
+		position: fixed;
+		left: 0;
+		right: 0;
+		top: 0;
+		bottom: 0;
+		background: rgba(0, 0, 0, .4);
+		z-index: 1000;
+		.dbox{
+			width: calc(100% - 150rpx);
+			background: #FFFFFF;
+			border-radius: 32rpx;
+			padding: 48rpx 30rpx;
+			box-sizing: border-box;
+			&-title{
+				font-family: PingFang-SC, PingFang-SC;
+				font-weight: bold;
+				font-size: 34rpx;
+				color: #002846;
+				line-height: 48rpx;
+				text-align: center;
+			}
+			&-content{
+				padding: 0 14rpx;
+				font-family: PingFangSC, PingFang SC;
+				font-weight: 400;
+				font-size: 32rpx;
+				color: #002846;
+				line-height: 54rpx;
+				text-align: center;
+				margin-top: 30rpx;
+				span{
+					font-weight: bold;
+				}
+			}
+			&-btns{
+				margin-top: 56rpx;
+				&>view{
+					width: calc(50% - 20rpx);
+				}
+			}
+		}
+	}
+</style>