createList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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_send.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. uni.setClipboardData({
  198. })
  199. this.$showToast('复制成功')
  200. }
  201. else if(item.text==='团队人员'){
  202. await this.getUserCategoryData()
  203. this.$api.get(`/core/member/listByQueTeamId/${this.dto.teamQuestionnaireId}`).then(({data:res})=>{
  204. if(res.code!==0) return this.$showToast(res.msg)
  205. this.teamUserList = res.data;
  206. this.originTeamUserList = res.data;
  207. this.teamUserList.forEach(l=>{
  208. l.categoryName = this.categoryData.find(c=>c.id==l.category)?.name;
  209. })
  210. this.teamUserShow = true
  211. })
  212. }
  213. else if(item.text==='生成报告'){
  214. if(this.dto.status==0) return this.$showToast('问卷未完成,全部团队人员作答后才能生成报告')
  215. }
  216. else if(item.text==='发送报告'){
  217. if(this.dto.status==0) return this.$showToast('请先生成报告后再进行发送报告')
  218. }
  219. },
  220. handleConfirm(data){
  221. data.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
  222. this.$api.put('/core/user/team',data).then(({data:res})=>{
  223. if(res.code!==0) return this.$showToast(res.msg)
  224. this.$showToast('保存成功')
  225. this.teamInfoShow = false;
  226. })
  227. },
  228. handleAnswer(item){
  229. uni.navigateTo({
  230. url:'/pagesPublish/questionnaireFill?teamQuestionnaireId='+item.teamQuestionnaireId+'&teamId='+item.teamId+'&type='+item.type
  231. })
  232. },
  233. createReport(item){
  234. },
  235. sendReport(item){
  236. },
  237. addUser(){
  238. uni.navigateTo({
  239. url:'/pagesMy/teamUser?type=select',
  240. events:{
  241. selectUserConfirm: data => {
  242. data.forEach((d,i)=>(this.$set(data[i],'status',0)));
  243. let newUser = this.filterUsers(this.teamUserList,data)
  244. this.teamUserList = [...this.teamUserList,...newUser];
  245. }
  246. }
  247. })
  248. },
  249. filterUsers(originArr,selectArr){
  250. const aValuesToExclude = new Set(originArr.map(item => item.id));
  251. return selectArr.filter(item => {
  252. return !aValuesToExclude.has(item.id);
  253. });
  254. },
  255. userConfirm(){
  256. if(this.teamUserList.length===0) return this.$showToast('至少保留一位团队人员');
  257. this.$api.get('/core/team/questionnaire/'+this.dto.teamQuestionnaireId).then(({data:res})=>{
  258. if(res.code!==0) return this.$showToast(res.msg)
  259. let dto = res.data;
  260. dto.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
  261. dto.delMemberIds = [...new Set(this.delMemberIds)];
  262. dto.memberList = this.teamUserList;
  263. dto.type = 2;
  264. delete dto.memberInfos;
  265. this.$api.put('/core/team/questionnaire/updateMembers',dto).then(({data:resu})=>{
  266. if(resu.code!==0) return this.$showToast(resu.msg)
  267. this.$showToast('操作成功')
  268. this.teamUserShow = false;
  269. // this.show = false;
  270. })
  271. })
  272. },
  273. deleteUser(data){
  274. let u = this.originTeamUserList.find(u=>u.id===data.item.id);
  275. if(u) this.delMemberIds=[...this.delMemberIds,u.id]
  276. this.teamUserList.splice(data.index,1);
  277. }
  278. }
  279. }
  280. </script>
  281. <style scoped lang="scss">
  282. .qbox{
  283. width: 100%;
  284. height: 100%;
  285. flex: 1;
  286. .list{
  287. flex: 1;
  288. margin-top: 20rpx;
  289. overflow: hidden;
  290. &-item{
  291. width: 100%;
  292. background: #FFFFFF;
  293. border-radius: 24rpx;
  294. margin-top: 20rpx;
  295. padding: 36rpx 24rpx 19rpx;
  296. box-sizing: border-box;
  297. position: relative;
  298. display: block;
  299. .expand{
  300. width: 32rpx;
  301. height: 32rpx;
  302. position: absolute;
  303. top: 36rpx;
  304. right: 32rpx;
  305. }
  306. .title{
  307. width: calc(100% - 128rpx);
  308. font-family: PingFang-SC, PingFang-SC;
  309. font-weight: bold;
  310. font-size: 32rpx;
  311. color: #002846;
  312. line-height: 32rpx;
  313. }
  314. .name{
  315. font-family: PingFangSC, PingFang SC;
  316. font-weight: 400;
  317. font-size: 24rpx;
  318. color: #667E90;
  319. line-height: 24rpx;
  320. margin-top: 35rpx;
  321. }
  322. .progress{
  323. margin-top: 36rpx;
  324. &-left{
  325. width: calc(100% - 95rpx);
  326. &-text{
  327. font-family: PingFangSC, PingFang SC;
  328. font-weight: 400;
  329. font-size: 24rpx;
  330. color: #667E90;
  331. line-height: 24rpx;
  332. }
  333. &-box{
  334. flex: 1;
  335. position: relative;
  336. height: 12rpx;
  337. background: #F0F2F8;
  338. border-radius: 6rpx;
  339. &-current{
  340. height: 12rpx;
  341. background: #7CC5C5;
  342. border-radius: 6rpx;
  343. position: absolute;
  344. top: 0;
  345. left: 0;
  346. }
  347. }
  348. }
  349. &-right{
  350. font-size: 24rpx;
  351. line-height: 24rpx;
  352. color: #95A5B1;
  353. span{
  354. font-size: 24rpx;
  355. line-height: 24rpx;
  356. color: #002846;
  357. }
  358. }
  359. }
  360. .bottom{
  361. margin-top: 30rpx;
  362. border-top: 1rpx solid #EFEFEF;
  363. padding-top: 20rpx;
  364. &-left{
  365. font-family: PingFangSC, PingFang SC;
  366. font-weight: 400;
  367. font-size: 24rpx;
  368. color: #667E90;
  369. line-height: 24rpx;
  370. }
  371. &-right{
  372. border-radius: 32rpx;
  373. background: linear-gradient( 90deg, #33A7A7 0%, #4DB2B2 100%);
  374. padding: 19rpx 22rpx;
  375. font-family: PingFangSC, PingFang SC;
  376. font-weight: 400;
  377. font-size: 26rpx;
  378. color: #FFFFFF;
  379. line-height: 26rpx;
  380. letter-spacing: 2rpx;
  381. }
  382. }
  383. }
  384. }
  385. .empty{
  386. flex: 1;
  387. }
  388. .dialog{
  389. position: fixed;
  390. left: 0;
  391. right: 0;
  392. top: 0;
  393. bottom: 0;
  394. background: rgba(0, 0, 0, .4);
  395. z-index: 1001;
  396. justify-content: flex-end;
  397. .dbox{
  398. width: 100%;
  399. height: 738rpx;
  400. background: #FFFFFF;
  401. box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(0,0,0,0.07);
  402. border-radius: 24rpx 24rpx 0rpx 0rpx;
  403. padding: 48rpx 30rpx 0;
  404. box-sizing: border-box;
  405. &-top{
  406. &-title{
  407. width: calc(100% - 60rpx);
  408. font-family: PingFang-SC, PingFang-SC;
  409. font-weight: bold;
  410. font-size: 32rpx;
  411. color: #002846;
  412. line-height: 40rpx;
  413. }
  414. &-expand{
  415. width: 32rpx;
  416. height: 32rpx;
  417. transform: rotate(180deg);
  418. }
  419. }
  420. &-name{
  421. font-family: PingFangSC, PingFang SC;
  422. font-weight: 400;
  423. font-size: 24rpx;
  424. color: #667E90;
  425. line-height: 24rpx;
  426. margin-top: 24rpx;
  427. }
  428. &-progress{
  429. margin-top: 36rpx;
  430. &-left{
  431. width: calc(100% - 95rpx);
  432. &-text{
  433. font-family: PingFangSC, PingFang SC;
  434. font-weight: 400;
  435. font-size: 24rpx;
  436. color: #667E90;
  437. line-height: 24rpx;
  438. }
  439. &-box{
  440. flex: 1;
  441. position: relative;
  442. height: 12rpx;
  443. background: #F0F2F8;
  444. border-radius: 6rpx;
  445. &-current{
  446. height: 12rpx;
  447. background: #7CC5C5;
  448. border-radius: 6rpx;
  449. position: absolute;
  450. top: 0;
  451. left: 0;
  452. }
  453. }
  454. }
  455. &-right{
  456. font-size: 24rpx;
  457. line-height: 24rpx;
  458. color: #95A5B1;
  459. span{
  460. font-size: 24rpx;
  461. line-height: 24rpx;
  462. color: #002846;
  463. }
  464. }
  465. }
  466. &-menu{
  467. margin-top: 43rpx;
  468. overflow: hidden;
  469. margin-left: -30rpx;
  470. &-pre{
  471. width: calc(25% - 30rpx);
  472. background: #F7F8FA;
  473. border-radius: 24rpx;
  474. padding: 30rpx 20rpx;
  475. margin-top: 24rpx;
  476. margin-left: 30rpx;
  477. box-sizing: border-box;
  478. float: left;
  479. image{
  480. width: 42rpx;
  481. height: 42rpx;
  482. }
  483. text{
  484. font-family: PingFangSC, PingFang SC;
  485. font-weight: 400;
  486. font-size: 24rpx;
  487. color: #002846;
  488. line-height: 24rpx;
  489. text-align: center;
  490. margin-top: 24rpx;
  491. }
  492. }
  493. }
  494. }
  495. &-box{
  496. width: 100%;
  497. height: 1200rpx;
  498. background: #F7F7F7;
  499. padding-top: 38rpx;
  500. border-radius: 24rpx 24rpx 0rpx 0rpx;
  501. box-sizing: border-box;
  502. position: relative;
  503. overflow-y: auto;
  504. &-title{
  505. font-family: PingFang-SC, PingFang-SC;
  506. font-weight: bold;
  507. font-size: 32rpx;
  508. color: #002846;
  509. line-height: 32rpx;
  510. text-align: center;
  511. }
  512. &-close{
  513. width: 48rpx;
  514. height: 48rpx;
  515. position: absolute;
  516. top: 30rpx;
  517. right: 30rpx;
  518. }
  519. &-teaminfo{
  520. margin-top: 40rpx;
  521. }
  522. }
  523. }
  524. .alert{
  525. position: fixed;
  526. left: 0;
  527. right: 0;
  528. top: 0;
  529. bottom: 0;
  530. z-index: 1002;
  531. background: rgba(0, 0, 0, .4);
  532. &-box{
  533. width: calc(100% - 100rpx);
  534. padding: 54rpx 99rpx 48rpx;
  535. box-sizing: border-box;
  536. position: relative;
  537. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/alert_bg.png') no-repeat;
  538. background-size: 100% 100%;
  539. &-title{
  540. font-family: PingFang-SC, PingFang-SC;
  541. font-weight: bold;
  542. font-size: 36rpx;
  543. color: #002846;
  544. line-height: 56rpx;
  545. text-align: center;
  546. }
  547. &-close{
  548. width: 48rpx;
  549. height: 48rpx;
  550. position: absolute;
  551. top: 40rpx;
  552. right: 30rpx;
  553. }
  554. &-text{
  555. font-family: PingFangSC, PingFang SC;
  556. font-weight: 400;
  557. font-size: 30rpx;
  558. color: #002846;
  559. line-height: 48rpx;
  560. text-align: center;
  561. margin-top: 32rpx;
  562. }
  563. .zt_btn{
  564. margin-top: 66rpx;
  565. }
  566. }
  567. }
  568. }
  569. </style>