InsideModule.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div>
  3. <div class="bigBox">
  4. <div style="text-align: center;">
  5. <h2 style="font-size: 20px;">{{ needName }}</h2>
  6. </div>
  7. <div style="display: flex;justify-content: flex-start;align-items: center;height: 93%;">
  8. <div style="height: 100%;width: calc(100% - 0px);position: relative;">
  9. <div class="setBox">
  10. <div
  11. style="width: 60%;display: flex;justify-content: flex-start;align-items: center;margin-left: 10px;">
  12. <div style="width: calc(40%);">
  13. <span style="font-size: 14px;color: #7484AB;">连接线:</span>
  14. <span class="sv" :style="{ opacity: lineMenuColor == 'orange' ? 1 : 0.4 }"
  15. @click="svClick">SV</span>
  16. <span class="goose" :style="{ opacity: lineMenuColor == 'orange' ? 0.4 : 1 }"
  17. @click="gooseClick">GOOSE</span>
  18. </div>
  19. <div style="display: flex;width: calc(30%);">
  20. <span style="font-size: 14px;color: #7484AB;margin-left: 20px;">操作:</span>
  21. <div class="cutPoint">
  22. <!-- <img style="width: 22px;height: 22px;display: block;"
  23. src="../../../assets/icon/iorn_pen.png" alt="">
  24. <span style="display: block;">控点</span> -->
  25. </div>
  26. <div class="deletePoint" @click="delClick">
  27. <img style="width: 22px;height: 22px;display: block;"
  28. src="../../../assets/icon/cut_knief.png" alt="">
  29. <span style="display: block;">删除</span>
  30. </div>
  31. </div>
  32. <div style="display: flex;width: 30%;">
  33. <div>
  34. <span style="margin-left: 5px;">X:</span>
  35. <el-input type="number" class="coord" v-model="fatX" @input="limitNumX"
  36. @change="xChange"></el-input>
  37. </div>
  38. <div>
  39. <span style="margin-left: 5px;">Y:</span>
  40. <el-input type="number" class="coord" v-model="fatY" @input="limitNumY"
  41. @change="yChange"></el-input>
  42. </div>
  43. </div>
  44. </div>
  45. <div style="width: calc(30%);">
  46. <div style="width: calc(100%);">
  47. <el-button type="primary" @click="cleanAll" plain>关闭</el-button>
  48. <el-button type="primary" @click="saveMap">保存</el-button>
  49. </div>
  50. </div>
  51. <div style="width: calc(15%);">
  52. <span style="font-size: 14px;color: #7484AB;">双击节点或连接线可配置属性</span>
  53. </div>
  54. </div>
  55. <div class="tableBox">
  56. <!-- 建议使用这个 -->
  57. <DrawDesigns ref="designsRef" :lineMenuColor="lineMenuColor" :needObj="needObj" :fatX="fatX"
  58. :fatY="fatY" :nowLook="nowLook" :needId="needId" :needName="needName" :coolObj="coolObj"
  59. :svOrGoose="svOrGoose" @backxy="backxy"></DrawDesigns>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import { ref, onMounted, toRefs, watch } from 'vue';
  68. import { ElMessage } from 'element-plus';
  69. import cid from '@/api/cid/cid'
  70. import FeelLoad from '@/pages/feelLoad/FeelLoad.vue'//bmnp
  71. import FatherMap from '@/pages/mapLoad/FatherMap.vue';//jsplumb
  72. import DrawDesigns from '@/pages/components/draw/DrawDesigns.vue';//logicflow
  73. import { now } from 'moment';
  74. export default {
  75. props: {
  76. tfType: {
  77. type: null || Number,
  78. required: true
  79. },
  80. insideNeed: {
  81. type: Object,
  82. required: true
  83. },
  84. lineId: {
  85. type: Number || String,
  86. required: true
  87. },
  88. setName: {
  89. type: String,
  90. required: true
  91. },
  92. setId: {
  93. type: Object,
  94. required: true
  95. }
  96. },
  97. setup(props, { emit }) {
  98. let moduleList = ref([])
  99. let lineMenuColor = ref('#255CE7')
  100. let designsRef = ref(null)
  101. let fatX = ref()
  102. let fatY = ref()
  103. let result = props.tfType
  104. let nowLook = ref(null)
  105. let needObj = ref({})
  106. let needId = ref('')
  107. let needName = ref('')
  108. let coolObj = ref({})
  109. let svOrGoose = ref(1)//0为sv,1为goose
  110. watch(() => props.tfType, (newVal) => {
  111. nowLook.value = newVal
  112. })
  113. watch(() => props.insideNeed, (newVal) => {
  114. needObj.value = newVal
  115. })
  116. watch(() => props.lineId, (newVal) => {
  117. needId.value = newVal
  118. })
  119. watch(() => props.setName, (newVal) => {
  120. needName.value = newVal
  121. })
  122. watch(() => props.setId, (newVal) => {
  123. coolObj.value = newVal
  124. })
  125. function searchModule() {
  126. needObj.value = props.insideNeed
  127. needId.value = props.lineId
  128. nowLook.value = result
  129. needName.value = props.setName
  130. coolObj.value = props.setId//模型整个数据
  131. }
  132. function svClick() {
  133. lineMenuColor.value = 'orange'
  134. svOrGoose.value = 0
  135. designsRef.value.orange()//切换为sv
  136. }
  137. function gooseClick() {
  138. lineMenuColor.value = '#255CE7'
  139. svOrGoose.value = 1
  140. designsRef.value.blue()//切换为goose
  141. }
  142. function delClick() {
  143. designsRef.value.delLine()//删除连接线
  144. }
  145. function saveMap() {
  146. designsRef.value.saveLine()//保存为图片
  147. }
  148. function cleanAll() {
  149. designsRef.value.cleanMap()//清除画布
  150. emit("closeDraw")
  151. }
  152. function limitNumX(e) {//强制转换为数字
  153. let types = e.replace(/\D/g, '');
  154. fatX.value = types - 0
  155. }
  156. function limitNumY(e) {//强制转换为数字
  157. let types = e.replace(/\D/g, '');
  158. fatY.value = types - 0
  159. }
  160. function xChange(e) {
  161. fatX.value = e - 0
  162. designsRef.value.momal()
  163. }
  164. function yChange(e) {
  165. fatY.value = e - 0
  166. designsRef.value.momal()
  167. }
  168. function backxy(x, y) {
  169. fatX.value = x
  170. fatY.value = y
  171. }
  172. onMounted(() => {
  173. searchModule()
  174. })
  175. return {
  176. moduleList,
  177. searchModule,
  178. lineMenuColor,
  179. svClick,
  180. gooseClick,
  181. designsRef,
  182. delClick,
  183. saveMap,
  184. cleanAll,
  185. fatX,
  186. fatY,
  187. backxy,
  188. xChange,
  189. yChange,
  190. limitNumX,//只能输入数字
  191. limitNumY,
  192. nowLook,
  193. result,
  194. needObj,
  195. needId,
  196. needName,
  197. coolObj,
  198. svOrGoose,//0为sv,1为goose
  199. }
  200. },
  201. components: {
  202. FeelLoad,
  203. FatherMap,
  204. DrawDesigns
  205. }
  206. }
  207. </script>
  208. <style scoped>
  209. .bigBox {
  210. width: 100%;
  211. height: calc(100vh - 150px);
  212. border: 1px solid #cbcbda;
  213. border-radius: 3px;
  214. }
  215. .tableBox {
  216. width: 100%;
  217. height: calc(100% - 10%);
  218. }
  219. .setBox {
  220. width: calc(100% - 14%);
  221. height: calc(100% - 90%);
  222. border: 1px solid #A3ADE0;
  223. position: absolute;
  224. top: 0px;
  225. left: calc(100% - 86.5%);
  226. z-index: 1;
  227. background-color: #F7F8FB;
  228. line-height: calc(600%);
  229. display: flex;
  230. justify-content: space-around;
  231. align-items: center;
  232. /* margin-top: 1px; */
  233. }
  234. .moduleBox {
  235. width: 10%;
  236. height: 100%;
  237. border: 1px solid green;
  238. }
  239. .sv {
  240. display: inline-block;
  241. width: 75px;
  242. height: 24px;
  243. text-align: center;
  244. line-height: 24px;
  245. border-top: 2px solid #FF7C03;
  246. font-size: 16px;
  247. margin-right: 20px;
  248. cursor: pointer;
  249. opacity: 0.4;
  250. }
  251. .sv:hover {
  252. opacity: 1;
  253. }
  254. .goose {
  255. display: inline-block;
  256. width: 75px;
  257. height: 24px;
  258. text-align: center;
  259. line-height: 24px;
  260. border-top: 2px solid #255CE7;
  261. font-size: 16px;
  262. cursor: pointer;
  263. }
  264. .goose:hover {
  265. opacity: 1;
  266. }
  267. .cutPoint {
  268. display: flex;
  269. justify-content: space-around;
  270. align-items: center;
  271. font-size: 14px;
  272. text-align: center;
  273. margin-right: 10px;
  274. cursor: pointer;
  275. }
  276. .deletePoint {
  277. display: flex;
  278. justify-content: space-around;
  279. align-items: center;
  280. font-size: 14px;
  281. text-align: center;
  282. cursor: pointer;
  283. }
  284. :deep(.lf-dndpanel) {
  285. height: 100%;
  286. width: 220px;
  287. overflow-y: auto;
  288. background-color: #F7F8FB;
  289. padding: 0;
  290. margin: 0;
  291. }
  292. :deep(.lf-dnd-item) {
  293. width: 38%;
  294. float: left;
  295. margin: 5%;
  296. }
  297. :deep(.lf-dnd-shape) {
  298. display: none;
  299. }
  300. :deep(.lf-dnd-text) {
  301. width: calc(100% - 8px);
  302. height: 42px;
  303. border: 1px solid #d3daef;
  304. margin-left: 2px;
  305. color: #255CE7;
  306. text-align: center;
  307. line-height: 22px;
  308. background: #e4dfdf;
  309. border-radius: 3px;
  310. padding: 3px;
  311. }
  312. .coord {
  313. width: 75px;
  314. height: 30px;
  315. background-color: transparent;
  316. border: none;
  317. margin-left: 5px;
  318. }
  319. </style>