index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. import InputCom from './component/input.vue'
  142. export default {
  143. name: 'SourceDialog',
  144. components: {
  145. InputCom
  146. },
  147. data () {
  148. return {
  149. dialogVisible: false,
  150. imgUrl:'',
  151. top:0,
  152. right:0,
  153. bottom:0,
  154. left:0,
  155. symbol:'',
  156. isDown:false,
  157. x:0,
  158. y:0,
  159. l:0,
  160. t:0
  161. }
  162. },
  163. computed: {
  164. url(){
  165. return require('data-room-ui/BorderComponents/GcBorder16/component.png')
  166. }
  167. },
  168. mounted () {
  169. },
  170. methods: {
  171. confirm(){
  172. this.$emit('getArray',[this.top,this.right,this.bottom,this.left])
  173. this.dialogVisible = false
  174. },
  175. getDom(){
  176. // const a=document.getElementById('top')
  177. // const b=document.getElementById('right')
  178. // const c=document.getElementById('bottom')
  179. // const d=document.getElementById('left')
  180. // this.top=getComputedStyle(a).top.slice(0,-2)
  181. // this.right=getComputedStyle(b).right.slice(0,-2)
  182. // this.bottom=getComputedStyle(c).bottom.slice(0,-2)
  183. // this.left=getComputedStyle(d).left.slice(0,-2)
  184. },
  185. onMouseUp(){
  186. // this.isDown=false;
  187. },
  188. onMousemove(e){
  189. // const a=document.getElementById('top')
  190. // if(this.isDown==false){
  191. // return
  192. // }
  193. // console.log(e)
  194. // let ny=e.clientY-194;
  195. // let nt=ny-(this.y-this.t);
  196. // a.style.top=nt+"px"
  197. // this.top=a.style.top
  198. },
  199. onMouseDown(e){
  200. // this.y=e.layerY
  201. // this.t=this.top;
  202. // this.isDown=true
  203. // console.log(this.x,this.l)
  204. },
  205. changeSymbol(val){
  206. this.symbol=val
  207. },
  208. close(){
  209. },
  210. changeTop(val){
  211. const a=document.getElementById('top')
  212. a.style.top=val+"px"
  213. },
  214. changeRight(val){
  215. const a=document.getElementById('right')
  216. a.style.right=val+"px"
  217. },
  218. changeBottom(val){
  219. const a=document.getElementById('bottom')
  220. a.style.bottom=val+"px"
  221. },
  222. changeLeft(val){
  223. const a=document.getElementById('left')
  224. a.style.left=val+"px"
  225. },
  226. init (val,array) {
  227. if(!val.startsWith('http')){
  228. this.imgUrl=getFileUrl(val)
  229. }else{
  230. this.imgUrl=val
  231. }
  232. if(array){
  233. [this.top,this.right,this.bottom,this.left]=array
  234. this.$nextTick(()=>{
  235. this.changeTop(this.top)
  236. this.changeRight(this.right)
  237. this.changeBottom(this.bottom)
  238. this.changeLeft(this.left)
  239. })
  240. }
  241. this.dialogVisible = true
  242. },
  243. }
  244. }
  245. </script>
  246. <style lang="scss" scoped>
  247. // @import '../../assets/style/bsTheme.scss';
  248. ::v-deep .el-dialog__body{
  249. background-color: #232832;
  250. position: relative;
  251. min-height: 450px;
  252. align-items: center;
  253. justify-content: center;
  254. display: flex;
  255. padding: 16px 16px 16px 16px !important;
  256. }
  257. .content{
  258. margin: 20px 0;
  259. width: 100%;
  260. display: flex;
  261. justify-content: center;
  262. align-items: center;
  263. .img{
  264. position: relative;
  265. .toptitle{
  266. position: absolute;
  267. top: -30px;
  268. left: 34%;
  269. }
  270. .righttitle{
  271. position: absolute;
  272. top: 50%;
  273. right: -110px;
  274. }
  275. .bottomtitle{
  276. position: absolute;
  277. bottom: -30px;
  278. left: 34%;
  279. }
  280. .lefttitle{
  281. position: absolute;
  282. top: 50%;
  283. left: -110px;
  284. }
  285. // height: 100%;
  286. .top{
  287. position: absolute;
  288. top: 0;
  289. height: 1px;
  290. background-color: #fff;
  291. width: 100%;
  292. }
  293. .right{
  294. position: absolute;
  295. right: 0;
  296. top: 0;
  297. height: 100%;
  298. background-color: #fff;
  299. width: 1px;
  300. }
  301. .bottom{
  302. position: absolute;
  303. bottom: 0;
  304. height: 1px;
  305. background-color: #fff;
  306. width: 100%;
  307. }
  308. .left{
  309. position: absolute;
  310. left: 0;
  311. top: 0;
  312. height: 100%;
  313. background-color: #fff;
  314. width: 1px;
  315. }
  316. }
  317. }
  318. ::v-deep .el-input-number--mini{
  319. width: 100px;
  320. .el-input__inner{
  321. padding-right: 30px;
  322. }
  323. }
  324. table{
  325. margin-right: 120px;
  326. color: #fff;
  327. border: 1px solid #fff;
  328. }
  329. th{
  330. padding: 4px;
  331. }
  332. td{
  333. padding: 8px;
  334. }
  335. </style>