yangfeng
2023-07-21 51ce81df657be1e2eb5cfd8f21ebe731d8d3444b
后台配置相关
2个文件已添加
2个文件已修改
121 ■■■■ 已修改文件
src/api/backgroundConfig/memberManage.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/backgroundConfig/rolePermssion.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/backgroundConfig/rolePermssion/AddRolePermssionDialog.vue 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/backgroundConfig/rolePermssion/index.vue 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/backgroundConfig/memberManage.js
New file
@@ -0,0 +1,10 @@
import request from "@/common/untils/request.js"
// 新增用户(注册账号)
export function registerUser(data) {
  return request({
    url: "/api/user/register",
    method: "post",
    data
  })
}
src/api/backgroundConfig/rolePermssion.js
New file
@@ -0,0 +1,19 @@
import request from "@/common/untils/request.js"
// 创建角色
export function addAuthority(data) {
  return request({
    url: "/api/authority/add",
    method: "post",
    data
  })
}
// 设置角色菜单
export function setMenuAuthority(data) {
  return request({
    url: "/api/authority/setMenuAuthority",
    method: "post",
    data
  })
}
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) {
src/views/backgroundConfig/rolePermssion/index.vue
@@ -56,13 +56,13 @@
        tableInfomation: [
          {
            number: "1",
            owner: "总经理",
            authorityName: "总经理",
            notes: ""
          }
        ],
        tableColumn: [
          { label: "#", prop: "number", width: 80 },
          { label: "权限名称", prop: "owner", width: 160 },
          { label: "权限名称", prop: "authorityName", width: 160 },
          { label: "备注", prop: "notes" }
        ]
      }
@@ -76,34 +76,14 @@
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.editConfig.infomation = {
        customName: "",
        documentNumber: "ZDYBD01-3",
        owner: "",
        contractStatus: "",
        salesQuotation: "",
        approvalWorkflow: "",
        approvalSteps: "",
        approvalPerson: "",
        approvalOpinion: ""
      }
      this.editConfig.infomation = {}
    },
    // 编辑
    handleClick(row) {
      console.log(row)
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      this.editConfig.infomation = {
        customName: "",
        documentNumber: "TKD20230521-12",
        owner: "",
        contractStatus: "",
        salesQuotation: "",
        approvalWorkflow: "",
        approvalSteps: "",
        approvalPerson: "",
        approvalOpinion: ""
      }
      this.editConfig.infomation = { ...row }
    }
  }
}