newApplication.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178
  1. <!-- 选择实验室 -->
  2. <template>
  3. <view id="newApplication">
  4. <view class="newApplication-page" v-if="pageType == 1">
  5. <view class="picker-max-box">
  6. <view class="picker-title-box">
  7. <view>*</view>
  8. <view>申请实验室:</view>
  9. </view>
  10. <input @click="inputClick(2)" v-model="subject.subName" class="picker-input-box" disabled type="text"
  11. placeholder="请选择实验室">
  12. </view>
  13. <view class="picker-max-box" v-if="subject.subId">
  14. <view class="picker-title-box">
  15. <view>*</view>
  16. <view>申请期限:</view>
  17. </view>
  18. <view class="apply_data">
  19. <picker mode="date" v-model="validBeginTime" :start="currentDate" fields="day"
  20. @change="beginDateChange">
  21. <view class="for-top-title-time" v-if="validBeginTime.length>0">{{validBeginTime}}</view>
  22. <view class="for-top-title-time" v-if="validBeginTime.length<=0">开始时间</view>
  23. </picker>
  24. -
  25. <picker mode="date" v-model="validEndTime" :start="currentDate" fields="day"
  26. @change="endDateChange">
  27. <view class="for-top-title-time" v-if="validEndTime.length>0">{{validEndTime}}</view>
  28. <view class="for-top-title-time" v-if="validEndTime.length<=0">结束时间</view>
  29. </picker>
  30. </view>
  31. </view>
  32. <view class="picker-max-box" v-if="subject.subId">
  33. <view class="picker-title-box">
  34. <view> </view>
  35. <view>申请备注:</view>
  36. </view>
  37. <textarea class="remark" v-model="applyCause" placeholder="请输入申请备注"></textarea>
  38. </view>
  39. <view class="user-info-box" v-if="subject.subId">
  40. <view class="picker-title-box">
  41. <view>*</view>
  42. <view>身份信息:</view>
  43. <view>(关联学生信息材料)</view>
  44. </view>
  45. <view class="user-info-box-min">
  46. <view>*</view>
  47. <view>申请人:</view>
  48. <input v-model="sysUser.userName" type="text" placeholder="学生姓名">
  49. </view>
  50. <view class="user-info-box-min">
  51. <view>*</view>
  52. <view>联系电话:</view>
  53. <input v-model="sysUser.mobile" type="text" placeholder="联系电话">
  54. </view>
  55. <view class="user-info-box-min">
  56. <view>*</view>
  57. <view>学号:</view>
  58. <input v-model="sysUser.account" type="text" placeholder="学号">
  59. </view>
  60. <view class="user-info-box-min" v-if="versionField() != 'xiBeiNongLinDaXue'">
  61. <view>*</view>
  62. <view>物理卡号:</view>
  63. <input v-model="sysUser.cardNumSimple" type="text" placeholder="物理卡号">
  64. </view>
  65. <view class="user-info-box-min" v-if="versionField() != 'xiBeiNongLinDaXue'">
  66. <view>*</view>
  67. <view>班级:</view>
  68. <input v-model="sysUser.gradeName" type="text" placeholder="班级">
  69. </view>
  70. <view class="user-info-box-min">
  71. <view>*</view>
  72. <view>导师:</view>
  73. <input v-model="sysUser.tutorUserName" @change="tutorUserNameClick()" type="text"
  74. placeholder="请输入姓名,最少两个字">
  75. <uni-data-picker disabled=true @change="bindPickerChange" :localdata="tutorUserList" ref='picker'>
  76. </uni-data-picker>
  77. </view>
  78. </view>
  79. <!-- 学生 -->
  80. <view v-if="subjectData.sysUser.userType == '2'" v-for="(item,index) in subjectData.listStudent"
  81. :key="index">
  82. <!-- 院系考试证书 -->
  83. <view class="picker-max-box" v-if="item.materialType==2&&item.relationType==2">
  84. <view class="picker-title-box">
  85. <view>*</view>
  86. <view>安全考试证书:</view>
  87. </view>
  88. <img class="picker-up-img-box" v-if="subjectData.listcert[0]"
  89. :src="subjectData.listcert[0].cert_url">
  90. <view v-if="!subjectData.listcert[0]" style="margin-left:40px;color:#999;font-size:14px;">暂无证书
  91. </view>
  92. </view>
  93. <!-- 上传材料 -->
  94. <view class="picker-max-box" v-if="item.materialType==1">
  95. <view class="picker-title-box">
  96. <view>*</view>
  97. <view>{{item.materialName}}:</view>
  98. </view>
  99. <view class="picker-text-info-box">{{item.materialDescribe}}</view>
  100. <view class="picker-for-item-box" v-for="(minItem,minIndex) in item.upList" :key="minIndex">
  101. <img class="left-img-box" :src="imagesUrl('commonality/icon_pdf.png')"
  102. v-if="minItem.type == 'pdf'">
  103. <img class="left-img-box" :src="imagesUrl('commonality/icon_word.png')"
  104. v-if="minItem.type == 'doc' || minItem.type == 'docx'">
  105. <img class="left-img-box" :src="baseUrl+minItem.url"
  106. v-if="minItem.type == 'png' || minItem.type == 'jpg' || minItem.type == 'jpeg' || minItem.type == 'gif'">
  107. <view class="center-text-box">{{minItem.name}}</view>
  108. <img class="right-img-box" :src="imagesUrl('commonality/icon_sczl_sc.png')"
  109. @click="delUpData(item,minIndex)">
  110. </view>
  111. <view class="up-data-button" @click="itemUpData(item)">上传材料</view>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 实验室选择页面 -->
  116. <view class="pageTwo" v-if="pageType == 2">
  117. <view class="pageTwo-input-box">
  118. <input type="text" placeholder="请输入实验室名称/房间号" v-model="subjectName">
  119. <view @click="subjectList">查找</view>
  120. </view>
  121. <view class="for-max-box">
  122. <view class="for-null-text" v-if="!searchList[0]">{{nullText}}</view>
  123. <view class="for-box" v-for="(item,index) in searchList" :key="index">
  124. <view class="button-text-view">{{item.subName}}{{item.roomNum?'('+item.roomNum+')':''}}</view>
  125. <view class="button-big-view">
  126. <view class="button-null-view"></view>
  127. <view class="button-view" @click="checkClick(item)">选择</view>
  128. <view class="button-null-view"></view>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="out-button" @click="inputClick(1)">返回</view>
  133. </view>
  134. <view class="bottom-button" v-if="pageType == 1" @click="upDataButton()">
  135. {{infoType?'准入材料修改完毕,重新提交':'准入材料上传完毕,提交申请'}}
  136. </view>
  137. <view class="shade-max-box" v-if="shadeType">
  138. <view class="shade-big-box">
  139. <img :src="imagesUrl('student/img_zrsq_bg.png')">
  140. <view @click="pageBack">返回</view>
  141. </view>
  142. </view>
  143. </view>
  144. </template>
  145. <script>
  146. import {
  147. subjectList,
  148. materialApply,
  149. materialUpdate,
  150. materialAdd,
  151. teacherApply
  152. } from '@/api/apiDemo/index.js'
  153. import {
  154. systemUserDropList
  155. } from '@/api/commonality/permission.js'
  156. import {
  157. systemMineGetListByPower,
  158. laboratoryAppletMaterialApply,
  159. laboratoryAppletMaterialAdd,
  160. laboratoryAppletMaterialUpdate,
  161. } from '@/pages_student/api/index.js'
  162. import {
  163. config
  164. } from '@/api/request/config.js'
  165. export default {
  166. data() {
  167. return {
  168. baseUrl: config.base_url,
  169. pageType: 2,
  170. shadeType: false,
  171. //有效期
  172. buttonArray2: [],
  173. buttonArrayIndex2: 11,
  174. //搜索回的实验室列表
  175. searchList: [],
  176. //选择的实验室数据
  177. subject: {},
  178. //暂无数据提示
  179. nullText: "请输入实验室名称进行搜索",
  180. //实验室名称
  181. subjectName: "",
  182. //有效期
  183. validLength: "12",
  184. //获取的实验室配置数据
  185. subjectData: {},
  186. //是否是编辑状态
  187. infoType: false,
  188. //编辑参数
  189. infoData: {},
  190. validBeginTime: '', //申请期限开始
  191. validEndTime: '', //申请期限结束
  192. applyCause: '', //申请备注
  193. sysUser: {},
  194. tutorUserList: [],
  195. strArr: [], //存储类型
  196. currentDate: '', //当前日期
  197. uploadFileName: '', //学生上传的文件名
  198. }
  199. },
  200. onLoad(option) {
  201. if (option.item) {
  202. let newItem = JSON.parse(decodeURIComponent(option.item));
  203. let newObj = {
  204. deptId: newItem.labSecurityApply.deptId,
  205. deptName: newItem.labSecurityApply.deptName,
  206. subId: newItem.labSecurityApply.subId,
  207. subName: newItem.labSecurityApply.subName,
  208. }
  209. this.$set(this, 'validBeginTime', newItem.labSecurityApply.validBeginTime.split(' ')[0])
  210. this.$set(this, 'validEndTime', newItem.labSecurityApply.validEndTime.split(' ')[0])
  211. this.$set(this, 'applyCause', newItem.labSecurityApply.applyCause)
  212. this.$set(this, 'subject', newObj)
  213. this.$set(this, 'infoData', newItem)
  214. this.$set(this, 'infoType', true)
  215. this.$set(this, 'pageType', 2)
  216. this.materialApply();
  217. }
  218. },
  219. onShow() {
  220. this.addTime();
  221. this.clearData();
  222. this.currentDate = this.getdate();
  223. // console.log('时间')
  224. // console.log(this.currentDate)
  225. },
  226. methods: {
  227. getdate() {
  228. var date = new Date();
  229. var seperator1 = "-";
  230. var year = date.getFullYear();
  231. var month = date.getMonth() + 1;
  232. var strDate = date.getDate();
  233. if (month >= 1 && month <= 9) {
  234. month = "0" + month;
  235. }
  236. if (strDate >= 0 && strDate <= 9) {
  237. strDate = "0" + strDate;
  238. }
  239. var currentdate = year + "-" + month + "-" + strDate;
  240. return currentdate;
  241. },
  242. //清除
  243. clearData() {
  244. this.tutorUserList = [];
  245. },
  246. //导师查询
  247. async tutorUserNameClick() {
  248. let self = this
  249. self.tutorUserList = []
  250. let obj = {
  251. userName: this.sysUser.tutorUserName,
  252. userType: '1'
  253. }
  254. const {
  255. data
  256. } = await systemUserDropList(obj)
  257. if (data.code == 200) {
  258. console.log(data)
  259. data.data.forEach(function(item) {
  260. self.tutorUserList.push({
  261. text: item.userName,
  262. value: item.userId,
  263. })
  264. })
  265. console.log(self.tutorUserList)
  266. self.$refs.picker.show()
  267. }
  268. },
  269. bindPickerChange: function(e) {
  270. let self = this;
  271. console.log('picker发送选择改变,携带值为', e.detail.value)
  272. let data = e.detail.value;
  273. data.forEach(function(item) {
  274. self.sysUser.tutorUserName = item.text
  275. self.sysUser.tutorUserId = item.value
  276. })
  277. },
  278. //时间选择触发-开始
  279. beginDateChange(data) {
  280. this.validBeginTime = data.detail.value;
  281. },
  282. endDateChange(data) {
  283. this.validEndTime = data.detail.value;
  284. },
  285. pageBack() {
  286. if (this.infoType) {
  287. uni.navigateBack({
  288. delta: 2
  289. });
  290. }else{
  291. uni.navigateBack();
  292. }
  293. },
  294. //申请编辑
  295. async materialUpdate(obj) {
  296. const {
  297. data
  298. } = await laboratoryAppletMaterialUpdate(obj)
  299. if (data.code == 200) {
  300. this.shadeType = true;
  301. }
  302. },
  303. //申请提交
  304. async materialAdd(obj) {
  305. const {
  306. data
  307. } = await laboratoryAppletMaterialAdd(obj)
  308. if (data.code == 200) {
  309. this.shadeType = true;
  310. }
  311. },
  312. //提交按钮
  313. upDataButton() {
  314. let self = this;
  315. if (!this.subject.subId) {
  316. uni.showToast({
  317. title: '请选择实验室',
  318. icon: "none",
  319. mask: true,
  320. duration: 2000
  321. });
  322. return
  323. }
  324. if (!this.validBeginTime) {
  325. uni.showToast({
  326. title: '请选择开始时间',
  327. icon: "none",
  328. mask: true,
  329. duration: 2000
  330. });
  331. return
  332. }
  333. if (!this.validEndTime) {
  334. uni.showToast({
  335. title: '请选择结束时间',
  336. icon: "none",
  337. mask: true,
  338. duration: 2000
  339. });
  340. return
  341. }
  342. if (!this.sysUser.userName) {
  343. uni.showToast({
  344. title: '请输入申请人',
  345. icon: "none",
  346. mask: true,
  347. duration: 2000
  348. });
  349. return
  350. }
  351. if (!this.sysUser.mobile) {
  352. uni.showToast({
  353. title: '请输入联系电话',
  354. icon: "none",
  355. mask: true,
  356. duration: 2000
  357. });
  358. return
  359. }
  360. if (!this.sysUser.account) {
  361. uni.showToast({
  362. title: '请输入学号',
  363. icon: "none",
  364. mask: true,
  365. duration: 2000
  366. });
  367. return
  368. }
  369. let playTime = Math.floor(new Date(this.validBeginTime).getTime() / 1000);
  370. let endTime = Math.floor(new Date(this.validEndTime).getTime() / 1000);
  371. if(playTime > endTime){
  372. uni.showToast({
  373. title: '开始时间不能大于结束时间',
  374. icon: "none",
  375. mask: true,
  376. duration: 2000
  377. });
  378. return
  379. }
  380. // if (!this.sysUser.cardNumSimple) {
  381. // uni.showToast({
  382. // title: '请输入物理卡号',
  383. // icon: "none",
  384. // mask: true,
  385. // duration: 2000
  386. // });
  387. // return
  388. // }
  389. // if (!this.sysUser.gradeName) {
  390. // uni.showToast({
  391. // title: '请输入班级',
  392. // icon: "none",
  393. // mask: true,
  394. // duration: 2000
  395. // });
  396. // return
  397. // }
  398. if (!this.sysUser.tutorUserId) {
  399. uni.showToast({
  400. title: '请选择导师',
  401. icon: "none",
  402. mask: true,
  403. duration: 2000
  404. });
  405. return
  406. }
  407. let sysUser = {
  408. userName: this.sysUser.userName,
  409. userId: this.sysUser.userId,
  410. mobile: this.sysUser.mobile,
  411. account: this.sysUser.account,
  412. cardNumSimple: this.sysUser.cardNumSimple,
  413. grade: this.sysUser.gradeName,
  414. tutorUserId: this.sysUser.tutorUserId,
  415. tutorUserName: this.sysUser.tutorUserName,
  416. };
  417. let obj = {
  418. subAdminId: this.subjectData.fzrSysUser.userId, //学号/工号
  419. userNumber: this.subjectData.sysUser.account, //学号/工号
  420. userMajor: this.subjectData.sysUser.majorName, //专业
  421. userMajorId: this.subjectData.sysUser.major, //专业
  422. deptId: this.subjectData.sysUser.deptId, //NULL部门id
  423. deptName: this.subjectData.sysUser.deptName, //NULL部门名称
  424. subId: this.subject.subId, //NULL实验室id
  425. subName: this.subject.subName, //NULL实验室名称
  426. roomNum: this.subject.roomNum, //NULL实验室名称
  427. auditStatus: "0", //NULL审核状态 0待审核 1驳回 2通过
  428. //validLength: this.validLength, //NULL有效期 月份时长
  429. relList: [], //上传资料
  430. sysUserModel: sysUser, //身份卡用户信息
  431. validBeginTime: this.validBeginTime+'T00:00:00', //申请期限开始时间
  432. validEndTime: this.validEndTime+'T23:59:59', //申请期限结束时间
  433. applyCause: this.applyCause, //申请备注
  434. };
  435. if (this.subjectData.sysUser.userType == '2') {
  436. for (let i = 0; i < self.subjectData.listStudent.length; i++) {
  437. if (self.subjectData.listStudent[i].materialType == 1) {
  438. if (!self.subjectData.listStudent[i].upList[0]) {
  439. uni.showToast({
  440. title: self.subjectData.listStudent[i].materialName + "未上传",
  441. icon: "none",
  442. mask: true,
  443. duration: 2000
  444. });
  445. return
  446. } else {
  447. let upData = {
  448. materialId: self.subjectData.listStudent[i].materialId,
  449. dataName: self.subjectData.listStudent[i].materialName,
  450. dataDescribe: self.subjectData.listStudent[i].materialDescribe,
  451. dataUrl: "",
  452. };
  453. for (let o = 0; o < self.subjectData.listStudent[i].upList.length; o++) {
  454. upData.dataUrl = upData.dataUrl + self.subjectData.listStudent[i].upList[o].name +
  455. ';' + self.subjectData.listStudent[i].upList[o].url + ',';
  456. }
  457. obj.relList.push(upData);
  458. }
  459. }
  460. }
  461. }
  462. if (this.infoType) {
  463. obj.applyId = this.infoData.labSecurityApply.applyId;
  464. this.materialUpdate(obj);
  465. } else {
  466. this.materialAdd(obj);
  467. }
  468. },
  469. //删除对应材料
  470. delUpData(item, index) {
  471. item.upList.splice(index, 1);
  472. this.$forceUpdate()
  473. },
  474. itemUpData(item) {
  475. this.uploadFileName = '';
  476. this.uploadFileName = this.sysUser.userName + item.materialName; //学生上传的文件名
  477. let self = this;
  478. let fileTypeArr = item.fileType.split(',')
  479. self.strArr = [];
  480. fileTypeArr.forEach(function(item) {
  481. if (item == '1') {
  482. self.strArr.push('pdf')
  483. } else if (item == '2') {
  484. self.strArr.push('doc', 'docx')
  485. } else if (item == '3') {
  486. self.strArr.push('png', 'jpg', 'gif')
  487. }
  488. })
  489. uni.showActionSheet({
  490. itemList: ['上传文件', '上传图片'],
  491. success: function(res) {
  492. console.log(res)
  493. if (res.tapIndex == 0) {
  494. //上传文件
  495. self.upData(item);
  496. } else if (res.tapIndex == 1) {
  497. //上传图片
  498. self.upImg(item);
  499. }
  500. },
  501. fail: function(res) {
  502. console.log(res.errMsg);
  503. }
  504. });
  505. },
  506. upImg(item) {
  507. let self = this;
  508. wx.chooseImage({
  509. count: 1,
  510. sizeType: ["original", "compressed"],
  511. sourceType: ["album", "camera"],
  512. success: function(res) {
  513. console.log(res)
  514. let text = res.tempFilePaths[0].split('.')
  515. if (self.strArr.indexOf(text[1]) == -1) {
  516. uni.showToast({
  517. title: '请上传' + self.strArr.join(',') + '格式文件',
  518. icon: "none",
  519. mask: true,
  520. duration: 2000
  521. });
  522. return
  523. }
  524. if (text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' &&
  525. text[1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx') {
  526. uni.showToast({
  527. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  528. icon: "none",
  529. mask: true,
  530. duration: 2000
  531. });
  532. return
  533. }
  534. let upObj = {
  535. name: self.uploadFileName + '.' + text[1],
  536. path: res.tempFilePaths[0],
  537. type: text[1],
  538. }
  539. self.upDataFunction(item, upObj);
  540. }
  541. });
  542. },
  543. //上传文件
  544. upData(item) {
  545. let self = this;
  546. wx.chooseMessageFile({
  547. count: 1,
  548. type: 'all',
  549. success(res) {
  550. let text = res.tempFiles[0].path.split('.')
  551. if (self.strArr.indexOf(text[1]) == -1) {
  552. uni.showToast({
  553. title: '请上传' + self.strArr.join(',') + '格式文件',
  554. icon: "none",
  555. mask: true,
  556. duration: 2000
  557. });
  558. return
  559. }
  560. if (text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' && text[
  561. 1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx') {
  562. uni.showToast({
  563. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  564. icon: "none",
  565. mask: true,
  566. duration: 2000
  567. });
  568. return
  569. }
  570. let upObj = {
  571. name: self.uploadFileName + '.' + text[1],
  572. path: res.tempFiles[0].path,
  573. type: text[1],
  574. }
  575. self.upDataFunction(item, upObj);
  576. }
  577. })
  578. },
  579. async upDataFunction(item, upObj) {
  580. var self = this;
  581. uni.showLoading({
  582. title: '上传中',
  583. mask: true
  584. });
  585. uni.uploadFile({
  586. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  587. header: {
  588. 'Authorization': uni.getStorageSync('token')
  589. },
  590. filePath: upObj.path,
  591. name: 'file',
  592. formData: {
  593. 'user': 'test'
  594. },
  595. success: (uploadFileRes) => {
  596. let res = JSON.parse(uploadFileRes.data);
  597. if (res.code == 200) {
  598. let obj = {
  599. name: upObj.name,
  600. url: res.data.url,
  601. type: upObj.type
  602. }
  603. item.upList.push(obj);
  604. this.$forceUpdate();
  605. } else {
  606. uni.showToast({
  607. title: res.msg,
  608. icon: "none",
  609. mask: true,
  610. duration: 2000
  611. });
  612. }
  613. },
  614. fail: err => {},
  615. complete: () => {
  616. uni.hideLoading()
  617. }
  618. });
  619. },
  620. //选择搜索页面
  621. inputClick(type) {
  622. if (this.pageType != type) {
  623. this.pageType = type;
  624. }
  625. },
  626. //实验室选择
  627. checkClick(item) {
  628. this.$set(this, "subject", item);
  629. this.materialApply();
  630. },
  631. //获取实验室相关配置
  632. async materialApply() {
  633. let self = this;
  634. const {
  635. data
  636. } = await laboratoryAppletMaterialApply({
  637. subId: this.subject.subId
  638. })
  639. if (data.code == 200) {
  640. if (data.data.sysUser.userType != '2') {
  641. uni.showToast({
  642. title: '您不是学生,无法申请准入',
  643. icon: "none",
  644. mask: true,
  645. duration: 2000
  646. });
  647. return
  648. }
  649. if (data.data.sysUser.userType == '2') {
  650. if (!data.data.listStudent[0]) {
  651. uni.showToast({
  652. title: '该实验室未设置准入条件',
  653. icon: "none",
  654. mask: true,
  655. duration: 2000
  656. });
  657. return
  658. }
  659. }
  660. if (data.data.listStudent) {
  661. for (let i = 0; i < data.data.listStudent.length; i++) {
  662. if (data.data.listStudent[i].materialType == 1) {
  663. data.data.listStudent[i].upList = [];
  664. }
  665. }
  666. }
  667. if (data.data.listTeacher) {
  668. for (let i = 0; i < data.data.listTeacher.length; i++) {
  669. if (data.data.listTeacher[i].materialType == 1) {
  670. data.data.listTeacher[i].upList = [];
  671. }
  672. }
  673. }
  674. this.subjectData = data.data;
  675. this.sysUser = data.data.sysUser;
  676. this.sysUser.mobile == null ? '' : this.sysUser.mobile;
  677. this.sysUser.userName == null ? '' : this.sysUser.userName;
  678. this.sysUser.cardNum == null ? '' : this.sysUser.cardNum;
  679. this.sysUser.grade == null ? '' : this.sysUser.grade;
  680. this.sysUser.tutorUserName == null ? '' : this.sysUser.tutorUserName;
  681. if (this.infoType) {
  682. this.validLength = this.infoData.labSecurityApply.validLength;
  683. for (let i = 0; i < self.infoData.listTemp.length; i++) {
  684. if (self.infoData.listTemp[i].materialType == 1) {
  685. if (self.subjectData.sysUser.userType == '2') {
  686. for (let o = 0; o < self.subjectData.listStudent.length; o++) {
  687. if (self.subjectData.listStudent[o].materialType == 1 && self.subjectData
  688. .listStudent[o].id == self.infoData.listTemp[i].id) {
  689. self.subjectData.listStudent[o].upList = JSON.parse(JSON.stringify(self
  690. .infoData.listTemp[i].upList));
  691. }
  692. }
  693. }
  694. }
  695. }
  696. }
  697. this.pageType = 1;
  698. }
  699. },
  700. //有效期选中
  701. buttonChange2(e) {
  702. console.log("e", e.mp.detail.value);
  703. this.buttonArrayIndex2 = e.mp.detail.value;
  704. this.validLength = this.buttonArray2[e.mp.detail.value].value;
  705. },
  706. //查询实验室
  707. async subjectList() {
  708. if(!this.subjectName){
  709. uni.showToast({
  710. title: '请输入实验室名称/房间号',
  711. icon: "none",
  712. mask: true,
  713. duration: 2000
  714. });
  715. return
  716. }
  717. const {
  718. data
  719. } = await systemMineGetListByPower({
  720. searchValue: this.subjectName
  721. })
  722. if (data.code == 200) {
  723. this.searchList = data.data;
  724. if (!data.data[0]) {
  725. this.nullText = "暂无数据"
  726. }
  727. }
  728. },
  729. //生成有效期
  730. addTime() {
  731. let list = [];
  732. for (let i = 1; i < 61; i++) {
  733. let obj = {
  734. name: i + "个月",
  735. value: i,
  736. }
  737. list.push(obj)
  738. }
  739. this.$set(this, 'buttonArray2', list);
  740. },
  741. },
  742. }
  743. </script>
  744. <style lang="stylus" scoped>
  745. #newApplication {
  746. height:100%;
  747. width: 100%;
  748. display flex;
  749. flex-direction column;
  750. overflow: hidden;
  751. .user-info-box {
  752. background #fff;
  753. border-radius: 20rpx;
  754. margin: 20rpx 20rpx;
  755. padding: 20rpx 0 0;
  756. .user-info-box_title {
  757. font-size: 30rpx;
  758. font-family: PingFang SC;
  759. font-weight: 500;
  760. color: #333333;
  761. line-height: 30rpx;
  762. margin-left: 24rpx;
  763. margin-bottom: 10px;
  764. }
  765. .user-info-box-min {
  766. margin: 0 26rpx;
  767. display flex;
  768. align-items center;
  769. view {
  770. line-height: 66rpx;
  771. font-size: 28rpx;
  772. }
  773. view:nth-child(1) {
  774. color: red;
  775. line-height: 28rpx;
  776. position: relative;
  777. top: 4rpx;
  778. }
  779. view:nth-child(2) {
  780. flex: 1;
  781. color: #999;
  782. }
  783. view:nth-child(3) {
  784. flex: 1;
  785. text-align right;
  786. color: #333;
  787. }
  788. >input {
  789. width 460rpx;
  790. }
  791. }
  792. .picker-title-box {
  793. padding: 0 20rpx;
  794. display flex;
  795. justify-content flex-start;
  796. align-items center;
  797. view {
  798. line-height: 80rpx;
  799. font-size: 28rpx;
  800. }
  801. view:nth-child(1) {
  802. color: red;
  803. line-height: 28rpx;
  804. }
  805. view:nth-child(2) {}
  806. view:nth-child(3) {
  807. color: #999;
  808. }
  809. }
  810. }
  811. .newApplication-page {
  812. flex:1;
  813. background #fff;
  814. margin: 20rpx 20rpx 160rpx;
  815. padding-bottom: 20rpx;
  816. border-radius: 20rpx;
  817. overflow-y: scroll;
  818. .picker-max-box {
  819. /* 申请备注 */
  820. .remark {
  821. width: 627rpx;
  822. height: 200rpx;
  823. font-size: 28rpx;
  824. margin: 0 20rpx;
  825. border: 2rpx solid #a2a2a2;
  826. border-radius: 10rpx;
  827. padding: 20rpx;
  828. }
  829. /* 申请期限 */
  830. .apply_data {
  831. width: 667rpx;
  832. height: 82rpx;
  833. background: #FFFFFF;
  834. border: 2rpx solid #A2A2A2;
  835. border-radius: 10rpx;
  836. display: flex;
  837. justify-content: space-between;
  838. align-items center;
  839. margin: 0 20rpx;
  840. padding: 0 30rpx;
  841. box-sizing border-box;
  842. >picker {
  843. >view {
  844. font-size: 28rpx;
  845. font-family: PingFang SC;
  846. font-weight: 500;
  847. color: #999999;
  848. line-height: 82rpx;
  849. }
  850. }
  851. }
  852. .picker-title-box {
  853. padding: 0 20rpx;
  854. display flex;
  855. justify-content flex-start;
  856. align-items center;
  857. view {
  858. line-height: 80rpx;
  859. font-size: 28rpx;
  860. }
  861. view:nth-child(1) {
  862. color: red;
  863. }
  864. view:nth-child(2) {}
  865. view:nth-child(3) {
  866. color: #999;
  867. }
  868. }
  869. .picker-input-box {
  870. padding: 0 20rpx;
  871. display flex;
  872. height: 80rpx;
  873. width: 627rpx;
  874. border: 1rpx solid #a2a2a2;
  875. border-radius: 10rpx;
  876. margin: 0 20rpx;
  877. }
  878. .picker-min-box {
  879. display flex;
  880. height: 80rpx;
  881. width: 667rpx;
  882. border: 1rpx solid #a2a2a2;
  883. border-radius: 10rpx;
  884. margin: 0 20rpx;
  885. view {
  886. flex: 1;
  887. line-height: 80rpx;
  888. padding: 0 20rpx;
  889. color: #999;
  890. font-size: 28rpx;
  891. }
  892. img {
  893. width: 24rpx;
  894. height: 12rpx;
  895. margin: 35rpx 23rpx;
  896. }
  897. }
  898. .picker-text-box {
  899. padding: 0 50rpx;
  900. height: 60rpx;
  901. line-height: 60rpx;
  902. font-size: 28rpx;
  903. color: #999;
  904. }
  905. .picker-text-info-box {
  906. color: #999;
  907. font-size: 28rpx;
  908. line-height: 40rpx;
  909. padding: 0 20rpx;
  910. }
  911. .picker-up-img-box {
  912. margin: 40rpx auto;
  913. width: 640rpx;
  914. height: 250rpx;
  915. border: 2px dashed #E0E0E0;
  916. border-radius: 20rpx;
  917. background: #F8F8F8;
  918. view:nth-child(1) {
  919. margin-top: 30rpx;
  920. font-size: 80rpx;
  921. color: #e0e0e0;
  922. text-align center;
  923. }
  924. view:nth-child(2) {
  925. font-weight: 700;
  926. font-size: 28rpx;
  927. color: #999;
  928. text-align center;
  929. }
  930. }
  931. .picker-for-item-box {
  932. display flex;
  933. margin: 20rpx 0;
  934. .left-img-box {
  935. margin: 0 20rpx;
  936. width: 60rpx;
  937. height: 60rpx;
  938. }
  939. .center-text-box {
  940. flex: 1;
  941. line-height: 60rpx;
  942. font-size: 28rpx;
  943. color: #333;
  944. display: block;
  945. overflow: hidden;
  946. text-overflow: ellipsis;
  947. white-space: nowrap;
  948. }
  949. .right-img-box {
  950. width: 30rpx;
  951. height: 30rpx;
  952. margin: 15rpx 20rpx;
  953. }
  954. }
  955. .up-data-button {
  956. width: 500rpx;
  957. height: 80rpx;
  958. margin: 40rpx auto;
  959. line-height: 80rpx;
  960. text-align center;
  961. font-size: 28rpx;
  962. border-radius: 10rpx;
  963. color: #0183FA;
  964. border: 1rpx dashed #0183FA;
  965. }
  966. }
  967. }
  968. .bottom-button {
  969. position fixed;
  970. bottom: 20rpx;
  971. left: 25rpx;
  972. z-index: 500;
  973. width: 700rpx;
  974. line-height: 100rpx;
  975. border-radius: 20rpx;
  976. background #0183FA;
  977. color: #fff;
  978. text-align center;
  979. }
  980. .pageTwo {
  981. flex: 1;
  982. display flex;
  983. flex-direction column;
  984. overflow-y hidden;
  985. .pageTwo-input-box {
  986. display flex;
  987. padding: 20rpx 25rpx;
  988. background #fff;
  989. margin-bottom: 20rpx;
  990. input {
  991. padding: 0 20rpx;
  992. width: 460rpx;
  993. line-height: 80rpx;
  994. height: 80rpx;
  995. border-top: 1rpx solid #a2a2a2;
  996. border-left: 1rpx solid #a2a2a2;
  997. border-bottom: 1rpx solid #a2a2a2;
  998. border-bottom-left-radius: 10rpx;
  999. border-top-left-radius: 10rpx;
  1000. }
  1001. view {
  1002. width: 200rpx;
  1003. line-height: 80rpx;
  1004. height: 80rpx;
  1005. border: 1rpx solid #007AFF;
  1006. color: #fff;
  1007. background #007AFF;
  1008. text-align center;
  1009. border-top-right-radius: 10rpx;
  1010. border-bottom-right-radius: 10rpx;
  1011. }
  1012. }
  1013. .for-max-box {
  1014. background #fff;
  1015. flex: 1;
  1016. overflow-y scroll;
  1017. .for-box:nth-child(1) {
  1018. border: none;
  1019. }
  1020. .for-null-text {
  1021. text-align center;
  1022. line-height: 100rpx;
  1023. color: #999;
  1024. }
  1025. .for-box {
  1026. border-top: 1rpx solid #dedede;
  1027. display: flex;
  1028. .button-text-view {
  1029. padding: 35rpx 35rpx 35rpx 20rpx;
  1030. width:560rpx;
  1031. }
  1032. .button-big-view {
  1033. padding: 20rpx 0 20rpx 0 ;
  1034. width: 100rpx;
  1035. display: flex;
  1036. flex-direction: column;
  1037. .button-null-view{
  1038. flex:1;
  1039. }
  1040. .button-view{
  1041. line-height:60rpx;
  1042. width: 100rpx;
  1043. text-align center;
  1044. border-radius: 10rpx;
  1045. background #007AFF;
  1046. color: #fff;
  1047. }
  1048. }
  1049. }
  1050. }
  1051. .out-button {
  1052. width: 650rpx;
  1053. height: 100rpx;
  1054. line-height: 100rpx;
  1055. margin: 20rpx 50rpx;
  1056. text-align center;
  1057. font-size: 32rpx;
  1058. color: #fff;
  1059. background #999;
  1060. border-radius: 20rpx;
  1061. }
  1062. }
  1063. .shade-max-box {
  1064. background: rgba(0, 0, 0, 0.2);
  1065. width: 100%;
  1066. height: 100%;
  1067. position fixed;
  1068. z-index 100;
  1069. .shade-big-box {
  1070. width: 626rpx;
  1071. height: 567rpx;
  1072. margin: 335rpx 63rpx;
  1073. position relative;
  1074. z-index 100;
  1075. img {
  1076. width: 626rpx;
  1077. height: 567rpx;
  1078. }
  1079. view {
  1080. position absolute;
  1081. left: 88rpx;
  1082. bottom: 100rpx;
  1083. width: 450rpx;
  1084. height: 80rpx;
  1085. line-height: 80rpx;
  1086. text-align center;
  1087. color: #fff;
  1088. background #0183FA;
  1089. border-radius: 40rpx;
  1090. }
  1091. }
  1092. }
  1093. }
  1094. /deep/.input-value-border {
  1095. display: none !important;
  1096. }
  1097. </style>