Karsa 3 місяців тому
батько
коміт
6b09f070a4

+ 94 - 1
src/api/modules/dataApi.js

@@ -346,11 +346,104 @@ const dataInterence = {
 	/**
 	 * 可批量加入的指标列表
 	 * @param {*} params 
+	 * 	"ListAll": true,
+		"FrequencyList": [],
+		"ClassifyIdList": [],
+		"UserIdList": [],
+		"TradeCodeList": [],
+		"Keyword": "测试混合表格"
 	 */
 	getBatchAddListV2: params => {
-		return http.get('/entry/target/edb/batch/list',params)
+		return http.post('/entry/target/edb/batch/list',params)
 	},
 
+	/**
+	 * 编辑指标数据全量
+	 * @param {*} params 
+	 * "ClassifyId": 20,
+		"Frequency":"日度",
+		"Unit":"吨",
+		"TradeCode":""
+	 * @returns 
+	 */
+	editEdbDataV2: params => {
+		return http.post('/entry/target/edb/excel_style/edit',params)
+	},
+
+	/**
+	 * 批量入库时校验
+	 * @param {*} params 
+	 * 
+		"ListAll": true,
+		"FrequencyList"
+		"ClassifyIdList"
+		"UserIdList"
+		"TradeCodeList": []
+	 * @returns 
+	 */
+	checkAddListV2: params => {
+		return http.post('/entry/target/edb/batch/add/check',params)
+	},
+
+	/**
+	 * 批量入库校验名称
+	 * @param {*} params []
+	 * "EdbCode": "W001117",
+		"EdbName": "美国:堪萨斯联储制造业指数:同比增减:原料价格"
+	 * @returns 
+	 */
+	checkAddListNameV2: params => {
+		return http.post('/entry/target/edb/batch/add/name_check',params)
+	},
+
+	/**
+	 * 批量加入指标库
+	 * @param {*} params 
+	 * @returns 
+	 */
+	addToBaseBatchV2: params => {
+		return http.post('/entry/target/edb/batch/add',params)
+	},
+
+	/**
+	 * 校验是否可删除
+	 * @param {*} params 
+	 * 	"ListAll": true,
+			"FrequencyList": [],
+			"ClassifyIdList": [],
+			"UserIdList": [],
+			"TradeCodeList": [,
+    	"Keyword":""
+	 * @returns 
+	 */
+	checkDelListV2: params => {
+		return http.post('/entry/target/edb/batch/del/check',params)
+	},
+	
+	/**
+	 * 批量删除指标
+	 * @param {*} params 
+	 * "ListAll": true,
+			"FrequencyList": [],
+			"ClassifyIdList": [],
+			"UserIdList": [],
+			"TradeCodeList": [,
+    	"Keyword":""
+	 * @returns 
+	 */
+	delEdbBatchV2: params => {
+		return http.post('/entry/target/edb/batch/del',params)
+	},
+
+	/**
+	 * 操作日志接口
+	 * @param {*} params 
+	 * PageSize=10 CurrentIndex=1 TradeCode=W001116
+	 * @returns 
+	 */
+	getOperaLogsList: params => {
+		return http.get('/entry/target/edb/op/record/list',params)
+	}
 
 }
 

+ 5 - 4
src/lang/modules/DataSources/En.js

