Explorar el Código

Merge branch 'master' of http://47.110.251.215:3000/web/saber

duy hace 2 años
padre
commit
e1c4528ec9
Se han modificado 2 ficheros con 286 adiciones y 99 borrados
  1. 58 0
      src/api/tentative/testcollect.js
  2. 228 99
      src/views/tentative/metadata.vue

+ 58 - 0
src/api/tentative/testcollect.js

@@ -47,3 +47,61 @@ export const update = (row) => {
     data: row
   })
 }
+
+export const getMetadataDetail = (current, size, params) => {
+  return request({
+    url: '/api/blade-business/metadata/classification/detail',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size
+    }
+  })
+}
+
+export const metadataSubmit = (row) => {
+  return request({
+    url: '/api/blade-business/metadata/classification/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const metadataUpdate = (row) => {
+  return request({
+    url: '/api/blade-business/metadata/classification/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const metadataRemove = (id) => {
+  return request({
+    url: '/api/blade-business/metadata/remove',
+    method: 'post',
+    params: {
+      ids:id,
+    }
+  })
+}
+
+export const getAllocationDetail = (current, size, params) => {
+  return request({
+    url: '/api/blade-business/metadata/allocation/detail',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size
+    }
+  })
+}
+
+export const allocation = (row) => {
+  return request({
+    url: '/api/blade-business/metadata/allocation',
+    method: 'post',
+    params: row
+  })
+}

+ 228 - 99
src/views/tentative/metadata.vue

@@ -16,9 +16,11 @@
                @size-change="sizeChange"
                @refresh-change="refreshChange"
                @on-load="onLoad">
-                <template slot="menuRight"> 
-                    <div style="display:flex">
-                        <el-select v-model="optionvalue" clearable placeholder="请选择文件存储类型">
+                <template slot="menuLeft"> 
+                    <div style="display:flex;align-items: center;">
+                        <div style="width:180px">文件存储类型</div>
+                        <el-select v-model="query.fileStorageType" placeholder="请选择文件存储类型"
+                          @change="queryChange">
                             <el-option
                             v-for="item in options"
                             :key="item.value"
@@ -26,79 +28,72 @@
                             :value="item.value">
                             </el-option>
                         </el-select>
-                        <el-link :underline="false" @click="setMetadata"><i class="el-icon-s-tools" size="large" style="line-height: 38px; font-size: 24px;margin-left: 5px;"></i></el-link>
+                        <el-link :underline="false" @click="setAllocation" type="primary"><i class="el-icon-s-tools" size="large" style="line-height: 38px; font-size: 24px;margin-left: 5px;"></i></el-link>
                         
                     </div>
                 </template>
+                <template slot="menuRight">
+                  <div>
+                    <el-button type="primary"
+                      icon="el-icon-plus"
+                      circle
+                      @click="toadd"></el-button>
+                  </div>
+                </template>
     </avue-crud>
       <!-- 编辑元素表单信息 -->
     <el-dialog
       title="设置分类元素数据"
       :visible.sync="setMetadataTag"
-      width="60%"
+      width="60%" :center='true'
       :modal-append-to-body="false"
     >
       <div>
         <div style="float:right;margin-bottom:20px">
-          <el-select v-model="optionvalue" clearable placeholder="请选择文件存储类型">
-                            <el-option
-                            v-for="item in options"
-                            :key="item.value"
-                            :label="item.label"
-                            :value="item.value">
-                            </el-option>
+          <el-select v-model="optionvalue" placeholder="请选择文件存储类型">
+              <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value">
+              </el-option>
            </el-select>
-          <el-button type="primary">保存</el-button>
+          <el-button type="primary" @click="allocationSave">保存</el-button>
         </div>
           
         <el-table
           :data="MetadataformDatass"
-          border
+          border ref="dialogtable"
           style="width: 100%;">
           <el-table-column
-            prop="metadataitem"
+            type="selection"
+            width="55">
+          </el-table-column>
+          <el-table-column
+            prop="containerName"
             label="元数据项">
-            <template slot-scope="scope">
-              <el-input
-                v-model="scope.row.metadataitem"
-                placeholder="请输入"
-              ></el-input>
-            </template>
           </el-table-column>
           <el-table-column
-            prop="capture"
-            label="捕获方式">
-            <template slot-scope="scope">
-              <el-select
-                v-model="scope.row.capture"
-                placeholder="请选择">
-                <el-option
-                  v-for="(item,key) in tableTypelist"
-                  :key="key"
-                  :label="item.dictValue"
-                  :value="item.dictKey">
-                </el-option>
-              </el-select>
-            </template>
+            prop="captureMode"
+            label="捕获方式"
+            :formatter="tableFormatter">
           </el-table-column>
           <el-table-column
-            prop="isrequired"
-            label="是否必选">
-            <template slot-scope="scope">
-              <el-select
-                v-model="scope.row.isrequired"
-                placeholder="请选择">
-                <el-option
-                  v-for="(item,key) in ownerTypeList"
-                  :key="key"
-                  :label="item.dictValue"
-                  :value="item.dictKey">
-                </el-option>
-              </el-select>
-            </template>
+            prop="mandatoryType"
+            label="是否必选"
+            :formatter="tableFormatter">
           </el-table-column>
        
         </el-table>
+        <div class="text-align-c">
+          <el-pagination
+            @current-change="handleCurrentChange"
+            :current-page.sync="page2.current"
+            :page-size="page2.pageSize"
+            layout="total, prev, pager, next"
+            :total="page2.total">
+          </el-pagination>
+        </div>
       </div>
       <span
         slot="footer"
@@ -107,7 +102,7 @@
         <el-button @click="setMetadataTag = false">取 消</el-button>
         <el-button
           type="primary"
-          @click="editeditElementFormMF()"
+          @click="setMetadataTag = false"
         >确 定</el-button>
       </span>
     </el-dialog>
@@ -116,31 +111,48 @@
 </template>
 
 <script>
-import {getList, getDetail, add, update, remove} from "@/api/tentative/testcollect";
+import {getDetail,getMetadataDetail,metadataSubmit,metadataUpdate, metadataRemove,getAllocationDetail,allocation} from "@/api/tentative/testcollect";
 import {mapGetters} from "vuex";
 
 export default {
   data() {
     return {
-    options: [{
-          value: '选项1',
+    options: [
+        {
+          value: 0,
+          label: '普通'
+        },
+        {
+          value: 1,
           label: '竣工图'
         }, {
-          value: '选项2',
+          value: 2,
           label: '计量'
         }, {
-          value: '选项3',
+          value: 3,
           label: '质检'
         }, {
-          value: '选项4',
+          value: 4,
           label: '声像'
         }, {
-          value: '选项5',
+          value: 5,
           label: '隐蔽'
-        }],
-     optionvalue: '',
+        }, {
+          value: 6,
+          label: '试验'
+        }, {
+          value: 7,
+          label: '管理文件'
+        }, {
+          value: 8,
+          label: '变更令'
+        }
+        ],
+     optionvalue: 0,
       form: {},
-      query: {},
+      query: {
+        fileStorageType:0,
+      },
       loading: true,
       page: {
         pageSize: 20,
@@ -152,7 +164,8 @@ export default {
       option: {
          refreshBtn: false,      // 刷新 
         columnBtn: false,       // 操作列显隐
-        addBtn:true,
+        cellBtn:true,//开启行编辑按钮
+        addBtn:false,
         menuWidth:330,
         height:'auto',
         calcHeight: 30,
@@ -160,50 +173,61 @@ export default {
         searchShow: false,
         searchMenuSpan: 0,
         border: true,
-        index: true,
+        index:true,
+        indexLabel:'序号',
         viewBtn: true,
-        selection: true,
+        selection: false,
         dialogClickModal: false,
         labelWidth:150,
         column: [
           {
             label: "元数据项",
-            prop: "metadataitem",
+            prop: "containerName",
             rules: [{
               required: true,
               message: "请输入元数据项",
               trigger: "blur"
-            }]
+            }],
+            cell: true,
           },
            {
             label: "编号",
-            prop: "id",
+            prop: "code",
             rules: [{
               required: true,
               message: "编号",
               trigger: "blur"
-            }]
+            }],
+            cell: true,
           },
            {
             label: "数据类型",
-            prop: "datatype",
+            prop: "fieldType",
             type:'select',
-            dicData:[{
-              label:'数值',
-              value:0
-            },{
+            dicData:[
+            // {
+            //   label:'数值',
+            //   value:0
+            // },
+            {
               label:'字符串',
               value:1
-            }],
+            },
+            {
+              label:'日期',
+              value:4
+            }
+            ],
             rules: [{
               required: true,
               message: "数据类型",
               trigger: "blur"
-            }]
+            }],
+            cell: true,
           },
            {
             label: "容器类型",
-            prop: "containertype",
+            prop: "containerType",
             type:'select',
             rules: [{
               required: true,
@@ -216,11 +240,15 @@ export default {
             },{
               label:'文件联',
               value:1
-            }],
+            },{label:'内容描述',value:2},{label:'组件',value:3},{label:'文件标识码',value:4},{label:'竣工图',value:5},
+            {label:'照片文件',value:6},{label:'电子属性',value:7},{label:'数字化属性',value:8},{label:'电子签名',value:9},
+            {label:'业务事项',value:10},{label:'责任者',value:11},{label:'关系实体',value:12}
+            ],
+            cell: true,
           },
             {
             label: "捕获方式",
-            prop: "capture",
+            prop: "captureMode",
             rules: [{
               required: true,
               message: "捕获方式",
@@ -233,11 +261,15 @@ export default {
             },{
               label:'自动',
               value:1
+            },{
+              label:'手动/自动',
+              value:2
             }],
+            cell: true,
           },
               {
             label: "是否必选",
-            prop: "isrequired",
+            prop: "mandatoryType",
             rules: [{
               required: true,
               message: "是否必选",
@@ -250,7 +282,11 @@ export default {
             },{
               label:'必选',
               value:1
+            },{
+              label:'条件选',
+              value:2
             }],
+            cell: true,
           }
 
         ]
@@ -258,6 +294,12 @@ export default {
       data: [],
       setMetadataTag:false,
       MetadataformDatass:[],
+
+      page2:{
+        pageSize:20,
+        total:0,
+        current:1,
+      }
     };
   },
   computed: {
@@ -282,7 +324,8 @@ export default {
   methods: {
 
     rowSave(row, done, loading) {
-      add(row).then(() => {
+      row.fileStorageType = this.query.fileStorageType;
+      metadataSubmit(row).then(() => {
         this.onLoad(this.page);
         this.$message({
           type: "success",
@@ -295,7 +338,8 @@ export default {
       });
     },
     rowUpdate(row, index, done, loading) {
-      update(row).then(() => {
+      row.fileStorageType = this.query.fileStorageType;
+      metadataUpdate(row).then(() => {
         this.onLoad(this.page);
         this.$message({
           type: "success",
@@ -314,7 +358,7 @@ export default {
         type: "warning"
       })
         .then(() => {
-          return remove(row.id);
+          return metadataRemove(row.id);
         })
         .then(() => {
           this.onLoad(this.page);
@@ -347,7 +391,9 @@ export default {
     },
     selectionClear() {
       this.selectionList = [];
-      this.$refs.crud.toggleSelection();
+      if(this.$refs.crud){
+        this.$refs.crud.toggleSelection();
+      }
     },
     currentChange(currentPage){
       this.page.currentPage = currentPage;
@@ -360,24 +406,27 @@ export default {
     },
     onLoad(page, params = {}) {
       this.loading = true;
-      // getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
-      //   const data = res.data.data;
-      //   this.page.total = data.total;
-      //   this.data = data.records;
-      //   this.loading = false;
-      //   this.selectionClear();
-      // });
-        const data = [{
-          metadataitem:'全宗名称',
-          id:'1',
-          datatype:'字符串',
-          containertype:'来源',
-          capture:'手动',
-          isrequired:'是',
+      getMetadataDetail(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+        const data = res.data.data;
+        data.records.forEach((item)=>{
+          item.fieldType = Number(item.fieldType)
+        })
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+        this.selectionClear();
+      });
+        // const data = [{
+        //   metadataitem:'全宗名称',
+        //   id:'1',
+        //   datatype:'字符串',
+        //   containertype:'来源',
+        //   capture:'手动',
+        //   isrequired:'是',
           
-        }];
-         this.page.total = 1;
-        this.data = data;
+        // }];
+        //this.page.total = 1;
+        // this.data = data;
         this.loading = false;
         this.selectionClear();
     },
@@ -420,6 +469,86 @@ export default {
 
       }
        this.setMetadataTag=true;
+    },
+
+    //新增一条数据
+    toadd(){
+      this.$refs.crud.rowCellAdd()
+      //console.log(this.$refs.crud.rowCellAdd())
+    },
+
+    //切换选项
+    queryChange(){
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+
+    setAllocation(){
+      this.getAllocationList();
+      this.setMetadataTag=true;
+      this.optionvalue = this.query.fileStorageType;
+    },
+
+    getAllocationList(){
+      getAllocationDetail(this.page2.current,this.page2.pageSize,{
+        fileStorage:this.optionvalue
+      }).then((res)=>{
+        //console.log(res)
+        const data = res.data.data;
+        this.MetadataformDatass = data.records;
+        this.page2.total = data.total;
+      })
+    },
+
+    handleCurrentChange(index){
+      this.page2.current = index;
+      this.getAllocationList();
+    },
+
+    tableFormatter(row, column, cellValue){
+      //console.log(row,'row');
+      //console.log(column,'column');
+      //console.log(cellValue,'cellValue');
+      let obj = {}
+      if(column.property == 'captureMode'){
+        obj = {
+          0:'手动',
+          1:'自动',
+          2:'手动/自动',
+        }
+        
+      }else if(column.property == 'mandatoryType'){
+        obj = {
+          0:'可选',
+          1:'必选',
+          2:'条件选',
+        }
+      }
+
+      return obj[cellValue];
+    },
+
+    //修改文件类型储存
+    allocationSave(){
+      let list = [];
+      list = this.$refs.dialogtable.selection;
+      //console.log(list)
+      if (list.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+
+      let ids = [];
+      list.forEach((item)=>{
+        ids.push(item.id)
+      })
+
+      allocation({
+        ids:ids.join(','),
+        type:this.optionvalue
+      }).then(()=>{
+        this.handleCurrentChange(1);
+      })
     }
   }
 };