main.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <div>
  3. <el-dialog title="属性编辑" class="el-dialogDeep" :visible.sync="visible" top="10vh" width="60%" append-to-body
  4. @closed="closed" :close-on-click-modal="false" v-dialog-drag>
  5. <span>
  6. <!-- <div class="settingBut">
  7. <el-button size="mini" @click="saveSetting" v-if="labelShow" type="primary">保存</el-button>
  8. <el-button size="mini" @click="labelShow = false" v-if="labelShow">取消</el-button>
  9. <el-tooltip effect="dark" content="Label名设置" placement="bottom" v-if="!labelShow">
  10. <el-button icon="el-icon-setting" circle size="mini" @click="setting"></el-button>
  11. </el-tooltip>
  12. </div> -->
  13. <avue-form ref="form" v-model="form" :option="option">
  14. <!-- <template slot="remarksOneLabel" v-if="labelShow">
  15. <el-input v-model="labelForm.label1" placeholder="请输入内容"></el-input>
  16. </template>
  17. <template slot="customTwoLabel" v-if="labelShow">
  18. <el-input v-model="labelForm.label2" placeholder="请输入内容"></el-input>
  19. </template>
  20. <template slot="customThreeLabel" v-if="labelShow">
  21. <el-input v-model="labelForm.label3" placeholder="请输入内容"></el-input>
  22. </template>
  23. <template slot="customFourLabel" v-if="labelShow">
  24. <el-input v-model="labelForm.label4" placeholder="请输入内容"></el-input>
  25. </template>
  26. <template slot="customFiveLabel" v-if="labelShow">
  27. <el-input v-model="labelForm.label5" placeholder="请输入内容"></el-input>
  28. </template> -->
  29. </avue-form>
  30. </span>
  31. <span slot="footer" class="dialog-footer">
  32. <el-button @click="visible = false">取 消</el-button>
  33. <el-button type="primary" @click="importData">确 认</el-button>
  34. </span>
  35. </el-dialog>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. name: "property-dialog",
  41. data() {
  42. return {
  43. form: {
  44. remarksOne: null,
  45. customTwo: null,
  46. customThree: null,
  47. customFour: null,
  48. customFive: null,
  49. customSix: null,
  50. customSeven: null,
  51. customEight: null,
  52. customNine: null,
  53. customTen: null,
  54. },
  55. visible: false,
  56. fromIndex: null,
  57. option: {
  58. menuBtn: false,
  59. labelWidth: 100,
  60. column: [
  61. {
  62. label: "螺纹",
  63. prop: "remarksOne",
  64. labelslot: true,
  65. span: 12,
  66. type: "select",
  67. dicUrl: "/api/blade-system/dict-biz/dictionary?code=Thread",
  68. props: {
  69. label: "dictValue",
  70. value: "dictValue"
  71. }
  72. },
  73. {
  74. label: "介质",
  75. prop: "customTwo",
  76. span: 12,
  77. type: "select",
  78. dicUrl: "/api/blade-system/dict-biz/dictionary?code=medium",
  79. props: {
  80. label: "dictValue",
  81. value: "dictValue"
  82. }
  83. },
  84. {
  85. label: "颜色",
  86. prop: "customThree",
  87. span: 12,
  88. type: "select",
  89. dicUrl: "/api/blade-system/dict-biz/dictionary?code=property_color",
  90. props: {
  91. label: "dictValue",
  92. value: "dictValue"
  93. }
  94. },
  95. {
  96. label: "钢印",
  97. prop: "customFour",
  98. span: 12,
  99. type: "select",
  100. dicUrl: "/api/blade-system/dict-biz/dictionary?code=stencil",
  101. props: {
  102. label: "dictValue",
  103. value: "dictValue"
  104. }
  105. },
  106. {
  107. label: "特别提示",
  108. prop: "customFive",
  109. span: 24
  110. }
  111. ]
  112. },
  113. labelShow: false,
  114. labelForm: {}
  115. };
  116. },
  117. props: {},
  118. async created() {
  119. this.option = await this.getColumnData(this.getColumnName(52), this.option);
  120. },
  121. methods: {
  122. init(row, index) {
  123. if (row.attributeList) {
  124. let attributeList = []
  125. let data = []
  126. let propName = ["remarksOne", "customTwo", "customThree", "customFour", "customFive", "customSix", "customSeven", "customEight", "customNine", "customTen"]
  127. attributeList = JSON.parse(row.attributeList)
  128. attributeList.forEach((e, index) => {
  129. data.push({
  130. label: e.attributeName,
  131. prop: propName[index],
  132. span: 12,
  133. type: "select",
  134. dicData: e.attributeData,
  135. props: {
  136. label: "dictValue",
  137. value: "dictValue"
  138. }
  139. })
  140. });
  141. this.option.column = data
  142. }
  143. this.form = {
  144. remarksOne: row.remarksOne,
  145. customTwo: row.customTwo,
  146. customThree: row.customThree,
  147. customFour: row.customFour,
  148. customFive: row.customFive,
  149. customSix: row.customSix,
  150. customSeven: row.customSeven,
  151. customEight: row.customEight,
  152. customNine: row.customNine,
  153. customTen: row.customTen,
  154. };
  155. this.fromIndex = index;
  156. this.visible = true;
  157. },
  158. closed() {
  159. this.form = this.$options.data().form;
  160. console.log(this.form)
  161. this.fromIndex = null;
  162. },
  163. importData() {
  164. const data = {
  165. remarksOne: this.form.remarksOne,
  166. customTwo: this.form.customTwo,
  167. customThree: this.form.customThree,
  168. customFour: this.form.customFour,
  169. customFive: this.form.customFive,
  170. customSix: this.form.customSix,
  171. customSeven: this.form.customSeven,
  172. customEight: this.form.customEight,
  173. customNine: this.form.customNine,
  174. customTen: this.form.customTen,
  175. };
  176. this.$emit("importProperty", data, this.fromIndex);
  177. this.visible = false;
  178. },
  179. // setting() {
  180. // this.labelShow = true;
  181. // this.labelForm = {
  182. // label1: this.option.column[0].label,
  183. // label2: this.option.column[1].label,
  184. // label3: this.option.column[2].label,
  185. // label4: this.option.column[3].label,
  186. // label5: this.option.column[4].label
  187. // };
  188. // },
  189. // saveSetting() {
  190. // this.option.column[0].label = this.labelForm.label1;
  191. // this.option.column[1].label = this.labelForm.label2;
  192. // this.option.column[2].label = this.labelForm.label3;
  193. // this.option.column[3].label = this.labelForm.label4;
  194. // this.option.column[4].label = this.labelForm.label5;
  195. // this.saveColumn();
  196. // },
  197. // async saveColumn() {
  198. // const inSave = await this.saveColumnData(
  199. // this.getColumnName(52),
  200. // this.option
  201. // );
  202. // if (inSave) {
  203. // this.$message.success("保存成功");
  204. // this.labelShow = false;
  205. // }
  206. // }
  207. }
  208. };
  209. </script>
  210. <style lang="scss" scoped>
  211. .settingBut {
  212. display: flex;
  213. justify-content: flex-end;
  214. }
  215. </style>