Source/plt-web/plt-web-ui/src/views/system/password/index.vue
@@ -2,18 +2,17 @@
  <basic-container>
    <avue-crud
      ref="passWordCrud"
      v-model="form"
      :data="tableData"
      :option="option"
      :page.sync="page"
      :table-loading="tableLoading"
      v-model="form"
      @on-load="getTableList"
      @refresh-change="handleRefresh"
      @size-change="sizeChange"
      @current-change="currentChange"
      @row-save="rowSaveHandler"
      @row-update="rowUpdateHandler"
      @row-del="rowDeleteHandler"
    >
      <template slot="menu" slot-scope="{ row, index }">
        <el-button
@@ -36,7 +35,7 @@
      <template slot="name" slot-scope="{row}">
        <el-tag>{{row.name}}</el-tag>
        <el-tag>{{ row.name }}</el-tag>
      </template>
      <template slot="defaultFlag" slot-scope="{row}">
        <el-tag v-if="row.defaultFlag" type="success">是</el-tag>
@@ -48,22 +47,23 @@
</template>
<script>
import {refDataGrid} from "@/api/system/password/api"
import {refDataGrid, deleteDep, addDept, updatePasswordStrateg} from "@/api/system/password/api"
import basicOption from "@/util/basic-option";
import {column} from "@/views/system/password/option";
import Vue from "vue";
export default {
  name: "index",
  data(){
    return{
      form:{},
      tableData:[],
      option:{
  data() {
    return {
      form: {},
      tableData: [],
      option: {
        ...basicOption,
        selection:false,
        calcHeight:-60,
        menuWidth:150,
        column:[
        selection: false,
        calcHeight: -60,
        menuWidth: 150,
        editBtn: false,
        delBtn: false,
        column: [
          {
            label: '策略名称',
            prop: 'name',
@@ -90,7 +90,7 @@
                  callback(new Error('请输入密码最小长度'));
                } else if (/[^\d]/g.test(value)) {
                  callback(new Error('密码最小长度的输入类型只能为数字类型'));
                } else if ( this.minValue >=  this.maxValue &&  this.maxValue != 0) {
                } else if (this.minValue >= this.maxValue && this.maxValue != 0) {
                  callback(new Error('密码最小长度不能大于密码最大长度'))
                } else {
                  callback();
@@ -111,7 +111,7 @@
                this.maxValue = value * 1
                if (value == "") {
                  callback(new Error('请输入密码最大长度'));
                } else if ( this.maxValue <=  this.minValue) {
                } else if (this.maxValue <= this.minValue) {
                  callback(new Error('密码最大长度不能小于密码最大长度'));
                } else if (/[^\d]/g.test(value)) {
                  callback(new Error('密码最大长度的输入类型只能为数字类型'));
@@ -288,6 +288,7 @@
            prop: 'defaultFlag',
            type: 'switch',
            labelWidth: "30%",
            value: 0,
            dicData: [{
              label: '否',
              value: 0
@@ -304,24 +305,23 @@
        total: 0,
        pageSizes: [10, 30, 50, 100],
      },
      tableLoading:false,
      checkboxlength: "", //添加存放多选的变量,用于下拉菜单的禁用效果和必填种类是否大于组合方式然后提示用户重新选择
      selectlength: 0,    //这个是下拉菜单的数据变量
      checkboxlist: "" ,  //这个是用于防止change时间冒泡,出现两次弹窗定义的变量
      checkboxNumber: "", //用于首次点击编辑,判断组合方式是否小于必填种类的变量
      selectNumber: "",   //这个也是存放多选的变量,效果一样,只是用作在编辑模块
      tableLoading: false,
      checkboxlength: "", // 添加存放多选的变量,用于下拉菜单的禁用效果和必填种类是否大于组合方式然后提示用户重新选择
      selectlength: 0,    // 下拉菜单的数据变量
      checkboxlist: "",  // 用于防止change时间冒泡,出现两次弹窗定义的变量
      checkboxNumber: "", // 用于首次点击编辑,判断组合方式是否小于必填种类的变量
      selectNumber: "",   // 存放多选的变量,效果一样,只是用作在编辑模块
      checkboxedit: "",   // 用于判断是否是编辑
      editFlag: false,
      minValue:"", // 最小长度value
      maxValue:""  // 最大长度value
      minValue: "",        // 最小长度value
      maxValue: ""         // 最大长度value
    }
  },
  methods:{
  methods: {
    // 表格初始化请求
    getTableList() {
      this.tableLoading = true;
      refDataGrid(this.page.currentPage, this.page.pageSize).then(res =>{
        console.log(res);
      refDataGrid(this.page.currentPage, this.page.pageSize).then(res => {
        this.tableData = res.data.data;
        this.page.total = res.data.total;
        this.tableLoading = false;
@@ -329,27 +329,38 @@
    },
    // 表格头部刷新
    handleRefresh(){
    handleRefresh() {
      this.getTableList();
    },
    //  条数
    sizeChange(val){
    sizeChange(val) {
      this.page.pageSize = val;
    },
    // 页码
    currentChange(val){
    currentChange(val) {
      this.page.currentPage = val;
    },
    // 添加
    rowSaveHandler(){
      console.log(this.form.requireCharCount);
    rowSaveHandler(row, done, loading) {
      row.combinations = row.requireCharType.join(',');
      delete row.requireCharType;
      addDept(row).then(res => {
        if (res.data.code === 200) {
          this.$message.success(res.data.obj);
          this.getTableList();
          done()
        }
      }).catch(err => {
        loading()
        console.log(err);
      })
    },
    // 编辑按钮
    handleEdit(row,index){
    handleEdit(row, index) {
      this.$refs.passWordCrud.rowEdit(row, index);
      this.editFlag = true;
      this.checkboxNumber = row.requireCharType.split(",");
@@ -357,22 +368,48 @@
    },
    // 修改
    rowUpdateHandler(){
    },
    // 删除按钮
    handleDel(){
    rowUpdateHandler(row, index, done,loading) {
      row.combinations = row.requireCharType;
      delete row.requireCharType;
      updatePasswordStrateg(row).then(res => {
        if (res.data.code === 200) {
          this.$message.success(res.data.obj);
          this.getTableList();
          done()
        }
      }).catch(err => {
        loading()
        console.log(err);
      })
    },
    // 删除
    rowDeleteHandler(){
    handleDel(row, index) {
      let params = {
        pwdIds: row.oid
      }
      this.$confirm('您确定要删除当前的密码策略吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteDep(params).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTableList();
          }
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 必填种类changge事件
    handleSelectChange(val){
    handleSelectChange(val) {
      this.selectlength = val.value;
    },
@@ -430,7 +467,7 @@
      }
    },
    // 循环找到对应必填种类禁用选项
    // 过滤找到对应必填种类禁用选项
    setDisabled(arr, indices) {
      arr.dicData.forEach((item, index) => {
        item.disabled = !indices.includes(index);
@@ -441,8 +478,8 @@
}
</script>
<style scoped lang="scss">
.avue-form__group--flex{
<style lang="scss" scoped>
.avue-form__group--flex {
  padding-bottom: 25px !important;
}