index.vue 7.8 KB

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