newApplication.vue 32 KB

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