@@ -43,8 +43,8 @@ export default {
     right_op_insertcol:'Insert Column',
     right_op_delrow:'Delete Row',
     right_op_delcol:'Delete Column',
-    label_one_level_classify:'Primary Category',
-    label_edb_classify:'Indicator Category',
+    label_one_level_classify:'Variety',
+    label_edb_classify:'Sub-Variety',
     use_intro:'Instructions for Use',
     use_msg:` 1、Add new indicators: Enter the name, unit and value of the indicator under the column of the preset indicator and save it;</br>
     2、Add date: select a date in the first column or insert a date line (to copy the existing date format), enter the value and save it;</br>
@@ -79,8 +79,9 @@ export default {
     opera_time:'Operation Time',
     opera_msg:'Operation Content',
     opera_user:'Operator',
-    insert_up_row:'Insert {num} Row Above',
-    insert_down_row:'Insert {num} Row Below',
+    insert_up_row:'Insert Row Above',
+    insert_down_row:'Insert Row Below',
+    max_batch_msg: 'Please do not add more than 30 metrics at a time!'
   },
 
   /* 期货数据库页面 */

+ 3 - 2
src/lang/modules/DataSources/Zh.js

@@ -43,8 +43,8 @@ export default {
     right_op_insertcol:'插入列',
     right_op_delrow:'删除行',
     right_op_delcol:'删除列',
-    label_one_level_classify:'一级分类',
-    label_edb_classify:'指标分类',
+    label_one_level_classify:'品种',
+    label_edb_classify:'子品种',
     use_intro:'使用说明',
     use_msg:` 1、新增指标:在预设好的指标列下输入指标名称、单位、数值并保存;</br>
     2、新增日期:在第一列选择日期或插入日期行(需复制已有日期格式)输入数值并保存;</br>
@@ -81,6 +81,7 @@ export default {
     opera_user:'操作人',
     insert_up_row:'向上插入',
     insert_down_row:'向下插入',
+    max_batch_msg:'批量添加指标数量不得超过30个!'
   },
 
   /* 期货数据库页面 */

+ 3 - 25
src/views/dataEntry_manage/components/insertData.vue

@@ -24,7 +24,7 @@
         <h3><!-- 下载导入模板 -->{{$t('ManualEntryPage.down_tem')}}</h3>
         <div class="templete-wrap">
           <div class="item" v-for="tem in templateList" :key="tem.name">
-            <a :href="`${tem.url}${$i18nt.locale==='zh'?'':'/en'}`" download="模板">
+            <a :href="tem.url" download="模板">
               <el-button type="primary" icon="el-icon-download">{{tem.name}}</el-button>
             </a>
             <div>
@@ -87,15 +87,10 @@ export default {
     isShowinsert: {
       type: Boolean,
     },
-    source: {
-      type: String,
-    },
   },
   data() {
     return {
       action: process.env.VUE_APP_API_ROOT + "/entry/import/data", //上传文件
-      downloadTemplate: process.env.VUE_APP_API_ROOT + "/entry/template", //模板下载
-      downloadTemplateTwo: process.env.VUE_APP_API_ROOT + "/entry/template", //模板下载
       downloadErrorlist:
         process.env.VUE_APP_API_ROOT +
         "/entry/import/failList" +
@@ -105,12 +100,12 @@ export default {
       templateList: [
         {
           name:/* "模板1"  */this.$t('ManualEntryPage.tem_msg',{index:1}),
-          url: this.downloadTemplate,
+          url: process.env.VUE_APP_API_ROOT + "/entry/template?Source=1",
           previewImg: require('@/assets/img/data_m/tem1.png')
         },
         {
           name:/* "模板2" */this.$t('ManualEntryPage.tem_msg',{index:2}),
-          url: this.downloadTemplateTwo,
+          url: process.env.VUE_APP_API_ROOT + "/entry/template?Source=2",
           previewImg: require('@/assets/img/data_m/tem2.png')
         },
       ],
@@ -125,23 +120,6 @@ export default {
       previewList: []
     };
   },
-  watch: {
-    source: {
-      handler(nval) {
-        if (nval === "targetList") {
-          this.action = process.env.VUE_APP_API_ROOT + "/entry/target/import";
-          this.downloadTemplate =
-            process.env.VUE_APP_API_ROOT + "/entry/target/template";
-          this.downloadErrorlist =
-            process.env.VUE_APP_API_ROOT +
-            "/entry/import_target/failList" +
-            `?${localStorage.getItem("auth")}`;
-          this.name = "ImportTargetFile";
-        }
-      },
-      immediate: true,
-    },
-  },
   methods: {
     cancelHandle() {
       this.$emit('update:isShowinsert',false)

+ 355 - 113
src/views/dataEntry_manage/dataEntry/addToBaseList.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="batch-opera-list">
-    <div class="header">
+    <div class="header" v-if="step===1">
       <div class="left">
 
         <el-cascader
@@ -10,10 +10,11 @@
             label: 'ClassifyName',
             value: 'ClassifyId',
             children: 'Child',
-            emitPath: false
+            emitPath: false,
+            multiple:true
           }"
           style="width: 200px;"
-          placeholder="品种"
+          :placeholder="$t('ManualEntryPage.label_vaiety')"
           clearable
           @change="filterChange"
         />
@@ -23,22 +24,25 @@
           @change="filterChange"
           :placeholder="$t('Edb.InputHolderAll.input_fre')"
           clearable
+          multiple
         >
           <el-option v-for="item in frequencyOptions" :key="item.val" :label="item.label" :value="item.val"/>
         </el-select>
 
         <el-cascader
-          v-model="filterObj.user"
+          v-model="filterObj.users"
           :options="userOptions"
           :props="{
-            label: 'ChartClassifyName',
-            value: 'ChartClassifyId',
+            label: 'NodeName',
+            value: 'NodeId',
             children: 'Children',
-            emitPath: false
+            emitPath: false,
+            multiple: true
           }"
           style="width: 250px;"
           placeholder="请选择创建人"
           clearable
+           @change="filterChange"
         />
 
         <el-input 
@@ -60,72 +64,170 @@
           ><!-- 列表全选 -->{{$t('SystemManage.OperateAuth.all_select')}}</el-checkbox>
       </div>
 
-      <el-button 
-        v-permission="permissionBtn.dataSourcePermission.selfData_addEdb"
-        type="primary" 
-        @click="handleCheckEdb('multiple')"
+      <span>{{$t('SystemManage.OperateAuth.label_checked')}}:{{ isSelectAll ? (total-filterDuplicateChecked.length) : filterDuplicateChecked.length }}</span>
+      <el-button
+        type="primary"
+        v-if="$route.path==='/batchDelList'"
+        @click="handleBatchDel"
       ><!-- 批量删除 -->{{$t('ManualEntryPage.batch_del')}}</el-button>
     </div>
 
     <div class="main">
-      <el-table
-        :data="tableData"
-        ref="table"
-        element-loading-text="加载中..."
-        v-loading="tableLoading"
-        border
-        style="margin:20px 0"
-        @selection-change="selectionChange"
-        @select="selectHandle" 
-        @select-all="selectAllPageHandle"
-      >
-          <el-table-column
-            type="selection"
-            width="55"
+      <template v-if="step===1">
+        <el-table
+          :data="tableData"
+          ref="table"
+          element-loading-text="加载中..."
+          v-loading="tableLoading"
+          border
+          style="margin:20px 0"
+          @selection-change="selectionChange"
+          @select="selectHandle" 
+          @select-all="selectAllPageHandle"
+        >
+            <el-table-column
+              type="selection"
+              width="55"
+            />
+            <el-table-column
+              v-for="item in tableColums"
+              :key="item.label"
+              :label="item.label"
+              :prop="item.key"
+              :width="item.widthsty"
+              :min-width="item.minwidthsty"
+              align="center"
+            >
+              <template slot-scope="{row}">
+
+                <template v-if="item.key==='SecName'">
+                  <span style="white-space: pre-wrap;">{{ row.SecName }}</span>
+                </template>
+
+                <span v-else>{{ row[item.key] }}</span>
+              </template>
+            </el-table-column>
+            
+            <div slot="empty" style="padding: 100px 0">
+              <tableNoData :text="$t('Table.prompt_slogan')" size="mini"/>
+            </div>
+        </el-table>
+
+        <div style="height:35px;margin: 20px 0;">
+          <m-page
+            :page_no="page_no"
+            :pageSize="pageSize"
+            :total="total"
+            @handleCurrentChange="pageChange"
           />
-          <el-table-column
-            v-for="item in tableColums"
-            :key="item.label"
-            :label="item.label"
-            :prop="item.key"
-            :width="item.widthsty"
-            :min-width="item.minwidthsty"
-            align="center"
-          >
-            <template slot-scope="{row}">
+        </div>
+
+        <div class="add-handles-bot" v-if="$route.path==='/batchToBase'">
+          <el-button @click="$router.go(-1)" style="width:120px"><!-- 取消 -->{{$t('Dialog.cancel_btn')}}</el-button>
+          <el-button @click="handleNextStep" type="primary" style="width:120px;margin-left:5%;"><!-- 下一步 -->{{$t('Dialog.next_step')}}</el-button>
+        </div>
+      </template>
+
+      <!-- 第二步 -->
+      <template v-else>
+        <el-table 
+          :data="addToBaseList" 
+          border 
+          height="500px"
+        >
+          <el-table-column :label="$t('Edb.Detail.e_id')" align="center" prop="TradeCode">
+            <template slot="header" slot-scope="scope">
+                  {{$t('Edb.Detail.e_id')}}
+            </template>
+            <template slot-scope="scope">
+                {{scope.row.TradeCode}}
+            </template>
+          </el-table-column>
 
-              <template v-if="item.key==='IndexName'">
-                <span style="white-space: pre-wrap;">{{ row.IndexName }}</span>
+          <el-table-column :label="$t('Edb.Detail.e_name')" align="center" width="210px">
+              <template slot-scope="scope">
+                <div class="name-cell">
+                    <el-input 
+                      v-model="scope.row.SecName" 
+                      placeholder="请填写指标名称" 
+                      style="width:100%;margin:5px 0;"
+                      :class="existNameArr.includes(scope.row.SecName)&&'error-ipt'"
+                    />
+                  <div class="error" v-if="existNameArr.includes(scope.row.SecName)">
+                    <span>指标名称已存在,请重新填写</span>
+                  </div>
+                </div>
               </template>
-
-              <span v-else>{{ row[item.key] }}</span>
+          </el-table-column>
+          <el-table-column :label="$t('Edb.Detail.e_unit')" align="center" width="150px">
+              <template slot-scope="scope">
+                  <selectUnit v-model="scope.row.Unit"/>
+              </template>
+          </el-table-column>
+          <el-table-column :label="$t('Edb.Detail.e_fre')" align="center" width="120px">
+            <template slot-scope="scope">
+              <el-select
+                v-model="scope.row.Frequency"
+                placeholder="请选择频率"
+              >
+                <el-option
+                  v-for="item in frequencyOptions"
+                  :key="item.val"
+                  :label="item.label"
+                  :value="item.val"
+                >
+                </el-option>
+              </el-select>
             </template>
           </el-table-column>
-          
-          <div slot="empty" style="padding: 100px 0">
-            <tableNoData :text="$t('Table.prompt_slogan')" size="mini"/>
-          </div>
-      </el-table>
-
-      <div style="height:35px;margin: 20px 0;">
-        <m-page
-          :page_no="page_no"
-          :pageSize="pageSize"
-          :total="total"
-          @handleCurrentChange="pageChange"
-        />
-      </div>
-
-      <div class="add-handles-bot">
-        <el-button @click="$router.go(-1)" style="width:120px"><!-- 取消 -->{{$t('Dialog.cancel_btn')}}</el-button>
-         <el-button @click="saveMarker" type="primary" style="width:120px;margin-left:5%;"><!-- 下一步 -->{{$t('Dialog.next_step')}}</el-button>
-      </div>
+          <el-table-column align="center" width="280px">
+              <template slot="header" slot-scope="scope">
+                  <span style="margin-right:40px;display:inline-block">目录</span>
+                  <el-radio-group 
+                    v-model="classifyType"
+                    @change="handleClassifyTypeChange"
+                  >
+                      <el-radio :label="0">分目录</el-radio>
+                      <el-radio :label="1">同目录</el-radio>
+                  </el-radio-group>
+              </template>
+              <template slot-scope="{row,$index}">
+                    <el-cascader
+                      v-model="row.EtaClassifyId"
+                      :options="edbBaseClassify"
+                      :props="{	
+                        label: 'ClassifyName',
+                        value: 'ClassifyId',
+                        children: 'Children',
+                        checkStrictly: true,
+                        emitPath:false
+                      }"
+                      placeholder="请选择指标目录"
+                      :disabled="(classifyType===1&&$index>0)"
+                      @change="handleClassifyChange(row,$index)"
+                      class="cascader-wrapper"
+                    />
+              </template>
+          </el-table-column>
+        </el-table>
+
+        <div style="text-align: center; margin: 30px 0">
+          <el-button @click="handlePrevStep">{{$t('Dialog.prev_step')}}</el-button>
+          <el-button
+            type="primary"
+            @click="handleCheckName"
+            :loading="saveLoading"
+          >
+            {{ $t("Dialog.confirm_save_btn") }}
+          </el-button>
+        </div>
+      </template>
     </div>
 
   </div>
 </template>
 <script>
-import { dataInterence } from '@/api/api.js';
+import { dataInterence,dataBaseInterface,departInterence } from '@/api/api.js';
 import { selfDataInterface } from '@/api/modules/dataSource';
 import mPage from '@/components/mPage.vue';
 export default {
@@ -135,11 +237,11 @@ export default {
         return [
           {
             label: this.$t('Edb.Detail.e_id'),
-            key: 'IndexCode',
+            key: 'TradeCode',
           },
          {
             label: this.$t('Edb.Detail.e_name'),
-            key: 'IndexName',
+            key: 'SecName',
           },
           {
             label: /* '最新日期' */this.$t('Edb.Detail.e_latest_date'),
@@ -148,7 +250,7 @@ export default {
           },
           {
             label: /* '最新值' */this.$t('Edb.Detail.e_latest_value'),
-            key: 'EndDate',
+            key: 'LatestValue',
             sortable:true,
           },
           {
@@ -193,6 +295,10 @@ export default {
             1:this.$t('YsDataPage.haved_all_msg'),//本次添加的指标均已在指标库中,请勿重复添加!
             2:this.$t('YsDataPage.haved_some_msg'),//指标库中已存在以下指标,会自动过滤!
         }[key]
+    },
+
+    filterDuplicateChecked() {
+      return Array.from(new Set(this.checkedList))
     }
   },
   data() {
@@ -203,6 +309,7 @@ export default {
       tableData: [],
 
       classifyList: [],
+      userOptions: [],
 
       isSelectAll: false, //真正意义上的全选或不全选
       checkedList: [], //不全选勾选中的 或 全选取消勾的
@@ -211,29 +318,76 @@ export default {
       filterObj: {
         page_no: 1,
         pageSize: 10,
-        classify: '',
-        frequency: '',
+        classify: [],
+        frequency: [],
+        users: [],
         keyWord: '',
-        sortParam:'',
-        sortType:'',
         checkAll: false, //控制全选显示状态
         checkSome: false
       },
 
-      /* 加入指标库弹窗 */
-      isAddToBaseDia: false,
-      addToType: 'multiple',
+      step: 1,
+      classifyType:0,//目录方式
+      edbBaseClassify: [],
       addToBaseList: [],//可加入的指标
       existEdbList: [],//已存在的指标
+      existNameArr:[]
 
     }
   },
   mounted(){
     this.getClassify();
     this.getTableData('init');
+    this.getUserOptions()
+    this.$route.path === '/batchToBase'&& this.getEdbBaseClassify();
   },
   methods:{
-     // 获取分类
+    /* 下一步 */
+    handleNextStep() {
+      if(!this.checkedList.length && !this.isSelectAll) return this.$message.warning('请选择指标')
+
+      const { frequency,keyWord,users,classify } = this.filterObj
+
+      dataInterence.checkAddListV2({
+          UserIdList: users,
+          FrequencyList:frequency,
+          ClassifyIdList: classify,
+          Keyword:keyWord,
+          ListAll:this.isSelectAll,
+          TradeCodeList:this.checkedList.map(_=>_.TradeCode)
+      }).then(res=>{
+          if(res.Ret!==200) return 
+
+          const edbList = res.Data||[]
+          this.existEdbList = edbList.filter(i=>i.IsJoinEdb===1)
+          this.addToBaseList = edbList.filter(i=>i.IsJoinEdb===0)
+
+          if(this.addToBaseList.length>30) return this.$message.warning('批量添加指标数量不得超过30个!')
+
+          this.step++
+      })
+    },
+
+    filterNodes(arr) {
+			arr.length &&
+				arr.forEach((item) => {
+					item.Children.length && this.filterNodes(item.Children);
+					if (!item.Children.length) {
+						delete item.Children;
+					}
+				});
+		},
+    // 获取指标库分类
+    async getEdbBaseClassify(){
+      if(this.$route.path !== '/batchToBase') return
+      
+      const res=await dataBaseInterface.menuListV3()
+      if (res.Ret !== 200) return
+      this.filterNodes(res.Data.AllNodes||[]);
+			this.edbBaseClassify = res.Data.AllNodes || [];
+    },
+
+    // 获取分类
 		getClassify() {
 			dataInterence.getClassifyV2().then(res =>{
 				if(res.Ret === 200 && res.Data.List) {
@@ -242,21 +396,74 @@ export default {
 			})
 		},
 
+    // 同目录修改
+    handleClassifyChange(e,index){
+        if(this.classifyType===1){
+          // 修改所有的指标的目录为第一个
+          this.addToBaseList.forEach(item=>{
+              item.EtaClassifyId=e.EtaClassifyId
+          })
+        }
+    },
+
+    handleClassifyTypeChange(){
+      this.handleClassifyChange(this.addToBaseList[0])
+    },
+
+    handleCheckName() {
+      //重名校验
+      this.existNameArr = []
+      dataInterence.checkAddListNameV2(
+          this.addToBaseList.map(_=>({EdbCode:_.TradeCode,EdbName:_.SecName}))
+      ).then(res=>{
+          if(res.Ret!==200) return 
+          this.existNameArr = res.Data.filter(i=>i.Exist).map(_=>_.EdbName)
+
+          if(this.existNameArr.length) return 
+          this.handleSave()
+      })
+    },
+
+    handleSave() {
+
+      let haveIncomplete = this.addToBaseList.some(_ => !_.SecName||!_.EtaClassifyId||!_.Unit)
+      if(haveIncomplete) return this.$message.warning('指标信息填写不完整')
+
+      this.saveLoading = true;
+      dataInterence.addToBaseBatchV2(
+          this.addToBaseList.map(i=>({
+            EdbCode: i.TradeCode,
+            EdbName: i.SecName,
+            Frequency: i.Frequency,
+            Unit: i.Unit,
+            ClassifyId: i.EtaClassifyId
+          }))
+      ).then(res=>{
+          this.saveLoading = false
+
+          if(res.Ret!==200) return 
+          this.$message.success(this.$t('MsgPrompt.add_msg2'))
+          
+          this.$router.replace({
+            path: '/dataList'
+          })
+      })
+    },
+
     getTableData(type='pageChange') {
       this.tableLoading = true;
 
-      const { frequency,page_no,pageSize,keyWord,source,sortParam,sortType } = this.filterObj;
+      const { frequency,page_no,pageSize,keyWord,classify,users } = this.filterObj;
 
       let params = {
-        Frequency: frequency,
+        UserIdList: users,
+        FrequencyList: frequency,
         CurrentIndex: page_no,
         PageSize: pageSize,
-        Keywords: keyWord,
-        Source: source,
-        SortField: sortParam,
-        SortRule: sortType
+        Keyword: keyWord,
+        ClassifyIdList: classify
       }
-			selfDataInterface.getEdbList(params).then(res => {
+			dataInterence.getBatchAddListV2(params).then(res => {
         this.tableLoading = false;
         if( res.Ret!==200 )return
 
@@ -275,13 +482,31 @@ export default {
 			});
     },
 
+    // 获取所有用户
+    async getUserOptions() {
+      const res = await departInterence.getSystemUser()
+
+      if(res.Ret !== 200) return
+      this.userOptions = res.Data || []
+      this.filterUserEmpty(this.userOptions)
+    },
+
+    filterUserEmpty(arr) {
+      arr.length && arr.forEach(item => {
+        item.Children && item.Children.length && this.filterUserEmpty(item.Children)
+        if (!item.Children || !item.Children.length) {
+          delete item.Children
+        }
+      })
+    },
+
     /* 设置当页数据勾选状态 */
     checkedSomeSelection() {
       this.selectionReactCancel=true
 
       if(!this.isSelectAll){
           this.checkedList.map(_ =>{
-              let row = this.tableData.find(item => item.IndexCode==_.IndexCode)
+              let row = this.tableData.find(item => item.TradeCode==_.TradeCode)
               if(row){ //设置部分选中
                   setTimeout(()=>{
                       this.$refs.table.toggleRowSelection(row,true)
@@ -291,7 +516,7 @@ export default {
       }else{
           this.$refs.table &&this.$refs.table.toggleAllSelection()
           this.checkedList.map(_ =>{
-              let row = this.tableData.find(item => item.IndexCode==_.IndexCode)
+              let row = this.tableData.find(item => item.TradeCode==_.TradeCode)
               if(row){ //设置部分不勾选
                   setTimeout(()=>{
                       this.$refs.table.toggleRowSelection(row,false)
@@ -346,13 +571,13 @@ export default {
         if(this.selectionReactCancel) return 
 
         //当前项是选中还是取消选
-        let haveChecked = selection.some(_ => _.IndexCode === row.IndexCode);
+        let haveChecked = selection.some(_ => _.TradeCode === row.TradeCode);
 
         //全选取消选和不全选选中才有意义
         if((haveChecked&&!this.isSelectAll) || (!haveChecked&&this.isSelectAll)) {
           this.checkedList.push(row)
         }else {
-          this.checkedList=this.checkedList.filter(_ => _.IndexCode!==row.IndexCode)
+          this.checkedList=this.checkedList.filter(_ => _.TradeCode!==row.TradeCode)
         }
     },
 
@@ -368,8 +593,8 @@ export default {
           this.checkedList = [...this.checkedList,...this.tableData]
         }else {
 
-          let pageIds = this.tableData.map(_ => _.IndexCode);
-          this.checkedList = this.checkedList.filter(_ => !pageIds.includes(_.IndexCode))
+          let pageIds = this.tableData.map(_ => _.TradeCode);
+          this.checkedList = this.checkedList.filter(_ => !pageIds.includes(_.TradeCode))
         }
     },
 
@@ -381,54 +606,70 @@ export default {
     },
 
     filterChange(val) {
+      console.log(val)
       this.filterObj.page_no = 1;
-      if(!val) {
+      if(!val||!val.length) {
         this.isSelectAll = false
         this.checkedList = []
         this.filterObj.checkAll = false
         this.filterObj.checkSome = false
       }
-      this.getTableData(val?'filter':'')
+      this.getTableData(val.length?'filter':'')
     },
 
+    /* 批量删除 */
+    handleBatchDel(data={}){
 
-    handleCheckEdb(type='multiple',data={}){
+      if(!this.checkedList.length && !this.isSelectAll) return this.$message.warning('请选择指标')
 
-      if(type==='multiple' && !this.checkedList.length && !this.isSelectAll) return this.$message.warning('请选择指标')
+      const { frequency,keyWord,users,classify } = this.filterObj
 
-      const {frequence,keyWord,sortParam,sortType} = this.filterObj
+      let params = {
+        UserIdList: users,
+        FrequencyList:frequency,
+        ClassifyIdList: classify,
+        Keyword:keyWord,
+        ListAll:this.isSelectAll,
+        TradeCodeList:this.checkedList.map(_=>_.TradeCode)
+      }
 
-      selfDataInterface.checkEdb({
-          Frequency:frequence,
-          Keywords:keyWord,
-          SortField:sortParam||0,
-          SortRule:sortType||0,
-          ListAll:type==='single'?false:this.isSelectAll,
-          IndexCodes:type==='single'?[data.IndexCode]:this.checkedList.map(_=>_.IndexCode)
-      }).then(res=>{
+      dataInterence.checkDelListV2(params).then(res=>{
           if(res.Ret!==200) return 
 
           const edbList = res.Data||[]
-          this.existEdbList = edbList.filter(i=>i.EdbExist===1)
-          this.addToBaseList = edbList.filter(i=>i.EdbExist===0)
-
-          this.existEdbList.length&&(this.isHintDialogShow=true)
-          !this.existEdbList.length&&this.handleCloseHintDia()
+          this.existEdbList = edbList.filter(i=>i.IsJoinEdb===1)
+          
+          if(this.existEdbList.length) {
+            let existCode = this.existEdbList.map(_ => _.TradeCode).join(',');
+            this.$alert(`${existCode}已加入指标库,不可删除`,this.$t('Confirm.prompt'),{
+                confirmButtonText: '知道了',
+              }).then(()=>{
+              }).catch(()=>{})
+
+            return
+          }
+
+          this.$confirm('删除操作不可撤销,确定删除吗?',this.$t('Dialog.warn_tit'),{
+                confirmButtonText:/* "确定" */this.$t('Dialog.confirm_btn'),
+                cancelButtonText:/* "取消" */this.$t('Dialog.cancel_btn'),
+                type:"warning"
+            }).then(()=>{
+              this.handleDelApi(params);
+            }).catch(()=>{})
+         
       })
     },
 
-    //跳转至指标详情
-    goToEdbBase(data){
-        const {EdbClassifyId,EdbInfoId,EdbUniqueCode} = data||{}
-        const { href } = this.$router.resolve({
-            path:'/database',
-            query:{
-                code:EdbUniqueCode,
-                id:EdbInfoId,
-                classifyId:EdbClassifyId,
-            }
-        })
-        window.open(href,"_blank")
+    async handleDelApi(params) {
+      const res = await dataInterence.delEdbBatchV2(params)
+      this.saveLoading = false
+
+      if(res.Ret!==200) return 
+      this.$message.success(this.$t('MsgPrompt.delete_msg'))
+      
+      this.$router.replace({
+        path: '/dataList'
+      })
     }
 
   },
@@ -449,6 +690,7 @@ export default {
     .header {
       display: flex;
       justify-content: space-between;
+      align-items: center;
       .left {
         display: flex;
         align-items: center;

+ 75 - 24
src/views/dataEntry_manage/dataEntry/components/edbDetail.vue

@@ -49,13 +49,15 @@
 		</el-table>
 
     <div class="bottom">
-      <!-- <div class="left-select">
+      <div class="left-select" ref="url" v-if="yearsList.length">
         <el-button 
           type="primary"
           v-for="year in yearsList"
           :key="year"
+          @click="handlePostion"
         >{{year}}</el-button>
-      </div> -->
+      </div>
+
       <ul 
         class="value-ul" 
         ref="valueUl" 
@@ -65,7 +67,7 @@
         <li
           class="value-item"
           v-for="(item,rindex) in dataList"
-          :key="item.Dt"
+          :key="rindex"
         >
           <div 
             :class="['value-label',
@@ -118,11 +120,11 @@
       @mouseleave="hideContextMenu"
     >
       <div class="item" @click="handleOptTable('insert_up_row')">
-        向上插入
+        <!-- 向上插入 -->{{$t('ManualEntryPage.insert_up_row')}}
         <el-input v-model="rightMouseMenu.insertUpRows" size="mini" style="width:50px;" @change="val => { rightMouseMenu.insertUpRows = Number(val) }" @click.native.stop/>
       </div>
       <div class="item" @click="handleOptTable('insert_down_row')">
-        向下插入
+        <!-- 向下插入 -->{{$t('ManualEntryPage.insert_down_row')}}
         <el-input v-model="rightMouseMenu.insertDownRows" size="mini" style="width:50px;" @change="val => { rightMouseMenu.insertDownRows = Number(val) }" @click.native.stop/>
       </div>
       <div class="item" @click="handleOptTable('del_row')"><!-- 删除行 -->{{$t('ManualEntryPage.right_op_delrow')}}</div>
@@ -162,6 +164,7 @@ export default {
 				},
 			]
 		},
+
 		tableColumsTwo() {
 			return [
 				{
@@ -186,6 +189,19 @@ export default {
 				}
 			]
 		},
+
+    yearsList() {
+      if(!this.edbInfo.Detail) return []
+      if(!['日度','周度'].includes(this.edbInfo.Detail.Frequency)) return []
+
+      let years = [];
+      this.dataList.forEach(_ => {
+        if(!years.includes(_.Dt.substring(0,4))&&_.Dt) {
+          years.push(_.Dt.substring(0,4))
+        }
+      })
+      return years;
+    }
   },
   watch: {
     id(newval) {
@@ -196,12 +212,7 @@ export default {
     return {
       tableData: [],
       edbInfo: {},
-      yearsList: [
-        '2024',
-        '2023',
-        '2022',
-        '2021',
-      ],
+      // yearsList: [],
       dataList: [],
 
       readonly:  false,//日期只读
@@ -222,14 +233,25 @@ export default {
   methods:{
     /* 获取指标详情 */
     async getEdbDetail() {
+      let loading = this.$loading({
+        lock: true,
+        text: `${this.$t('Table.data_loading')}...`,
+        target: '.edb-detail-data-wrap',
+        spinner: 'el-icon-loading',
+        background: 'rgba(255, 255, 255, 0.8)'
+      })
+
       const res = await dataInterence.getEdbDetailV2({
         TradeCode: this.id
       })
 
+      loading.close()
       if(res.Ret !== 200) return 
       this.edbInfo = res.Data;
-      this.dataList = res.Data.Detail.DataList||[];
+      res.Data.Detail.ClassifyName = res.Data.ClassifyList.map(_ => _.ClassifyName).join('/')
       this.tableData = [res.Data.Detail]
+      
+      this.dataList = res.Data.Detail.DataList||[];
     },
 
     handleLoadData() {
@@ -237,8 +259,30 @@ export default {
     },
 
     /* 更改日期 */
-    handleTimeChange() {
-
+    async handleTimeChange(index, e) {
+        // 判断选择的日期是否重复
+      // let flag = this.dataList.some((item) => item.Dt == e.Dt);
+      // if (flag) {
+      //   if (!this.tempTime) {
+      //     // 如果是新增行的
+      //     e.Dt = "";
+      //   } else {
+      //     e.Dt = this.tempTime;
+      //   }
+      //   this.$message.warning(/* "该日期已存在"  */this.$t('Edb.MsgPrompt.date_haved_msg'));
+      // } else {
+       
+      //     // 修改日期
+      //     let params = {
+      //       CreateDate: e.Dt, //新录入日期
+      //       OldCreateDate: this.tempTime, //之前日期
+      //       List: this.dataList,
+      //     };
+      //     const res = await dataInterence.modifyTargetDate(params);
+      //     if (res.Ret === 200) {
+      //       this.$message.success("修改成功");
+      //     }
+      // }
     },
 
      // 日期获取焦点存放日期
@@ -263,7 +307,6 @@ export default {
 
       // 如果input 为改变 且 之前也为空
       if (!this.temInputVal.Close && !e.Close) {
-        // console.log('之前之后都是空');
         return;
       }
 
@@ -357,7 +400,6 @@ export default {
 
     /* 右键 */
     handleRightClick(e) {
-      console.log(e)
       let dom = $('.right-lick-menu')[0];
       if(e.clientY > window.innerHeight/2) {
         dom.style.left = e.clientX-3 + 'px';
@@ -394,15 +436,15 @@ export default {
         Dt: '',
         TradeCode: this.edbInfo.Detail.TradeCode
       }
-      console.log(type)
       if(type==='insert_up_row') {
-        let insertArr = new Array(this.rightMouseMenu.insertUpRows).fill('').map(_ => newItem)
-        console.log(insertArr)
+        let insertArr = new Array(this.rightMouseMenu.insertUpRows).fill('').map(item => _.cloneDeep(newItem))
         this.dataList.splice(this.rightMouseMenu.rindex, 0, ...insertArr);
       }else {
-        let insertArr = new Array(this.rightMouseMenu.insertDownRows).fill('').map(_ => newItem)
+        let insertArr = new Array(this.rightMouseMenu.insertDownRows).fill('').map(item => _.cloneDeep(newItem))
         this.dataList.splice(this.rightMouseMenu.rindex+1, 0, ...insertArr);
       }
+
+      console.log(this.dataList)
     },
 
     delRow() {
@@ -431,16 +473,16 @@ export default {
 	}
   .bottom {
     flex: 1;
-    
+    display: flex;
     overflow: hidden;
     .value-ul{
+      flex: 1;
       max-height: 100%;
       overflow-y: auto;
-      border-bottom: 1px solid #EBEFF6;
+      border: 1px solid #EBEFF6;
       box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2);
       .value-item {
-        border: 1px solid #dcdfe6;
-        border-bottom: none;
+        border-bottom: 1px solid #dcdfe6;
         display: flex;
 
         .value-label {
@@ -498,6 +540,15 @@ export default {
         color: #999;
       }
     }
+
+    .left-select {
+      width: fit-content;
+      max-height: 90%;
+      border: 1px solid #EBEFF6;
+      padding: 10px 15px;
+      overflow-y: auto;
+      .el-button { display: block;margin:10px 0; }
+    }
   }
 
   .right-lick-menu  {

+ 21 - 4
src/views/dataEntry_manage/dataEntry/components/operateLogsDia.vue

@@ -39,6 +39,7 @@
   </m-dialog>
 </template>
 <script>
+import { dataInterence } from '@/api/api.js';
 import mDialog from '@/components/mDialog.vue';
 import mPage from '@/components/mPage.vue';
 export default {
@@ -51,12 +52,18 @@ export default {
       type: String
     }
   },
+  watch: {
+    isShow(nval) {
+      if(!nval) return 
+      this.getTableData()
+    }
+  },
   computed: {
     tableColums() {
       return [
-        {  label: /* '操作时间' */this.$t('ManualEntryPage.opera_time'),key: 'TradeCode' },
-        {  label: /* '操作内容' */this.$t('ManualEntryPage.opera_msg'),key: 'SecName',minwidthsty:'150px' },
-        {  label: /* '操作人' */this.$t('ManualEntryPage.opera_user'),key: 'Frequency'},
+        {  label: /* '操作时间' */this.$t('ManualEntryPage.opera_time'),key: 'CreateTime' },
+        {  label: /* '操作内容' */this.$t('ManualEntryPage.opera_msg'),key: 'Remark',minwidthsty:'150px' },
+        {  label: /* '操作人' */this.$t('ManualEntryPage.opera_user'),key: 'UserName'},
       ]
     }
   },
@@ -72,7 +79,17 @@ export default {
 
   },
   methods:{
-    getTableData() {
+    async getTableData() {
+      const res = await dataInterence.getOperaLogsList({
+        PageSize: this.pageSize,
+        CurrentIndex: this.page_no,
+        TradeCode: this.edbCode
+      })
+
+      if(res.Ret !== 200) return 
+
+      this.tableData = res.Data.List || [];
+      this.total = res.Data.Paging.Totals;
 
     },
 

+ 5 - 30
src/views/dataEntry_manage/dataEntry/dataEdit.vue

@@ -74,7 +74,6 @@
 
 <script>
 import { dataInterence } from '@/api/api.js';
-import {dataBaseInterface} from '@/api/modules/chartApi'
 import { formRules } from '../databaseComponents/util';
 import { unitArr,frequencySelectList } from '@/utils/defaultOptions';
 import { mapState } from 'vuex';
@@ -164,34 +163,15 @@ export default {
           cellUpdateBefore(r,c,value){
             // 禁止更新第一行
             if(r===0) return false
-            
-            // if(c===0&&value) {
-            //   console.log(value)
-            //   console.log(isNaN(value)&&!isNaN(Date.parse(value)))
-            //   if(isNaN(value)&&!isNaN(Date.parse(value))) {
-            //     return true
-            //   }else {
-            //     bus.$message.warning('请输入正确的日期格式')
-            //     return false
-            //   }
-            // }
           },
           cellMousedownBefore(e,{r,c}){
             if(r===0) return false
           },
-
-          cellAllRenderBefore(a,b,c) {
-            // console.log(a,b,c)
-          },
-
-          rangePasteBefore(range,data) {
-            console.log(range,data)
-          }
         },
       }  
     },
 
-     ...mapState({
+    ...mapState({
 			currentLang: state => state.lang,
 		}),
     frequencyArr(){
@@ -309,25 +289,20 @@ export default {
         if(result_obj[key].Date && !isNaN(result_obj[key].Value)) DataList.push(result_obj[key]);
       }
 
-      const { Ret,Data } = await dataBaseInterface.adjustEdbEdit({
+      const { Ret,Data } = await dataInterence.editEdbDataV2({
         EdbName: targetName,
         Frequency: frequency,
         Unit: unit,
         ClassifyId: menu,
-        EdbInfoId: Number(this.edb_id)|| 0,
-        DataList
+        TradeCode: this.$route.query.id,
+        Data: DataList
       })
 
       if(Ret !== 200) return
       // this.$message.success('保存成功')
       this.$message.success(this.$t('MsgPrompt.saved_msg'))
 
-      const { UniqueCode,EdbInfoId } = Data;
-
-      this.$router.replace({path:'/dataList', query: {
-        code: UniqueCode,
-        id: EdbInfoId
-      }});
+      this.$router.replace({path:'/dataList'});
     },  
 
     initExcelOptions() {

+ 7 - 6
src/views/dataEntry_manage/dataEntry/index.vue

@@ -160,6 +160,7 @@
   <!-- 操作日志弹窗 -->
   <operateLogsDia
     :isShow.sync="isShowOperaLogs"
+    :edbCode="operteId"
   />
   </div>
 </template>
@@ -191,12 +192,10 @@ export default {
     exportUrl() {
       let exportDataurl = process.env.VUE_APP_API_ROOT + "/entry/export/dataList";
 
-      let str = `${exportDataurl}?Frequency=${this.frequency}&ClassifyId=${
+      let str = `${exportDataurl}?ClassifyId=${
         this.selectClassifyId
-      }&KeyWord=${
-        !this.leftSearchTradeCode ? "" : this.leftSearchVal
       }&TradeCode=${
-        !this.leftSearchTradeCode ? "" : this.leftSearchTradeCode
+        this.selectedEdb ? this.selectedEdb : ''
       }&StartDate=&EndDate=&Mobile=&${localStorage.getItem("auth")}`;
       return str.replace(/#/g, encodeURIComponent("#")).replace(/;/g, encodeURIComponent(";"));
     },
@@ -241,6 +240,7 @@ export default {
 
       /* 操作日志弹窗 */
       isShowOperaLogs: false,
+      operteId: '',
 
       /* 导入弹窗 */
       isShowinsert:false
@@ -381,7 +381,7 @@ export default {
 
     // 查看操作日志
     handleOperaLogs(item){
-      // this.operteId
+      this.operteId = item.TradeCode;
       this.isShowOperaLogs = true;
     },
     
@@ -405,7 +405,8 @@ export default {
 						}).then(res =>{
 								if( res.Ret !== 200 ) return
 								this.$message.success(/* '删除成功!' */this.$t('MsgPrompt.delete_msg'));
-								this.getTableData();
+                this.getClassify();
+                this.getTableData()
 							});
 					}).catch(() => {});
 				}

+ 18 - 25
src/views/dataEntry_manage/onlineExcelCopy.vue

@@ -12,13 +12,13 @@
       </div>
       <div class="data-options" >
         <el-form :model="dataForm" label-position="top" ref="dataOptions">
-          <el-form-item :label="$t('ManualEntryPage.label_one_level_classify')" prop="firstClassify" :rules="[{required:true,message:'一级分类不能为空',trigger:'change'}]">
-            <el-select v-model="dataForm.firstClassify" placeholder="请选择一级分类" style="width: 100%;" @change="changeFirstClassify">
+          <el-form-item :label="$t('ManualEntryPage.label_one_level_classify')" prop="firstClassify" :rules="[{required:true,message:'品种不能为空',trigger:'change'}]">
+            <el-select v-model="dataForm.firstClassify" placeholder="请选择品种" style="width: 100%;" @change="changeFirstClassify">
               <el-option :label="item.ClassifyName" :value="item.ClassifyId" v-for="item in classifyArray" :key="item.ClassifyId"></el-option>
             </el-select>
           </el-form-item>
-          <el-form-item :label="$t('ManualEntryPage.label_edb_classify')" prop="secondClassify" :rules="[{required:true,message:'指标分类不能为空',trigger:'change'}]">
-            <el-select v-model="dataForm.secondClassify" placeholder="请选择指标分类" style="width: 100%;" @change="changeSecondClassify">
+          <el-form-item :label="$t('ManualEntryPage.label_edb_classify')" prop="secondClassify" :rules="[{required:true,message:'子品种不能为空',trigger:'change'}]">
+            <el-select v-model="dataForm.secondClassify" placeholder="请选择子品种" style="width: 100%;" @change="changeSecondClassify">
               <el-option :label="item.ClassifyName" :value="item.ClassifyId" v-for="item in secondClassifyArray" :key="item.ClassifyId"></el-option>
             </el-select>
           </el-form-item>
@@ -173,14 +173,14 @@ export default {
     }
   },
 created() {
-    this.dataForm.firstClassify = parseInt(this.$route.query.parentClassifyId) || ''
-    this.dataForm.secondClassify = parseInt(this.$route.query.ClassifyId) || ''
-    this.dataForm.frequency = this.$route.query.Frequency || ''
-    this.dataForm.tradeCode = this.$route.query.TradeCode || ''
-    this.dataForm.tradeName = this.$route.query.TradeName || ''
-    this.copyDataForm = JSON.parse(JSON.stringify(this.dataForm))
-    // 字符串
-    this.isEdit = this.$route.query.isEdit.toString()
+    // this.dataForm.firstClassify = parseInt(this.$route.query.parentClassifyId) || ''
+    // this.dataForm.secondClassify = parseInt(this.$route.query.ClassifyId) || ''
+    // this.dataForm.frequency = this.$route.query.Frequency || ''
+    // this.dataForm.tradeCode = this.$route.query.TradeCode || ''
+    // this.dataForm.tradeName = this.$route.query.TradeName || ''
+    // this.copyDataForm = JSON.parse(JSON.stringify(this.dataForm))
+    // // 字符串
+    // this.isEdit = this.$route.query.isEdit.toString()
     this.initExcelOptions()
     // 监听折叠导航栏事件
     EventBus.$off('collapseHandle')
@@ -189,14 +189,6 @@ created() {
       luckysheet.create(this.options)
     })
   },
-  beforeRouteEnter(to, from, next){
-    if(to.query.isEdit=='true'){
-      to.matched[1].name='编辑excel数据'
-    }else{
-      to.matched[1].name='复制excel数据'
-    }
-    next()
-  },
   beforeRouteLeave(to, from, next) {
     luckysheet.destroy()
     next();
@@ -550,12 +542,13 @@ created() {
       let res=await dataInterence.getClassify()
       if(res.Ret===200){
         this.classifyArray = res.Data.List || []
-        let item = this.classifyArray.find(item => item.ClassifyId == this.dataForm.firstClassify)
-        this.firstClassName = item && item.ClassifyName
-        this.secondClassifyArray = item ? item.Child : []
+        
+        this.dataForm.firstClassify = this.classifyArray[0].ClassifyId;
+        this.firstClassName = this.classifyArray[0].ClassifyName
+        this.secondClassifyArray = this.classifyArray[0] ? this.classifyArray[0].Child : []
         if(this.secondClassifyArray.length>0){
-          let item2 = this.secondClassifyArray.find(item => item.ClassifyId == this.dataForm.secondClassify)
-          this.secondClassName = item2 && item2.ClassifyName
+          this.dataForm.secondClassify = this.secondClassifyArray[0].ClassifyId;
+          this.secondClassName = this.secondClassifyArray[0].ClassifyName
         }
       }
     },