newApplication.vue 31 KB

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