field_dialog.blade.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template id="fieldDialog">
  2. <el-dialog
  3. :visible.sync="fieldDialogVisible"
  4. :show-close="false"
  5. :before-close="saveFile"
  6. center
  7. width="43%">
  8. <div class="field-card"><span class="field-card-cop">选择列表字段</span> <span class="field-card-num">(一次最多可以选择6个)</span></div>
  9. <div class="field-item">
  10. <el-checkbox-group v-model="checkFielList" @change="changeCheckFile">
  11. <el-checkbox :label="item" v-for="(item,index) in income_comment" :key="index" class="el-checkbox-item" :disabled="item.state"><span class="field-item-content">[[item.title]]</span></el-checkbox>
  12. </el-checkbox-group>
  13. </div>
  14. <span slot="footer" class="dialog-footer">
  15. <el-button type="primary" @click="saveFile('')">保存</el-button>
  16. </span>
  17. </el-dialog>
  18. </template>
  19. <script>
  20. Vue.component('fieldDialog',{
  21. delimiters: ['[[', ']]'],
  22. props:{
  23. fieldDialogVisible:{
  24. type:Boolean,
  25. default:false
  26. },
  27. income_comment:{
  28. type: Array,
  29. default:()=>[]
  30. },
  31. choose_income:{
  32. type:Array,
  33. default:()=>[]
  34. },
  35. selectFielList:{
  36. type:Array,
  37. default:()=>[]
  38. }
  39. },
  40. data(){
  41. return {
  42. checkFielList:[],
  43. }
  44. },
  45. mounted() {
  46. this.changeCheckFile(this.selectFielList)
  47. this.checkFielList = this.selectFielList
  48. },
  49. methods: {
  50. saveFile(data){
  51. this.$emit('checkfiellist',{
  52. data: !data ? this.checkFielList : "",
  53. status:false
  54. })
  55. },
  56. changeCheckFile(data){
  57. if(data.length >= 6){
  58. let newArray = this.income_comment.filter((item) => !data.some((item2) => item2.type === item.type));
  59. for(let item of newArray){
  60. item.state = true
  61. }
  62. for(let item of this.income_comment){
  63. for(let el of newArray){
  64. if(item.type == el.type){
  65. item = el
  66. }
  67. }
  68. }
  69. }else{
  70. for(let item of this.income_comment){
  71. item.state = false
  72. }
  73. }
  74. }
  75. },
  76. template:"#fieldDialog",
  77. })
  78. </script>
  79. <style>
  80. .el-dialog--center .el-dialog__body {
  81. padding: 30px;
  82. }
  83. .el-dialog {
  84. display: flex;
  85. flex-direction: column;
  86. margin:0 !important;
  87. position:absolute;
  88. top:50%;
  89. left:50%;
  90. transform:translate(-50%,-50%);
  91. }
  92. .el-dialog__header {
  93. padding:0;
  94. }
  95. .field-card {
  96. margin-bottom: 37px;
  97. }
  98. .field-card-cop {
  99. font-size: 24px;
  100. font-weight: normal;
  101. font-stretch: normal;
  102. letter-spacing: 2px;
  103. color: #1f1f1f;
  104. }
  105. .field-card-num {
  106. font-size: 18px;
  107. font-weight: normal;
  108. letter-spacing: 2px;
  109. color: #6c6c6c;
  110. margin-left: 10px;
  111. }
  112. .el-checkbox-group {
  113. margin-left: 72px;
  114. display: flex;
  115. flex-wrap: wrap;
  116. height: 500px;
  117. overflow-y: auto;
  118. }
  119. .el-checkbox {
  120. width: 25%;
  121. margin-bottom: 26px;
  122. display: flex;
  123. }
  124. .el-checkbox-group:after {
  125. content: "";
  126. width: 25%;
  127. height: 0px;
  128. visibility: hidden;
  129. }
  130. .field-item-content {
  131. font-size: 18px;
  132. font-weight: normal;
  133. font-stretch: normal;
  134. line-height: 48px;
  135. letter-spacing: 1px;
  136. color: #333333;
  137. margin-left: 10px;
  138. width: 100%;
  139. white-space: break-spaces;
  140. line-height: 1;
  141. display: flex;
  142. }
  143. .el-checkbox__inner {
  144. zoom: 1.5;
  145. }
  146. .el-checkbox__label {
  147. width: 100%;
  148. }
  149. </style>