newApplication.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251
  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. wx.chooseImage({
  551. count: 1,
  552. sizeType: ["original", "compressed"],
  553. sourceType: ["album", "camera"],
  554. success: function(res) {
  555. console.log(res)
  556. let text = res.tempFilePaths[0].split('.')
  557. if (self.strArr.indexOf(text[1]) == -1) {
  558. uni.showToast({
  559. title: '请上传' + self.strArr.join(',') + '格式文件',
  560. icon: "none",
  561. mask: true,
  562. duration: 2000
  563. });
  564. return
  565. }
  566. if (text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' &&
  567. text[1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx') {
  568. uni.showToast({
  569. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  570. icon: "none",
  571. mask: true,
  572. duration: 2000
  573. });
  574. return
  575. }
  576. let upObj = {
  577. name: self.uploadFileName + '.' + text[1],
  578. path: res.tempFilePaths[0],
  579. type: text[1],
  580. }
  581. self.upDataFunction(item, upObj);
  582. }
  583. });
  584. },
  585. //上传文件
  586. upData(item) {
  587. let self = this;
  588. wx.chooseMessageFile({
  589. count: 1,
  590. type: 'all',
  591. success(res) {
  592. let text = res.tempFiles[0].path.split('.')
  593. if (self.strArr.indexOf(text[1]) == -1) {
  594. uni.showToast({
  595. title: '请上传' + self.strArr.join(',') + '格式文件',
  596. icon: "none",
  597. mask: true,
  598. duration: 2000
  599. });
  600. return
  601. }
  602. if (text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' && text[
  603. 1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx') {
  604. uni.showToast({
  605. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  606. icon: "none",
  607. mask: true,
  608. duration: 2000
  609. });
  610. return
  611. }
  612. let upObj = {
  613. name: self.uploadFileName + '.' + text[1],
  614. path: res.tempFiles[0].path,
  615. type: text[1],
  616. }
  617. self.upDataFunction(item, upObj);
  618. }
  619. })
  620. },
  621. async upDataFunction(item, upObj) {
  622. var self = this;
  623. uni.showLoading({
  624. title: '上传中',
  625. mask: true
  626. });
  627. uni.uploadFile({
  628. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  629. header: {
  630. 'Authorization': uni.getStorageSync('token')
  631. },
  632. filePath: upObj.path,
  633. name: 'file',
  634. formData: {
  635. 'user': 'test'
  636. },
  637. success: (uploadFileRes) => {
  638. let res = JSON.parse(uploadFileRes.data);
  639. if (res.code == 200) {
  640. let obj = {
  641. name: upObj.name,
  642. url: res.data.url,
  643. type: upObj.type
  644. }
  645. item.upList.push(obj);
  646. this.$forceUpdate();
  647. } else {
  648. uni.showToast({
  649. title: res.msg,
  650. icon: "none",
  651. mask: true,
  652. duration: 2000
  653. });
  654. }
  655. },
  656. fail: err => {},
  657. complete: () => {
  658. uni.hideLoading()
  659. }
  660. });
  661. },
  662. //选择搜索页面
  663. inputClick(type) {
  664. if (this.pageType != type) {
  665. this.pageType = type;
  666. }
  667. },
  668. //实验室选择
  669. checkClick(item) {
  670. this.$set(this, "subject", item);
  671. this.materialApply(item);
  672. },
  673. //获取实验室相关配置
  674. async materialApply(item) {
  675. let self = this;
  676. const {
  677. data
  678. } = await laboratoryAppletMaterialApply({
  679. subId: this.subject.subId
  680. })
  681. if (data.code == 200) {
  682. if (!data.data.listStudent[0]) {
  683. uni.showToast({
  684. title: '该实验室未设置准入条件',
  685. icon: "none",
  686. mask: true,
  687. duration: 2000
  688. });
  689. return
  690. }
  691. this.$set(this, "subject", item);
  692. if (data.data.listStudent) {
  693. for (let i = 0; i < data.data.listStudent.length; i++) {
  694. if (data.data.listStudent[i].materialType == 1) {
  695. data.data.listStudent[i].upList = [];
  696. }
  697. }
  698. }
  699. if (data.data.listTeacher) {
  700. for (let i = 0; i < data.data.listTeacher.length; i++) {
  701. if (data.data.listTeacher[i].materialType == 1) {
  702. data.data.listTeacher[i].upList = [];
  703. }
  704. }
  705. }
  706. this.subjectData = data.data;
  707. this.sysUser = data.data.sysUser;
  708. this.sysUser.mobile == null ? '' : this.sysUser.mobile;
  709. this.sysUser.userName == null ? '' : this.sysUser.userName;
  710. this.sysUser.cardNum == null ? '' : this.sysUser.cardNum;
  711. this.sysUser.grade == null ? '' : this.sysUser.grade;
  712. this.sysUser.tutorUserName == null ? '' : this.sysUser.tutorUserName;
  713. if (this.infoType) {
  714. this.validLength = this.infoData.labSecurityApply.validLength;
  715. for (let i = 0; i < self.infoData.listTemp.length; i++) {
  716. if (self.infoData.listTemp[i].materialType == 1) {
  717. for (let o = 0; o < self.subjectData.listStudent.length; o++) {
  718. if (self.subjectData.listStudent[o].materialType == 1 && self.subjectData
  719. .listStudent[o].id == self.infoData.listTemp[i].id) {
  720. self.subjectData.listStudent[o].upList = JSON.parse(JSON.stringify(self
  721. .infoData.listTemp[i].upList));
  722. }
  723. }
  724. }
  725. }
  726. }
  727. this.pageType = 1;
  728. }
  729. },
  730. //有效期选中
  731. buttonChange2(e) {
  732. console.log("e", e.mp.detail.value);
  733. this.buttonArrayIndex2 = e.mp.detail.value;
  734. this.validLength = this.buttonArray2[e.mp.detail.value].value;
  735. },
  736. //查询实验室
  737. async subjectList() {
  738. if(!this.subjectName){
  739. uni.showToast({
  740. title: '请输入实验室名称/房间号',
  741. icon: "none",
  742. mask: true,
  743. duration: 2000
  744. });
  745. return
  746. }
  747. const {
  748. data
  749. } = await systemMineGetListByPower({
  750. searchValue: this.subjectName
  751. })
  752. if (data.code == 200) {
  753. this.searchList = data.data;
  754. if (!data.data[0]) {
  755. this.nullText = "暂无数据"
  756. }
  757. }
  758. },
  759. //生成有效期
  760. addTime() {
  761. let list = [];
  762. for (let i = 1; i < 61; i++) {
  763. let obj = {
  764. name: i + "个月",
  765. value: i,
  766. }
  767. list.push(obj)
  768. }
  769. this.$set(this, 'buttonArray2', list);
  770. },
  771. },
  772. }
  773. </script>
  774. <style lang="stylus" scoped>
  775. #newApplication {
  776. height:100%;
  777. width: 100%;
  778. display flex;
  779. flex-direction column;
  780. overflow: hidden;
  781. .user-info-box {
  782. background #fff;
  783. border-radius: 20rpx;
  784. margin: 20rpx 20rpx;
  785. padding: 20rpx 0 0;
  786. .user-info-box_title {
  787. font-size: 30rpx;
  788. font-family: PingFang SC;
  789. font-weight: 500;
  790. color: #333333;
  791. line-height: 30rpx;
  792. margin-left: 24rpx;
  793. margin-bottom: 10px;
  794. }
  795. .user-info-box-min {
  796. margin: 0 26rpx;
  797. display flex;
  798. align-items center;
  799. view {
  800. line-height: 66rpx;
  801. font-size: 28rpx;
  802. }
  803. view:nth-child(1) {
  804. color: red;
  805. line-height: 28rpx;
  806. position: relative;
  807. top: 4rpx;
  808. }
  809. view:nth-child(2) {
  810. flex: 1;
  811. color: #999;
  812. }
  813. view:nth-child(3) {
  814. flex: 1;
  815. text-align right;
  816. color: #333;
  817. }
  818. >input {
  819. width 460rpx;
  820. }
  821. }
  822. .picker-title-box {
  823. padding: 0 20rpx;
  824. display flex;
  825. justify-content flex-start;
  826. align-items center;
  827. view {
  828. line-height: 80rpx;
  829. font-size: 28rpx;
  830. }
  831. view:nth-child(1) {
  832. color: red;
  833. line-height: 28rpx;
  834. }
  835. view:nth-child(2) {}
  836. view:nth-child(3) {
  837. color: #999;
  838. }
  839. }
  840. }
  841. .newApplication-page {
  842. flex:1;
  843. background #fff;
  844. margin: 20rpx 20rpx 0;
  845. padding-bottom: 20rpx;
  846. border-radius: 20rpx;
  847. overflow-y: scroll;
  848. .picker-max-box {
  849. /* 申请备注 */
  850. .remark {
  851. width: 627rpx;
  852. height: 200rpx;
  853. font-size: 28rpx;
  854. margin: 0 20rpx;
  855. border: 2rpx solid #a2a2a2;
  856. border-radius: 10rpx;
  857. padding: 20rpx;
  858. }
  859. /* 申请期限 */
  860. .apply_data {
  861. width: 667rpx;
  862. height: 82rpx;
  863. background: #FFFFFF;
  864. border: 2rpx solid #A2A2A2;
  865. border-radius: 10rpx;
  866. display: flex;
  867. justify-content: space-between;
  868. align-items center;
  869. margin: 0 20rpx;
  870. padding: 0 30rpx;
  871. box-sizing border-box;
  872. >picker {
  873. >view {
  874. font-size: 28rpx;
  875. font-family: PingFang SC;
  876. font-weight: 500;
  877. color: #999999;
  878. line-height: 82rpx;
  879. }
  880. }
  881. }
  882. .picker-title-box {
  883. padding: 0 20rpx;
  884. display flex;
  885. justify-content flex-start;
  886. align-items center;
  887. view {
  888. line-height: 80rpx;
  889. font-size: 28rpx;
  890. }
  891. view:nth-child(1) {
  892. color: red;
  893. }
  894. view:nth-child(2) {}
  895. view:nth-child(3) {
  896. color: #999;
  897. }
  898. }
  899. .picker-input-box {
  900. padding: 0 20rpx;
  901. display flex;
  902. height: 80rpx;
  903. width: 627rpx;
  904. border: 1rpx solid #a2a2a2;
  905. border-radius: 10rpx;
  906. margin: 0 20rpx;
  907. }
  908. .picker-min-box {
  909. display flex;
  910. height: 80rpx;
  911. width: 667rpx;
  912. border: 1rpx solid #a2a2a2;
  913. border-radius: 10rpx;
  914. margin: 0 20rpx;
  915. view {
  916. flex: 1;
  917. line-height: 80rpx;
  918. padding: 0 20rpx;
  919. color: #999;
  920. font-size: 28rpx;
  921. }
  922. img {
  923. width: 24rpx;
  924. height: 12rpx;
  925. margin: 35rpx 23rpx;
  926. }
  927. }
  928. .picker-text-box {
  929. padding: 0 50rpx;
  930. height: 60rpx;
  931. line-height: 60rpx;
  932. font-size: 28rpx;
  933. color: #999;
  934. }
  935. .picker-text-info-box {
  936. color: #999;
  937. font-size: 28rpx;
  938. line-height: 40rpx;
  939. padding: 0 20rpx;
  940. }
  941. .picker-up-img-box {
  942. margin: 40rpx auto;
  943. width: 640rpx;
  944. height: 250rpx;
  945. border: 2px dashed #E0E0E0;
  946. border-radius: 20rpx;
  947. background: #F8F8F8;
  948. view:nth-child(1) {
  949. margin-top: 30rpx;
  950. font-size: 80rpx;
  951. color: #e0e0e0;
  952. text-align center;
  953. }
  954. view:nth-child(2) {
  955. font-weight: 700;
  956. font-size: 28rpx;
  957. color: #999;
  958. text-align center;
  959. }
  960. }
  961. .picker-for-item-box {
  962. display flex;
  963. margin: 20rpx 0;
  964. .left-img-box {
  965. margin: 0 20rpx;
  966. width: 60rpx;
  967. height: 60rpx;
  968. }
  969. .center-text-box {
  970. flex: 1;
  971. line-height: 60rpx;
  972. font-size: 28rpx;
  973. color: #333;
  974. display: block;
  975. overflow: hidden;
  976. text-overflow: ellipsis;
  977. white-space: nowrap;
  978. }
  979. .right-img-box {
  980. width: 30rpx;
  981. height: 30rpx;
  982. margin: 15rpx 20rpx;
  983. }
  984. }
  985. .up-data-button {
  986. width: 500rpx;
  987. height: 80rpx;
  988. margin: 40rpx auto;
  989. line-height: 80rpx;
  990. text-align center;
  991. font-size: 28rpx;
  992. border-radius: 10rpx;
  993. color: #0183FA;
  994. border: 1rpx dashed #0183FA;
  995. }
  996. }
  997. }
  998. .agreement-box{
  999. display: flex
  1000. margin-bottom:160rpx;
  1001. margin-top:40rpx;
  1002. img{
  1003. width:40rpx;
  1004. height:40rpx;
  1005. margin: 0 20rpx 0 70rpx;
  1006. }
  1007. .text-2{
  1008. color:#0183FA;
  1009. }
  1010. }
  1011. .bottom-button {
  1012. position fixed;
  1013. bottom: 20rpx;
  1014. left: 25rpx;
  1015. z-index: 500;
  1016. width: 700rpx;
  1017. line-height: 100rpx;
  1018. border-radius: 20rpx;
  1019. background #0183FA;
  1020. color: #fff;
  1021. text-align center;
  1022. }
  1023. .pageTwo {
  1024. flex: 1;
  1025. display flex;
  1026. flex-direction column;
  1027. overflow-y hidden;
  1028. .pageTwo-input-box {
  1029. display flex;
  1030. padding: 20rpx 25rpx;
  1031. background #fff;
  1032. margin-bottom: 20rpx;
  1033. input {
  1034. padding: 0 20rpx;
  1035. width: 460rpx;
  1036. line-height: 80rpx;
  1037. height: 80rpx;
  1038. border-top: 1rpx solid #a2a2a2;
  1039. border-left: 1rpx solid #a2a2a2;
  1040. border-bottom: 1rpx solid #a2a2a2;
  1041. border-bottom-left-radius: 10rpx;
  1042. border-top-left-radius: 10rpx;
  1043. }
  1044. view {
  1045. width: 200rpx;
  1046. line-height: 80rpx;
  1047. height: 80rpx;
  1048. border: 1rpx solid #007AFF;
  1049. color: #fff;
  1050. background #007AFF;
  1051. text-align center;
  1052. border-top-right-radius: 10rpx;
  1053. border-bottom-right-radius: 10rpx;
  1054. }
  1055. }
  1056. .for-max-box {
  1057. background #fff;
  1058. flex: 1;
  1059. overflow-y scroll;
  1060. .for-box:nth-child(1) {
  1061. border: none;
  1062. }
  1063. .for-null-text {
  1064. text-align center;
  1065. line-height: 100rpx;
  1066. color: #999;
  1067. }
  1068. .for-box {
  1069. border-top: 1rpx solid #dedede;
  1070. display: flex;
  1071. .button-text-view {
  1072. padding: 35rpx 35rpx 35rpx 20rpx;
  1073. width:560rpx;
  1074. }
  1075. .button-big-view {
  1076. padding: 20rpx 0 20rpx 0 ;
  1077. width: 100rpx;
  1078. display: flex;
  1079. flex-direction: column;
  1080. .button-null-view{
  1081. flex:1;
  1082. }
  1083. .button-view{
  1084. line-height:60rpx;
  1085. width: 100rpx;
  1086. text-align center;
  1087. border-radius: 10rpx;
  1088. background #007AFF;
  1089. color: #fff;
  1090. }
  1091. }
  1092. }
  1093. }
  1094. .out-button {
  1095. width: 650rpx;
  1096. height: 100rpx;
  1097. line-height: 100rpx;
  1098. margin: 20rpx 50rpx;
  1099. text-align center;
  1100. font-size: 32rpx;
  1101. color: #fff;
  1102. background #999;
  1103. border-radius: 20rpx;
  1104. }
  1105. }
  1106. .shade-max-box {
  1107. background: rgba(0, 0, 0, 0.2);
  1108. width: 100%;
  1109. height: 100%;
  1110. position fixed;
  1111. z-index 100;
  1112. .shade-big-box {
  1113. width: 626rpx;
  1114. height: 567rpx;
  1115. margin: 335rpx 63rpx;
  1116. position relative;
  1117. z-index 100;
  1118. img {
  1119. width: 626rpx;
  1120. height: 567rpx;
  1121. }
  1122. view {
  1123. position absolute;
  1124. left: 88rpx;
  1125. bottom: 100rpx;
  1126. width: 450rpx;
  1127. height: 80rpx;
  1128. line-height: 80rpx;
  1129. text-align center;
  1130. color: #fff;
  1131. background #0183FA;
  1132. border-radius: 40rpx;
  1133. }
  1134. }
  1135. }
  1136. .shade-text-max-big-box{
  1137. background-color: #fff;
  1138. padding:20rpx;
  1139. position: fixed;
  1140. z-index:510;
  1141. height:100%;
  1142. overflow-y: scroll;
  1143. .shade-text-button-box{
  1144. width:710rpx;
  1145. display: flex;
  1146. overflow: hidden;
  1147. padding:0 0 80rpx;
  1148. view{
  1149. width:200rpx;
  1150. text-align: center;
  1151. font-size:34rpx;
  1152. line-height:80rpx;
  1153. border-radius:10rpx
  1154. }
  1155. view:nth-child(2){
  1156. background-color: #dedede
  1157. }
  1158. view:nth-child(4){
  1159. background-color: #0183FA;
  1160. color:#fff;
  1161. }
  1162. .shade-text-null-p{
  1163. flex:1;
  1164. }
  1165. }
  1166. }
  1167. }
  1168. /deep/.input-value-border {
  1169. display: none !important;
  1170. }
  1171. </style>