guhongwei 2 anos atrás
pai
commit
305d386cb1
1 arquivos alterados com 112 adições e 3 exclusões
  1. 112 3
      src/views/app/basic/index.vue

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

@@ -29,6 +29,18 @@
                 </template>
               </data-table>
             </template>
+            <template #account_btn="{ item }">
+              <el-button type="primary" size="small" @click="abtnAdd()">添加</el-button>
+              <data-table :fields="acfields" :opera="acopera" :data="form[item.model]" :usePage="false" @edit="acbtnEdit" @del="acbtnDel">
+                <template #img_url="{ row, item }">
+                  <el-image
+                    class="image"
+                    @click="imgView(row[item.model])"
+                    :src="row[item.model] && row[item.model].length > 0 ? row[item.model][0].uri : ''"
+                  ></el-image>
+                </template>
+              </data-table>
+            </template>
           </data-form>
         </el-col>
       </el-col>
@@ -51,6 +63,22 @@
             </template>
           </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">
+            <template #img_url="{ item }">
+              <c-upload v-model="acbtnForm[item.model]" url="/files/projectadmin/imgurl/upload" :limit="1"></c-upload>
+            </template>
+            <template #is_jump>
+              <el-option v-for="i in isnoList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #type>
+              <el-option v-for="i in jumptypeLsit" :key="i._id" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #is_use>
+              <el-option v-for="i in isuseList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </data-form>
+        </el-col>
       </template>
     </c-dialog>
   </div>
@@ -68,11 +96,12 @@ export default {
   components: {},
   data: function () {
     return {
-      form: { logo_url: [], foot_menus: [] },
+      form: { logo_url: [], foot_menus: [], account_btn: [] },
       fields: [
         { label: '公司名称', model: 'name' },
         { label: '公司logo', model: 'logo_url', custom: true },
         { label: '底部菜单', model: 'foot_menus', custom: true },
+        { label: '账号功能按钮', model: 'account_btn', custom: true },
       ],
       // 底部菜单
       mfields: [
@@ -104,8 +133,6 @@ export default {
         { label: '修改', method: 'edit' },
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
       ],
-      // 弹框
-      dialog: { title: '底部菜单', show: false, type: '1' },
       otherFields: [
         { label: '名称', model: 'name' },
         { label: '跳转路径', model: 'route' },
@@ -116,10 +143,62 @@ export default {
         { label: '选中', model: 'active', custom: true },
       ],
       otherForm: { normal: [], active: [] },
+      // 账号功能按钮
+      acfields: [
+        { label: '名称', model: 'name' },
+        { label: '图片', model: 'img_url', custom: true },
+        {
+          label: '是否跳转',
+          model: 'is_jump',
+          format: (i) => {
+            let data = this.isnoList.find((r) => r.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+        {
+          label: '跳转类型',
+          model: 'type',
+          format: (i) => {
+            let data = this.jumptypeLsit.find((r) => r.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+        { label: '跳转路径', model: 'route' },
+        { label: '排序', model: 'sort' },
+        {
+          label: '是否启用',
+          model: 'is_use',
+          format: (i) => {
+            let data = this.isuseList.find((r) => r.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+      ],
+      acopera: [
+        { label: '修改', method: 'edit' },
+        { label: '删除', method: 'del', confirm: true, type: 'danger' },
+      ],
+      acbtnFields: [
+        { 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' },
+      ],
+      acbtnForm: { img_url: [] },
+      // 弹框
+      dialog: { title: '底部菜单', show: false, type: '1' },
       // 字典
       isuseList: [],
       // 跳转类型
       jumptypeLsit: [],
+      // 是否
+      isnoList: [],
     };
   },
   async created() {
@@ -135,6 +214,7 @@ export default {
         let data = res.data;
         if (!data.logo_url) data.logo_url = [];
         if (!data.foot_menus) data.foot_menus = [];
+        if (!data.account_btn) data.account_btn = [];
         this.$set(this, `form`, data);
       }
     },
@@ -168,9 +248,32 @@ export default {
       }
       this.toClose();
     },
+    // 账号功能按钮
+    abtnAdd() {
+      this.dialog = { title: '账号功能按钮', show: true, type: '2' };
+    },
+    // 修改
+    acbtnEdit({ data }) {
+      this.$set(this, `acbtnForm`, data);
+      this.dialog = { title: '账号功能按钮', show: true, type: '2' };
+    },
+    // 删除
+    acbtnDel({ data }) {
+      let account_btn = this.form.account_btn.filter((i) => i.id != data.id);
+      this.$set(this.form, `account_btn`, account_btn);
+    },
+    acbtnSave({ data }) {
+      if (!data.id) {
+        data.id = moment().valueOf();
+        this.form.account_btn = [...this.form.account_btn, data];
+      } else {
+      }
+      this.toClose();
+    },
     // 关闭弹框
     toClose() {
       this.otherForm = {};
+      this.acbtnForm = {};
       this.dialog = { title: '底部菜单', show: false, type: '1' };
     },
     // 字典
@@ -184,8 +287,14 @@ export default {
       // 跳转类型
       res = await this.dQuery({ type: 'jump_type' });
       if (this.$checkRes(res)) {
+        console.log(res.data);
         this.$set(this, `jumptypeLsit`, res.data);
       }
+      // 是否
+      res = await this.dQuery({ type: 'is_no' });
+      if (this.$checkRes(res)) {
+        this.$set(this, `isnoList`, res.data);
+      }
     },
     // 预览图片
     imgView(e) {