index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. <template>
  2. <view class="main">
  3. <view class="one">
  4. <view class="one_1">
  5. 基本信息
  6. </view>
  7. <view class="one_2">
  8. <view class="label">
  9. <text class="title">批建时间:</text>
  10. <text class="content">{{info.build_time||'暂无'}}</text>
  11. </view>
  12. <view class="label">
  13. <text class="title">实验室名称:</text>
  14. <text class="content">{{info.name||'暂无'}}</text>
  15. </view>
  16. <view class="label">
  17. <text class="title">英文名称:</text>
  18. <text class="content">{{info.english_name||'暂无'}}</text>
  19. </view>
  20. <view class="label">
  21. <text class="title">所属学科:</text>
  22. <text class="content">{{info.subject||'暂无'}}</text>
  23. </view>
  24. <view class="label">
  25. <text class="title">所属专业:</text>
  26. <text class="content">{{info.major||'暂无'}}</text>
  27. </view>
  28. <view class="label">
  29. <text class="title">实验室面积:</text>
  30. <text class="content">{{info.lab_acreage||'暂无'}}</text>
  31. </view>
  32. <view class="label">
  33. <text class="title">依托单位名称:</text>
  34. <text class="content">{{info.unit_name||'暂无'}}</text>
  35. </view>
  36. <view class="label">
  37. <text class="title">实验室地区:</text>
  38. <text class="content">{{info.zhRegion||'暂无'}}</text>
  39. </view>
  40. <view class="label">
  41. <text class="title">实验室地址:</text>
  42. <text class="content">{{info.lab_address||'暂无'}}</text>
  43. </view>
  44. <view class="label">
  45. <text class="title">实验室建设方案:</text>
  46. <text class="content" @tap.stop="toFile(info.plan)" v-if="info.plan&&info.plan.length>0">
  47. {{info.plan[0].name||'暂无'}}</text>
  48. </view>
  49. <view class="label">
  50. <text class="title">实验室定位:</text>
  51. <text class="content">{{info.position||'暂无'}}</text>
  52. </view>
  53. <view class="label">
  54. <text class="title">实验室简介:</text>
  55. <text class="content">{{info.brief||'暂无'}}</text>
  56. </view>
  57. <view class="label">
  58. <text class="title">实验室标志性照片:</text>
  59. <view class="image">
  60. <view v-for="(item, index) in info.basic_file" :key="index">
  61. <image class="images" :src="item.url" mode="widthFix"></image>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="one">
  68. <view class="one_1">
  69. 实验室主任信息
  70. </view>
  71. <view class="one_2">
  72. <view class="label">
  73. <text class="title">姓名:</text>
  74. <text class="content">{{directorInfo.name||'暂无'}}</text>
  75. </view>
  76. <view class="label">
  77. <text class="title">性别:</text>
  78. <text class="content">{{formatText(directorInfo.gender,genderList)||'暂无'}}</text>
  79. </view>
  80. <view class="label">
  81. <text class="title">出生年月:</text>
  82. <text class="content">{{directorInfo.birth||'暂无'}}</text>
  83. </view>
  84. <view class="label">
  85. <text class="title">证件类别:</text>
  86. <text class="content">{{formatText(directorInfo.cardtype,cardtypeList)||'暂无'}}</text>
  87. </view>
  88. <view class="label">
  89. <text class="title">证件号码:</text>
  90. <text class="content">{{directorInfo.num||'暂无'}}</text>
  91. </view>
  92. <view class="label">
  93. <text class="title">学历:</text>
  94. <text class="content">{{formatText(directorInfo.education,educationList)||'暂无'}}</text>
  95. </view>
  96. <view class="label">
  97. <text class="title">学位:</text>
  98. <text class="content">{{formatText(directorInfo.degree,degreeList)||'暂无'}}</text>
  99. </view>
  100. <view class="label">
  101. <text class="title">职称:</text>
  102. <text class="content">{{formatText(directorInfo.title,titleList)||'暂无'}}</text>
  103. </view>
  104. <view class="label">
  105. <text class="title">研究领域:</text>
  106. <text class="content">{{directorInfo.field||'暂无'}}</text>
  107. </view>
  108. <view class="label">
  109. <text class="title">工作单位:</text>
  110. <text class="content">{{directorInfo.unit||'暂无'}}</text>
  111. </view>
  112. <view class="label">
  113. <text class="title">电子邮箱:</text>
  114. <text class="content">{{directorInfo.email||'暂无'}}</text>
  115. </view>
  116. <view class="label">
  117. <text class="title">办公电话:</text>
  118. <text class="content">{{directorInfo.work_phone||'暂无'}}</text>
  119. </view>
  120. <view class="label">
  121. <text class="title">手机号:</text>
  122. <text class="content">{{directorInfo.phone||'暂无'}}</text>
  123. </view>
  124. </view>
  125. </view>
  126. <view class="one" v-if="list.length>0">
  127. <view class="one_1">
  128. 研究方向
  129. </view>
  130. <view class="one_2">
  131. <view class="list" v-for="(item, index) in list" :key="index">
  132. <view class="name textOver">{{item.name||'暂无'}}</view>
  133. <view class="other">
  134. <view class="other_1 textOne">
  135. 方向带头人:{{getDict(item.person_id,'person_id')||'暂无'}}
  136. </view>
  137. <view class="other_1 textOver">
  138. 核心成员:{{getDict(item.persons,'persons')||'暂无'}}
  139. </view>
  140. <view class="other_1 textOne" @tap.stop="toFile(item.file)"
  141. v-if="item.file&&item.file.length>0">
  142. 附件:{{item.file[0].name||'暂无'}}
  143. </view>
  144. <view class="status textOne">
  145. 是否启用:{{getDict(item.is_show,'is_show')||'暂无'}}
  146. </view>
  147. </view>
  148. </view>
  149. <view class="total">
  150. <uni-pagination :current="page" :pageSize="3" :total="total" @change="toPage" />
  151. </view>
  152. </view>
  153. </view>
  154. <view class="one">
  155. <view class="one_1">
  156. 依托单位
  157. </view>
  158. <view class="one_2">
  159. <view class="label">
  160. <text class="title">名称:</text>
  161. <text class="content">{{unitInfo.name||'暂无'}}</text>
  162. </view>
  163. <view class="label">
  164. <text class="title">通讯地址:</text>
  165. <text class="content">{{unitInfo.address||'暂无'}}</text>
  166. </view>
  167. <view class="label">
  168. <text class="title">联系人:</text>
  169. <text class="content">{{unitInfo.contacts||'暂无'}}</text>
  170. </view>
  171. <view class="label">
  172. <text class="title">联系电话:</text>
  173. <text class="content">{{unitInfo.phone||'暂无'}}</text>
  174. </view>
  175. <view class="label">
  176. <text class="title">单位类别:</text>
  177. <text class="content">{{formatText(unitInfo.type,unittypeList)||'暂无'}}</text>
  178. </view>
  179. <view class="label">
  180. <text class="title">是否为事业单位:</text>
  181. <text class="content">{{formatText(unitInfo.is_career,careerList)||'暂无'}}</text>
  182. </view>
  183. <view class="label">
  184. <text class="title">隶属:</text>
  185. <text class="content">{{formatText(unitInfo.subjection,subjectionList)||'暂无'}}</text>
  186. </view>
  187. </view>
  188. </view>
  189. <view class="one">
  190. <view class="one_1">
  191. 科研助理(日常联系人)
  192. </view>
  193. <view class="one_2">
  194. <view class="label">
  195. <text class="title">姓名:</text>
  196. <text class="content">{{assistantInfo.name||'暂无'}}</text>
  197. </view>
  198. <view class="label">
  199. <text class="title">证件类别:</text>
  200. <text class="content">{{formatText(assistantInfo.cardtype,cardtypeList)||'暂无'}}</text>
  201. </view>
  202. <view class="label">
  203. <text class="title">证件号码:</text>
  204. <text class="content">{{assistantInfo.num||'暂无'}}</text>
  205. </view>
  206. <view class="label">
  207. <text class="title">工作单位:</text>
  208. <text class="content">{{assistantInfo.unit||'暂无'}}</text>
  209. </view>
  210. <view class="label">
  211. <text class="title">电子邮箱:</text>
  212. <text class="content">{{assistantInfo.email||'暂无'}}</text>
  213. </view>
  214. <view class="label">
  215. <text class="title">办公电话:</text>
  216. <text class="content">{{assistantInfo.work_phone||'暂无'}}</text>
  217. </view>
  218. <view class="label">
  219. <text class="title">手机号:</text>
  220. <text class="content">{{assistantInfo.phone||'暂无'}}</text>
  221. </view>
  222. </view>
  223. </view>
  224. <view class="one">
  225. <view class="one_1">
  226. 财务助理
  227. </view>
  228. <view class="one_2">
  229. <view class="label">
  230. <text class="title">是否同以上科研助理:</text>
  231. <text class="content">{{formatText(info.is_alike,alikeList)||'暂无'}}</text>
  232. </view>
  233. <view class="label">
  234. <text class="title">姓名:</text>
  235. <text class="content">{{financeInfo.name||'暂无'}}</text>
  236. </view>
  237. <view class="label">
  238. <text class="title">证件类别:</text>
  239. <text class="content">{{formatText(financeInfo.cardtype,cardtypeList)||'暂无'}}</text>
  240. </view>
  241. <view class="label">
  242. <text class="title">证件号码:</text>
  243. <text class="content">{{financeInfo.num||'暂无'}}</text>
  244. </view>
  245. <view class="label">
  246. <text class="title">工作单位:</text>
  247. <text class="content">{{financeInfo.unit||'暂无'}}</text>
  248. </view>
  249. <view class="label">
  250. <text class="title">电子邮箱:</text>
  251. <text class="content">{{financeInfo.email||'暂无'}}</text>
  252. </view>
  253. <view class="label">
  254. <text class="title">办公电话:</text>
  255. <text class="content">{{financeInfo.work_phone||'暂无'}}</text>
  256. </view>
  257. <view class="label">
  258. <text class="title">手机号:</text>
  259. <text class="content">{{financeInfo.phone||'暂无'}}</text>
  260. </view>
  261. </view>
  262. </view>
  263. </view>
  264. </template>
  265. <script>
  266. export default {
  267. data() {
  268. return {
  269. id: '',
  270. user: {},
  271. info: {},
  272. // 实验室主任信息
  273. directorInfo: {},
  274. // 依托单位
  275. unitInfo: {},
  276. // 科研助理
  277. assistantInfo: {},
  278. // 财务助理
  279. financeInfo: {},
  280. list: [],
  281. total: 0,
  282. skip: 0,
  283. limit: 3,
  284. page: 1,
  285. // 字典表
  286. regionList: [],
  287. genderList: [],
  288. cardtypeList: [],
  289. educationList: [],
  290. degreeList: [],
  291. titleList: [],
  292. unittypeList: [],
  293. careerList: [],
  294. subjectionList: [],
  295. alikeList: [{
  296. dict_value: true,
  297. dict_label: '是'
  298. },
  299. {
  300. dict_value: false,
  301. dict_label: '否'
  302. },
  303. ],
  304. userList: [],
  305. showList: []
  306. }
  307. },
  308. onLoad: async function(e) {
  309. const that = this;
  310. that.$set(that, `id`, e && e.id || '');
  311. await that.searchOther();
  312. that.searchToken();
  313. await that.search();
  314. uni.hideLoading();
  315. },
  316. onPullDownRefresh: async function() {
  317. const that = this;
  318. await that.search();
  319. uni.stopPullDownRefresh();
  320. },
  321. methods: {
  322. searchToken() {
  323. const that = this;
  324. try {
  325. const res = uni.getStorageSync('token');
  326. if (res) {
  327. const user = that.$jwt(res);
  328. that.$set(that, `user`, user);
  329. } else {
  330. uni.navigateTo({
  331. url: `/pages/login/index`
  332. })
  333. }
  334. } catch (e) {
  335. uni.showToast({
  336. title: err.errmsg,
  337. icon: 'error',
  338. duration: 2000
  339. });
  340. }
  341. },
  342. async search() {
  343. const that = this;
  344. if (that.id) {
  345. const res = await that.$api(`/basic/${that.id}`, 'GET', {}, 'freeLabel')
  346. if (res.errcode == '0') {
  347. if (res.data.region) {
  348. for (let val of that.regionList) {
  349. const region = val.children.find(i => i.code == res.data.region)
  350. if (region) res.data.zhRegion = region.name
  351. }
  352. }
  353. that.$set(that, `info`, res.data)
  354. // 实验室主任信息
  355. const director = await that.$api(`/basicDirector`, 'GET', {
  356. lab_id: that.id
  357. }, 'freeLabel')
  358. if (director.errcode == '0' && director.total > 0) {
  359. that.$set(that, `directorInfo`, director.data[0]);
  360. }
  361. // 依托单位信息
  362. if (res.data.declare_unit) that.$set(that, `unitInfo`, res.data.declare_unit)
  363. // 科研助理
  364. if (res.data.assistant) that.$set(that, `assistantInfo`, res.data.assistant)
  365. // 财务助理
  366. if (res.data.finance) that.$set(that, `financeInfo`, res.data.finance)
  367. // 研究方向
  368. that.dirSearch();
  369. } else {
  370. uni.showToast({
  371. title: res.errmsg,
  372. });
  373. }
  374. }
  375. },
  376. // 研究方向
  377. async dirSearch() {
  378. const that = this;
  379. let info = {
  380. skip: that.skip,
  381. limit: that.limit,
  382. lab_id: that.id
  383. }
  384. const res = await that.$api(`/direction`, 'GET', {
  385. ...info
  386. }, 'freeLabel')
  387. if (res.errcode == '0') {
  388. that.$set(that, `list`, res.data)
  389. that.$set(that, `total`, res.total)
  390. } else {
  391. uni.showToast({
  392. title: res.errmsg,
  393. });
  394. }
  395. uni.hideLoading();
  396. },
  397. // 查询字典表
  398. getDict(e, model) {
  399. const that = this;
  400. if (!e) return '暂无'
  401. if (model == 'person_id') {
  402. let data = that.userList.find((i) => i._id == e);
  403. if (data) return data.name;
  404. else return '暂无';
  405. } else if (model == 'persons') {
  406. let list = [];
  407. if (e.length > 0) {
  408. for (const val of e) {
  409. let data = that.userList.find((i) => i._id == val);
  410. if (data) list.push(data.name);
  411. }
  412. return list.join(',');
  413. }
  414. } else if (model == 'is_show') {
  415. let data = that.showList.find((i) => i.dict_value == e);
  416. if (data) return data.dict_label;
  417. else return '暂无';
  418. }
  419. },
  420. // 整理数据
  421. formatText(item, model) {
  422. const that = this;
  423. if (item) {
  424. let data = model.find((i) => i.dict_value == item);
  425. if (data) return data.dict_label;
  426. else return '暂无';
  427. }
  428. },
  429. // 查看文件
  430. toFile(item) {
  431. const that = this;
  432. let serverUrl = that.$config.serverFile;
  433. let url = item[0].url
  434. // 判断前面是否有http
  435. const http = url.lastIndexOf("http");
  436. if (http == -1) url = serverUrl + url
  437. //获取最后一个.的位置
  438. const arr = url.lastIndexOf(".");
  439. //获取后缀
  440. const typeName = url.substr(arr + 1);
  441. //支持预览的文件类型
  442. //微信小程序
  443. let fileType = ['doc', 'xls', 'ppt', 'pdf', 'docx', 'xlsx', 'pptx'];
  444. uni.showLoading({
  445. title: '加载中',
  446. mask: true
  447. })
  448. //下载文件资源到本地
  449. uni.downloadFile({
  450. url: url,
  451. success: function(res) {
  452. uni.hideLoading();
  453. var filePath = res.tempFilePath;
  454. if (!fileType.includes(typeName)) {
  455. return false;
  456. }
  457. uni.showLoading({
  458. title: '正在打开',
  459. mask: true
  460. })
  461. // 新开页面打开文档,支持格式:doc, xls, ppt, pdf, docx, xlsx, pptx。
  462. uni.openDocument({
  463. filePath: filePath,
  464. fileType: typeName, // 文件类型,指定文件类型打开文件,有效值 doc, xls, ppt, pdf, docx, xlsx, pptx
  465. success: res => {
  466. uni.hideLoading();
  467. console.log('打开文档成功', res);
  468. },
  469. fail: openError => {
  470. uni.hideLoading();
  471. console.log('fail:' + JSON.stringify(openError));
  472. }
  473. });
  474. },
  475. fail: function(err) {
  476. uni.hideLoading();
  477. console.log('fail:' + JSON.stringify(err));
  478. }
  479. });
  480. },
  481. // 分页
  482. toPage(e) {
  483. const that = this;
  484. uni.showLoading({
  485. title: '加载中',
  486. mask: true
  487. })
  488. that.$set(that, `page`, e.current);
  489. const page = e.current - 1;
  490. const skip = page * that.limit;
  491. that.$set(that, `skip`, skip)
  492. that.dirSearch();
  493. },
  494. async searchOther() {
  495. const that = this;
  496. let res;
  497. uni.showLoading({
  498. title: '正在加载请稍后',
  499. mask: true
  500. })
  501. //地区
  502. res = await that.$api('/region', 'GET', {
  503. code: '220000',
  504. status: '0'
  505. }, 'freeLabel')
  506. if (res.errcode == '0') that.$set(that, `regionList`, res.data);
  507. //性别
  508. res = await that.$api('/dictData', 'GET', {
  509. dict_type: 'sys_user_sex',
  510. status: '0'
  511. }, 'jcyjdtglpt')
  512. if (res.errcode == '0') that.$set(that, `genderList`, res.data);
  513. //证件类别
  514. res = await that.$api('/dictData', 'GET', {
  515. dict_type: 'leading_cadre_cardtype',
  516. status: '0'
  517. }, 'jcyjdtglpt')
  518. if (res.errcode == '0') that.$set(that, `cardtypeList`, res.data);
  519. //学历
  520. res = await that.$api('/dictData', 'GET', {
  521. dict_type: 'education',
  522. status: '0'
  523. }, 'jcyjdtglpt')
  524. if (res.errcode == '0') that.$set(that, `educationList`, res.data);
  525. //学位
  526. res = await that.$api('/dictData', 'GET', {
  527. dict_type: 'degree',
  528. status: '0'
  529. }, 'jcyjdtglpt')
  530. if (res.errcode == '0') that.$set(that, `degreeList`, res.data);
  531. //职称
  532. res = await that.$api('/dictData', 'GET', {
  533. dict_type: 'title',
  534. status: '0'
  535. }, 'jcyjdtglpt')
  536. if (res.errcode == '0') that.$set(that, `titleList`, res.data);
  537. //单位类别
  538. res = await that.$api('/dictData', 'GET', {
  539. dict_type: 'declare_unit_type',
  540. status: '0'
  541. }, 'jcyjdtglpt')
  542. if (res.errcode == '0') that.$set(that, `unittypeList`, res.data);
  543. //事业单位
  544. res = await that.$api('/dictData', 'GET', {
  545. dict_type: 'declare_unit_career',
  546. status: '0'
  547. }, 'jcyjdtglpt')
  548. if (res.errcode == '0') that.$set(that, `careerList`, res.data);
  549. //隶属
  550. res = await that.$api('/dictData', 'GET', {
  551. dict_type: 'declare_unit_subjection',
  552. status: '0'
  553. }, 'jcyjdtglpt')
  554. if (res.errcode == '0') that.$set(that, `subjectionList`, res.data);
  555. //是否启用
  556. res = await that.$api('/dictData', 'GET', {
  557. dict_type: 'info_show',
  558. status: '0'
  559. }, 'jcyjdtglpt')
  560. if (res.errcode == '0') that.$set(that, `showList`, res.data);
  561. // 固定/流动人员 作者
  562. let personList = [];
  563. res = await that.$api('/fixedpersonnel', 'GET', {
  564. status: '0'
  565. }, 'freeLabel')
  566. if (res.errcode == '0') personList = res.data;
  567. res = await that.$api('/flowpersonnel', 'GET', {
  568. status: '0'
  569. }, 'freeLabel')
  570. if (res.errcode == '0') personList.push(...res.data);
  571. that.$set(that, `userList`, personList);
  572. },
  573. }
  574. }
  575. </script>
  576. <style lang="scss" scoped>
  577. .main {
  578. background-color: var(--f9Color);
  579. .one {
  580. padding: 2vw;
  581. .one_1 {
  582. padding: 2vw;
  583. font-size: var(--font16Size);
  584. font-weight: bold;
  585. margin: 0 0 2vw 0;
  586. border-bottom: 1px var(--fcColor) dashed;
  587. }
  588. .one_2 {
  589. background-color: var(--mainColor);
  590. padding: 2vw;
  591. margin: 0 0 2vw 0;
  592. border-radius: 5px;
  593. .label {
  594. margin: 0 0 1vw 0;
  595. .title {
  596. font-size: var(--font14Size);
  597. font-weight: bold;
  598. }
  599. .content {
  600. margin: 0 0 0 1vw;
  601. color: var(--f85Color);
  602. font-size: var(--font14Size);
  603. }
  604. .image {
  605. .images {
  606. width: 100%;
  607. margin: 0 0 1vw 0;
  608. }
  609. }
  610. }
  611. .list {
  612. background-color: var(--mainColor);
  613. border: 1px solid var(--f5Color);
  614. padding: 2vw;
  615. margin: 0 2vw 2vw 2vw;
  616. border-radius: 5px;
  617. .name {
  618. font-size: var(--font14Size);
  619. font-weight: bold;
  620. }
  621. .other {
  622. font-size: var(--font12Size);
  623. color: var(--f85Color);
  624. .other_1 {
  625. margin: 1vw 0 0 0;
  626. }
  627. }
  628. .status {
  629. padding: 1vw 0 0 0;
  630. font-size: var(--font12Size);
  631. color: var(--fF0Color);
  632. }
  633. }
  634. }
  635. }
  636. }
  637. </style>