tableHead.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <section>
  3. <div id="child_menu">
  4. <div class="left">
  5. <label>行数</label>
  6. <input type="text" style="width: 40px" v-model="sum_copy"/>
  7. <label @click="changeSum" style="cursor: pointer">确认</label>
  8. </div>
  9. <div class="right">
  10. <label>设置</label> &nbsp;&nbsp;&nbsp; <label>删除</label>
  11. </div>
  12. </div>
  13. <child v-bind:sum="this.sum"></child>
  14. <div id="setting" >
  15. <div id="Attribute">
  16. <div style="color: red;font-weight: bolder;text-align: center;font-size: 14px;">抬 头</div>
  17. <table :title="form && form.id ? '编辑' : '新增' " :model="form">
  18. <tr>
  19. <td>名称</td>
  20. <td colspan="3"><input type="text" v-model="form_copy.name"/></td>
  21. </tr>
  22. <tr>
  23. <td>字体</td>
  24. <td>
  25. <select v-model="form_copy.fontFamily" style="width:80px;border: #0342c5 1px solid;">
  26. <option value="黑体">黑体</option>
  27. <option value="楷体">楷体</option>
  28. <option value="微软雅黑">微软雅黑</option>
  29. <option value="宋体">宋体</option>
  30. </select>
  31. </td>
  32. <td>字高</td>
  33. <td><input type="text" v-model="form_copy.fontSize"/></td>
  34. </tr>
  35. <tr>
  36. <td>字距</td>
  37. <td colspan="3">
  38. <input type="text" style="width:50px;margin-right: 14px;" v-model="form_copy.letterSpacing" />
  39. 线粗
  40. <input type="text" style="width:50px" v-model="form_copy.thickness"/></td>
  41. </tr>
  42. <tr>
  43. <td>长度</td>
  44. <td colspan="3">
  45. <input type="text" style="width:45px;margin-right: 14px;" v-model="form_copy.width" />
  46. 距抬头
  47. <input type="text" style="width:45px" v-model="form_copy.marginTop"/></td>
  48. </tr>
  49. <tr>
  50. <td>字组</td>
  51. <td colspan="3"><input type="text" v-model="form_copy.content" /></td>
  52. </tr>
  53. <tr>
  54. <td colspan="4">
  55. <label>着色 <input type="color" v-model="form_copy.color" style="width: 40px;"/></label>
  56. &nbsp;
  57. <button type="primary" @click="fittingPreview">预览</button>
  58. &nbsp;
  59. <button type="primary" @click="fittingSave">提交</button>
  60. </td>
  61. </tr>
  62. </table>
  63. </div>
  64. <div id="fitting">
  65. <div style="margin:70px auto 0" :style="{width:form.width+'px',letterSpacing:form.letterSpacing+'px'}">
  66. <div>{{form.content}}</div>
  67. <hr :style="{borderBottom:form.thickness+'px solid '+form.color,marginTop:form.marginTop+'px'}" />
  68. </div>
  69. </div>
  70. </div>
  71. </section>
  72. </template>
  73. <script>
  74. import child from '@/components/common/list';
  75. let data = () => {
  76. return {
  77. collapsed: false,
  78. sum:1,
  79. sum_copy:1,
  80. form_copy:{
  81. width:250,
  82. color:'red'
  83. },
  84. form:{
  85. width:250,
  86. color:'red'
  87. }
  88. }
  89. }
  90. let changeSum = function(){
  91. this.sum = this.sum_copy * 8
  92. }
  93. let findAll = function() {
  94. this.$axios.get("/api/columns/singleColumn/findAll").then(response => {
  95. if (response.data.code == 0) {
  96. this.rows = response.data.list;
  97. }
  98. })
  99. .catch(error => {
  100. console.log(error);
  101. this.message = error;
  102. });
  103. };
  104. let fittingSave = function(){
  105. this.$axios.post('/api/columns/singleColumn/saveOrUpdate', this.form).then(response => {
  106. if (response.data.code == 0) {
  107. this.findAll()
  108. this.form = {}
  109. }
  110. })
  111. .catch(error => {
  112. console.log(error);
  113. this.message = error;
  114. });
  115. }
  116. let fittingEdit = function(index){
  117. this.form = this.rows[index]
  118. }
  119. let settingShow = function(){
  120. this.form = {}
  121. }
  122. let fittingPreview = function(){
  123. if(this.form_copy.width=="") this.form_copy.width=0
  124. this.form = Object.assign({}, this.form_copy)
  125. }
  126. export default {
  127. data: data,
  128. methods: {
  129. findAll,
  130. fittingSave,
  131. fittingEdit,
  132. settingShow,
  133. changeSum,
  134. fittingPreview
  135. },
  136. mounted: function() {
  137. this.findAll();
  138. },
  139. components:{
  140. child
  141. }
  142. }
  143. </script>
  144. <style scoped>
  145. hr{
  146. border: none;
  147. border-bottom: red solid 1px;
  148. }
  149. </style>