newApplication.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274
  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" v-if="userType == 2">
  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-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="agreement-box" v-if="pageType == 1 && subject.subId">
  135. <img @click="buttonAgreement()" v-if="!agreementType" :src="imagesUrl('commonality/icon_12.png')">
  136. <img @click="buttonAgreement()" v-if="agreementType" :src="imagesUrl('commonality/icon_13.png')">
  137. <p @click="buttonAgreement()" class="text-1">我已阅读并同意</p>
  138. <p class="text-2" @click="shadeButton(1)">《实验室开放管理规定》</p>
  139. </view>
  140. <view class="bottom-button" v-if="pageType == 1" @click="upDataButton()">
  141. {{infoType?'准入材料修改完毕,重新提交':'准入材料上传完毕,提交申请'}}
  142. </view>
  143. <view class="shade-max-box" v-if="shadeType">
  144. <view class="shade-big-box">
  145. <img :src="imagesUrl('student/img_zrsq_bg.png')">
  146. <view @click="pageBack">返回</view>
  147. </view>
  148. </view>
  149. <view class="shade-text-max-big-box" v-if="agreementShadeType">
  150. <view v-html="agreementText"></view>
  151. <view class="shade-text-button-box">
  152. <view class="shade-text-null-p"></view>
  153. <view @click="shadeButton(3)">取消</view>
  154. <view class="shade-text-null-p"></view>
  155. <view @click="shadeButton(2)">确定</view>
  156. <view class="shade-text-null-p"></view>
  157. </view>
  158. </view>
  159. </view>
  160. </template>
  161. <script>
  162. import {
  163. subjectList,
  164. materialApply,
  165. materialUpdate,
  166. materialAdd,
  167. teacherApply
  168. } from '@/api/apiDemo/index.js'
  169. import {
  170. systemUserDropList
  171. } from '@/api/commonality/permission.js'
  172. import {
  173. systemMineGetListByPower,
  174. laboratoryAppletMaterialApply,
  175. laboratoryAppletMaterialAdd,
  176. laboratoryAppletMaterialUpdate,
  177. } from '@/pages_student/api/index.js'
  178. import {
  179. config
  180. } from '@/api/request/config.js'
  181. export default {
  182. data() {
  183. return {
  184. baseUrl: config.base_url,
  185. pageType: 2,
  186. shadeType: false,
  187. //有效期
  188. buttonArray2: [],
  189. buttonArrayIndex2: 11,
  190. //搜索回的实验室列表
  191. searchList: [],
  192. //选择的实验室数据
  193. subject: {},
  194. //暂无数据提示
  195. nullText: "请输入实验室名称进行搜索",
  196. //实验室名称
  197. subjectName: "",
  198. //有效期
  199. validLength: "12",
  200. //获取的实验室配置数据
  201. subjectData: {},
  202. //是否是编辑状态
  203. infoType: false,
  204. //编辑参数
  205. infoData: {},
  206. validBeginTime: '', //申请期限开始
  207. validEndTime: '', //申请期限结束
  208. applyCause: '', //申请备注
  209. sysUser: {},
  210. tutorUserList: [],
  211. strArr: [], //存储类型
  212. currentDate: '', //当前日期
  213. uploadFileName: '', //学生上传的文件名
  214. userType:uni.getStorageSync('userType'),
  215. agreementType:false,
  216. agreementShadeType:false,
  217. agreementText:'<p>根据学校出台的《实验室安全管理办法》和《实验室安全事故追责实施细则(暂行)》文件的相关规定,为加强实验室安全管理,实验室安全工作严格按照&quot;谁使用、谁负责,谁主管、谁负责”的原则,自即日起,任何人未经允许不得擅自进入实验室,违者将按照学校相关规定,严肃追责处理。</p><p><span style="font-size: 18px;"><strong>一、进入教学实验室的程序</strong></span></p><p>1、学生提出申请,到中心办公室填写资源环境学院实验中心开放实验室使用申请表(附件1)、资源环境学院实验室安全管理责任书(附件2)。</p><p>2、由学生、实验室管理人员、导师三方签字同意,实验中心主任审批,方可进入实验室。</p><p>3、审核后的申请表一份送交到相关实验室管理者,一份申请者放在实验室作为进入证明,方便核验。</p><p>4、学生进入实验室,必须认真学习、严格遵守实验室的各种规章制度,做好安全防护工作和危化品使用等安全事项,严格按照操作规程使用仪器设备,做好各种记录。</p><p>5、实验室实行值班制,由谁主管的实验室接受进入实验室,谁就要负责全程监管实验室安全,实验中实验室至少有一名指导教师或一名实验室工作人员在场,负责实验安全指导、仪器设备调整与维护,解答学生实验过程的疑难问题,对所做实验进行认定,并认真做好使用情况记录。</p><p><span style="font-size: 18px;"><strong>二、奖惩</strong></span></p><p>1、学生实验过程中,实验室工作人员、指导教师和参加实验的学生应认真负责,对于在实验过程中出现的水患、火灾以及设备损坏等问题必须严肃追究当事人责任,并给予相应的处罚。</p><p>2、对于未按规定进行操作或者未进行登记者,实验室工作人员有权终止其进入实验室。</p><p>3、对于私自进入实验室工作人员,年终一律不得评优,绩效津贴视情节给予扣除,并在全院通报批评。</p><p><span style="font-size: 18px;"><strong>三、管理</strong></span></p><p>中心将不定期组织相关人员对实验室进行安全检查,一经发现有违规情况和安全隐患,随时终止实验室的使用权利并严肃追责。本办法自公布之日起实施,具体内容由本科教学中心负责解释。</p><p><br/></p>',
  218. }
  219. },
  220. onLoad(option) {
  221. if (option.item) {
  222. let newItem = JSON.parse(decodeURIComponent(option.item));
  223. let newObj = {
  224. deptId: newItem.labSecurityApply.deptId,
  225. deptName: newItem.labSecurityApply.deptName,
  226. subId: newItem.labSecurityApply.subId,
  227. subName: newItem.labSecurityApply.subName,
  228. }
  229. this.$set(this, 'validBeginTime', newItem.labSecurityApply.validBeginTime.split(' ')[0])
  230. this.$set(this, 'validEndTime', newItem.labSecurityApply.validEndTime.split(' ')[0])
  231. this.$set(this, 'applyCause', newItem.labSecurityApply.applyCause)
  232. this.$set(this, 'subject', newObj)
  233. this.$set(this, 'infoData', newItem)
  234. this.$set(this, 'infoType', true)
  235. this.$set(this, 'pageType', 2)
  236. this.materialApply();
  237. }
  238. },
  239. onShow() {
  240. this.addTime();
  241. this.clearData();
  242. this.currentDate = this.getdate();
  243. // console.log('时间')
  244. // console.log(this.currentDate)
  245. },
  246. methods: {
  247. shadeButton(type){
  248. if(type == 1){
  249. this.$set(this,'agreementShadeType',true);
  250. }else if(type == 2){
  251. this.$set(this,'agreementType',true);
  252. this.$set(this,'agreementShadeType',false);
  253. }else if(type == 3){
  254. this.$set(this,'agreementShadeType',false);
  255. }
  256. },
  257. buttonAgreement(){
  258. this.$set(this,'agreementType',!this.agreementType);
  259. },
  260. getdate() {
  261. var date = new Date();
  262. var seperator1 = "-";
  263. var year = date.getFullYear();
  264. var month = date.getMonth() + 1;
  265. var strDate = date.getDate();
  266. if (month >= 1 && month <= 9) {
  267. month = "0" + month;
  268. }
  269. if (strDate >= 0 && strDate <= 9) {
  270. strDate = "0" + strDate;
  271. }
  272. var currentdate = year + "-" + month + "-" + strDate;
  273. return currentdate;
  274. },
  275. //清除
  276. clearData() {
  277. this.tutorUserList = [];
  278. },
  279. //导师查询
  280. async tutorUserNameClick() {
  281. let self = this
  282. self.tutorUserList = []
  283. let obj = {
  284. userName: this.sysUser.tutorUserName,
  285. userType: '1'
  286. }
  287. const {
  288. data
  289. } = await systemUserDropList(obj)
  290. if (data.code == 200) {
  291. console.log(data)
  292. data.data.forEach(function(item) {
  293. self.tutorUserList.push({
  294. text: item.userName,
  295. value: item.userId,
  296. })
  297. })
  298. console.log(self.tutorUserList)
  299. self.$refs.picker.show()
  300. }
  301. },
  302. bindPickerChange: function(e) {
  303. let self = this;
  304. console.log('picker发送选择改变,携带值为', e.detail.value)
  305. let data = e.detail.value;
  306. data.forEach(function(item) {
  307. self.sysUser.tutorUserName = item.text
  308. self.sysUser.tutorUserId = item.value
  309. })
  310. },
  311. //时间选择触发-开始
  312. beginDateChange(data) {
  313. this.validBeginTime = data.detail.value;
  314. },
  315. endDateChange(data) {
  316. this.validEndTime = data.detail.value;
  317. },
  318. pageBack() {
  319. if (this.infoType) {
  320. uni.navigateBack({
  321. delta: 2
  322. });
  323. }else{
  324. uni.navigateBack();
  325. }
  326. },
  327. //申请编辑
  328. async materialUpdate(obj) {
  329. const {
  330. data
  331. } = await laboratoryAppletMaterialUpdate(obj)
  332. if (data.code == 200) {
  333. this.shadeType = true;
  334. }
  335. },
  336. //申请提交
  337. async materialAdd(obj) {
  338. const {
  339. data
  340. } = await laboratoryAppletMaterialAdd(obj)
  341. if (data.code == 200) {
  342. this.shadeType = true;
  343. }
  344. },
  345. //提交按钮
  346. upDataButton() {
  347. let self = this;
  348. if (!this.subject.subId) {
  349. uni.showToast({
  350. title: '请选择实验室',
  351. icon: "none",
  352. mask: true,
  353. duration: 2000
  354. });
  355. return
  356. }
  357. if (!this.validBeginTime) {
  358. uni.showToast({
  359. title: '请选择开始时间',
  360. icon: "none",
  361. mask: true,
  362. duration: 2000
  363. });
  364. return
  365. }
  366. if (!this.validEndTime) {
  367. uni.showToast({
  368. title: '请选择结束时间',
  369. icon: "none",
  370. mask: true,
  371. duration: 2000
  372. });
  373. return
  374. }
  375. if (!this.sysUser.userName) {
  376. uni.showToast({
  377. title: '请输入申请人',
  378. icon: "none",
  379. mask: true,
  380. duration: 2000
  381. });
  382. return
  383. }
  384. if (!this.sysUser.mobile) {
  385. uni.showToast({
  386. title: '请输入联系电话',
  387. icon: "none",
  388. mask: true,
  389. duration: 2000
  390. });
  391. return
  392. }
  393. if (!this.sysUser.account) {
  394. uni.showToast({
  395. title: '请输入学号',
  396. icon: "none",
  397. mask: true,
  398. duration: 2000
  399. });
  400. return
  401. }
  402. let playTime = Math.floor(new Date(this.validBeginTime).getTime() / 1000);
  403. let endTime = Math.floor(new Date(this.validEndTime).getTime() / 1000);
  404. if(playTime > endTime){
  405. uni.showToast({
  406. title: '开始时间不能大于结束时间',
  407. icon: "none",
  408. mask: true,
  409. duration: 2000
  410. });
  411. return
  412. }
  413. // if (!this.sysUser.cardNumSimple) {
  414. // uni.showToast({
  415. // title: '请输入物理卡号',
  416. // icon: "none",
  417. // mask: true,
  418. // duration: 2000
  419. // });
  420. // return
  421. // }
  422. // if (!this.sysUser.gradeName) {
  423. // uni.showToast({
  424. // title: '请输入班级',
  425. // icon: "none",
  426. // mask: true,
  427. // duration: 2000
  428. // });
  429. // return
  430. // }
  431. if(this.userType == 2){
  432. if (!this.sysUser.tutorUserId) {
  433. uni.showToast({
  434. title: '请选择导师',
  435. icon: "none",
  436. mask: true,
  437. duration: 2000
  438. });
  439. return
  440. }
  441. }
  442. if (!this.agreementType) {
  443. uni.showToast({
  444. title: '请确认并勾选 《实验室开放管理规定》',
  445. icon: "none",
  446. mask: true,
  447. duration: 2000
  448. });
  449. return
  450. }
  451. let sysUser = {
  452. userName: this.sysUser.userName,
  453. userId: this.sysUser.userId,
  454. mobile: this.sysUser.mobile,
  455. account: this.sysUser.account,
  456. cardNumSimple: this.sysUser.cardNumSimple,
  457. grade: this.sysUser.gradeName,
  458. tutorUserId: this.sysUser.tutorUserId,
  459. tutorUserName: this.sysUser.tutorUserName,
  460. };
  461. let obj = {
  462. subAdminId: this.subjectData.fzrSysUser.userId, //学号/工号
  463. userNumber: this.subjectData.sysUser.account, //学号/工号
  464. userMajor: this.subjectData.sysUser.majorName, //专业
  465. userMajorId: this.subjectData.sysUser.major, //专业
  466. deptId: this.subjectData.sysUser.deptId, //NULL部门id
  467. deptName: this.subjectData.sysUser.deptName, //NULL部门名称
  468. subId: this.subject.subId, //NULL实验室id
  469. subName: this.subject.subName, //NULL实验室名称
  470. roomNum: this.subject.roomNum, //NULL实验室名称
  471. auditStatus: "0", //NULL审核状态 0待审核 1驳回 2通过
  472. //validLength: this.validLength, //NULL有效期 月份时长
  473. relList: [], //上传资料
  474. sysUserModel: sysUser, //身份卡用户信息
  475. validBeginTime: this.validBeginTime+'T00:00:00', //申请期限开始时间
  476. validEndTime: this.validEndTime+'T23:59:59', //申请期限结束时间
  477. applyCause: this.applyCause, //申请备注
  478. };
  479. for (let i = 0; i < self.subjectData.listStudent.length; i++) {
  480. if (self.subjectData.listStudent[i].materialType == 1) {
  481. if (!self.subjectData.listStudent[i].upList[0]) {
  482. uni.showToast({
  483. title: self.subjectData.listStudent[i].materialName + "未上传",
  484. icon: "none",
  485. mask: true,
  486. duration: 2000
  487. });
  488. return
  489. } else {
  490. let upData = {
  491. materialId: self.subjectData.listStudent[i].materialId,
  492. dataName: self.subjectData.listStudent[i].materialName,
  493. dataDescribe: self.subjectData.listStudent[i].materialDescribe,
  494. dataUrl: "",
  495. };
  496. for (let o = 0; o < self.subjectData.listStudent[i].upList.length; o++) {
  497. upData.dataUrl = upData.dataUrl + self.subjectData.listStudent[i].upList[o].name +
  498. ';' + self.subjectData.listStudent[i].upList[o].url + ',';
  499. }
  500. obj.relList.push(upData);
  501. }
  502. }
  503. }
  504. if (this.infoType) {
  505. obj.applyId = this.infoData.labSecurityApply.applyId;
  506. this.materialUpdate(obj);
  507. } else {
  508. this.materialAdd(obj);
  509. }
  510. },
  511. //删除对应材料
  512. delUpData(item, index) {
  513. item.upList.splice(index, 1);
  514. this.$forceUpdate()
  515. },
  516. itemUpData(item) {
  517. this.uploadFileName = '';
  518. this.uploadFileName = this.sysUser.userName + item.materialName; //学生上传的文件名
  519. let self = this;
  520. let fileTypeArr = item.fileType.split(',')
  521. self.strArr = [];
  522. fileTypeArr.forEach(function(item) {
  523. if (item == '1') {
  524. self.strArr.push('pdf')
  525. } else if (item == '2') {
  526. self.strArr.push('doc', 'docx')
  527. } else if (item == '3') {
  528. self.strArr.push('png', 'jpg', 'gif')
  529. }
  530. })
  531. uni.showActionSheet({
  532. itemList: ['上传文件', '上传图片'],
  533. success: function(res) {
  534. console.log(res)
  535. if (res.tapIndex == 0) {
  536. //上传文件
  537. self.upData(item);
  538. } else if (res.tapIndex == 1) {
  539. //上传图片
  540. self.upImg(item);
  541. }
  542. },
  543. fail: function(res) {
  544. console.log(res.errMsg);
  545. }
  546. });
  547. },
  548. upImg(item) {
  549. let self = this;
  550. uni.chooseImage({
  551. count: 1,
  552. sizeType: ["original", "compressed"],
  553. sourceType: ["album", "camera"],
  554. success: function(res) {
  555. // #ifdef WEB
  556. let text = res.tempFiles[0].name.split('.')
  557. // #endif
  558. // #ifdef MP-WEIXIN
  559. let text = res.tempFilePaths[0].split('.')
  560. // #endif
  561. if (self.strArr.indexOf(text[1]) == -1) {
  562. uni.showToast({
  563. title: '请上传' + self.strArr.join(',') + '格式文件',
  564. icon: "none",
  565. mask: true,
  566. duration: 2000
  567. });
  568. return
  569. }
  570. if (text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' &&
  571. text[1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx') {
  572. uni.showToast({
  573. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  574. icon: "none",
  575. mask: true,
  576. duration: 2000
  577. });
  578. return
  579. }
  580. let upObj = {
  581. name: self.uploadFileName + '.' + text[1],
  582. path: res.tempFilePaths[0],
  583. type: text[1],
  584. }
  585. self.upDataFunction(item, upObj);
  586. }
  587. });
  588. },
  589. //上传文件
  590. upData(item) {
  591. let self = this;
  592. // #ifdef WEB
  593. let arr = [];
  594. for(let i=0;i<self.strArr.length;i++){
  595. arr.push('.'+self.strArr[i])
  596. }
  597. uni.chooseFile({
  598. count: 6, //默认100
  599. extension:arr,
  600. success: function (res) {
  601. let text = res.tempFiles[0].name.split('.')
  602. let upObj = {
  603. name: res.tempFiles[0].name,
  604. path: res.tempFiles[0].path,
  605. type: text[1],
  606. }
  607. self.upDataFunction(item, upObj);
  608. }
  609. });
  610. // #endif
  611. // #ifdef MP-WEIXIN
  612. wx.chooseMessageFile({
  613. count: 1,
  614. type: 'all',
  615. success(res) {
  616. let text = res.tempFiles[0].path.split('.')
  617. if (self.strArr.indexOf(text[1]) == -1) {
  618. uni.showToast({
  619. title: '请上传' + self.strArr.join(',') + '格式文件',
  620. icon: "none",
  621. mask: true,
  622. duration: 2000
  623. });
  624. return
  625. }
  626. if (text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' && text[
  627. 1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx') {
  628. uni.showToast({
  629. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  630. icon: "none",
  631. mask: true,
  632. duration: 2000
  633. });
  634. return
  635. }
  636. let upObj = {
  637. name: self.uploadFileName + '.' + text[1],
  638. path: res.tempFiles[0].path,
  639. type: text[1],
  640. }
  641. self.upDataFunction(item, upObj);
  642. }
  643. })
  644. // #endif
  645. },
  646. async upDataFunction(item, upObj) {
  647. var self = this;
  648. uni.showLoading({
  649. title: '上传中',
  650. mask: true
  651. });
  652. uni.uploadFile({
  653. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  654. header: {
  655. 'Authorization': uni.getStorageSync('token')
  656. },
  657. filePath: upObj.path,
  658. name: 'file',
  659. formData: {
  660. 'user': 'test'
  661. },
  662. success: (uploadFileRes) => {
  663. let res = JSON.parse(uploadFileRes.data);
  664. if (res.code == 200) {
  665. let obj = {
  666. name: upObj.name,
  667. url: res.data.url,
  668. type: upObj.type
  669. }
  670. item.upList.push(obj);
  671. this.$forceUpdate();
  672. } else {
  673. uni.showToast({
  674. title: res.msg,
  675. icon: "none",
  676. mask: true,
  677. duration: 2000
  678. });
  679. }
  680. },
  681. fail: err => {},
  682. complete: () => {
  683. uni.hideLoading()
  684. }
  685. });
  686. },
  687. //选择搜索页面
  688. inputClick(type) {
  689. if (this.pageType != type) {
  690. this.pageType = type;
  691. }
  692. },
  693. //实验室选择
  694. checkClick(item) {
  695. this.$set(this, "subject", item);
  696. this.materialApply(item);
  697. },
  698. //获取实验室相关配置
  699. async materialApply(item) {
  700. let self = this;
  701. const {
  702. data
  703. } = await laboratoryAppletMaterialApply({
  704. subId: this.subject.subId
  705. })
  706. if (data.code == 200) {
  707. if (!data.data.listStudent[0]) {
  708. uni.showToast({
  709. title: '该实验室未设置准入条件',
  710. icon: "none",
  711. mask: true,
  712. duration: 2000
  713. });
  714. return
  715. }
  716. this.$set(this, "subject", item);
  717. if (data.data.listStudent) {
  718. for (let i = 0; i < data.data.listStudent.length; i++) {
  719. if (data.data.listStudent[i].materialType == 1) {
  720. data.data.listStudent[i].upList = [];
  721. }
  722. }
  723. }
  724. if (data.data.listTeacher) {
  725. for (let i = 0; i < data.data.listTeacher.length; i++) {
  726. if (data.data.listTeacher[i].materialType == 1) {
  727. data.data.listTeacher[i].upList = [];
  728. }
  729. }
  730. }
  731. this.subjectData = data.data;
  732. this.sysUser = data.data.sysUser;
  733. this.sysUser.mobile == null ? '' : this.sysUser.mobile;
  734. this.sysUser.userName == null ? '' : this.sysUser.userName;
  735. this.sysUser.cardNum == null ? '' : this.sysUser.cardNum;
  736. this.sysUser.grade == null ? '' : this.sysUser.grade;
  737. this.sysUser.tutorUserName == null ? '' : this.sysUser.tutorUserName;
  738. if (this.infoType) {
  739. this.validLength = this.infoData.labSecurityApply.validLength;
  740. for (let i = 0; i < self.infoData.listTemp.length; i++) {
  741. if (self.infoData.listTemp[i].materialType == 1) {
  742. for (let o = 0; o < self.subjectData.listStudent.length; o++) {
  743. if (self.subjectData.listStudent[o].materialType == 1 && self.subjectData
  744. .listStudent[o].id == self.infoData.listTemp[i].id) {
  745. self.subjectData.listStudent[o].upList = JSON.parse(JSON.stringify(self
  746. .infoData.listTemp[i].upList));
  747. }
  748. }
  749. }
  750. }
  751. }
  752. this.pageType = 1;
  753. }
  754. },
  755. //有效期选中
  756. buttonChange2(e) {
  757. console.log("e", e.mp.detail.value);
  758. this.buttonArrayIndex2 = e.mp.detail.value;
  759. this.validLength = this.buttonArray2[e.mp.detail.value].value;
  760. },
  761. //查询实验室
  762. async subjectList() {
  763. if(!this.subjectName){
  764. uni.showToast({
  765. title: '请输入实验室名称/房间号',
  766. icon: "none",
  767. mask: true,
  768. duration: 2000
  769. });
  770. return
  771. }
  772. const {
  773. data
  774. } = await systemMineGetListByPower({
  775. searchValue: this.subjectName
  776. })
  777. if (data.code == 200) {
  778. this.searchList = data.data;
  779. if (!data.data[0]) {
  780. this.nullText = "暂无数据"
  781. }
  782. }
  783. },
  784. //生成有效期
  785. addTime() {
  786. let list = [];
  787. for (let i = 1; i < 61; i++) {
  788. let obj = {
  789. name: i + "个月",
  790. value: i,
  791. }
  792. list.push(obj)
  793. }
  794. this.$set(this, 'buttonArray2', list);
  795. },
  796. },
  797. }
  798. </script>
  799. <style lang="stylus" scoped>
  800. #newApplication {
  801. height:100%;
  802. width: 100%;
  803. display flex;
  804. flex-direction column;
  805. overflow: hidden;
  806. .user-info-box {
  807. background #fff;
  808. border-radius: 20rpx;
  809. margin: 20rpx 20rpx;
  810. padding: 20rpx 0 0;
  811. .user-info-box_title {
  812. font-size: 30rpx;
  813. font-family: PingFang SC;
  814. font-weight: 500;
  815. color: #333333;
  816. line-height: 30rpx;
  817. margin-left: 24rpx;
  818. margin-bottom: 10px;
  819. }
  820. .user-info-box-min {
  821. margin: 0 26rpx;
  822. display flex;
  823. align-items center;
  824. view {
  825. line-height: 66rpx;
  826. font-size: 28rpx;
  827. }
  828. view:nth-child(1) {
  829. color: red;
  830. line-height: 28rpx;
  831. position: relative;
  832. top: 4rpx;
  833. }
  834. view:nth-child(2) {
  835. flex: 1;
  836. color: #999;
  837. }
  838. view:nth-child(3) {
  839. flex: 1;
  840. text-align right;
  841. color: #333;
  842. }
  843. >input {
  844. width 460rpx;
  845. }
  846. }
  847. .picker-title-box {
  848. padding: 0 20rpx;
  849. display flex;
  850. justify-content flex-start;
  851. align-items center;
  852. view {
  853. line-height: 80rpx;
  854. font-size: 28rpx;
  855. }
  856. view:nth-child(1) {
  857. color: red;
  858. line-height: 28rpx;
  859. }
  860. view:nth-child(2) {}
  861. view:nth-child(3) {
  862. color: #999;
  863. }
  864. }
  865. }
  866. .newApplication-page {
  867. flex:1;
  868. background #fff;
  869. margin: 20rpx 20rpx 0;
  870. padding-bottom: 20rpx;
  871. border-radius: 20rpx;
  872. overflow-y: scroll;
  873. .picker-max-box {
  874. /* 申请备注 */
  875. .remark {
  876. width: 627rpx;
  877. height: 200rpx;
  878. font-size: 28rpx;
  879. margin: 0 20rpx;
  880. border: 2rpx solid #a2a2a2;
  881. border-radius: 10rpx;
  882. padding: 20rpx;
  883. }
  884. /* 申请期限 */
  885. .apply_data {
  886. width: 667rpx;
  887. height: 82rpx;
  888. background: #FFFFFF;
  889. border: 2rpx solid #A2A2A2;
  890. border-radius: 10rpx;
  891. display: flex;
  892. justify-content: space-between;
  893. align-items center;
  894. margin: 0 20rpx;
  895. padding: 0 30rpx;
  896. box-sizing border-box;
  897. >picker {
  898. >view {
  899. font-size: 28rpx;
  900. font-family: PingFang SC;
  901. font-weight: 500;
  902. color: #999999;
  903. line-height: 82rpx;
  904. }
  905. }
  906. }
  907. .picker-title-box {
  908. padding: 0 20rpx;
  909. display flex;
  910. justify-content flex-start;
  911. align-items center;
  912. view {
  913. line-height: 80rpx;
  914. font-size: 28rpx;
  915. }
  916. view:nth-child(1) {
  917. color: red;
  918. }
  919. view:nth-child(2) {}
  920. view:nth-child(3) {
  921. color: #999;
  922. }
  923. }
  924. .picker-input-box {
  925. padding: 0 20rpx;
  926. display flex;
  927. height: 80rpx;
  928. width: 627rpx;
  929. border: 1rpx solid #a2a2a2;
  930. border-radius: 10rpx;
  931. margin: 0 20rpx;
  932. }
  933. .picker-min-box {
  934. display flex;
  935. height: 80rpx;
  936. width: 667rpx;
  937. border: 1rpx solid #a2a2a2;
  938. border-radius: 10rpx;
  939. margin: 0 20rpx;
  940. view {
  941. flex: 1;
  942. line-height: 80rpx;
  943. padding: 0 20rpx;
  944. color: #999;
  945. font-size: 28rpx;
  946. }
  947. img {
  948. width: 24rpx;
  949. height: 12rpx;
  950. margin: 35rpx 23rpx;
  951. }
  952. }
  953. .picker-text-box {
  954. padding: 0 50rpx;
  955. height: 60rpx;
  956. line-height: 60rpx;
  957. font-size: 28rpx;
  958. color: #999;
  959. }
  960. .picker-text-info-box {
  961. color: #999;
  962. font-size: 28rpx;
  963. line-height: 40rpx;
  964. padding: 0 20rpx;
  965. }
  966. .picker-up-img-box {
  967. margin: 40rpx auto;
  968. width: 640rpx;
  969. height: 250rpx;
  970. border: 2px dashed #E0E0E0;
  971. border-radius: 20rpx;
  972. background: #F8F8F8;
  973. view:nth-child(1) {
  974. margin-top: 30rpx;
  975. font-size: 80rpx;
  976. color: #e0e0e0;
  977. text-align center;
  978. }
  979. view:nth-child(2) {
  980. font-weight: 700;
  981. font-size: 28rpx;
  982. color: #999;
  983. text-align center;
  984. }
  985. }
  986. .picker-for-item-box {
  987. display flex;
  988. margin: 20rpx 0;
  989. .left-img-box {
  990. margin: 0 20rpx;
  991. width: 60rpx;
  992. height: 60rpx;
  993. }
  994. .center-text-box {
  995. flex: 1;
  996. line-height: 60rpx;
  997. font-size: 28rpx;
  998. color: #333;
  999. display: block;
  1000. overflow: hidden;
  1001. text-overflow: ellipsis;
  1002. white-space: nowrap;
  1003. }
  1004. .right-img-box {
  1005. width: 30rpx;
  1006. height: 30rpx;
  1007. margin: 15rpx 20rpx;
  1008. }
  1009. }
  1010. .up-data-button {
  1011. width: 500rpx;
  1012. height: 80rpx;
  1013. margin: 40rpx auto;
  1014. line-height: 80rpx;
  1015. text-align center;
  1016. font-size: 28rpx;
  1017. border-radius: 10rpx;
  1018. color: #0183FA;
  1019. border: 1rpx dashed #0183FA;
  1020. }
  1021. }
  1022. }
  1023. .agreement-box{
  1024. display: flex
  1025. margin-bottom:160rpx;
  1026. margin-top:40rpx;
  1027. img{
  1028. width:40rpx;
  1029. height:40rpx;
  1030. margin: 0 20rpx 0 70rpx;
  1031. }
  1032. .text-2{
  1033. color:#0183FA;
  1034. }
  1035. }
  1036. .bottom-button {
  1037. position fixed;
  1038. bottom: 20rpx;
  1039. left: 25rpx;
  1040. z-index: 500;
  1041. width: 700rpx;
  1042. line-height: 100rpx;
  1043. border-radius: 20rpx;
  1044. background #0183FA;
  1045. color: #fff;
  1046. text-align center;
  1047. }
  1048. .pageTwo {
  1049. flex: 1;
  1050. display flex;
  1051. flex-direction column;
  1052. overflow-y hidden;
  1053. .pageTwo-input-box {
  1054. display flex;
  1055. padding: 20rpx 25rpx;
  1056. background #fff;
  1057. margin-bottom: 20rpx;
  1058. input {
  1059. padding: 0 20rpx;
  1060. width: 460rpx;
  1061. line-height: 80rpx;
  1062. height: 80rpx;
  1063. border-top: 1rpx solid #a2a2a2;
  1064. border-left: 1rpx solid #a2a2a2;
  1065. border-bottom: 1rpx solid #a2a2a2;
  1066. border-bottom-left-radius: 10rpx;
  1067. border-top-left-radius: 10rpx;
  1068. }
  1069. view {
  1070. width: 200rpx;
  1071. line-height: 80rpx;
  1072. height: 80rpx;
  1073. border: 1rpx solid #007AFF;
  1074. color: #fff;
  1075. background #007AFF;
  1076. text-align center;
  1077. border-top-right-radius: 10rpx;
  1078. border-bottom-right-radius: 10rpx;
  1079. }
  1080. }
  1081. .for-max-box {
  1082. background #fff;
  1083. flex: 1;
  1084. overflow-y scroll;
  1085. .for-box:nth-child(1) {
  1086. border: none;
  1087. }
  1088. .for-null-text {
  1089. text-align center;
  1090. line-height: 100rpx;
  1091. color: #999;
  1092. }
  1093. .for-box {
  1094. border-top: 1rpx solid #dedede;
  1095. display: flex;
  1096. .button-text-view {
  1097. padding: 35rpx 35rpx 35rpx 20rpx;
  1098. width:560rpx;
  1099. }
  1100. .button-big-view {
  1101. padding: 20rpx 0 20rpx 0 ;
  1102. width: 100rpx;
  1103. display: flex;
  1104. flex-direction: column;
  1105. .button-null-view{
  1106. flex:1;
  1107. }
  1108. .button-view{
  1109. line-height:60rpx;
  1110. width: 100rpx;
  1111. text-align center;
  1112. border-radius: 10rpx;
  1113. background #007AFF;
  1114. color: #fff;
  1115. }
  1116. }
  1117. }
  1118. }
  1119. .out-button {
  1120. width: 650rpx;
  1121. height: 100rpx;
  1122. line-height: 100rpx;
  1123. margin: 20rpx 50rpx;
  1124. text-align center;
  1125. font-size: 32rpx;
  1126. color: #fff;
  1127. background #999;
  1128. border-radius: 20rpx;
  1129. }
  1130. }
  1131. .shade-max-box {
  1132. background: rgba(0, 0, 0, 0.2);
  1133. width: 100%;
  1134. height: 100%;
  1135. position fixed;
  1136. z-index 100;
  1137. .shade-big-box {
  1138. width: 626rpx;
  1139. height: 567rpx;
  1140. margin: 335rpx 63rpx;
  1141. position relative;
  1142. z-index 100;
  1143. img {
  1144. width: 626rpx;
  1145. height: 567rpx;
  1146. }
  1147. view {
  1148. position absolute;
  1149. left: 88rpx;
  1150. bottom: 100rpx;
  1151. width: 450rpx;
  1152. height: 80rpx;
  1153. line-height: 80rpx;
  1154. text-align center;
  1155. color: #fff;
  1156. background #0183FA;
  1157. border-radius: 40rpx;
  1158. }
  1159. }
  1160. }
  1161. .shade-text-max-big-box{
  1162. background-color: #fff;
  1163. padding:20rpx;
  1164. position: fixed;
  1165. z-index:510;
  1166. height:100%;
  1167. overflow-y: scroll;
  1168. .shade-text-button-box{
  1169. width:710rpx;
  1170. display: flex;
  1171. overflow: hidden;
  1172. padding:0 0 80rpx;
  1173. view{
  1174. width:200rpx;
  1175. text-align: center;
  1176. font-size:34rpx;
  1177. line-height:80rpx;
  1178. border-radius:10rpx
  1179. }
  1180. view:nth-child(2){
  1181. background-color: #dedede
  1182. }
  1183. view:nth-child(4){
  1184. background-color: #0183FA;
  1185. color:#fff;
  1186. }
  1187. .shade-text-null-p{
  1188. flex:1;
  1189. }
  1190. }
  1191. }
  1192. }
  1193. /deep/.input-value-border {
  1194. display: none !important;
  1195. }
  1196. </style>