meetadd.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <view>
  3. <view class="navbox">
  4. <uni-nav-bar color="#ffffff" left-icon="left" title="会议预订" :background-color="backgroundColor"
  5. :border="false" statusBar='true' fixed="true" @clickLeft='getBack'>
  6. </uni-nav-bar>
  7. </view>
  8. <image :src="navbg" class="navbg"></image>
  9. <view class="zxmain" :style="'margin-top:-'+marTop+'rpx;'">
  10. <view class="ytbox">
  11. <uni-forms ref="form" class="ytforms" :rules="rules" :modelValue="datainfo">
  12. <!-- 预定会议室 -->
  13. <view v-show="stepval==1">
  14. <view class="ytsbox">
  15. <view class="yttit">选择会议室</view>
  16. <view class="mb12" v-for="(ite,idx) in hyslist" :key="ite.conferenceRoomId">
  17. <view class="mlists" :class="meetid==ite.conferenceRoomId?'act':''" @click="getMeetId(ite)">
  18. <!-- 会议图片 -->
  19. <view class="banbox mb12" v-if="ite.conferenceRoomUrl&&meetid==ite.conferenceRoomId" @click.stop="getStop">
  20. <hys-banner :bannerlist="ite.conferenceRoomUrl"></hys-banner>
  21. </view>
  22. <view class="flexc" >
  23. <view class="mtit">{{ite.conferenceRoomName}}</view>
  24. <view class="mtxt bga" v-if="ite.type=='N'"><text class="cir"></text>当前空闲</view>
  25. <view class="mtxt bgb" v-if="ite.type=='Y'"><text class="cir"></text>当前占用</view>
  26. </view>
  27. </view>
  28. <!--已经预约的时间段 -->
  29. <view class="tlist" v-show="meetid==ite.conferenceRoomId">
  30. <view class="ttips flexc">
  31. <image :src="tipimg"></image>已被预约时段
  32. </view>
  33. <block v-if="ite.conferenceRoomOrderList&&ite.conferenceRoomOrderList.length">
  34. <view class="ttime flexc" v-for="(tite,tidx) in ite.conferenceRoomOrderList" :key="tite.conferenceRoomOrderId">
  35. <view class="cir"></view>
  36. {{tite.startTime}} 至 {{tite.endTime}}
  37. </view>
  38. </block>
  39. <view v-else class="ttime">当前会议室空闲,无预约记录</view>
  40. </view>
  41. </view>
  42. <view class="ybtn flexcc" @click="getNextFn">下一步</view>
  43. <view class="tips">* 为避免您的重复操作,请避开会议室已被预约时段</view>
  44. </view>
  45. </view>
  46. <view v-show="stepval==2">
  47. <view class="ytsbox">
  48. <view class="yttit">填写预订信息</view>
  49. <view class="pt5">
  50. <uni-forms-item label="预定人员" class="disable" name="visitName">
  51. <view class="intit">{{datainfo.orderUser}}</view>
  52. </uni-forms-item>
  53. <uni-forms-item label="会议名称" name="conferenceName">
  54. <uni-easyinput :inputBorder="false" type="textarea" autoHeight v-model="datainfo.conferenceName"
  55. placeholder="输入会议名称">
  56. </uni-easyinput>
  57. </uni-forms-item>
  58. <uni-forms-item label="开始时间" name="startTime">
  59. <uni-datetime-picker v-model="datainfo.startTime" @change="getChangeaFn">
  60. <view class="pickbox flexc">
  61. <view :class="datainfo.startTime?'txr flex1':'coa txr flex1'">{{datainfo.startTime || "请选择开始时间"}}</view>
  62. <image :src="hupimg" class="hupimg"></image>
  63. </view>
  64. </uni-datetime-picker>
  65. </uni-forms-item>
  66. <uni-forms-item label="结束时间" name="endTime">
  67. <uni-datetime-picker v-model="datainfo.endTime" @change="getChangebFn" :start="datainfo.startTime">
  68. <view class="pickbox flexc">
  69. <view :class="datainfo.endTime?'txr flex1':'coa txr flex1'">{{datainfo.endTime || "请选择结束时间"}}</view>
  70. <image :src="hupimg" class="hupimg"></image>
  71. </view>
  72. </uni-datetime-picker>
  73. </uni-forms-item>
  74. <uni-forms-item label="参会人数" name="conferenceNumber">
  75. <uni-easyinput :inputBorder="false" v-model="datainfo.conferenceNumber"
  76. type="number"
  77. placeholder="输入参会人数">
  78. </uni-easyinput>
  79. </uni-forms-item>
  80. <view class="textarea">
  81. <uni-easyinput :inputBorder="false" type="textarea" autoHeight v-model="datainfo.remark"
  82. placeholder="请输入会议要求…">
  83. </uni-easyinput>
  84. </view>
  85. <view class="chose" @click="getCkFn">
  86. <image :src="choseimg" v-if="datainfo.useXk=='Y'"></image>
  87. <image :src="nchoseimg" v-else></image>
  88. 需要准备席卡
  89. </view>
  90. <!-- <uni-forms-item label="会议室" name="appointmentSite">
  91. <view class="flex1">
  92. <w-select
  93. :list='hyslist'
  94. v-model="chooseValue"
  95. valueName='conferenceRoomName'
  96. keyName="conferenceRoomId"
  97. :filterable='filterable'
  98. width='100%'
  99. height="36px"
  100. @change='getchangeb'
  101. >
  102. </w-select>
  103. </view>
  104. </uni-forms-item> -->
  105. </view>
  106. <view class="flexc">
  107. <view class="ybtn flexcc ybga mr20" @click="getPreFn">上一步</view>
  108. <view class="ybtn flexcc" @click="getSubmit">确认提交</view>
  109. </view>
  110. <view class="tips">* 为避免您的重复操作,请先仔细查看已预约时段。</view>
  111. </view>
  112. </view>
  113. </uni-forms>
  114. </view>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  120. import {getRoomNoList,getRoomyyAdd,getRoomyyPut,getRoomyyDetail,getRoomtimeNoList} from "@/api/mine/work.js"
  121. import {getDictionaryFn} from "@/api/mine/register.js"
  122. import wSelect from "@/work/components/w-select/w-select.vue"
  123. import hysBanner from "@/work/components/yuyue/hysbanner.vue"
  124. export default {
  125. components: {wSelect,hysBanner},
  126. data() {
  127. return {
  128. hupimg:require("@/static/images/order/hup.png"),
  129. navbg:require("@/static/images/navbg.png"),
  130. tipimg:require("@/work/static/yuy/tips.png"),
  131. choseimg:require("@/work/static/yuy/chose.png"),
  132. nchoseimg:require("@/work/static/yuy/nchose.png"),
  133. backgroundColor: "transparent",
  134. nvaHeight: 44,
  135. marTop: 0, //距离顶部的距离
  136. stubarHeight: 0, //
  137. datainfo:{
  138. "conferenceRoomId": "",//会议室ID
  139. "conferenceRoomName": "",//会议室名称
  140. "conferenceRoomAddress": "",//会议室地址
  141. "orderUser": "",//会议室预约人员名称
  142. "orderUserId": "",//会议室预约人员id(用户id)
  143. "conferenceName": "",//会议名称
  144. "conferenceNumber": "",//会议室人数
  145. "startTime": "",//会议开始时间
  146. "endTime": "",//会议结束时间
  147. 'useXk':'N',//是否需要席卡 N:不需要 Y:需要
  148. 'remark':'',//说明
  149. },
  150. rules: {
  151. startTime: {rules: [{required: true,errorMessage: '请选择开始时间',}]},
  152. endTime: {rules: [{required: true,errorMessage: '请选择结束时间' } ]},
  153. conferenceRoomName: {rules: [{required: true,errorMessage: '请选择会议室'} ]},
  154. conferenceName: {rules: [{required: true,errorMessage: '请输入会议名称'} ]},
  155. conferenceNumber: {rules: [{required: true,errorMessage: '请输入会议人数'} ]},
  156. },
  157. meetid:0,
  158. hys:'',
  159. hysidx:'',
  160. hyslist:[],
  161. ptype:'add',
  162. stepval:1,//
  163. id:'',
  164. filterable:true,
  165. chooseValue:'',
  166. name:this.$store.state.user.name,
  167. userId:this.$store.state.user.userId,
  168. bannerlist:[]
  169. }
  170. },
  171. onPageScroll(e) {
  172. var scrollTop = Number(e.scrollTop);
  173. if (scrollTop > 0) {
  174. this.backgroundColor = '#0491FD'
  175. } else {
  176. this.backgroundColor = 'transparent'
  177. }
  178. },
  179. onLoad: function(e) {
  180. if(e.data){
  181. var data=JSON.parse(decodeURIComponent(e.data))
  182. if(data.type){
  183. this.ptype=data.type;
  184. this.id=data.id;
  185. this.getDetail()
  186. }
  187. }else{
  188. this.datainfo.orderUser=this.name;
  189. this.datainfo.orderUserId=this.userId;
  190. }
  191. // this.init()
  192. this.getRoomNoList()
  193. uni.getSystemInfo({
  194. success: (e) => {
  195. this.stubarHeight = Number(e.statusBarHeight);
  196. this.nvaHeight = Number(e.statusBarHeight) + 44;
  197. this.tabscheight = Number(this.nvaHeight) * 2 + 100;
  198. }
  199. })
  200. },
  201. onShow() {},
  202. mounted() {
  203. this.getHeightFn()
  204. },
  205. methods: {
  206. checkPermi,
  207. checkRole,
  208. getBack() {
  209. uni.navigateBack({
  210. delta: 1
  211. })
  212. },
  213. getStop(){
  214. },
  215. bindTimeChangea(e){
  216. var val=e.detail.value;
  217. // this.day=val
  218. },
  219. getHeightFn() {
  220. let query = uni.createSelectorQuery().in(this);
  221. //需要给黄色区域设置一个id标识,在这里是demo
  222. query.select('.navbox').boundingClientRect(data => {
  223. var top = data.top < 0 ? -data.top : data.top;
  224. var stubarHeight = Number(this.stubarHeight);
  225. this.marTop = stubarHeight > 0 ? 692 - Number(data.height) * 2 : 692 - Number(data.height) *
  226. 2 + 40 //赋值,待会要用
  227. if (top <= this.nvaHeight) {
  228. const opacity = top / 100 // 计算透明度值
  229. const color = `rgba(4, 145, 253, ${opacity})`
  230. this.backgroundColor = color // 更新盒子背景颜色
  231. } else {
  232. this.backgroundColor = '#00A9F0'
  233. }
  234. }).exec();
  235. },
  236. init() {
  237. // 门卫
  238. // getDictionaryFn('is_read').then(res=>{
  239. // if(res.code==200){
  240. // this.ydztlist = res.data.map(v => {
  241. // return {
  242. // label: v.dictLabel,
  243. // value: v.dictValue
  244. // }
  245. // })
  246. // }
  247. // })
  248. },
  249. statusFormat(ite,list,type) {
  250. var aite=selectValueKey(list, ite);
  251. if(type=='hys'){
  252. this.hysidx=aite.key
  253. }
  254. return aite.actions;
  255. },
  256. getChangeaFn(e){
  257. this.datainfo.startTime=e
  258. var endTime=this.datainfo.endTime;
  259. if(endTime){
  260. var startime=new Date(e).getTime()
  261. var endtime=new Date(endTime).getTime()
  262. if(startime>endtime){
  263. this.$toast('开始时间大于开始时间')
  264. this.datainfo.endTime=''
  265. }
  266. }
  267. },
  268. getChangebFn(e){
  269. var that=this;
  270. var startt=this.datainfo.startTime;
  271. if(!startt){
  272. this.$toast('请选择开始时间')
  273. setTimeout(function(){
  274. that.datainfo.endTime='';
  275. },200)
  276. return
  277. }
  278. var startime=new Date(startt).getTime()
  279. var endtime=new Date(e).getTime()
  280. if(startime>endtime){
  281. setTimeout(function(){
  282. that.datainfo.endTime='';
  283. },200)
  284. this.$toast('请选择时间大于开始时间')
  285. return
  286. }
  287. this.datainfo.endTime=e
  288. },
  289. getMeetId(ite){
  290. var id=ite.conferenceRoomId;
  291. var name=ite.conferenceRoomName;
  292. var adress=ite.conferenceRoomAddress
  293. this.meetid=id;
  294. this.datainfo.conferenceRoomId=id;
  295. this.datainfo.conferenceRoomName=name;
  296. this.datainfo.conferenceRoomAddress=adress;
  297. },
  298. getCkFn(){
  299. var useXk=this.datainfo.useXk;
  300. if(useXk=='Y'){
  301. this.datainfo.useXk='N'
  302. }else{
  303. this.datainfo.useXk='Y'
  304. }
  305. },
  306. getPreFn(){
  307. uni.pageScrollTo({
  308. scrollTop: 0,
  309. duration: 0
  310. })
  311. this.stepval=Number(this.stepval)-1
  312. },
  313. getNextFn(){
  314. if(!this.datainfo.conferenceRoomId){
  315. this.$toast("请选择会议室")
  316. return
  317. }
  318. uni.pageScrollTo({
  319. scrollTop: 0,
  320. duration: 0
  321. })
  322. this.stepval=Number(this.stepval)+1
  323. },
  324. getSubmit(){
  325. var that=this;
  326. this.$refs.form.validate().then(res => {
  327. var params = JSON.parse(JSON.stringify(this.datainfo))
  328. if(this.ptype=='add'){
  329. getRoomyyAdd(params).then(res => {
  330. if (res.code == 200) {
  331. this.$toast("新增成功")
  332. uni.$emit('refreshmeetlist')
  333. setTimeout(function(){
  334. uni.navigateBack({
  335. delta:1
  336. })
  337. },1200)
  338. } else {
  339. this.$toast(res.msg)
  340. }
  341. })
  342. }else{
  343. getRoomyyPut(params).then(res => {
  344. if (res.code == 200) {
  345. this.$toast("修改成功")
  346. uni.$emit('refreshmeetlist')
  347. setTimeout(function(){
  348. uni.navigateBack({
  349. delta:1
  350. })
  351. },1200)
  352. } else {
  353. this.$toast(res.msg)
  354. }
  355. })
  356. }
  357. })
  358. },
  359. getchangeb(e){
  360. this.datainfo.conferenceRoomId=e.conferenceRoomId;
  361. this.datainfo.conferenceRoomName=e.conferenceRoomName;
  362. this.datainfo.conferenceRoomAddress=e.conferenceRoomAddress;
  363. },
  364. getRoomNoList() {
  365. getRoomNoList().then(res => {
  366. if (res.code == 200) {
  367. var newArr=res.rows;
  368. newArr.forEach(ite=>{
  369. if(ite.conferenceRoomUrl){
  370. ite.conferenceRoomUrl=ite.conferenceRoomUrl.split(',')
  371. }
  372. })
  373. this.hyslist=newArr
  374. } else {
  375. this.$toast(res.msg)
  376. }
  377. })
  378. },
  379. getDetail(){
  380. getRoomyyDetail(this.id).then(res=>{
  381. if(res.code==200){
  382. this.datainfo=res.data;
  383. this.meetid=res.data.conferenceRoomId;
  384. // this.chooseValue=res.data.conferenceRoomId
  385. }
  386. })
  387. }
  388. },
  389. }
  390. </script>
  391. <style>
  392. /* page {
  393. background: #ffffff;
  394. } */
  395. </style>
  396. <style lang="scss" scoped>
  397. .ytbox /deep/ .uni-forms .uni-forms-item{padding: 10rpx 26rpx 10rpx;border: 2rpx solid #0391FD;margin-bottom: 24rpx;border-radius: 12rpx;min-height: 90rpx;}
  398. .ytbox /deep/ .uni-forms-item__label{flex: 0 0 auto;width: 144rpx !important;font-size: 28rpx;font-weight: bold;position: relative;color: #161616;text-align-last: justify;height: 66rpx;}
  399. .ytbox /deep/ .uni-forms-item__label text{flex: 1;}
  400. .ytbox /deep/ .uni-forms-item__label .is-required{position: absolute;right: 0;color: #F10C31;margin-top: 16rpx;}
  401. .ytbox /deep/ uni-textarea{flex: 1;width: auto;text-align: right;}
  402. .ytbox .textarea /deep/ uni-textarea{flex: 1;width: auto;text-align: left;padding: 26rpx;font-size: 28rpx;min-height: 192rpx;box-sizing: border-box;border-radius: 3px;
  403. border: 2rpx solid #0391FD;margin: 0;}
  404. .ytbox /deep/ .uni-textarea-placeholder{font-size: 28rpx;color: #aaaaaa !important;}
  405. .ytbox /deep/ .uni-easyinput__placeholder-class{font-size: 28rpx;color: #aaaaaa;}
  406. .ytbox /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  407. .ytbox /deep/ .uni-easyinput{flex: 1;text-align: right;}
  408. .ytbox /deep/ .uni-easyinput__content-input{font-size: 28rpx;}
  409. .ytbox /deep/ .uni-forms-item__error{margin-top:0rpx;left: auto;right: 0;}
  410. .ytbox /deep/ .uni-easyinput__content-textarea{min-height: 42rpx;}
  411. .disable{background: #EFF0F2;border: none !important;}
  412. .ytbox{width: 684rpx;margin: 0 auto;padding-top: 24rpx;position: relative;flex: 1;overflow: auto;background-color: #ffffff;padding-bottom: 4rpx;border-radius: 14rpx;}
  413. .ytforms{
  414. .yttit{font-size: 28rpx;font-weight: bold;margin-bottom: 56rpx;
  415. color: #161616;display: flex;align-items: center;padding: 0rpx 26rpx;box-sizing: border-box;position: relative;
  416. &::before{content: '';width: 6rpx;height: 34rpx;background: $com-cd3;border-radius: 4rpx;position: absolute;top: 50%;transform: translateY(-50%);left: 0rpx;}
  417. }
  418. .ytsbox{background-color: #ffffff;padding: 32rpx 28rpx 0;border-radius: 14rpx;margin-bottom: 24rpx;
  419. .intit{font-weight: 500;flex: 1;font-size: 26rpx;text-align: right;color: #666666;}
  420. .pickbox{flex: 1;text-align: right;font-weight: 500;font-size: 28rpx;color: #161616;
  421. .hupimg{width: 18rpx;height: 14rpx;margin-left: 12rpx;flex: 0 0 auto;}
  422. }
  423. .chose{display: flex;align-items: center;font-weight: 500;font-size: 28rpx;color: #161616;margin-top: 34rpx;
  424. image{width: 26rpx;height: 24rpx;margin-right: 18rpx;flex: 0 0 auto;}
  425. }
  426. }
  427. }
  428. // 按钮
  429. .ybtn{width: 100%;height: 90rpx;background: $com-cd3;border-radius: 14rpx;margin: 100rpx auto 0;font-size: 28rpx;font-weight: 500;color: #FFFFFF;
  430. &.btn1{background-color: #9a9c9e;}
  431. &.ybga{background-color: #e6efff;color:#0391fd ;}
  432. }
  433. .tips{font-weight: bold;margin-top: 28rpx;
  434. font-size: 22rpx;line-height: 34rpx;
  435. color: #FF0000;}
  436. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  437. .navbg{width: 100%;height: 692rpx;}
  438. .zxmain{position: relative;padding: 20rpx 32rpx 40rpx;box-sizing: border-box;display: flex;
  439. min-height: calc(100vh - 44px);
  440. }
  441. // 会议室列表
  442. .mlists{border-radius: 6rpx;border: 2rpx solid #C1C1C1;min-height: 90rpx;box-sizing: border-box;
  443. padding: 24rpx 26rpx;
  444. &.act{border: 2rpx solid #0391FD;
  445. .mtit{font-weight: bold;color: #0391FD;}
  446. }
  447. .mtit{font-weight: 500;font-size: 28rpx;color: #161616;flex: 1;margin-right: 16rpx;}
  448. .mtxt{font-weight: 500;font-size: 26rpx;flex: 0 0 auto;
  449. &.bga{color: #0AC86E;
  450. .cir{background: #0AC86E;}
  451. }
  452. &.bgb{color: #FF6969;
  453. .cir{background: #FF6969;}
  454. }
  455. .cir{width: 12rpx;height: 12rpx;margin-right: 16rpx;border-radius: 50%;display: inline-block;}
  456. }
  457. }
  458. .tlist{padding-top: 30rpx;
  459. .ttips{font-weight: bold;font-size: 28rpx;color: #161616;
  460. image{width: 26rpx;height: 28rpx;margin-right: 16rpx;flex: 0 0 auto;}
  461. }
  462. // padding: 24rpx 0 36rpx 38rpx;
  463. .ttime{font-weight: 500;font-size: 26rpx;color: #161616;padding-left: 38rpx;padding-top: 24rpx;margin-bottom: 8rpx;
  464. &:last-child{margin-bottom: 0;}
  465. .cir{width: 12rpx;height: 12rpx;background: #FFB132;border-radius: 50%;flex: 0 0 auto;margin-right: 22rpx;
  466. }
  467. }
  468. }
  469. </style>