Browse Source

新增文件上传

tengmingxue 2 years ago
parent
commit
262cc17b94

+ 35 - 0
src/api/resource/files.ts

@@ -0,0 +1,35 @@
+/*
+ * @Author: tengmingxue 1473375109@qq.com
+ * @Date: 2023-08-15 11:20:48
+ * @LastEditors: tengmingxue 1473375109@qq.com
+ * @LastEditTime: 2023-08-25 10:40:29
+ * @FilePath: \xld-gis-admin\src\api\resource\scene.ts
+ * @Description: 文件资源接口
+ */
+import { defHttp } from '/@/utils/http/axios';
+import { session } from "/@/utils/Memory.js";
+enum Api {
+    Login = '/callProvider'
+}
+const interfaceType = { apiUrl2: true };
+
+/**
+ * @description:获取地图资源列表
+ */
+export function list() {
+    const formData = new FormData();
+    formData.append("interfaceName", "antu.space.provider.sservicebase.ServiceBaseMetaDataViewProvider");
+    formData.append("methodName", "getResourcePagedList");
+    formData.append("args[]", session.getItem('tokenV2'));
+    formData.append("args[]", '{"type":"DR","pageIndex":1,"pageSize":20,"orderBy":"updatedate DESC"}');
+    return new Promise<void>((resolve, reject) => {
+        defHttp.post({ url: Api.Login, params: formData, ...interfaceType })
+            .then((r) => {
+                let result = r.result === '' ? {} : JSON.parse(r.result)
+                console.log('文件资源数据',result)
+                resolve(result);
+            })
+    })
+}
+
+

+ 173 - 177
src/views/dataAdmin/dataAdmin/fileResourceUpload/AddMethod.vue

@@ -1,6 +1,6 @@
 <template>
   <BasicModal
-    width="800px"
+    width="1200px"
     v-bind="$attrs"
     @register="registerModal"
     :title="getTitle"
@@ -8,205 +8,201 @@
     :useWrapper="true"
     :minHeight="500"
   >
-    <div style="height: 50vh;">
-          <div class="text-center text-black text-2xl">
-            <!-- <a-typography-title style="font-size: 16px;">流域基础信息</a-typography-title> -->
-            <a-menu v-model:selectedKeys="current" mode="horizontal" @click="menuClick">
-              <a-menu-item key="mail1">
-                基础信息
-              </a-menu-item>
-              <a-menu-item key="mail2">
-                版本信息
-              </a-menu-item>
-            </a-menu>
-          </div>
+    <div style="height: 50vh">
+      <div class="text-center text-black text-2xl">
+        <!-- <a-typography-title style="font-size: 16px;">流域基础信息</a-typography-title> -->
+        <a-menu v-model:selectedKeys="current" mode="horizontal" @click="menuClick">
+          <a-menu-item key="mail1"> 基础信息 </a-menu-item>
+          <a-menu-item key="mail2"> 版本信息 </a-menu-item>
+        </a-menu>
+      </div>
       <BasicForm @register="registerForm" v-if="show1">
         <template #upload>
-          <a-upload name="file" :multiple="true">
-           <a-button  type="primary">
-             <upload-outlined></upload-outlined>
+          <a-upload
+            name="file"
+            :multiple="true"
+            :fileList="fileList"
+            action=""
+            :showUploadList="true"
+            :customRequest="()=>{}"
+          >
+            <a-button type="primary">
+              <upload-outlined></upload-outlined>
               选择文件
-           </a-button>
-           <span style="font-size: 14px; margin-left: 10px;">支持上传png、jpeg、gif、tif、doc、xls、pdf等格式文件</span>
+            </a-button>
+            <span style="font-size: 14px; margin-left: 10px"
+              >支持上传png、jpeg、gif、tif、doc、xls、pdf等格式文件</span
+            >
           </a-upload>
         </template>
       </BasicForm>
+      <upload-file-list :fileList="fileList"></upload-file-list>
     </div>
   </BasicModal>
 </template>
 <script lang="ts">
-  import { defineComponent, ref, computed, unref, reactive, onMounted } from 'vue';
-  import { BasicModal, useModalInner } from '/@/components/Modal';
-  import { BasicForm, useForm } from '/@/components/Form/index';
-  import { accountFormSchema, accountFormSchema2 } from './fileUploadData';
-  import { filterRoleList } from '/@/api/system/system';
-  // import { addDzsbsjjr } from '/@/api/datamanager/groundDisasterId/muSourceData';
+import { defineComponent, ref, computed, unref, reactive, onMounted, watch } from 'vue';
+import { BasicModal, useModalInner } from '/@/components/Modal';
+import { BasicForm, useForm } from '/@/components/Form/index';
+import { accountFormSchema, accountFormSchema2 } from './fileUploadData';
+import { cloneDeep } from 'lodash-es';
+import { message, Upload } from 'ant-design-vue';
+import { useMessage } from '/@/hooks/web/useMessage';
+import { TOption } from '/@/views/rule/linkedge/config/config.data';
+import { PlusOutlined } from '@ant-design/icons-vue';
+import { addFileResource } from '../../api/fileUploadApi';
+import UploadFileList from './uploadFileList.vue';
 
