meeting.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. <view class="ytsbox">
  13. <view class="yttit">预订信息</view>
  14. <view class="pt5">
  15. <uni-forms-item label="预定人员" class="disable" name="visitName">
  16. <view class="intit">{{datainfo.orderUser}}</view>
  17. </uni-forms-item>
  18. <uni-forms-item label="开始时间" name="startTime">
  19. <uni-datetime-picker v-model="datainfo.startTime">
  20. <view class="pickbox flexc">
  21. <view :class="datainfo.startTime?'txr flex1':'coa txr flex1'">{{datainfo.startTime || "请选择开始时间"}}</view>
  22. <image :src="hupimg" class="hupimg"></image>
  23. </view>
  24. </uni-datetime-picker>
  25. </uni-forms-item>
  26. <uni-forms-item label="结束时间" name="endTime">
  27. <uni-datetime-picker v-model="datainfo.endTime">
  28. <view class="pickbox flexc">
  29. <view :class="datainfo.endTime?'txr flex1':'coa txr flex1'">{{datainfo.endTime || "请选择结束时间"}}</view>
  30. <image :src="hupimg" class="hupimg"></image>
  31. </view>
  32. </uni-datetime-picker>
  33. </uni-forms-item>
  34. <uni-forms-item label="会议室" name="appointmentSite">
  35. <w-select
  36. :list='hyslist'
  37. v-model="chooseValue"
  38. valueName='conferenceRoomName'
  39. keyName="conferenceRoomId"
  40. :filterable='filterable'
  41. width='100%'
  42. height="36px"
  43. @change='getchangeb'
  44. >
  45. </w-select>
  46. <!-- <picker class="pickbox" range-key='dictLabel' :value="hysidx"
  47. :range="hyslist" @change="bindTimeChangea">
  48. <view class="flexc flex1">
  49. <view class="flex1 f14" v-if="datainfo.conferenceRoomName&&!hys">{{statusFormat(datainfo.conferenceRoomName,hyslist,'hys')}}</view>
  50. <view class="flex1 f14" v-else :class="hys?'':'coa'">{{hys||"请选择会议室"}}</view>
  51. <image :src="hupimg" class="hupimg"></image>
  52. </view>
  53. </picker> -->
  54. </uni-forms-item>
  55. <uni-forms-item label="会议名称" name="conferenceName">
  56. <uni-easyinput :inputBorder="false" type="textarea" autoHeight v-model="datainfo.conferenceName"
  57. placeholder="输入会议名称">
  58. </uni-easyinput>
  59. </uni-forms-item>
  60. <uni-forms-item label="参会人数" name="conferenceNumber">
  61. <uni-easyinput :inputBorder="false" v-model="datainfo.conferenceNumber"
  62. placeholder="输入参会人数">
  63. </uni-easyinput>
  64. </uni-forms-item>
  65. </view>
  66. <view class="ybtn flexcc" @click="getSubmit">确认提交</view>
  67. <view class="tips">* 为避免重复操作,请先选择时间查看当前会议室是否被占用。</view>
  68. </view>
  69. </uni-forms>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  76. import {getRoomNoList,getRoomyyAdd,getRoomyyPut,getRoomyyDetail} from "@/api/mine/work.js"
  77. import {getDictionaryFn} from "@/api/mine/register.js"
  78. import wSelect from "@/work/components/w-select/w-select.vue"
  79. export default {
  80. components: {wSelect},
  81. data() {
  82. return {
  83. hupimg:require("@/static/images/order/hup.png"),
  84. navbg:require("@/static/images/navbg.png"),
  85. backgroundColor: "transparent",
  86. nvaHeight: 44,
  87. marTop: 0, //距离顶部的距离
  88. stubarHeight: 0, //
  89. datainfo:{
  90. "conferenceRoomId": "",//会议室ID
  91. "conferenceRoomName": "",//会议室名称
  92. "conferenceRoomAddress": "",//会议室地址
  93. "orderUser": "",//会议室预约人员名称
  94. "orderUserId": "",//会议室预约人员id(用户id)
  95. "conferenceName": "",//会议名称
  96. "conferenceNumber": "",//会议室人数
  97. "startTime": "",//会议开始时间
  98. "endTime": "",//会议结束时间
  99. },
  100. rules: {
  101. startTime: {rules: [{required: true,errorMessage: '请选择开始时间',}]},
  102. endTime: {rules: [{required: true,errorMessage: '请选择结束时间' } ]},
  103. conferenceRoomName: {rules: [{required: true,errorMessage: '请选择会议室'} ]},
  104. conferenceName: {rules: [{required: true,errorMessage: '请输入会议名称'} ]},
  105. conferenceNumber: {rules: [{required: true,errorMessage: '请输入会议人数'} ]},
  106. },
  107. hys:'',
  108. hysidx:'',
  109. hyslist:[],
  110. ptype:'add',
  111. id:'',
  112. filterable:true,
  113. chooseValue:'',
  114. name:this.$store.state.user.name,
  115. userId:this.$store.state.user.userId,
  116. }
  117. },
  118. onPageScroll(e) {
  119. var scrollTop = Number(e.scrollTop);
  120. if (scrollTop > 0) {
  121. this.backgroundColor = '#0491FD'
  122. } else {
  123. this.backgroundColor = 'transparent'
  124. }
  125. },
  126. onLoad: function(e) {
  127. if(e.data){
  128. var data=JSON.parse(decodeURIComponent(e.data))
  129. if(data.type){
  130. this.ptype=data.type;
  131. this.id=data.id;
  132. this.getDetail()
  133. }
  134. }else{
  135. this.datainfo.orderUser=this.name;
  136. this.datainfo.orderUserId=this.userId;
  137. }
  138. // this.init()
  139. this.getRoomNoList()
  140. uni.getSystemInfo({
  141. success: (e) => {
  142. this.stubarHeight = Number(e.statusBarHeight);
  143. this.nvaHeight = Number(e.statusBarHeight) + 44;
  144. this.tabscheight = Number(this.nvaHeight) * 2 + 100;
  145. }
  146. })
  147. },
  148. onUnload() {
  149. uni.$off('refreshdatalist')
  150. },
  151. onShow() {},
  152. mounted() {
  153. this.getHeightFn()
  154. },
  155. methods: {
  156. checkPermi,
  157. checkRole,
  158. getBack() {
  159. uni.navigateBack({
  160. delta: 1
  161. })
  162. },
  163. bindTimeChangea(e){
  164. var val=e.detail.value;
  165. // this.day=val
  166. },
  167. getHeightFn() {
  168. let query = uni.createSelectorQuery().in(this);
  169. //需要给黄色区域设置一个id标识,在这里是demo
  170. query.select('.navbox').boundingClientRect(data => {
  171. var top = data.top < 0 ? -data.top : data.top;
  172. var stubarHeight = Number(this.stubarHeight);
  173. this.marTop = stubarHeight > 0 ? 692 - Number(data.height) * 2 : 692 - Number(data.height) *
  174. 2 + 40 //赋值,待会要用
  175. if (top <= this.nvaHeight) {
  176. const opacity = top / 100 // 计算透明度值
  177. const color = `rgba(4, 145, 253, ${opacity})`
  178. this.backgroundColor = color // 更新盒子背景颜色
  179. } else {
  180. this.backgroundColor = '#00A9F0'
  181. }
  182. }).exec();
  183. },
  184. init() {
  185. // 门卫
  186. // getDictionaryFn('is_read').then(res=>{
  187. // if(res.code==200){
  188. // this.ydztlist = res.data.map(v => {
  189. // return {
  190. // label: v.dictLabel,
  191. // value: v.dictValue
  192. // }
  193. // })
  194. // }
  195. // })
  196. },
  197. statusFormat(ite,list,type) {
  198. var aite=selectValueKey(list, ite);
  199. if(type=='hys'){
  200. this.hysidx=aite.key
  201. }
  202. return aite.actions;
  203. },
  204. getSubmit(){
  205. var that=this;
  206. this.$refs.form.validate().then(res => {
  207. var params = JSON.parse(JSON.stringify(this.datainfo))
  208. if(!params.conferenceRoomName){
  209. this.$toast("请选择会议室")
  210. return
  211. }
  212. var regex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
  213. var s=regex.test(params.startTime);
  214. var e=regex.test(params.endTime);
  215. if(!s){
  216. that.$toast("请选择完整的开始时间")
  217. return
  218. }
  219. if(!e){
  220. that.$toast("请选择完整的结束时间")
  221. return
  222. }
  223. if(this.ptype=='add'){
  224. getRoomyyAdd(params).then(res => {
  225. if (res.code == 200) {
  226. this.$toast("新增成功")
  227. uni.$emit('refreshmeetlist')
  228. setTimeout(function(){
  229. uni.navigateBack({
  230. delta:1
  231. })
  232. },1200)
  233. } else {
  234. this.$toast(res.msg)
  235. }
  236. })
  237. }else{
  238. getRoomyyPut(params).then(res => {
  239. if (res.code == 200) {
  240. this.$toast("修改成功")
  241. uni.$emit('refreshmeetlist')
  242. setTimeout(function(){
  243. uni.navigateBack({
  244. delta:1
  245. })
  246. },1200)
  247. } else {
  248. this.$toast(res.msg)
  249. }
  250. })
  251. }
  252. })
  253. },
  254. getchangeb(e){
  255. this.datainfo.conferenceRoomId=e.conferenceRoomId;
  256. this.datainfo.conferenceRoomName=e.conferenceRoomName;
  257. this.datainfo.conferenceRoomAddress=e.conferenceRoomAddress;
  258. },
  259. getRoomNoList() {
  260. getRoomNoList().then(res => {
  261. if (res.code == 200) {
  262. this.hyslist=res.rows
  263. } else {
  264. this.$toast(res.msg)
  265. }
  266. })
  267. },
  268. getDetail(){
  269. getRoomyyDetail(this.id).then(res=>{
  270. if(res.code==200){
  271. this.datainfo=res.data;
  272. this.chooseValue=res.data.conferenceRoomId
  273. }
  274. })
  275. }
  276. },
  277. }
  278. </script>
  279. <style>
  280. /* page {
  281. background: #ffffff;
  282. } */
  283. </style>
  284. <style lang="scss" scoped>
  285. .ytbox /deep/ .uni-forms .uni-forms-item{padding: 10rpx 26rpx 10rpx;border: 2rpx solid #0391FD;margin-bottom: 24rpx;border-radius: 12rpx;}
  286. .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;}
  287. .ytbox /deep/ .uni-forms-item__label text{flex: 1;}
  288. .ytbox /deep/ .uni-forms-item__label .is-required{position: absolute;right: 0;color: #F10C31;margin-top: 16rpx;}
  289. .ytbox /deep/ uni-textarea{flex: 1;width: auto;text-align: right;}
  290. .ytbox /deep/ .uni-textarea-placeholder{font-size: 28rpx;color: #aaaaaa !important;}
  291. .ytbox /deep/ .uni-easyinput__placeholder-class{font-size: 28rpx;color: #aaaaaa;}
  292. .ytbox /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  293. .ytbox /deep/ .uni-easyinput{flex: 1;text-align: right;}
  294. .ytbox /deep/ .uni-easyinput__content-input{font-size: 28rpx;}
  295. .ytbox /deep/ .uni-forms-item__error{margin-top:0rpx;left: auto;right: 0;}
  296. .ytbox /deep/ .uni-easyinput__content-textarea{min-height: 48rpx;}
  297. .disable{background: #EFF0F2;border: none !important;}
  298. .ytbox{width: 684rpx;margin: 0 auto;padding-top: 24rpx;position: relative;flex: 1;overflow: auto;background-color: #ffffff;padding-bottom: 4rpx;border-radius: 14rpx;}
  299. .ytforms{
  300. .yttit{font-size: 28rpx;font-weight: bold;margin-bottom: 56rpx;
  301. color: #161616;display: flex;align-items: center;padding: 0rpx 26rpx;box-sizing: border-box;position: relative;
  302. &::before{content: '';width: 6rpx;height: 34rpx;background: $com-cd3;border-radius: 4rpx;position: absolute;top: 50%;transform: translateY(-50%);left: 0rpx;}
  303. }
  304. .ytsbox{background-color: #ffffff;padding: 32rpx 28rpx 0;border-radius: 14rpx;margin-bottom: 24rpx;
  305. .intit{font-weight: 500;flex: 1;font-size: 26rpx;text-align: right;color: #666666;}
  306. .pickbox{flex: 1;text-align: right;font-weight: 500;font-size: 28rpx;color: #161616;
  307. .hupimg{width: 18rpx;height: 14rpx;margin-left: 12rpx;flex: 0 0 auto;}
  308. }
  309. }
  310. }
  311. // 按钮
  312. .ybtn{width: 100%;height: 90rpx;background: $com-cd3;border-radius: 14rpx;margin: 100rpx auto 0;font-size: 28rpx;font-weight: 500;color: #FFFFFF;
  313. &.btn1{background-color: #9a9c9e;}
  314. }
  315. .tips{font-weight: bold;margin-top: 28rpx;
  316. font-size: 22rpx;line-height: 34rpx;
  317. color: #FF0000;}
  318. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  319. .navbg{width: 100%;height: 692rpx;}
  320. .zxmain{position: relative;padding: 20rpx 32rpx 40rpx;box-sizing: border-box;display: flex;
  321. min-height: calc(100vh - 44px);
  322. }
  323. </style>