guhongwei 2 年之前
父節點
當前提交
d9ccb0ae03
共有 1 個文件被更改,包括 27 次插入3 次删除
  1. 27 3
      src/views/app/basic/index.vue

+ 27 - 3
src/views/app/basic/index.vue

@@ -64,7 +64,7 @@
           </data-form>
         </el-col>
         <el-col :span="24" class="dialog_two" v-else-if="dialog.type == '2'">
-          <data-form :fields="acbtnFields" :form="acbtnForm" :rules="{}" @save="acbtnSave" :span="24">
+          <data-form :fields="acbtnFields" :form="acbtnForm" :rules="{}" @save="acbtnSave" :span="24" @dataChange="dataChange">
             <template #img_url="{ item }">
               <c-upload v-model="acbtnForm[item.model]" url="/files/projectadmin/imgurl/upload" :limit="1"></c-upload>
             </template>
@@ -166,6 +166,7 @@ export default {
           },
         },
         { label: '跳转路径', model: 'route' },
+        { label: '按钮属性', model: 'nature' },
         { label: '排序', model: 'sort' },
         {
           label: '是否启用',
@@ -185,8 +186,6 @@ export default {
         { label: '名称', model: 'name' },
         { label: '图片', model: 'img_url', custom: true },
         { label: '是否跳转', model: 'is_jump', type: 'select' },
-        { label: '跳转类型', model: 'type', type: 'select' },
-        { label: '跳转路径', model: 'route' },
         { label: '排序', model: 'sort', type: 'number' },
         { label: '是否启用', model: 'is_use', type: 'select' },
       ],
@@ -214,7 +213,17 @@ export default {
         let data = res.data;
         if (!data.logo_url) data.logo_url = [];
         if (!data.foot_menus) data.foot_menus = [];
+        if (data.foot_menus.length > 0) {
+          data.foot_menus = data.foot_menus.sort((a, b) => {
+            return a.sort - b.sort;
+          });
+        }
         if (!data.account_btn) data.account_btn = [];
+        if (data.account_btn.length > 0) {
+          data.account_btn = data.account_btn.sort((a, b) => {
+            return a.sort - b.sort;
+          });
+        }
         this.$set(this, `form`, data);
       }
     },
@@ -255,6 +264,7 @@ export default {
     // 修改
     acbtnEdit({ data }) {
       this.$set(this, `acbtnForm`, data);
+      if (data.is_jump) this.dataChange({ model: 'is_jump', value: data.is_jump });
       this.dialog = { title: '账号功能按钮', show: true, type: '2' };
     },
     // 删除
@@ -262,6 +272,20 @@ export default {
       let account_btn = this.form.account_btn.filter((i) => i.id != data.id);
       this.$set(this.form, `account_btn`, account_btn);
     },
+    dataChange({ model, value }) {
+      if (model == 'is_jump') {
+        if (value == '0') {
+          let other = [{ label: '按钮属性', model: 'nature' }];
+          this.acbtnFields.splice(3, 0, ...other);
+        } else if (value == '1') {
+          let other = [
+            { label: '跳转类型', model: 'type', type: 'select' },
+            { label: '跳转路径', model: 'route' },
+          ];
+          this.acbtnFields.splice(3, 0, ...other);
+        }
+      }
+    },
     acbtnSave({ data }) {
       if (!data.id) {
         data.id = moment().valueOf();