-  import { message, Upload, } from 'ant-design-vue';
-  import { useMessage } from '/@/hooks/web/useMessage';
-  // import { FileItem } from '/@/components/Upload/src/typing';
-  import { TOption } from '/@/views/rule/linkedge/config/config.data';
-  import { PlusOutlined } from '@ant-design/icons-vue';
-  // import { upload } from '/@/api/oss/ossFileUploader';
-  import { addFileResource } from '../../api/fileUploadApi'
-  export default defineComponent({
-    name: 'AccountModal',
-    components: {
-      BasicModal,
-      BasicForm,
-      Upload,
-      PlusOutlined,
-    },
-    emits: ['success', 'register'],
-    setup(_, { emit }) {
-      let show1 = ref(true)
-      const current = ref(['mail1']);
-      const tenantLogo = ref('');
-      const loading = ref(false);
-      const roleOptions = ref<TOption[]>([]);
-      const isUpdate = ref(true);
-      const rowId = ref('');
-      const postData = reactive({});
+export default defineComponent({
+  name: 'AccountModal',
+  components: {
+    BasicModal,
+    BasicForm,
+    Upload,
+    PlusOutlined,
+    UploadFileList,
+  },
+  emits: ['success', 'register'],
+  setup(_, { emit }) {
+    let show1 = ref(true);
+    const current = ref(['mail1']);
+    const tenantLogo = ref('');
+    const loading = ref(false);
+    const roleOptions = ref<TOption[]>([]);
+    const isUpdate = ref(true);
+    const rowId = ref('');
+    const postData = reactive({});
+    const fileList = [];
+    onMounted(async () => {});
 
-      const getRoleList = async () => {
-        const res = await filterRoleList();
-        console.log(res);
-        roleOptions.value = res.map((m) => {
-          return {
-            label: m.name,
-            value: m.id,
-          };
-        });
-      };
-      onMounted(async () => {
-        await getRoleList();
-      });
+    const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
+      labelWidth: 100,
+      schemas: show1 ? accountFormSchema : accountFormSchema2,
+      showActionButtonGroup: false,
+      actionColOptions: {
+        span: 18,
+      },
+    });
 
-      const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
-        labelWidth: 100,
-        schemas: show1 ? accountFormSchema : accountFormSchema2,
-        showActionButtonGroup: false,
-        actionColOptions: {
-          span: 18,
-        },
-      });
+    const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
+      await resetFields();
+      setModalProps({ confirmLoading: false });
+      isUpdate.value = !!data?.isUpdate;
+      if (unref(isUpdate)) {
+        rowId.value = data.record.id;
+        setFieldsValue(data.record);
+      }
+    });
+    const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
 
-      const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
-        await resetFields();
-        setModalProps({ confirmLoading: false });
-        isUpdate.value = !!data?.isUpdate;
-        if (unref(isUpdate)) {
-          rowId.value = data.record.id;
-          setFieldsValue(data.record);
-        }
-      });
-      const getTitle = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
+    watch(()=>fileList, (op) => {
+      console.log('文件改变', op);
+    });
+    async function handleSubmit() {
+      setModalProps({ confirmLoading: true });
+      try {
+        const { createMessage } = useMessage();
+        const values = await validate(['parentId']);
+        Object.assign(postData, values);
 
-      async function handleSubmit() {
-        setModalProps({ confirmLoading: true });
-        try {
-          const { createMessage } = useMessage();
-          const values = await validate([
-            'parentId'
-          ]);
-          Object.assign(postData, values);
+        console.log('准备传递的参数' + JSON.stringify(postData));
 
-          console.log("准备传递的参数"+JSON.stringify(postData))
+        await addFileResource(paramsToFormData(postData as any), unref(isUpdate));
+        closeModal();
+        emit('success');
+        createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功');
+      } finally {
+        setTimeout(() => {
+          setModalProps({ confirmLoading: false });
+        }, 300);
+      }
+    }
+    // async function customUpload({ file }) {
+    //   if (beforeUpload(file)) {
+    //     tenantLogo.value = '';
+    //     loading.value = true;
+    //     const formData = new FormData();
+    //     formData.append('file', file);
+    //     const response = await upload(formData);
+    //     if (response.fileStaticUri) {
+    //       tenantLogo.value = response.fileStaticUri;
+    //       loading.value = false;
+    //     }
+    //   }
+    // }
+    // const beforeUpload = (file: FileItem) => {
+    //   const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
+    //   if (!isJpgOrPng) {
+    //     message.error('只能上传图片文件!');
+    //   }
+    //   const isLt2M = (file.size as number) / 1024 / 1024 < 5;
+    //   if (!isLt2M) {
+    //     message.error('图片大小不能超过5MB!');
+    //   }
+    //   return isJpgOrPng && isLt2M;
+    // };
+    function preProcessData(data) {
+      Object.keys(data).forEach((item) => {
+        if (typeof data[item] === 'undefined' || data[item] === null || data[item] === '') {
+          delete data[item];
+        }
+      });
+      return data;
+    }
 
-          await addFileResource(paramsToFormData(postData as any), unref(isUpdate));
-          closeModal();
-          emit('success');
-          createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功');
-        } finally {
-          setTimeout(() => {
-            setModalProps({ confirmLoading: false });
-          }, 300);
+    function paramsToFormData(obj) {
+      const data = preProcessData(obj);
+      const formData = new FormData();
+      Object.keys(data).forEach((key) => {
+        if (data[key] instanceof Array) {
+          data[key].forEach((item) => {
+            formData.append(key, item);
+          });
+          return;
         }
-      }
-      // async function customUpload({ file }) {
-      //   if (beforeUpload(file)) {
-      //     tenantLogo.value = '';
-      //     loading.value = true;
-      //     const formData = new FormData();
-      //     formData.append('file', file);
-      //     const response = await upload(formData);
-      //     if (response.fileStaticUri) {
-      //       tenantLogo.value = response.fileStaticUri;
-      //       loading.value = false;
-      //     }
-      //   }
-      // }
-      // const beforeUpload = (file: FileItem) => {
-      //   const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
-      //   if (!isJpgOrPng) {
-      //     message.error('只能上传图片文件!');
-      //   }
-      //   const isLt2M = (file.size as number) / 1024 / 1024 < 5;
-      //   if (!isLt2M) {
-      //     message.error('图片大小不能超过5MB!');
-      //   }
-      //   return isJpgOrPng && isLt2M;
-      // };
-      function preProcessData(data) {
-        Object.keys(data).forEach((item) => {
-          if (typeof data[item] === 'undefined' || data[item] === null || data[item] === '') {
-            delete data[item];
-          }
-        });
-        return data;
-      }
+        formData.append(key, obj[key]);
+      });
+      return formData;
+    }
 
-      function paramsToFormData(obj) {
-        const data = preProcessData(obj);
-        const formData = new FormData();
-        Object.keys(data).forEach((key) => {
-          if (data[key] instanceof Array) {
-            data[key].forEach((item) => {
-              formData.append(key, item);
-            });
-            return;
-          }
-          formData.append(key, obj[key]);
-        });
-        return formData;
+    // 菜单点击事件
+    const menuClick = (value) => {
+      console.log('canshu1111' + JSON.stringify(value));
+      if (value.key == 'mail1') {
+        show1.value = true;
+      } else {
+        show1.value = false;
       }
+    };
 
-      // 菜单点击事件
-      const menuClick = (value) => {
-        console.log("canshu1111" + JSON.stringify(value))
-        if(value.key == 'mail1'){
-          show1.value = true
-        }else{
-          show1.value = false
-        }
-      }
-      return {
-        current,
-        registerModal,
-        registerForm,
-        handleSubmit,
-        getTitle,
-        roleOptions,
-        // customUpload,
-        // beforeUpload,
-        tenantLogo,
-        loading,
-        menuClick,
-        show1,
-      };
-    },
-  });
+    return {
+      current,
+      registerModal,
+      registerForm,
+      handleSubmit,
+      getTitle,
+      roleOptions,
+      // customUpload,
+      // beforeUpload,
+      tenantLogo,
+      loading,
+      menuClick,
+      show1,
+      fileList,
+    };
+  },
+});
 </script>
 <style scoped lang="less">
