ResourceSharingResourceIssue.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. <template>
  2. <div class="autoBox box" style="min-height: 900px;position: relative;">
  3. <div class="crumbs">
  4. <div style="overflow: hidden">
  5. <el-breadcrumb separator-class="el-icon-arrow-right" style="float: left">
  6. <el-breadcrumb-item :to="{ path: 'home' }">{{$t('common.Home')}}</el-breadcrumb-item>
  7. <el-breadcrumb-item :to="{ path: 'resourceSharing' }" class="pointer">{{$t('common.ResourceSharing')}}</el-breadcrumb-item>
  8. <el-breadcrumb-item>{{$t('common.resourceResearchResourceIssue')}}</el-breadcrumb-item>
  9. </el-breadcrumb>
  10. </div>
  11. <div class="content">
  12. <div class="addLanguage">
  13. <i class="el-icon-orange" style="font-size: 30px;line-height: 50px;color: #E6A23C;vertical-align: middle;"></i>
  14. <span style="font-size: 18px;line-height: 50px;margin-left: 20px;vertical-align: middle;">{{$t('common.resourceLanguageVersion')}}</span>
  15. <!-- <i class="el-icon-plus" style="font-size: 30px;font-weight: 600;margin-left: 20px;line-height: 50px; color: #E6A23C;vertical-align: middle;"></i>-->
  16. <!-- <i class="el-icon-plus" style="font-size: 30px;font-weight: 600;margin-left: 20px;line-height: 50px; color: #E6A23C;vertical-align: middle;"-->
  17. <!-- @click="addTabDialog(editableTabsValue)"></i>-->
  18. </div>
  19. <div class="issue">
  20. <el-tabs v-model="editableTabsValue" type="card" closable @tab-remove="removeTab">
  21. <el-tab-pane
  22. v-for="(item, index) in languageList"
  23. :key="item.name"
  24. :label="$t(item.title)"
  25. :name="item.name"
  26. >
  27. <div style="width: 100%;padding: 0 150px;box-sizing: border-box">
  28. <el-form ref="form" :model="form" :rules="rules" label-width="140px">
  29. <!--资源类型 调研资源-->
  30. <el-form-item required :label="$t('common.resourceTheResourceType')">
  31. <!--<el-select style="width: 320px;" v-model="form.public.resourceTypeSelectValue1" :placeholder="$t('common.resource')" @change="resourceType">
  32. <el-option
  33. v-for="item in form.public.resourceTypeSelect"
  34. :label="item.value"
  35. :value="item">
  36. </el-option>
  37. </el-select>-->
  38. <el-input :value="$t('common.researchResource')" style="width: 320px;float: left;" disabled class="research"></el-input>
  39. <el-select v-model="form.public.resourceTypeSelectValue" :placeholder="$t('common.resourcePleaseSelectTheSecondaryType')" style="width: 320px;float: right;">
  40. <el-option
  41. v-for="item in form.public.resourceTypeSelect"
  42. :label="item.label"
  43. :value="item">
  44. </el-option>
  45. </el-select>
  46. </el-form-item>
  47. <!--媒体-->
  48. <el-form-item :label="$t('common.resourceResearchResourceMedia')">
  49. <el-upload
  50. class="upload-demo"
  51. action="/api/file/upload/attachment?module=BaseResearchResourcesInfoForm&attachmentBusinessType=base_research_resource_info_media"
  52. :before-upload="beforeUploadMedia"
  53. :on-remove="onRemoveMedia"
  54. :on-preview="onPreviewMedia"
  55. list-type="picture"
  56. :on-success="handleAvatarSuccessMedia"
  57. :limit="1"
  58. :headers="myHeaders"
  59. :file-list="fileList">
  60. <el-button size="small" type="primary">{{$t('common.resourceSelectUploadFile')}}</el-button>
  61. <div slot="tip" class="el-upload__tip" style="display: inline-block;margin-left: 5px;">{{$t('common.resourceUploadJPGPNG')}},{{$t('common.resourceFilesCannotExceed10Mb')}},{{$t('common.resourceUploadOne')}}</div>
  62. </el-upload>
  63. </el-form-item>
  64. <!--名称-->
  65. <el-form-item required :label="$t('common.resourceName')">
  66. <el-input v-model="form[item.language].name"
  67. :placeholder="$t('common.resourcePleaseEnterTheName')"
  68. ></el-input>
  69. </el-form-item>
  70. <!--所属单位-->
  71. <el-form-item required :label="$t('common.resourceSubordinateUnits')">
  72. <el-input v-model="form[item.language].affiliatedUnitName"
  73. :placeholder="$t('common.resourcePleaseEnterUnit')"
  74. ></el-input>
  75. </el-form-item>
  76. <!--国家-->
  77. <el-form-item required :label="$t('common.resourceCountries')">
  78. <el-select style="width: 320px;" v-model="form.public.resourceCountrySelectValue1" :placeholder="$t('common.resourcePleaseSelectContinent')" @change="resourceCountry">
  79. <el-option
  80. v-for="item in form.public.resourceCountrySelect"
  81. :label="item.label"
  82. :value="item">
  83. </el-option>
  84. </el-select>
  85. <el-select v-model="form.public.resourceCountrySelectValue2" :placeholder="$t('common.resourcePleaseSelectCountry')" style="width: 320px;float: right;">
  86. <el-option
  87. v-for="item in form.public.resourceCountrySelectValue1.data"
  88. :label="item.label"
  89. :value="item">
  90. </el-option>
  91. </el-select>
  92. </el-form-item>
  93. <!--联系人-->
  94. <el-form-item required :label="$t('common.resourceTheContact')">
  95. <el-input v-model="form[item.language].contactsName"
  96. :placeholder="$t('common.resourcePleaseEnterTheContactName')"
  97. ></el-input>
  98. </el-form-item>
  99. <!--联系电话-->
  100. <el-form-item :label="$t('common.resourceContactPhoneNumber')">
  101. <el-input v-model="form[item.language].contactsNumber"
  102. :placeholder="$t('common.resourcePleaseEnterYourContactNumber')"
  103. ></el-input>
  104. </el-form-item>
  105. <!--摘要-->
  106. <el-form-item :label="$t('common.resourceDetailsAbstract')">
  107. <el-input
  108. type="textarea"
  109. :placeholder="$t('common.resourcePleaseEnterSummary')"
  110. v-model="form[item.language].details"
  111. maxlength="500"
  112. show-word-limit
  113. rows="6"
  114. >
  115. </el-input>
  116. </el-form-item>
  117. <!--视频-->
  118. <el-form-item :label="$t('common.resourceResearchResourceVideo')">
  119. <el-upload
  120. class="upload-demo"
  121. action="/api/resourceshare/baseResearchResourcesInfos/uploadVideo"
  122. :before-upload="beforeUploadVideo"
  123. :on-remove="onRemoveVideo"
  124. :on-preview="onPreviewVideo"
  125. :on-success="handleAvatarSuccessVideo"
  126. :limit="1"
  127. :headers="myHeadersVideo"
  128. :file-list="fileList"
  129. :data="video"
  130. name="layuiVideo">
  131. <el-button size="small" type="primary">{{$t('common.resourceSelectUploadFile')}}</el-button>
  132. <div slot="tip" class="el-upload__tip" style="display: inline-block;margin-left: 5px;">{{$t('common.resourceUploadJPGPNG')}},{{$t('common.resourceFilesCannotExceed')}}50MB,{{$t('common.resourceUploadOne')}}</div>
  133. </el-upload>
  134. </el-form-item>
  135. <!--附件-->
  136. <el-form-item :label="$t('common.resourceTheAttachment')">
  137. <el-upload
  138. class="upload-demo"
  139. action="/api/file/upload/attachment?module=BaseResearchResourcesInfoForm&attachmentBusinessType=base_research_resource_info_file"
  140. :before-upload="beforeUploadFile"
  141. :on-remove="onRemoveFile"
  142. :on-preview="onPreviewFile"
  143. :on-success="handleAvatarSuccessFile"
  144. :limit="1"
  145. :headers="myHeaders"
  146. :file-list="fileList">
  147. <el-button size="small" type="primary">{{$t('common.resourceSelectUploadFile')}}</el-button>
  148. <div slot="tip" class="el-upload__tip" style="display: inline-block;margin-left: 5px;">{{$t('common.resourceUploadPDF')}},{{$t('common.resourceFilesCannotExceed50Mb')}}</div>
  149. </el-upload>
  150. </el-form-item>
  151. <!--轮播图-->
  152. <el-form-item :label="$t('common.resourceSlideshow')">
  153. <el-upload
  154. class="upload-demo"
  155. action="/api/file/upload/img?module=BaseResearchResourcesEntityForm"
  156. :before-upload="beforeUploadBanner"
  157. :on-remove="onRemoveBanner"
  158. :on-preview="onPreviewBanner"
  159. list-type="picture"
  160. :on-success="handleAvatarSuccessBanner"
  161. :limit="1"
  162. :headers="myHeaders"
  163. :file-list="fileList">
  164. <el-button size="small" type="primary">{{$t('common.resourceSelectUploadFile')}}</el-button>
  165. <div slot="tip" class="el-upload__tip" style="display: inline-block;margin-left: 5px;">{{$t('common.resourceUploadJPGPNG')}},{{$t('common.resourceFilesCannotExceed10Mb')}}</div>
  166. </el-upload>
  167. </el-form-item>
  168. <el-form-item style="text-align: center;">
  169. <el-button style="margin-right: 50px;">{{$t('common.resourceCancel')}}</el-button>
  170. <el-button type="primary" @click="onSubmit">{{$t('common.resourceRelease')}}</el-button>
  171. </el-form-item>
  172. </el-form>
  173. </div>
  174. </el-tab-pane>
  175. </el-tabs>
  176. </div>
  177. </div>
  178. </div>
  179. <el-dialog
  180. :visible.sync="dialogVisible"
  181. width="60%"
  182. height="80%"
  183. :before-close="beforeClose">
  184. <div>
  185. <!-- <img :src="'api/file/pub/'+ dialogVisibleImg" alt="">-->
  186. <img :src="'api/file/pub/'+ dialogVisibleImg" alt="" style="width: 100%" v-show="dialogVisibleImg!=''">
  187. <video :src="'api/file/pub/'+ dialogVisibleVideo" style="width: 100%" v-show="dialogVisibleVideo!=''"
  188. type="video/mp4" controls="controls" width="100%" autoplay preload="auto"></video>
  189. <iframe :src="'api/file/pub/'+ dialogVisiblePdf" frameborder="0" v-show="dialogVisiblePdf!=''" style="width: 100%;height: 800px;"></iframe>
  190. </div>
  191. </el-dialog>
  192. <el-dialog
  193. :title="$t('common.resourceLanguageVersion')"
  194. :visible.sync="addLanguage"
  195. width="30%">
  196. <div>
  197. <el-select v-model="addLanguageValue">
  198. <el-option
  199. v-for="item in addLanguageOptions"
  200. :label="$t(item.label)"
  201. :value="item"
  202. :style="!item.label==languageList.title">
  203. </el-option>
  204. </el-select>
  205. </div>
  206. <span slot="footer" class="dialog-footer">
  207. <el-button @click="languageClose">取 消</el-button>
  208. <el-button type="primary" @click="addTab">确 定</el-button>
  209. </span>
  210. </el-dialog>
  211. </div>
  212. </template>
  213. <script>
  214. import Base from "@/views/base/Base";
  215. import {getDicts} from '@/api/dict';
  216. import { saveOrUpdate,UpdateVideo } from "@/api/research/resource/baseResearchResourcesEntity";
  217. import { getToken ,resetToken} from '@/utils/auth'
  218. import { getTreeByLanguagePortal } from "@/api/operation/baseCityInformationDict";
  219. export default {
  220. name: "resourceSharingResourceIssue",
  221. extends: Base,
  222. data(){
  223. return{
  224. dialogVisible:false,
  225. dialogVisibleImg:'',
  226. dialogVisibleVideo:'',
  227. dialogVisiblePdf:'',
  228. addLanguage:false,
  229. addLanguageOptions: [
  230. {
  231. label: "common.Chinese",
  232. name: '1',
  233. value: 'CN',
  234. },
  235. {
  236. label: 'common.English',
  237. name: '2',
  238. value: 'EN',
  239. }
  240. ],
  241. addLanguageValue: '',
  242. video:{dir:'media'},
  243. myHeaders: {Authorization: ('Bearer ' +getToken())},
  244. myHeadersVideo: {Authorization: ('Bearer ' +getToken())},
  245. fileList:[],
  246. editableTabsValue: '1',
  247. languageList:[
  248. {
  249. title: "common.Chinese",
  250. name: '1',
  251. language: 'CN',
  252. },
  253. {
  254. title: 'common.English',
  255. name: '2',
  256. language: 'EN',
  257. }
  258. ],
  259. tabIndex: 2,
  260. form: {
  261. public:{
  262. resourceTypeSelectValue:'',
  263. resourceTypeSelect:[],
  264. resourceCountrySelectValue1:'',
  265. resourceCountrySelectValue2:'',
  266. resourceCountrySelectValue:'',
  267. resourceCountrySelect:[],
  268. },
  269. CN:{
  270. language:"ZH",
  271. reserveOne:2, // 资源类型
  272. researchResourcesType:'',
  273. name:'',
  274. affiliatedUnitName:'',
  275. country:'',//国家
  276. continent:'',//大洲
  277. contactsName:'',
  278. contactsNumber:'',
  279. researchResourceAbstract:'',
  280. researchResourcesMediaVideo:'',
  281. reserveTwo:'',//轮播图
  282. },
  283. EN:{
  284. language:"EN",
  285. reserveOne:2, // 资源类型
  286. researchResourcesType:'',
  287. name:'',
  288. affiliatedUnitName:'',
  289. country:'',//国家
  290. continent:'',//大洲
  291. contactsName:'',
  292. contactsNumber:'',
  293. researchResourceAbstract:'',
  294. researchResourcesMediaVideo:'',
  295. reserveTwo:'',//轮播图
  296. }
  297. },
  298. baseResearchResourcesInfo:{
  299. reserveOne:2, // 资源类型
  300. researchResourcesType:'',
  301. researchResourcesMedia:'',
  302. name:'',
  303. affiliatedUnitName:'',
  304. country:'',//国家
  305. continent:'',//大洲
  306. contactsName:'',
  307. contactsNumber:'',
  308. details:'',
  309. researchResourcesMediaVideo:'',
  310. fileAddress:'',
  311. reserveTwo:'',
  312. },
  313. mediaFileMap: new Map(),
  314. fileMap: new Map(),
  315. rules: {
  316. name: [
  317. { required: true},
  318. ],
  319. },
  320. }
  321. },
  322. mounted() {
  323. if (!this.$Cookies.get('token')){
  324. this.toView('resourceSharing',1)
  325. }else{
  326. this.initData();
  327. };
  328. },
  329. watch:{
  330. '$i18n.locale'(){
  331. this.initData();
  332. },
  333. },
  334. methods:{
  335. initData(){
  336. this.getData();
  337. },
  338. resourceType(data){
  339. let that = this;
  340. if (data.value === 'Research results' || data.value === '研究成果'){
  341. that.baseResearchResourcesInfo.reserveOne = 1;
  342. }else{
  343. that.baseResearchResourcesInfo.reserveOne = 2;
  344. }
  345. },
  346. resourceCountry(data){
  347. this.form.public.resourceTypeSelectValue2 = '';
  348. let that = this;
  349. },
  350. addTabDialog(){
  351. const that = this;
  352. that.addLanguage = true;
  353. },
  354. languageClose(){
  355. const that = this;
  356. that.addLanguage = false;
  357. },
  358. addTab(targetName) {
  359. const that = this;
  360. that.addLanguage = false;
  361. // let newTabName = ++this.tabIndex + '';
  362. // this.languageList.push({
  363. // title: 'New Tab',
  364. // name: newTabName,
  365. // content: 'New Tab content'
  366. // });
  367. // this.editableTabsValue = newTabName;
  368. },
  369. removeTab(targetName) {
  370. let tabs = this.languageList;
  371. let activeName = this.editableTabsValue;
  372. if (activeName === targetName) {
  373. tabs.forEach((tab, index) => {
  374. if (tab.name === targetName) {
  375. let nextTab = tabs[index + 1] || tabs[index - 1];
  376. if (nextTab) {
  377. activeName = nextTab.name;
  378. }
  379. }
  380. });
  381. }
  382. this.editableTabsValue = activeName;
  383. this.languageList = tabs.filter(tab => tab.name !== targetName);
  384. },
  385. onSubmit() {
  386. const that = this;
  387. //选择器
  388. that.form.CN.researchResourcesType = that.form.EN.researchResourcesType = that.form.public.resourceTypeSelectValue.value;
  389. that.form.CN.continent = that.form.EN.continent = that.form.public.resourceCountrySelectValue1.value;
  390. that.form.CN.country = that.form.EN.country = that.form.public.resourceCountrySelectValue2.value;
  391. let data = []
  392. data.push(that.form.CN)
  393. data.push(that.form.EN)
  394. let token = getToken();
  395. this.submitHandler((token) => {
  396. saveOrUpdate(
  397. JSON.stringify(data),
  398. JSON.stringify(that.mediaFileMap),
  399. JSON.stringify(that.fileMap),
  400. token
  401. ).then(result => {
  402. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  403. alert('发布成功');
  404. } else {
  405. alert('Release Success');
  406. }
  407. }).catch((error) => {
  408. this.resetToken();
  409. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  410. alert('发布失败');
  411. } else {
  412. alert('Release Error');
  413. }
  414. });
  415. this.toResourceSharing()
  416. });
  417. },
  418. beforeUploadMedia(file) {
  419. var FileExt = file.name.replace(/.+\./, "");
  420. if (['jpg', 'png'].indexOf(FileExt.toLowerCase()) === -1) {
  421. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  422. this.$message({
  423. type: 'warning',
  424. message: '请上传jpg,png的图片!'
  425. });
  426. } else {
  427. this.$message({
  428. type: 'warning',
  429. message: 'Please upload the picture of jpg, png!'
  430. });
  431. }
  432. return false;
  433. }
  434. this.isLt2k = file.size / 1024 / 1024 < 10 ? '1' : '0';
  435. if (this.isLt2k === '0') {
  436. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  437. this.$message({
  438. message: '上传文件大小不能超过10M!',
  439. type: 'error'
  440. });
  441. } else {
  442. this.$message({
  443. message: 'Upload file size cannot exceed 10M!',
  444. type: 'error'
  445. });
  446. }
  447. return false;
  448. }
  449. },
  450. beforeUploadVideo(file) {
  451. const isLt200M = file.size / 1024 / 1024 < 200;
  452. if (['video/mp4'].indexOf(file.type) == -1) {
  453. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  454. this.$message({
  455. type: 'warning',
  456. message: '请上传mp4的视频!'
  457. });
  458. } else {
  459. this.$message({
  460. type: 'warning',
  461. message: 'Please upload the Video of MP4!'
  462. });
  463. }
  464. return false;
  465. }
  466. if (!isLt200M) {
  467. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  468. this.$message({
  469. message: '上传文件大小不能超过200M!',
  470. type: 'error'
  471. });
  472. } else {
  473. this.$message({
  474. message: 'Upload file size cannot exceed 200M!',
  475. type: 'error'
  476. });
  477. }
  478. return false;
  479. }
  480. },
  481. beforeUploadFile(file) {
  482. var FileExt = file.name.replace(/.+\./, "");
  483. if (['pdf'].indexOf(FileExt.toLowerCase()) === -1) {
  484. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  485. this.$message({
  486. type: 'warning',
  487. message: '请上传pdf的附件!'
  488. });
  489. } else {
  490. this.$message({
  491. type: 'warning',
  492. message: 'Please upload the attachment of PDF!'
  493. });
  494. }
  495. return false;
  496. }
  497. this.isLt2k = file.size / 1024 / 1024 < 50 ? '1' : '0';
  498. if (this.isLt2k === '0') {
  499. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  500. this.$message({
  501. message: '上传文件大小不能超过50M!',
  502. type: 'error'
  503. });
  504. } else {
  505. this.$message({
  506. message: 'Upload file size cannot exceed 50M!',
  507. type: 'error'
  508. });
  509. }
  510. return false;
  511. }
  512. },
  513. beforeUploadBanner(file) {
  514. var FileExt = file.name.replace(/.+\./, "");
  515. if (['jpg', 'png'].indexOf(FileExt.toLowerCase()) === -1) {
  516. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  517. this.$message({
  518. type: 'warning',
  519. message: '请上传jpg,png的图片!'
  520. });
  521. } else {
  522. this.$message({
  523. type: 'warning',
  524. message: 'Please upload the picture of jpg, png!'
  525. });
  526. }
  527. return false;
  528. }
  529. this.isLt2k = file.size / 1024 / 1024 < 10 ? '1' : '0';
  530. if (this.isLt2k === '0') {
  531. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  532. this.$message({
  533. message: '上传文件大小不能超过10M!',
  534. type: 'error'
  535. });
  536. } else {
  537. this.$message({
  538. message: 'Upload file size cannot exceed 10M!',
  539. type: 'error'
  540. });
  541. }
  542. return false;
  543. }
  544. },
  545. onRemoveMedia() {
  546. if(this.editableTabsValue == 1){
  547. this.researchResourcesMediaVideo.delete("ZH")
  548. }else{
  549. this.researchResourcesMediaVideo.delete("EN")
  550. }
  551. },
  552. onRemoveVideo() {
  553. if(this.editableTabsValue == 1){
  554. this.form.ZH.researchResourcesMediaVideo = ''
  555. }else{
  556. this.form.EN.researchResourcesMediaVideo = ''
  557. }
  558. },
  559. onRemoveFile() {
  560. if(this.editableTabsValue == 1){
  561. this.fileMap.delete("ZH")
  562. }else{
  563. this.fileMap.delete("EN")
  564. }
  565. },
  566. onRemoveBanner() {
  567. if(this.editableTabsValue == 1){
  568. this.form.ZH.reserveTwo = ''
  569. }else{
  570. this.form.EN.reserveTwo = ''
  571. }
  572. },
  573. onPreviewMedia(file){
  574. this.dialogVisible = true;
  575. this.dialogVisibleImg = file.response.data.path;
  576. },
  577. onPreviewVideo(file){
  578. this.dialogVisible = true;
  579. this.dialogVisibleVideo = file.response.url;
  580. },
  581. onPreviewFile(file){
  582. console.log(file)
  583. this.dialogVisible = true;
  584. this.dialogVisiblePdf = file.response.data.path;
  585. },
  586. onPreviewBanner(file){
  587. this.dialogVisible = true;
  588. this.dialogVisibleImg = file.response.data;
  589. },
  590. handleAvatarSuccessMedia(res,file){
  591. /*if(this.editableTabsValue == 1){
  592. let url = res.data;
  593. this.form.CN.researchResultCover = JSON.stringify(url);
  594. this.form.CN.researchResultCover = this.form.CN.researchResultCover.replace(/"/g, "")
  595. }else{
  596. let url = res.data;
  597. this.form.EN.researchResultCover = JSON.stringify(url);
  598. this.form.EN.researchResultCover = this.form.CN.researchResultCover.replace(/"/g, "")
  599. }*/
  600. if(this.editableTabsValue == 1){
  601. this.mediaFileMap.set("ZH",res.data.attachmentId)
  602. }else{
  603. this.mediaFileMap.set("EN",res.data.attachmentId)
  604. }
  605. },
  606. handleAvatarSuccessVideo(res,file){
  607. if(this.editableTabsValue == 1){
  608. let url = res.url;
  609. this.form.CN.researchResourcesMediaVideo = JSON.stringify(url);
  610. this.form.CN.researchResourcesMediaVideo = this.form.CN.researchResourcesMediaVideo.replace(/"/g, "")
  611. }else{
  612. let url = res.data;
  613. this.form.EN.researchResourcesMediaVideo = JSON.stringify(url);
  614. this.form.EN.researchResourcesMediaVideo = this.form.CN.researchResourcesMediaVideo.replace(/"/g, "")
  615. }
  616. },
  617. handleAvatarSuccessFile(res,file){
  618. /*if(this.editableTabsValue == 1){
  619. let url = res.data;
  620. this.form.CN.researchResultFile = JSON.stringify(url);
  621. this.form.CN.researchResultFile = this.form.CN.researchResultFile.replace(/"/g, "")
  622. }else{
  623. let url = res.data;
  624. this.form.EN.researchResultFile = JSON.stringify(url);
  625. this.form.EN.researchResultFile = this.form.CN.researchResultFile.replace(/"/g, "")
  626. }*/
  627. if(this.editableTabsValue == 1){
  628. this.fileMap.set("ZH",res.data.attachmentId)
  629. }else{
  630. this.fileMap.set("EN",res.data.attachmentId)
  631. }
  632. },
  633. handleAvatarSuccessBanner(res,file){
  634. if(this.editableTabsValue == 1){
  635. let url = res.data;
  636. this.form.CN.reserveTwo = JSON.stringify(url);
  637. this.form.CN.reserveTwo = this.form.CN.reserveTwo.replace(/"/g, "")
  638. }else{
  639. let url = res.data;
  640. this.form.EN.reserveTwo = JSON.stringify(url);
  641. this.form.EN.reserveTwo = this.form.CN.reserveTwo.replace(/"/g, "")
  642. }
  643. },
  644. async getData(){
  645. const that = this;
  646. that.form.public.resourceCountrySelectValue1 = '';
  647. that.form.public.resourceCountrySelectValue2 = '';
  648. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  649. await getDicts(
  650. "RESEARCH_RESOURCE_TYPE_DICT"
  651. ).then(result => {
  652. if (result.data) {
  653. that.form.public.resourceTypeSelect = result.data[0];
  654. }
  655. })
  656. await getTreeByLanguagePortal('ZH').then(result => {
  657. if (result.data) {
  658. let values = Object.values(result.data);
  659. that.form.public.resourceCountrySelect = values;
  660. }
  661. })
  662. }else if (this.$i18n.locale.toUpperCase() == 'EN'){
  663. await getDicts(
  664. "RESEARCH_RESOURCE_TYPE_DICT_EN"
  665. ).then(result => {
  666. if (result.data) {
  667. that.form.public.resourceTypeSelect = result.data[0];
  668. }
  669. })
  670. await getTreeByLanguagePortal('EN').then(result => {
  671. if (result.data) {
  672. let values = Object.values(result.data);
  673. that.form.public.resourceCountrySelect = values;
  674. }
  675. })
  676. }
  677. },
  678. toView(router, json) {
  679. clearInterval(this.timer);
  680. this.$router.push({ name: router, params: {key:json} });
  681. },
  682. beforeClose(done){
  683. this.dialogVisibleImg = '';
  684. this.dialogVisibleVideo = '';
  685. this.dialogVisiblePdf = '';
  686. done()
  687. },
  688. toResourceSharing(){
  689. this.toView('resourceSharing',1)
  690. },
  691. }
  692. }
  693. </script>
  694. <style scoped>
  695. .box {
  696. margin-top: 10px;
  697. background: #fff;
  698. /* height: 500px; */
  699. padding: 20px 0;
  700. }
  701. .crumbs {
  702. margin:0 20px;
  703. }
  704. .content{
  705. width: 100%;
  706. padding: 20px 10px;
  707. box-sizing: border-box;
  708. }
  709. .content .addLanguage{
  710. width: 100%;
  711. height: 50px;
  712. border-bottom: 1px solid #666666;
  713. }
  714. .content .issue{
  715. margin-top: 15px;
  716. }
  717. </style>
  718. <style>
  719. .research input[type=text].el-input__inner{
  720. color: red;
  721. }
  722. </style>