temPlatePop.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div id="temPlatePop">
  3. <el-dialog
  4. :visible.sync="diaBox"
  5. width="900px"
  6. :show-close="false"
  7. :close-on-click-modal="false"
  8. >
  9. <div slot="title" class="hearders">
  10. <div class="leftTitle">字段模板</div>
  11. <div class="rightBoxs">
  12. <img
  13. src="@/assets/images/Close@2x.png"
  14. alt=""
  15. @click="diaBox = false"
  16. />
  17. </div>
  18. </div>
  19. <el-row :gutter="10" style="margin-bottom: 14px">
  20. <el-col :span="8">商品信息:</el-col>
  21. <el-col
  22. :span="8"
  23. style="color: transparent !important; user-select: none"
  24. >2</el-col
  25. >
  26. <el-col :span="8">商品包装介绍:</el-col>
  27. </el-row>
  28. <div class="boxStyle">
  29. <div class="colStyle">
  30. <div v-for="(item, index) in arr1" :key="index">
  31. <el-checkbox
  32. style="margin-right: 6px"
  33. v-model="item.status"
  34. :disabled="item.disabled == 1"
  35. :true-label="1"
  36. :false-label="0"
  37. ><span
  38. style="color: transparent !important; user-select: none"
  39. ></span
  40. ></el-checkbox>
  41. <span>{{ item.fieldName }}</span>
  42. <el-checkbox
  43. style="float: right"
  44. v-model="item.require"
  45. :true-label="1"
  46. :disabled="item.disabledRequire === 1"
  47. :false-label="0"
  48. >必填</el-checkbox
  49. >
  50. </div>
  51. </div>
  52. <div class="colStyle">
  53. <div v-for="(item, index) in arr2" :key="index">
  54. <el-checkbox
  55. style="margin-right: 6px"
  56. v-model="item.status"
  57. :disabled="item.disabled == 1"
  58. :true-label="1"
  59. :false-label="0"
  60. ><span
  61. style="color: transparent !important; user-select: none"
  62. ></span
  63. ></el-checkbox>
  64. <span>{{ item.fieldName }}</span>
  65. <el-checkbox
  66. style="float: right"
  67. v-model="item.require"
  68. :true-label="1"
  69. :disabled="item.disabledRequire === 1"
  70. :false-label="0"
  71. >必填</el-checkbox
  72. >
  73. </div>
  74. </div>
  75. <div class="colStyle">
  76. <div v-for="(item, index) in arr3" :key="index">
  77. <el-checkbox
  78. style="margin-right: 6px"
  79. v-model="item.status"
  80. :disabled="item.disabled == 1"
  81. :true-label="1"
  82. :false-label="0"
  83. ><span
  84. style="color: transparent !important; user-select: none"
  85. ></span
  86. ></el-checkbox>
  87. <span>{{ item.fieldName }}</span>
  88. <el-checkbox
  89. style="float: right"
  90. v-model="item.require"
  91. :true-label="1"
  92. :false-label="0"
  93. :disabled="item.disabledRequire === 1"
  94. >必填</el-checkbox
  95. >
  96. </div>
  97. </div>
  98. </div>
  99. <span slot="footer" class="dialog-footer">
  100. <el-button @click="diaBox = false">取 消</el-button>
  101. <el-button type="primary" @click="submitEveryDayStyleNumData"
  102. >确 定</el-button
  103. >
  104. </span>
  105. </el-dialog>
  106. </div>
  107. </template>
  108. <script>
  109. export default {
  110. data() {
  111. return {
  112. diaBox: false,
  113. everyDaystyleNum: "",
  114. arr1: [],
  115. arr2: [],
  116. arr3: [],
  117. id: "",
  118. };
  119. },
  120. methods: {
  121. openBox(id) {
  122. this.id = id;
  123. this.arr1 = [];
  124. this.arr2 = [];
  125. this.arr3 = [];
  126. this.$api.obtainbusiness(id).then((res) => {
  127. let arr = JSON.parse(res.data.goodsFieldJson);
  128. for (let i = 0; i < arr.length; i++) {
  129. if (i <= 10) {
  130. this.arr1.push(arr[i]);
  131. } else if (i > 10 && i <= 21) {
  132. this.arr2.push(arr[i]);
  133. } else {
  134. this.arr3.push(arr[i]);
  135. }
  136. }
  137. this.diaBox = true;
  138. });
  139. },
  140. submitEveryDayStyleNumData() {
  141. let json = [...this.arr1, ...this.arr2, ...this.arr3];
  142. this.$api
  143. .editCourseBusiness({
  144. goodsFieldJson: JSON.stringify(json),
  145. id: this.id,
  146. })
  147. .then((res) => {
  148. this.$emit("backData", "");
  149. this.$message.success("修改成功");
  150. this.diaBox = false;
  151. });
  152. },
  153. },
  154. };
  155. </script>
  156. <style lang="less" scoped>
  157. .boxStyle {
  158. display: flex;
  159. justify-content: space-between;
  160. }
  161. .colStyle {
  162. flex: 1;
  163. flex-shrink: 0;
  164. background-color: #eee;
  165. padding: 10px 20px;
  166. margin-right: 10px;
  167. & > :last-of-type {
  168. margin-right: 0px;
  169. }
  170. > div {
  171. margin-bottom: 6px;
  172. > span {
  173. user-select: none;
  174. }
  175. }
  176. }
  177. </style>