-  :deep(.vben-basic-tree) {
-    width: 100% !important;
-  }
+:deep(.vben-basic-tree) {
+  width: 100% !important;
+}
 
-  :deep(.is-unflod) {
-    display: none !important;
-  }
+:deep(.is-unflod) {
+  display: none !important;
+}
 
-  :deep(.is-flod) {
-    display: none !important;
-  }
+:deep(.is-flod) {
+  display: none !important;
+}
 </style>

+ 334 - 246
src/views/dataAdmin/dataAdmin/fileResourceUpload/fileUploadData.js

@@ -1,85 +1,87 @@
 export const columns = [
-    {
-      title: '资源编号',
-      dataIndex: 'resourceNumber',
-      width: 200,
-    },
-    {
-        title: '资源名称',
-        dataIndex: 'resourceName',
-        width: 200,
-      },
-      {
-        title: '坐标系名称',
-        dataIndex: 'coordinateName',
-        width: 200,
-      },
-      {
-        title: '资源标签',
-        dataIndex: 'resourceTags',
-        width: 200,
-      },
-      {
-        title: '发布人',
-        dataIndex: 'publisher',
-        width: 200,
-      },
-      {
-        title: '发布时间',
-        dataIndex: 'publisherTime',
-        width: 200,
-      },
-      {
-        title: '审核状态',
-        dataIndex: 'auditStatus',
-        width: 200,
-      },
-      {
-        title: '审核人',
-        dataIndex: 'reviewer',
-        width: 200,
-      },
-      {
-        title: '审核时间',
-        dataIndex: 'reviewTime',
-        width: 200,
-      },
+  {
+    title: '资源编号',
+    dataIndex: 'serviceid',
+    width: 200,
+  },
+  {
+    title: '资源名称',
+    dataIndex: 'servicename',
+    width: 200,
+  },
+  {
+    title: '类型',
+    dataIndex: 'typename',
+    width: 200,
+  },
+  {
+    title: '发布人',
+    dataIndex: 'publisher',
+    width: 200,
+  },
+  {
+    title: '发布时间',
+    dataIndex: 'publishdate',
+    width: 200,
+    slots: { customRender: 'pdate' },
+  },
+  {
+    title: '当前环节',
+    dataIndex: 'currhj',
+    width: 200,
+  },
+  {
+    title: '当前处理人',
+    dataIndex: 'currHandler',
+    width: 200,
+  },
+  {
+    title: '审核状态',
+    dataIndex: 'status',
+    width: 200,
+    slots: { customRender: 'status' },
+  },
+  {
+    title: '审核时间',
+    dataIndex: 'status',
+    width: 200,
+  },
 ];
 
 export const searchFormSchema = [
-    {
-        field: 'resourceTags',
-        label: '资源标签',
-        component: 'Select',
-        componentProps: {
-          options: [
-            { label: '无', value: 0 },
-          ],
-        },
-        colProps: { span: 6 },
-      },
-    {
-        field: 'resourceName',
-        label: '资源名称',
-        component: 'Input',
-        colProps: { span: 6 },
-        componentProps: {
-            maxLength: 255,
-        },
+  {
+    field: 'resourceTags',
+    label: '资源标签',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: '无', value: 0 },
+      ],
     },
