yangfeng
2023-07-21 51ce81df657be1e2eb5cfd8f21ebe731d8d3444b
src/views/backgroundConfig/rolePermssion/AddRolePermssionDialog.vue
@@ -21,8 +21,8 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="12">
                <el-form-item label="权限名称" prop="owner">
                  <el-input v-model="editConfig.infomation.owner"></el-input>
                <el-form-item label="权限名称" prop="authorityName">
                  <el-input v-model="editConfig.infomation.authorityName"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
@@ -90,7 +90,7 @@
          </div>
        </div>
        <div class="btn">
          <el-button type="primary" size="small" @click="editConfig.visible = false">保 存</el-button>
          <el-button type="primary" size="small" @click="saveClick('form')">保 存</el-button>
          <el-button size="small" @click="editConfig.visible = false">取 消</el-button>
        </div>
      </div>
@@ -99,6 +99,7 @@
</template>
<script>
import { addAuthority } from "@/api/backgroundConfig/rolePermssion" // setMenuAuthority
export default {
  name: "AddRolePermissionDialog",
  props: {
@@ -108,10 +109,7 @@
        return {
          visible: false,
          title: "新建",
          infomation: {
            owner: "",
            notes: ""
          }
          infomation: {}
        }
      }
    }
@@ -141,7 +139,7 @@
      dialogWidth: "60%",
      editConfig: this.editCommonConfig,
      rules: {
        owner: [{ required: true, message: "请输入", trigger: "blur" }]
        authorityName: [{ required: true, message: "请输入", trigger: "blur" }]
      },
      moduleSelTitle: "全部",
      tableData: [],
@@ -159,6 +157,52 @@
  methods: {
    handleClose() {
      this.editConfig.visible = false
    },
    saveClick(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log(this.editConfig.infomation)
          if (this.editConfig.title === "新建") {
            addAuthority({
              authorityName: this.editConfig.infomation.authorityName,
              casbinInfos: []
            })
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
                    message: "添加成功",
                    type: "success"
                  })
                  this.$parent.getData()
                }
              })
              .catch((err) => {
                console.log(err)
              })
          } else {
            // getUpdateClient(params)
            //   .then((res) => {
            //     console.log(res)
            //     this.editConfig.visible = false
            //     if (res.code === 200) {
            //       this.$message({
            //         message: "编辑成功",
            //         type: "success"
            //       })
            //       this.$parent.getData()
            //     }
            //   })
            //   .catch((err) => {
            //     console.log(err)
            //   })
          }
        } else {
          console.log("error submit")
          return false
        }
      })
    },
    // 模块选择
    moduleSelectClick(value) {
@@ -207,7 +251,7 @@
        this.tableData = []
      }
    },
    // 模块全选
    // 模块全选 / 取消全选
    selAllChange(row) {
      if (row.checked) {
        let arr = []
@@ -215,6 +259,8 @@
          arr.push(ele.name)
        })
        row.checkedList = arr
      } else {
        row.checkedList = []
      }
    },
    handleCheckedChange(value, row) {