newApplication.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  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. // if (!this.sysUser.cardNumSimple) {
  370. // uni.showToast({
  371. // title: '请输入物理卡号',
  372. // icon: "none",
  373. // mask: true,
  374. // duration: 2000
  375. // });
  376. // return
  377. // }
  378. // if (!this.sysUser.gradeName) {
  379. // uni.showToast({
  380. // title: '请输入班级',
  381. // icon: "none",
  382. // mask: true,
  383. // duration: 2000
  384. // });
  385. // return
  386. // }
  387. if (!this.sysUser.tutorUserId) {
  388. uni.showToast({
  389. title: '请选择导师',
  390. icon: "none",
  391. mask: true,
  392. duration: 2000
  393. });
  394. return
  395. }
  396. let sysUser = {
  397. userName: this.sysUser.userName,
  398. userId: this.sysUser.userId,
  399. mobile: this.sysUser.mobile,
  400. account: this.sysUser.account,
  401. cardNumSimple: this.sysUser.cardNumSimple,
  402. grade: this.sysUser.gradeName,
  403. tutorUserId: this.sysUser.tutorUserId,
  404. tutorUserName: this.sysUser.tutorUserName,
  405. };
  406. let obj = {
  407. subAdminId: this.subjectData.fzrSysUser.userId, //学号/工号
  408. userNumber: this.subjectData.sysUser.account, //学号/工号
  409. userMajor: this.subjectData.sysUser.majorName, //专业
  410. userMajorId: this.subjectData.sysUser.major, //专业
  411. deptId: this.subjectData.sysUser.deptId, //NULL部门id
  412. deptName: this.subjectData.sysUser.deptName, //NULL部门名称
  413. subId: this.subject.subId, //NULL实验室id
  414. subName: this.subject.subName, //NULL实验室名称
  415. auditStatus: "0", //NULL审核状态 0待审核 1驳回 2通过
  416. //validLength: this.validLength, //NULL有效期 月份时长
  417. relList: [], //上传资料
  418. sysUserModel: sysUser, //身份卡用户信息
  419. validBeginTime: this.validBeginTime+'T00:00:00', //申请期限开始时间
  420. validEndTime: this.validEndTime+'T23:59:59', //申请期限结束时间
  421. applyCause: this.applyCause, //申请备注
  422. };
  423. if (this.subjectData.sysUser.userType == '2') {
  424. for (let i = 0; i < self.subjectData.listStudent.length; i++) {
  425. if (self.subjectData.listStudent[i].materialType == 1) {
  426. if (!self.subjectData.listStudent[i].upList[0]) {
  427. uni.showToast({
  428. title: self.subjectData.listStudent[i].materialName + "未上传",
  429. icon: "none",
  430. mask: true,
  431. duration: 2000
  432. });
  433. return
  434. } else {
  435. let upData = {
  436. materialId: self.subjectData.listStudent[i].materialId,
  437. dataName: self.subjectData.listStudent[i].materialName,
  438. dataDescribe: self.subjectData.listStudent[i].materialDescribe,
  439. dataUrl: "",
  440. };
  441. for (let o = 0; o < self.subjectData.listStudent[i].upList.length; o++) {
  442. upData.dataUrl = upData.dataUrl + self.subjectData.listStudent[i].upList[o].name +
  443. ';' + self.subjectData.listStudent[i].upList[o].url + ',';
  444. }
  445. obj.relList.push(upData);
  446. }
  447. }
  448. }
  449. }
  450. if (this.infoType) {
  451. obj.applyId = this.infoData.labSecurityApply.applyId;
  452. this.materialUpdate(obj);
  453. } else {
  454. this.materialAdd(obj);
  455. }
  456. },
  457. //删除对应材料
  458. delUpData(item, index) {
  459. item.upList.splice(index, 1);
  460. this.$forceUpdate()
  461. },
  462. itemUpData(item) {
  463. this.uploadFileName = '';
  464. this.uploadFileName = this.sysUser.userName + item.materialName; //学生上传的文件名
  465. let self = this;
  466. let fileTypeArr = item.fileType.split(',')
  467. self.strArr = [];
  468. fileTypeArr.forEach(function(item) {
  469. if (item == '1') {
  470. self.strArr.push('pdf')
  471. } else if (item == '2') {
  472. self.strArr.push('doc', 'docx')
  473. } else if (item == '3') {
  474. self.strArr.push('png', 'jpg', 'gif')
  475. }
  476. })
  477. uni.showActionSheet({
  478. itemList: ['上传文件', '上传图片'],
  479. success: function(res) {
  480. console.log(res)
  481. if (res.tapIndex == 0) {
  482. //上传文件
  483. self.upData(item);
  484. } else if (res.tapIndex == 1) {
  485. //上传图片
  486. self.upImg(item);
  487. }
  488. },
  489. fail: function(res) {
  490. console.log(res.errMsg);
  491. }
  492. });
  493. },
  494. upImg(item) {
  495. let self = this;
  496. wx.chooseImage({
  497. count: 1,
  498. sizeType: ["original", "compressed"],
  499. sourceType: ["album", "camera"],
  500. success: function(res) {
  501. console.log(res)
  502. let text = res.tempFilePaths[0].split('.')
  503. if (self.strArr.indexOf(text[1]) == -1) {
  504. uni.showToast({
  505. title: '请上传' + self.strArr.join(',') + '格式文件',
  506. icon: "none",
  507. mask: true,
  508. duration: 2000
  509. });
  510. return
  511. }
  512. if (text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' &&
  513. text[1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx') {
  514. uni.showToast({
  515. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  516. icon: "none",
  517. mask: true,
  518. duration: 2000
  519. });
  520. return
  521. }
  522. let upObj = {
  523. name: self.uploadFileName + '.' + text[1],
  524. path: res.tempFilePaths[0],
  525. type: text[1],
  526. }
  527. self.upDataFunction(item, upObj);
  528. }
  529. });
  530. },
  531. //上传文件
  532. upData(item) {
  533. let self = this;
  534. wx.chooseMessageFile({
  535. count: 1,
  536. type: 'all',
  537. success(res) {
  538. let text = res.tempFiles[0].path.split('.')
  539. if (self.strArr.indexOf(text[1]) == -1) {
  540. uni.showToast({
  541. title: '请上传' + self.strArr.join(',') + '格式文件',
  542. icon: "none",
  543. mask: true,
  544. duration: 2000
  545. });
  546. return
  547. }
  548. if (text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' && text[
  549. 1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx') {
  550. uni.showToast({
  551. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  552. icon: "none",
  553. mask: true,
  554. duration: 2000
  555. });
  556. return
  557. }
  558. let upObj = {
  559. name: self.uploadFileName + '.' + text[1],
  560. path: res.tempFiles[0].path,
  561. type: text[1],
  562. }
  563. self.upDataFunction(item, upObj);
  564. }
  565. })
  566. },
  567. async upDataFunction(item, upObj) {
  568. var self = this;
  569. uni.showLoading({
  570. title: '上传中',
  571. mask: true
  572. });
  573. uni.uploadFile({
  574. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  575. header: {
  576. 'Authorization': uni.getStorageSync('token')
  577. },
  578. filePath: upObj.path,
  579. name: 'file',
  580. formData: {
  581. 'user': 'test'
  582. },
  583. success: (uploadFileRes) => {
  584. let res = JSON.parse(uploadFileRes.data);
  585. if (res.code == 200) {
  586. let obj = {
  587. name: upObj.name,
  588. url: res.data.url,
  589. type: upObj.type
  590. }
  591. item.upList.push(obj);
  592. this.$forceUpdate();
  593. } else {
  594. uni.showToast({
  595. title: res.msg,
  596. icon: "none",
  597. mask: true,
  598. duration: 2000
  599. });
  600. }
  601. },
  602. fail: err => {},
  603. complete: () => {
  604. uni.hideLoading()
  605. }
  606. });
  607. },
  608. //选择搜索页面
  609. inputClick(type) {
  610. if (this.pageType != type) {
  611. this.pageType = type;
  612. }
  613. },
  614. //实验室选择
  615. checkClick(item) {
  616. this.$set(this, "subject", item);
  617. this.materialApply();
  618. },
  619. //获取实验室相关配置
  620. async materialApply() {
  621. let self = this;
  622. const {
  623. data
  624. } = await laboratoryAppletMaterialApply({
  625. subId: this.subject.subId
  626. })
  627. if (data.code == 200) {
  628. if (data.data.sysUser.userType != '2') {
  629. uni.showToast({
  630. title: '您不是学生,无法申请准入',
  631. icon: "none",
  632. mask: true,
  633. duration: 2000
  634. });
  635. return
  636. }
  637. if (data.data.sysUser.userType == '2') {
  638. if (!data.data.listStudent[0]) {
  639. uni.showToast({
  640. title: '该实验室未设置准入条件',
  641. icon: "none",
  642. mask: true,
  643. duration: 2000
  644. });
  645. return
  646. }
  647. }
  648. if (data.data.listStudent) {
  649. for (let i = 0; i < data.data.listStudent.length; i++) {
  650. if (data.data.listStudent[i].materialType == 1) {
  651. data.data.listStudent[i].upList = [];
  652. }
  653. }
  654. }
  655. if (data.data.listTeacher) {
  656. for (let i = 0; i < data.data.listTeacher.length; i++) {
  657. if (data.data.listTeacher[i].materialType == 1) {
  658. data.data.listTeacher[i].upList = [];
  659. }
  660. }
  661. }
  662. this.subjectData = data.data;
  663. this.sysUser = data.data.sysUser;
  664. this.sysUser.mobile == null ? '' : this.sysUser.mobile;
  665. this.sysUser.userName == null ? '' : this.sysUser.userName;
  666. this.sysUser.cardNum == null ? '' : this.sysUser.cardNum;
  667. this.sysUser.grade == null ? '' : this.sysUser.grade;
  668. this.sysUser.tutorUserName == null ? '' : this.sysUser.tutorUserName;
  669. if (this.infoType) {
  670. this.validLength = this.infoData.labSecurityApply.validLength;
  671. for (let i = 0; i < self.infoData.listTemp.length; i++) {
  672. if (self.infoData.listTemp[i].materialType == 1) {
  673. if (self.subjectData.sysUser.userType == '2') {
  674. for (let o = 0; o < self.subjectData.listStudent.length; o++) {
  675. if (self.subjectData.listStudent[o].materialType == 1 && self.subjectData
  676. .listStudent[o].id == self.infoData.listTemp[i].id) {
  677. self.subjectData.listStudent[o].upList = JSON.parse(JSON.stringify(self
  678. .infoData.listTemp[i].upList));
  679. }
  680. }
  681. }
  682. }
  683. }
  684. }
  685. this.pageType = 1;
  686. }
  687. },
  688. //有效期选中
  689. buttonChange2(e) {
  690. console.log("e", e.mp.detail.value);
  691. this.buttonArrayIndex2 = e.mp.detail.value;
  692. this.validLength = this.buttonArray2[e.mp.detail.value].value;
  693. },
  694. //查询实验室
  695. async subjectList() {
  696. if(!this.subjectName){
  697. uni.showToast({
  698. title: '请输入实验室名称/房间号',
  699. icon: "none",
  700. mask: true,
  701. duration: 2000
  702. });
  703. return
  704. }
  705. const {
  706. data
  707. } = await systemMineGetListByPower({
  708. searchValue: this.subjectName
  709. })
  710. if (data.code == 200) {
  711. this.searchList = data.data;
  712. if (!data.data[0]) {
  713. this.nullText = "暂无数据"
  714. }
  715. }
  716. },
  717. //生成有效期
  718. addTime() {
  719. let list = [];
  720. for (let i = 1; i < 61; i++) {
  721. let obj = {
  722. name: i + "个月",
  723. value: i,
  724. }
  725. list.push(obj)
  726. }
  727. this.$set(this, 'buttonArray2', list);
  728. },
  729. },
  730. }
  731. </script>
  732. <style lang="stylus" scoped>
  733. #newApplication {
  734. height:100%;
  735. width: 100%;
  736. display flex;
  737. flex-direction column;
  738. overflow: hidden;
  739. .user-info-box {
  740. background #fff;
  741. border-radius: 20rpx;
  742. margin: 20rpx 20rpx;
  743. padding: 20rpx 0 0;
  744. .user-info-box_title {
  745. font-size: 30rpx;
  746. font-family: PingFang SC;
  747. font-weight: 500;
  748. color: #333333;
  749. line-height: 30rpx;
  750. margin-left: 24rpx;
  751. margin-bottom: 10px;
  752. }
  753. .user-info-box-min {
  754. margin: 0 26rpx;
  755. display flex;
  756. align-items center;
  757. view {
  758. line-height: 66rpx;
  759. font-size: 28rpx;
  760. }
  761. view:nth-child(1) {
  762. color: red;
  763. line-height: 28rpx;
  764. position: relative;
  765. top: 4rpx;
  766. }
  767. view:nth-child(2) {
  768. flex: 1;
  769. color: #999;
  770. }
  771. view:nth-child(3) {
  772. flex: 1;
  773. text-align right;
  774. color: #333;
  775. }
  776. >input {
  777. width 460rpx;
  778. }
  779. }
  780. .picker-title-box {
  781. padding: 0 20rpx;
  782. display flex;
  783. justify-content flex-start;
  784. align-items center;
  785. view {
  786. line-height: 80rpx;
  787. font-size: 28rpx;
  788. }
  789. view:nth-child(1) {
  790. color: red;
  791. line-height: 28rpx;
  792. }
  793. view:nth-child(2) {}
  794. view:nth-child(3) {
  795. color: #999;
  796. }
  797. }
  798. }
  799. .newApplication-page {
  800. flex:1;
  801. background #fff;
  802. margin: 20rpx 20rpx 160rpx;
  803. padding-bottom: 20rpx;
  804. border-radius: 20rpx;
  805. overflow-y: scroll;
  806. .picker-max-box {
  807. /* 申请备注 */
  808. .remark {
  809. width: 627rpx;
  810. height: 200rpx;
  811. font-size: 28rpx;
  812. margin: 0 20rpx;
  813. border: 2rpx solid #a2a2a2;
  814. border-radius: 10rpx;
  815. padding: 20rpx;
  816. }
  817. /* 申请期限 */
  818. .apply_data {
  819. width: 667rpx;
  820. height: 82rpx;
  821. background: #FFFFFF;
  822. border: 2rpx solid #A2A2A2;
  823. border-radius: 10rpx;
  824. display: flex;
  825. justify-content: space-between;
  826. align-items center;
  827. margin: 0 20rpx;
  828. padding: 0 30rpx;
  829. box-sizing border-box;
  830. >picker {
  831. >view {
  832. font-size: 28rpx;
  833. font-family: PingFang SC;
  834. font-weight: 500;
  835. color: #999999;
  836. line-height: 82rpx;
  837. }
  838. }
  839. }
  840. .picker-title-box {
  841. padding: 0 20rpx;
  842. display flex;
  843. justify-content flex-start;
  844. align-items center;
  845. view {
  846. line-height: 80rpx;
  847. font-size: 28rpx;
  848. }
  849. view:nth-child(1) {
  850. color: red;
  851. }
  852. view:nth-child(2) {}
  853. view:nth-child(3) {
  854. color: #999;
  855. }
  856. }
  857. .picker-input-box {
  858. padding: 0 20rpx;
  859. display flex;
  860. height: 80rpx;
  861. width: 627rpx;
  862. border: 1rpx solid #a2a2a2;
  863. border-radius: 10rpx;
  864. margin: 0 20rpx;
  865. }
  866. .picker-min-box {
  867. display flex;
  868. height: 80rpx;
  869. width: 667rpx;
  870. border: 1rpx solid #a2a2a2;
  871. border-radius: 10rpx;
  872. margin: 0 20rpx;
  873. view {
  874. flex: 1;
  875. line-height: 80rpx;
  876. padding: 0 20rpx;
  877. color: #999;
  878. font-size: 28rpx;
  879. }
  880. img {
  881. width: 24rpx;
  882. height: 12rpx;
  883. margin: 35rpx 23rpx;
  884. }
  885. }
  886. .picker-text-box {
  887. padding: 0 50rpx;
  888. height: 60rpx;
  889. line-height: 60rpx;
  890. font-size: 28rpx;
  891. color: #999;
  892. }
  893. .picker-text-info-box {
  894. color: #999;
  895. font-size: 28rpx;
  896. line-height: 40rpx;
  897. padding: 0 20rpx;
  898. }
  899. .picker-up-img-box {
  900. margin: 40rpx auto;
  901. width: 640rpx;
  902. height: 250rpx;
  903. border: 2px dashed #E0E0E0;
  904. border-radius: 20rpx;
  905. background: #F8F8F8;
  906. view:nth-child(1) {
  907. margin-top: 30rpx;
  908. font-size: 80rpx;
  909. color: #e0e0e0;
  910. text-align center;
  911. }
  912. view:nth-child(2) {
  913. font-weight: 700;
  914. font-size: 28rpx;
  915. color: #999;
  916. text-align center;
  917. }
  918. }
  919. .picker-for-item-box {
  920. display flex;
  921. margin: 20rpx 0;
  922. .left-img-box {
  923. margin: 0 20rpx;
  924. width: 60rpx;
  925. height: 60rpx;
  926. }
  927. .center-text-box {
  928. flex: 1;
  929. line-height: 60rpx;
  930. font-size: 28rpx;
  931. color: #333;
  932. display: block;
  933. overflow: hidden;
  934. text-overflow: ellipsis;
  935. white-space: nowrap;
  936. }
  937. .right-img-box {
  938. width: 30rpx;
  939. height: 30rpx;
  940. margin: 15rpx 20rpx;
  941. }
  942. }
  943. .up-data-button {
  944. width: 500rpx;
  945. height: 80rpx;
  946. margin: 40rpx auto;
  947. line-height: 80rpx;
  948. text-align center;
  949. font-size: 28rpx;
  950. border-radius: 10rpx;
  951. color: #0183FA;
  952. border: 1rpx dashed #0183FA;
  953. }
  954. }
  955. }
  956. .bottom-button {
  957. position fixed;
  958. bottom: 20rpx;
  959. left: 25rpx;
  960. z-index: 500;
  961. width: 700rpx;
  962. line-height: 100rpx;
  963. border-radius: 20rpx;
  964. background #0183FA;
  965. color: #fff;
  966. text-align center;
  967. }
  968. .pageTwo {
  969. flex: 1;
  970. display flex;
  971. flex-direction column;
  972. overflow-y hidden;
  973. .pageTwo-input-box {
  974. display flex;
  975. padding: 20rpx 25rpx;
  976. background #fff;
  977. margin-bottom: 20rpx;
  978. input {
  979. padding: 0 20rpx;
  980. width: 460rpx;
  981. line-height: 80rpx;
  982. height: 80rpx;
  983. border-top: 1rpx solid #a2a2a2;
  984. border-left: 1rpx solid #a2a2a2;
  985. border-bottom: 1rpx solid #a2a2a2;
  986. border-bottom-left-radius: 10rpx;
  987. border-top-left-radius: 10rpx;
  988. }
  989. view {
  990. width: 200rpx;
  991. line-height: 80rpx;
  992. height: 80rpx;
  993. border: 1rpx solid #007AFF;
  994. color: #fff;
  995. background #007AFF;
  996. text-align center;
  997. border-top-right-radius: 10rpx;
  998. border-bottom-right-radius: 10rpx;
  999. }
  1000. }
  1001. .for-max-box {
  1002. background #fff;
  1003. flex: 1;
  1004. overflow-y scroll;
  1005. .for-box:nth-child(1) {
  1006. border: none;
  1007. }
  1008. .for-null-text {
  1009. text-align center;
  1010. line-height: 100rpx;
  1011. color: #999;
  1012. }
  1013. .for-box {
  1014. border-top: 1rpx solid #dedede;
  1015. display: flex;
  1016. .button-text-view {
  1017. padding: 35rpx 35rpx 35rpx 20rpx;
  1018. width:560rpx;
  1019. }
  1020. .button-big-view {
  1021. padding: 20rpx 0 20rpx 0 ;
  1022. width: 100rpx;
  1023. display: flex;
  1024. flex-direction: column;
  1025. .button-null-view{
  1026. flex:1;
  1027. }
  1028. .button-view{
  1029. line-height:60rpx;
  1030. width: 100rpx;
  1031. text-align center;
  1032. border-radius: 10rpx;
  1033. background #007AFF;
  1034. color: #fff;
  1035. }
  1036. }
  1037. }
  1038. }
  1039. .out-button {
  1040. width: 650rpx;
  1041. height: 100rpx;
  1042. line-height: 100rpx;
  1043. margin: 20rpx 50rpx;
  1044. text-align center;
  1045. font-size: 32rpx;
  1046. color: #fff;
  1047. background #999;
  1048. border-radius: 20rpx;
  1049. }
  1050. }
  1051. .shade-max-box {
  1052. background: rgba(0, 0, 0, 0.2);
  1053. width: 100%;
  1054. height: 100%;
  1055. position fixed;
  1056. z-index 100;
  1057. .shade-big-box {
  1058. width: 626rpx;
  1059. height: 567rpx;
  1060. margin: 335rpx 63rpx;
  1061. position relative;
  1062. z-index 100;
  1063. img {
  1064. width: 626rpx;
  1065. height: 567rpx;
  1066. }
  1067. view {
  1068. position absolute;
  1069. left: 88rpx;
  1070. bottom: 100rpx;
  1071. width: 450rpx;
  1072. height: 80rpx;
  1073. line-height: 80rpx;
  1074. text-align center;
  1075. color: #fff;
  1076. background #0183FA;
  1077. border-radius: 40rpx;
  1078. }
  1079. }
  1080. }
  1081. }
  1082. /deep/.input-value-border {
  1083. display: none !important;
  1084. }
  1085. </style>