-    {
-        field: 'auditStatus',
-        label: '审核状态',
-        component: 'Select',
-        componentProps: {
-          options: [
-            { label: '审核不通过', value: 2 },
-            { label: '审核中', value: 1 },
-            { label: '审核通过', value: 0 },
-          ],
-        },
-        colProps: { span: 6 },
-      },
+    colProps: { span: 6 },
+  },
+  {
+    field: 'resourceName',
+    label: '资源名称',
+    component: 'Input',
+    colProps: { span: 6 },
+    componentProps: {
+      maxLength: 255,
+    },
+  },
+  {
+    field: 'auditStatus',
+    label: '审核状态',
+    component: 'Select',
+    componentProps: {
+      options: [
+        { label: '审核不通过', value: 2 },
+        { label: '审核中', value: 1 },
+        { label: '审核通过', value: 0 },
+      ],
+    },
+    colProps: { span: 6 },
+  },
 ]
 
 // 新增表单配置
@@ -131,183 +133,183 @@ export const accountFormSchema = [
       getPopupContainer: () => document.body,
     },
   },
-{
-  field: 'lymc',
-  label: '数据版本',
-  component: 'Input',
-  colProps: { span: 12 },
-  componentProps: {
-    placeholder: '请输入',
-  },
-},
-{
-  field: 'lymc',
-  label: '运行状态',
-  component: 'Input',
-  colProps: { span: 12 },
-  componentProps: {
-    placeholder: '请输入',
-  },
-},
-{
-  field: 'lymc',
-  label: '资源描述',
-  component: 'Input',
-  colProps: { span: 24 },
-  componentProps: {
-    placeholder: '请输入',
-  },
-},
-{
-  field: 'parentId',
-  label: '责任处室',
-  required: true,
-  component: 'TreeSelect',
-  colProps: { span: 12 },
-  componentProps: {
-    replaceFields: {
-      title: 'name',
-      key: 'id',
-      value: 'id',
+  {
+    field: 'lymc',
+    label: '数据版本',
+    component: 'Input',
+    colProps: { span: 12 },
+    componentProps: {
+      placeholder: '请输入',
+    },
+  },
+  {
+    field: 'lymc',
+    label: '运行状态',
+    component: 'Input',
+    colProps: { span: 12 },
+    componentProps: {
+      placeholder: '请输入',
+    },
+  },
+  {
+    field: 'lymc',
+    label: '资源描述',
+    component: 'Input',
+    colProps: { span: 24 },
+    componentProps: {
+      placeholder: '请输入',
+    },
+  },
+  {
+    field: 'parentId',
+    label: '责任处室',
+    required: true,
+    component: 'TreeSelect',
+    colProps: { span: 12 },
+    componentProps: {
+      replaceFields: {
+        title: 'name',
+        key: 'id',
+        value: 'id',
+      },
+      maxTagCount: 10,
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    field: 'lymc',
+    label: '保管单位',
+    component: 'TreeSelect',
+    colProps: { span: 12 },
+    componentProps: {
+      replaceFields: {
+        title: 'name',
+        key: 'id',
+        value: 'id',
+      },
+      maxTagCount: 10,
+      getPopupContainer: () => document.body,
+    },
+  }, {
+    field: 'lymc',
+    label: '密级',
+    component: 'TreeSelect',
+    colProps: { span: 12 },
+    componentProps: {
+      replaceFields: {
+        title: 'name',
+        key: 'id',
+        value: 'id',
+      },
+      maxTagCount: 10,
+      getPopupContainer: () => document.body,
     },
-    maxTagCount: 10,
-    getPopupContainer: () => document.body,
-  },
-},
-{
-  field: 'lymc',
-  label: '保管单位',
-  component: 'TreeSelect',
-  colProps: { span: 12 },
-  componentProps: {
-    replaceFields: {
-      title: 'name',
-      key: 'id',
-      value: 'id',
+  }, {
+    field: 'lymc',
+    label: '坐标系',
+    component: 'TreeSelect',
+    colProps: { span: 12 },
+    componentProps: {
+      replaceFields: {
+        title: 'name',
+        key: 'id',
+        value: 'id',
+      },
+      maxTagCount: 10,
+      getPopupContainer: () => document.body,
     },
-    maxTagCount: 10,
-    getPopupContainer: () => document.body,
-  },
-},  {
-  field: 'lymc',
-  label: '密级',
-  component: 'TreeSelect',
-  colProps: { span: 12 },
-  componentProps: {
-    replaceFields: {
-      title: 'name',
-      key: 'id',
-      value: 'id',
+  },
+  {
+    field: 'lymc',
+    label: '数据范围',
+    component: 'Input',
+    colProps: { span: 12 },
+    componentProps: {
+      placeholder: '请输入',
     },
-    maxTagCount: 10,
-    getPopupContainer: () => document.body,
-  },
-},  {
-  field: 'lymc',
-  label: '坐标系',
-  component: 'TreeSelect',
-  colProps: { span: 12 },
-  componentProps: {
-    replaceFields: {
-      title: 'name',
-      key: 'id',
-      value: 'id',
+  },
+  {
+    field: 'lymc',
+    label: '数据来源',
+    component: 'Input',
+    colProps: { span: 12 },
+    componentProps: {
+      placeholder: '请输入',
     },
-    maxTagCount: 10,
-    getPopupContainer: () => document.body,
-  },
-},
-{
-  field: 'lymc',
-  label: '数据范围',
-  component: 'Input',
-  colProps: { span: 12 },
-  componentProps: {
-    placeholder: '请输入',
-  },
-},
-{
-  field: 'lymc',
-  label: '数据来源',
-  component: 'Input',
-  colProps: { span: 12 },
-  componentProps: {
-    placeholder: '请输入',
-  },
-},
-{
-  field: 'lymc',
-  label: 'EPSC CODE',
-  component: 'Input',
-  colProps: { span: 24 },
-  componentProps: {
-    placeholder: '请输入',
-  },
-},
+  },
+  {
+    field: 'lymc',
+    label: 'EPSC CODE',
+    component: 'Input',
+    colProps: { span: 24 },
+    componentProps: {
+      placeholder: '请输入',
+    },
+  },
 
-{
-  field: 'sjms',
-  label: '备注:',
-  component: 'InputTextArea',
-  colProps: { span: 24 },
-  componentProps: {
-    maxLength: 255,
-    placeholder: '请输入备注',
-  },
-},
+  {
+    field: 'sjms',
+    label: '备注:',
+    component: 'InputTextArea',
+    colProps: { span: 24 },
+    componentProps: {
+      maxLength: 255,
+      placeholder: '请输入备注',
+    },
+  },
 
-{
-  field: 'status',
-  label: "是否公开", //状态
-  component: 'RadioButtonGroup',
-  colProps: { span: 8 },
-  defaultValue: '0',
-  componentProps: {
-    options: [
-      { label: "是", value: '0' }, //启用
-      { label:"否", value: '1' }, //禁用
-    ],
-  },
-},
+  {
+    field: 'status',
+    label: "是否公开", //状态
+    component: 'RadioButtonGroup',
+    colProps: { span: 8 },
+    defaultValue: '0',
+    componentProps: {
+      options: [
+        { label: "是", value: '0' }, //启用
+        { label: "否", value: '1' }, //禁用
+      ],
+    },
+  },
 
-{
-  field: 'status',
-  label: "是否共享", //状态
-  component: 'RadioButtonGroup',
-  colProps: { span: 8 },
-  defaultValue: '0',
-  componentProps: {
-    options: [
-      { label: "是", value: '0' }, //启用
-      { label:"否", value: '1' }, //禁用
-    ],
-  },
-},
+  {
+    field: 'status',
+    label: "是否共享", //状态
+    component: 'RadioButtonGroup',
+    colProps: { span: 8 },
+    defaultValue: '0',
+    componentProps: {
+      options: [
+        { label: "是", value: '0' }, //启用
+        { label: "否", value: '1' }, //禁用
+      ],
+    },
+  },
 
-{
-  field: 'status',
-  label: "是否展开", //状态
-  component: 'RadioButtonGroup',
-  colProps: { span: 8 },
-  defaultValue: '0',
-  componentProps: {
-    options: [
-      { label: "是", value: '0' }, //启用
-      { label:"否", value: '1' }, //禁用
-    ],
-  },
-},
+  {
+    field: 'status',
+    label: "是否展开", //状态
+    component: 'RadioButtonGroup',
+    colProps: { span: 8 },
+    defaultValue: '0',
+    componentProps: {
+      options: [
+        { label: "是", value: '0' }, //启用
+        { label: "否", value: '1' }, //禁用
+      ],
+    },
+  },
 
-{
-  field: 'file',
-  label: '上传附件',
-  slot: 'upload',
-  required: true,
-  component: 'Input',
-  // componentProps: {
-  //   maxLength: 255,
-  // },
-},
+  {
+    field: 'file',
+    label: '上传附件',
+    slot: 'upload',
+    required: false,
+    component: 'Input',
+    // componentProps: {
+    //   maxLength: 255,
+    // },
+  },
 ]
 
 
@@ -328,4 +330,90 @@ export const accountFormSchema2 = [
       maxLength: 36,
     },
   },
-]
+  {
+    field: 'version',
+    label: '版本',
+    component: 'TreeSelect',
+    colProps: { span: 24 },
+    componentProps: {
+      replaceFields: {
+        title: 'name',
+        key: 'id',
+        value: 'id',
+      },
+      maxTagCount: 10,
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    field: 'versionCode',
+    label: '版本号',
+    component: 'Input',
+    colProps: { span: 24 },
+    componentProps: {
+      placeholder: '请输入版本号',
+    },
+  },
+  {
+    field: 'isnew',
+    label: "是否最新版本", //状态
+    component: 'RadioButtonGroup',
+    colProps: { span: 24 },
+    defaultValue: '0',
+    componentProps: {
+      options: [
+        { label: "是", value: '0' },
+        { label: "否", value: '1' },
+      ],
+    },
+  },
+]
+
+
+export const fileFields = [
+  {
+    title: '序号',
+    dataIndex: 'xh',
+    width: '10%',
+    align:'center'
+  },
+  {
+    title: '资源名称',
+    dataIndex: 'sname',
+    width: '20%',
+    slots: { customRender: 'sname' },
+  },
+  {
+    title: '资源编码',
+    dataIndex: 'scode',
+    width: '20%',
+    slots: { customRender: 'scode' },
+    align:'center'
+  },
+  {
+    title: '格式',
+    dataIndex: 'type',
+    width: '10%',
+    align:'center'
+  },
+  {
+    title: '缩略图',
+    dataIndex: 'operation',
+    width: '20%',
+    slots: { customRender: 'opera' },
+    align:'center'
+  },
+  {
+    title: '状态',
+    dataIndex: 'status',
+    width: '10%',
+    align:'center'
+  },
+  {
+    title: '操作',
+    dataIndex: 'operation',
+    width: '10%',
+    slots: { customRender: 'operation' },
+    align:'center'
+  },
+];

+ 116 - 91
src/views/dataAdmin/dataAdmin/fileResourceUpload/index.vue

@@ -1,19 +1,19 @@
 <!-- 文件型资源上传 -->
 <template>
-  <div style="height: 100%; width: 100%; margin-top: 0; padding: 0;">
+  <div style="height: 100%; width: 100%; margin-top: 0; padding: 0">
     <!-- 使用搜索框和表格封装组件 -->
     <BasicTable
-    :rowSelection="{ type: 'checkbox' }" 
-    @register="registerTable"
-    :clickToRowSelect="false"
+      :rowSelection="{ type: 'checkbox' }"
+      @register="registerTable"
+      :clickToRowSelect="false"
     >
-    <!-- 表格右上角按钮 -->
-    <template #toolbar>
+      <!-- 表格右上角按钮 -->
+      <template #toolbar>
         <!-- <Authority :value="authList.addAuth">
           <a-button type="primary" @click="addMethod" >新增文件</a-button>
         </Authority> -->
-        <Authority >
-          <a-button type="primary" @click="addMethod" >新增文件</a-button>
+        <Authority>
+          <a-button type="primary" @click="addMethod">新增文件</a-button>
         </Authority>
         <Authority :value="authList.deleteAuth">
           <Popconfirm
@@ -30,28 +30,28 @@
       <template #action="{ record }">
         <TableAction
           :actions="[
-                        {
+            {
               label: '浏览',
-              auth: 'api:yt:role:saveOrUpdateRoleInfoWithMenu:update',
-              icon: 'clarity:note-edit-line',//图标
+              //auth: 'api:yt:role:saveOrUpdateRoleInfoWithMenu:update',
+              //icon: 'clarity:note-edit-line', //图标
               onClick: handleEdit.bind(null, record),
             },
             {
               label: '查看',
-              auth: 'api:yt:role:saveOrUpdateRoleInfoWithMenu:update',
-              icon: 'clarity:note-edit-line',
+              //auth: 'api:yt:role:saveOrUpdateRoleInfoWithMenu:update',
+              //icon: 'clarity:note-edit-line',
               onClick: handleEdit.bind(null, record),
             },
             {
               label: '编辑',
-              auth: 'api:yt:role:saveOrUpdateRoleInfoWithMenu:update',
-              icon: 'clarity:note-edit-line',
+              //auth: 'api:yt:role:saveOrUpdateRoleInfoWithMenu:update',
+              //icon: 'clarity:note-edit-line',
               onClick: handleEdit.bind(null, record),
             },
             {
               label: '删除',
-              auth: 'api:yt:role:delete',
-              icon: 'ant-design:delete-outlined',
+              //auth: 'api:yt:role:delete',
+              //icon: 'ant-design:delete-outlined',
               color: 'error',
               ifShow: true,
               popConfirm: {
@@ -62,6 +62,26 @@
           ]"
         />
       </template>
+      <template #pdate="{ record }">
+        <Tag :color="'red'">
+          {{ record.publishdate ? moment(record.publishdate).format('YYYY-MM-DD HH:mm:ss') : '' }}
+        </Tag>
+      </template>
+      <template #status="{ record }">
+        <Tag :style="`color:${record.status === 3 || record.status === 3 ? 'red' : '#05B069'};`">
+          {{
+            record.status === 0
+              ? '待审核'
+              : record.status === 1
+              ? '审核通过'
+              : record.status === 2
+              ? '审核不通过'
+              : record.status === 3
+              ? '被驳回'
+              : '未提交'
+          }}
+        </Tag>
+      </template>
     </BasicTable>
     <!-- 新增和编辑 -->
     <!-- <RoleDrawer @register="registerDrawer" @success="handleSuccess" /> -->
@@ -75,98 +95,103 @@ import { BasicTable, TableAction, useTable } from '/@/components/Table';
 import { Authority } from '/@/components/Authority';
 import { useModal } from '/@/components/Modal';
 import { Popconfirm } from 'ant-design-vue';
-import { getFileListByPage, delFileResource  } from '../../api/fileUploadApi';
+import { getFileListByPage, delFileResource } from '../../api/fileUploadApi';
 import { columns, searchFormSchema } from './fileUploadData';
-// 
+import { list } from '/@/api/resource/files';
 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
-
 import AddMethod from './AddMethod.vue';
+import Moment from 'moment';
 
 export default defineComponent({
   name: 'mapUpload',
-  components: { BasicTable, Authority, Popconfirm, TableAction, AddMethod},
+  components: { BasicTable, Authority, Popconfirm, TableAction, AddMethod },
   setup() {
     //按钮的权限控制标识
-    const bottomAuthority = "api:dataresource:fileupload:";
+    const bottomAuthority = 'api:dataresource:fileupload:';
     const authList = {
-      addAuth: bottomAuthority + "fileuploadAdd",//新增权限控制
-      deleteAuth: bottomAuthority + "fileuploadDelete",//删除权限控制
-      editAuth: bottomAuthority + "fileuploadEdit",//编辑权限控制
-    }
+      addAuth: bottomAuthority + 'fileuploadAdd', //新增权限控制
+      deleteAuth: bottomAuthority + 'fileuploadDelete', //删除权限控制
+      editAuth: bottomAuthority + 'fileuploadEdit', //编辑权限控制
+    };
+    const moment = Moment;
     // 新增和编辑界面
     // const [registerDrawer, { openDrawer }] = useDrawer();
     const [registerModal, { openModal: openModal }] = useModal();
     // 新增和编辑界面操作函数
     function handleSuccess() {
-        reload();
-      };
+      reload();
+    }
     // 配置下方表格
     const [registerTable, { setProps, reload, setSelectedRowKeys }] = useTable({
       // 表格题目
-        title: '文件型资源列表',
-        // 分页查询请求函数
-        api: getFileListByPage,
-        // 表头
-        columns,
-        // 查询条件框配置
-        formConfig: {
-          labelWidth: 120,
-          schemas: searchFormSchema,
-        },
-        useSearchForm: true,
-        showTableSetting: true,
-        bordered: true,
-        // 表格控制序号显示
-        showIndexColumn: true,
-        // 表格操作栏
-        actionColumn: {
-          width: 200,
-          title: '操作',
-          dataIndex: 'action',
-          slots: { customRender: 'action' },
-          fixed: 'right',
-        },
-      });
-      // 
-      const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } = useBatchDelete(delFileResource, handleSuccess, setProps);
-      // 
-      selectionOptions.rowSelection.getCheckboxProps = (record) => {
-        // Demo:status为1的选择框禁用
-        if (record.status === 1) {
-          return { disabled: true };
-        } else {
-          return { disabled: false };
-        }
-      };
-      // 
-      nextTick(() => {
-        setProps(selectionOptions);
+      title: '文件型资源列表',
+      // 分页查询请求函数
+      api: list,
+      // 表头
+      columns,
+      // 查询条件框配置
+      formConfig: {
+        labelWidth: 120,
+        schemas: searchFormSchema,
+      },
+      useSearchForm: true,
+      showTableSetting: true,
+      bordered: true,
+      // 表格控制序号显示
+      showIndexColumn: true,
+      // 表格操作栏
+      actionColumn: {
+        width: 200,
+        title: '操作',
+        dataIndex: 'action',
+        slots: { customRender: 'action' },
+        fixed: 'right',
+      },
+      pagination: {
+        hideOnSinglePage: false,
+      },
+    });
+    //
+    const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } =
+      useBatchDelete(delFileResource, handleSuccess, setProps);
+    //
+    selectionOptions.rowSelection.getCheckboxProps = (record) => {
+      // Demo:status为1的选择框禁用
+      if (record.status === 1) {
+        return { disabled: true };
+      } else {
+        return { disabled: false };
+      }
+    };
+    //
+    nextTick(() => {
+      setProps(selectionOptions);
+    });
+    // 新增
+    function addMethod() {
+      openModal(true, {
+        isUpdate: false,
       });
-      // 新增
-      function addMethod(){
-        openModal(true, {
-          isUpdate: false,
-        });
-      };
-      // 编辑
-      function handleEdit(record) {
-        // openDrawer(true, {
-        //   record,
-        //   isUpdate: true,
-        // });
-      };
-
-      return {
-        registerModal,
-        authList,
-        registerTable,
-        addMethod,
-        handleEdit,
-        handleSuccess,
-        hasBatchDelete,
-        handleDeleteOrBatchDelete,
-      };
+    }
+    // 编辑
+    function handleEdit(record) {
+      // openDrawer(true, {
+      //   record,
+      //   isUpdate: true,
+      // });
+    }
 
+    return {
+      moment,
+      registerModal,
+      authList,
+      registerTable,
+      addMethod,
+      handleEdit,
+      handleSuccess,
+      hasBatchDelete,
+      handleDeleteOrBatchDelete,
+    };
   },
-})
+});
 </script>

