<template>
  <div class="fullHeight">
    <div class="searchBox whiteBlock">
      <el-select size="medium" style="margin-right: 20px"
        v-model="searchStyleType"
        :placeholder="$t('message.alarmValueSet.placeholder_select')" @change="refresh"
      >
        <el-option :label="item" :value="index+1" v-for="(item,index) in styleTypeArr" :key="index"> </el-option>
      </el-select>
      <el-select size="medium" style="margin-right: 20px"
        v-model="searchModuleType"
        :placeholder="$t('message.alarmValueSet.placeholder_select')" @change="refresh"
      >
        <el-option :label="item" :value="index+1" v-for="(item,index) in moudleTypeArr" :key="index"> </el-option>
      </el-select>
      <!-- <el-button type="primary" plain size="medium" @click="refresh">查询</el-button> -->
      <el-button type="primary" size="medium" @click="add">新增</el-button>
    </div>
    <div class="table_wrap whiteBlock">
    <el-table class="tables" :data="List" height="700">
      <el-table-column
        prop="labelName"
        label="标签名称"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="moduleName"
        label="模块名称"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="appName"
        label="app端模块名称"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="plugin"
        label="app端组件名"
        align="center"
      ></el-table-column>
      <el-table-column prop="modulePath" label="模块路径" align="center">
      </el-table-column>
      <el-table-column
        prop="moduleIcon"
        align="center"
        label="解锁模块图标"
      ></el-table-column>
      <el-table-column
        prop="moduleIcon2"
        align="center"
        label="未解锁模块图标"
      ></el-table-column>
      <el-table-column prop="moduleType" label="模块类型" align="center">
        <template slot-scope="scope">{{
          moudleTypeArr[scope.row.moduleType-1]
        }}</template>
      </el-table-column>
      <el-table-column prop="moduleEquipment" label="是否在设备中台显示" align="center">
        <template slot-scope="scope">{{
          scope.row.moduleEquipment === 1 ? "是" : ""
        }}</template>
      </el-table-column>
      <el-table-column prop="appShow" label="是否app端显示" align="center">
        <template slot-scope="scope">{{
          scope.row.appShow === 1 ? "是" : ""
        }}</template>
      </el-table-column>
      <el-table-column
        :label="$t('message.alarmValueSet.operation')"
        align="center" width="300"
      >
        <template slot-scope="scope">
          <div class="tableBtns">
             <!-- v-show="scope.row.moduleType==2||scope.row.moduleType==3" -->
              <div class="operationText" @click="addEditForm=scope.row;menuManageDialog=true;getMenuList()">
                  菜单管理
              </div>
            <div @click="edit(scope.row)" class="operationText">
              <img
                src="@/assets/images/icon-edit.png"
                width="15px"
                height="15px"
              />
              <span>{{ $t("message.alarmValueSet.edit") }}</span>
            </div>
            <div @click="deleteDev(scope.row)" class="operationText">
              <img
                src="@/assets/images/icon-delete.png"
                width="15px"
                height="15px"
              />
              <span>删除</span>
            </div>
          </div>
        </template>
      </el-table-column>
    </el-table>
    </div>
    <el-dialog
      @close="close"
      :modal-append-to-body="false"
      :title="Popup_title[Popup.type]"
      :visible.sync="Popup.show"
      width="667px"
    >
      <div class="dialog_content">
        <vue-scroll style="height: 680px">
        <el-form
          v-if="Popup.type === 'add' || Popup.type === 'edit'"
          size="medium"
          :model="addEditForm"
          ref="addEditForm"
          label-width="120px"
          class="dialogFormBox"
          :rules="formRules"
        >
        <el-form-item label="标签名称" prop="labelName">
            <el-input
              v-model="addEditForm.labelName"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="标签排序" prop="labelSortNum">
            <el-input
              v-model="addEditForm.labelSortNum"
              placeholder="相同的标签需要序号一致"
            ></el-input>
          </el-form-item>
          <el-form-item label="模块名称" prop="moduleName">
            <el-input
              v-model="addEditForm.moduleName"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          
          <el-form-item label="解锁模块图标" prop="moduleIcon">
            <el-input
              v-model="addEditForm.moduleIcon"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="解锁模块图标2" prop="bigModuleIcon">
            <el-input
              v-model="addEditForm.bigModuleIcon"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="未解锁模块图标" prop="moduleIcon2">
            <el-input
              v-model="addEditForm.moduleIcon2"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="未解锁模块图标2" prop="disableModuleIcon">
            <el-input
              v-model="addEditForm.disableModuleIcon"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="模块路径" prop="modulePath">
            <el-input
              v-model="addEditForm.modulePath"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="模块类型" prop="moduleType">
            <el-select
              v-model="addEditForm.moduleType"
              :placeholder="$t('message.alarmValueSet.placeholder_select')"
            >
              <el-option :label="item" :value="index+1" v-for="(item,index) in moudleTypeArr" :key="index"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="addEditForm.moduleType==2" label="项目模块类型" prop="moduleEquipment">
            <el-select
              v-model="addEditForm.moduleEquipment"
              :placeholder="$t('message.alarmValueSet.placeholder_select')"
            >
              <el-option label="设备中台" :value="1"> </el-option>
              <el-option label="项目后台" :value="0"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="app端模块名称" prop="appName">
            <el-input
              v-model="addEditForm.appName"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="app端组件名" prop="plugin">
            <el-input
              v-model="addEditForm.plugin"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="是否在app展示" prop="appShow">
            <el-select
              v-model="addEditForm.appShow"
              :placeholder="$t('message.alarmValueSet.placeholder_select')"
            >
              <el-option label="是" :value="1"> </el-option>
              <el-option label="否" :value="2"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="模块描述" prop="moduleDesc">
            <el-input
              v-model="addEditForm.moduleDesc"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
        </el-form>
        </vue-scroll>
        <div class="dialog-footer">
            <el-button
              class="cancleBtn"
              @click="Popup.show = false"
              icon="el-icon-circle-close"
              size="medium"
              >{{ $t("message.alarmValueSet.cancel") }}
            </el-button>
            <el-button
              type="primary"
              icon="el-icon-circle-check"
              @click="submit"
              size="medium"
              >{{ $t("message.alarmValueSet.save") }}
            </el-button>
          </div>
      </div>
    </el-dialog>
    <el-dialog
      title="菜单管理"
      :modal-append-to-body="false"
      :visible.sync="menuManageDialog"
      width="1167px"
    >
    <el-button type="primary" size="medium" @click="addMenu">新增</el-button>
    <el-table class="tables" :data="menuList" height="500" default-expand-all row-key="menuId" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
      <el-table-column
        prop="menuName"
        label="菜单名称" width="200"
      ></el-table-column>
      <el-table-column prop="path" label="菜单路径" align="center">
      </el-table-column>
      <!-- <el-table-column
        prop="icon"
        align="center"
        label="菜单图标"
      ></el-table-column> -->
      <el-table-column prop="status" width="80" label="状态" align="center">
        <template slot-scope="scope">{{
          scope.row.status === 1 ? "启用" : "禁用"
        }}</template>
      </el-table-column>
      <el-table-column
        :label="$t('message.alarmValueSet.operation')"
        align="center" width="250"
      >
        <template slot-scope="scope">
          <div class="tableBtns">
            <div class="operationText" @click="btnManageDialog=true;addEditMenuForm=scope.row;getBtnList()">按钮管理</div>
            <div @click="editMenu(scope.row)" class="operationText">
              <img
                src="@/assets/images/icon-edit.png"
                width="15px"
                height="15px"
              />
              <span>{{ $t("message.alarmValueSet.edit") }}</span>
            </div>
            <div @click="deleteMenu(scope.row)" class="operationText">
              <img
                src="@/assets/images/icon-delete.png"
                width="15px"
                height="15px"
              />
              <span>删除</span>
            </div>
          </div>
        </template>
      </el-table-column>
    </el-table>
    </el-dialog>
    <el-dialog
      @close="closeMenu"
      :modal-append-to-body="false"
      :title="Popup_title_menu[PopupMenu.type]"
      :visible.sync="PopupMenu.show"
      width="667px"
    >
      <div class="dialog_content">
        <el-form
          size="medium"
          :model="addEditMenuForm"
          ref="addEditMenuForm"
          label-width="120px"
          class="dialogFormBox"
          :rules="menuFormRules"
        >
        <el-form-item label="所属模块" prop="moduleId">
            <el-select
              v-model="addEditMenuForm.moduleId"
              :placeholder="$t('message.alarmValueSet.placeholder_select')"
            >
              <el-option :label="item.moduleName" :value="item.moduleId" v-for="(item,index) in List" :key="index"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="父级菜单" prop="parentId">
            <el-select clearable
              v-model="addEditMenuForm.parentId"
              :placeholder="$t('message.alarmValueSet.placeholder_select')" filterable
            >
              <el-option :label="item.menuName" :value="item.menuId" v-for="(item,index) in allMenuList" :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="菜单名称" prop="menuName">
            <el-input
              v-model="addEditMenuForm.menuName"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="菜单图标" prop="icon">
            <el-input
              v-model="addEditMenuForm.icon"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="菜单路径" prop="path">
            <el-input
              v-model="addEditMenuForm.path"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="企业菜单路径" prop="companyPath">
            <el-input
              v-model="addEditMenuForm.companyPath"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="app端菜单路径" prop="appPath">
            <el-input
              v-model="addEditMenuForm.appPath"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="菜单类型" prop="menuEquipment">
            <el-select
              v-model="addEditMenuForm.menuEquipment"
              :placeholder="$t('message.alarmValueSet.placeholder_select')"
            >
              <el-option label="设备中台页面" :value="1"> </el-option>
              <el-option label="项目后台页面" :value="0"> </el-option>
              <el-option label="app端页面" :value="2"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="状态" prop="status">
            <el-select
              v-model="addEditMenuForm.status"
              :placeholder="$t('message.alarmValueSet.placeholder_select')"
            >
              <el-option label="启用" :value="1"> </el-option>
              <el-option label="禁用" :value="0"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="打开方式" prop="target">
            <el-select
              v-model="addEditMenuForm.target"
              :placeholder="$t('message.alarmValueSet.placeholder_select')"
            >
              <el-option label="当前窗口" value="_self"> </el-option>
              <el-option label="新窗口" value="_blank"> </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="优先级" prop="priority">
            <el-input
              v-model="addEditMenuForm.priority"
              placeholder="越小越靠前"
            ></el-input>
          </el-form-item>
          <el-form-item label="描述" prop="menuDesc">
            <el-input
              v-model="addEditMenuForm.menuDesc"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <div class="dialog-footer">
            <el-button
              class="cancleBtn"
              @click="PopupMenu.show = false"
              icon="el-icon-circle-close"
              size="medium"
              >{{ $t("message.alarmValueSet.cancel") }}
            </el-button>
            <el-button
              type="primary"
              icon="el-icon-circle-check"
              @click="submitMenuData"
              size="medium"
              >{{ $t("message.alarmValueSet.save") }}
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
    <el-dialog
      title="按钮管理"
      :modal-append-to-body="false"
      :visible.sync="btnManageDialog"
      width="667px"
    >
    <el-button type="primary" size="medium" @click="addBtn">新增</el-button>
    <el-table class="tables" :data="btnList" height="500">
      <el-table-column
        prop="actionName"
        label="按钮名称"
        align="center"
      ></el-table-column>
      <el-table-column prop="actionCode" label="按钮标识" align="center">
      </el-table-column>
      <el-table-column prop="status" width="80" label="状态" align="center">
        <template slot-scope="scope">{{
          scope.row.status === 1 ? "启用" : "禁用"
        }}</template>
      </el-table-column>
      <el-table-column
        :label="$t('message.alarmValueSet.operation')"
        align="center" width="200"
      >
        <template slot-scope="scope">
          <div class="tableBtns">
            <div @click="editBtn(scope.row)" class="operationText">
              <img
                src="@/assets/images/icon-edit.png"
                width="15px"
                height="15px"
              />
              <span>{{ $t("message.alarmValueSet.edit") }}</span>
            </div>
            <div @click="deleteBtn(scope.row)" class="operationText">
              <img
                src="@/assets/images/icon-delete.png"
                width="15px"
                height="15px"
              />
              <span>删除</span>
            </div>
          </div>
        </template>
      </el-table-column>
    </el-table>
    </el-dialog>
    <el-dialog
      :modal-append-to-body="false"
      @close="closeBtn"
      :title="Popup_title_btn[PopupBtn.type]"
      :visible.sync="PopupBtn.show"
      width="667px"
    >
      <div class="dialog_content">
        <el-form
          size="medium"
          :model="addEditBtnForm"
          ref="addEditBtnForm"
          label-width="120px"
          class="dialogFormBox"
          :rules="btnFormRules"
        >
          <el-form-item label="按钮名称" prop="actionName">
            <el-input
              v-model="addEditBtnForm.actionName"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="按钮标识" prop="actionCode">
            <el-input
              v-model="addEditBtnForm.actionCode"
              :placeholder="$t('message.alarmValueSet.placeholder')"
            ></el-input>
          </el-form-item>
          <el-form-item label="状态" prop="status">
            <el-select
              v-model="addEditBtnForm.status"
              :placeholder="$t('message.alarmValueSet.placeholder_select')"
            >
              <el-option label="启用" :value="1"> </el-option>
              <el-option label="禁用" :value="0"> </el-option>
            </el-select>
          </el-form-item>
          <div class="dialog-footer">
            <el-button
              class="cancleBtn"
              @click="PopupBtn.show = false"
              icon="el-icon-circle-close"
              size="medium"
              >{{ $t("message.alarmValueSet.cancel") }}
            </el-button>
            <el-button
              type="primary"
              icon="el-icon-circle-check"
              @click="submitBtnData"
              size="medium"
              >{{ $t("message.alarmValueSet.save") }}
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {
  addModuleApi,
  editModuleApi,
  deleteModuleApi,
  getAllModuleApi,
  addMenuApi,
  deleteMenuApi,
  editMenuApi,
  getAllMenuApi,
  addBtnApi,
  deleteBtnApi,
  editBtnApi,
  getAllBtnApi,getAllMenuByGroupApi
} from "@/assets/js/api/jxjadmin";

