multiColumn.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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>名称</td>
  9. <td colspan="3"><input type="text" v-model="form_copy.name"/></td>
  10. <td>宽度</td>
  11. <td ><input type="text" style="width:20px;" v-model="form_copy.width" /></td>
  12. </tr>
  13. <tr>
  14. <td colspan="4">
  15. 高:一层<input type="text" style="width:30px;margin: 0 5px;" v-model="form_copy.heightOne" />
  16. 二层<input type="text" style="width:30px;margin: 0 5px;" v-model="form_copy.heightTwo" />
  17. </td>
  18. <td>列数</td>
  19. <td ><input type="text" style="width:20px;" v-model="form_copy.columnCount" /></td>
  20. </tr>
  21. <tr>
  22. <td colspan="4">
  23. 字体
  24. <select v-model="form_copy.fontFamily" style="width:50px;border: #0342c5 1px solid;">
  25. <option value="黑体">黑体</option>
  26. <option value="楷体">楷体</option>
  27. <option value="微软雅黑">微软雅黑</option>
  28. <option value="宋体">宋体</option>
  29. </select>
  30. 字高<input type="text" style="width:30px;margin: 0 5px;" v-model="form_copy.fontSize" />
  31. </td>
  32. <td>字距</td>
  33. <td ><input type="text" style="width:20px;" v-model="form_copy.letterSpacing" /></td>
  34. </tr>
  35. <tr>
  36. <td colspan="4">
  37. 分列宽:1<input type="text" style="width:30px;margin: 0 5px;" v-model="form_copy.heightOne" />
  38. 2<input type="text" style="width:30px;margin: 0 5px;" v-model="form_copy.heightTwo" />
  39. </td>
  40. <td>3</td>
  41. <td ><input type="text" style="width:20px;" v-model="form_copy.letterSpacing" /></td>
  42. </tr>
  43. <tr>
  44. <td colspan="4">
  45. 4<input type="text" style="width:30px;margin: 0 5px;" v-model="form_copy.heightOne" />
  46. 5<input type="text" style="width:30px;margin: 0 5px;" v-model="form_copy.heightOne" />
  47. 6<input type="text" style="width:30px;margin: 0 5px;" v-model="form_copy.heightOne" />
  48. </td>
  49. <td>计宽</td>
  50. <td ><input type="text" style="width:20px;" v-model="form_copy.letterSpacing" /></td>
  51. </tr>
  52. <tr>
  53. <td>字组</td>
  54. <td colspan="5"><input type="text" v-model="form_copy.content" /></td>
  55. </tr>
  56. <tr>
  57. <td colspan="6">
  58. <button type="primary" @click="fittingPreview">键入</button>
  59. &nbsp;
  60. <button type="primary" @click="fittingPreview">预览</button>
  61. &nbsp;
  62. <button type="primary" @click="fittingSave">提交</button>
  63. </td>
  64. </tr>
  65. </table>
  66. </div>
  67. <div id="fitting">
  68. <table>
  69. <tr><td :colspan="form.columnCount" :style="{width:form.width+'px',height:form.heightOne+'px'}"></td></tr>
  70. <tr>
  71. <td v-for="index in form.columnCount" v-bind:key="index" :style="{height:form.heightTwo+'px'}"></td>
  72. </tr>
  73. <tr>
  74. <td v-for="index in form.columnCount" v-bind:key="index" ></td>
  75. </tr>
  76. </table>
  77. </div>
  78. </div>
  79. </section>
  80. </template>
  81. <script>
  82. let findAll = function() {
  83. this.$axios.get("/api/columns/multiColumn/findAll").then(response => {
  84. if (response.data.code == 0) {
  85. this.rows = response.data.list;
  86. }
  87. })
  88. .catch(error => {
  89. console.log(error);
  90. this.message = error;
  91. });
  92. };
  93. let fittingSave = function(){
  94. this.$axios.post('/api/columns/multiColumn/saveOrUpdate', this.form).then(response => {
  95. if (response.data.code == 0) {
  96. this.findAll()
  97. this.form = {}
  98. }
  99. })
  100. .catch(error => {
  101. console.log(error);
  102. this.message = error;
  103. });
  104. }
  105. let fittingEdit = function(index){
  106. this.form = this.rows[index]
  107. }
  108. let settingShow = function(){
  109. this.form = {}
  110. }
  111. let fittingPreview = function(){
  112. this.form = Object.assign({}, this.form_copy)
  113. }
  114. export default {
  115. data() {
  116. return {
  117. rows: [],
  118. form: {
  119. columnCount:3
  120. },
  121. form_copy: {}
  122. };
  123. },
  124. mounted: function() {
  125. this.findAll();
  126. },
  127. methods: {
  128. findAll,
  129. fittingSave,
  130. fittingEdit,
  131. settingShow,
  132. fittingPreview
  133. }
  134. };
  135. </script>
  136. <style scoped>
  137. #fitting table{
  138. border: 1px solid #000;
  139. border-collapse: collapse;
  140. margin: auto;
  141. margin-top: 70px;
  142. }
  143. #fitting table tr td{
  144. width: 50px;
  145. height: 30px;
  146. border: 1px solid #000;
  147. }
  148. #Attribute {
  149. padding: 34px 34px;
  150. width: 230px;
  151. }
  152. </style>