“linengliang”
2023-11-03 390c3dd9027f3d112bebc0864b9dc70b15d5457e
查询
已添加3个文件
已修改1个文件
227 ■■■■■ 文件已修改
src/views/base/Secret.vue 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/NewPermissionList.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/modules/SecretForm.vue 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/modules/SecretModel.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/Secret.vue
src/views/system/NewPermissionList.vue
@@ -11,6 +11,7 @@
        type="primary"
        icon="delete">批量删除
      </a-button>
      <a-button @click="handleSecret" type="primary" icon="frown" v-if="selectionRows.length===1&&selectionRows[0].title==='芝麻开门'">查询</a-button>
    </div>
    <!-- table区域-begin -->
@@ -75,6 +76,7 @@
    <permission-modal ref="modalForm" @ok="modalFormOk"></permission-modal>
    <permission-data-rule-list ref="PermissionDataRuleList" @ok="modalFormOk"></permission-data-rule-list>
    <secret-model ref="secret"></secret-model>
  </a-card>
</template>
@@ -85,6 +87,7 @@
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import PermissionDataRuleList from './PermissionDataRuleList'
  import JEllipsis from '@/components/jeecg/JEllipsis'
import SecretModel from './modules/SecretModel.vue'
  const columns = [
    {
@@ -147,7 +150,8 @@
    components: {
      PermissionDataRuleList,
      PermissionModal,
      JEllipsis
      JEllipsis,
        SecretModel
    },
    data() {
      return {
@@ -185,6 +189,10 @@
          })
        }
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows;
      },
      // æ ¹æ®å·²å±•开的行查询数据(用于保存后刷新时异步加载子级的数据)
      loadDataByExpandedRows(dataList) {
        if (this.expandedRowKeys.length > 0) {
@@ -220,6 +228,11 @@
      handleExpandedRowsChange(expandedRows) {
        this.expandedRowKeys = expandedRows
      },
      handleSecret(){
        this.$refs.secret.title='秘密'
        this.$refs.secret.add();
      }
    }
  }
</script>
src/views/system/modules/SecretForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,153 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type">
              <a-input v-model="model.type" placeholder="请输入类型"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="查询" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sql">
              <a-textarea v-model="model.sql" rows="4" placeholder="请输入查询" />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>
<script>
  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'
  export default {
    name: 'SecretForm',
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        name:'',
        code:'',
        model:{
         },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
           type : [
              { required: true, message: '请输入sql类型!'},
           ],
           sql:[{ required: true, message: '请输入sql!'},]
        },
        url: {
          add: "/sys/permission/addSecret",
          edit: "/base/departmentCategory/edit",
          queryById: "/base/departmentCategory/queryById",
          check:"/base/departmentCategory/check"
        }
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.name=this.model.name;
        this.code=this.model.code;
        this.visible = true;
      },
      submitForm () {
        const that = this;
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
            })
          }
        })
      },
      validateCode(rule, value, callback){
        var params = {
        code:value,
        delFlag:'0',
      };
      getAction(this.url.check,params).then(res=>{
            if(res.result.length==0){
              callback();
            }
            else if(this.model.id&&this.code==value){
              callback();
            }
            else{
              callback('部门类型编码重复')
            }
        })
      },
      validateName(rule, value, callback){
        var params = {
        name:value,
        delFlag:'0',
      };
      getAction(this.url.check,params).then(res=>{
            if(res.result.length==0){
              callback();
            }
            else if(this.model.id&&this.name==value){
              callback();
            }
            else{
              callback('部门类型名称重复')
            }
        })
      },
    }
  }
</script>
src/views/system/modules/SecretModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <secret-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></secret-form>
  </j-modal>
</template>
<script>
  import SecretForm from './SecretForm.vue'
  export default {
    name: 'SecretModal',
    components: {
        SecretForm
    },
    data () {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>