Explorar o código

文档管理-提交新版本

lxh hai 1 ano
pai
achega
8b10d0daef

+ 2 - 24
src/views/vent/performance/comment/DeviceModal.vue

@@ -9,8 +9,6 @@
     :footer="null"
     destroyOnClose
   >
-    <!-- <iframe width="100%" height="100%" src="D:/mky/apps/mky-vent-base/public/fileEdit.html" frameborder="0" scrolling="no"></iframe> -->
-    <!-- <FormModal :record="record" @saveOrUpdate="(values) => emit('saveOrUpdate', values)" /> -->
     <div id="fileEdit"></div>
   </BasicModal>
 </template>
@@ -19,9 +17,6 @@
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { onMounted } from 'vue';
   import { useUserStore } from '/@/store/modules/user';
-  // import FormModal from './FormModal.vue';
-  // 声明Emits
-  // const emit = defineEmits(['saveOrUpdate', 'register']);
 
   let props = defineProps({
     fileType: {
@@ -33,6 +28,8 @@
       default: 0,
     },
   });
+  //设置标题
+  let title = '文档管理';
   const userStore = useUserStore(); //获取用户信息
   let userId = unref(userStore.getUserInfo).id;
   let userName = unref(userStore.getUserInfo).username;
@@ -90,25 +87,6 @@
     );
   });
 
-  //设置标题
-  const title = computed(
-    () => {
-      if (!unref(isUpdate)) {
-        if (record.strname || record.systemname) {
-          return `新增(${record.strname || record.systemname})`;
-        }
-        return `新增`;
-      } else {
-        if (record.strname || record.systemname) {
-          return `编辑(${record.strname || record.systemname})`;
-        }
-        return `编辑`;
-      }
-    }
-
-    // !unref(isUpdate) ? `新增(${record.strname || record.systemname})` : `编辑(${record.strname || record.systemname})`
-  );
-
   onMounted(() => {});
 </script>
 

+ 0 - 63
src/views/vent/performance/comment/FormModal.vue

@@ -1,63 +0,0 @@
-<template>
-  <div class="vent-form">
-    <BasicForm @register="registerForm" />
-    <div class="j-box-bottom-button offset-20" style="margin-top: 30px">
-      <div class="j-box-bottom-button-float">
-        <a-button preIcon="ant-design:sync-outlined" @click="onReset">重置</a-button>
-        <a-button type="primary" preIcon="ant-design:save-filled" @click="handleSubmit">保存</a-button>
-      </div>
-    </div>
-  </div>
-</template>
-<script lang="ts" setup>
-  import { inject, nextTick, watch } from 'vue';
-  import { BasicForm, useForm } from '/@/components/Form/index';
-  // 声明Emits
-  const emit = defineEmits(['saveOrUpdate']);
-  const testData = inject('formData') as any;
-  //表单配置
-  const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
-    schemas: inject('formSchema'),
-    showActionButtonGroup: false,
-  });
-
-  watch(
-    testData,
-    (newV) => {
-      nextTick(() => {
-        setFieldsValue({ ...newV });
-      });
-    },
-    { immediate: true }
-  );
-
-  // 重置表单
-  async function onReset() {
-    await resetFields();
-    await setFieldsValue({ ...testData });
-  }
-  //表单提交事件
-  async function handleSubmit(v) {
-    try {
-      let values = await validate();
-      emit('saveOrUpdate', values);
-    } finally {
-      // setModalProps({ confirmLoading: false });
-    }
-  }
-</script>
-<style lang="less" scoped>
-  @ventSpace: zxm;
-  .j-box-bottom-button-float {
-    border: none !important;
-    padding-bottom: 30px;
-    left: 0px !important;
-    right: 0px !important;
-    bottom: 0px !important;
-  }
-  .vent-form {
-    .@{ventSpace}-select-selection-item {
-      color: rgba(255, 255, 255, 1) !important;
-    }
-  }
-</style>

+ 5 - 53
src/views/vent/performance/comment/NormalTable.vue

@@ -43,15 +43,7 @@
       // required: true,
       default: () => [],
     },
-    // searchFormSchema: {
-    //   type: Array,
-    //   required: true,
-    //   default: () => [],
-    // },
-    // formSchema: {
-    //   type: Array,
-    //   required: true,
-    // },
+
     list: {
       type: Function,
       required: true,
@@ -66,10 +58,6 @@
       type: Function,
       required: true,
     },
-    // saveOrUpdate: {
-    //   type: Function,
-    //   required: true,
-    // },
     pointList: {
       type: Function,
       // required: true,
@@ -80,9 +68,6 @@
     title: {
       type: String,
     },
-    // deviceType: {
-    //   type: String,
-    // },
   });
   let fileType = ref(''); //文件类型
   let editID = ref(0); //文件ID
@@ -90,11 +75,7 @@
   const isUpdate = ref(false);
   const record = reactive({});
 
-  // provide('formSchema', props.formSchema);
-  provide('isUpdate', isUpdate);
   provide('formData', record);