export default {
  mounted() {
    this.getList();
  },
  data() {
    return {
        Popup_title: {
            edit: '编辑模块',
            add: '新增模块',
        },
        Popup_title_menu: {
            edit: '编辑菜单',
            add: '新增菜单',
        },
        Popup_title_btn: {
            edit: '编辑按钮',
            add: '新增按钮',
        },
      addEditForm: {
        moduleIcon: "",
        moduleName: "",
        modulePath: "",
        moduleDesc: "",
        moduleIcon2:"",
        moduleType: 1,
        plugin:'',
        moduleEquipment:"",
        appName:'',
        labelName:'',
        labelSortNum:0,
        disableModuleIcon: "",
        bigModuleIcon: ""
      },
      formRules: {
        // modulePath: [
        //   {
        //     required: true,
        //     message: this.$t("message.personnelPosition.required"),
        //     trigger: "blur",
        //   },
        // ],
        moduleName: [
          {
            required: true,
            message: this.$t("message.personnelPosition.required"),
            trigger: "blur",
          },
        ],
      },
      List: [],
      Popup: {
        type: "add",
        show: false,
      },
      menuManageDialog:false,
      menuList:[],
      addEditMenuForm:{
          icon:"",
          menuDesc:"",
          menuName:"",
          moduleId:"",
          parentId:"",
          path:"",
          appPath: "",
          priority:"",
          scheme:"",
          status: 1,
          target:'_self',
          menuEquipment:"",
          companyPath: ''
      },
      menuFormRules: {
        menuName: [
          {
            required: true,
            message: this.$t("message.personnelPosition.required"),
            trigger: "blur",
          },
        ],
      },
      PopupMenu: {
        type: "add",
        show: false,
      },
      PopupBtn: {
        type: "add",
        show: false,
      },
      checkOperateArr:[],
      btnManageDialog:false,
      addEditBtnForm:{
        menuId:"",
        actionCode:"",
        actionName:"",
        status:1
      },
      btnFormRules: {
        actionCode: [
          {
            required: true,
            message: this.$t("message.personnelPosition.required"),
            trigger: "blur",
          },
        ],
        actionName: [
          {
            required: true,
            message: this.$t("message.personnelPosition.required"),
            trigger: "blur",
          },
        ],
      },
      btnList:[],
      moudleTypeArr:['企业模块','项目后台','企业后台','项目看板'],
      searchModuleType: 2,
      styleTypeArr:['普通项目级版本','精益建造版本','衢州版','三江版'],
      searchStyleType:1,
      allMenuList:[]
    };
  },
  methods: {

    handle(type, show) {
      //打开弹窗前的统一处理
      this.Popup = {
        type: type,
        show: show,
      };
    },
    handleMenu(type, show) {
      //打开弹窗前的统一处理
      this.PopupMenu = {
        type: type,
        show: show,
      };
      getAllMenuApi({moduleId:this.addEditForm.moduleId}).then((result) => {
        if (result.success) {
          this.allMenuList = result.result;
        //   console.log("列表", result);
        }
      });
    },
    handleBtn(type, show) {
      //打开弹窗前的统一处理
      this.PopupBtn = {
        type: type,
        show: show,
      };
    },
    add() {
      this.addEditForm.moduleType=this.searchModuleType
      this.handle("add", true);
    },
    addMenu() {
      this.addEditMenuForm.moduleId=this.addEditForm.moduleId
      this.handleMenu("add", true);
    },
    addBtn() {
      this.handleBtn("add", true);
    },
    edit(obj) {
    //   console.log("编辑", obj);
      this.addEditForm = JSON.parse(JSON.stringify(obj));
      this.handle("edit", true);
    },
    editMenu(obj) {
    //   console.log("编辑", obj);
      this.addEditMenuForm = JSON.parse(JSON.stringify(obj));
      if(obj.operateCode){
        if(obj.operateCode.indexOf(',')!=-1){
          this.checkOperateArr = obj.operateCode.split(',')
        }else{
          this.checkOperateArr = [obj.operateCode]
        }
      }else{
        this.checkOperateArr=[]
      }
      
      this.handleMenu("edit", true);
    },
    editBtn(obj) {
    //   console.log("编辑", obj);
      this.addEditBtnForm = JSON.parse(JSON.stringify(obj));
      this.handleBtn("edit", true);
    },
    deleteDev(obj) {
      console.log("删除", obj);
      this.$confirm(
        this.$t("message.personnelPosition.beaconManage.table.confirmText") +
          "【" +
          obj.moduleName +
          "】?",
        this.$t("message.personnelPosition.beaconManage.table.Tips"),
        {
          confirmButtonText: this.$t(
            "message.personnelPosition.confirmButtonText"
          ),
          cancelButtonText: this.$t(
            "message.personnelPosition.cancelButtonText"
          ),
          type: "warning",
        }
      )
        .then(() => {
          deleteModuleApi({ moduleId: obj.moduleId }).then((result) => {
            if (result.success) {
              this.$message.success(result.message);
              this.getList();
            }
          });
        })
        .catch(() => {});
    },
    deleteMenu(obj) {
      console.log("删除", obj);
      this.$confirm(
        this.$t("message.personnelPosition.beaconManage.table.confirmText") +
          "【" +
          obj.menuName +
          "】?",
        this.$t("message.personnelPosition.beaconManage.table.Tips"),
        {
          confirmButtonText: this.$t(
            "message.personnelPosition.confirmButtonText"
          ),
          cancelButtonText: this.$t(
            "message.personnelPosition.cancelButtonText"
          ),
          type: "warning",
        }
      )
        .then(() => {
          deleteMenuApi({ menuId: obj.menuId }).then((result) => {
            if (result.success) {
              this.$message.success(result.message);
              this.getMenuList();
            }
          });
        })
        .catch(() => {});
    },
    deleteBtn(obj) {
      console.log("删除", obj);
      this.$confirm(
        this.$t("message.personnelPosition.beaconManage.table.confirmText") +
          "【" +
          obj.actionName +
          "】?",
        this.$t("message.personnelPosition.beaconManage.table.Tips"),
        {
          confirmButtonText: this.$t(
            "message.personnelPosition.confirmButtonText"
          ),
          cancelButtonText: this.$t(
            "message.personnelPosition.cancelButtonText"
          ),
          type: "warning",
        }
      )
        .then(() => {
          deleteBtnApi({ actionId: obj.actionId }).then((result) => {
            if (result.success) {
              this.$message.success(result.message);
              this.getMenuList();
            }
          });
        })
    },
    submit() {
      this.$refs["addEditForm"].validate((valid) => {
        if (valid) {
          let params = this.addEditForm;
          params.styleType=this.searchStyleType
          console.log("params", params);
          console.log("添加信息", this.addEditForm);
          if (this.Popup.type === "add") {
            console.log('添加成功的参数',params)
            addModuleApi(params).then((result) => {
              console.log('添加成功的返回值',result)
              if (result.success) {
                this.$message.success(result.message);
                this.getList();
              }
            });
          } else if (this.Popup.type === "edit") {
            console.log("编辑信息", this.addEditForm);
            editModuleApi(params).then((result) => {
              if (result.success) {
                this.$message.success(result.message);
                this.getList();
              }
            });
          }
          this.Popup.show = false;
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    submitMenuData() {
      this.$refs["addEditMenuForm"].validate((valid) => {
        if (valid) {
          let params = this.addEditMenuForm;
          // params.moduleId=this.addEditForm.moduleId
          params.operateCode = this.checkOperateArr.join(',')
          if (this.PopupMenu.type === "add") {
            addMenuApi(params).then((result) => {
              if (result.success) {
                this.$message.success(result.message);
                this.getMenuList();
              }
            });
          } else if (this.PopupMenu.type === "edit") {
            editMenuApi(params).then((result) => {
              if (result.success) {
                this.$message.success(result.message);
                this.getMenuList();
              }
            });
          }
          this.PopupMenu.show = false;
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    submitBtnData() {
      this.$refs["addEditBtnForm"].validate((valid) => {
        if (valid) {
          let params = this.addEditBtnForm;
          // params.moduleId=this.addEditForm.moduleId
          params.menuId=this.addEditMenuForm.menuId
          if (this.PopupBtn.type === "add") {
            addBtnApi(params).then((result) => {
              if (result.success) {
                this.$message.success(result.message);
                this.getBtnList();
              }
            });
          } else if (this.PopupBtn.type === "edit") {
            editBtnApi(params).then((result) => {
              if (result.success) {
                this.$message.success(result.message);
                this.getBtnList();
              }
            });
          }
          this.PopupBtn.show = false;
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    refresh() {
      this.getList();
    },
    getList() {
      getAllModuleApi({moduleType:this.searchModuleType,styleType:this.searchStyleType}).then((result) => {
        if (result.success) {
          this.List = result.result;
        //   console.log("列表", result);
        }
      });
    },
    getMenuList() {
      getAllMenuByGroupApi({moduleId:this.addEditForm.moduleId}).then((result) => {
        if (result.success) {
          this.menuList = result.result;
        //   console.log("列表", result);
        }
      });
    },
     getBtnList() {
      getAllBtnApi({menuId:this.addEditMenuForm.menuId}).then((result) => {
        if (result.success) {
          this.btnList = result.result;
        //   console.log("列表", result);
        }
      });
    },
    close() {
      this.addEditForm = {
        moduleIcon: "",
        moduleIcon2:"",
        moduleName: "",
        modulePath: "",
        moduleDesc: "",
        moduleType: 1,
        appName:'',
        labelName:'',
        labelSortNum:0,
        disableModuleIcon: "",
        bigModuleIcon: ""
      };
    },
    closeMenu(){
        this.addEditMenuForm={
          icon:"",
          menuDesc:"",
          menuName:"",
          moduleId:"",
          parentId:"",
          path:"",
          appPath: "",
          priority:"",
          scheme:"",
          status: 1,
          companyPath: ''
      }
    },
    closeBtn(){
        this.addEditBtnForm={
          menuId:"",
          actionCode:"",
          actionName:"",
          status:1
      }
    },
  },
};
</script>
<style lang="less">
.tableBtns {
  display: flex;
  justify-content: center;
}

.yj-dialogFormBox {
  width: 462px;
}
</style>