Sfoglia il codice sorgente

组件和文件的代理中心修改

sujunling 1 anno fa
parent
commit
ac605ddce3

+ 2 - 2
src/views/authorize/app/index.vue

@@ -4,7 +4,7 @@
       <div class="left-search-input">
         <div class="input">
           <span>关键字</span>
-          <a-input allowClear v-model:value="searchValue" style="width: 200px;" placeholder="请输入关键字"></a-input>
+          <a-input allowClear v-model:value="searchValue" style="width: 200px;" placeholder="请输入系统名称"></a-input>
         </div>
       </div>
       <div class="right-btns">
@@ -15,7 +15,7 @@
     <div class="bottom-table">
       <BasicTable @register="registerTable" class="basic-table">
         <template #toolbar>
-          <a-button type="primary" @click="handleAdd">新增应用</a-button>
+          <a-button type="primary" @click="handleAdd">新增</a-button>
         </template>
         <template #action="{ record }">
           <TableAction :actions="[

+ 2 - 2
src/views/authorize/empower/AuditModal.vue

@@ -50,7 +50,7 @@
                                 </a-form-item>
                             </a-col>
                         </a-row>
-                        <a-row>
+                        <!-- <a-row>
                             <a-col :span="10">
                                 <a-form-item label="审核时间" name="passtime">
                                     <a-input v-model:value="form.passtime" style="width: 100%" disabled />
@@ -61,7 +61,7 @@
                                     <a-input v-model:value="form.user" style="width: 100%" disabled />
                                 </a-form-item>
                             </a-col>
-                        </a-row>
+                        </a-row> -->
                     </a-form>
                 </div>
             </div>

+ 46 - 2
src/views/dataAdmin/assembly/SourceDetail.vue

@@ -30,8 +30,18 @@
             </a-form-item>
           </a-col>
           <a-col :span="24" class="form-col">
-            <a-form-item ref="bz" label="授权文件" name="bz" class="label-form-item">
+            <!-- <a-form-item ref="bz" label="授权文件" name="bz" class="label-form-item">
               <a-input v-model:value="formState.bz" placeholder="请输入授权文件地址" :disabled="isView" />
+            </a-form-item> -->
+            <a-form-item ref="bz" label="授权文件" name="bz" class="label-form-item">
+              <a-upload :beforeUpload="beforeUploadImg" :remove="removeImgJS" :custom-request="customUploadJS"
+                v-model:file-list="fileList2" :disabled="isViewImg">
+                <a-button style="background-color: #0671dd; color: #fff; border-radius: 4px" :disabled="isView">
+                  <upload-outlined></upload-outlined>
+                  文件授权上传
+                </a-button>
+              </a-upload>
+              <!-- <span class="updateImg" @click="imgBut2" v-if="!isView"></span> -->
             </a-form-item>
           </a-col>
           <!-- <a-col :span="9" class="form-col">
@@ -145,6 +155,7 @@ export default defineComponent({
     });
 
     var fileList = ref([]);