+ 126 - 0
src/views/dataAdmin/dataAdmin/fileResourceUpload/uploadFileList.vue

@@ -0,0 +1,126 @@
+<template>
+  <a-table :columns="columns" :dataSource="dataSource" bordered :customRow="rowClick">
+    <template v-for="col in ['scode', 'sname']" #[col]="{ text, record }" :key="col">
+      <span>
+        <a-input
+          v-if="editableData[record.key]"
+          v-model:value="editableData[record.key][col]"
+          style="margin: -5px 0"
+          @mouseleave="mouseleave(editableData, record.key, col)"
+        />
+        <template v-else>
+          {{ text }}
+        </template>
+      </span>
+    </template>
+    <template #opera="{ record }">
+      <a-upload v-model:file-list="imgList" name="file" :multiple="false" action="">
+        <span
+          style="
+            color: #0671dd;
+            font-size: 14px;
+            font-weight: 500;
+            line-height: 16px;
+            letter-spacing: 0px;
+          "
+          >选择</span
+        >
+      </a-upload>
+    </template>
+    <template #operation="{ record }">
+      <DeleteOutlined
+        style="
+          color: #f8252c;
+          font-size: 16px;
+          font-weight: 500;
+          line-height: 16px;
+          cursor: pointer;
+        "
+        @click="del(record)"
+      />
+    </template>
+  </a-table>
+</template>
+  <script lang="ts">
+import { defineComponent, ref, computed, unref, reactive, onMounted,watch } from 'vue';
+import { DeleteOutlined } from '@ant-design/icons-vue';
+import { cloneDeep } from 'lodash-es';
+import { fileFields } from './fileUploadData';
+const props = {
+    fileList:{type:Array,default:[]}
+}
+export default defineComponent({
+  name: 'AccountModal',
+  components: { DeleteOutlined },
+  emits: ['success', 'register'],
+  props,
+  setup(props, { emit }) {
+    const fileList =  ref(props.fileList);
+    let imgList = ref([])
+    let editableData = reactive({});
+    onMounted(async () => {});
+    const columns = fileFields;
+    let dataSource = [
+      {
+        xh: 1,
+        key: 'A001',
+        sname: '资源名称',
+        scode: 's-001',
+        type: 'ppt',
+        operation: '',
+        status: '已提交',
+      },
+      {
+        xh: 2,
+        key: 'A002',
+        sname: '资源名称1',
+        scode: 's-002',
+        type: 'ppt',
+        operation: '',
+        status: '已提交',
+      },
+    ];
+    watch(()=>props.fileList,(list)=>{
+        fileList.value = list
+        console.log('上传数据列表',list)
+    })
+
+    const rowClick = (record, index) => {
+      return {
+        onclick: () => {
+          editableData[record.key] = cloneDeep(record);
+        },
+        onContextmenu: (event) => {},
+        onMouseenter: (event) => {}, // 鼠标移入行
+        onMouseleave: (event) => {},
+      };
+    };
+    const mouseleave = (editData, key, col) => {
+      const updateValue = editData[key][col];
+      //保存数据
+      dataSource.forEach((item) => {
+        if (item.key === key && updateValue != '') item[col] = updateValue;
+      });
+      //清空editableData
+      //editableData = reactive({});
+    };
+    const del = (row) => {
+      editableData = reactive({});
+      dataSource = dataSource.filter((item) => item.key != row.key);
+    };
+    return {
+      columns,
+      dataSource,
+      editableData,
+      rowClick,
+      mouseleave,
+      fileList,
+      imgList,
+      del,
+    };
+  },
+});
+</script>
+  <style scoped lang="less">
+</style>
+  