-  // provide('deviceType', props.deviceType);
-  // const glob = useGlobSetting();
   const [registerModal, { openModal, closeModal }] = useModal();
 
   const columnList = getTableHeaderColumns(props.columnsType);
@@ -141,28 +122,6 @@
 
   //注册table数据
   const [registerTable, { reload }, { selectedRowKeys }] = tableContext;
-
-  // const saveOrUpdateHandler = async (params) => {
-  //   try {
-  //     await props.saveOrUpdate(params, isUpdate.value);
-  //     closeModal();
-  //     await doRequest(props.list, { confirm: false });
-  //   } catch (error) {
-  //     message.error('保存失败,请联系管理员');
-  //   }
-  // };
-
-  // /**
-  //  * 新增事件
-  //  */
-  // function handleAdd() {
-  //   for (let key in record) {
-  //     delete record[key];
-  //   }
-  //   isUpdate.value = false;
-  //   openModal(true);
-  // }
-
   /**
    * 编辑事件
    */
@@ -219,22 +178,15 @@
   }
 
   /**
-   * 查看
-   */
-  // function handleDetail(record) {
-  //   iframeUrl.value = `${glob.uploadUrl}/sys/annountCement/show/${record.id}?token=${getToken()}`;
-  //   openDetail(true);
-  // }
-  /**
    * 操作列定义
    * @param record
    */
   function getActions(record) {
     return [
-      // {
-      //   label: '详情',
-      //   onClick: handleEdit.bind(null, record),
-      // },
+      {
+        label: '详情',
+        onClick: handleEdit.bind(null, record),
+      },
       {
         label: '编辑',
         onClick: handleEdit.bind(null, record),

+ 0 - 30
src/views/vent/performance/comment/fileMenuModal.vue

@@ -1,30 +0,0 @@
-<template>
-  <BasicModal
-    v-bind="$attrs"
-    @register="registerModal"
-    :title="title"
-    width="900px"
-    :showCancelBtn="false"
-    :showOkBtn="false"
-    :footer="null"
-    destroyOnClose
-  >
-    <fileModal @saveOrUpdate="(values) => emit('saveOrUpdate', values)" />
-  </BasicModal>
-</template>
-<script lang="ts" setup>
-  import fileModal from './fileModal.vue';
-  import { BasicModal, useModalInner } from '/@/components/Modal';
-  import { ref } from 'vue';
-  const emit = defineEmits(['saveOrUpdate', 'register']);
-  //弹窗标题
-  let title = ref('编辑目录');
-  //弹窗赋值
-  const [registerModal, { setModalProps }] = useModalInner(async (data) => {
-    //重置弹窗
-    setModalProps({ confirmLoading: false });
-    // Object.assign(record, data.record);
-  });
-</script>
-
-<style lang="less" scoped></style>

+ 0 - 128
src/views/vent/performance/comment/fileModal.vue

@@ -1,128 +0,0 @@
-<template>
-  <div class="title">目录类型 : </div>
-  <div class="content">
-    <template v-for="(tag, index) in state.tags" :key="tag">
-      <a-tag :closable="index !== 0" @close="handleClose(tag)">
-        {{ tag }}
-      </a-tag>
-    </template>
-    <a-input
-      v-if="state.inputVisible"
-      ref="inputRef"
-      v-model:value="state.inputValue"
-      type="text"
-      size="small"
-      :style="{ width: '78px' }"
-      @blur="handleInputConfirm"
-      @keyup.enter="handleInputConfirm"
-    />
-    <a-tag v-else style="background: #fff; border-style: dashed" @click="showInput">
-      <plus-outlined />
-      新增目录
-    </a-tag>
-  </div>
-  <div class="footer">
-    <a-button style="margin-right: 10px" type="primary" @click="handleSubmit">保存</a-button>
-    <a-button type="primary" @click="handleSubmit">取消</a-button>
-  </div>
-</template>
-<script lang="ts" setup>
-  import { ref, reactive, toRefs, nextTick, inject, watch } from 'vue';
-  import { PlusOutlined } from '@ant-design/icons-vue';
-  import { createFile, deleteById } from '../fileDetail/fileDetail.api';
-  components: {
-    PlusOutlined;
-  }
-  //左侧树列表数据
-  const treeData = inject('treeData') as any;
-  //编辑菜单-新增or删除
-  let flag = ref(true) as any;
-  //编辑菜单-被删除元素ID
-  let delId = ref(0) as any;
-  // 声明Emits
-  const emit = defineEmits(['saveOrUpdate']);
-  const inputRef = ref();
-  const state = reactive<any>({
-    tags: [],
-    inputVisible: false,
-    inputValue: '',
-  });
-  const handleClose = (removedTag: string) => {
-    flag.value = false; //编辑菜单-删除
-    const tags = state.tags.filter((tag) => tag !== removedTag);
-    //获取被删除元素ID
-    delId.value = treeData[0].children.filter((el) => el.title === removedTag)[0].id;
-    console.log(tags);
-    state.tags = tags;
-  };
-  const showInput = () => {
-    flag.value = true; //编辑菜单-新增
-    state.inputVisible = true;
-    nextTick(() => {
-      inputRef.value.focus();
-    });
-  };
-  const handleInputConfirm = () => {
-    const inputValue = state.inputValue;
-    let tags = state.tags;
-    if (inputValue && tags.indexOf(inputValue) === -1) {
-      tags = [...tags, inputValue];
-    }
-    console.log(tags);
-    Object.assign(state, {
-      tags,
-      inputVisible: false,
-      inputValue: '',
-    });
-  };
-  //新增
-
-  //删除
-  //表单提交事件
-  async function handleSubmit(v) {
-    try {
-      if (flag.value) {
-        //编辑菜单-新增保存
-        console.log('编辑菜单-新增');
-      } else {
-        //编辑菜单-删除保存
-        console.log('编辑菜单-删除');
-      }
-      emit('saveOrUpdate', false);
-    } finally {
-      // setModalProps({ confirmLoading: false });
-    }
-  }
-  watch(
-    treeData,
-    (newV) => {
-      console.log(newV, 'new111');
-      let editMenuList = [] as any;
-      newV[0].children.forEach((el) => {
-        editMenuList.push(el.title);
-      });
-      state.tags = [...editMenuList];
-    },
-    { immediate: true }
-  );
-</script>
-
-<style lang="less" scoped>
-  .title {
-    margin-bottom: 10px;
-  }
-  .footer {
-    position: absolute;
-    right: 20px;
-    bottom: 20px;
-  }
-  ::v-deep .zxm-tag {
-    margin-bottom: 10px;
-    border-color: #3ad8ff77;
-    background-color: #ffffff00 !important;
-    color: #fff;
-  }
-  ::v-deep .zxm-tag-close-icon {
-    color: #fff;
-  }
-</style>

+ 44 - 32
src/views/vent/performance/fileDetail/index.vue

@@ -85,44 +85,57 @@
   let listArr = reactive<any[]>([]);
 
   //递归遍历左侧菜单数据
-  let list2tree = (list) => {
-    list.forEach((child) => {
-      const pid = child.parentId;
-      if (pid) {
-        list.forEach((parent) => {
-          if (parent.id === pid) {
-            parent.children = parent.children || [];
-            parent.isFolder = true;
-            parent.title = parent.fileName;
-            parent.pid = parent.parentId;
-            parent.children.push({ id: child.id, isFolder: true, title: child.fileName, pid: child.parentId });
-          }
-        });
+  // let list2tree = (list) => {
+  //   list.forEach((child) => {
+  //     const pid = child.parentId;
+  //     if (pid) {
+  //       list.forEach((parent) => {
+  //         if (parent.id === pid) {
+  //           parent.children = parent.children || [];
+  //           parent.isFolder = true;
+  //           parent.title = parent.fileName;
+  //           parent.pid = parent.parentId;
+  //           parent.children.push({ id: child.id, isFolder: true, title: child.fileName, pid: child.parentId });
+  //         }
+  //       });
+  //     }
+  //   });
+  //   console.log(list, '999999999');
+  //   return list.filter((n) => n.parentId == 'root');
+  // };
+  let list2trees = (data) => {
+    // 删除 所有 children,以防止多次调用
+    data.forEach(function (item) {
+      delete item.children;
+    });
+    // 将数据存储为 以 id 为 KEY 的 map 索引数据列
+    let map = {};
+    data.forEach(function (item) {
+      map[item.id] = item;
+    });
+    var val = [];
+    data.forEach(function (item) {
+      item.isFolder = true;
+      item.title = item.fileName;
+      item.pid = item.parentId;
+      // 以当前遍历项,的pid,去map对象中找到索引的id
+      var parent = map[item.pid];
+      // 好绕啊,如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
+      if (parent) {
+        (parent.children || (parent.children = [])).push(item);
+      } else {
+        //如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级
+        val.push(item);
       }
     });
-    console.log(list, '999999999');
-    return list.filter((n) => n.parentId == 'root');
-  };
-  let list2trees = () => {
-    let arr = [
-      { id: 0, name: 1, parentId: 'root' },
-      { id: 1, name: 1, parentId: 0 },
-      { id: 2, name: 1, parentId: 0 },
-      { id: 3, name: 1, parentId: 2 },
-      { id: 4, name: 1, parentId: 2 },
-      { id: 5, name: 1, parentId: 3 },
-      { id: 6, name: 1, parentId: 3 },
-      { id: 7, name: 1, parentId: 5 },
-      { id: 8, name: 1, parentId: 5 },
-      { id: 9, name: 1, parentId: 7 },
-      { id: 10, name: 1, parentId: 7 },
-    ];
+    return val;
   };
+
   //获取左侧菜单树数据
   let getTreeList = async () => {
     listArr.length = 0;
     let data = await getTree({ parentId: '' });
-    let list = list2tree(data.records);
+    let list = list2trees(data.records);
     console.log(list, 'list');
     listArr.push(...list);
     console.log(listArr, '树节点数据');
@@ -208,7 +221,6 @@
 
   onMounted(() => {
     getTreeList();
-    list2trees();
   });
 </script>