dialogEditProperty.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template>
  2. <div class="jt-wall-dialog">
  3. <el-dialog
  4. draggable
  5. :modal="false"
  6. :destroy-on-close="false"
  7. v-model="dialogVisible"
  8. :title="title"
  9. :style="{ left: '120px', background: 'rgb(0 44 126 / 68%)', height: '400px', width: '180px', top: '100px' }"
  10. @close="closeDialog"
  11. @open="openDialog"
  12. >
  13. <template #header>
  14. <div slot="title" class="header-title">
  15. <span style="line-height:24px;font-size:18px;color:#fff;font-family: 'Alimama_ShuHeiTi_Bold'">{{ title }}</span>
  16. </div>
  17. </template>
  18. <template #default>
  19. <div class="odin-dialog__content">
  20. <div class="jt-wall-row" v-show="isShowHeight">
  21. <div class="col-left">高度</div>
  22. <div class="col-main"><el-input v-model="wallHeight" placeholder="输入高度值" clearable /></div>
  23. </div>
  24. <div class="jt-wall-row" v-show="isShowArcHeight">
  25. <div class="col-left">弯曲度</div>
  26. <div class="col-main"><el-input v-model="arcHeight" placeholder="输入弯曲度0~9000" clearable /></div>
  27. </div>
  28. <div class="jt-wall-row" v-show="isShowLineWidth">
  29. <div class="col-left">线宽</div>
  30. <div class="col-main"><el-input v-model="lineWidth" placeholder="输入宽度值" clearable /></div>
  31. </div>
  32. <div class="jt-wall-row" v-show="isShowGlowpower">
  33. <div class="col-left">发光强度</div>
  34. <div class="col-main"><el-input v-model="glowPower" placeholder="输入发光强度0~1" clearable /></div>
  35. </div>
  36. <div class="jt-wall-row" v-show="isShowColor">
  37. <div class="col-left">颜色</div>
  38. <div class="col-main">
  39. <el-config-provider :locale="locale"><el-color-picker v-model="color" show-alpha :predefine="predefineColors" label="12" /></el-config-provider>
  40. </div>
  41. </div>
  42. <div class="jt-wall-row" v-show="isShowDirection">
  43. <div class="col-left">流动方向</div>
  44. <div class="col-main">
  45. <el-radio-group v-model="radioDirection">
  46. <el-radio-button v-for="(item, index) in directions" :label="item.key" v-model="item.value" @change="directionChange" />
  47. </el-radio-group>
  48. </div>
  49. </div>
  50. <div class="jt-wall-row" v-show="isShowOrder">
  51. <div class="col-left">流动顺序</div>
  52. <div class="col-main">
  53. <el-radio-group v-model="radioOrder"><el-radio-button v-for="(item, index) in orders" :label="item.key" v-model="item.value" /></el-radio-group>
  54. </div>
  55. </div>
  56. <div class="jt-wall-row" v-show="isShowSpeed">
  57. <div class="col-left">流动速度</div>
  58. <div class="col-main">
  59. <div class="col-main"><el-input v-model="speed" placeholder="输入流动速度0~10" clearable /></div>
  60. </div>
  61. </div>
  62. <div class="jt-wall-row" v-show="isShowCount">
  63. <div class="col-left">重复数量</div>
  64. <div class="col-main"><el-input v-model="yCount" placeholder="输入1~100" clearable /></div>
  65. </div>
  66. <div class="jt-wall-row" v-show="isShowText" style="height: 60px;">
  67. <div class="col-left">文字内容</div>
  68. <div class="col-main"><el-input v-model="txtContent" placeholder="输入显示的文字内容" clearable type="textarea" :rows="2" /></div>
  69. </div>
  70. <div class="jt-wall-row" v-show="isShowOutlineWidth">
  71. <div class="col-left">描边宽度</div>
  72. <div class="col-main"><el-input v-model="outlineWidth" placeholder="输入宽度值" clearable /></div>
  73. </div>
  74. <div class="jt-wall-row" v-show="isShowOutlineColor">
  75. <div class="col-left">描边颜色</div>
  76. <div class="col-main">
  77. <el-config-provider :locale="locale"><el-color-picker v-model="outlineColor" show-alpha :predefine="predefineColors" label="12" /></el-config-provider>
  78. </div>
  79. </div>
  80. <div class="jt-wall-row" v-show="isShowVideoUrl" style="height: 100px;">
  81. <div class="col-left">视频地址</div>
  82. <div class="col-main"><el-input v-model="txtVideoUrl" placeholder="输入播放视频的地址" clearable type="textarea" :rows="2" /></div>
  83. </div>
  84. <div class="el-body-foot">
  85. <el-button-group class="ml-4">
  86. <el-button type="primary" :icon="Edit" @click="submit()">修改</el-button>
  87. <el-button type="danger" :icon="Delete" @click="remove()">删除</el-button>
  88. </el-button-group>
  89. </div>
  90. </div>
  91. </template>
  92. </el-dialog>
  93. </div>
  94. </template>
  95. <script setup>
  96. /* 引入ref和reactive 其中ref用于简单类型 reactive用于复杂类型 */
  97. import { computed, ref, reactive, toRefs, watch } from 'vue';
  98. import { ElDialog } from 'element-plus';
  99. import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
  100. import en from 'element-plus/dist/locale/en.mjs';
  101. import { ArrowLeft, ArrowRight, Delete, Edit, Share } from '@element-plus/icons-vue';
  102. import { param, type } from 'jquery';
  103. import { DrawTools } from '../CrMap/DrawTools.js';
  104. const language = ref('zh-cn');
  105. const locale = computed(() => (language.value === 'zh-cn' ? zhCn : en));
  106. const props = defineProps({
  107. params: {
  108. id: {
  109. type: String,
  110. default: () => undefined
  111. },
  112. height: {
  113. type: Number,
  114. default: () => 13
  115. },
  116. color: {
  117. type: String,
  118. default: () => '255,255,0,0.9'
  119. },
  120. direction: {
  121. type: String,
  122. default: () => 'horizontal'
  123. },
  124. order: {
  125. type: String,
  126. default: () => '+'
  127. },
  128. count: {
  129. type: Number,
  130. default: () => 2
  131. },
  132. text: {
  133. type: String,
  134. default: () => ''
  135. },
  136. lineWidth: {
  137. type: Number,
  138. default: () => 2
  139. },
  140. glowPower: {
  141. type: Number,
  142. default: () => 0.25
  143. },
  144. outlineWidth: {
  145. type: Number,
  146. default: () => 0
  147. },
  148. outlineColor: {
  149. type: String,
  150. default: () => '255,255,0,0.9'
  151. },
  152. speed: {
  153. type: Number,
  154. default: () => 1.5
  155. },
  156. videoUrl: {
  157. type: String,
  158. default: () => ''
  159. },
  160. arcHeight: {
  161. type: Number,
  162. default: () => 1000
  163. }
  164. },
  165. showDialog: {
  166. type: Boolean,
  167. default: () => false
  168. }
  169. });
  170. const emit = defineEmits(['submit', 'update:showDialog', 'update:params', 'remove']);
  171. /* 默认颜色 */
  172. const predefineColors = ref([
  173. '#ff4500',
  174. '#ff8c00',
  175. '#ffd700',
  176. '#90ee90',
  177. '#00ced1',
  178. '#1e90ff',
  179. '#c71585',
  180. 'rgba(255, 69, 0, 0.68)',
  181. 'rgb(255, 120, 0)',
  182. 'hsv(51, 100, 98)',
  183. 'hsva(120, 40, 94, 0.5)',
  184. 'hsl(181, 100%, 37%)',
  185. 'hsla(209, 100%, 56%, 0.73)',
  186. '#c7158577'
  187. ]);
  188. /* 初始赋值 */
  189. const isShowColor = ref(false);
  190. const isShowText = ref(false);
  191. const isShowHeight = ref(false);
  192. const isShowDirection = ref(false);
  193. const isShowOrder = ref(false);
  194. const isShowCount = ref(false);
  195. const isLineWidth = ref(false);
  196. const isShowLineWidth = ref(false);
  197. const isShowGlowpower = ref(false);
  198. const isShowOutlineWidth = ref(false);
  199. const isShowOutlineColor = ref(false);
  200. const isShowSpeed = ref(false);
  201. const isShowVideoUrl = ref(false);
  202. const isShowArcHeight = ref(false);
  203. const color = ref(props.params.color);
  204. const title = ref('属性编辑');
  205. const dialogVisible = ref(props.showDialog);
  206. const directions = reactive([{ key: '左右', value: 'horizontal' }, { key: '上下', value: 'vertical' }]);
  207. const orders = reactive([]);
  208. const radioDirection = ref('');
  209. const radioOrder = ref('');
  210. const wallHeight = ref(0);
  211. const yCount = ref(0);
  212. const txtContent = ref('');
  213. const lineWidth = ref(0);
  214. const glowPower = ref(0.25);
  215. const outlineWidth = ref(0);
  216. const outlineColor = ref(props.params.outlineColor);
  217. const speed = ref(1.5);
  218. const txtVideoUrl = ref('');
  219. const arcHeight = ref(1000);
  220. /* 根据传递的属性更新 */
  221. updateParams(props.params);
  222. /* 监听参数的变化 */
  223. watch(
  224. () => props.showDialog,
  225. (newVal, oldVal) => {
  226. dialogVisible.value = newVal;
  227. }
  228. );
  229. watch(props.params, (newVal, oldVal) => {
  230. updateParams(newVal);
  231. });
  232. /**
  233. * 根据参数更新内容
  234. * @param {JSON} params 参数
  235. */
  236. function updateParams(params) {
  237. _setShowControls(false);
  238. /* 根据参数的显示不同的内容 */
  239. if (params.id === DrawTools.DrawType.TextWall) {
  240. title.value = '广告牌编辑';
  241. isShowColor.value = true;
  242. isShowText.value = true;
  243. isShowHeight.value = true;
  244. } else if (params.id === DrawTools.DrawType.DynamicWall) {
  245. title.value = '动态围栏编辑';
  246. isShowColor.value = true;
  247. isShowDirection.value = true;
  248. isShowOrder.value = true;
  249. isShowCount.value = true;
  250. isShowHeight.value = true;
  251. isShowSpeed.value = true;
  252. } else if (params.id === DrawTools.DrawType.NormalWall) {
  253. title.value = '普通围栏编辑';
  254. isShowColor.value = true;
  255. isShowHeight.value = true;
  256. } else if (params.id === DrawTools.DrawType.Circle) {
  257. title.value = '贴地圆编辑';
  258. isShowColor.value = true;
  259. isShowOutlineColor.value = true;
  260. isShowOutlineWidth.value = true;
  261. } else if (params.id === DrawTools.DrawType.DynamicCircle) {
  262. title.value = '扩散圆编辑';
  263. isShowColor.value = true;
  264. isShowCount.value = true;
  265. isShowSpeed.value = true;
  266. } else if (params.id === DrawTools.DrawType.House) {
  267. title.value = '房屋编辑';
  268. isShowColor.value = true;
  269. isShowHeight.value = true;
  270. } else if (params.id === DrawTools.DrawType.VideoWall) {
  271. title.value = '视频墙编辑';
  272. isShowHeight.value = true;
  273. isShowVideoUrl.value = true;
  274. } else if (params.id === DrawTools.DrawType.Polyline) {
  275. title.value = '贴地线编辑';
  276. isShowColor.value = true;
  277. isShowLineWidth.value = true;
  278. } else if (params.id === DrawTools.DrawType.ArrowPolyline) {
  279. title.value = '箭头线编辑';
  280. isShowColor.value = true;
  281. isShowLineWidth.value = true;
  282. } else if (params.id === DrawTools.DrawType.DynamicPolyline) {
  283. title.value = '动态线编辑';
  284. isShowColor.value = true;
  285. isShowOrder.value = true;
  286. isShowCount.value = true;
  287. isShowLineWidth.value = true;
  288. isShowSpeed.value = true;
  289. } else if (params.id === DrawTools.DrawType.GrowPolyline) {
  290. title.value = '发光线编辑';
  291. isShowColor.value = true;
  292. isShowLineWidth.value = true;
  293. isShowGlowpower.value = true;
  294. } else if (params.id === DrawTools.DrawType.OutlinePolyline) {
  295. title.value = '描边线编辑';
  296. isShowColor.value = true;
  297. isShowLineWidth.value = true;
  298. isShowOutlineColor.value = true;
  299. isShowOutlineWidth.value = true;
  300. } else if (params.id === DrawTools.DrawType.Polygon) {
  301. title.value = '贴地面编辑';
  302. isShowColor.value = true;
  303. isShowOutlineColor.value = true;
  304. isShowOutlineWidth.value = true;
  305. } else if (params.id === DrawTools.DrawType.Rectangle) {
  306. title.value = '矩形编辑';
  307. isShowColor.value = true;
  308. isShowOutlineColor.value = true;
  309. isShowOutlineWidth.value = true;
  310. } else if (params.id === DrawTools.DrawType.SpatialLine) {
  311. title.value = '空间线编辑';
  312. isShowColor.value = true;
  313. isShowLineWidth.value = true;
  314. } else if (params.id === DrawTools.DrawType.OdLine) {
  315. title.value = 'OD线编辑';
  316. isShowSpeed.value = true;
  317. isShowColor.value = true;
  318. isShowLineWidth.value = true;
  319. isShowOrder.value = true;
  320. isShowArcHeight.value = true;
  321. } else {
  322. _setShowControls(false);
  323. }
  324. color.value = params.color;
  325. /* 判断方向及顺序 */
  326. if (params.direction === 'horizontal') {
  327. radioDirection.value = directions[0].key;
  328. Object.assign(orders, [{ key: '自左至右', value: '-' }, { key: '自右至左', value: '+' }]);
  329. if (params.order === '-') {
  330. radioOrder.value = orders[0].key;
  331. } else {
  332. radioOrder.value = orders[1].key;
  333. }
  334. } else {
  335. radioDirection.value = directions[1].key;
  336. Object.assign(orders, [{ key: '自上至下', value: '+' }, { key: '自下至上', value: '-' }]);
  337. if (params.order === '+') {
  338. radioOrder.value = orders[0].key;
  339. } else {
  340. radioOrder.value = orders[1].key;
  341. }
  342. }
  343. /* 单独更改 */
  344. if (params.id === DrawTools.DrawType.OdLine) {
  345. Object.assign(orders, [{ key: '汇聚', value: '+' }, { key: '扩散', value: '-' }]);
  346. if (params.order === '+') {
  347. radioOrder.value = orders[0].key;
  348. } else {
  349. radioOrder.value = orders[1].key;
  350. }
  351. }
  352. wallHeight.value = parseFloat(params.height).toFixed(2);
  353. yCount.value = params.count;
  354. txtContent.value = params.text;
  355. lineWidth.value = params.lineWidth;
  356. glowPower.value = params.power;
  357. outlineColor.value = params.outlineColor;
  358. outlineWidth.value = params.outlineWidth;
  359. speed.value = (parseFloat(params.duration) / 1000).toFixed(2);
  360. txtVideoUrl.value = params.videoUrl;
  361. arcHeight.value = params.odlineHeight;
  362. // console.log('===设置参数显示>>>', params.lineWidth);
  363. }
  364. /**
  365. * 显示控件设置
  366. * @param {Boolean} isShow 是否显示
  367. */
  368. function _setShowControls(isShow) {
  369. isShowColor.value = isShow;
  370. isShowText.value = isShow;
  371. isShowDirection.value = isShow;
  372. isShowOrder.value = isShow;
  373. isShowCount.value = isShow;
  374. isShowHeight.value = isShow;
  375. isShowLineWidth.value = isShow;
  376. isShowGlowpower.value = isShow;
  377. isShowOutlineColor.value = isShow;
  378. isShowOutlineWidth.value = isShow;
  379. isShowSpeed.value = isShow;
  380. isShowVideoUrl.value = isShow;
  381. isShowArcHeight.value = isShow;
  382. }
  383. /**
  384. * 对外部公开的函数
  385. */
  386. defineExpose({
  387. updateParams
  388. });
  389. /**
  390. * 提交更改
  391. */
  392. function submit() {
  393. emit('submit', {
  394. id: props.params.id,
  395. height: wallHeight.value,
  396. color: color.value,
  397. direction: directions.filter(item => {
  398. return item.key === radioDirection.value;
  399. })[0].value,
  400. order: orders.filter(item => {
  401. return item.key === radioOrder.value;
  402. })[0].value,
  403. count: yCount.value,
  404. text: txtContent.value,
  405. lineWidth: lineWidth.value,
  406. power: glowPower.value,
  407. outlineColor: outlineColor.value,
  408. outlineWidth: outlineWidth.value,
  409. duration: speed.value * 1000,
  410. videoUrl: txtVideoUrl.value,
  411. odlineHeight: arcHeight.value
  412. });
  413. dialogVisible.value = false;
  414. }
  415. /**
  416. * 提交删除
  417. */
  418. function remove() {
  419. emit('remove', {});
  420. dialogVisible.value = false;
  421. }
  422. /**
  423. * 材质方向选择事件
  424. * @param {Object} e
  425. */
  426. function directionChange(e) {
  427. if (e.target.value === directions[0].key) {
  428. Object.assign(orders, [{ key: '自左至右', value: '-' }, { key: '自右至左', value: '+' }]);
  429. radioOrder.value = orders[0].key;
  430. } else if (e.target.value === directions[1].key) {
  431. Object.assign(orders, [{ key: '自上至下', value: '-' }, { key: '自下至上', value: '+' }]);
  432. radioOrder.value = orders[0].key;
  433. }
  434. }
  435. /**
  436. * 窗口关闭,修改双向绑定值
  437. */
  438. function closeDialog() {
  439. emit('update:showDialog', false);
  440. }
  441. /**
  442. * 窗口打开
  443. */
  444. function openDialog() {
  445. updateParams(props.params);
  446. }
  447. </script>
  448. <style lang="scss">
  449. /* 墙对话框内容行样式 */
  450. .jt-wall-row {
  451. display: flex;
  452. flex-direction: row;
  453. height: 40px;
  454. align-items: center;
  455. /* 行左侧标题样式 */
  456. .col-left {
  457. display: flex;
  458. align-items: center;
  459. justify-content: right;
  460. width: 60px;
  461. font-family: 'Alimama_ShuHeiTi_Bold';
  462. font-weight: bold;
  463. margin-right: 8px;
  464. }
  465. /* 主要内容样式 */
  466. .col-main {
  467. flex: 1;
  468. display: flex;
  469. flex-direction: row;
  470. .el-input--suffix {
  471. background-color: rgba(255, 255, 255, 0);
  472. }
  473. .el-input--suffix * {
  474. background-color: rgba(255, 255, 255, 0);
  475. color: rgba(255, 255, 255, 1);
  476. }
  477. }
  478. }
  479. /* 墙对话框整体样式 */
  480. .jt-wall-dialog {
  481. pointer-events: none; // ***覆盖层元素增加可穿透点击事件***
  482. .el-dialog {
  483. pointer-events: auto; // ***弹窗层元素不可穿透点击事件(不影响弹窗层元素的点击事件)***
  484. position: absolute !important; //将通知框的position改成absolute,可以在某个div进行显示
  485. background: rgb(5 45 155 / 70%);
  486. min-width: 280px;
  487. overflow: hidden;
  488. /* 对话框标题头样式 */
  489. .el-dialog__header {
  490. background: url('../../assets/image/backheader.png') no-repeat;
  491. margin-right: 0px;
  492. padding: 6px;
  493. }
  494. /* 对话框关闭按钮的样式 */
  495. .el-dialog__headerbtn {
  496. height: 34px;
  497. }
  498. /* 对话框主体的样式 */
  499. .el-dialog__body {
  500. padding: 10px;
  501. color: #fff;
  502. }
  503. /* 颜色选择器的宽度 */
  504. .el-color-picker__trigger {
  505. width: 120px;
  506. }
  507. .el-body-foot {
  508. position: absolute;
  509. bottom: 8px;
  510. right: 8px;
  511. }
  512. }
  513. }
  514. </style>