createList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  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" @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" @close="teamUserShow=false"></cus-team-user>
  74. </view>
  75. </template>
  76. <script>
  77. import PageEmpty from '@/components/pageEmpty/index.vue'
  78. import CusTeamUser from '@/components/CusTeamUser/index.vue'
  79. import CusTeamInfoFill from '@/components/CusTeamInfoFill/index.vue'
  80. export default {
  81. components:{ PageEmpty, CusTeamUser, CusTeamInfoFill },
  82. props:{
  83. list:{
  84. typeof:Array,
  85. default:[]
  86. }
  87. },
  88. data(){
  89. return {
  90. show:false,
  91. teamInfoShow:false,
  92. teamUserShow:false,
  93. alertShow:false,
  94. dto:null,
  95. menuList:[
  96. {
  97. img:this.$imgBase+'questionnaire_edit.png',
  98. text:'编辑问卷'
  99. },
  100. {
  101. img:this.$imgBase+'questionnaire_share.png',
  102. text:'分享问卷'
  103. },
  104. {
  105. img:this.$imgBase+'questionnaire_info.png',
  106. text:'团队信息'
  107. },
  108. {
  109. img:this.$imgBase+'questionnaire_copy.png',
  110. text:'复制链接'
  111. },
  112. {
  113. img:this.$imgBase+'questionnaire_users.png',
  114. text:'团队人员'
  115. },
  116. {
  117. img:this.$imgBase+'questionnaire_report.png',
  118. text:'生成报告'
  119. },
  120. {
  121. img:this.$imgBase+'questionnaire_report.png',
  122. text:'发送报告'
  123. }
  124. ],
  125. menuListCopy:[],
  126. teamUserList:[
  127. // {
  128. // name:'张三',
  129. // email:'2233983769@qq.com',
  130. // type:1,
  131. // status:0
  132. // },
  133. // {
  134. // name:'李四',
  135. // email:'2233983769@qq.com',
  136. // type:2,
  137. // status:0
  138. // },
  139. // {
  140. // name:'王五',
  141. // email:'2233983769@qq.com',
  142. // type:3,
  143. // status:1
  144. // },
  145. // {
  146. // name:'赵六',
  147. // email:'2233983769@qq.com',
  148. // type:1,
  149. // status:1
  150. // }
  151. ],
  152. teamScaleData:[],
  153. teamLevelData:[],
  154. }
  155. },
  156. methods:{
  157. scrolltolower(){
  158. this.$emit('scrolltolower')
  159. },
  160. showDialog(item){
  161. this.dto = item;
  162. if(this.dto.type==1) this.menuListCopy = this.menuList.filter((_, index) => index !== 4);
  163. else this.menuListCopy = JSON.parse(JSON.stringify(this.menuList))
  164. this.show = true;
  165. },
  166. async getTeamScaleData(){
  167. return new Promise((resolve,reject)=>{
  168. this.$api.get('/getListByType/team_scale').then(({data:res})=>{
  169. if(res.code!==0) return this.$showToast(res.msg)
  170. this.teamScaleData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  171. resolve()
  172. })
  173. })
  174. },
  175. async getTeamHierarchyData(){
  176. return new Promise((resolve,reject)=>{
  177. this.$api.get('/getListByType/team_hierarchy').then(({data:res})=>{
  178. if(res.code!==0) return this.$showToast(res.msg)
  179. this.teamLevelData = res.data.map(d=>({name:d.dictLabel,id:d.dictValue}))
  180. resolve()
  181. })
  182. })
  183. },
  184. async handleMenuClick(item){
  185. if(item.text==='编辑问卷'){
  186. uni.navigateTo({
  187. url:`/pagesHome/questionnaireEdit?teamQuestionnaireId=${this.dto.teamQuestionnaireId}&type=${this.dto.type}&questionnaireName=${this.dto.title}`
  188. })
  189. }else if(item.text==='分享问卷'){
  190. }else if(item.text==='团队信息'){
  191. this.teamInfoShow = true;
  192. await this.getTeamScaleData()
  193. await this.getTeamHierarchyData()
  194. this.$api.get(`/core/user/team/${this.dto.teamId}`).then(({data:res})=>{
  195. if(res.code!==0) return this.$showToast(res.msg)
  196. this.$refs.teamRef.setTeamInfo(res.data)
  197. this.$refs.teamRef.teamInfo.functionIds = res.data.functions.map(f=>f.id);
  198. this.$refs.teamRef.teamInfo.orgIds = res.data.organizations.map(o=>o.id);
  199. this.$refs.teamRef.areaText = res.data.provinceName+res.data.cityName;
  200. this.$refs.teamRef.industryText = res.data.industryName;
  201. this.$refs.teamRef.functionTypeText = res.data.functions.map(f=>f.functionName).join('、');
  202. this.$refs.teamRef.architectureTypeText = res.data.organizations.map(f=>f.orgName).join('、');
  203. this.$refs.teamRef.teamScaleText = this.teamScaleData.find(d=>d.id==res.data.scale).name;
  204. this.$refs.teamRef.teamLevelText = this.teamLevelData.find(d=>d.id==res.data.hierarchy).name;
  205. })
  206. }
  207. else if(item.text==='复制链接') {
  208. this.$showToast('复制成功')
  209. }
  210. else if(item.text==='团队人员'){
  211. this.$api.get(`/core/member/listByQueTeamId/${this.dto.teamQuestionnaireId}`).then(({data:res})=>{
  212. if(res.code!==0) return this.$showToast(res.msg)
  213. this.teamUserShow = true
  214. })
  215. }
  216. else if(item.text==='生成报告'){
  217. if(this.dto.status==0) return this.$showToast('问卷未完成,全部团队人员作答后才能生成报告')
  218. }
  219. else if(item.text==='发送报告'){
  220. if(this.dto.status==0) return this.$showToast('请先生成报告后再进行发送报告')
  221. }
  222. },
  223. handleConfirm(data){
  224. data.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
  225. this.$api.put('/core/user/team',data).then(({data:res})=>{
  226. if(res.code!==0) return this.$showToast(res.msg)
  227. this.$showToast('保存成功')
  228. this.teamInfoShow = false;
  229. })
  230. },
  231. handleAnswer(item){
  232. uni.navigateTo({
  233. url:'/pagesPublish/questionnaireFill?teamQuestionnaireId='+item.teamQuestionnaireId+'&teamId='+item.teamId+'&type='+item.type
  234. })
  235. },
  236. createReport(item){
  237. },
  238. sendReport(item){
  239. },
  240. }
  241. }
  242. </script>
  243. <style scoped lang="scss">
  244. .qbox{
  245. width: 100%;
  246. height: 100%;
  247. flex: 1;
  248. .list{
  249. flex: 1;
  250. margin-top: 20rpx;
  251. overflow: hidden;
  252. &-item{
  253. width: 100%;
  254. background: #FFFFFF;
  255. border-radius: 24rpx;
  256. margin-top: 20rpx;
  257. padding: 36rpx 24rpx 19rpx;
  258. box-sizing: border-box;
  259. position: relative;
  260. display: block;
  261. .expand{
  262. width: 32rpx;
  263. height: 32rpx;
  264. position: absolute;
  265. top: 36rpx;
  266. right: 32rpx;
  267. }
  268. .title{
  269. width: calc(100% - 128rpx);
  270. font-family: PingFang-SC, PingFang-SC;
  271. font-weight: bold;
  272. font-size: 32rpx;
  273. color: #002846;
  274. line-height: 32rpx;
  275. }
  276. .name{
  277. font-family: PingFangSC, PingFang SC;
  278. font-weight: 400;
  279. font-size: 24rpx;
  280. color: #667E90;
  281. line-height: 24rpx;
  282. margin-top: 35rpx;
  283. }
  284. .progress{
  285. margin-top: 36rpx;
  286. &-left{
  287. width: calc(100% - 95rpx);
  288. &-text{
  289. font-family: PingFangSC, PingFang SC;
  290. font-weight: 400;
  291. font-size: 24rpx;
  292. color: #667E90;
  293. line-height: 24rpx;
  294. }
  295. &-box{
  296. flex: 1;
  297. position: relative;
  298. height: 12rpx;
  299. background: #F0F2F8;
  300. border-radius: 6rpx;
  301. &-current{
  302. height: 12rpx;
  303. background: #7CC5C5;
  304. border-radius: 6rpx;
  305. position: absolute;
  306. top: 0;
  307. left: 0;
  308. }
  309. }
  310. }
  311. &-right{
  312. font-size: 24rpx;
  313. line-height: 24rpx;
  314. color: #95A5B1;
  315. span{
  316. font-size: 24rpx;
  317. line-height: 24rpx;
  318. color: #002846;
  319. }
  320. }
  321. }
  322. .bottom{
  323. margin-top: 30rpx;
  324. border-top: 1rpx solid #EFEFEF;
  325. padding-top: 20rpx;
  326. &-left{
  327. font-family: PingFangSC, PingFang SC;
  328. font-weight: 400;
  329. font-size: 24rpx;
  330. color: #667E90;
  331. line-height: 24rpx;
  332. }
  333. &-right{
  334. border-radius: 32rpx;
  335. background: linear-gradient( 90deg, #33A7A7 0%, #4DB2B2 100%);
  336. padding: 19rpx 22rpx;
  337. font-family: PingFangSC, PingFang SC;
  338. font-weight: 400;
  339. font-size: 26rpx;
  340. color: #FFFFFF;
  341. line-height: 26rpx;
  342. letter-spacing: 2rpx;
  343. }
  344. }
  345. }
  346. }
  347. .empty{
  348. flex: 1;
  349. }
  350. .dialog{
  351. position: fixed;
  352. left: 0;
  353. right: 0;
  354. top: 0;
  355. bottom: 0;
  356. background: rgba(0, 0, 0, .4);
  357. z-index: 1001;
  358. justify-content: flex-end;
  359. .dbox{
  360. width: 100%;
  361. height: 738rpx;
  362. background: #FFFFFF;
  363. box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(0,0,0,0.07);
  364. border-radius: 24rpx 24rpx 0rpx 0rpx;
  365. padding: 48rpx 30rpx 0;
  366. box-sizing: border-box;
  367. &-top{
  368. &-title{
  369. width: calc(100% - 60rpx);
  370. font-family: PingFang-SC, PingFang-SC;
  371. font-weight: bold;
  372. font-size: 32rpx;
  373. color: #002846;
  374. line-height: 40rpx;
  375. }
  376. &-expand{
  377. width: 32rpx;
  378. height: 32rpx;
  379. transform: rotate(180deg);
  380. }
  381. }
  382. &-name{
  383. font-family: PingFangSC, PingFang SC;
  384. font-weight: 400;
  385. font-size: 24rpx;
  386. color: #667E90;
  387. line-height: 24rpx;
  388. margin-top: 24rpx;
  389. }
  390. &-progress{
  391. margin-top: 36rpx;
  392. &-left{
  393. width: calc(100% - 95rpx);
  394. &-text{
  395. font-family: PingFangSC, PingFang SC;
  396. font-weight: 400;
  397. font-size: 24rpx;
  398. color: #667E90;
  399. line-height: 24rpx;
  400. }
  401. &-box{
  402. flex: 1;
  403. position: relative;
  404. height: 12rpx;
  405. background: #F0F2F8;
  406. border-radius: 6rpx;
  407. &-current{
  408. height: 12rpx;
  409. background: #7CC5C5;
  410. border-radius: 6rpx;
  411. position: absolute;
  412. top: 0;
  413. left: 0;
  414. }
  415. }
  416. }
  417. &-right{
  418. font-size: 24rpx;
  419. line-height: 24rpx;
  420. color: #95A5B1;
  421. span{
  422. font-size: 24rpx;
  423. line-height: 24rpx;
  424. color: #002846;
  425. }
  426. }
  427. }
  428. &-menu{
  429. margin-top: 43rpx;
  430. overflow: hidden;
  431. margin-left: -30rpx;
  432. &-pre{
  433. width: calc(25% - 30rpx);
  434. background: #F7F8FA;
  435. border-radius: 24rpx;
  436. padding: 30rpx 20rpx;
  437. margin-top: 24rpx;
  438. margin-left: 30rpx;
  439. box-sizing: border-box;
  440. float: left;
  441. image{
  442. width: 42rpx;
  443. height: 42rpx;
  444. }
  445. text{
  446. font-family: PingFangSC, PingFang SC;
  447. font-weight: 400;
  448. font-size: 24rpx;
  449. color: #002846;
  450. line-height: 24rpx;
  451. text-align: center;
  452. margin-top: 24rpx;
  453. }
  454. }
  455. }
  456. }
  457. &-box{
  458. width: 100%;
  459. height: 1200rpx;
  460. background: #F7F7F7;
  461. padding-top: 38rpx;
  462. border-radius: 24rpx 24rpx 0rpx 0rpx;
  463. box-sizing: border-box;
  464. position: relative;
  465. overflow-y: auto;
  466. &-title{
  467. font-family: PingFang-SC, PingFang-SC;
  468. font-weight: bold;
  469. font-size: 32rpx;
  470. color: #002846;
  471. line-height: 32rpx;
  472. text-align: center;
  473. }
  474. &-close{
  475. width: 48rpx;
  476. height: 48rpx;
  477. position: absolute;
  478. top: 30rpx;
  479. right: 30rpx;
  480. }
  481. &-teaminfo{
  482. margin-top: 40rpx;
  483. }
  484. }
  485. }
  486. .alert{
  487. position: fixed;
  488. left: 0;
  489. right: 0;
  490. top: 0;
  491. bottom: 0;
  492. z-index: 1002;
  493. background: rgba(0, 0, 0, .4);
  494. &-box{
  495. width: calc(100% - 100rpx);
  496. padding: 54rpx 99rpx 48rpx;
  497. box-sizing: border-box;
  498. position: relative;
  499. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/alert_bg.png') no-repeat;
  500. background-size: 100% 100%;
  501. &-title{
  502. font-family: PingFang-SC, PingFang-SC;
  503. font-weight: bold;
  504. font-size: 36rpx;
  505. color: #002846;
  506. line-height: 56rpx;
  507. text-align: center;
  508. }
  509. &-close{
  510. width: 48rpx;
  511. height: 48rpx;
  512. position: absolute;
  513. top: 40rpx;
  514. right: 30rpx;
  515. }
  516. &-text{
  517. font-family: PingFangSC, PingFang SC;
  518. font-weight: 400;
  519. font-size: 30rpx;
  520. color: #002846;
  521. line-height: 48rpx;
  522. text-align: center;
  523. margin-top: 32rpx;
  524. }
  525. .zt_btn{
  526. margin-top: 66rpx;
  527. }
  528. }
  529. }
  530. }
  531. </style>