MapData.vue 10 KB

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