newApplication.vue 28 KB

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