createList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="qbox adffc">
  3. <view class="list" v-if="list.length">
  4. <up-list @scrolltolower="scrolltolower" style="height: 100%;">
  5. <up-list-item class="list-item" v-for="(item, index) in list" :key="index">
  6. <view @click.prevent="showDialog(item)">
  7. <image class="expand" :src="imgBase+'questionnaire_icon_down.png'"></image>
  8. <view class="title">{{item.title||''}}</view>
  9. <view class="name">团队名称:{{item.teamName||''}}</view>
  10. <view class="progress adfacjb">
  11. <view class="progress-left adfac">
  12. <view class="progress-left-text">作答进度:</view>
  13. <view class="progress-left-box">
  14. <view class="progress-left-box-current" :style="{'width':(item.finishNum/item.userNum*100)+'%'}"></view>
  15. </view>
  16. </view>
  17. <view class="progress-right"><span>{{item.finishNum}}/</span>{{item.userNum}}</view>
  18. </view>
  19. <view class="bottom adfacjb">
  20. <view class="bottom-left">截止时间:{{item.endTime}}</view>
  21. <view class="bottom-right" v-if="item.status===0&&item.type==1" @click.stop="handleAnswer(item)">立即作答</view>
  22. <view class="bottom-right" v-else-if="item.status===1&&!item.fileUrl" @click.stop="createReport(item)">生成报告</view>
  23. <view class="bottom-right" v-else-if="item.status===1&&item.fileUrl" @click.stop="sendReport(item)">发送报告</view>
  24. </view>
  25. </view>
  26. </up-list-item>
  27. </up-list>
  28. </view>
  29. <view class="empty" v-else>
  30. <page-empty></page-empty>
  31. </view>
  32. <view class="dialog adffc" v-if="show">
  33. <view class="dbox">
  34. <view class="dbox-top adfacjb">
  35. <view class="dbox-top-title">{{dto.title||''}}</view>
  36. <image class="dbox-top-expand" :src="imgBase+'questionnaire_icon_down.png'" @click="show=false"></image>
  37. </view>
  38. <view class="dbox-name">团队名称:{{dto.teamName||''}}</view>
  39. <view class="dbox-progress adfacjb">
  40. <view class="dbox-progress-left adfac">
  41. <view class="dbox-progress-left-text">作答进度:</view>
  42. <view class="dbox-progress-left-box">
  43. <view class="dbox-progress-left-box-current" :style="{'width':(dto.finishNum/dto.userNum*100)+'%'}"></view>
  44. </view>
  45. </view>
  46. <view class="dbox-progress-right"><span>{{dto.finishNum}}/</span>{{dto.userNum}}</view>
  47. </view>
  48. <view class="dbox-menu">
  49. <view class="dbox-menu-pre adffcac" v-for="(item,index) in menuListCopy" :key="index" @click="handleMenuClick(item,index)">
  50. <image :src="item.img"></image>
  51. <text>{{item.text}}</text>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="dialog adffc" v-if="teamInfoShow">
  57. <view class="dialog-box">
  58. <view class="dialog-box-title">团队信息</view>
  59. <image class="dialog-box-close" :src="imgBase+'remind_close.png'" @click="teamInfoShow=false"></image>
  60. <view class="dialog-box-teaminfo">
  61. <cus-team-info-fill ref="teamRef" confirmText="保存" @handleConfirm="handleConfirm"></cus-team-info-fill>
  62. </view>
  63. </view>
  64. </view>
  65. <div class="alert adffcacjc" v-if="alertShow">
  66. <div class="alert-box">
  67. <div class="alert-box-title">温馨提示</div>
  68. <image :src="imgBase+'remind_close.png'" class="alert-box-close" @click="alertShow=false"></image>
  69. <div class="alert-box-text">该问卷尚未生成报告<br>请确认团队人员是否全部作答<br>完成后点击生成报告</div>
  70. <div class="zt_btn" @click="alertShow=false">我知道了</div>
  71. </div>
  72. </div>
  73. <cus-team-user :deluser="true" :show="teamUserShow" :list="teamUserList"
  74. @close="teamUserShow=false" @addUser="addUser" @handleConfirm="userConfirm" @deleteUser="deleteUser"></cus-team-user>
  75. </view>
  76. </template>
  77. <script>
  78. import PageEmpty from '@/components/pageEmpty/index.vue'
  79. import CusTeamUser from '@/components/CusTeamUser/index.vue'
  80. import CusTeamInfoFill from '@/components/CusTeamInfoFill/index.vue'
  81. export default {
  82. components:{ PageEmpty, CusTeamUser, CusTeamInfoFill },
  83. props:{
  84. list:{
  85. typeof:Array,
  86. default:[]
  87. }
  88. },
  89. data(){
  90. return {
  91. show:false,
  92. teamInfoShow:false,
  93. teamUserShow:false,
  94. alertShow:false,
  95. dto:null,
  96. menuList:[
  97. {
  98. img:this.$imgBase+'questionnaire_edit.png',
  99. text:'编辑问卷'
  100. },
  101. {
  102. img:this.$imgBase+'questionnaire_share.png',
  103. text:'分享问卷'
  104. },
  105. {
  106. img:this.$imgBase+'questionnaire_info.png',
  107. text:'团队信息'
  108. },
  109. {
  110. img:this.$imgBase+'questionnaire_copy.png',
  111. text:'复制链接'
  112. },
  113. {
  114. img:this.$imgBase+'questionnaire_users.png',
  115. text:'团队人员'
  116. },
  117. {
  118. img:this.$imgBase+'questionnaire_report.png',
  119. text:'生成报告'
  120. },
  121. {
  122. img:this.$imgBase+'questionnaire_report.png',
  123. text:'发送报告'
  124. }
  125. ],
  126. menuListCopy:[],
  127. teamUserList:[],
  128. originTeamUserList:[],
  129. teamScaleData:[],
  130. teamLevelData:[],
  131. categoryData:[],
  132. delMemberIds:[],
  133. }
  134. },
  135. methods:{
  136. scrolltolower(){
  137. this.$emit('scrolltolower')
  138. },
  139. showDialog(item){
  140. this.dto = item;
  141. if(this.dto.type==1) this.menuListCopy = this.menuList.filter((_, index) => index !== 4);
  142. else this.menuListCopy = JSON.parse(JSON.stringify(this.menuList))
  143. this.show = true;
  144. },
  145. async getTeamScaleData(){
  146. return new Promise((resolve,reject)=>{
  147. this.$api.get('/getListByType/team_scale').then(({data:res})=>{
  148. if(res.code!==0) return this.$showToast(res.msg)
  149. this.teamScaleData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  150. resolve()
  151. })
  152. })
  153. },
  154. async getTeamHierarchyData(){
  155. return new Promise((resolve,reject)=>{
  156. this.$api.get('/getListByType/team_hierarchy').then(({data:res})=>{
  157. if(res.code!==0) return this.$showToast(res.msg)
  158. this.teamLevelData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  159. resolve()
  160. })
  161. })
  162. },
  163. async getUserCategoryData(){
  164. return new Promise((resolve,reject)=>{
  165. this.$api.get('/getListByType/UserCategory').then(({data:res})=>{
  166. if(res.code!==0) return this.$showToast(res.msg)
  167. this.categoryData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  168. resolve()
  169. })
  170. })
  171. },
  172. async handleMenuClick(item){
  173. if(item.text==='编辑问卷'){
  174. uni.navigateTo({
  175. url:`/pagesHome/questionnaireEdit?teamQuestionnaireId=${this.dto.teamQuestionnaireId}&type=${this.dto.type}&questionnaireName=${this.dto.title}&isEdit=true`
  176. })
  177. this.show = false;
  178. }else if(item.text==='分享问卷'){
  179. }else if(item.text==='团队信息'){
  180. this.teamInfoShow = true;
  181. await this.getTeamScaleData()
  182. await this.getTeamHierarchyData()
  183. this.$api.get(`/core/user/team/${this.dto.teamId}`).then(({data:res})=>{
  184. if(res.code!==0) return this.$showToast(res.msg)
  185. this.$refs.teamRef.setTeamInfo(res.data)
  186. this.$refs.teamRef.teamInfo.functionIds = res.data.functions.map(f=>f.id);
  187. this.$refs.teamRef.teamInfo.orgIds = res.data.organizations.map(o=>o.id);
  188. this.$refs.teamRef.areaText = res.data.provinceName+res.data.cityName;
  189. this.$refs.teamRef.industryText = res.data.industryName;
  190. this.$refs.teamRef.functionTypeText = res.data.functions.map(f=>f.functionName).join('、');
  191. this.$refs.teamRef.architectureTypeText = res.data.organizations.map(f=>f.orgName).join('、');
  192. this.$refs.teamRef.teamScaleText = this.teamScaleData.find(d=>d.id==res.data.scale).name;
  193. this.$refs.teamRef.teamLevelText = this.teamLevelData.find(d=>d.id==res.data.hierarchy).name;
  194. })
  195. }
  196. else if(item.text==='复制链接') {
  197. this.$showToast('复制成功')
  198. }
  199. else if(item.text==='团队人员'){
  200. await this.getUserCategoryData()
  201. this.$api.get(`/core/member/listByQueTeamId/${this.dto.teamQuestionnaireId}`).then(({data:res})=>{
  202. if(res.code!==0) return this.$showToast(res.msg)
  203. this.teamUserList = res.data;
  204. this.originTeamUserList = res.data;
  205. this.teamUserList.forEach(l=>{
  206. l.categoryName = this.categoryData.find(c=>c.id==l.category)?.name;
  207. })
  208. this.teamUserShow = true
  209. })
  210. }
  211. else if(item.text==='生成报告'){
  212. if(this.dto.status==0) return this.$showToast('问卷未完成,全部团队人员作答后才能生成报告')
  213. }
  214. else if(item.text==='发送报告'){
  215. if(this.dto.status==0) return this.$showToast('请先生成报告后再进行发送报告')
  216. }
  217. },
  218. handleConfirm(data){
  219. data.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
  220. this.$api.put('/core/user/team',data).then(({data:res})=>{
  221. if(res.code!==0) return this.$showToast(res.msg)
  222. this.$showToast('保存成功')
  223. this.teamInfoShow = false;
  224. })
  225. },
  226. handleAnswer(item){
  227. uni.navigateTo({
  228. url:'/pagesPublish/questionnaireFill?teamQuestionnaireId='+item.teamQuestionnaireId+'&teamId='+item.teamId+'&type='+item.type
  229. })
  230. },
  231. createReport(item){
  232. },
  233. sendReport(item){
  234. },
  235. addUser(){
  236. uni.navigateTo({
  237. url:'/pagesMy/teamUser?type=select',
  238. events:{
  239. selectUserConfirm: data => {
  240. data.forEach((d,i)=>(this.$set(data[i],'status',0)));
  241. let newUser = this.filterUsers(this.teamUserList,data)
  242. this.teamUserList = [...this.teamUserList,...newUser];
  243. }
  244. }
  245. })
  246. },
  247. filterUsers(originArr,selectArr){
  248. const aValuesToExclude = new Set(originArr.map(item => item.id));
  249. return selectArr.filter(item => {
  250. return !aValuesToExclude.has(item.id);
  251. });
  252. },
  253. userConfirm(){
  254. if(this.teamUserList.length===0) return this.$showToast('至少保留一位团队人员');
  255. this.$api.get('/core/team/questionnaire/'+this.dto.teamQuestionnaireId).then(({data:res})=>{
  256. if(res.code!==0) return this.$showToast(res.msg)
  257. let dto = res.data;
  258. dto.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
  259. dto.delMemberIds = [...new Set(this.delMemberIds)];
  260. dto.memberList = this.teamUserList;
  261. dto.type = 2;
  262. delete dto.memberInfos;
  263. this.$api.put('/core/team/questionnaire/updateMembers',dto).then(({data:resu})=>{
  264. if(resu.code!==0) return this.$showToast(resu.msg)
  265. this.$showToast('操作成功')
  266. this.teamUserShow = false;
  267. // this.show = false;
  268. })
  269. })
  270. },
  271. deleteUser(data){
  272. let u = this.originTeamUserList.find(u=>u.id===data.item.id);
  273. if(u) this.delMemberIds=[...this.delMemberIds,u.id]
  274. this.teamUserList.splice(data.index,1);
  275. }
  276. }
  277. }
  278. </script>
  279. <style scoped lang="scss">
  280. .qbox{
  281. width: 100%;
  282. height: 100%;
  283. flex: 1;
  284. .list{
  285. flex: 1;
  286. margin-top: 20rpx;
  287. overflow: hidden;
  288. &-item{
  289. width: 100%;
  290. background: #FFFFFF;
  291. border-radius: 24rpx;
  292. margin-top: 20rpx;
  293. padding: 36rpx 24rpx 19rpx;
  294. box-sizing: border-box;
  295. position: relative;
  296. display: block;
  297. .expand{
  298. width: 32rpx;
  299. height: 32rpx;
  300. position: absolute;
  301. top: 36rpx;
  302. right: 32rpx;
  303. }
  304. .title{
  305. width: calc(100% - 128rpx);
  306. font-family: PingFang-SC, PingFang-SC;
  307. font-weight: bold;
  308. font-size: 32rpx;
  309. color: #002846;
  310. line-height: 32rpx;
  311. }
  312. .name{
  313. font-family: PingFangSC, PingFang SC;
  314. font-weight: 400;
  315. font-size: 24rpx;
  316. color: #667E90;
  317. line-height: 24rpx;
  318. margin-top: 35rpx;
  319. }
  320. .progress{
  321. margin-top: 36rpx;
  322. &-left{
  323. width: calc(100% - 95rpx);
  324. &-text{
  325. font-family: PingFangSC, PingFang SC;
  326. font-weight: 400;
  327. font-size: 24rpx;
  328. color: #667E90;
  329. line-height: 24rpx;
  330. }
  331. &-box{
  332. flex: 1;
  333. position: relative;
  334. height: 12rpx;
  335. background: #F0F2F8;
  336. border-radius: 6rpx;
  337. &-current{
  338. height: 12rpx;
  339. background: #7CC5C5;
  340. border-radius: 6rpx;
  341. position: absolute;
  342. top: 0;
  343. left: 0;
  344. }
  345. }
  346. }
  347. &-right{
  348. font-size: 24rpx;
  349. line-height: 24rpx;
  350. color: #95A5B1;
  351. span{
  352. font-size: 24rpx;
  353. line-height: 24rpx;
  354. color: #002846;
  355. }
  356. }
  357. }
  358. .bottom{
  359. margin-top: 30rpx;
  360. border-top: 1rpx solid #EFEFEF;
  361. padding-top: 20rpx;
  362. &-left{
  363. font-family: PingFangSC, PingFang SC;
  364. font-weight: 400;
  365. font-size: 24rpx;
  366. color: #667E90;
  367. line-height: 24rpx;
  368. }
  369. &-right{
  370. border-radius: 32rpx;
  371. background: linear-gradient( 90deg, #33A7A7 0%, #4DB2B2 100%);
  372. padding: 19rpx 22rpx;
  373. font-family: PingFangSC, PingFang SC;
  374. font-weight: 400;
  375. font-size: 26rpx;
  376. color: #FFFFFF;
  377. line-height: 26rpx;
  378. letter-spacing: 2rpx;
  379. }
  380. }
  381. }
  382. }
  383. .empty{
  384. flex: 1;
  385. }
  386. .dialog{
  387. position: fixed;
  388. left: 0;
  389. right: 0;
  390. top: 0;
  391. bottom: 0;
  392. background: rgba(0, 0, 0, .4);
  393. z-index: 1001;
  394. justify-content: flex-end;
  395. .dbox{
  396. width: 100%;
  397. height: 738rpx;
  398. background: #FFFFFF;
  399. box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(0,0,0,0.07);
  400. border-radius: 24rpx 24rpx 0rpx 0rpx;
  401. padding: 48rpx 30rpx 0;
  402. box-sizing: border-box;
  403. &-top{
  404. &-title{
  405. width: calc(100% - 60rpx);
  406. font-family: PingFang-SC, PingFang-SC;
  407. font-weight: bold;
  408. font-size: 32rpx;
  409. color: #002846;
  410. line-height: 40rpx;
  411. }
  412. &-expand{
  413. width: 32rpx;
  414. height: 32rpx;
  415. transform: rotate(180deg);
  416. }
  417. }
  418. &-name{
  419. font-family: PingFangSC, PingFang SC;
  420. font-weight: 400;
  421. font-size: 24rpx;
  422. color: #667E90;
  423. line-height: 24rpx;
  424. margin-top: 24rpx;
  425. }
  426. &-progress{
  427. margin-top: 36rpx;
  428. &-left{
  429. width: calc(100% - 95rpx);
  430. &-text{
  431. font-family: PingFangSC, PingFang SC;
  432. font-weight: 400;
  433. font-size: 24rpx;
  434. color: #667E90;
  435. line-height: 24rpx;
  436. }
  437. &-box{
  438. flex: 1;
  439. position: relative;
  440. height: 12rpx;
  441. background: #F0F2F8;
  442. border-radius: 6rpx;
  443. &-current{
  444. height: 12rpx;
  445. background: #7CC5C5;
  446. border-radius: 6rpx;
  447. position: absolute;
  448. top: 0;
  449. left: 0;
  450. }
  451. }
  452. }
  453. &-right{
  454. font-size: 24rpx;
  455. line-height: 24rpx;
  456. color: #95A5B1;
  457. span{
  458. font-size: 24rpx;
  459. line-height: 24rpx;
  460. color: #002846;
  461. }
  462. }
  463. }
  464. &-menu{
  465. margin-top: 43rpx;
  466. overflow: hidden;
  467. margin-left: -30rpx;
  468. &-pre{
  469. width: calc(25% - 30rpx);
  470. background: #F7F8FA;
  471. border-radius: 24rpx;
  472. padding: 30rpx 20rpx;
  473. margin-top: 24rpx;
  474. margin-left: 30rpx;
  475. box-sizing: border-box;
  476. float: left;
  477. image{
  478. width: 42rpx;
  479. height: 42rpx;
  480. }
  481. text{
  482. font-family: PingFangSC, PingFang SC;
  483. font-weight: 400;
  484. font-size: 24rpx;
  485. color: #002846;
  486. line-height: 24rpx;
  487. text-align: center;
  488. margin-top: 24rpx;
  489. }
  490. }
  491. }
  492. }
  493. &-box{
  494. width: 100%;
  495. height: 1200rpx;
  496. background: #F7F7F7;
  497. padding-top: 38rpx;
  498. border-radius: 24rpx 24rpx 0rpx 0rpx;
  499. box-sizing: border-box;
  500. position: relative;
  501. overflow-y: auto;
  502. &-title{
  503. font-family: PingFang-SC, PingFang-SC;
  504. font-weight: bold;
  505. font-size: 32rpx;
  506. color: #002846;
  507. line-height: 32rpx;
  508. text-align: center;
  509. }
  510. &-close{
  511. width: 48rpx;
  512. height: 48rpx;
  513. position: absolute;
  514. top: 30rpx;
  515. right: 30rpx;
  516. }
  517. &-teaminfo{
  518. margin-top: 40rpx;
  519. }
  520. }
  521. }
  522. .alert{
  523. position: fixed;
  524. left: 0;
  525. right: 0;
  526. top: 0;
  527. bottom: 0;
  528. z-index: 1002;
  529. background: rgba(0, 0, 0, .4);
  530. &-box{
  531. width: calc(100% - 100rpx);
  532. padding: 54rpx 99rpx 48rpx;
  533. box-sizing: border-box;
  534. position: relative;
  535. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/alert_bg.png') no-repeat;
  536. background-size: 100% 100%;
  537. &-title{
  538. font-family: PingFang-SC, PingFang-SC;
  539. font-weight: bold;
  540. font-size: 36rpx;
  541. color: #002846;
  542. line-height: 56rpx;
  543. text-align: center;
  544. }
  545. &-close{
  546. width: 48rpx;
  547. height: 48rpx;
  548. position: absolute;
  549. top: 40rpx;
  550. right: 30rpx;
  551. }
  552. &-text{
  553. font-family: PingFangSC, PingFang SC;
  554. font-weight: 400;
  555. font-size: 30rpx;
  556. color: #002846;
  557. line-height: 48rpx;
  558. text-align: center;
  559. margin-top: 32rpx;
  560. }
  561. .zt_btn{
  562. margin-top: 66rpx;
  563. }
  564. }
  565. }
  566. }
  567. </style>