1
0

index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div class="scene flex justify-end content-center">
  3. <div class="scene-list" v-if="list.length">
  4. <div class="scene-title" v-show="!show">
  5. <el-button class="newbut" @click="handleAdd">
  6. <i class="iconfont icon-import" style="margin-right: 5px"></i>
  7. 导入
  8. </el-button>
  9. </div>
  10. <div class="list" v-if="active">
  11. <div
  12. class="listItem py-4"
  13. v-for="(item, index) in list"
  14. :key="index"
  15. :class="{
  16. active: item.fusionId === sceneItem.fusionId,
  17. disabled: !item.viewAuth,
  18. }"
  19. @click="handleItem(item)"
  20. >
  21. <div class="anmc" :title="item.title || item.caseTitle">
  22. {{ item.title || item.caseTitle }}
  23. </div>
  24. <div
  25. class="cursor-pointer"
  26. v-if="!show && (item.editAuth || caseInfoData.isAuthor) && item.fusionId === sceneItem.fusionId"
  27. quaternary
  28. type="primary"
  29. >
  30. <el-icon v-if="item.editAuth" style="margin-right: 34px" title="编辑">
  31. <EditPen @click="handleAdddyrh(item)" />
  32. </el-icon>
  33. <el-icon title="移除">
  34. <CircleClose @click="handlegotoelT(item)" />
  35. </el-icon>
  36. </div>
  37. <div class="cursor-pointer" v-show="!show" v-else-if="!item.viewAuth && caseInfoData.isAuthor">
  38. <el-icon title="移除">
  39. <CircleClose @click.stop="handlegotoelT(item)" />
  40. </el-icon>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. <div
  46. class="app-scene"
  47. ref="sceneRef"
  48. :style="{
  49. height: '100%',
  50. width: list.length == 0?'100%':'',
  51. }"
  52. >
  53. <iframe
  54. v-if="list && list.length && sceneURL"
  55. :src="sceneURL"
  56. frameborder="0"
  57. :style="{ width: '100%', height: '100%' }"
  58. ></iframe>
  59. <div class="import" v-else @click="handleAdd" v-show="!show">
  60. <el-icon size="26" color="#26559B">
  61. <i style="font-size: 26px; color: #26559B" class="iconfont icon-import"></i></el-icon>
  62. <div class="name">导入</div>
  63. <div class="noData" >
  64. <div class="name" style="margin-top: 25px;">暂无数据</div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script setup lang="ts">
  71. import {
  72. getCaseSceneList,
  73. getCaseList,
  74. getUrlSrc,
  75. getSceneListTree,
  76. setCaseaddOrUpdate,
  77. getCaseFusionList,
  78. casefusionDel,
  79. show,
  80. setaddFusionIds ,
  81. caseInfoData,
  82. } from "@/store/case";
  83. import { router } from "@/router";
  84. import comSelect from "@/components/company-select/index.vue";
  85. import { ElMessage, ElMessageBox } from "element-plus";
  86. import List from "./list.vue";
  87. import SceneContent from "./sceneContent.vue";
  88. import { Plus, DocumentAdd, EditPen } from "@element-plus/icons-vue";
  89. import ModelContent from "./modelContent.vue";
  90. import { useScenePaggingParams } from "./pagging";
  91. import { computed, ref, onMounted } from "vue";
  92. import { tableModelScene } from "./quisk";
  93. const active = ref(true);
  94. const list = ref([
  95. ]);
  96. const isEdit = ref(false);
  97. const showModal = ref(false);
  98. const sceneURL = ref("");
  99. const sceneNum = ref("");
  100. const sceneItem = ref({
  101. fusionId: "",
  102. });
  103. const params = useScenePaggingParams();
  104. const caseId = computed(() => router.currentRoute.value?.params?.caseId);
  105. onMounted(() => {
  106. geiList();
  107. });
  108. async function geiList(refresh) {
  109. list.value = await getCaseList({
  110. caseId: caseId.value,
  111. type: 'fusion',
  112. })||[];
  113. // list.value = getList.filter((item) => item.caseId);
  114. console.log("getCaseFusionList", list.value);
  115. sceneItem.value = (list.value && list.value.find(ele => ele.viewAuth)) || {};
  116. sceneURL.value = getUrlSrc({ ...sceneItem.value, type: 100 }, caseId.value);
  117. console.log("res", list.value, sceneURL.value);
  118. }
  119. function handlegotoEdit(record) {
  120. if (record.isLaser) return;
  121. let url =
  122. record.type == 2 || record.type == 5
  123. ? `/mega/index.html?m=${record.num}`
  124. : `/epg.html?m=${record.num}`;
  125. window.open(url.replace("spg", "epg"));
  126. }
  127. function handleAdddyrh(record) {
  128. let url = `/code/index.html?caseId=${record.fusionId}#/fuseEdit/merge`;
  129. window.open(url);
  130. }
  131. async function handlegotoelT(record) {
  132. isEdit.value = true;
  133. ElMessageBox.confirm("确定要移除当前多元融合吗?", "提示", {
  134. confirmButtonText: "确定",
  135. cancelButtonText: "取消",
  136. type: "warning",
  137. }).then(async () => {
  138. // await casefusionDel(record.fusionId);
  139. let newlist = list.value.filter((item) => item.fusionId !== record.fusionId);
  140. const apiData = {
  141. caseId: caseId.value,
  142. fusionIds: newlist.map(item => item.fusionId),
  143. };
  144. await setaddFusionIds(apiData)
  145. list.value = list.value.filter((item) => item.fusionId !== record.fusionId);
  146. sceneItem.value = (list.value && list.value.find(ele => ele.viewAuth)) || {};
  147. sceneURL.value = getUrlSrc({ ...sceneItem.value, type: 100 }, caseId.value);
  148. });
  149. // if (record.inFusion || (await confirm("确定要移除当前场景吗?"))) {
  150. // await casefusionDel(record.fusionId);
  151. // list.value = list.value.filter((item) => item.fusionId !== record.fusionId);
  152. // sceneItem.value = (list.value && list.value[0]) || {};
  153. // sceneURL.value = getUrlSrc({ ...sceneItem.value, type: 99 }, caseId.value);
  154. // // submitForm();
  155. // }
  156. }
  157. async function submitForm() {
  158. isEdit.value = false;
  159. let sublist = getSceneListTree(list.value);
  160. const apiData = {
  161. caseId: caseId.value,
  162. sceneNumParam: sublist,
  163. };
  164. setCaseaddOrUpdate(apiData)
  165. .then((res) => {
  166. geiList(true);
  167. ElMessage({
  168. message: "操作成功",
  169. type: "success",
  170. });
  171. })
  172. .catch((errr) => {
  173. console.log("setCaseaddOrUpdateerrr", errr);
  174. return geiList(true);
  175. });
  176. }
  177. async function handleAdd() {
  178. let fusionIds = [], noEditList = []
  179. list.value.map((item) => {
  180. fusionIds.push(item.fusionId);
  181. if(!item.editAuth) {
  182. noEditList.push(item.fusionId)
  183. }
  184. });
  185. console.log("handleAdd", fusionIds, noEditList);
  186. let val = await tableModelScene({ fusionIds, noEditList });
  187. geiList();
  188. if (val) {
  189. console.log("刷新列表");
  190. }
  191. }
  192. function handleItem(item) {
  193. if(!item.viewAuth) return ElMessage.error("您没有查看权限,请联系管理员开通");
  194. sceneItem.value = item;
  195. sceneURL.value = getUrlSrc({ ...item, type: 100 }, caseId.value);
  196. }
  197. </script>
  198. <style scoped lang="scss">
  199. .scene {
  200. height: 100%;
  201. .scene-list {
  202. width: calc(var(--leftwidth));
  203. height: 100%;
  204. overflow-y: scroll;
  205. overflow-x: hidden;
  206. &::-webkit-scrollbar {
  207. display: none;
  208. }
  209. .scene-title {
  210. height: 64px;
  211. padding: 24px 48px 0 48px;
  212. .newbut{
  213. position: relative;
  214. left: -16px;
  215. }
  216. }
  217. .list {
  218. .listItem {
  219. width: calc(var(--leftwidth) - 0px);
  220. cursor: pointer;
  221. padding: 25px 48px;
  222. &:hover{
  223. background: rgba(69,144,255,0.1);;
  224. }
  225. }
  226. .active {
  227. background: rgba(69, 144, 255, 0.1);
  228. }
  229. .disabled {
  230. color: rgba(0, 0, 0, 0.3);
  231. cursor:not-allowed;
  232. }
  233. }
  234. }
  235. .app-scene {
  236. background: #f5f5f5;
  237. width: calc(100% - var(--leftwidth));
  238. position: relative;
  239. border-right: 48px solid #fff;
  240. border-bottom: 48px solid #fff;
  241. .import {
  242. position: absolute;
  243. left: 50%;
  244. top: 50%;
  245. transform: translate(-50%, -50%);
  246. text-align: center;
  247. margin-right: 20px;
  248. padding-top: 40px;
  249. height: 148px;
  250. width: 148px;
  251. text-align: center;
  252. background: #fafafa;
  253. cursor: pointer;
  254. .noData{
  255. position: absolute;
  256. top: 140px;
  257. width: 100%;
  258. // transform: translate(50%, -50%);
  259. }
  260. }
  261. }
  262. .anmc {
  263. width: 100%;
  264. margin-bottom: 16px;
  265. overflow: hidden;
  266. text-overflow: ellipsis;
  267. display: -webkit-box;
  268. word-break: break-all;
  269. -webkit-line-clamp: 2;
  270. /*! autoprefixer: off */
  271. -webkit-box-orient: vertical;
  272. }
  273. .cursor-pointer {
  274. color: var(--primaryColor);
  275. text-align: right;
  276. }
  277. }
  278. </style>