+ 4 - 1
src/views/dataAdmin/dataAdmin/mapUpload/index.vue

@@ -67,7 +67,7 @@
       </template>
       <template #status="{ record }">
         <Tag
-          :style="`color:${ record.status === 3 || record.status === 3 ? 'red' : '' };`"
+          :style="`color:${ record.status === 3 || record.status === 3 ? 'red' : '#05B069' };`"
         >
           {{
            record.status === 0 ? '待审核' : (record.status === 1 ? '审核通过' : (record.status === 2 ? '审核不通过' : ( record.status === 3 ? '被驳回' : '未提交' )))
@@ -121,6 +121,9 @@ export default defineComponent({
         slots: { customRender: 'action' },
         fixed: 'right',
       },
+      pagination: {
+        hideOnSinglePage: false,
+      },
     });
     const moment = Moment
     const { createMessage } = useMessage();

+ 3 - 0
src/views/dataAdmin/dataAdmin/sceneResourceUpload/index.vue

@@ -149,6 +149,9 @@ export default defineComponent({
         slots: { customRender: 'action' },
         fixed: 'right',
       },
+      pagination: {
+        hideOnSinglePage: false,
+      },
     });
     //
     const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } =

+ 21 - 24
src/views/resource/examine/index.vue

@@ -2,19 +2,22 @@
   <div class="examine-container">
     <div class="left-container">
       <template v-for="source in sourceTypes" :key="source.name">
