傅豪杰 1 年之前
父節點
當前提交
505c858a65

+ 36 - 0
ruoyi-ui/src/baseComponents/f-color/index.vue

@@ -0,0 +1,36 @@
+<!--
+ * @Author: fhj
+ * @LastEditors: 傅豪杰 18516149270@163.com
+ * @Description:
+-->
+<template>
+    <el-color-picker v-model="currentValue" show-alpha v-bind="$attrs"  @change="handleChange"></el-color-picker>
+</template>
+
+<script>
+import formMixins from '../../mixins/formMixins.js'
+export default {
+  name: 'FColor',
+  inheritAttrs: false,
+  mixins: [formMixins],
+  props: {
+    // 绑定的数据
+    value: {},
+  },
+  computed:{
+    currentValue: {
+      get() {
+        return this.value || []
+      },
+      set(val) {
+        this.$emit('input', val)
+      }
+    },
+  },
+  methods:{
+    handleChange(val) {
+      this.$emit('change', val)
+    }
+  }
+};
+</script>

+ 33 - 30
ruoyi-ui/src/views/template/addTemplate/blocks/detailDialog.vue

@@ -156,10 +156,10 @@ export default {
       },
       fromDataConfig: [],
       // 表单验证
-      fromRules:{
-        name:[{required: true, message: '请输入模版名称'}],
-        status:[{required: true, message: '请选择状态'}],
-        baseId:[{required: true, message: '请选择基础库'}],
+      fromRules: {
+        name: [{required: true, message: '请输入模版名称'}],
+        status: [{required: true, message: '请选择状态'}],
+        baseId: [{required: true, message: '请选择基础库'}],
       },
       // 表单key
       fromKey:0,
@@ -185,30 +185,33 @@ export default {
   },
   methods: {
     // 显示弹窗
-    show(){
+    show() {
       this.fromDataConfig = formConfig.call(this)
       this.$refs.dialog.show();
     },
     // 初始化表单数据
-    initFormData(fromData){
+    initFormData(fromData) {
       this.fromData = {
-          content:'',
-          ...fromData
+        content:'',
+        ...fromData
       }
       this.fromKey++;
     },
     // 初始化按钮表单数据
-    initBtnFormData(fromData){
+    initBtnFormData(fromData) {
       this.btnData = {
-          content:'',
-          ...fromData
+        content: '',
+        ...fromData
       }
-      if (Object.keys(this.btnData).length == 0) return this.btnFromKey = 0
-      this.btnFromKey++;
+      if (Object.keys(this.btnData).length === 0) {
+        this.btnFromKey = 0
+        return
+      } 
+      this.btnFromKey++
     },
     // 详情
-    async handleInitData(){
-      const {dialogType,rowData} = this;
+    async handleInitData() {
+      const {dialogType,rowData} = this
       if(dialogType === 'add') {
         this.pageArray = []
         this.initFormData({})
@@ -216,7 +219,7 @@ export default {
       }
       // 调接口获取详情
       const res = await addTemplateApi.configDetail({ id: rowData.id });
-      if(res.code != 200) return this.initFormData({})
+      if (res.code !== 200) return this.initFormData({})
       const from = { ...res.data, baseId: res.data.baseId.toString() }
       this.pageArray = JSON.parse(res.data.components).map((item, index) => ({
         ...item,
@@ -230,40 +233,40 @@ export default {
       this.initFormData(from);
     },
     // 关闭之前回调.
-    async handleBeforeClose(type){
-      if(type !='ok') {
+    async handleBeforeClose(type) {
+      if (type !='ok') {
         this.btnFromShow = false
         return true
       };
       const validate = await this.$refs.ruleForm.validate();
 
-      if(!validate) return false;
+      if (!validate) return false;
       const params = {
-          ...this.fromData,
-          components: JSON.stringify(this.pageArray),
-          baseId: Number(this.fromData.baseId)
+        ...this.fromData,
+        components: JSON.stringify(this.pageArray),
+        baseId: Number(this.fromData.baseId)
       }
       //  调接口更新数据
       const res = await addTemplateApi.configAddOrEdit(params);
-      if(res.code !=200){
-          this.$modal.msgError(res.msg);
-          return false;
+      if (res.code !== 200) {
+        this.$modal.msgError(res.msg)
+        return false
       }
 
       this.$emit('updateList')
       this.initFormData({})
       this.btnFromShow = false
-      return true;
+      return true
     },
     addBtn(item) {
       this.pageArray.push({ ...item, i: this.pageArrayCount })
     },
-    removeBtn(index){
+    removeBtn(index) {
       this.pageArray.splice(index, 1)
     },
     showSeting(item, index) {
       console.log(item, 'xxxxxxxxxxx')
-      if (Object.keys(item).length == 0) return 
+      if (Object.keys(item).length === 0) return 
       this.currentCpn = index
       const from = { ...item }
       this.initBtnFormData(from)
@@ -274,9 +277,9 @@ export default {
       this.btnFromShow = false
     }
   },
-  computed:{
+  computed: {
     pageArrayCount() {
-      return this.pageArray.length
+      return this.pageArray.length;
     },
     cpnArray() {
       return this.allButton.map((item, index) => ({ x: 0, y: index*2, w: 2, h: 2, i: index, text: item.name, ...item }))