limitdetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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" :modelValue="datainfo">
  12. <view class="ytsbox">
  13. <view class="yttit">人员信息</view>
  14. <view class="pt5">
  15. <uni-forms-item label="姓名" name="personneName">
  16. <uni-easyinput :inputBorder="false" v-model="datainfo.personneName" placeholder="请输入姓名">
  17. </uni-easyinput>
  18. </uni-forms-item>
  19. <uni-forms-item label="联系方式" name="personnePhone">
  20. <uni-easyinput :inputBorder="false" v-model="datainfo.personnePhone" placeholder="请输入联系方式">
  21. </uni-easyinput>
  22. </uni-forms-item>
  23. <uni-forms-item label="门禁权限" name="guard">
  24. <view class="pickbox" @click="getRecorddwFn">
  25. <view class="flexc flex1">
  26. <view class="flex1 f14" v-if="datainfo.guard&&!mjtxt">{{statusFormats(datainfo.guard,mjlist,'dblx')}}</view>
  27. <view class="flex1 f14" v-else :class="mjtxt?'':'coa'">{{mjtxt||"请选择门禁"}}</view>
  28. <image :src="hupimg" class="hupimg"></image>
  29. </view>
  30. </view>
  31. </uni-forms-item>
  32. <uni-forms-item label="是否启用" name="isEnable">
  33. <view class="pickbox">
  34. <view class="flexc flex1" >
  35. <uni-data-checkbox :selectedColor="actcolor" selectedTextColor='#222327' v-model="datainfo.isEnable" :localdata="qylist" />
  36. </view>
  37. </view>
  38. </uni-forms-item>
  39. <uni-forms-item label="部门" name="deptName">
  40. <view class="pickbox" @click="getRecordbmFn">
  41. <view class="flexc flex1">
  42. <view class="flex1 f14" :class="datainfo.deptName?'':'coa'">{{datainfo.deptName||"请选择部门"}}</view>
  43. <image :src="hupimg" class="hupimg"></image>
  44. </view>
  45. </view>
  46. </uni-forms-item>
  47. </view>
  48. <view class="ybtn flexcc" @click="getSubmit">确认提交</view>
  49. <view class="tips"></view>
  50. </view>
  51. </uni-forms>
  52. </view>
  53. </view>
  54. <!-- 选择担保类型 -->
  55. <bartree-pickerfixed ref="treePickerzrdw" deptType='1' :multiple='true' @select-change="selectChangezrdw" title="选择门禁"
  56. :localdata="mjlist" :checkVal='datainfo.guard' valueKey="value" textKey="label" childrenKey="children"></bartree-pickerfixed>
  57. <!-- 选择部门 -->
  58. <bartree-pickerfixed ref="treePickerbm" deptType='1' :multiple='false' @select-change="selectChangebm" title="选择部门"
  59. :localdata="depTree" :checkVal='datainfo.deptName' valueKey="id" textKey="label" childrenKey="children"></bartree-pickerfixed>
  60. </view>
  61. </template>
  62. <script>
  63. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  64. import {getManagementAdd,getManagementPut,getManagementDetail} from "@/api/mine/work.js"
  65. import {getDictionaryFn} from "@/api/mine/register.js"
  66. import {selectValueKey} from "@/utils/common.js"
  67. import {getDeptFn} from "@/api/mine/mine.js"
  68. import bartreePickerfixed from "@/work/components/ba-tree-picker/ba-tree-pickerfixed.vue"
  69. export default {
  70. components: {bartreePickerfixed},
  71. data() {
  72. return {
  73. hupimg:require("@/static/images/order/hup.png"),
  74. navbg:require("@/static/images/navbg.png"),
  75. backgroundColor: "transparent",
  76. nvaHeight: 44,
  77. marTop: 0, //距离顶部的距离
  78. stubarHeight: 0, //
  79. datainfo:{
  80. "personneId":"",//ID
  81. "personneName":"",//人员姓名
  82. "personnePhone":"",//人员手机号
  83. "deptId":"",//部门id
  84. "deptName":"",//部门名称
  85. "humanFaceData":"",//人脸数据
  86. "guard":"",//门禁
  87. "isEnable":"0"//是否启用 0:是,1:否
  88. },
  89. mjtxt:'',
  90. qylist:[{text:'是',value:'0'},{text:'否',value:'1'}],
  91. actcolor:'#00A9F0',
  92. qyidx:[],
  93. sfqy:'',
  94. mjlist:[],
  95. depTree:[],
  96. ptype:'add',
  97. id:'',
  98. // name:this.$store.state.user.name,
  99. // userId:this.$store.state.user.userId,
  100. // deptId:this.$store.state.user.deptId,
  101. // deptName:this.$store.state.user.deptName,
  102. }
  103. },
  104. onPageScroll(e) {
  105. var scrollTop = Number(e.scrollTop);
  106. if (scrollTop > 0) {
  107. this.backgroundColor = '#0491FD'
  108. } else {
  109. this.backgroundColor = 'transparent'
  110. }
  111. },
  112. onLoad: function(e) {
  113. if(e.data){
  114. var data=JSON.parse(decodeURIComponent(e.data))
  115. if(data.type){
  116. this.ptype=data.type;
  117. this.id=data.id;
  118. this.getDetail()
  119. }
  120. }else{
  121. this.datainfo.orderFoodUser=this.name;
  122. this.datainfo.orderFoodUserId=this.userId;
  123. this.datainfo.orderFoodDept=this.deptName;
  124. this.datainfo.orderFoodDeptId=this.deptId;
  125. }
  126. this.init()
  127. // this.getDataFn()
  128. uni.getSystemInfo({
  129. success: (e) => {
  130. this.stubarHeight = Number(e.statusBarHeight);
  131. this.nvaHeight = Number(e.statusBarHeight) + 44;
  132. this.tabscheight = Number(this.nvaHeight) * 2 + 100;
  133. }
  134. })
  135. },
  136. onShow() {},
  137. mounted() {
  138. this.getHeightFn()
  139. },
  140. methods: {
  141. checkPermi,
  142. checkRole,
  143. getBack() {
  144. uni.navigateBack({
  145. delta: 1
  146. })
  147. },
  148. statusFormat(ite,list,type) {
  149. var aite=selectValueKey(list, ite);
  150. this.qyidx=aite.key
  151. return aite.actions;
  152. },
  153. statusFormats(ite,list,type){//多选匹配
  154. if(ite){
  155. var actions = [];
  156. list.forEach(s => {
  157. if(ite.indexOf(s.dictValue)>-1){
  158. actions.push(s.dictLabel);
  159. }
  160. })
  161. return actions.join(',')
  162. }else{
  163. return ''
  164. }
  165. },
  166. init() {
  167. // 就餐类型
  168. getDictionaryFn('menj').then(res=>{
  169. if(res.code==200){
  170. this.mjlist = res.data.map(v => {
  171. return {
  172. label: v.dictLabel,
  173. value: v.dictValue
  174. }
  175. })
  176. }
  177. })
  178. getDeptFn().then(res=>{
  179. if(res.code==200){
  180. this.depTree=res.data
  181. }
  182. })
  183. },
  184. getRecorddwFn(){
  185. this.$refs.treePickerzrdw._show();
  186. },
  187. getRecordbmFn(){
  188. this.$refs.treePickerbm._show();
  189. },
  190. selectChangezrdw(e){
  191. var val=e;
  192. var newArr=[],newVal=[];
  193. var a=0;
  194. e.forEach((ite,idx)=>{
  195. newArr[idx]=ite.deptName
  196. newVal[idx]=ite.deptId
  197. })
  198. this.mjtxt=newArr.join(',')
  199. this.datainfo.guard=newVal.join(',');
  200. },
  201. selectChangebm(e){
  202. var val=e;
  203. console.log(e)
  204. },
  205. bindTimeChangea(e){
  206. var val=e.detail.value;
  207. this.datainfo.orderFoodTime=val
  208. },
  209. bindTimeChangeb(e){
  210. var val=e.detail.value;
  211. this.datainfo.orderFoodType=this.jclxlist[val].value
  212. this.jclx=this.jclxlist[val].label
  213. },
  214. getHeightFn() {
  215. let query = uni.createSelectorQuery().in(this);
  216. //需要给黄色区域设置一个id标识,在这里是demo
  217. query.select('.navbox').boundingClientRect(data => {
  218. var top = data.top < 0 ? -data.top : data.top;
  219. var stubarHeight = Number(this.stubarHeight);
  220. this.marTop = stubarHeight > 0 ? 692 - Number(data.height) * 2 : 692 - Number(data.height) *
  221. 2 + 40 //赋值,待会要用
  222. if (top <= this.nvaHeight) {
  223. const opacity = top / 100 // 计算透明度值
  224. const color = `rgba(4, 145, 253, ${opacity})`
  225. this.backgroundColor = color // 更新盒子背景颜色
  226. } else {
  227. this.backgroundColor = '#00A9F0'
  228. }
  229. }).exec();
  230. },
  231. getSubmit() {
  232. var that=this;
  233. var params = JSON.parse(JSON.stringify(this.datainfo))
  234. if(!params.orderFoodTime){
  235. this.$toast("请选择就餐日期")
  236. return
  237. }
  238. if(!this.jclx){
  239. this.$toast("请选择就餐类型")
  240. return
  241. }
  242. uni.showLoading({
  243. title:"加载中"
  244. })
  245. if(this.ptype=='add'){
  246. getFoodAdd(params).then(res => {
  247. uni.hideLoading()
  248. if (res.code == 200) {
  249. this.$toast("预约成功")
  250. setTimeout(function(){
  251. uni.$emit('refreshfoodlist')
  252. uni.navigateBack({
  253. delta:1
  254. })
  255. },1200)
  256. } else {
  257. this.$toast(res.msg)
  258. }
  259. })
  260. }else{
  261. getFoodPut(params).then(res => {
  262. uni.hideLoading()
  263. if (res.code == 200) {
  264. this.$toast("修改成功")
  265. setTimeout(function(){
  266. uni.$emit('refreshfoodlist')
  267. uni.navigateBack({
  268. delta:1
  269. })
  270. },1200)
  271. } else {
  272. this.$toast(res.msg)
  273. }
  274. })
  275. }
  276. },
  277. getDetail(){
  278. getFoodDetail(this.id).then(res=>{
  279. if(res.code==200){
  280. this.datainfo=JSON.parse(JSON.stringify(res.data))
  281. }
  282. })
  283. }
  284. },
  285. }
  286. </script>
  287. <style>
  288. /* page {
  289. background: #ffffff;
  290. } */
  291. </style>
  292. <style lang="scss" scoped>
  293. .ytbox /deep/ .uni-forms .uni-forms-item{padding: 10rpx 26rpx 10rpx;border: 2rpx solid #0391FD;margin-bottom: 24rpx;border-radius: 12rpx;}
  294. .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;}
  295. .ytbox /deep/ .uni-forms-item__label text{flex: 1;}
  296. .ytbox /deep/ .uni-forms-item__label .is-required{position: absolute;right: 0;color: #F10C31;margin-top: 16rpx;}
  297. .ytbox /deep/ uni-textarea{flex: 1;width: auto;text-align: right;}
  298. .ytbox /deep/ .uni-textarea-placeholder{font-size: 28rpx;color: #DDDDDD !important;}
  299. .ytbox /deep/ .uni-easyinput__placeholder-class{font-size: 28rpx;color: #AAAAAA;}
  300. .ytbox /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  301. .ytbox /deep/ .uni-easyinput{flex: 1;text-align: right;}
  302. .ytbox /deep/ .uni-easyinput__content-input{font-size: 28rpx;}
  303. .ytbox /deep/ .uni-forms-item__error{margin-top:20rpx;left: auto;right: 0;}
  304. .ytbox /deep/ .checklist-group{justify-content: end;}
  305. .disable{background: #EFF0F2;border: none !important;}
  306. .ytbox{width: 684rpx;margin: 0 auto;padding-top: 24rpx;position: relative;flex: 1;overflow: auto;background-color: #ffffff;padding-bottom: 4rpx;border-radius: 14rpx;}
  307. .ytforms{
  308. .yttit{font-size: 28rpx;font-weight: bold;margin-bottom: 56rpx;
  309. color: #161616;display: flex;align-items: center;padding: 0rpx 26rpx;box-sizing: border-box;position: relative;
  310. &::before{content: '';width: 6rpx;height: 34rpx;background: $com-cd3;border-radius: 4rpx;position: absolute;top: 50%;transform: translateY(-50%);left: 0rpx;}
  311. }
  312. .ytsbox{background-color: #ffffff;padding: 32rpx 28rpx 0;border-radius: 14rpx;margin-bottom: 24rpx;
  313. .intit{font-weight: 500;flex: 1;font-size: 26rpx;text-align: right;color: #666666;}
  314. .pickbox{flex: 1;text-align: right;font-weight: 500;font-size: 28rpx;color: #161616;
  315. .hupimg{width: 18rpx;height: 14rpx;margin-left: 12rpx;flex: 0 0 auto;}
  316. }
  317. }
  318. }
  319. // 按钮
  320. .ybtn{width: 100%;height: 90rpx;background: $com-cd3;border-radius: 14rpx;margin: 100rpx auto 0;font-size: 28rpx;font-weight: 500;color: #FFFFFF;
  321. &.btn1{background-color: #9a9c9e;}
  322. }
  323. .tips{font-weight: bold;margin-top: 28rpx;
  324. font-size: 22rpx;line-height: 34rpx;
  325. color: #FF0000;}
  326. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  327. .navbg{width: 100%;height: 692rpx;}
  328. .zxmain{position: relative;padding: 20rpx 32rpx 40rpx;box-sizing: border-box;display: flex;
  329. min-height: calc(100vh - 44px);
  330. }
  331. </style>