瀏覽代碼

Merge branch 'product' of http://1.116.113.26:8088/zhuliu/xiaoshi_system into product

zhuhao 1 年之前
父節點
當前提交
4c8a3a759d

+ 21 - 0
package-lock.json

@@ -10547,6 +10547,11 @@
       "integrity": "sha1-qkDtrBcERbmkMeF7tiwLiBucQSM=",
       "dev": true
     },
+    "shvl": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmmirror.com/shvl/-/shvl-2.0.3.tgz",
+      "integrity": "sha512-V7C6S9Hlol6SzOJPnQ7qzOVEWUQImt3BNmmzh40wObhla3XOYMe4gGiYzLrJd5TFa+cI2f9LKIRJTTKZSTbWgw=="
+    },
     "side-channel": {
       "version": "1.0.4",
       "resolved": "https://registry.nlark.com/side-channel/download/side-channel-1.0.4.tgz",
@@ -12573,6 +12578,22 @@
       "resolved": "https://registry.nlark.com/vuex/download/vuex-3.6.2.tgz",
       "integrity": "sha1-I2vAhqhww655lG8QfxbeWdWJXnE="
     },
+    "vuex-persistedstate": {
+      "version": "4.1.0",
+      "resolved": "https://registry.npmmirror.com/vuex-persistedstate/-/vuex-persistedstate-4.1.0.tgz",
+      "integrity": "sha512-3SkEj4NqwM69ikJdFVw6gObeB0NHyspRYMYkR/EbhR0hbvAKyR5gksVhtAfY1UYuWUOCCA0QNGwv9pOwdj+XUQ==",
+      "requires": {
+        "deepmerge": "^4.2.2",
+        "shvl": "^2.0.3"
+      },
+      "dependencies": {
+        "deepmerge": {
+          "version": "4.3.1",
+          "resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-4.3.1.tgz",
+          "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="
+        }
+      }
+    },
     "watch-size": {
       "version": "2.0.0",
       "resolved": "https://registry.npmmirror.com/watch-size/-/watch-size-2.0.0.tgz",

+ 2 - 1
package.json

@@ -28,7 +28,8 @@
     "vue": "^2.6.11",
     "vue-i18n": "^8.11.2",
     "vue-router": "^3.2.0",
-    "vuex": "^3.4.0"
+    "vuex": "^3.4.0",
+    "vuex-persistedstate": "^4.1.0"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "~4.5.0",

+ 7 - 3
src/api/index.js

@@ -3,9 +3,9 @@ import template from "./template";
 import custom from "./custom";
 import field from "./field";
 import data from "./data";
-import common from "./common";
+// import common from "./common";
 import oauth2 from "./oauth2";
-import project from "./project";
+// import project from "./project";
 import download from "./download";
 import client from "./client";
 import user from "./user";
@@ -29,6 +29,8 @@ import event from "./newApi/event";
 import product from "./newApi/product";
 import framework from "./newApi/framework";
 import file from "./newApi/file"
+import project from "./newApi/project"
+import common from "./newApi/common"
 
 export default {
   ...report,
@@ -57,5 +59,7 @@ export default {
   ...event,
   ...product,
   ...framework,
-  ...file
+  ...file,
+  ...project,
+  ...common
 }

+ 42 - 0
src/api/newApi/common.js

@@ -0,0 +1,42 @@
+import axios from "@/utils/axios";
+export default {
+    /**
+     * 查询应用场景
+     * @param {*} data 
+     * @returns 
+     */
+    getScenario(data) {
+        return axios.get("/xiaoshi/common/scenario", {data});
+    },
+    /**
+     * 根据应用场景获取处理事项(调查类型)
+     * @param {*} data 
+     * @returns 
+     */
+    getMatter(data) {
+        return axios.post("/xiaoshi/common/matter", data);
+    },
+
+     /**
+     * 获取table栏位及分组字段
+     */
+    getParamsCommon(data) {
+        return axios.post('/xiaoshi/common/getParams', data);
+    },
+    /**
+     * 显示栏位管理(查询显示栏位)
+     * @param {*} data 
+     * @returns 
+     */
+    getCustomField(params) {
+        return axios.get("/xiaoshi/common/getCustomField", { params });
+    },
+    /**
+     * 显示栏位管理(更新显示栏位)
+     * @param {*} data 
+     * @returns 
+     */
+    setCustomField(data) {
+        return axios.post("/xiaoshi/common/setCustomField",  data );
+    },
+};

+ 1 - 6
src/api/newApi/event.js

@@ -8,12 +8,7 @@ export default {
    return axios.post('/xiaoshi/event/addEvent', data)
   },
 
-  /**
-  * 获取table栏位及分组字段
-  */
-  getParamsCommon(data) {
-    return axios.post('/xiaoshi/common/getParams', data);
-  },
+ 
   /**
   * 查询事件
   */

+ 16 - 3
src/api/newApi/project.js

@@ -1,7 +1,20 @@
 import axios from "@/utils/axios";
 // 新系统专题库新接口
 export default {
-  addPatentProject(data) {
-    return axios.post("/xiaoshi/patentProject/addPatentProject", data);
-  },
+    /**
+     * 新增专利数据库
+     * @param {*} data 
+     * @returns 
+     */
+    addPatentProject(data) {
+        return axios.post("/xiaoshi/patentProject/addPatentProject", data);
+    },
+    /**
+     * 查询专利数据库
+     * @param {*} data 
+     * @returns 
+     */
+    queryPatentProject(data) {
+        return axios.post("/xiaoshi/patentProject/queryPatentProject", data);
+    },
 };

+ 2 - 2
src/store/index.js

@@ -12,7 +12,7 @@ import dictMessage from "./modules/dictMessage"
 import contextMenu from './modules/contextMenu'
 
 import persisPlugin from './persisPlugin'
-
+import createPersistedState from 'vuex-persistedstate'
 Vue.use(Vuex)
 
 export default new Vuex.Store({
@@ -28,5 +28,5 @@ export default new Vuex.Store({
     contextMenu
   },
   getters,
-  plugins:[persisPlugin]
+  plugins:[createPersistedState(), ]
 })

+ 7 - 1
src/store/modules/dictMessage.js

@@ -1,12 +1,18 @@
 export default {
   state: {
-    dictMessage:[]
+    //公用字典
+    dictMessage:[],
+    //应用场景
+    scenario:[]
   },
 
   mutations: {
     SET_DictMessage(state, dictMessage){
       state.dictMessage=dictMessage
     },
+    SET_Scenario(state,scenario){
+      state.scenario=scenario
+    },
   },
 
   actions: {

+ 7 - 3
src/store/persisPlugin.js

@@ -1,14 +1,18 @@
 const KEY = 'VUEX_STORE'
 import Cookies from "js-cookie";
 export default function(store){
-   
     //保存仓库数据到本地
-    window.addEventListener('beforeunload',()=>{
+    window.addEventListener('beforeunload',(e)=>{
         if(Cookies.get('token')){
             localStorage.setItem(KEY, JSON.stringify(store.state))
         }
-        
     })
+    window.addEventListener("popstate", ()=>{
+        if(Cookies.get('token')){
+            localStorage.setItem(KEY, JSON.stringify(store.state))
+        }
+    });
+    
     //恢复仓库数据
     try{
        const localStorage = localStorage.getItem(KEY)

+ 1 - 1
src/utils/direct/index.js

@@ -35,7 +35,7 @@ const draggable = (el, binding) => {
 const SelectLazyLoading={
     inserted(el,binding){
         let SELECT_DOM = el.querySelector(".el-select-dropdown .el-select-dropdown__wrap") || el.querySelector('.el-autocomplete-suggestion__wrap') ;
-            console.log(SELECT_DOM)
+            // console.log(SELECT_DOM)
             if(!SELECT_DOM){
                 return false
             }

+ 4 - 2
src/utils/model/route.vue

@@ -13,14 +13,16 @@
       <i slot="reference" class="el-icon-circle-plus-outline" style="font-size:20px;"></i>
     </upload>
     <myUpload :multiple="true" :fileList="[{name:'场景可视化.jpg'}]" accept=".png,.jpg"></myUpload>
-
+    <my-date value=""></my-date>
   </div>
 </template>
 <script>
 import upload from './Cascader/index.vue'
+import myDate from './date/index.vue'
 export default {
   components:{
-    upload
+    upload,
+    myDate
   },
   data() {
     return {

+ 2 - 2
src/utils/model/selectTree/index.vue

@@ -88,7 +88,7 @@ export default {
     handleNodeClick(node){
       this.valueTitle = node[this.props.label]
       this.valueId = node[this.props.value]
-      this.$emit('getValue',this.valueId)
+      this.$emit('input',this.valueId)
       this.$refs.treeSelect.visible = false
       this.defaultExpandedKey = []
     },
@@ -98,7 +98,7 @@ export default {
       this.valueId = null
       this.defaultExpandedKey = []
       this.clearSelected()
-      this.$emit('getValue',null)
+      this.$emit('input',null)
     },
     /* 清空选中样式 */
     clearSelected(){

+ 76 - 40
src/views/components/dialog/fields.vue

@@ -1,21 +1,32 @@
 <template>
   <div>
     <el-dialog
-        title="提示"
-        :visible.sync="dialogVisible"
-        width="50%"
-        :before-close="handleClose">
-        <div>
-            <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
-            <div style="margin: 15px 0;"></div>
-            <el-checkbox-group v-model="checked" @change="handleCheckedChange">
-                <el-checkbox v-for="field in filedList" :label="field.value" :key="field.value">{{field.name}}</el-checkbox>
-            </el-checkbox-group>
-        </div>
-        <span slot="footer" class="dialog-footer">
-            <el-button @click="handleClose">取 消</el-button>
-            <el-button type="primary" @click="submit">确 定</el-button>
-        </span>
+      title="提示"
+      :visible.sync="dialogVisible"
+      width="50%"
+      :before-close="handleClose"
+    >
+      <div>
+        <el-checkbox
+          :indeterminate="isIndeterminate"
+          v-model="checkAll"
+          @change="handleCheckAllChange"
+          >全选</el-checkbox
+        >
+        <div style="margin: 15px 0"></div>
+        <el-checkbox-group v-model="checked" @change="handleCheckedChange">
+          <el-checkbox
+            v-for="field in filedList"
+            :label="field.value"
+            :key="field.value"
+            >{{ field.name }}</el-checkbox
+          >
+        </el-checkbox-group>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button type="primary" @click="submit">确 定</el-button>
+      </span>
     </el-dialog>
   </div>
 </template>
@@ -24,52 +35,77 @@
 export default {
   components: {},
   props: {
-    filedList:{
-        type:Array,
+    filedList: {
+      type: Array,
       default: () => {
-          return []
-        }
+        return [];
+      },
+    },
+    type:{
+      type:String,
+      default:''
     }
   },
   data() {
     return {
-        //控制显示弹窗
-        dialogVisible:false,
-        //是否全选
-        isIndeterminate:false,
-        //全选
-        checkAll:false,
-        //选择
-        checked:[],
+      //控制显示弹窗
+      dialogVisible: false,
+      //是否全选
+      isIndeterminate: false,
+      //全选
+      checkAll: false,
+      //选择
+      checked: [],
     };
   },
   watch: {},
   computed: {},
   created() {},
-  mounted() {},
+  mounted() {
+    //获取显示栏位
+    this.getCustomField(this.type);
+  },
   methods: {
+    getCustomField(type) {
+      if(!this.type) return;
+      var params = {
+        tableName: type,
+      };
+      this.$api.getCustomField(params).then((response) => {
+        if (response.code == 200) {
+          this.filedList.push(...response.data.data)
+          this.$emit('getFieldList',this.filedList)
+        }
+      }).catch(error=>{
+        this.filedList.splice(0)
+        this.$emit('getFieldList',this.filedList)
+      });
+    },
     //打开栏位
-    open(data){
-        this.dialogVisible = true
+    open(data) {
+      this.dialogVisible = true;
     },
     //关闭弹窗
-    handleClose(){
-        this.dialogVisible = false
+    handleClose() {
+      this.dialogVisible = false;
     },
     //提交更改
-    submit(){
-
+    submit() {
+      this.$api.setCustomField().then(()=>{
+        
+      })
     },
     //全选
     handleCheckAllChange(val) {
-        this.checked = val ? this.filedList : [];
-        this.isIndeterminate = false;
+      this.checked = val ? this.filedList : [];
+      this.isIndeterminate = false;
     },
     //勾选
-    handleCheckedChange(value){
-        let checkedCount =  value.length;
-        this.checkAll = checkedCount === this.filedList.length;
-        this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
+    handleCheckedChange(value) {
+      let checkedCount = value.length;
+      this.checkAll = checkedCount === this.filedList.length;
+      this.isIndeterminate =
+        checkedCount > 0 && checkedCount < this.cities.length;
     },
   },
 };

+ 8 - 13
src/views/event/components/dialog/addEvent.vue

@@ -28,7 +28,7 @@
             <!-- <el-select v-model="formData[0].applicationScenarios[0]" :disabled="(formData[0].id && !this.row) ? true : false" -->
             <el-select ref="select2" v-model="formData[0].scenarioId" style="width: 100%;" placeholder="请选择事件场景">
               <el-option
-                v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO ? commonData.ENTERPRISE_APPLICATION_SCENARIO : []"
+                v-for="item in commonData"
                 :key="parseInt(item.value)" :label="item.label" :value="parseInt(item.value)">
               </el-option>
             </el-select>
@@ -79,8 +79,8 @@
                 <!-- multiple -->
                 <el-select v-model="scope.row.scenarioId" style="width: 100%;" placeholder="请选择事件场景">
                   <el-option
-                    v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO ? commonData.ENTERPRISE_APPLICATION_SCENARIO : []"
-                    :key="parseInt(item.value)" :label="item.label" :value="parseInt(item.value)">
+                    v-for="item in commonData"
+                    :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)">
                   </el-option>
                 </el-select>
               </div>
@@ -146,8 +146,6 @@ export default {
         name: [{ required: true, message: '请输入事件名称', trigger: 'blur' },],
         scenarioId: [{ required: true, message: '请选择事件场景', trigger: 'change' },],
       },
-      //应用场景数据
-      commonData: {},
       //弹窗类型
       type: 1,
       questionNameArr: {
@@ -177,10 +175,12 @@ export default {
   watch: {},
   computed: {
     ...mapGetters(["userinfo"]),
+    commonData(){
+      return this.$store.state.dictMessage.scenario || []
+    }
   },
   async mounted() {
-    // 应用场景(是通过字典还是接口待定)
-    await this.getCommonData()
+
   },
   methods: {
     // 自定义组件文件删除
@@ -294,12 +294,7 @@ export default {
       this.loading = false
       this.dialogVisible = false
     },
-    // 请求应用场景(是通过字典还是接口待定)
-    async getCommonData() {
-      await this.$api.getCommonData({ keys: 'QUERY_GROUP,ENTERPRISE_APPLICATION_SCENARIO,INVESTIGATION_TYPE' }).then(response => {
-        this.commonData = response.data
-      })
-    },
+
     // 检验事件并提交保存请求
     submitForm1() {
       var list = []

+ 30 - 17
src/views/event/components/index.vue

@@ -130,30 +130,39 @@ export default {
       commonData: [],
       //显示视图
       showView: false,
-      //场景
-      scene:[],
+      // //场景
+      // scene:[],
       //表格全部栏位
       fieldList: [],
       //操作回馈
       handleMessage:'',
     };
   },
-  watch: {},
-  computed: {},
+  watch: {
+  },
+  computed: {
+    scene(){
+      var a = this.$store.state.dictMessage.scenario.map(item=>{
+        return {
+          label:item.name,
+          value:item.id
+        }
+      })
+      var obj = this.searchFiled.find(item=>{return item.label == '应用场景'})
+      if(obj){
+        obj.options = a
+      }
+      return this.$store.state.dictMessage.scenario
+    }
+  },
   created() { },
   async mounted() {
-    await this.getCommonData()
     //获取table栏位及分组字段
     await this.getColumn()
     this.getList()
   },
   methods: {
-    // 请求应用场景(是通过字典还是接口待定)
-    async getCommonData() {
-      await this.$api.getCommonData({ keys: 'QUERY_GROUP,ENTERPRISE_APPLICATION_SCENARIO,INVESTIGATION_TYPE' }).then(response => {
-        this.scene = response.data.ENTERPRISE_APPLICATION_SCENARIO  
-      })
-    },
+
     // 子组件新增事件成功
     handleSuccess(val) {
       this.handleMessage = val
@@ -200,12 +209,16 @@ export default {
             value: 'value',
             type:'type',
           })
-          // 为3是下拉框选择
-          this.searchFiled.forEach(item => {
-            if (item.type == '3') {
-              item.options=this.scene
-            }
-          })
+          //为应用场景添加选项
+          var obj = this.searchFiled.find(item=>{return item.label == '应用场景'})
+          if(obj){
+            obj.options = this.scene.map(item=>{
+              return {
+                label:item.name,
+                value:item.id
+              }
+            })
+          }
         }
       })
       this.showView = false

+ 7 - 19
src/views/layout/index.vue

@@ -54,7 +54,6 @@ export default {
       button: [],
       show: false,
       btnLoading: false,
-      text:''
     }
   },
   watch: {
@@ -75,9 +74,8 @@ export default {
   },
   async mounted() {
     this.$store.commit('SET_PREFIX', '/')
-    this.getUserInfo()
+    
     this.getRouter()
-    this.DictMessage()
     await this.getPermissions() 
     if (this.id) {
       this.$store.commit('SET_PROJECT_ID', parseInt(this.id))
@@ -96,12 +94,8 @@ export default {
       const response = await this.$api.getPermissions()
       this.$store.commit('SET_PERMISSIONS', response.data)
     },
-    //获取字典项
-    DictMessage() {
-      this.$api.DictMessage().then(response => {
-        this.$store.commit("SET_DictMessage",response.data)
-      })
-    },
+    
+
     //获取路由信息
     getRouter(){
       this.button = this.$route.meta.button || []
@@ -131,16 +125,10 @@ export default {
       })
     },
     
-//获取个人信息
-    getUserInfo() {
-      this.$api.getUserInfo().then(response => {
-        localStorage.tenant = response.data.tenantId
-        this.text = `欢迎${response.data.name}登录本系统`
-        this.$store.commit('SET_USERINFO', response.data)
-        this.connectWebSocket(response.data.id)
-      })
-    },
-  }
+  
+  },
+
+  
 }
 </script>
 <style lang="scss">

+ 30 - 0
src/views/layout/mixins/index.js

@@ -23,3 +23,33 @@ export const webSocket = {
   }
 }
 
+export const commonData={
+  mounted() {
+    // this.DictMessage()
+    // this.getUserInfo()
+    // this.getScenario()
+  },
+  methods:{
+    //获取个人信息
+    getUserInfo() {
+      this.$api.getUserInfo().then(response => {
+        localStorage.tenant = response.data.tenantId
+        this.$store.commit('SET_USERINFO', response.data)
+        this.connectWebSocket(response.data.id)
+      })
+    },
+    //获取字典项
+    DictMessage() {
+      this.$api.DictMessage().then(response => {
+        this.$store.commit("SET_DictMessage",response.data)
+      })
+    },
+    //获取应用场景
+    getScenario(){
+      this.$api.getScenario().then(response => {
+        this.$store.commit("SET_Scenario",response.data.data)
+      })
+    }
+  }
+}
+

+ 5 - 1
src/views/login/index.vue

@@ -100,11 +100,13 @@ import Storage from '@/utils/storage';
 import { formatDate, formatAxis } from '@/utils/formatTime';
 
 import resePassword from './compoments/resePassword.vue'
+import { commonData,webSocket } from "@/views/layout/mixins";
 
 export default {
   components: {
     resePassword
   },
+  mixins:[commonData,webSocket],
   data() {
     return {
       show:false,
@@ -242,7 +244,9 @@ export default {
             this.$router.push({
               path: '/home'
             })
-    
+            this.DictMessage()
+            this.getUserInfo()
+            this.getScenario()
       }).catch(error => {
         this.getCode()
         this.btnLoading = false

+ 67 - 82
src/views/project/components/drawer/form.vue

@@ -4,7 +4,7 @@
       direction="rtl" :before-close="close" destroy-on-close>
       <el-container>
         <el-main>
-          <el-form :model="ruleForm" :rules="rules" ref="ruleForm1" label-width="130px" label-position="left"
+          <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" label-position="left"
             class="demo-ruleForm">
             <el-form-item label="专题库名称" prop="name">
               <el-input v-model="ruleForm.name" placeholder="请输入专题库名称"></el-input>
@@ -13,9 +13,9 @@
               <div>
                 <el-form-item label="委托方" prop="entrustName" v-if="userinfo.tenantType == 1">
 
-                  <mySelectButton size='large' style="width:100%" @click="handleSelect">
+                  <mySelectButton size='large' style="width:100%" @click="handleSelect" >
                     <div slot="select" style="width:100%">
-                      <el-autocomplete style="width:100%" v-model="ruleForm.entrustName" ref="client" :fetch-suggestions="querySearch" v-SelectLazyLoading="loadClient"
+                      <el-autocomplete style="width:100%" v-model="ruleForm.entrustName" ref="client" value-key="name" :fetch-suggestions="querySearch" v-SelectLazyLoading="loadClient"
                         @input="input" placeholder="请输入内容" :trigger-on-focus="false" @select="handleChange">
                       </el-autocomplete>
                     </div>
@@ -32,7 +32,7 @@
             </el-form-item>
             <el-form-item label="负责人" prop="person">
               <el-select style="width:100%" v-model="ruleForm.headId" filterable remote clearable placeholder="请选择"
-                :loading="loading" v-SelectLazyLoading="loadHead" :remote-method="remoteMethod">
+                :loading="personnelList.loading" v-SelectLazyLoading="loadHead" :remote-method="remoteMethod">
                 <el-option v-for="item in personnelList.data" :key="item.id" :label="item.name" :value="item.id">
                 </el-option>
               </el-select>
@@ -56,29 +56,19 @@
                 </span>
               </div>
             </el-form-item>
-            <el-form-item label="应用场景" prop="scenarioList">
-              <el-checkbox-group v-model="ruleForm.scenarios" @change="onChange">
-                <el-checkbox v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO" :key="item.value"
-                  :label="parseInt(item.value)">{{ item.label }}</el-checkbox>
+            <el-form-item label="应用场景" prop="scenarioIds">
+              <el-checkbox-group v-model="ruleForm.scenarioIds" @change="onChange">
+                <el-checkbox v-for="item in commonData" :key="item.id"
+                  :label="parseInt(item.id)">{{ item.name }}</el-checkbox>
               </el-checkbox-group>
             </el-form-item>
             <el-form-item label="调查类型" prop="matterIds" v-if="show == true">
               <el-checkbox-group v-model="ruleForm.matterIds">
-                <template v-for="(item, index) in dictAssociateData">
-                  <el-checkbox :label="parseInt(item.dictChildValue)">
-                    {{ item.dictChildLabel }}
+                <template >
+                  <el-checkbox v-for="(item, index) in dictAssociateData" :key="index" :label="parseInt(item.id)">
+                    {{ item.name }}
                   </el-checkbox>
-                  <div v-if="index === dictAssociateData.length - 1" class="more-data-box">
-                    <el-link v-if="moreData" type="primary" icon="el-icon-arrow-down" @click="handleMoreData(0)">更多
-                    </el-link>
-                    <el-link v-else type="primary" icon="el-icon-arrow-up" @click="handleMoreData(1)">收起</el-link>
-                  </div>
                 </template>
-                <div v-show="isShow">
-                  <el-checkbox v-for="item in dictSecondAssociateData" :label="parseInt(item.dictChildValue)">
-                    {{ item.dictChildLabel }}
-                  </el-checkbox>
-                </div>
               </el-checkbox-group>
             </el-form-item>
             <template>
@@ -96,7 +86,7 @@
                   </div>
                 </el-form-item>
                 <el-form-item label="分类架构" prop="structureId" v-if="ruleForm.products && ruleForm.products.fieldId && $permission('/workspace/product')">
-                  <my-select-Tree style="width:100%" :options="structureList" @getValue="getStructureId" :props="StructureProp" :value="ruleForm.structureId"></my-select-Tree>
+                  <my-select-Tree style="width:100%" :options="structureList" :props="StructureProp" v-model="ruleForm.structureId"></my-select-Tree>
                 </el-form-item>
               </div>
             </template>
@@ -192,7 +182,7 @@ export default {
     product
   },
   props: {
-    commonData: Object
+    commonData: Array
   },
   data() {
     return {
@@ -216,18 +206,15 @@ export default {
         },
         data:[]
       },
-      //负责人下拉加载
+      //确认按钮
       loading: false,
       //显示调查类型
       show: false,
-      //显示更多调查类型
-      isShow: false,
-      //显示更多和收起按钮
-      moreData: true,
+
+
       //调查类型列表
       dictAssociateData: [],
-      //其他调查类型
-      dictSecondAssociateData: [],
+
       //用来获取调查类型
       test: {
         value: '1',
@@ -260,8 +247,10 @@ export default {
           current:1,
           size:10
         },
-        data:[]
+        data:[],
+        cb:null
       }
+      
 
     };
   },
@@ -284,10 +273,12 @@ export default {
       }
       this.ruleForm.crons=val
     },
+
     //获取架构id
     getStructureId(val){
 
     },
+
     //获取选中的值
     chooseItem({row,type}){
       this.ruleForm.products = {
@@ -312,6 +303,7 @@ export default {
     closeProduct(){
       this.productVisible = false
     },
+
     //选择事件
     change(value){
       if(this.ruleForm.eventList){
@@ -349,6 +341,7 @@ export default {
         this.showEvent = true
       })
     },
+
     //打开弹窗
     open(form, title) {
       //获取部门列表
@@ -359,12 +352,21 @@ export default {
       this.title = title
       this.drawer = true
     },
+    //关闭抽屉
+    close() {
+      this.drawer = false
+      this.clientList.queryParams.name = ''
+      this.personnelList.queryParams.name = ''
+    },
+
     //获取部门列表
     getDepartment() {
       this.$api.getPermissionDepartmentList().then((response) => {
         this.departmentList = response.data;
       });
     },
+
+
     //获取人员列表(懒加载)
     loadHead(){
       if(this.personnelList.queryParams.current * this.personnelList.queryParams.size>=this.personnelList.queryParams.total){
@@ -374,40 +376,48 @@ export default {
       this.getPersonnelList()
     },
     getPersonnelList() {
+      this.personnelList.loading = true;
       this.$api.getPermissionPersonnel(this.personnelList.queryParams).then((response) => {
-        this.personnelList.data.push(...response.data)
-        this.personnelList.queryParams.total=response.pageColumn.total
+        if(response.code == 200){
+          this.personnelList.loading = false;
+          this.personnelList.data.push(...response.data)
+          this.personnelList.queryParams.total=response.pageColumn.total
+        }
       })
     },
-    //关闭抽屉
-    close() {
-      this.drawer = false
+    //人员远程搜索
+    remoteMethod(query) {
+          this.personnelList.data=[]
+          this.personnelList.queryParams.current = 1
+          this.personnelList.queryParams.name = query
+          this.getPersonnelList()
     },
-    //远程搜索(建议调取接口获取)
+
+    
+    //远程搜索委托方(建议调取接口获取)
    async querySearch(queryString, cb) {
       this.clientList.queryParams.current = 1
       this.clientList.queryParams.name = queryString
       this.clientList.data = []
+      this.clientList.cb = cb
       await this.getClientList()
-      // // 调用 callback 返回建议列表的数据
-      cb(this.clientList.data);
+      // 调用 callback 返回建议列表的数据
+      // cb(this.clientList.data);
     },
     loadClient(){
+      if(this.clientList.queryParams.current * this.clientList.queryParams.size>=this.clientList.queryParams.total){
+        return false
+      }
       this.clientList.queryParams.current += 1
-      this.getClientList('load')
+      this.getClientList()
     },
     //获取委托方
-    async getClientList(type){
+    async getClientList(){
       await this.$api.getAdminClientList(this.clientList.queryParams).then(res => {
         if (res.code == 200) {
-          res.data.records.forEach(item => {
-            item.value = item.name
-          });
-          if(type){
-            this.$refs['client'].$data.suggestions.push(...res.data.records)
-          }else{
             this.clientList.data.push(...res.data.records)
-          }
+            this.clientList.queryParams.total = res.data.total
+            this.clientList.cb(this.clientList.data);
         }
       })
     },
@@ -435,52 +445,30 @@ export default {
     close2() {
       this.visible = false
     },
-    //负责人远程搜索
-    remoteMethod(query) {
-      
-    },
-    //负责人下拉懒加载
-    lazyLoading() {
 
-    },
     //调查类型选择切换
     onChange() {
-      if (this.ruleForm.scenarioList.length != 0) {
+      if (this.ruleForm.scenarioIds.length != 0) {
         this.show = true
-        this.test.value = this.ruleForm.scenarioList.toString()
-        this.test.flag = 1
-        this.$api.getDictTreeByParentDictValue(this.test).then(response => {
-          this.dictAssociateData = response.data
-          this.test.value = this.ruleForm.scenarioList.toString()
-          this.test.flag = 0
-          this.$api.getDictTreeByParentDictValue(this.test).then(response => {
-            this.dictSecondAssociateData = response.data
-          })
+        this.$api.getMatter(this.ruleForm.scenarioIds).then(response => {
+          this.dictAssociateData = response.data.data
         })
       } else {
         this.show = false
       }
     },
-    //调查类型展开收起
-    handleMoreData(type) {
-      if (type === 0) {
-        this.isShow = true
-        this.test.value = this.ruleForm.scenarioList.toString()
-        this.test.flag = 0
-        this.$api.getDictTreeByParentDictValue(this.test).then(response => {
-          this.dictSecondAssociateData = response.data
-        })
-      } else if (type === 1) {
-        this.isShow = false
-      }
-      this.moreData = !this.moreData
-    },
+
     //提交数据
     submit() {
       this.$refs.ruleForm.validate((valid) => {
         if (valid) {
           this.show = false
           this.loading = true
+          console.log(this.ruleForm)
+          this.ruleForm.trees = []
+          if(this.ruleForm.products){
+            this.ruleForm.trees.push(this.ruleForm.products)
+          }
           if (this.ruleForm.id) {
             this.$api.editProject(this.ruleForm).then(response => {
               this.loading = false
@@ -493,9 +481,6 @@ export default {
           } else {
             this.$api.addPatentProject(this.ruleForm).then(response => {
               this.loading = false
-              let permissions = this.permissions
-              permissions[response.data] = 0
-              this.$store.commit('SET_PERMISSIONS', permissions)
               this.$message.success('新增成功')
               this.$emit('submit', 1)
               this.close()

+ 70 - 20
src/views/project/index.vue

@@ -22,7 +22,7 @@
                 <span>分组查询:</span>
                 <el-select v-model="group" :disabled="!$permission('/workspace/project/check')" clearable size="small"
                   @change="onChange" style="width:200px">
-                  <el-option v-for="item in commonData.QUERY_GROUP" :key="item.value" :label="item.label"
+                  <el-option v-for="item in groupingOption" :key="item.value" :label="item.name"
                     :value="parseInt(item.value)">
                   </el-option>
                 </el-select>
@@ -51,7 +51,7 @@
           <el-main class="workspace-main">
             <div v-loading="loading">
               <component :is="viewType" v-bind="$attrs" v-on="$listeners" :isOperate="isOperate" :tableData="dataList"
-                :common-data="commonData" :group="group" :params="queryParams" :field="fieldList" @option="handleOption"
+                :common-data="commonData" :group="group" :params="queryParams" :column="fieldList" @option="handleOption"
                 @on-sort="handleSort"></component>
             </div>
             <div class="pagination" v-if="[2].indexOf(isOperate) == -1">
@@ -70,8 +70,8 @@
       </div>
 
     </div>
-    <project-form-drawer @submit="submitProjectForm" :common-data="commonData" ref="projectFormDrawer" />
-    <field ref="field"></field>
+    <project-form-drawer @submit="getMessage" :common-data="commonData" ref="projectFormDrawer" />
+    <field ref="field" type="patentProject" @getFieldList="getFieldList"></field>
   </div>
 </template>
 
@@ -143,10 +143,10 @@ export default {
           "orderType": 1
         }
       ],
+      //分组集合
+      groupingOption:[],
       //分组
       group: '',
-      //字典项
-      commonData: {},
       //展示的视图
       queryShowType: '0',
       //显示的视图组件
@@ -157,27 +157,69 @@ export default {
       dataList: [],
       //栏位集合
       fieldList: [],
+      //接受子组件消息
+      handleMessage:'',
     };
   },
   watch: {},
   computed: {
-    ...mapGetters(['userinfo'])
+    ...mapGetters(['userinfo']),
+    commonData(){
+      return this.$store.state.dictMessage.scenario
+    }
   },
   created() { },
   mounted() {
-    //获取字典项(接口还是通过字典获取)
-    this.$api.getCommonData({ keys: 'QUERY_GROUP,ENTERPRISE_APPLICATION_SCENARIO,INVESTIGATION_TYPE' }).then(response => {
-      this.commonData = response.data
-    })
+
+    //获取检索字段和分组字段
+    this.getColumn()
     //获取应用场景统计
-    if ([2].indexOf(this.isOperate) == -1) {
-      this.getScenarioAndTypeTotal();
-    }
+    // if ([2].indexOf(this.isOperate) == -1) {
+    //   this.getScenarioAndTypeTotal();
+    // }
 
     //获取专题库列表
     this.getList()
   },
   methods: {
+    //获取自定义栏位
+    getFieldList(data){
+      this.fieldList  = data
+    },
+    //获取检索字段和分组字段
+    async getColumn() {
+      let params = ['patentProject']
+      await this.$api.getParamsCommon(params).then(res => {
+        if (res.code == 200) {
+          // 显示栏位
+          // this.columnList = res.data[0].conditionDTOList.filter(item => {
+          //   return item.name != 'Id' && item.ifShow == true
+          // })
+          // 分组字段
+          let conditionDTOList= JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
+          this.groupingOption = this.$commonJS.getField(conditionDTOList,(u)=> u.ifGroup == true,{
+            name: 'name',
+            value: 'value',
+          })
+          // 搜索字段
+          this.searchFiled = this.$commonJS.getField(conditionDTOList,(u)=> u.ifSearch == true ,{
+            label: 'name',
+            value: 'value',
+            type:'type',
+          })
+          // 为3是下拉框选择
+          // this.searchFiled.forEach(item => {
+          //   if (item.type == '3') {
+          //     item.options=this.scene
+          //   }
+          // })
+        }
+      })
+      this.showView = false
+      this.$nextTick(() => {
+        this.showView = true
+      })
+    },
     //获取应用场景统计
     getScenarioAndTypeTotal() {
       this.$api.getScenarioAndTypeTotal().then((response) => {
@@ -213,12 +255,12 @@ export default {
         orderDTOList:this.sort,//排序
       }
       this.loading = true
-      this.$api.getProjectListV2(params).then(response => {
-        this.dataList = response.data.records
+      this.$api.queryPatentProject(params).then(response => {
+        this.dataList = response.data.data
         this.total = response.data.total
         this.loading = false
       }).catch(error => {
-        this.dataList = [{}, {}]
+        this.dataList = []
         this.total = 0
         this.loading = false
       })
@@ -316,12 +358,20 @@ export default {
         crons:'',
         status: '0',
         sort: 1,
-        typeList: [],
-        scenarios: []
+        matterIds: [],
+        scenarioIds: []
       }, '新增专题库')
     },
     //确认提交专题库信息
-    submitProjectForm() { },
+    getMessage(val) {
+      this.handleMessage = val
+      this.getList()
+     },
+     clearMessage(){
+      this.$nextTick(()=>{
+        this.handleMessage = ''
+      })
+     },
     //导出列表
     handleExport() {
       this.btnLoading = true