pagination.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <section>
  3. <div id="setting" >
  4. <div id="Attribute">
  5. <div style="color: red;font-weight: bolder;text-align: center;font-size: 14px;">页码</div>
  6. <table :title="form && form.id ? '编辑' : '新增' " :model="form">
  7. <tr>
  8. <td>名称 <input type="text" style="width: 108px" v-model="form_copy.name"/></td>
  9. </tr>
  10. <tr>
  11. <td>
  12. 字高 <input type="text" v-model="form_copy.fontSize"/>
  13. 三角形高 <input type="text" v-model="form_copy.graphicHeight"/>
  14. </td>
  15. </tr>
  16. <tr>
  17. <td>三角形与两边距离 <input type="text" v-model="form_copy.graphicMargin" /></td>
  18. </tr>
  19. <tr>
  20. <td>方框与两边距离 <input type="text" v-model="form_copy.boxMargin" /></td>
  21. </tr>
  22. <tr>
  23. <td>1与——距离 <input type="text" v-model="form_copy.hyphenLeftMargin" /></td>
  24. </tr>
  25. <tr>
  26. <td>/与0距离 <input type="text" v-model="form_copy.slashRightMargin" /></td>
  27. </tr>
  28. <tr>
  29. <td >
  30. <label>着色 <input type="color" v-model="form_copy.color" style="width: 40px;"/></label>
  31. &nbsp;
  32. <button type="primary" @click="fittingPreview">预览</button>
  33. &nbsp;
  34. <button type="primary" @click="fittingSave">提交</button>
  35. </td>
  36. </tr>
  37. </table>
  38. </div>
  39. <div id="fitting" style="width:895px">
  40. <div class="pagination_type" :style="{fontSize:form.fontSize+'px'}">
  41. <input type="radio" name="pagination_type" value="1" :checked="form.type==1" v-model="form.type"/>
  42. 0
  43. <label :style="{marginRight:form.slashRightMargin+'px'}">/</label>
  44. 0
  45. </div>
  46. <div class="pagination_type" :style="{fontSize:form.fontSize+'px'}">
  47. <input type="radio" name="pagination_type" value="2" :checked="form.type==2" v-model="form.type"/>
  48. <div class="triangle-left" :style="{borderTop:form.graphicHeight/2+'px solid transparent',
  49. borderBottom:form.graphicHeight/2+'px solid transparent',borderRight:form.graphicHeight+'px solid '+form.color,
  50. marginRight:form.graphicMargin+'px'}"></div>
  51. 1
  52. <label :style="{marginLeft:form.hyphenLeftMargin+'px'}">-</label>
  53. <input type="text" v-model="form.content" :style="{marginLeft:form.boxMargin+'px',marginRight:form.boxMargin+'px'}" />
  54. <label :style="{marginRight:form.slashRightMargin+'px'}">/</label>
  55. 00
  56. <div class="triangle-right" :style="{borderTop:form.graphicHeight/2+'px solid transparent',
  57. borderBottom:form.graphicHeight/2+'px solid transparent',borderLeft:form.graphicHeight+'px solid '+form.color,
  58. marginLeft:form.graphicMargin+'px'}"></div>
  59. </div>
  60. <div class="pagination_type" :style="{fontSize:form.fontSize+'px'}">
  61. <input type="radio" name="pagination_type" value="3" :checked="form.type==3" v-model="form.type" />
  62. <div class="triangle-left" :style="{borderTop:form.graphicHeight/2+'px solid transparent',
  63. borderBottom:form.graphicHeight/2+'px solid transparent',borderRight:form.graphicHeight+'px solid '+form.color,
  64. marginRight:form.graphicMargin+'px'}"></div>
  65. 1
  66. <label :style="{marginLeft:form.hyphenLeftMargin+'px'}">-</label>
  67. <input type="text" v-model="form.content" :style="{marginLeft:form.boxMargin+'px',marginRight:form.boxMargin+'px'}" />
  68. <label :style="{marginRight:form.slashRightMargin+'px'}">/</label>
  69. 000
  70. <div class="triangle-right" :style="{borderTop:form.graphicHeight/2+'px solid transparent',
  71. borderBottom:form.graphicHeight/2+'px solid transparent',borderLeft:form.graphicHeight+'px solid '+form.color,
  72. marginLeft:form.graphicMargin+'px'}"></div>
  73. </div>
  74. </div>
  75. </div>
  76. </section>
  77. </template>
  78. <script>
  79. let findAll = function() {
  80. this.$axios.get("/api/accessories/pagination/findAll").then(response => {
  81. if (response.data.code == 0) {
  82. this.rows = response.data.list;
  83. }
  84. })
  85. .catch(error => {
  86. console.log(error);
  87. this.message = error;
  88. });
  89. };
  90. let fittingSave = function(){
  91. this.$axios.post('/api/accessories/pagination/saveOrUpdate', this.form).then(response => {
  92. if (response.data.code == 0) {
  93. this.findAll()
  94. this.form = {}
  95. }
  96. })
  97. .catch(error => {
  98. console.log(error);
  99. this.message = error;
  100. });
  101. }
  102. let fittingEdit = function(index){
  103. this.form = this.rows[index]
  104. }
  105. let settingShow = function(){
  106. this.form = {}
  107. }
  108. let fittingPreview = function(){
  109. this.form = Object.assign({}, this.form_copy)
  110. }
  111. export default {
  112. data() {
  113. return {
  114. rows: [],
  115. form: {},
  116. form_copy: {
  117. color:'red'
  118. }
  119. };
  120. },
  121. mounted: function() {
  122. this.findAll();
  123. },
  124. methods: {
  125. findAll,
  126. fittingSave,
  127. fittingEdit,
  128. settingShow,
  129. fittingPreview
  130. }
  131. };
  132. </script>
  133. <style scoped>
  134. #Attribute {
  135. padding: 20px 15px 30px;
  136. }
  137. #Attribute table tr td {
  138. height: 28px;
  139. padding: 0;
  140. }
  141. #Attribute table tr td input[type="text"] {
  142. width: 30px;
  143. }
  144. input[type="radio"] {
  145. border-radius:0% 0%;
  146. }
  147. .triangle-left {
  148. width: 0;
  149. height: 0;
  150. border-top: 7px solid transparent;
  151. border-right: 14px solid red;
  152. border-bottom: 7px solid transparent;
  153. margin-bottom: -2px;
  154. }
  155. .triangle-right {
  156. width: 0;
  157. height: 0;
  158. border-top: 7px solid transparent;
  159. border-left: 14px solid red;
  160. border-bottom: 7px solid transparent;
  161. margin-bottom: -2px;
  162. }
  163. .pagination_type{
  164. display: inline-block;
  165. width: 295px;
  166. margin-top: 50px;
  167. }
  168. .pagination_type >input,.pagination_type>div,.pagination_type>label{
  169. display: inline-block;
  170. }
  171. .pagination_type input[type="text"]{
  172. width: 30px;
  173. }
  174. </style>