newApplication.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  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.name" class="picker-input-box" disabled type="text" placeholder="请选择实验室">
  11. </view>
  12. <view class="picker-max-box" v-if="subject.id">
  13. <view class="picker-title-box">
  14. <view>*</view>
  15. <view>申请期限:</view>
  16. </view>
  17. <view class="apply_data">
  18. <picker mode="date"v-model="validBeginTime" :start="currentDate" fields="day" @change="beginDateChange">
  19. <view class="for-top-title-time" v-if="validBeginTime.length>0">{{validBeginTime}}</view>
  20. <view class="for-top-title-time" v-if="validBeginTime.length<=0">开始时间</view>
  21. </picker>
  22. -
  23. <picker mode="date" v-model="validEndTime" :start="currentDate" fields="day" @change="endDateChange">
  24. <view class="for-top-title-time" v-if="validEndTime.length>0">{{validEndTime}}</view>
  25. <view class="for-top-title-time" v-if="validEndTime.length<=0">结束时间</view>
  26. </picker>
  27. </view>
  28. </view>
  29. <view class="picker-max-box" v-if="subject.id">
  30. <view class="picker-title-box">
  31. <view> </view>
  32. <view>申请备注:</view>
  33. </view>
  34. <textarea class="remark" v-model="applyCause" placeholder="请输入申请备注"></textarea>
  35. </view>
  36. <view class="user-info-box" v-if="subject.id">
  37. <view class="picker-title-box">
  38. <view>*</view>
  39. <view>身份信息:</view>
  40. <view>(关联学生信息材料)</view>
  41. </view>
  42. <view class="user-info-box-min">
  43. <view>*</view>
  44. <view>申请人:</view>
  45. <input v-model="sysUser.nickName" type="text" placeholder="学生姓名">
  46. </view>
  47. <view class="user-info-box-min">
  48. <view>*</view>
  49. <view>联系电话:</view>
  50. <input v-model="sysUser.phonenumber" type="text" placeholder="联系电话">
  51. </view>
  52. <view class="user-info-box-min" >
  53. <view>*</view>
  54. <view>学号:</view>
  55. <input v-model="sysUser.userName" type="text" placeholder="学号">
  56. </view>
  57. <view class="user-info-box-min">
  58. <view>*</view>
  59. <view>物理卡号:</view>
  60. <input v-model="sysUser.cardNum" type="text" placeholder="物理卡号">
  61. </view>
  62. <view class="user-info-box-min">
  63. <view>*</view>
  64. <view>班级:</view>
  65. <input v-model="sysUser.grade" type="text" placeholder="班级">
  66. </view>
  67. <view class="user-info-box-min" >
  68. <view>*</view>
  69. <view>导师:</view>
  70. <input v-model="sysUser.tutorUserName" @change="tutorUserNameClick()" type="text" placeholder="请输入姓名,最少两个字">
  71. <uni-data-picker disabled=true @change="bindPickerChange" :localdata="tutorUserList" ref='picker'> </uni-data-picker>
  72. </view>
  73. </view>
  74. <!-- 老师 -->
  75. <view v-if="subjectData.sysUser.userType == '11'" v-for="(item,index) in subjectData.listTeacher" :key="index">
  76. <!-- 身份卡 -->
  77. <view class="picker-max-box" v-if="item.materialType==2&&item.relationType==1">
  78. <view class="picker-title-box">
  79. <view>*</view>
  80. <view>身份卡</view>
  81. <view>(已关联教职工信息)</view>
  82. </view>
  83. <view class="picker-text-box">姓名:{{subjectData.sysUser.nickName}}</view>
  84. <view class="picker-text-box">工号:{{subjectData.sysUser.userName}}</view>
  85. <view class="picker-text-box">院校:{{subjectData.sysUser.dept.deptName}}</view>
  86. </view>
  87. <!-- 上传材料 -->
  88. <view class="picker-max-box" v-if="item.materialType==1">
  89. <view class="picker-title-box">
  90. <view>*</view>
  91. <view>{{item.materialName}}:</view>
  92. </view>
  93. <view class="picker-text-info-box">{{item.materialDescribe}}</view>
  94. <view class="picker-for-item-box" v-for="(minItem,minIndex) in item.upList" :key="minIndex">
  95. <img class="left-img-box" src="@/pages_student/images/Version2.3/icon_pdf.png" v-if="minItem.type == 'pdf'">
  96. <img class="left-img-box" src="@/pages_student/images/Version2.3/icon_word.png" v-if="minItem.type == 'doc' || minItem.type == 'docx'">
  97. <img class="left-img-box" :src="minItem.url" v-if="minItem.type == 'png' || minItem.type == 'jpg' || minItem.type == 'jpeg' || minItem.type == 'gif'">
  98. <view class="center-text-box">{{minItem.name}}</view>
  99. <img class="right-img-box" src="@/pages_student/images/Version2.3/icon_sczl_sc.png" @click="delUpData(item,minIndex)">
  100. </view>
  101. <view class="up-data-button" @click="itemUpData(item)">上传材料</view>
  102. </view>
  103. </view>
  104. <!-- 学生 -->
  105. <view v-if="subjectData.sysUser.userType == '22'" v-for="(item,index) in subjectData.listStudent" :key="index">
  106. <!-- 身份卡 -->
  107. <!-- <view class="picker-max-box" v-if="item.materialType==2&&item.relationType==1">
  108. <view class="picker-title-box">
  109. <view>*</view>
  110. <view>身份卡</view>
  111. <view>(已关联学生信息)</view>
  112. </view>
  113. <view class="picker-text-box">姓名:{{subjectData.sysUser.nickName}}</view>
  114. <view class="picker-text-box">工号:{{subjectData.sysUser.userName}}</view>
  115. <view class="picker-text-box">院校:{{subjectData.sysUser.dept.deptName}}</view>
  116. <view class="picker-text-box">专业:{{subjectData.sysUser.major}}</view>
  117. </view> -->
  118. <!-- 院系考试证书 -->
  119. <view class="picker-max-box" v-if="item.materialType==2&&item.relationType==2">
  120. <view class="picker-title-box">
  121. <view>*</view>
  122. <view>安全考试证书:</view>
  123. </view>
  124. <img class="picker-up-img-box" v-if="subjectData.listcert[0]" :src="subjectData.listcert[0].cert_url">
  125. <view v-if="!subjectData.listcert[0]" style="margin-left:40px;color:#999;font-size:14px;">暂无证书</view>
  126. </view>
  127. <!-- 上传材料 -->
  128. <view class="picker-max-box" v-if="item.materialType==1">
  129. <view class="picker-title-box">
  130. <view>*</view>
  131. <view>{{item.materialName}}:</view>
  132. </view>
  133. <view class="picker-text-info-box">{{item.materialDescribe}}</view>
  134. <view class="picker-for-item-box" v-for="(minItem,minIndex) in item.upList" :key="minIndex">
  135. <img class="left-img-box" src="@/pages_student/images/Version2.3/icon_pdf.png" v-if="minItem.type == 'pdf'">
  136. <img class="left-img-box" src="@/pages_student/images/Version2.3/icon_word.png" v-if="minItem.type == 'doc' || minItem.type == 'docx'">
  137. <img class="left-img-box" :src="baseUrl+minItem.url" v-if="minItem.type == 'png' || minItem.type == 'jpg' || minItem.type == 'jpeg' || minItem.type == 'gif'">
  138. <view class="center-text-box">{{minItem.name}}</view>
  139. <img class="right-img-box" src="@/pages_student/images/Version2.3/icon_sczl_sc.png" @click="delUpData(item,minIndex)">
  140. </view>
  141. <view class="up-data-button" @click="itemUpData(item)">上传材料</view>
  142. </view>
  143. </view>
  144. </view>
  145. <view class="pageTwo" v-if="pageType == 2">
  146. <view class="pageTwo-input-box">
  147. <input type="text" placeholder="请输入实验室名称" v-model="subjectName">
  148. <view @click="subjectList">查找</view>
  149. </view>
  150. <view class="for-max-box">
  151. <view class="for-null-text" v-if="!searchList[0]">{{nullText}}</view>
  152. <view class="for-box" v-for="(item,index) in searchList" :key="index">
  153. <view>{{item.name}}</view>
  154. <view @click="checkClick(item)">选择</view>
  155. </view>
  156. </view>
  157. <view class="out-button" @click="inputClick(1)">返回</view>
  158. </view>
  159. <view class="bottom-button" v-if="pageType == 1" @click="upDataButton()">{{infoType?'准入材料修改完毕,重新提交':'准入材料上传完毕,提交申请'}}</view>
  160. <view class="shade-max-box" v-if="shadeType">
  161. <view class="shade-big-box">
  162. <img src="@/pages_student/images/Version2.3/img_zrsq_bg.png">
  163. <view @click="pageBack">返回</view>
  164. </view>
  165. </view>
  166. </view>
  167. </template>
  168. <script>
  169. import { subjectList,materialApply,materialUpdate,materialAdd ,teacherApply} from '@/api/index.js'
  170. import { config } from '@/api/request/config.js'
  171. export default {
  172. data() {
  173. return {
  174. baseUrl:config.base_url,
  175. pageType:1,
  176. shadeType:false,
  177. //有效期
  178. buttonArray2:[],
  179. buttonArrayIndex2:11,
  180. //搜索回的实验室列表
  181. searchList:[],
  182. //选择的实验室数据
  183. subject:{},
  184. //暂无数据提示
  185. nullText:"请输入实验室名称进行搜索",
  186. //实验室名称
  187. subjectName:"",
  188. //有效期
  189. validLength:"12",
  190. //获取的实验室配置数据
  191. subjectData:{},
  192. //是否是编辑状态
  193. infoType:false,
  194. //编辑参数
  195. infoData:{},
  196. validBeginTime:'',//申请期限开始
  197. validEndTime:'',//申请期限结束
  198. applyCause:'',//申请备注
  199. sysUser:{},
  200. tutorUserList: [],
  201. strArr:[],//存储类型
  202. currentDate:'',//当前日期
  203. uploadFileName:'',//学生上传的文件名
  204. }
  205. },
  206. onLoad(option) {
  207. console.log(JSON.parse(decodeURIComponent(option.item)))
  208. if(option.item){
  209. let newItem = JSON.parse(decodeURIComponent(option.item));
  210. let newObj = {
  211. deptId:newItem.labSecurityApply.deptId,
  212. deptName:newItem.labSecurityApply.deptName,
  213. id:newItem.labSecurityApply.subjectId,
  214. name:newItem.labSecurityApply.subjectName,
  215. }
  216. this.validBeginTime=newItem.labSecurityApply.validBeginTime;//申请期限开始时间
  217. this.validEndTime=newItem.labSecurityApply.validEndTime;//申请期限结束时间
  218. this.applyCause=newItem.labSecurityApply.applyCause;//申请备注
  219. this.$set(this,'subject',newObj)
  220. this.$set(this,'infoData',newItem)
  221. this.infoType = true;
  222. this.materialApply();
  223. }
  224. },
  225. onShow(){
  226. this.addTime();
  227. this.clearData();
  228. this.currentDate=this.getdate();
  229. console.log('时间')
  230. console.log(this.currentDate)
  231. },
  232. methods: {
  233. getdate() {
  234. var date = new Date();
  235. var seperator1 = "-";
  236. var year = date.getFullYear();
  237. var month = date.getMonth() + 1;
  238. var strDate = date.getDate();
  239. if (month >= 1 && month <= 9) {
  240. month = "0" + month;
  241. }
  242. if (strDate >= 0 && strDate <= 9) {
  243. strDate = "0" + strDate;
  244. }
  245. var currentdate = year + "-" + month + "-" + strDate;
  246. return currentdate;
  247. },
  248. //清除
  249. clearData(){
  250. this.tutorUserList=[];
  251. },
  252. //导师查询
  253. async tutorUserNameClick(){
  254. let _this=this
  255. _this.tutorUserList=[]
  256. let obj = {
  257. nickName:this.sysUser.tutorUserName
  258. }
  259. const {data} = await teacherApply(obj)
  260. if(data.code == 200){
  261. console.log(data)
  262. data.data.forEach(function(item){
  263. _this.tutorUserList.push({text: item.nickName,value:item.userId,})
  264. })
  265. console.log(_this.tutorUserList)
  266. _this.$refs.picker.show()
  267. }
  268. },
  269. bindPickerChange: function(e) {
  270. let _this=this;
  271. console.log('picker发送选择改变,携带值为', e.detail.value)
  272. let data=e.detail.value;
  273. data.forEach(function(item){
  274. _this.sysUser.tutorUserName=item.text
  275. _this.sysUser.tutorUserId=item.value
  276. })
  277. },
  278. //时间选择触发-开始
  279. beginDateChange(data){
  280. this.validBeginTime = data.detail.value;
  281. },
  282. endDateChange(data){
  283. this.validEndTime = data.detail.value;
  284. },
  285. pageBack(){
  286. uni.navigateBack();
  287. },
  288. async materialUpdate(obj){
  289. const {data} = await materialUpdate(obj)
  290. if(data.code == 200){
  291. this.shadeType = true;
  292. }
  293. },
  294. async materialAdd(obj){
  295. const {data} = await materialAdd(obj)
  296. if(data.code == 200){
  297. this.shadeType = true;
  298. // setTimeout(function(){
  299. // uni.navigateBack();
  300. // },2000);
  301. }
  302. },
  303. //提交按钮
  304. upDataButton(){
  305. let self = this;
  306. if(!this.subject.id){
  307. uni.showToast({
  308. title: '请选择实验室',
  309. icon:"none",
  310. mask:true,
  311. duration: 2000
  312. });
  313. return
  314. }
  315. if(!this.validBeginTime){
  316. uni.showToast({
  317. title: '请选择开始时间',
  318. icon:"none",
  319. mask:true,
  320. duration: 2000
  321. });
  322. return
  323. }
  324. if(!this.validEndTime){
  325. uni.showToast({
  326. title: '请选择结束时间',
  327. icon:"none",
  328. mask:true,
  329. duration: 2000
  330. });
  331. return
  332. }
  333. if(!this.sysUser.nickName){
  334. uni.showToast({
  335. title: '请输入申请人',
  336. icon:"none",
  337. mask:true,
  338. duration: 2000
  339. });
  340. return
  341. }
  342. if(!this.sysUser.phonenumber){
  343. uni.showToast({
  344. title: '请输入联系电话',
  345. icon:"none",
  346. mask:true,
  347. duration: 2000
  348. });
  349. return
  350. }
  351. if(!this.sysUser.userName){
  352. uni.showToast({
  353. title: '请输入学号',
  354. icon:"none",
  355. mask:true,
  356. duration: 2000
  357. });
  358. return
  359. }
  360. if(!this.sysUser.cardNum){
  361. uni.showToast({
  362. title: '请输入物理卡号',
  363. icon:"none",
  364. mask:true,
  365. duration: 2000
  366. });
  367. return
  368. }
  369. if(!this.sysUser.grade){
  370. uni.showToast({
  371. title: '请输入班级',
  372. icon:"none",
  373. mask:true,
  374. duration: 2000
  375. });
  376. return
  377. }
  378. if(!this.sysUser.tutorUserId){
  379. uni.showToast({
  380. title: '请选择导师',
  381. icon:"none",
  382. mask:true,
  383. duration: 2000
  384. });
  385. return
  386. }
  387. let sysUser={
  388. nickName:this.sysUser.nickName,
  389. phonenumber:this.sysUser.phonenumber,
  390. userName:this.sysUser.userName,
  391. cardNum:this.sysUser.cardNum,
  392. grade:this.sysUser.grade,
  393. tutorUserId:this.sysUser.tutorUserId,
  394. tutorUserName:this.sysUser.tutorUserName,
  395. userId:this.sysUser.userId,
  396. };
  397. let obj = {
  398. subjectAdminid:this.subjectData.fzrsysUser[0].user_id,
  399. userNumber:this.subjectData.sysUser.userName,//学号/工号
  400. userMajor:this.subjectData.sysUser.major,//专业
  401. deptId:this.subject.deptId, //NULL部门id
  402. deptName:this.subject.deptName, //NULL部门名称
  403. subjectId:this.subject.id, //NULL实验室id
  404. subjectName:this.subject.name, //NULL实验室名称
  405. auditStatus:"0", //NULL审核状态 0待审核 1驳回 2通过
  406. validLength:this.validLength, //NULL有效期 月份时长
  407. mrList:[],//上传资料
  408. sysUser:sysUser,//身份卡用户信息
  409. validBeginTime:this.validBeginTime,//申请期限开始时间
  410. validEndTime:this.validEndTime,//申请期限结束时间
  411. applyCause:this.applyCause,//申请备注
  412. };
  413. if(this.subjectData.sysUser.userType == '22'){
  414. for(let i=0;i<self.subjectData.listStudent.length;i++){
  415. if(self.subjectData.listStudent[i].materialType==1){
  416. if(!self.subjectData.listStudent[i].upList[0]){
  417. uni.showToast({
  418. title: self.subjectData.listStudent[i].materialName+"未上传",
  419. icon:"none",
  420. mask:true,
  421. duration: 2000
  422. });
  423. return
  424. }else{
  425. let upData = {
  426. materialId:self.subjectData.listStudent[i].id,
  427. dataName:self.subjectData.listStudent[i].materialName,
  428. dataDescribe:self.subjectData.listStudent[i].materialDescribe,
  429. dataUrl:"",
  430. };
  431. for(let o=0;o<self.subjectData.listStudent[i].upList.length;o++){
  432. upData.dataUrl = upData.dataUrl + self.subjectData.listStudent[i].upList[o].name + ';' + self.subjectData.listStudent[i].upList[o].url + ',';
  433. }
  434. obj.mrList.push(upData);
  435. }
  436. }
  437. }
  438. }else if(this.subjectData.sysUser.userType == '11'){
  439. for(let i=0;i<self.subjectData.listTeacher.length;i++){
  440. if(self.subjectData.listTeacher[i].materialType==1){
  441. if(!self.subjectData.listTeacher[i].upList[0]){
  442. uni.showToast({
  443. title: self.subjectData.listStudent[i].materialName+"未上传",
  444. icon:"none",
  445. mask:true,
  446. duration: 2000
  447. });
  448. return
  449. }else{
  450. let upData = {
  451. materialId:self.subjectData.listTeacher[i].id,
  452. dataName:self.subjectData.listTeacher[i].materialName,
  453. dataDescribe:self.subjectData.listTeacher[i].materialDescribe,
  454. dataUrl:"",
  455. };
  456. for(let o=0;o<self.subjectData.listTeacher[i].upList.length;o++){
  457. upData.dataUrl = upData.dataUrl + self.subjectData.listTeacher[i].upList[o].name + ';' + self.subjectData.listTeacher[i].upList[o].url + ',';
  458. }
  459. obj.mrList.push(upData);
  460. }
  461. }
  462. }
  463. }
  464. if(this.infoType){
  465. obj.id = this.infoData.labSecurityApply.id;
  466. this.materialUpdate(obj);
  467. }else{
  468. this.materialAdd(obj);
  469. }
  470. },
  471. //删除对应材料
  472. delUpData(item,index){
  473. item.upList.splice(index,1);
  474. this.$forceUpdate()
  475. },
  476. itemUpData(item){
  477. console.log(item)
  478. console.log(this.sysUser.nickName+item.materialName)
  479. this.uploadFileName='';
  480. this.uploadFileName=this.sysUser.nickName+item.materialName;//学生上传的文件名
  481. let _this=this;
  482. let fileTypeArr= item.fileType.split(',')
  483. _this.strArr = [];
  484. fileTypeArr.forEach(function (item){
  485. if(item=='1'){
  486. _this.strArr.push('pdf')
  487. }else if(item=='2'){
  488. _this.strArr.push('doc','docx')
  489. }else if(item=='3'){
  490. _this.strArr.push('png','jpg','gif')
  491. }
  492. })
  493. console.log(_this.strArr)
  494. //数组去重
  495. //strArr= [...new Set(strArr)]
  496. let self = this;
  497. uni.showActionSheet({
  498. itemList: ['上传文件', '上传图片'],
  499. success: function (res) {
  500. console.log(res)
  501. if(res.tapIndex == 0){
  502. //上传文件
  503. self.upData(item);
  504. }else if(res.tapIndex == 1){
  505. //上传图片
  506. self.upImg(item);
  507. }
  508. },
  509. fail: function (res) {
  510. console.log(res.errMsg);
  511. }
  512. });
  513. },
  514. upImg(item) {
  515. let self = this;
  516. wx.chooseImage({
  517. count: 1,
  518. sizeType: ["original", "compressed"],
  519. sourceType: ["album", "camera"],
  520. success: function(res) {
  521. console.log(res)
  522. let text = res.tempFilePaths[0].split('.')
  523. if(self.strArr.indexOf(text[1])==-1){ uni.showToast({
  524. title: '请上传'+self.strArr.join(',')+'格式文件',
  525. icon:"none",
  526. mask:true,
  527. duration: 2000
  528. });
  529. return
  530. }
  531. if(text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' && text[1] != 'pdf' && text[1] != 'doc' && text[1] != 'docx'){
  532. uni.showToast({
  533. title: '仅支持png/jpg/jpeg/gif/pdf/doc/docx类型的文件上传',
  534. icon:"none",
  535. mask:true,
  536. duration: 2000
  537. });
  538. return
  539. }
  540. let upObj = {
  541. name:self.uploadFileName+'.'+text[1],
  542. path:res.tempFilePaths[0],
  543. type:text[1],
  544. }
  545. self.upDataFunction(item,upObj);
  546. // let tempFilePaths = res.tempFilePaths[0];
  547. // self.upDataFunction(tempFilePaths,upObj);
  548. }
  549. });
  550. },
  551. //上传文件
  552. upData(item){
  553. let self = this;
  554. wx.chooseMessageFile({
  555. count: 1,
  556. type: 'all',
  557. success (res) {
  558. let text = res.tempFiles[0].path.split('.')
  559. if(self.strArr.indexOf(text[1])==-1){ uni.showToast({
  560. title: '请上传'+self.strArr.join(',')+'格式文件',
  561. icon:"none",
  562. mask:true,
  563. duration: 2000
  564. });
  565. return
  566. }
  567. if(text[1] != 'png' && text[1] != 'jpg' && text[1] != 'jpeg' && text[1] != 'gif' && 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. //name:res.tempFiles[0].name,
  579. path:res.tempFiles[0].path,
  580. type:text[1],
  581. }
  582. self.upDataFunction(item,upObj);
  583. }
  584. })
  585. },
  586. async upDataFunction(item,upObj){
  587. var self = this;
  588. uni.showLoading({
  589. title: '上传中',
  590. mask: true
  591. });
  592. uni.uploadFile({
  593. url: config.base_url+'/base/file/upload', //仅为示例,非真实的接口地址
  594. header:{'Authorization':uni.getStorageSync('token')},
  595. filePath: upObj.path,
  596. name: 'file',
  597. formData: {
  598. 'user': 'test'
  599. },
  600. success: (uploadFileRes) => {
  601. let res = JSON.parse(uploadFileRes.data);
  602. if(res.code == 200){
  603. let obj = {
  604. name:upObj.name,
  605. url:res.data.url,
  606. type:upObj.type
  607. }
  608. item.upList.push(obj);
  609. this.$forceUpdate();
  610. }else{
  611. uni.showToast({
  612. title: res.msg,
  613. icon:"none",
  614. mask:true,
  615. duration: 2000
  616. });
  617. }
  618. },
  619. fail: err => {},
  620. complete: () => {
  621. uni.hideLoading()
  622. }
  623. });
  624. },
  625. //选择搜索页面
  626. inputClick(type){
  627. if(this.pageType != type){
  628. this.pageType = type;
  629. }
  630. },
  631. //实验室选择
  632. checkClick(item){
  633. this.$set(this,"subject",item);
  634. this.materialApply();
  635. },
  636. //获取实验室相关配置
  637. async materialApply(){
  638. let self = this;
  639. const {data} = await materialApply({subjectId:this.subject.id})
  640. if(data.code == 200){
  641. /* if(data.data.sysUser.userType!='11'&&data.data.sysUser.userType!='22'){
  642. uni.showToast({
  643. title: '您不是学生也不是教职工,无法申请准入',
  644. icon:"none",
  645. mask:true,
  646. duration: 2000
  647. });
  648. return
  649. } */
  650. if(data.data.sysUser.userType!='22'){
  651. uni.showToast({
  652. title: '您不是学生,无法申请准入',
  653. icon:"none",
  654. mask:true,
  655. duration: 2000
  656. });
  657. return
  658. }
  659. if(data.data.sysUser.userType == '11'){
  660. if(!data.data.listTeacher[0]){
  661. uni.showToast({
  662. title: '该实验室未设置准入条件',
  663. icon:"none",
  664. mask:true,
  665. duration: 2000
  666. });
  667. return
  668. }
  669. }
  670. if(data.data.sysUser.userType == '22'){
  671. if(!data.data.listStudent[0]){
  672. uni.showToast({
  673. title: '该实验室未设置准入条件',
  674. icon:"none",
  675. mask:true,
  676. duration: 2000
  677. });
  678. return
  679. }
  680. }
  681. if(data.data.listStudent){
  682. for(let i=0;i<data.data.listStudent.length;i++){
  683. if(data.data.listStudent[i].materialType == 1){
  684. data.data.listStudent[i].upList = [];
  685. }
  686. }
  687. }
  688. if(data.data.listTeacher){
  689. for(let i=0;i<data.data.listTeacher.length;i++){
  690. if(data.data.listTeacher[i].materialType == 1){
  691. data.data.listTeacher[i].upList = [];
  692. }
  693. }
  694. }
  695. console.log(1111111111111)
  696. console.log(data.data)
  697. this.subjectData = data.data;
  698. this.sysUser=data.data.sysUser;
  699. this.sysUser.nickName==null?'':this.sysUser.nickName;
  700. this.sysUser.phonenumber==null?'':this.sysUser.phonenumber;
  701. this.sysUser.userName==null?'':this.sysUser.userName;
  702. this.sysUser.cardNum==null?'':this.sysUser.cardNum;
  703. this.sysUser.grade==null?'':this.sysUser.grade;
  704. this.sysUser.tutorUserName==null?'':this.sysUser.tutorUserName;
  705. if(this.infoType){
  706. this.validLength = this.infoData.labSecurityApply.validLength;
  707. for(let i=0;i<self.infoData.listTemp.length;i++){
  708. if(self.infoData.listTemp[i].materialType == 1){
  709. if(self.subjectData.sysUser.userType == '11'){
  710. for(let o=0;o<self.subjectData.listTeacher.length;o++){
  711. if(self.subjectData.listTeacher[o].materialType == 1 && self.subjectData.listTeacher[o].id == self.infoData.listTemp[i].id){
  712. self.subjectData.listTeacher[o].upList = JSON.parse(JSON.stringify(self.infoData.listTemp[i].upList));
  713. }
  714. }
  715. }else if(self.subjectData.sysUser.userType == '22'){
  716. for(let o=0;o<self.subjectData.listStudent.length;o++){
  717. if(self.subjectData.listStudent[o].materialType == 1 && self.subjectData.listStudent[o].id == self.infoData.listTemp[i].id){
  718. self.subjectData.listStudent[o].upList = JSON.parse(JSON.stringify(self.infoData.listTemp[i].upList));
  719. }
  720. }
  721. }
  722. }
  723. }
  724. }
  725. this.pageType = 1;
  726. }
  727. },
  728. //有效期选中
  729. buttonChange2(e){
  730. console.log("e",e.mp.detail.value);
  731. this.buttonArrayIndex2 = e.mp.detail.value;
  732. this.validLength = this.buttonArray2[e.mp.detail.value].value;
  733. },
  734. //查询实验室
  735. async subjectList(){
  736. let obj = {
  737. name:this.subjectName
  738. }
  739. const {data} = await subjectList(obj)
  740. if(data.code == 200){
  741. this.searchList = data.data;
  742. if(!data.data[0]){
  743. this.nullText = "暂无数据"
  744. }
  745. }
  746. },
  747. //生成有效期
  748. addTime(){
  749. let list = [];
  750. for(let i=1;i<61;i++){
  751. let obj = {
  752. name:i+"个月",
  753. value:i,
  754. }
  755. list.push(obj)
  756. }
  757. this.$set(this,'buttonArray2',list);
  758. },
  759. }
  760. }
  761. </script>
  762. <style lang="stylus" scoped>
  763. #newApplication{
  764. height:auto;
  765. width:100%;
  766. display flex
  767. flex-direction column
  768. .user-info-box{
  769. background #fff;
  770. border-radius:20rpx;
  771. margin:20rpx 20rpx;
  772. padding:20rpx 0 0;
  773. .user-info-box_title{
  774. font-size: 30rpx;
  775. font-family: PingFang SC;
  776. font-weight: 500;
  777. color: #333333;
  778. line-height: 30rpx;
  779. margin-left: 24rpx
  780. margin-bottom :10px;
  781. }
  782. .user-info-box-min{
  783. margin:0 26rpx;
  784. display flex;
  785. align-items center;
  786. view{
  787. line-height:66rpx;
  788. font-size:28rpx;
  789. }
  790. view:nth-child(1){
  791. color:red;
  792. line-height:28rpx;
  793. position: relative;
  794. top: 4rpx;
  795. }
  796. view:nth-child(2){
  797. flex:1;
  798. color:#999;
  799. }
  800. view:nth-child(3){
  801. flex:1;
  802. text-align right;
  803. color:#333;
  804. }
  805. >input{
  806. width 460rpx;
  807. }
  808. }
  809. .picker-title-box{
  810. padding:0 20rpx;
  811. display flex;
  812. justify-content flex-start;
  813. align-items center;
  814. view{
  815. line-height:80rpx;
  816. font-size:28rpx;
  817. }
  818. view:nth-child(1){
  819. color:red;
  820. line-height:28rpx;
  821. }
  822. view:nth-child(2){
  823. }
  824. view:nth-child(3){
  825. color:#999;
  826. }
  827. }
  828. }
  829. .newApplication-page{
  830. background #fff
  831. margin:20rpx 20rpx 160rpx;
  832. padding-bottom:20rpx;
  833. border-radius:20rpx;
  834. .picker-max-box{
  835. /* 申请备注 */
  836. .remark{
  837. width:627rpx;
  838. height:200rpx;
  839. font-size:28rpx;
  840. margin:0 20rpx;
  841. border: 2rpx solid #a2a2a2;
  842. border-radius:10rpx;
  843. padding:20rpx;
  844. }
  845. /* 申请期限 */
  846. .apply_data{
  847. width: 667rpx;
  848. height: 82rpx;
  849. background: #FFFFFF;
  850. border: 2rpx solid #A2A2A2;
  851. border-radius: 10rpx;
  852. display :flex;
  853. justify-content :space-between;
  854. align-items center;
  855. margin :0 20rpx;
  856. padding :0 30rpx;
  857. box-sizing border-box;
  858. >picker{
  859. >view{
  860. font-size: 28rpx;
  861. font-family: PingFang SC;
  862. font-weight: 500;
  863. color: #999999;
  864. line-height: 82rpx;
  865. }
  866. }
  867. }
  868. .picker-title-box{
  869. padding:0 20rpx;
  870. display flex;
  871. justify-content flex-start;
  872. align-items center;
  873. view{
  874. line-height:80rpx;
  875. font-size:28rpx;
  876. }
  877. view:nth-child(1){
  878. color:red;
  879. }
  880. view:nth-child(2){
  881. }
  882. view:nth-child(3){
  883. color:#999;
  884. }
  885. }
  886. .picker-input-box{
  887. padding:0 20rpx;
  888. display flex;
  889. height:80rpx;
  890. width:627rpx;
  891. border:1rpx solid #a2a2a2;
  892. border-radius:10rpx;
  893. margin:0 20rpx;
  894. }
  895. .picker-min-box{
  896. display flex;
  897. height:80rpx;
  898. width:667rpx;
  899. border:1rpx solid #a2a2a2;
  900. border-radius:10rpx;
  901. margin:0 20rpx;
  902. view{
  903. flex:1;
  904. line-height:80rpx;
  905. padding:0 20rpx;
  906. color:#999;
  907. font-size:28rpx;
  908. }
  909. img{
  910. width:24rpx;
  911. height:12rpx;
  912. margin:35rpx 23rpx;
  913. }
  914. }
  915. .picker-text-box{
  916. padding:0 50rpx;
  917. height:60rpx;
  918. line-height:60rpx;
  919. font-size:28rpx;
  920. color:#999;
  921. }
  922. .picker-text-info-box{
  923. color:#999;
  924. font-size:28rpx;
  925. line-height:40rpx;
  926. padding:0 20rpx;
  927. }
  928. .picker-up-img-box{
  929. margin:40rpx auto;
  930. width:640rpx;
  931. height:250rpx;
  932. border:2px dashed #E0E0E0;
  933. border-radius:20rpx;
  934. background: #F8F8F8;
  935. view:nth-child(1){
  936. margin-top:30rpx;
  937. font-size:80rpx;
  938. color:#e0e0e0;
  939. text-align center;
  940. }
  941. view:nth-child(2){
  942. font-weight:700;
  943. font-size:28rpx;
  944. color:#999;
  945. text-align center;
  946. }
  947. }
  948. .picker-for-item-box{
  949. display flex;
  950. margin:20rpx 0;
  951. .left-img-box{
  952. margin:0 20rpx;
  953. width:60rpx;
  954. height:60rpx;
  955. }
  956. .center-text-box{
  957. flex:1;
  958. line-height:60rpx;
  959. font-size:28rpx;
  960. color:#333;
  961. display:block;
  962. overflow:hidden;
  963. text-overflow:ellipsis;
  964. white-space:nowrap;
  965. }
  966. .right-img-box{
  967. width:30rpx;
  968. height:30rpx;
  969. margin:15rpx 20rpx;
  970. }
  971. }
  972. .up-data-button{
  973. width:500rpx;
  974. height:80rpx;
  975. margin:40rpx auto;
  976. line-height:80rpx;
  977. text-align center;
  978. font-size:28rpx;
  979. border-radius:10rpx;
  980. color:#0183FA;
  981. border:1rpx dashed #0183FA;
  982. }
  983. }
  984. }
  985. .bottom-button{
  986. position fixed;
  987. bottom:20rpx;
  988. left:25rpx;
  989. z-index :500;
  990. width:700rpx;
  991. line-height:100rpx;
  992. border-radius:20rpx;
  993. background #0183FA;
  994. color:#fff;
  995. text-align center;
  996. }
  997. .pageTwo{
  998. flex:1;
  999. display flex;
  1000. flex-direction column;
  1001. overflow-y hidden
  1002. .pageTwo-input-box{
  1003. display flex;
  1004. padding:20rpx 25rpx;
  1005. background #fff
  1006. margin-bottom:20rpx;
  1007. input{
  1008. padding:0 20rpx;
  1009. width:460rpx;
  1010. line-height:80rpx;
  1011. height:80rpx;
  1012. border-top:1rpx solid #a2a2a2;
  1013. border-left:1rpx solid #a2a2a2;
  1014. border-bottom:1rpx solid #a2a2a2;
  1015. border-bottom-left-radius:10rpx;
  1016. border-top-left-radius:10rpx;
  1017. }
  1018. view{
  1019. width:200rpx;
  1020. line-height:80rpx;
  1021. height:80rpx;
  1022. border:1rpx solid #007AFF;
  1023. color:#fff;
  1024. background #007AFF;
  1025. text-align center;
  1026. border-top-right-radius:10rpx;
  1027. border-bottom-right-radius:10rpx;
  1028. }
  1029. }
  1030. .for-max-box{
  1031. background #fff
  1032. flex:1;
  1033. overflow-y scroll
  1034. .for-box:nth-child(1){
  1035. border:none;
  1036. }
  1037. .for-null-text{
  1038. text-align center;
  1039. line-height:100rpx;
  1040. color:#999;
  1041. }
  1042. .for-box{
  1043. width:710rpx;
  1044. border-top:1rpx solid #dedede;
  1045. line-height:60rpx;
  1046. height:60rpx;
  1047. padding:20rpx;
  1048. display:flex;
  1049. overflow:hidden;
  1050. text-overflow:ellipsis;
  1051. white-space:nowrap;
  1052. view:nth-child(1){
  1053. flex:1;
  1054. }
  1055. view:nth-child(2){
  1056. width:100rpx;
  1057. text-align center
  1058. border-radius:10rpx;
  1059. background #007AFF
  1060. color:#fff;
  1061. }
  1062. }
  1063. }
  1064. .out-button{
  1065. width:650rpx;
  1066. height:100rpx;
  1067. line-height:100rpx;
  1068. margin:20rpx 50rpx;
  1069. text-align center;
  1070. font-size:32rpx;
  1071. color:#fff;
  1072. background #999;
  1073. border-radius:20rpx;
  1074. }
  1075. }
  1076. .shade-max-box{
  1077. background :rgba(0,0,0,0.2)
  1078. width:100%;
  1079. height:100%;
  1080. position fixed;
  1081. z-index 100;
  1082. .shade-big-box{
  1083. width:626rpx;
  1084. height:567rpx;
  1085. margin:335rpx 63rpx;
  1086. position relative;
  1087. z-index 100;
  1088. img{
  1089. width:626rpx;
  1090. height:567rpx;
  1091. }
  1092. view{
  1093. position absolute
  1094. left:88rpx;
  1095. bottom:100rpx;
  1096. width:450rpx;
  1097. height:80rpx;
  1098. line-height:80rpx;
  1099. text-align center
  1100. color:#fff;
  1101. background #0183FA
  1102. border-radius:40rpx;
  1103. }
  1104. }
  1105. }
  1106. }
  1107. /deep/.input-value-border{
  1108. display :none !important;
  1109. }
  1110. </style>