index.vue 6.08 KB
<route lang="yaml">
  name: securityMenu //标签管理
  </route>

<script lang="ts" setup name="securityMenu">
import TableTools from '@/components/Tools/table_tools.vue';
const { proxy } = getCurrentInstance() as any;
const dialogLabelFormRef = ref();


onBeforeMount(async () => {

});
// 右侧表格配置
const tableDataList = ref([]);
// 删除标签guids
const deleteLabelGuids = ref<any>([]);

// 保存编辑的guid
const editLabelRow = ref<any>('');
const page = ref({
  limit: 50,
  curr: 1,
  sizes: [
    { label: "10", value: 10 },
    { label: "50", value: 50 },
    { label: "100", value: 100 },
    { label: "150", value: 150 },
    { label: "200", value: 200 },
  ],
});
const tableInfo = ref({
  id: "role-manage-table",
  multiple: true,
  fixedSelection: true,
  fields: [
    { label: "序号", type: "index", width: 56, align: "center" },
    { label: "数据产品编号", field: "label", type: 'text_btn', class: 'drawer-detail-cell', width: 160, value: 'detail', columClass: 'text_btn' },
    {
      label: "数据产品名称", field: "classifyNames", width: 200,
    },
    { label: "数据类型", field: "gradeDetailName", width: 100 },
    {
      label: '权力主体', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 100, align: 'center'
    },
    { label: "是否公共数据", field: "updateUserName", width: 120 },
    { label: "状态", field: "updateTime", width: 160 },
  ],
  data: tableDataList.value,
  page: {
    type: "normal",
    rows: 0,
    ...page.value,
  },
  actionInfo: {
    label: "操作",
    type: "btn",
    width: 120,
    fixed: 'right',
    btns: [
      {
        label: "编辑", value: "edit", click: async (scope) => {
          console.log('编辑', scope);
        }
      },
      {
        label: "删除 ", value: "delete", click: (scope) => {
          console.log('删除', scope);

        }
      },
    ]
  },
  loading: false
});



const formItems = ref([
  {
    label: '附件上传',
    tip: '支持格式:pdf,单个文件不能超过10MB ',
    type: 'upload-file',
    accept: '.pdf',
    field: 'costAssessmentFile',
    templateUrl: '',
    required: true,
    block: true,
    visible: true,
    default: [],
  },
  {
    label: '附件上传',
    tip: '支持格式:pdf,单个文件不能超过10MB ',
    type: 'upload-file',
    accept: '.pdf',
    field: 'costAssessmentFile1',
    templateUrl: '',
    required: true,
    block: true,
    visible: true,
    default: [],
  },
  {
    label: '附件上传',
    tip: '支持格式:pdf,单个文件不能超过10MB ',
    type: 'upload-file',
    accept: '.pdf',
    field: 'costAssessmentFile2',
    templateUrl: '',
    required: true,
    block: true,
    visible: true,
    default: [],
  },
]);

const formRules = ref({
  registerGuid: [
    { required: true, trigger: 'change', message: "请填写资产名称" }
  ],
  costAssessmentFile: [{
    validator: (rule: any, value: any, callback: any) => {
      if (!value?.length) {
        callback(new Error('请上传数据价值评估附件'))
      } else {
        callback();
      }
    }, trigger: 'change'
  }]
});

const dialogInfo = ref({
  visible: false,
  size: 510,
  direction: "column",
  header: {
    title: "价值评估发起",
  },
  type: '',//标识是否是重新提交
  contents: [
    {
      type: 'form',
      title: '',
      formInfo: {
        id: 'quality-coss-level',
        items: formItems.value,
        rules: formRules.value
      }
    }
  ],
  footer: {
    btns: [
      { type: "default", label: "取消", value: "cancel" },
      { type: "primary", label: "确定", value: "submit" },
    ],
  },
});

const dialogBtnClick = () => {
  console.log('handleSelectChange');
};


const classSearchItemList = ref<any>([
  {
    type: 'select',
    multiple: true,
    label: '',
    field: 'labelName',
    default: [],
    options: [],
    placeholder: '请选择标签名称',
    clearable: true,
    filterable: true,
    visible: true
  },
  // 状态,可以编辑。

  {
    type: 'select',
    multiple: true,
    label: '',
    field: 'state',
    default: [],
    options: [],
    placeholder: '状态',
    clearable: true,
    filterable: true,
    visible: true
  }

]);

const guids = ref<any>([])
const selectChange = async (val: any, row: any) => {
  console.log('selectChange', val, row);
  if (val) {
    guids.value = val;
  }
};

/** 搜索查询分类标准 */
const refCount = ref(0);
const searchClass = async (val: any, clear: boolean = false) => {
  console.log('searchClass', val, clear);
  if (clear) {
    classSearchItemList.value.map(item => item.default = '')
    guids.value = []

    return;
  }
  if (val?.labelName?.length !== 0 || refCount.value >= 1) {

  }

};

const addNewLabel = () => {
  dialogInfo.value.visible = true;
}



</script>


<template>
  <div class="data-label">
    <div class="container_wrap">
      <div class="main_wrap">
        <div class="main_wrap-top-area">
          <TableTools :searchItems="classSearchItemList" :searchId="'template-manage-search'" @search="searchClass"
            @select-change="selectChange" />
        </div>
        <div>
          <el-button type="primary" class="v-add" @click="addNewLabel">新增</el-button>
          <!-- <el-button class="v-import">导入</el-button>
          <el-button>导出</el-button> -->
        </div>
        <div class="table_panel_wrap">
          <Table :tableInfo="tableInfo" />
        </div>
      </div>
    </div>
    <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" />
  </div>
</template>

<style lang="scss" scoped>
.data-label {
  width: 100%;
  height: 100%;

  .container_wrap {
    height: 100%;

    .main_wrap {
      height: 100%;
      padding: 11px 16px 0 16px;

      .main_wrap-top-area {
        display: flex;
        margin-bottom: 10px;
        align-items: center;

        .v-serach {
          margin-left: 10px;
        }
      }

      .table_panel_wrap {
        margin-top: 12px;
        width: 100%;
        height: calc(100% - 105px);
        min-height: 210px;
        overflow: visible;
      }
    }
  }
}
</style>