newApplication.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142
  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="@/images/basicsModules/icon_pdf.png" v-if="minItem.type == 'pdf'">
  96. <img class="left-img-box" src="@/images/basicsModules/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="@/images/basicsModules/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="@/images/basicsModules/icon_pdf.png" v-if="minItem.type == 'pdf'">
  136. <img class="left-img-box" src="@/images/basicsModules/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="@/images/basicsModules/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/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/apiDemo/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. this.subjectData = data.data;
  696. this.sysUser=data.data.sysUser;
  697. this.sysUser.nickName==null?'':this.sysUser.nickName;
  698. this.sysUser.phonenumber==null?'':this.sysUser.phonenumber;
  699. this.sysUser.userName==null?'':this.sysUser.userName;
  700. this.sysUser.cardNum==null?'':this.sysUser.cardNum;
  701. this.sysUser.grade==null?'':this.sysUser.grade;
  702. this.sysUser.tutorUserName==null?'':this.sysUser.tutorUserName;
  703. if(this.infoType){
  704. this.validLength = this.infoData.labSecurityApply.validLength;
  705. for(let i=0;i<self.infoData.listTemp.length;i++){
  706. if(self.infoData.listTemp[i].materialType == 1){
  707. if(self.subjectData.sysUser.userType == '11'){
  708. for(let o=0;o<self.subjectData.listTeacher.length;o++){
  709. if(self.subjectData.listTeacher[o].materialType == 1 && self.subjectData.listTeacher[o].id == self.infoData.listTemp[i].id){
  710. self.subjectData.listTeacher[o].upList = JSON.parse(JSON.stringify(self.infoData.listTemp[i].upList));
  711. }
  712. }
  713. }else if(self.subjectData.sysUser.userType == '22'){
  714. for(let o=0;o<self.subjectData.listStudent.length;o++){
  715. if(self.subjectData.listStudent[o].materialType == 1 && self.subjectData.listStudent[o].id == self.infoData.listTemp[i].id){
  716. self.subjectData.listStudent[o].upList = JSON.parse(JSON.stringify(self.infoData.listTemp[i].upList));
  717. }
  718. }
  719. }
  720. }
  721. }
  722. }
  723. this.pageType = 1;
  724. }
  725. },
  726. //有效期选中
  727. buttonChange2(e){
  728. console.log("e",e.mp.detail.value);
  729. this.buttonArrayIndex2 = e.mp.detail.value;
  730. this.validLength = this.buttonArray2[e.mp.detail.value].value;
  731. },
  732. //查询实验室
  733. async subjectList(){
  734. let obj = {
  735. name:this.subjectName
  736. }
  737. const {data} = await subjectList(obj)
  738. if(data.code == 200){
  739. this.searchList = data.data;
  740. if(!data.data[0]){
  741. this.nullText = "暂无数据"
  742. }
  743. }
  744. },
  745. //生成有效期
  746. addTime(){
  747. let list = [];
  748. for(let i=1;i<61;i++){
  749. let obj = {
  750. name:i+"个月",
  751. value:i,
  752. }
  753. list.push(obj)
  754. }
  755. this.$set(this,'buttonArray2',list);
  756. },
  757. }
  758. }
  759. </script>
  760. <style lang="stylus" scoped>
  761. #newApplication{
  762. height:auto;
  763. width:100%;
  764. display flex
  765. flex-direction column
  766. .user-info-box{
  767. background #fff;
  768. border-radius:20rpx;
  769. margin:20rpx 20rpx;
  770. padding:20rpx 0 0;
  771. .user-info-box_title{
  772. font-size: 30rpx;
  773. font-family: PingFang SC;
  774. font-weight: 500;
  775. color: #333333;
  776. line-height: 30rpx;
  777. margin-left: 24rpx
  778. margin-bottom :10px;
  779. }
  780. .user-info-box-min{
  781. margin:0 26rpx;
  782. display flex;
  783. align-items center;
  784. view{
  785. line-height:66rpx;
  786. font-size:28rpx;
  787. }
  788. view:nth-child(1){
  789. color:red;
  790. line-height:28rpx;
  791. position: relative;
  792. top: 4rpx;
  793. }
  794. view:nth-child(2){
  795. flex:1;
  796. color:#999;
  797. }
  798. view:nth-child(3){
  799. flex:1;
  800. text-align right;
  801. color:#333;
  802. }
  803. >input{
  804. width 460rpx;
  805. }
  806. }
  807. .picker-title-box{
  808. padding:0 20rpx;
  809. display flex;
  810. justify-content flex-start;
  811. align-items center;
  812. view{
  813. line-height:80rpx;
  814. font-size:28rpx;
  815. }
  816. view:nth-child(1){
  817. color:red;
  818. line-height:28rpx;
  819. }
  820. view:nth-child(2){
  821. }
  822. view:nth-child(3){
  823. color:#999;
  824. }
  825. }
  826. }
  827. .newApplication-page{
  828. background #fff
  829. margin:20rpx 20rpx 160rpx;
  830. padding-bottom:20rpx;
  831. border-radius:20rpx;
  832. .picker-max-box{
  833. /* 申请备注 */
  834. .remark{
  835. width:627rpx;
  836. height:200rpx;
  837. font-size:28rpx;
  838. margin:0 20rpx;
  839. border: 2rpx solid #a2a2a2;
  840. border-radius:10rpx;
  841. padding:20rpx;
  842. }
  843. /* 申请期限 */
  844. .apply_data{
  845. width: 667rpx;
  846. height: 82rpx;
  847. background: #FFFFFF;
  848. border: 2rpx solid #A2A2A2;
  849. border-radius: 10rpx;
  850. display :flex;
  851. justify-content :space-between;
  852. align-items center;
  853. margin :0 20rpx;
  854. padding :0 30rpx;
  855. box-sizing border-box;
  856. >picker{
  857. >view{
  858. font-size: 28rpx;
  859. font-family: PingFang SC;
  860. font-weight: 500;
  861. color: #999999;
  862. line-height: 82rpx;
  863. }
  864. }
  865. }
  866. .picker-title-box{
  867. padding:0 20rpx;
  868. display flex;
  869. justify-content flex-start;
  870. align-items center;
  871. view{
  872. line-height:80rpx;
  873. font-size:28rpx;
  874. }
  875. view:nth-child(1){
  876. color:red;
  877. }
  878. view:nth-child(2){
  879. }
  880. view:nth-child(3){
  881. color:#999;
  882. }
  883. }
  884. .picker-input-box{
  885. padding:0 20rpx;
  886. display flex;
  887. height:80rpx;
  888. width:627rpx;
  889. border:1rpx solid #a2a2a2;
  890. border-radius:10rpx;
  891. margin:0 20rpx;
  892. }
  893. .picker-min-box{
  894. display flex;
  895. height:80rpx;
  896. width:667rpx;
  897. border:1rpx solid #a2a2a2;
  898. border-radius:10rpx;
  899. margin:0 20rpx;
  900. view{
  901. flex:1;
  902. line-height:80rpx;
  903. padding:0 20rpx;
  904. color:#999;
  905. font-size:28rpx;
  906. }
  907. img{
  908. width:24rpx;
  909. height:12rpx;
  910. margin:35rpx 23rpx;
  911. }
  912. }
  913. .picker-text-box{
  914. padding:0 50rpx;
  915. height:60rpx;
  916. line-height:60rpx;
  917. font-size:28rpx;
  918. color:#999;
  919. }
  920. .picker-text-info-box{
  921. color:#999;
  922. font-size:28rpx;
  923. line-height:40rpx;
  924. padding:0 20rpx;
  925. }
  926. .picker-up-img-box{
  927. margin:40rpx auto;
  928. width:640rpx;
  929. height:250rpx;
  930. border:2px dashed #E0E0E0;
  931. border-radius:20rpx;
  932. background: #F8F8F8;
  933. view:nth-child(1){
  934. margin-top:30rpx;
  935. font-size:80rpx;
  936. color:#e0e0e0;
  937. text-align center;
  938. }
  939. view:nth-child(2){
  940. font-weight:700;
  941. font-size:28rpx;
  942. color:#999;
  943. text-align center;
  944. }
  945. }
  946. .picker-for-item-box{
  947. display flex;
  948. margin:20rpx 0;
  949. .left-img-box{
  950. margin:0 20rpx;
  951. width:60rpx;
  952. height:60rpx;
  953. }
  954. .center-text-box{
  955. flex:1;
  956. line-height:60rpx;
  957. font-size:28rpx;
  958. color:#333;
  959. display:block;
  960. overflow:hidden;
  961. text-overflow:ellipsis;
  962. white-space:nowrap;
  963. }
  964. .right-img-box{
  965. width:30rpx;
  966. height:30rpx;
  967. margin:15rpx 20rpx;
  968. }
  969. }
  970. .up-data-button{
  971. width:500rpx;
  972. height:80rpx;
  973. margin:40rpx auto;
  974. line-height:80rpx;
  975. text-align center;
  976. font-size:28rpx;
  977. border-radius:10rpx;
  978. color:#0183FA;
  979. border:1rpx dashed #0183FA;
  980. }
  981. }
  982. }
  983. .bottom-button{
  984. position fixed;
  985. bottom:20rpx;
  986. left:25rpx;
  987. z-index :500;
  988. width:700rpx;
  989. line-height:100rpx;
  990. border-radius:20rpx;
  991. background #0183FA;
  992. color:#fff;
  993. text-align center;
  994. }
  995. .pageTwo{
  996. flex:1;
  997. display flex;
  998. flex-direction column;
  999. overflow-y hidden
  1000. .pageTwo-input-box{
  1001. display flex;
  1002. padding:20rpx 25rpx;
  1003. background #fff
  1004. margin-bottom:20rpx;
  1005. input{
  1006. padding:0 20rpx;
  1007. width:460rpx;
  1008. line-height:80rpx;
  1009. height:80rpx;
  1010. border-top:1rpx solid #a2a2a2;
  1011. border-left:1rpx solid #a2a2a2;
  1012. border-bottom:1rpx solid #a2a2a2;
  1013. border-bottom-left-radius:10rpx;
  1014. border-top-left-radius:10rpx;
  1015. }
  1016. view{
  1017. width:200rpx;
  1018. line-height:80rpx;
  1019. height:80rpx;
  1020. border:1rpx solid #007AFF;
  1021. color:#fff;
  1022. background #007AFF;
  1023. text-align center;
  1024. border-top-right-radius:10rpx;
  1025. border-bottom-right-radius:10rpx;
  1026. }
  1027. }
  1028. .for-max-box{
  1029. background #fff
  1030. flex:1;
  1031. overflow-y scroll
  1032. .for-box:nth-child(1){
  1033. border:none;
  1034. }
  1035. .for-null-text{
  1036. text-align center;
  1037. line-height:100rpx;
  1038. color:#999;
  1039. }
  1040. .for-box{
  1041. width:710rpx;
  1042. border-top:1rpx solid #dedede;
  1043. line-height:60rpx;
  1044. height:60rpx;
  1045. padding:20rpx;
  1046. display:flex;
  1047. overflow:hidden;
  1048. text-overflow:ellipsis;
  1049. white-space:nowrap;
  1050. view:nth-child(1){
  1051. flex:1;
  1052. }
  1053. view:nth-child(2){
  1054. width:100rpx;
  1055. text-align center
  1056. border-radius:10rpx;
  1057. background #007AFF
  1058. color:#fff;
  1059. }
  1060. }
  1061. }
  1062. .out-button{
  1063. width:650rpx;
  1064. height:100rpx;
  1065. line-height:100rpx;
  1066. margin:20rpx 50rpx;
  1067. text-align center;
  1068. font-size:32rpx;
  1069. color:#fff;
  1070. background #999;
  1071. border-radius:20rpx;
  1072. }
  1073. }
  1074. .shade-max-box{
  1075. background :rgba(0,0,0,0.2)
  1076. width:100%;
  1077. height:100%;
  1078. position fixed;
  1079. z-index 100;
  1080. .shade-big-box{
  1081. width:626rpx;
  1082. height:567rpx;
  1083. margin:335rpx 63rpx;
  1084. position relative;
  1085. z-index 100;
  1086. img{
  1087. width:626rpx;
  1088. height:567rpx;
  1089. }
  1090. view{
  1091. position absolute
  1092. left:88rpx;
  1093. bottom:100rpx;
  1094. width:450rpx;
  1095. height:80rpx;
  1096. line-height:80rpx;
  1097. text-align center
  1098. color:#fff;
  1099. background #0183FA
  1100. border-radius:40rpx;
  1101. }
  1102. }
  1103. }
  1104. }
  1105. /deep/.input-value-border{
  1106. display :none !important;
  1107. }
  1108. </style>