+    var fileList2 = ref([]);
     var isViewImg = ref(false);
     var assemblyType = ref([
       { value: '地图浏览工具', label: '地图浏览工具', },
@@ -177,7 +188,7 @@ export default defineComponent({
     const moment = Moment;
     const rules = {
       // mapingurl: [{ required: true, message: '请输入服务地址', trigger: 'blur' }],
-      bz: [{ required: true, message: '请输入授权文件地址', trigger: 'blur' }],
+      // bz: [{ required: true, message: '请输入授权文件地址', trigger: 'blur' }],
       servicetype: [{ required: true, message: '请选择资源类型', trigger: 'change' }],
 
       servicename: [
@@ -245,6 +256,7 @@ export default defineComponent({
                 if (res && res?.status !== '-1') {
                   createMessage.success('修改组件资源成功!');
                   fileList.value = [];
+                  fileList2.value = [];
                   resetForm();
                   emit('RtnMain', true);
                 } else createMessage.error('修改组件资源失败!,失败原因:' + res?.message, 1);
@@ -253,6 +265,7 @@ export default defineComponent({
                 if (res && res?.status !== '-1') {
                   createMessage.success('新增组件资源成功!');
                   fileList.value = [];
+                  fileList2.value = [];
                   resetForm();
                   emit('RtnMain', true);
                 } else createMessage.error('新增组件资源失败!,失败原因:' + res?.message, 1);
@@ -271,6 +284,7 @@ export default defineComponent({
     const resetForm = () => {
       formState.mapingurl = '';
       fileList.value = [];
+      fileList2.value = [];
       formRef.value.resetFields();
     };
 
@@ -355,6 +369,10 @@ export default defineComponent({
       formState.mapingurl = '';
     }
 
+    function removeImgJS() {
+      formState.bz = '';
+    }
+
     function imgBut() {
       if (fileList.value.length) {
         return message.error('只能上传一个文件,请先删除之前的文件!')
@@ -363,6 +381,14 @@ export default defineComponent({
       }
     }
 
+    function imgBut2() {
+      if (fileList2.value.length) {
+        return message.error('只能上传一个文件,请先删除之前的文件!')
+      } else if (fileList2.value.length == 0) {
+        document.getElementById("thumbnail").click()
+      }
+    }
+
     function customUpload({ file, onSuccess, onError }) {
       const formData = new FormData();
       formData.append('file', file);
@@ -377,6 +403,20 @@ export default defineComponent({
       })
     }
 
+    function customUploadJS({ file, onSuccess, onError }) {
+      const formData = new FormData();
+      formData.append('file', file);
+      update(formData, session.getItem('sysFild').dirId).then(r => {
+        if (r && r.resp_code == 0 && r.resp_msg == "OK") {
+          formState.bz = `${r.datas.id},${r.datas.dirId}`;
+          // isViewImg.value = true;
+          onSuccess()
+        } else {
+          onError()
+        }
+      })
+    }
+
     //获取图片
     function getImg(i) {
       if (i) {
@@ -388,14 +428,18 @@ export default defineComponent({
       }
     }
     return {
+      removeImgJS,
       imgBut,
       removeImg,
       beforeUploadImg,
       getImg,
+      imgBut2,
       fileList,
+      fileList2,
       isViewImg,
       assemblyType,
       customUpload,
+      customUploadJS,
       ...toRefs(data),
       formRef,
       moment,

+ 3 - 0
src/views/dataAdmin/dataAdmin/fileResourceUpload/AddMethod.vue

@@ -258,6 +258,7 @@ export default defineComponent({
               servicealiasname: item['fileCode'],
               fileListUrls: item['fileId'],
               thumbnail: item['thumbnail'],
+              bz: item['bz'],
             };
             let postFormData = {
               type: 'DR',
@@ -366,6 +367,7 @@ export default defineComponent({
         if (r && r['resp_code'] === 0) {
           const datas = r['datas'] as any;
           const mapingurl = `${datas.id},${datas.dirId}`;
+          const bz = `${datas.id},${datas.dirId}`;
           const objFile = {
             fileId: datas.id,
             fileName: datas.fileName.split('.')[0], //文件名称
@@ -375,6 +377,7 @@ export default defineComponent({
             status: '上传成功', //状态
             mapingurl: mapingurl,
             file: file,
+            bz: bz,
           };
           fileList.value.push(objFile);
         } else {

+ 10 - 10
src/views/dataAdmin/dataAdmin/fileResourceUpload/fileUploadData.js

@@ -293,16 +293,16 @@ export const accountFormSchema = [
   //     options: ApplProcesses
   //   },
   // },
-  {
-    field: 'bz',
-    label: '备注:',
-    component: 'InputTextArea',
-    colProps: { span: 24 },
-    componentProps: {
-      maxLength: 255,
-      placeholder: '请输入备注',
-    },
-  },
+  // {
+  //   field: 'bz',
+  //   label: '备注:',
+  //   component: 'InputTextArea',
+  //   colProps: { span: 24 },
+  //   componentProps: {
+  //     maxLength: 255,
+  //     placeholder: '请输入备注',
+  //   },
+  // },
 
   {
     field: 'runtimestatus',

+ 0 - 379
src/views/resource/proxy/index copy.vue

@@ -1,379 +0,0 @@
-<template>
-  <div class="examine-container">
-    <div class="left-container">
-      <template v-for="source in sourceTypes" :key="source.SERVICETYPE">
-        <div class="soure-item-row" :class="{ active: current === source.SERVICETYPE }" @click="selectHandle(source)">
-          {{ source.name }}
-        </div>
-      </template>
-    </div>
-    <div class="right-container">
-      <BasicTable @register="registerTable" @fetch-success="onFetchSuccess">
-        <template #toolbar>
-          <Authority>
-            <a-button type="primary" @click="showModalBatch">IP管理</a-button>
-          </Authority>
-        </template>
-
-        <template #action="{ record }">
-          <TableAction :actions="[
-            {
-              label: 'IP管理',
-              onClick: showModal.bind(null, record),
-            },
-            // {
-            //   label: '删除',
-            //   onClick: handleDel.bind(null, record),
-            // },
-          ]" />
-        </template>
-      </BasicTable>
-    </div>
-    <a-modal v-model:visible="visible" :label-col="labelCol" :wrapper-col="wrapperCol" title="IP管理" @ok="handleOk">
-      <div class="wapper">
-        <p><span>IP地址:&nbsp;</span><a-input v-model:value="formState.ipaddress" /></p>
-        <p><span>服务ID:&nbsp;</span><a-input v-model:value="formState.serviceid" /></p>
-      </div>
-      <span style="clear: both;"></span>
-    </a-modal>
-  </div>
-</template>
-<script lang="ts">
-import { defineComponent, nextTick, ref, watch } from 'vue';
-import { BasicTable, useTable, TableAction } from '/@/components/Table';
-import { delRole, setRoleStatus } from '/@/api/system/system';
-import {
-  columns,
-  searchFormSchemaMR,
-  searchFormSchemaER,
-  searchFormSchemaDR,
-  searchFormSchemaSR,
-} from './map.data';
-import { RoleEnum } from '/@/enums/roleEnum';
-import { Authority } from '/@/components/Authority';
-import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
-import { Switch, Popconfirm, message } from 'ant-design-vue';
-import Moment from 'moment';
-import { getProxyList, proxySave, proxyDel } from '/@/api/resource/proxy';
-import { useModal } from '/@/components/Modal';
-import { useRouter } from 'vue-router';
-import { useAppStore } from '/@/store/modules/app';
-
-export default defineComponent({
-  name: 'RoleManagement',
-  components: {
-    BasicTable,
-    TableAction,
-    Authority,
-    Switch,
-    Popconfirm
-  },
-  setup() {
-    const appStore = useAppStore();
-    const { currentRoute } = useRouter();
-    const currRoute = currentRoute.value;
-    let current = ref(currRoute?.query?.type || 'MR');
-    let statusShow = ref(1);
-    const [registerTable, { getSelectRows, setProps, reload, setSelectedRowKeys, getDataSource, getSelectRowKeys }] = useTable({
-      title: '地图资源审核列表',
-      api: (param) => {
-        statusShow.value = param.checkStatus;
-        const data = Object.assign(param, { serviceType: current.value });
-        return getProxyList(data);
-      }, //求接口
-      //dataSource: dataSources, //表格的数据
-      columns,
-      // rowKey: (record) => record.SERVICEID,
-      rowKey: 'id',
-      formConfig: {
-        labelWidth: 90,
-        schemas: searchFormSchemaMR,
-      },
-      useSearchForm: true,
-      showTableSetting: true,
-      bordered: true,
-      showIndexColumn: true,
-      actionColumn: {
-        width: 200,
-        title: '操作',
-        dataIndex: 'action',
-        slots: { customRender: 'action' },
-        fixed: 'right',
-      },
-      pagination: {
-        hideOnSinglePage: false,
-        // pageSize: 10,
-      },
-      clickToRowSelect: true, //点击当前行多选框不选中,默认是true
-      rowSelection: { type: 'checkbox' }, //是否有多选功能
-      tableSetting: {
-        redo: true,
-        size: true,
-        setting: false,
-        fullScreen: false,
-      },
-    });
-
-    const onFetchSuccess = () => {
-      // 请求后拿到数据,打开对应的资源审核弹窗
-      nextTick(() => {
-        let dataList = getDataSource()
-        if (currRoute?.query?.bussid && appStore.routerPushAuditFlag) {
-          dataList.forEach(item => {
-            item.BUSSID === currRoute.query.bussid && handleEdit(item)
-          })
-          let searchFormSchema = searchFormSchemaMR;
-          let title = '地图资源审核列表';
-          if (current.value === 'MR') {
-            searchFormSchema = searchFormSchemaMR;
-            title = '地图资源审核列表';
-          } else if (current.value === 'ER') {
-            searchFormSchema = searchFormSchemaER;
-            title = '场景资源审核列表';
-          } else if (current.value === 'DR') {
-            searchFormSchema = searchFormSchemaDR;
-            title = '文件资源审核列表';
-          } else {
-            searchFormSchema = searchFormSchemaSR;
-            title = '组件资源审核列表';
-          }
-          setProps({
-            title: title,
-            formConfig: {
-              labelWidth: 90,
-              schemas: searchFormSchema,
-            },
-          });
-        }
-      });
-    }
-
-    const moment = Moment;
-    const ischect = ref(true)
-    const sourceTypes = ref([
-      { SERVICETYPE: 'MR', name: '地图资源' },
-      { SERVICETYPE: 'ER', name: '场景资源' },
-      { SERVICETYPE: 'DR', name: '文件资源' },
-      { SERVICETYPE: 'SR', name: '组件资源' },
-    ]);
-    const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions, resetSelectedRowKeys } =
-      useBatchDelete(delRole, handleSuccess, setProps);
-    selectionOptions.rowSelection.getCheckboxProps = (record: Recordable) => {
-      // Demo:status为1的选择框禁用
-      // if (record.status === 1) {
-      //   return { disabled: true };
-      // } else {
-      //   return { disabled: false };
-      // }
-    };
-    const [registerModal, { openModal }] = useModal();
-    watch(
-      () => current.value, (val) => {
-        let searchFormSchema = searchFormSchemaMR;
-        let title = '地图资源审核列表';
-        if (val === 'MR') {
-          searchFormSchema = searchFormSchemaMR;
-          title = '地图资源审核列表';
-        } else if (val === 'ER') {
-          searchFormSchema = searchFormSchemaER;
-          title = '场景资源审核列表';
-        } else if (val === 'DR') {
-          searchFormSchema = searchFormSchemaDR;
-          title = '文件资源审核列表';
-        } else {
-          searchFormSchema = searchFormSchemaSR;
-          title = '组件资源审核列表';
-        }
-        setProps({
-          title: title,
-          formConfig: {
-            labelWidth: 90,
-            schemas: searchFormSchema,
-          },
-        });
-        reload();
-      }
-    );
-    nextTick(() => {
-      setProps(selectionOptions);
-    });
-
-    function selectHandle(record) {
-      current.value = record.SERVICETYPE;
-    }
-
-    /**
-     * 详情
-     */
-    async function handleDel(record: Recordable) {
-      console.log(record);
-      record.serviceid = record.SERVICEID;
-      record.ipaddress = record.IPS
-      proxyDel({
-        serviceid: record.SERVICEID,
-        serviceType: record.SERVICETYPE,
-        ipaddress: record.IPS
-      }).then((r) => {
-        if (r) {
-          message.success(r.resp_msg);
-          reload();
-        } else {
-          message.error('删除代理失败!');
-        }
-      })
-    }
-
-    /**
-     * 审核
-     */
-    function handleEdit(record: Recordable) {
-      ischect.value = true;
-      setTimeout(() => {
-        openModal(true, {
-          record,
-          isUpdate: true,
-        });
-        appStore.setRouterPushAuditFlag(false)
-      }, 100);
-    }
-
-
-    function handleSuccess() {
-      openModal(false, {
-        isUpdate: false,
-      });
-      reload();
-    }
-
-    const visible = ref(false);
-
-    const disabled = ref(true);
-    const showModal = (e) => {
-      console.log(e);
-      visible.value = true;
-      disabled.value = e ? true : false;
-      if (e) {
-        formState.value.serviceid = e.SERVICEID;
-        formState.value.ipaddress = e.IPS;
-      }
-    };
-
-    function showModalBatch() {
-      var list = getSelectRowKeys();
-      if (list.length) {
-        formState.value.serviceid = list.join(',');
-        visible.value = true;
-      }
-    };
-
-    function handleOk() {
-      proxySave(formState.value).then((r) => {
-        if (r.resp_code == 0) {
-          visible.value = false;
-          formState.value.ipaddress = '';
-          formState.value.serviceid = '';
-          message.success('保存成功');
-          reload();
-          setSelectedRowKeys([]);
-        } else {
-          message.error(r.resp_msg);
-        }
-      })
-    };
-    const formState = ref({
-      ipaddress: "",
-      serviceid: ""
-    });
-
-
-    return {
-      showModalBatch,
-      disabled,
-      labelCol: { span: 2 },
-      wrapperCol: { span: 6 },
-      formState,
-      visible,
-      handleOk,
-      showModal,
-      statusShow,
-      current,
-      moment,
-      ischect,
-      sourceTypes,
-      registerTable,
-      registerModal,
-      handleDel,
-      handleEdit,
-      handleSuccess,
-      RoleEnum,
-      hasBatchDelete,
-      handleDeleteOrBatchDelete,
-      selectHandle,
-      onFetchSuccess
-    };
-  },
-});
-</script>
-<style scoped lang="less">
-.wapper {
-  padding: 20px;
-  height: 130px;
-}
-
-.wapper p {
-  margin-bottom: 10px;
-  height: 43px;
-}
-
-.wapper p span {
-  float: left;
-  height: 32px;
-  line-height: 32px;
-}
-
-.wapper p input {
-  float: left;
-  width: 430px;
-}
-
-.examine-container {
-  display: flex;
-  height: 100%;
-  width: 100%;
-
-  .left-container {
-    width: 240px;
-    height: calc(100% - 32px);
-    margin: 16px 0 16px 10px;
-    padding: 10px 20px;
-    background-color: #fff;
-    border-radius: 2px;
-
-    .soure-item-row {
-      height: 34px;
-      width: 100%;
-      margin: 20px 0;
-      line-height: 34px;
-      text-align: center;
-      font-size: 14px;
-      font-weight: normal;
-      letter-spacing: 0px;
-      color: #333333;
-      background: #eff0f5;
-      border-radius: 2px;
-      cursor: pointer;
-    }
-
-    .active {
-      background: #0671dd;
-      color: #fff;
-    }
-  }
-
-  .right-container {
-    width: calc(100% - 260px);
-    height: 100%;
-  }
-}
-</style>
-

+ 22 - 3
src/views/resource/proxy/index.vue

@@ -15,10 +15,16 @@
           </Authority>
         </template>
         <template #PUBLICCURL="{ record }">
-          {{ record.PUBLICCURL }}
+          <span v-if='current == "MR"||current == "ER"'>{{ record.PUBLICCURL }}</span> 
+        </template>
+        <template #index="{ index }">
+        {{ index + 1 }}
         </template>
         <template #MAPINGURL="{ record }">
-          {{ record.MAPINGURL }}
+          <span v-if='current == "MR"||current == "ER"'>{{ record.MAPINGURL }}</span>
+          <a :id="record.MAPINGURL" :href="getImg(record.MAPINGURL)" target="downloadFile" download v-else>
+            <button v-if="record?.MAPINGURL?.indexOf(',') > -1">下载文件</button>
+          </a>
         </template>
         <template #action="{ record }">
           <TableAction :actions="[
@@ -82,6 +88,7 @@ import { getProxyList, proxySave, proxyDel } from '/@/api/resource/proxy';
 import { useModal } from '/@/components/Modal';
 import { useRouter } from 'vue-router';
 import { useAppStore } from '/@/store/modules/app';
+import { getImgUrl } from '/@/api/dataAdmin/assembly';
 
 export default defineComponent({
   name: 'RoleManagement',
@@ -116,7 +123,7 @@ export default defineComponent({
       useSearchForm: true,
       showTableSetting: true,
       bordered: true,
-      showIndexColumn: true,
+      showIndexColumn: false,
       actionColumn: {
         width: 50,
         title: '操作',
@@ -320,7 +327,19 @@ export default defineComponent({
       formState.value.ipaddressList.push('');
     }
 
+    //获取图片
+    function getImg(i) {
+      if (i) {
+        var arr = i.split(',')
+        arr.length > 1 && getImgUrl(arr[0], arr[1]).then(r => {
+          var d = document.getElementById(i);
+          if (d) d.href = r;
+        })
+      }
+    }
+
     return {
+      getImg,
       add,
       remove,
       showModalBatch,

+ 21 - 16
src/views/resource/proxy/map.data.ts

@@ -1,12 +1,9 @@
 import { BasicColumn } from '/@/components/Table';
 import { FormSchema } from '/@/components/Table';
 
-
-
-
 /**
  * 查询条件
-*/
+ */
 export const searchFormSchemaMR: FormSchema[] = [
   {
     field: 'keyStr',
@@ -16,12 +13,12 @@ export const searchFormSchemaMR: FormSchema[] = [
     componentProps: {
       maxLength: 255,
     },
-  }
+  },
 ];
 
 /**
  * 查询条件
-*/
+ */
 export const searchFormSchemaER: FormSchema[] = [
   {
     field: 'keyStr',
@@ -31,12 +28,12 @@ export const searchFormSchemaER: FormSchema[] = [
     componentProps: {
       maxLength: 255,
     },
-  }
+  },
 ];
 
 /**
  * 查询条件
-*/
+ */
 export const searchFormSchemaDR: FormSchema[] = [
   {
     field: 'keyStr',
@@ -46,12 +43,12 @@ export const searchFormSchemaDR: FormSchema[] = [
     componentProps: {
       maxLength: 255,
     },
-  }
+  },
 ];
 
 /**
  * 查询条件
-*/
+ */
 export const searchFormSchemaSR: FormSchema[] = [
   {
     field: 'keyStr',
@@ -64,11 +61,15 @@ export const searchFormSchemaSR: FormSchema[] = [
   },
 ];
 
-
 /**
  * 列表显示信息
-*/
+ */
 export const columns: BasicColumn[] = [
+  {
+    title: '序号',
+    slots: { customRender: 'index' },
+    width: 50
+  },
   {
     title: '资源类型',
     dataIndex: 'SERVICEID',
@@ -76,8 +77,14 @@ export const columns: BasicColumn[] = [
     // slots: { customRender: 'SERVICEID' },
     sorter: true,
     customRender: ({ record }) => {
-      var s = record.SERVICEID
-      return s.indexOf('MR') > -1 ? '地图' : s.indexOf('ER') > -1 ? '场景' : s.indexOf('DR') > -1 ? '文件' : '组件';
+      var s = record.SERVICEID;
+      return s.indexOf('MR') > -1
+        ? '地图'
+        : s.indexOf('ER') > -1
+        ? '场景'
+        : s.indexOf('DR') > -1
+        ? '文件'
+        : '组件';
     },
   },
   {
@@ -97,11 +104,9 @@ export const columns: BasicColumn[] = [
     slots: { customRender: 'MAPINGURL' },
     width: 160,
   },
-
   {
     title: '限制指定IP',
     dataIndex: 'IPS',
     width: 120,
   },
 ];
-