Quellcode durchsuchen

Merge branch 'V0.0.2' of http://10.87.10.227:4000/jzyd_yyds/soc_app into V0.0.2

coys vor 2 Jahren
Ursprung
Commit
bfe33573a5

+ 6 - 3
src/components/dateCell/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="date-cell" >
     <van-cell v-if="disabled" :title="title" :label="selected" />
-    <van-cell v-else :title="title" is-link :label="selected" @click="clickItem">
+    <van-cell v-else :title="title" :label="selected" @click="clickItem">
       <template #right-icon>
         <van-icon name="notes-o" class="date-icon"/>
       </template>
@@ -114,10 +114,13 @@ export default {
 <style lang="scss">
 .date-icon{
   font-weight: 500;
-  line-height: inherit;
   width: 42px;
-  height: 42px;
+  height: 6.4vw;
   color: #008cd6;
   font-size: 42px;
+  line-height: 6.4vw;
+}
+.van-cell__label{
+  margin: 0;
 }
 </style>

+ 17 - 55
src/components/selectCell/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="date-cell">
     <van-cell v-if="disabled" :required="required" :title="title" :label="label"/>
-    <van-cell v-if="!disabled"  :required="required" :title="title" :label="label" is-link  @click="clickItem"/>
+    <van-cell v-else  :required="required" :title="title" :label="label" is-link  @click="clickItem"/>
     <van-popup v-model="showPicker" round lazy-render position="bottom" :close-on-popstate="true" get-container="#app">
       <van-picker
         v-bind="$attrs"
@@ -34,11 +34,6 @@ export default {
       type: [Boolean,String],
       default: false,
     },
-    //字典表
-    dict:{
-      type: String,
-      default: null,
-    },
     //标题
     title:{
       type: String,
@@ -63,60 +58,25 @@ export default {
   data(){
     return{
       showPicker:false,
-      selected:null,
       label:'',
-      columns: [],
     }
   },
-  watch:{
-    dict:{
-      handler(val){
-        if(!val) return;
-        if(this.dataList.length) return;
-        this.queryDict();
-      },
-      immediate: true
+  computed:{
+    columns(){
+      return this.dataList;
     },
-    dataList:{
-      handler(val){
-        if(this.dict) return;
-        this.columns = this.dataList;
-      },
-      immediate: true
-    },
-    value:{
-      handler (val) {
-        console.log(val, '6666')
-        if(!val){
-          this.selected = null;
-          this.label = null;
-        }else{
-          setTimeout(()=>{
-            this.columns.forEach(v=> {
-              console.log(v[this.prop.value], '7777')
-              if (v[this.prop.value] === val) {
-                this.selected = v;
-                this.label = v[this.prop.label];
-              }
-            })
-          },200)
-          // this.selected = val;
-          // this.label = val.dictLabel;
+    selected(){
+      let val;
+      this.columns.forEach(v=> {
+        if (v[this.prop.value] === this.value) {
+          val = v;
+          this.label = v[this.prop.label];
         }
-      },
-      immediate:true
-    }
+      });
+      return val;
+    },
   },
   methods:{
-    queryDict(){
-      console.log(this.dict,'this.dict')
-      getDict( this.dict ).then(res => {
-        let { code, data, msg } = res;
-        if (code == 200) {
-         this.columns = data;
-        }
-      })
-    },
     cancelPicker(){
       this.showPicker = false;
     },
@@ -137,6 +97,8 @@ export default {
 }
 </script>
 
-<style scoped>
-
+<style lang="scss" scoped>
+.van-cell__label{
+  margin: 0;
+}
 </style>

+ 1 - 1
src/config/env.development.js

@@ -1,7 +1,7 @@
 /** 本地开发环境*/
 module.exports = {
   title: 'soc-app-dev',
-  baseUrl: 'http://localhost:9018', // 项目地址
+  baseUrl: 'http://10.87.10.55:8080/', // 项目地址
   baseApi: '/dev', // 本地api请求地址,注意:如果你使用了代理,请设置成'/'
   APPID: 'xxx',
   APPSECRET: 'xxx',

+ 1 - 0
src/store/getters.js

@@ -5,6 +5,7 @@ const getters = {
   orgName: state => state.user.orgName,
   roleList: state => state.user.userRoleList,
   orgTree: state => state.app.orgTree,
+  dictionary: state => state.app.dictionary,
 }
 
 export default getters

+ 19 - 17
src/store/modules/app.js

@@ -14,7 +14,7 @@ export default {
     //行社机构树
     depTree: [],
     //字典
-    dicts: {}
+    dictionary: []
   },
   mutations : {
     SET_USER_NAME(state, name) {
@@ -26,29 +26,31 @@ export default {
     SET_DEPTREE: (state, val) => {
       state.depTree = val
     },
-    SET_DICT_ITEM(state, {key, value}) {
-      console.log(value,'val' )
-      state.dicts[key] = value;
+    SET_DICT_ITEM(state, dictItem) {
+      console.log(dictItem,'dictItem' )
+      state.dictionary.push(dictItem);
     }
   },
   actions : {
-    //获取字典
-    getDicts({commit, state}, key) {
+    //设置字典
+    setDict({commit, state}, key) {
+      console.log('字典已存在:',state.dictionary.some(item => item.key === key));
       return new Promise((resolve, reject) => {
-        if (state.dicts[key]) {
-          resolve(state.dicts[key]);
-        } else {
-          getDict(key).then(res => {
-            console.log(res.data,'ressssss')
-            commit('SET_DICT_ITEM', {key, value: res.data});
-            console.log(state.dicts,'dict')
-            resolve(res.data);
-          }).catch(error => {
-            reject(error)
-          })
+        if(state.dictionary.some(item => item.key === key)){
+          console.log('字典已存在2:',state.dictionary[key]);
+          return resolve('已存在');
         }
+        getDict(key).then(res => {
+          commit('SET_DICT_ITEM', {key, value: res.data});
+          console.log('存入字典:',state.dictionary,key)
+          resolve('设置成功');
+        }).catch(error => {
+          reject('设置成功')
+        })
       })
     },
+
+
     //获取用户机构树
     getOrgTree({commit, state}) {
       return new Promise((resolve, reject) => {

+ 25 - 11
src/utils/globalMixins.js

@@ -1,27 +1,40 @@
 import { getDict } from '@/api/toConsult.js'
 import dayjs from 'dayjs'
 import Dicts from '../utils/dicts'
+import {mapActions} from 'vuex'
 export default {
   data() {
     return {
-      //字典['dict_type']
-      dicts:[]
+
     }
   },
   created() {
-    /** 组件中设置dictType,即可获取相应的value*/
+    /** 组件中设置dicts数组,会将字典存储在vuex中*/
     if(this.dicts && this.dicts.length > 0){
-      this.dicts.forEach(item=>{
-        this.getDictHandler(item,(res)=>{
-          this[item] = res
-        })
-      })
+      this.setDicts()
+      // this.dicts.forEach(item=>{
+      //   this.getDictHandler(item,(res)=>{
+      //     this[item] = res
+      //   })
+      // })
     }
   },
-  computed:{
-
-  },
   methods: {
+    ...mapActions(['setDict']),
+    setDicts(){
+      this.dicts.forEach(item=>{
+        this.setDict(item)
+      })
+    },
+    /** 获取字典值
+     * 组件页面中需要设置:mapGetters(['dictionary']']),
+     * */
+    getDictItem(key){
+      let item = this.dictionary?.find((v)=>{
+        return  v.key === key
+      })
+      return item?.value
+    },
     //时间范围模板:2020-01-01~2020-01-02
     rangDate(start,end,a){
       if(!start || !end) return '暂无';
@@ -35,5 +48,6 @@ export default {
         callBack(data)
       })
     },
+
   }
 }

+ 4 - 73
src/views/menu/problemItem/api.js

@@ -2,9 +2,9 @@ import request from "@/utils/request";
 //获取列表
 export function dataList(data) {
   return request({
-    url: "/core/eduTask/report",
-    method: "post",
-    data,
+    url: "/core/question/list",
+    method: "get",
+    params: data,
   });
 }
 //获取计划列表
@@ -14,73 +14,4 @@ export function planList(orgId){
     method: "get",
   });
 }
-export const json = {
-  "msg": "操作成功",
-  "code": 200,
-  "data": [
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974731112400,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974794027000,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974794027000,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974794027000,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974794027000,
-      "name": "网点安全员每月培训计划"
-    },
-    {
-      "id": 1698299974794027000,
-      "name": "网点安全员每月培训计划"
-    }
-  ]
-}
+

+ 15 - 24
src/views/menu/problemItem/index.vue

@@ -2,11 +2,11 @@
   <div class="problem-item">
     <NavBar />
     <div class="page-container">
-      <van-search v-model="query.value" class="van-hairline--bottom" placeholder="请输入搜索关键词" />
+      <van-search v-model="query.searchKey" class="van-hairline--bottom" placeholder="请输入搜索关键词" />
       <org-tree v-model="query.orgId"  @change="getDataList"></org-tree>
       <div class="search-flex">
-        <select-cell class="van-hairline--right" title="确认状态" v-model="query.planId" :dataList="planList" :prop="prop" @change="getDataList"/>
-        <date-cell title="发现日期"  v-model="query.date" date-type="year-month" @change="getDataList"/>
+        <select-cell class="van-hairline--right" title="确认状态" v-model="query.confirmStatus" :data-list="getDictItem('question_confirm_status')" @change="getDataList"/>
+        <date-cell title="发现日期"  v-model="query.submitTime" date-type="year-month" @change="getDataList"/>
       </div>
       <div class="card-list">
         <van-empty description="暂无数据" v-if="!dataList || dataList.length === 0" />
@@ -50,16 +50,14 @@ export default {
   data() {
     return {
       query:{
-        value: '',
-        date:null,
+        searchKey: null,
+        submitTime:null,
         orgId:null,
-        planId:null,
+        confirmStatus:'0',
+        pageSize:20,
+        pageNum:1,
       },
       planList:[],
-      prop:{
-        label:'name',
-        value:'id',
-      },
       loading:false,
       columns:[
         {
@@ -77,37 +75,30 @@ export default {
         { field: "finish", key: "c", title: "已完成数",align: "center" },
         { field: "finishRate", key: "d", title: "完成率", align: "center" },
       ],
-      dataList:[]
+      dataList:[],
+      dicts:['question_confirm_status','question_reform_status']
     }
   },
   mounted() {
     this.initData();
   },
   computed:{
-    ...mapGetters(['orgId']),
+    ...mapGetters(['orgId','dictionary']),
+
   },
   methods: {
     //初始化数据
     initData(){
       this.query.orgId = this.orgId;
-      this.getPlanList();
-    },
-    //获取教育计划列表
-    getPlanList(){
-      planList(this.query.orgId).then(res=>{
-        this.planList = res.data;
-        if(res.data.length === 0) return this.$toast('暂无教育计划');
-        this.query.planId = res.data[0].id;
-        this.query.date = formatDate(new Date(),'YYYY-MM');
-        this.getDataList();
-      })
+      this.query.submitTime = formatDate(new Date(),'YYYY-MM');
+      this.getDataList();
     },
     //获取数据列表
     getDataList(){
       let data = {
         ...this.query
       }
-      data.date = this.query.date && `${this.query.date}-01`;
+      data.submitTime = this.query.submitTime && `${this.query.submitTime}-01`;
       if(!this.query.orgId) return this.$toast('请选择机构');
       dataList(data).then(res=>{
         this.dataList = res.data;

+ 8 - 0
vue.config.js

@@ -51,6 +51,14 @@ module.exports = defineConfig({
     },
     /*本地开发请求代理*/
     proxy: {
+      '/online': {
+        target: "http://47.92.229.224:8081",
+          // ws:true,
+          changOrigin:true,
+          pathRewrite:{
+          '^/online':'/'
+        }
+      },
       //配置跨域
       '/luojun': {
           target: "http://10.87.10.49:8080",