newApplication.vue 34 KB

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