FileData.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <Search :tag="tag" :type="'FILE'" ref="searchRef"></Search>
  3. <div style="background-color: #f0f2f5" class="dark:bg-dark-900">
  4. <div class="datacenter-right">
  5. <div class="resource_list" id="map_list">
  6. <div v-for="(i, n) in list" v-if="list.length" :key="n" data-permission="true" class="resource_item"
  7. data-checking="false" data-searching="1" data-ispub="1">
  8. <div class="mapItem-top-box">
  9. <div class="item-top">
  10. <div class="img_container" data-num="1">
  11. <img class="tab-list-icon-img-MR00001936 img_mr MR00001936" :id="i.SERVICEID + n" :src="setHtmlImg(i, n)"
  12. alt="文件预览图">
  13. </div>
  14. </div>
  15. <div class="item-title">
  16. <span class="r_name">{{ i.SERVICENAME }}</span>
  17. <!-- <span class="r-number" data-num="1" title="编目1次">1</span> -->
  18. </div>
  19. <div class="item-msg">
  20. <div class="item-msg-val">坐标系:<span>{{ i.CRS }}</span></div>
  21. <div class="item-msg-val">适用流程:<span>{{ i.SHSQLCMC }}</span></div>
  22. <div class="item-msg-val">关键字:
  23. <span :id="'KEYWORDS' + i.SERVICEID + n">{{ getTag(i.KEYWORDS, `KEYWORDS${i.SERVICEID}${n}`) }}</span>
  24. </div>
  25. <div class="item-msg-val">服务类型:<span>{{ i.TYPENAME }}</span></div>
  26. </div>
  27. </div>
  28. <div class="operation-box">
  29. <div class="left">
  30. <div class="operation-item browse-item-btn browse-item-MR00001936" v-if="i.SFJRSQK === '审核通过'">
  31. <a target="_blank"
  32. :href="(i.info && i.info.length && i.info[0].thumbnail) || './static/img/default-dr3.jpg'">
  33. <span style="color: #2D74E7;" rel="opener">浏览</span>
  34. </a>
  35. </div>
  36. <div class="operation-item" @click="handleQuery(i, n)">
  37. <a href="javascript:void(0)" class="">
  38. <span style="color: #2D74E7;">详细</span>
  39. </a>
  40. </div>
  41. </div>
  42. <div class="right">
  43. <div class="operation-item" v-if="i.SFJRSQK === '未加入'" @click="applyWay(i)">
  44. <a href="javascript:void(0)" class="">
  45. <span>加入申请库</span>
  46. </a>
  47. </div>
  48. <div class="operation-item" v-else-if="i.SFJRSQK === '审核通过'"
  49. style="background-color: #05B069;color: #ffffff;cursor: pointer;" @click="showEmpowerInfo(i)">
  50. 已申请信息
  51. </div>
  52. <div class="operation-item" v-else style="cursor: not-allowed;background-color: #e8e8e8;"
  53. :style="{ background: i.SFJRSQK == '已加入' ? '#E8E8E8' : i.SFJRSQK == '审核中' ? '#ED9C23' : i.SFJRSQK == '审核不通过' ? '#FA5151' : '' }">
  54. <a href="javascript:void(0)" class="" style="cursor: not-allowed;color:#656363;">
  55. <span :style="{ color: i.SFJRSQK == '已加入' ? '#999999' : '#ffffff' }">{{ i.SFJRSQK == '已加入' ? '已加入申请库' :
  56. i.SFJRSQK }}</span>
  57. </a>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <a-empty style="margin: 100px auto;" v-else description="暂无数据"></a-empty>
  63. </div>
  64. </div>
  65. <MyPage :total="total"></MyPage>
  66. <!-- 弹出框 -->
  67. <DetailModal v-if="showResDeatil" :type="'FILE'" @closeModal="showResDeatil = false" :resId="detailResId" />
  68. <EmpowerInfo title="文件资源申请信息" ref="infoRef"></EmpowerInfo>
  69. </div>
  70. </template>
  71. <script>
  72. import { defineComponent, nextTick, onMounted, ref, defineProps, watch } from 'vue';
  73. // 导入子页面【详情】
  74. import DetailModal from './child/DetailModal.vue';
  75. import Search from './child/Search.vue';
  76. import { platList, img, apply, tagAjax } from '/@/api/resource/plat';
  77. import { session } from '/@/utils/Memory';
  78. import { message, Empty } from 'ant-design-vue';
  79. import MyPage from './child/MyPage.vue';
  80. import { setHtmlImg } from '/@/views/minWidgets/CommonWay.js';
  81. import EmpowerInfo from './EmpowerInfo.vue';
  82. const props = {
  83. listData: {
  84. type: Object,
  85. default: () => { },
  86. }
  87. }
  88. export default defineComponent({
  89. name: 'FileData',
  90. components: { Search, DetailModal, MyPage, EmpowerInfo },
  91. props,
  92. emits: ['resAddToCar'],
  93. setup(props, { emit }) {
  94. const showResDeatil = ref(false)
  95. const searchRef = ref(null)
  96. const list = ref([]);
  97. const detailResId = ref('')
  98. const total = ref(0);
  99. const tag = ref('');
  100. onMounted(() => getList(props.listData));
  101. async function getList(res) {
  102. console.log("文件传进来的文件资源:", res)
  103. total.value = res.count;
  104. tag.value = res.keywords;
  105. var res = res.items;
  106. var val = JSON.parse(JSON.stringify(res))
  107. list.value = val;
  108. }
  109. watch(() => props.listData, (val) => getList(val), {
  110. deep: true,
  111. immediate: true
  112. })
  113. //获取资源标签
  114. function getTag(i, id) {
  115. if (i == "CSSJ") i = '["CSSJ","SJ"]';
  116. //判断是不是数组
  117. i = i.indexOf('[') > -1 ? JSON.parse(i) : [i];
  118. if (i.length) {
  119. tagAjax().then(r => {
  120. var name = r.filter(j => i.includes(j.code)).map(j => j.name).toString();
  121. document.querySelector(`#${id}`).innerHTML = name;
  122. })
  123. } else {
  124. return ''
  125. }
  126. }
  127. function applyWay(i) {
  128. console.log(i)
  129. apply({
  130. addRes: [{
  131. resDataType: "2",
  132. resId: i.SERVICEID,
  133. resName: `${i.SERVICENAME}(${i.CRS})`,
  134. resType: 0,
  135. workflowType: "FILE",
  136. }],
  137. userId: session.getItem('userId'),
  138. }).then((r) => {
  139. if (r.datas && r.resp_code == 0) {
  140. message.success('申请成功');
  141. // searchRef.value.getResData();
  142. eventBus.emit('addResToCarEventBus')
  143. emit('resAddToCar')
  144. }
  145. })
  146. }
  147. function handleQuery(record, n) {
  148. //打开详情弹窗
  149. session.setItem('thumbnail2', document.getElementById(record.SERVICEID + n).src);
  150. detailResId.value = record.SERVICEID
  151. showResDeatil.value = true
  152. }
  153. //申请信息查看
  154. const infoRef = ref(null);
  155. function showEmpowerInfo(i) {
  156. infoRef?.value?.showInfo(i);
  157. }
  158. return {
  159. infoRef,
  160. showEmpowerInfo,
  161. setHtmlImg,
  162. getTag,
  163. tag,
  164. total,
  165. showResDeatil,
  166. detailResId,
  167. searchRef,
  168. list,
  169. applyWay,
  170. handleQuery,
  171. };
  172. },
  173. });
  174. </script>
  175. <style scoped>
  176. .operation-item {
  177. border-radius: 3px;
  178. }
  179. .datacenter-right .resource_list .item-title .r_name {
  180. color: #5e5d5e;
  181. display: inline-block;
  182. width: 190px;
  183. overflow: hidden;
  184. text-overflow: ellipsis;
  185. white-space: nowrap;
  186. font-family: Source Han Sans CN;
  187. font-size: 16px;
  188. font-weight: bold;
  189. line-height: 16.38px;
  190. letter-spacing: 0px;
  191. color: #333333;
  192. }
  193. .datacenter-right .resource_list {
  194. box-sizing: border-box;
  195. width: 100%;
  196. float: left;
  197. clear: both;
  198. display: flex;
  199. flex-wrap: wrap;
  200. align-items: center;
  201. }
  202. .datacenter-right .resource_list>div:not(:nth-of-type(4n + 4)) {
  203. margin-right: 7px;
  204. }
  205. .resource_item {
  206. height: 318px;
  207. width: 224px;
  208. margin-bottom: 14px;
  209. border: 2px dashed transparent;
  210. width: 386px;
  211. height: 402px;
  212. border-radius: 4px;
  213. opacity: 1;
  214. background: #FFFFFF;
  215. border: 1px solid #DEDEDE;
  216. }
  217. .mapItem-top-box {
  218. height: 350px;
  219. }
  220. .datacenter-right .resource_list .operation-box {
  221. height: 42px;
  222. display: flex;
  223. margin-bottom: 10px;
  224. /* margin-left: 20px; */
  225. justify-content: space-between;
  226. padding: 0 24px;
  227. .left {
  228. display: flex;
  229. .operation-item {
  230. display: flex;
  231. align-items: center;
  232. justify-content: center;
  233. min-width: 50px;
  234. height: 34px;
  235. opacity: 1;
  236. margin-right: 22px;
  237. padding: 0 10px;
  238. background: #E8E8E8;
  239. a {
  240. font-size: 12px;
  241. width: 100%;
  242. text-align: center;
  243. color: #333333;
  244. }
  245. }
  246. }
  247. .right {
  248. .operation-item {
  249. display: flex;
  250. align-items: center;
  251. justify-content: center;
  252. min-width: 50px;
  253. height: 34px;
  254. opacity: 1;
  255. padding: 0 10px;
  256. background: #0671DD;
  257. a {
  258. font-size: 12px;
  259. width: 100%;
  260. text-align: center;
  261. color: #fff;
  262. }
  263. }
  264. }
  265. }
  266. .datacenter-right .resource_list .item-top {
  267. padding: 10px 16px 10px;
  268. }
  269. .datacenter-right .resource_list .item-top img {
  270. width: 360px;
  271. height: 190px;
  272. border: solid 1px #eeebeb;
  273. }
  274. .datacenter-right .resource_list .item-title {
  275. font-size: 14px;
  276. font-family: PingFang SC;
  277. font-weight: bold;
  278. color: #5e5d5e;
  279. line-height: 16px;
  280. padding: 0 0 0 14px;
  281. overflow: hidden;
  282. text-overflow: ellipsis;
  283. white-space: nowrap;
  284. }
  285. .datacenter-right .resource_list .item-msg {
  286. padding: 0 13px 13px;
  287. }
  288. .img_container {
  289. text-align: center;
  290. }
  291. .img_container {
  292. width: 100%;
  293. height: 100%;
  294. background: #b7bed3;
  295. border-radius: 4px;
  296. }
  297. .datacenter-right .resource_list .item-msg-val {
  298. font-size: 12px;
  299. font-family: PingFang SC;
  300. font-weight: bold;
  301. color: #888888;
  302. line-height: 26px;
  303. /* opacity: 0.5; */
  304. overflow: hidden;
  305. text-overflow: ellipsis;
  306. white-space: nowrap;
  307. }
  308. .item-msg-val>span {
  309. font-family: Source Han Sans CN;
  310. font-size: 14px;
  311. font-weight: normal;
  312. line-height: 16.38px;
  313. letter-spacing: 0px;
  314. color: #333333;
  315. }
  316. </style>