addPage.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <!-- 权限申请新增 -->
  2. <template>
  3. <view class="permissionApplyAddPage">
  4. <view class="check-big-box">
  5. <view class="check-text-p">*</view>
  6. <view class="check-title-p">所需权限</view>
  7. <view class="check-box" @click="checkButton(item)"
  8. v-for="(item,index) in permConfigList" :key="index">
  9. <img v-if="!item.checkType" class="left-box" :src="imagesUrl('commonality/icon_12.png')">
  10. <img v-if="item.checkType" class="left-box" :src="imagesUrl('commonality/icon_13.png')">
  11. <view>{{item.permName}}</view>
  12. </view>
  13. <!-- <view class="check-box" @click="checkButton(1)">
  14. <img v-if="!newData.checkType1" class="left-box" :src="imagesUrl('commonality/icon_12.png')">
  15. <img v-if="newData.checkType1" class="left-box" :src="imagesUrl('commonality/icon_13.png')">
  16. <view>回收报备</view>
  17. </view>
  18. <view class="check-box" @click="checkButton(2)">
  19. <img v-if="!newData.checkType2" class="left-box" :src="imagesUrl('commonality/icon_12.png')">
  20. <img v-if="newData.checkType2" class="left-box" :src="imagesUrl('commonality/icon_13.png')">
  21. <view>称重登记</view>
  22. </view> -->
  23. </view>
  24. <view class="check-big-box">
  25. <view class="check-text-p">*</view>
  26. <view class="check-title-p">申请实验室</view>
  27. <input @click="inputClick(2)" v-model="subject.subName" class="picker-input-box" disabled type="text"
  28. placeholder="请选择实验室">
  29. <view v-if="subject.subName" class="picker-button-box" @click="inputClick(2)">修改</view>
  30. </view>
  31. <view style="margin-top:40rpx;">
  32. <view class="text-color-p" v-if="subject.subName">基础信息:{{subject.deptName}}</view>
  33. <view class="text-color-p" v-if="subject.subName">{{subject.buildName}} - {{subject.floorName}} - {{subject.roomNum}}</view>
  34. <view class="text-color-p" v-if="subject.subName">实验室负责人:{{subject.adminName}}</view>
  35. </view>
  36. <view class="submit-button-p" style="margin-top:60rpx;" @click="submitButton()">立 即 申 请</view>
  37. <!-- 实验室选择页面 -->
  38. <view class="pageTwo" v-if="pageType == 2">
  39. <view class="pageTwo-input-box">
  40. <input type="text" placeholder="请输入实验室名称/房间号" v-model="subjectName">
  41. <view @click="subjectList">查找</view>
  42. </view>
  43. <view class="for-max-box">
  44. <view class="for-null-text" v-if="!searchList[0]">{{nullText}}</view>
  45. <view class="for-box" v-for="(item,index) in searchList" :key="index">
  46. <view class="button-text-view">{{item.subName}}{{item.roomNum?'('+item.roomNum+')':''}}</view>
  47. <view class="button-big-view">
  48. <view class="button-null-view"></view>
  49. <view class="button-view" @click="checkClick(item)">选择</view>
  50. <view class="button-null-view"></view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="out-button" @click="inputClick(1)">返回</view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. laboratorySubRelInfoGetRelList,
  61. } from '@/api/index.js'
  62. import {
  63. hwmsPermConfigList,
  64. hwmsAppRegisterApprovalAdd,
  65. } from '@/pages_hazardousWasteRecycling/api/index.js'
  66. export default {
  67. data() {
  68. return {
  69. pageType:1,
  70. //搜索回的实验室列表
  71. searchList: [],
  72. subject:{},
  73. //实验室名称
  74. subjectName: "",
  75. //暂无数据提示
  76. nullText: "请输入实验室名称进行搜索",
  77. newData:{
  78. checkType1:true,
  79. checkType2:true
  80. },
  81. permConfigList:[],
  82. }
  83. },
  84. onLoad(option) {
  85. },
  86. onShow() {
  87. this.hwmsPermConfigList();
  88. },
  89. mounted() {
  90. },
  91. methods: {
  92. checkButton(item){
  93. item.checkType = !item.checkType;
  94. },
  95. submitButton(){
  96. let self = this;
  97. let num = 0;
  98. for(let i=0;i<self.permConfigList.length;i++){
  99. if(self.permConfigList[i].checkType){
  100. num++
  101. }
  102. }
  103. if(num == 0){
  104. uni.showToast({
  105. title: '请勾选所需权限',
  106. icon: "none",
  107. mask: true,
  108. duration: 2000
  109. });
  110. return
  111. }
  112. if(!this.subject.subId){
  113. uni.showToast({
  114. title: '请选择实验室',
  115. icon: "none",
  116. mask: true,
  117. duration: 2000
  118. });
  119. return
  120. }
  121. uni.showModal({
  122. content: '是否确认提交?',
  123. cancelColor: "#999",
  124. confirmColor: "#0183FA",
  125. success: function(res) {
  126. if (res.confirm) {
  127. self.hwmsAppRegisterApprovalAdd();
  128. } else if (res.cancel) {}
  129. }
  130. });
  131. },
  132. async hwmsAppRegisterApprovalAdd(){
  133. let self = this;
  134. let obj = {
  135. perm : [],
  136. buildId : this.subject.buildId,
  137. buildName : this.subject.buildName,
  138. deptId : this.subject.deptId,
  139. deptName : this.subject.deptName,
  140. roomNum : this.subject.roomNum,
  141. subId : this.subject.subId,
  142. subName : this.subject.subName,
  143. };
  144. for(let i=0;i<self.permConfigList.length;i++){
  145. if(self.permConfigList[i].checkType){
  146. obj.perm.push(self.permConfigList[i].id)
  147. }
  148. }
  149. obj.perm = obj.perm + '';
  150. const {
  151. data
  152. } = await hwmsAppRegisterApprovalAdd(obj)
  153. if (data.code == 200) {
  154. uni.showToast({
  155. title: '提交成功',
  156. icon: "none",
  157. mask: true,
  158. duration: 2000
  159. });
  160. setTimeout(function() {
  161. uni.navigateBack();
  162. }, 2000);
  163. }
  164. },
  165. async hwmsPermConfigList(){
  166. const {
  167. data
  168. } = await hwmsPermConfigList()
  169. if (data.code == 200) {
  170. for(let i=0;i<data.data.length;i++){
  171. data.data[i].checkType = true;
  172. }
  173. this.$set(this,'permConfigList',data.data);
  174. }
  175. },
  176. //选择搜索页面
  177. inputClick(type) {
  178. if (this.pageType != type) {
  179. this.pageType = type;
  180. this.$set(this, "subjectName", '');
  181. this.$set(this, "searchList", []);
  182. }
  183. },
  184. //查询实验室
  185. async subjectList() {
  186. if(!this.subjectName){
  187. uni.showToast({
  188. title: '请输入实验室名称/房间号',
  189. icon: "none",
  190. mask: true,
  191. duration: 2000
  192. });
  193. return
  194. }
  195. const {
  196. data
  197. } = await laboratorySubRelInfoGetRelList({
  198. searchValue: this.subjectName
  199. })
  200. if (data.code == 200) {
  201. this.searchList = data.data;
  202. if (!data.data[0]) {
  203. this.nullText = "暂无数据"
  204. }
  205. }
  206. },
  207. //实验室选择
  208. checkClick(item) {
  209. this.$set(this, "subject", item);
  210. this.inputClick(1);
  211. },
  212. },
  213. }
  214. </script>
  215. <style lang="stylus" scoped>
  216. .permissionApplyAddPage{
  217. height: 100%;
  218. display flex;
  219. flex-direction column;
  220. background-color: #fff;
  221. .check-big-box{
  222. display: flex;
  223. padding:0 0 0 40rpx;
  224. margin-top:30rpx;
  225. .check-text-p{
  226. color:#FF6A6A;
  227. height:80rpx;
  228. line-height:80rpx;
  229. }
  230. .check-title-p{
  231. font-size:32rpx;
  232. height:80rpx;
  233. line-height:80rpx;
  234. }
  235. .check-box{
  236. display: flex;
  237. font-size:32rpx;
  238. margin-left:40rpx;
  239. img{
  240. width:40rpx;
  241. height:40rpx;
  242. margin-top:21rpx;
  243. }
  244. view{
  245. margin-left:20rpx;
  246. height:80rpx;
  247. line-height:80rpx;
  248. }
  249. }
  250. .picker-input-box{
  251. padding: 0 20rpx;
  252. display flex;
  253. height: 80rpx;
  254. width: 330rpx;
  255. border: 1rpx solid #a2a2a2;
  256. border-radius: 10rpx;
  257. margin: 0 20rpx;
  258. }
  259. .picker-button-box{
  260. font-size:30rpx;
  261. height: 80rpx;
  262. width: 100rpx;
  263. line-height:80rpx;
  264. text-align: center;
  265. color:#fff;
  266. background-color:#0183FA;
  267. border-radius: 10rpx;
  268. }
  269. }
  270. .text-color-p{
  271. color:#666;
  272. margin:0 50rpx;
  273. line-height:80rpx;
  274. }
  275. .submit-button-p{
  276. background-color:#0183FA;
  277. color:#fff;
  278. width:400rpx;
  279. height:80rpx;
  280. line-height:80rpx;
  281. text-align: center;
  282. font-size:30rpx;
  283. margin:20rpx 175rpx;
  284. border-radius:10rpx;
  285. }
  286. .pageTwo {
  287. flex: 1;
  288. display flex;
  289. flex-direction column;
  290. overflow-y hidden;
  291. position: absolute;
  292. height: 100%;
  293. z-index: 100;
  294. background-color: #fff;
  295. .pageTwo-input-box {
  296. display flex;
  297. padding: 20rpx 25rpx;
  298. background #fff;
  299. margin-bottom: 20rpx;
  300. input {
  301. padding: 0 20rpx;
  302. width: 460rpx;
  303. line-height: 80rpx;
  304. height: 80rpx;
  305. border-top: 1rpx solid #a2a2a2;
  306. border-left: 1rpx solid #a2a2a2;
  307. border-bottom: 1rpx solid #a2a2a2;
  308. border-bottom-left-radius: 10rpx;
  309. border-top-left-radius: 10rpx;
  310. }
  311. view {
  312. width: 200rpx;
  313. line-height: 80rpx;
  314. height: 80rpx;
  315. border: 1rpx solid #007AFF;
  316. color: #fff;
  317. background #007AFF;
  318. text-align center;
  319. border-top-right-radius: 10rpx;
  320. border-bottom-right-radius: 10rpx;
  321. }
  322. }
  323. .for-max-box {
  324. background #fff;
  325. flex: 1;
  326. overflow-y scroll;
  327. .for-box:nth-child(1) {
  328. border: none;
  329. }
  330. .for-null-text {
  331. text-align center;
  332. line-height: 100rpx;
  333. color: #999;
  334. }
  335. .for-box {
  336. border-top: 1rpx solid #dedede;
  337. display: flex;
  338. .button-text-view {
  339. padding: 35rpx 35rpx 35rpx 20rpx;
  340. width:560rpx;
  341. }
  342. .button-big-view {
  343. padding: 20rpx 0 20rpx 0 ;
  344. width: 100rpx;
  345. display: flex;
  346. flex-direction: column;
  347. .button-null-view{
  348. flex:1;
  349. }
  350. .button-view{
  351. line-height:60rpx;
  352. width: 100rpx;
  353. text-align center;
  354. border-radius: 10rpx;
  355. background #007AFF;
  356. color: #fff;
  357. }
  358. }
  359. }
  360. }
  361. .out-button {
  362. width: 650rpx;
  363. height: 100rpx;
  364. line-height: 100rpx;
  365. margin: 20rpx 50rpx;
  366. text-align center;
  367. font-size: 32rpx;
  368. color: #fff;
  369. background #999;
  370. border-radius: 20rpx;
  371. }
  372. }
  373. }
  374. </style>