index.vue 7.4 KB

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