index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <el-dialog
  3. title="点九图"
  4. :visible.sync="dialogVisible"
  5. :modal="true"
  6. width="75%"
  7. :modal-append-to-body="false"
  8. :appen-to-body="false"
  9. class="bs-dialog-wrap bs-el-dialog"
  10. @closed="close"
  11. @opened="getDom"
  12. >
  13. <div class="contentTable">
  14. <table
  15. border="1"
  16. cellspacing="0"
  17. >
  18. <tr>
  19. <th>方向</th>
  20. <th>描述</th>
  21. </tr>
  22. <tr>
  23. <td>左上角</td>
  24. <td>不能拉伸</td>
  25. </tr>
  26. <tr>
  27. <td>右上角</td>
  28. <td>不能拉伸</td>
  29. </tr>
  30. <tr>
  31. <td>左下角</td>
  32. <td>不能拉伸</td>
  33. </tr>
  34. <tr>
  35. <td>右下角</td>
  36. <td>不能拉伸</td>
  37. </tr>
  38. <tr>
  39. <td>左侧</td>
  40. <td>宽度不变,高度自动拉伸</td>
  41. </tr>
  42. <tr>
  43. <td>右侧</td>
  44. <td>宽度不变,高度自动拉伸</td>
  45. </tr>
  46. <tr>
  47. <td>顶部</td>
  48. <td>高度不变,宽度自动拉伸</td>
  49. </tr>
  50. <tr>
  51. <td>底部</td>
  52. <td>高度不变,宽度自动拉伸</td>
  53. </tr>
  54. <tr>
  55. <td>中部</td>
  56. <td>宽度,高度自动拉伸</td>
  57. </tr>
  58. </table>
  59. </div>
  60. <div
  61. class="imgContent"
  62. >
  63. <div class="imgContainer">
  64. <span class="toptitle">
  65. <!-- <InputCom @changeStyle='changeTop' :Fx="['上','下']" :number="top" /> -->
  66. <el-input-number
  67. v-model="top"
  68. class="bs-el-input-number"
  69. :step=" 1"
  70. :min="0"
  71. :max="49"
  72. @change="changeTop"
  73. />
  74. </span>
  75. <span class="righttitle">
  76. <el-input-number
  77. v-model="right"
  78. class="bs-el-input-number"
  79. :step=" 1"
  80. :min="0"
  81. :max="49"
  82. @change="changeRight"
  83. />
  84. </span>
  85. <span class="bottomtitle">
  86. <el-input-number
  87. v-model="bottom"
  88. class="bs-el-input-number"
  89. :step=" 1"
  90. :min="0"
  91. :max="49"
  92. @change="changeBottom"
  93. />
  94. </span>
  95. <span class="lefttitle">
  96. <el-input-number
  97. v-model="left"
  98. class="bs-el-input-number"
  99. :step=" 1"
  100. :min="0"
  101. :max="49"
  102. @change="changeLeft"
  103. />
  104. </span>
  105. <el-image
  106. style="max-width:550px;object-fit: cover;"
  107. :src="imgUrl||url"
  108. fit="cover"
  109. />
  110. <div
  111. id="top"
  112. class="top"
  113. @mousedown="onMouseDown"
  114. @mouseup="onMouseUp"
  115. @mousemove="onMousemove"
  116. @click="changeSymbol('top')"
  117. />
  118. <div
  119. id="right"
  120. class="right"
  121. @click="changeSymbol('right')"
  122. />
  123. <div
  124. id="bottom"
  125. class="bottom"
  126. @click="changeSymbol('bottom')"
  127. />
  128. <div
  129. id="left"
  130. class="left"
  131. @click="changeSymbol('left')"
  132. />
  133. </div>
  134. </div>
  135. <div
  136. slot="footer"
  137. class="dialog-footer"
  138. >
  139. <el-button
  140. class="bs-el-button-default"
  141. @click="dialogVisible = false"
  142. >
  143. 取消
  144. </el-button>
  145. <el-button
  146. type="primary"
  147. @click="confirm"
  148. >
  149. 确定
  150. </el-button>
  151. </div>
  152. </el-dialog>
  153. </template>
  154. <script>
  155. import { getFileUrl } from 'data-room-ui/js/utils/file'
  156. export default {
  157. name: 'SourceDialog',
  158. data () {
  159. return {
  160. contentHeight: 300,
  161. dialogVisible: false,
  162. imgUrl: '',
  163. top: 0,
  164. right: 0,
  165. bottom: 0,
  166. left: 0,
  167. symbol: '',
  168. isDown: false,
  169. x: 0,
  170. y: 0,
  171. l: 0,
  172. t: 0
  173. }
  174. },
  175. computed: {
  176. url () {
  177. return require('data-room-ui/BorderComponents/GcBorder16/component.png')
  178. }
  179. },
  180. methods: {
  181. confirm () {
  182. this.$emit('getArray', [this.top, this.right, this.bottom, this.left])
  183. this.dialogVisible = false
  184. },
  185. init (val, array) {
  186. if (!val.startsWith('http')) {
  187. this.imgUrl = getFileUrl(val)
  188. } else {
  189. this.imgUrl = val
  190. }
  191. if (array) {
  192. [this.top, this.right, this.bottom, this.left] = array
  193. this.$nextTick(() => {
  194. this.changeTop(this.top)
  195. this.changeRight(this.right)
  196. this.changeBottom(this.bottom)
  197. this.changeLeft(this.left)
  198. })
  199. }
  200. this.dialogVisible = true
  201. },
  202. getDom () {
  203. // const a=document.getElementById('top')
  204. // const b=document.getElementById('right')
  205. // const c=document.getElementById('bottom')
  206. // const d=document.getElementById('left')
  207. // this.top=getComputedStyle(a).top.slice(0,-2)
  208. // this.right=getComputedStyle(b).right.slice(0,-2)
  209. // this.bottom=getComputedStyle(c).bottom.slice(0,-2)
  210. // this.left=getComputedStyle(d).left.slice(0,-2)
  211. },
  212. close () {
  213. },
  214. changeTop (val) {
  215. const a = document.getElementById('top')
  216. a.style.top = val + '%'
  217. },
  218. changeRight (val) {
  219. const a = document.getElementById('right')
  220. a.style.right = val + '%'
  221. },
  222. changeBottom (val) {
  223. const a = document.getElementById('bottom')
  224. a.style.bottom = val + '%'
  225. },
  226. changeLeft (val) {
  227. const a = document.getElementById('left')
  228. a.style.left = val + '%'
  229. },
  230. onMouseUp () {
  231. // this.isDown=false;
  232. },
  233. onMousemove (e) {
  234. // const a=document.getElementById('top')
  235. // if(this.isDown==false){
  236. // return
  237. // }
  238. // let ny=e.clientY-194;
  239. // let nt=ny-(this.y-this.t);
  240. // a.style.top=nt+"px"
  241. // this.top=a.style.top
  242. },
  243. onMouseDown (e) {
  244. // this.y=e.layerY
  245. // this.t=this.top;
  246. // this.isDown=true
  247. },
  248. changeSymbol (val) {
  249. this.symbol = val
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss" scoped>
  255. ::v-deep .el-dialog__body{
  256. position: relative;
  257. background-color: #232832;
  258. min-height: 450px;
  259. padding: 16px 16px 16px 16px !important;
  260. overflow: auto;
  261. }
  262. .contentTable{
  263. position: absolute;
  264. top: 0;
  265. left: 0;
  266. width: 400px;
  267. margin-top: 50px;
  268. margin-left: 80px;
  269. margin-right: 200px;
  270. table{
  271. color: #fff;
  272. border: 1px solid #fff;
  273. }
  274. td,th{
  275. padding: 8px 20px;
  276. text-align: center;
  277. vertical-align: middle;
  278. }
  279. }
  280. .imgContent{
  281. width: 400px;
  282. position: absolute;
  283. left: 600px;
  284. top: 50%;
  285. transform: translateY(-50%);
  286. margin-top: 0px;
  287. .imgContainer{
  288. width: 100%;
  289. height: 100%;
  290. position: relative;
  291. .toptitle{
  292. position: absolute;
  293. top: -43px;
  294. left: 50%;
  295. transform: translateX(-50%);
  296. }
  297. .righttitle{
  298. position: absolute;
  299. top: 50%;
  300. transform: translateY(-50%);
  301. right: -150px;
  302. }
  303. .bottomtitle{
  304. position: absolute;
  305. bottom: -43px;
  306. left: 50%;
  307. transform: translateX(-50%);
  308. }
  309. .lefttitle{
  310. position: absolute;
  311. top: 50%;
  312. transform: translateY(-50%);
  313. left: -150px;
  314. }
  315. // height: 100%;
  316. .top{
  317. position: absolute;
  318. top: 0;
  319. height: 1px;
  320. background-color: #fff;
  321. width: 100%;
  322. }
  323. .right{
  324. position: absolute;
  325. right: 0;
  326. top: 0;
  327. height: 100%;
  328. background-color: #fff;
  329. width: 1px;
  330. }
  331. .bottom{
  332. position: absolute;
  333. bottom: 0;
  334. height: 1px;
  335. background-color: #fff;
  336. width: 100%;
  337. }
  338. .left{
  339. position: absolute;
  340. left: 0;
  341. top: 0;
  342. height: 100%;
  343. background-color: #fff;
  344. width: 1px;
  345. }
  346. }
  347. }
  348. </style>