Browse Source

共享字段

maxiaoxiao 9 tháng trước cách đây
mục cha
commit
ca3888f715

+ 14 - 0
src/api/shared.js

@@ -39,6 +39,13 @@ export function listZyml(params) {
         params
     })
 }
+export function Getdict(params) {
+    return request({
+        url: '/system/dict/data/list',
+        method: 'get',
+        params
+    })
+}
 // 共享位置
 export function Getfiledslist(params) {
     return request({
@@ -47,6 +54,13 @@ export function Getfiledslist(params) {
         params
     })
 }
+export function shareZyml(data) {
+    return request({
+        url: '/apply/share/configuration/zyml',
+        method: 'put',
+        data
+    })
+}
 
 export function fileds(data) {
     return request({

+ 7 - 1
src/components/mapView/tablePage.vue

@@ -10,6 +10,8 @@
       header-row-class-name="datatable"
       row-class-name="datarow"
       fit
+      :tree-props="treeProps"
+      row-key="bsm"
     >
       <el-table-column v-if="indexed" label="序号" width="70px">
         <template slot-scope="scope">{{ scope.$index + 1 }}</template>
@@ -33,7 +35,7 @@
         </template>
       </el-table-column>
     </el-table>
-    <div class="tabs-pagation" v-if="table.data.length">
+    <div class="tabs-pagation" v-if="table.data.length && table.total">
       <div class="font" v-if="showTotal">共{{ table.total }}条记录</div>
       <!-- <el-pagination class="tabone-pagination" background layout="prev, pager, next" :current-page="pageNum"
             :pager-count="5" :page-size="5" :total="table.total" @current-change="changePage" /> -->
@@ -71,6 +73,10 @@ export default {
       type: Boolean,
       default: true,
     },
+    treeProps: {
+      type: Object,
+      default: () => {},
+    },
     layout: {
       type: String,
       default: "total, sizes, prev, pager, next, jumper",

+ 13 - 0
src/views/ResourceShare/myApplication/config.js

@@ -1,3 +1,14 @@
+
+import { Getdict } from "@/api/shared.js";
+export async function Getservicetype() {
+  if (sessionStorage.getItem("servicetype")) {
+    return JSON.parse(sessionStorage.getItem("servicetype"))
+  } else {
+    const res = await Getdict({ pageNum: 1, pageSize: 10, dictType: 'servicetype' })
+    sessionStorage.setItem("servicetype", JSON.stringify(res.rows));
+    return res.rows
+  }
+}
 export const FormConfig = [
   [
     {
@@ -43,6 +54,8 @@ export const TableHeader = [
   { label: "截止有效期", prop: "deadline", },
   { label: "操作", slot: "action" },
 ]
+
+
 // 详情字段
 export const detailInfos = [
   [

+ 5 - 3
src/views/ResourceShare/myApplication/index.vue

@@ -49,14 +49,16 @@
           </div>
         </template>
         <template #url="{ row }">
-          <div v-if="row.ymlUrl" @click="copyText(row.ymlUrl)">
-            {{ row.ymlUrl }}
+          <div v-if="row.zymlUrl" @click="copyText(row.zymlUrl)">
+            {{ row.zymlUrl }}
             <i class="el-icon-document-copy usable"></i>
           </div>
         </template>
         <template #action="{ row }">
           <span class="usable" @click="detail(row)">详情</span>
-          <span :class="{ usable: row.state == 1 }" @click="revoke(row)"
+          <span
+            :class="row.state == 1 ? 'usable' : 'disable'"
+            @click="revoke(row)"
             >撤回</span
           >
         </template>

+ 1 - 1
src/views/ResourceShare/myReview/components/reviewModal.vue

@@ -93,7 +93,7 @@
         </div>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="close">关闭</el-button>
+        <el-button @click="close">关闭</el-button>
         <el-button type="primary" @click="submit">确 定</el-button>
       </span>
     </el-dialog>

+ 3 - 3
src/views/ResourceShare/myReview/index.vue

@@ -49,15 +49,15 @@
           </div>
         </template>
         <template #url="{ row }">
-          <div v-if="row.ymlUrl" @click="copyText(row.ymlUrl)">
-            {{ row.ymlUrl }}
+          <div v-if="row.zymlUrl" @click="copyText(row.zymlUrl)">
+            {{ row.zymlUrl }}
             <i class="el-icon-document-copy usable"></i>
           </div>
         </template>
         <template #action="{ row }">
           <span class="usable" @click="detail(row)">详情</span>
           <span
-            :class="{ usable: row.state == 0 || row.state == 1 }"
+            :class="row.state == 0 || row.state == 1 ? 'usable' : 'disable'"
             @click="review(row)"
             >审核</span
           >

+ 3 - 0
src/views/ResourceShare/resource.scss

@@ -32,5 +32,8 @@
         color: #3f93f5;
         cursor: pointer;
       }
+      .disable{
+        color: #a2a1a1;
+      }
     }
   }

+ 27 - 20
src/views/ResourceShare/sharedLocation/components/fieldSetModal.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="dialog">
     <el-dialog
-      :title="formData.JGMC"
+      :title="formData.name"
       width="40%"
       :visible.sync="dialogVisible"
       :before-close="close"
@@ -18,12 +18,19 @@
           <el-table-column label="序号" width="70px">
             <template slot-scope="scope">{{ scope.$index + 1 }}</template>
           </el-table-column>
-          <el-table-column prop="label" label="字段名"> </el-table-column>
-          <el-table-column prop="name" label="中文名" show-overflow-tooltip>
+          <el-table-column prop="filedName" label="字段名"> </el-table-column>
+          <el-table-column
+            prop="filedNameZh"
+            label="中文名"
+            show-overflow-tooltip
+          >
           </el-table-column>
           <el-table-column label="是否可共享" width="150">
-            <template #default="{ row }">
-              <el-checkbox v-model="row.checked" @change="changeShare(row)">
+            <template #default="{ row, $index }">
+              <el-checkbox
+                v-model="row.checked"
+                @change="changeShare(row, $index)"
+              >
                 可共享
               </el-checkbox>
             </template></el-table-column
@@ -32,7 +39,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submit">保存</el-button>
-        <el-button type="primary" @click="close">关闭</el-button>
+        <el-button @click="close">关闭</el-button>
       </span>
     </el-dialog>
   </div>
@@ -60,23 +67,23 @@ export default {
     Init(rowdata) {
       this.formData = rowdata;
       this.dialogVisible = true;
+      this.getfieldList(rowdata.bsm);
+    },
+    async getfieldList(id) {
+      let res = await Getfiledslist({ id });
+      // this.fieldList = res.data;
+      this.fieldList = [];
+      res.data.forEach((field) => {
+        this.fieldList.push({ ...field, checked: field == 0 });
+      });
     },
-    async getTableData(page = { pageIndex: 1, size: 10 }) {
-      this.model.pageNum = page.pageIndex;
-      this.model.pageSize = page.size;
-      this.model.startTime = this.model.sj[0];
-      this.model.endTime = this.model.sj[1];
-      let data = await Getfiledslist(this.model);
-      // this.active_dableData = data.data;
-      this.table = {
-        data: data.rows,
-        total: data.total,
-      };
+    changeShare(row, index) {
+      this.fieldList[index].shareDisplay = row.checked ? 0 : 1;
     },
     async submit() {
-      fileds(this.ruleForm).then((res) => {
-        if (res.success) {
-          this.$message.success("撤回成功!");
+      fileds(this.fieldList).then((res) => {
+        if ((res.code = 200)) {
+          this.$message.success("共享字段设置成功!");
           this.close();
         }
       });

+ 14 - 12
src/views/ResourceShare/sharedLocation/config.js

@@ -1,10 +1,10 @@
 export const FormConfig = [
   [
-    {
-      label: '注册时间:',
-      prop: 'time',
-      span: 6
-    },
+    // {
+    //   label: '服务器类型',
+    //   prop: 'time',
+    //   span: 6
+    // },
     {
       label: '服务类型:',
       prop: 'type',
@@ -12,29 +12,31 @@ export const FormConfig = [
     },
     {
       label: '数据服务名称:',
-      prop: 'carNo',
+      prop: 'name',
       span: 5,
       component: 'ElInput',
       componentProps: {
         placeholder: '数据服务名称'
       }
     },
+    {
+      span: 2
+    },
     {
       prop: 'action',
       span: 5
     }
   ]
 ]
-
 export const TableHeader = [
   // 序号
   { label: "数据服务名称", prop: "name" },
-  { label: "服务类型", prop: "type" },
+  { label: "服务类型", prop: "type", slot: "type" },
   { label: "注册时间", prop: "createTime" },
-  { label: "服务地址", prop: "url" },
-  { label: "数据范围", prop: "PHONE", },
-  { label: "共享状态", prop: "PROPERTYNAME", slot: "type" },
-  { label: "操作", prop: "PHONE", slot: "action" },
+  { label: "服务地址", prop: "url", width: 500 },
+  // { label: "数据范围", prop: "PHONE", },
+  { label: "共享状态", prop: "PROPERTYNAME", slot: "shared" },
+  { label: "操作", slot: "action" },
 ]
 // 详情字段
 export const detailInfos = [

+ 56 - 92
src/views/ResourceShare/sharedLocation/index.vue

@@ -1,28 +1,14 @@
 <template>
-  <div class="ghzc ResourceShare">
+  <div class="ghzc ResourceShare sharedLocation">
     <div class="innerContainer" v-drag>
       <custom-form ref="formRef" :model="model" :config="formConfig">
-        <template #time>
-          <el-date-picker
-            v-model="model.sj"
-            type="daterange"
-            value-format="yyyy-MM-dd"
-            range-separator="~"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            class="datepicker"
-            size="mini"
-            @change="changedate"
-          >
-          </el-date-picker>
-        </template>
         <template #type>
-          <el-select v-model="model.placeCode" placeholder="申请状态">
+          <el-select v-model="model.type" placeholder="申请状态">
             <el-option
-              v-for="item in optionList"
-              :key="item.code"
-              :label="item.name"
-              :value="item.code"
+              v-for="item in servicetype"
+              :key="item.dictValue"
+              :label="item.dictLabel"
+              :value="item.dictValue"
             >
             </el-option>
           </el-select>
@@ -40,17 +26,28 @@
         class="tablePage"
         :cloumn="cloumn"
         :table="table"
+        :indexed="false"
         :showTotal="false"
         ref="tableDialogRef"
         @currentChange="searchFun"
+        :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
       >
         <template #type="{ row }">
-          <el-checkbox v-model="row.checked" @change="changeShare(row)">
+          {{ sertypeMap[row.type] || "-" }}
+        </template>
+        <template #shared="{ row }">
+          <el-checkbox
+            v-if="row.url"
+            v-model="row.checked"
+            @change="changeShare(row)"
+          >
             共享
           </el-checkbox>
         </template>
         <template #action="{ row }">
-          <span class="usable" @click="fieldset(row)">共享字段设置</span>
+          <span class="usable" v-if="row.url" @click="fieldset(row)"
+            >共享字段设置</span
+          >
         </template>
       </tablePage>
     </div>
@@ -64,8 +61,9 @@ import tablePage from "@/components/mapView/tablePage.vue";
 import customForm from "@/components/mapView/custom-form.vue";
 import fieldSet from "./components/fieldSetModal.vue";
 import { FormConfig, TableHeader } from "./config";
-import { Getfiledslist, listZyml } from "@/api/shared.js";
+import { listZyml, shareZyml } from "@/api/shared.js";
 import { handleTree } from "@/utils/ruoyi.js";
+import { Getservicetype } from "../myApplication/config";
 export default {
   components: {
     tablePage,
@@ -75,98 +73,48 @@ export default {
   props: {},
   data() {
     return {
-      queryParams: {
-        name: null,
-        type: null,
-        state: null,
-        year: null,
-      },
       model: {
-        id: "23fa916114494640b71988d9858474c3",
-        regionCode: "", //地区编码
-        placeCode: "", //所属小区
         startTime: "",
         endTime: "",
         sj: ["", ""],
+        type: "",
+        state: null,
+        year: null,
       },
       formConfig: FormConfig,
       cloumn: TableHeader,
+      servicetype: [],
+      sertypeMap: {},
       table: { data: [], total: 0 },
-      table: {
-        data: [
-          { JGMC: "ssmdmm", type: 0, typeN: "正在审核", checked: false },
-          {
-            JGMC: "ssmdmm",
-            type: 1,
-            time: "2024/9/3",
-            typeN: "审核通过",
-            url: "snsd",
-            checked: true,
-            list: [
-              { time: "2024/9/3", jg: "申请通过" },
-              { time: "2024/8/13", jg: "申请通过" },
-            ],
-          },
-          {
-            JGMC: "ssmdmm",
-            type: 2,
-            typeN: "审核不通过",
-            list: [
-              { time: "2024/9/3", jg: "申请通过" },
-              { time: "2024/8/13", jg: "申请通过" },
-            ],
-          },
-          { JGMC: "ssmdmm", type: 3, typeN: "已撤回" },
-        ],
-        total: 0,
-      },
     };
   },
   methods: {
     searchFun(page) {
-      this.getList(page);
+      this.getTableData(page);
     },
     /** 查询数据资源目录列表 */
-    getList() {
-      this.loading = true;
-      listZyml(this.queryParams).then((response) => {
-        // this.zymlList = handleTree(response.data, "bsm", "pbsm");
-        // this.loading = false;
-        this.table = {
-          data: handleTree(response.data, "bsm", "pbsm"),
-        };
-        console.log(this.zymlList);
-      });
-    },
-    getTreeselect() {
-      listZyml().then((response) => {
-        this.zymlOptions = [];
-        const data = { bsm: 0, name: "根节点", children: [] };
-        data.children = handleTree(response.data, "bsm", "pbsm");
-        this.zymlOptions.push(data);
-      });
-    },
     async getTableData(page = { pageIndex: 1, size: 10 }) {
-      this.model.pageNum = page.pageIndex;
-      this.model.pageSize = page.size;
+      // this.model.pageNum = page.pageIndex;
+      // this.model.pageSize = page.size;
       this.model.startTime = this.model.sj[0];
       this.model.endTime = this.model.sj[1];
-      let data = await Getfiledslist(this.model);
-      // this.active_dableData = data.data;
+      let res = await listZyml(this.model);
+
       this.table = {
-        data: data.rows,
-        total: data.total,
+        data: handleTree(res.data, "bsm", "pbsm"),
+        total: 0,
       };
     },
     reset() {
       this.model = {
-        zymlBy: "",
-        state: "",
         startTime: "",
         endTime: "",
         sj: ["", ""],
-        pageNum: 1,
-        pageSize: 10,
+        type: "",
+        state: null,
+        year: null,
+        // pageNum: 1,
+        // pageSize: 10,
       };
       this.searchFun();
     },
@@ -174,14 +122,24 @@ export default {
     fieldset(row) {
       this.$refs.fieldSetModal.Init(row);
     },
-    changeShare(row) {},
+    changeShare(row) {
+      shareZyml({ id: row.bsm }).then((res) => {
+        this.$message.success("共享状态切换成功!");
+        this.searchFun();
+      });
+    },
     closeMdel() {
       this.searchFun();
     },
   },
   computed: {},
   watch: {},
-  mounted() {
+  async mounted() {
+    this.servicetype = await Getservicetype();
+    this.servicetype.forEach((ty) => {
+      this.sertypeMap[ty.dictValue] = ty.dictLabel;
+    });
+    console.log("--s-s--s", this.sertypeMap);
     this.searchFun();
   },
 };
@@ -194,4 +152,10 @@ export default {
 </style>
 <style lang="scss">
 @import "../../cockpit/datePicker.scss";
+.sharedLocation {
+  .el-table {
+    overflow-y: auto;
+    overflow-x: hidden;
+  }
+}
 </style>