addPage.vue 8.9 KB

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