-        <div class="soure-item-row" :class="{active:current===source.name}" @click="current = source.name">
+        <div
+          class="soure-item-row"
+          :class="{ active: current === source.name }"
+          @click="current = source.name"
+        >
           {{ `${source.name}(${source.num})` }}
         </div>
       </template>
     </div>
     <div class="right-container">
-      <BasicTable
-        :rowSelection="{ type: 'checkbox' }"
-        @register="registerTable"
-      >
+      <BasicTable :rowSelection="{ type: 'checkbox' }" rowKey="serviceid" @register="registerTable">
         <template #toolbar>
           <Authority>
-            <a-button type="primary" @click="batchExamine" :disabled="hasBatchDelete">批量审核</a-button>
+            <a-button type="primary" @click="batchExamine" :disabled="hasBatchDelete"
+              >批量审核</a-button
+            >
           </Authority>
         </template>
 
@@ -86,12 +89,12 @@ export default defineComponent({
   name: 'RoleManagement',
   components: { BasicTable, MapSourceModal, TableAction, Authority, Switch, Popconfirm },
   setup() {
-    let current=ref('地图资源');
+    let current = ref('地图资源');
     //const [registerDrawer, { openDrawer }] = useDrawer();
     const [registerModal, { openModal }] = useModal();
-    const [registerTable, { setProps, reload, getSelectRowKeys, getRowSelection, getSelectRows,setSelectedRowKeys, }] = useTable({
+    const [registerTable, { getSelectRows, setProps, reload, setSelectedRowKeys }] = useTable({
       title: '地图资源列表',
-      api: list,   //求接口
+      api: list, //求接口
       //dataSource: dataSources, //表格的数据
       columns,
       rowKey: 'serviceid',
@@ -114,10 +117,10 @@ export default defineComponent({
         hideOnSinglePage: false,
       },
       clickToRowSelect: true, //点击当前行多选框不选中,默认是true
-      rowSelection: { type: 'checkbox' },   //是否有多选功能
+      rowSelection: { type: 'checkbox' }, //是否有多选功能
     });
     const moment = Moment;
-   
+
     const sourceTypes = ref([
       { name: '地图资源', num: 4 },
       { name: '场景资源', num: 5 },
@@ -188,15 +191,9 @@ export default defineComponent({
       }
     };
     const batchExamine = () => {
-      const row = getSelectRows()
-      const ids = getSelectRowKeys()
-      const sle = getRowSelection()
-      console.log('获取行',row)
-      console.log('获取id',ids)
-      console.log('获取se',sle)
+      console.log('审核数据',getSelectRows())
     };
 
-
     onBeforeMount(async () => {});
 
     return {
@@ -232,18 +229,18 @@ export default defineComponent({
     .soure-item-row {
       height: 34px;
       width: 100%;
-      margin:20px 0;
+      margin: 20px 0;
       line-height: 34px;
-      text-align: center;;
+      text-align: center;
       font-size: 14px;
       font-weight: normal;
       letter-spacing: 0px;
       color: #333333;
-      background: #EFF0F5;
-      border-radius:2px;
+      background: #eff0f5;
+      border-radius: 2px;
     }
-    .active{
-      background: #0671DD;
+    .active {
+      background: #0671dd;
       color: #fff;
     }
   }