index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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. // console.log(e)
  239. // let ny=e.clientY-194;
  240. // let nt=ny-(this.y-this.t);
  241. // a.style.top=nt+"px"
  242. // this.top=a.style.top
  243. },
  244. onMouseDown (e) {
  245. // this.y=e.layerY
  246. // this.t=this.top;
  247. // this.isDown=true
  248. // console.log(this.x,this.l)
  249. },
  250. changeSymbol (val) {
  251. this.symbol = val
  252. }
  253. }
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. ::v-deep .el-dialog__body{
  258. position: relative;
  259. background-color: #232832;
  260. min-height: 450px;
  261. padding: 16px 16px 16px 16px !important;
  262. overflow: auto;
  263. }
  264. .contentTable{
  265. position: absolute;
  266. top: 0;
  267. left: 0;
  268. width: 400px;
  269. margin-top: 50px;
  270. margin-left: 80px;
  271. margin-right: 200px;
  272. table{
  273. color: #fff;
  274. border: 1px solid #fff;
  275. }
  276. td,th{
  277. padding: 8px 20px;
  278. text-align: center;
  279. vertical-align: middle;
  280. }
  281. }
  282. .imgContent{
  283. width: 400px;
  284. position: absolute;
  285. left: 600px;
  286. top: 50%;
  287. transform: translateY(-50%);
  288. margin-top: 0px;
  289. .imgContainer{
  290. width: 100%;
  291. height: 100%;
  292. position: relative;
  293. .toptitle{
  294. position: absolute;
  295. top: -43px;
  296. left: 50%;
  297. transform: translateX(-50%);
  298. }
  299. .righttitle{
  300. position: absolute;
  301. top: 50%;
  302. transform: translateY(-50%);
  303. right: -150px;
  304. }
  305. .bottomtitle{
  306. position: absolute;
  307. bottom: -43px;
  308. left: 50%;
  309. transform: translateX(-50%);
  310. }
  311. .lefttitle{
  312. position: absolute;
  313. top: 50%;
  314. transform: translateY(-50%);
  315. left: -150px;
  316. }
  317. // height: 100%;
  318. .top{
  319. position: absolute;
  320. top: 0;
  321. height: 1px;
  322. background-color: #fff;
  323. width: 100%;
  324. }
  325. .right{
  326. position: absolute;
  327. right: 0;
  328. top: 0;
  329. height: 100%;
  330. background-color: #fff;
  331. width: 1px;
  332. }
  333. .bottom{
  334. position: absolute;
  335. bottom: 0;
  336. height: 1px;
  337. background-color: #fff;
  338. width: 100%;
  339. }
  340. .left{
  341. position: absolute;
  342. left: 0;
  343. top: 0;
  344. height: 100%;
  345. background-color: #fff;
  346. width: 1px;
  347. }
  348. }
  349. }
  350. </style>