Bladeren bron

紧急需求插入

Karsa 3 maanden geleden
bovenliggende
commit
039bdf8366

+ 51 - 80
src/views/dataEntry_manage/dataEntry/addToBaseList.vue

@@ -2,19 +2,21 @@
   <div class="batch-opera-list">
     <div class="header">
       <div class="left">
-        <el-select
-          v-model="filterObj.source"
-          @change="filterChange"
-          :placeholder="$t('SelftDataPage.ph_channel')"
+
+        <el-cascader
+          v-model="filterObj.classify"
+          :options="classifyList"
+          :props="{
+            label: 'ClassifyName',
+            value: 'ClassifyId',
+            children: 'Child',
+            emitPath: false
+          }"
+          style="width: 200px;"
+          placeholder="品种"
           clearable
-        >
-          <el-option 
-            v-for="item in sourceOptions" 
-            :key="item.EdbBusinessSourceId" 
-            :label="item.SourceName" 
-            :value="item.EdbBusinessSourceId"
-          />
-        </el-select>
+          @change="filterChange"
+        />
 
         <el-select
           v-model="filterObj.frequency"
@@ -25,6 +27,20 @@
           <el-option v-for="item in frequencyOptions" :key="item.val" :label="item.label" :value="item.val"/>
         </el-select>
 
+        <el-cascader
+          v-model="filterObj.user"
+          :options="userOptions"
+          :props="{
+            label: 'ChartClassifyName',
+            value: 'ChartClassifyId',
+            children: 'Children',
+            emitPath: false
+          }"
+          style="width: 250px;"
+          placeholder="请选择创建人"
+          clearable
+        />
+
         <el-input 
           v-model="filterObj.keyWord" 
           :placeholder="$t('Edb.InputHolderAll.input_name_orid')"
@@ -48,7 +64,7 @@
         v-permission="permissionBtn.dataSourcePermission.selfData_addEdb"
         type="primary" 
         @click="handleCheckEdb('multiple')"
-      ><!-- 添加到指标库 -->{{$t('YsDataPage.add_base_btn')}}</el-button>
+      ><!-- 批量删除 -->{{$t('ManualEntryPage.batch_del')}}</el-button>
     </div>
 
     <div class="main">
@@ -99,34 +115,17 @@
           @handleCurrentChange="pageChange"
         />
       </div>
-    </div>
-
 
-    <!-- 操作提示弹窗 -->
-    <el-dialog 
-      :title="$t('BloombergPage.operation_prompt')"
-      :visible.sync="isHintDialogShow"
-      :close-on-click-modal="false"
-      :modal-append-to-body="false"
-      @close="isHintDialogShow=false"
-      width="578px"
-      v-dialogDrag
-      center>
-      <div class="hint-dialog-wrap">
-          <p style="margin-bottom: 20px;">{{ hintText }}</p>
-          <ul>
-              <li v-for="(item,index) in existEdbList" :key="index" class="hint-item" @click="goToEdbBase(item)">
-                  {{ index+1 }}、{{ item.IndexName }}({{ item.IndexCode }})
-              </li>
-          </ul>
+      <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>
-      <div style="text-align: center;margin-bottom: 30px;">
-          <el-button type="primary" @click="handleCloseHintDia">{{$t('Dialog.known')}}</el-button>
-      </div>
-    </el-dialog>
+    </div>
+
   </div>
 </template>
 <script>
+import { dataInterence } from '@/api/api.js';
 import { selfDataInterface } from '@/api/modules/dataSource';
 import mPage from '@/components/mPage.vue';
 export default {
@@ -203,7 +202,7 @@ export default {
       
       tableData: [],
 
-      sourceOptions: [],
+      classifyList: [],
 
       isSelectAll: false, //真正意义上的全选或不全选
       checkedList: [], //不全选勾选中的 或 全选取消勾的
@@ -212,7 +211,7 @@ export default {
       filterObj: {
         page_no: 1,
         pageSize: 10,
-        source: '',
+        classify: '',
         frequency: '',
         keyWord: '',
         sortParam:'',
@@ -221,33 +220,27 @@ export default {
         checkSome: false
       },
 
-      /* 查看数据弹窗 */
-      isLookDataDia: false,
-      lookEdbInfo: {},
-
       /* 加入指标库弹窗 */
       isAddToBaseDia: false,
       addToType: 'multiple',
       addToBaseList: [],//可加入的指标
       existEdbList: [],//已存在的指标
 
-      /* 提示弹窗 */
-      isHintDialogShow: false,
-
     }
   },
   mounted(){
-    this.getSource();
+    this.getClassify();
     this.getTableData('init');
   },
   methods:{
-    getSource() {
-      selfDataInterface.getSourceList().then(res => {
-        if(res.Ret!==200 ) return
-
-        this.sourceOptions = res.Data || [];
-      })
-    },
+     // 获取分类
+		getClassify() {
+			dataInterence.getClassifyV2().then(res =>{
+				if(res.Ret === 200 && res.Data.List) {
+					this.classifyList = res.Data.List||[];
+				}
+			})
+		},
 
     getTableData(type='pageChange') {
       this.tableLoading = true;
@@ -398,12 +391,6 @@ export default {
       this.getTableData(val?'filter':'')
     },
 
-    /* 查看数据 */
-    lookDataHandle(item) {
-
-      this.lookEdbInfo = item;
-      this.isLookDataDia =  true
-    },
 
     handleCheckEdb(type='multiple',data={}){
 
@@ -430,17 +417,6 @@ export default {
       })
     },
 
-    //提示弹窗关闭
-    handleCloseHintDia(){
-        this.isHintDialogShow = false
-        //判断是否要展示下一个弹窗
-        if(!this.addToBaseList.length) return
-        
-        if(this.addToBaseList.length>100) return this.$message.warning('批量添加指标数量不得超过100个!')
-
-        this.isAddToBaseDia = true
-    },
-
     //跳转至指标详情
     goToEdbBase(data){
         const {EdbClassifyId,EdbInfoId,EdbUniqueCode} = data||{}
@@ -479,16 +455,11 @@ export default {
         gap: 10px;
       }
     }
-}
-.hint-dialog-wrap{
-    padding-bottom:30px;
-    .hint-item{
-        cursor: pointer;
-        margin-bottom: 10px;
-        &:hover{
-            color:#409EFF;
-            text-decoration: underline;
-        }
+
+    .add-handles-bot {
+      display: flex;
+      justify-content: center;
+      align-items: center;
     }
 }
 </style>

+ 228 - 44
src/views/dataEntry_manage/dataEntry/components/edbDetail.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="edb-detail-data-wrap" @click="rightMouseMenu.show=false;">
+  <div class="edb-detail-data-wrap">
     <div class="handle-list">
       <span class="editsty" @click="$emit('handle',{item:edbInfo.Detail,type:'edit'})"><!-- 编辑 -->{{$t('Table.edit_btn')}}</span>
       <span class="editsty" @click="$emit('handle',{item:edbInfo.Detail,type:'addToBase'})"><!-- 加入指标库 -->{{$t('ManualEntryPage.add_tobase')}}</span>
@@ -49,13 +49,13 @@
 		</el-table>
 
     <div class="bottom">
-      <div class="left-select">
+      <!-- <div class="left-select">
         <el-button 
           type="primary"
           v-for="year in yearsList"
           :key="year"
         >{{year}}</el-button>
-      </div>
+      </div> -->
       <ul 
         class="value-ul" 
         ref="valueUl" 
@@ -64,26 +64,47 @@
         v-show="dataList.length">
         <li
           class="value-item"
-          v-for="item in dataList"
+          v-for="(item,rindex) in dataList"
           :key="item.Dt"
         >
-          <div class="value-label">
+          <div 
+            :class="['value-label',
+              { 'select': rindex===rightMouseMenu.rindex && rightMouseMenu.cindex === 0 }
+            ]"
+          >
             <el-date-picker
               v-model="item.Dt"
               type="date"
               :placeholder="$t('Edb.InputHolderAll.input_date')"
+              :data-rindex="rindex"
+              :data-cindex="0"
               :clearable="false"
               :editable="false"
               value-format="yyyy-MM-dd"
-              :readonly="false"
-              @mousedown.native="mousedown($event)"
+              :readonly="readonly"
+              @mousedown.native="e=> { readonly = e.button===2?true:false }"
               prefix-icon="none"
               @input="handleTimeChange(rindex, item)"
               @focus="handleTimeFocus(rindex, item)"
             ></el-date-picker>
           </div>
-          <div class="value-label">
-            {{item.Close}}
+          <div 
+            :class="['value-label',
+              { 'select': rindex===rightMouseMenu.rindex && rightMouseMenu.cindex === 1 }
+            ]"
+            :data-rindex="rindex"
+            :data-cindex="1"
+          >
+            <input
+              @focus="handleInputFocus(item, rindex, 1)"
+              @blur="handleInputChange(item)"
+              @input="handleInput(item)"
+              class="input-val-box"
+              type="number"
+              v-model="item.Close"
+              :data-rindex="rindex"
+              :data-cindex="1"
+            />
           </div>
         </li>
         <li class="nodata value-item" v-if="!dataList.length">{{$t('Table.prompt_slogan')}}</li>
@@ -96,15 +117,15 @@
       class="right-lick-menu"
       @mouseleave="hideContextMenu"
     >
-      <div class="item" @click="handleOptTable('插入行')">
+      <div class="item" @click="handleOptTable('insert_up_row')">
         向上插入
-        <el-input v-model="rightMouseMenu.insertUpRows" size="mini" style="width:60px;" @change="val => { rightMouseMenu.insertUpRows = Number(val) }"/>
+        <el-input v-model="rightMouseMenu.insertUpRows" size="mini" style="width:50px;" @change="val => { rightMouseMenu.insertUpRows = Number(val) }"/>
       </div>
-      <div class="item" @click="handleOptTable('插入列')">
+      <div class="item" @click="handleOptTable('insert_down_row')">
         向下插入
-        <el-input v-model="rightMouseMenu.insertDownRows" size="mini" style="width:60px;" @change="val => { rightMouseMenu.insertDownRows = Number(val) }"/>
+        <el-input v-model="rightMouseMenu.insertDownRows" size="mini" style="width:50px;" @change="val => { rightMouseMenu.insertDownRows = Number(val) }"/>
       </div>
-      <div class="item" @click="handleOptTable('删除行')"><!-- 删除行 -->{{$t('ManualEntryPage.right_op_delrow')}}</div>
+      <div class="item" @click="handleOptTable('del_row')"><!-- 删除行 -->{{$t('ManualEntryPage.right_op_delrow')}}</div>
     </div>
 	</div>
 </template>
@@ -181,17 +202,13 @@ export default {
         '2022',
         '2021',
       ],
-      dataList: [
-        {Dt: '2024-07-08',Close: '13510'},
-        {Dt: '2024-07-07',Close: '13510'},
-        {Dt: '2024-07-05',Close: '13510'},
-        {Dt: '2024-07-04',Close: '13510'},
-      ],
+      dataList: [],
+
+      readonly:  false,//日期只读
 
       rightMouseMenu: {
-        show:false,
-        left: 0,
-        top: 0,
+        rindex:-1,
+        cindex:-1,
         insertUpRows: 1,
         insertDownRows: 1,
       }
@@ -209,6 +226,7 @@ export default {
 
       if(res.Ret !== 200) return 
       this.edbInfo = res.Data;
+      this.dataList = res.Data.Detail.DataList||[];
       this.tableData = [res.Data.Detail]
     },
 
@@ -219,6 +237,120 @@ export default {
     /* 更改日期 */
     handleTimeChange() {
 
+    },
+
+     // 日期获取焦点存放日期
+    handleTimeFocus(index, e) {
+      this.tempTime = e.timeVal;
+      this.rightMouseMenu.rindex = index;
+      this.rightMouseMenu.cindex = 0;
+    },
+
+    // input 获取焦点
+    handleInputFocus(e, rindex, cindex) {
+      console.log(e, rindex, cindex)
+
+      this.rightMouseMenu.rindex = rindex;
+      this.rightMouseMenu.cindex = cindex;
+      this.temInputVal = JSON.parse(JSON.stringify(e));
+    },
+
+    // input 值改变 失去焦点
+    async handleInputChange(e) {
+      console.log(e);
+
+      // 如果input 为改变 且 之前也为空
+      if (!this.temInputVal.Close && !e.Close) {
+        // console.log('之前之后都是空');
+        return;
+      }
+
+      // 没有选择日期
+      if (!e.Dt) {
+        e.Close = "";
+        this.$message.warning(/* "请选择日期" */this.$t('Edb.InputHolderAll.input_date'));
+        return;
+      }
+      // 判断值是否改变
+      if (
+        this.temInputVal.TradeCode === e.TradeCode &&
+        this.temInputVal.Close === e.Close
+      ) {
+        console.log("值未改变");
+        return;
+      }
+
+      // 删除情况
+      if (!e.Close) {
+        this.handleDelete(e);
+        return;
+      }
+
+      // 修改情况
+      // 检查该日期下是否存在数据
+      let checkRes = await dataInterence.checkData({
+        TradeCode: e.TradeCode,
+        CreateDate: e.Dt,
+      });
+      if (checkRes.Data.Status === 0) {
+        const editRes = await dataInterence.editData({
+          TradeCode: e.TradeCode,
+          CreateDate: e.Dt,
+          Close: e.Close,
+          OldCreateDate: "",
+        });
+        if (editRes.Ret === 200) {
+
+          this.$message({
+            message: /* "新增成功" */this.$t('MsgPrompt.add_msg'),
+            type: "success",
+          });
+        } else {
+          this.$message({
+            message: editRes.msg,
+            type: "warning",
+          });
+          this.getTableList();
+        }
+      } else if (checkRes.Data.Status === 1) {
+        this.$confirm(
+          this.$t('Edb.MsgPrompt.date_have_value_msg',{val:checkRes.Data.Close}),
+          /* "提示" */this.$t('Dialog.warn_tit'),
+          {
+            type: "warning",
+          }
+        )
+          .then(async () => {
+            const editRes = await dataInterence.editData({
+              TradeCode: e.TradeCode,
+              CreateDate: e.Dt,
+              Close: e.Close,
+              OldCreateDate: e.Dt,
+            });
+            if (editRes.Ret === 200) {
+              this.$message({
+                message: /* "修改成功" */this.$t('MsgPrompt.edit_msg'),
+                type: "success",
+              });
+            } else {
+              this.$message({
+                message: editRes.msg,
+                type: "warning",
+              });
+              this.getTableList();
+            }
+          })
+          .catch(() => {
+            this.getTableList();
+          });
+      }
+    },
+
+    // 只允许输入整数或者小数点后四位
+    handleInput(e) {
+      if (e.Close.indexOf(".") > 0) {
+        e.Close = e.Close.slice(0, e.Close.indexOf(".") + 5);
+      }
     },
 
     /* 右键 */
@@ -239,12 +371,39 @@ export default {
       let dom = $('.right-lick-menu')[0];
 			dom.style.left = '-9999px';
 			dom.style.top = '-9999px';
+      this.rightMouseMenu.insertUpRows = 1;
+      this.rightMouseMenu.insertDownRows = 1
     },
 
     // 插入操作
-    handleOptTable() {
-
+    handleOptTable(type) {
+      const handlesMap = {
+        'insert_up_row': this.insertRow,
+        'insert_down_row': this.insertRow,
+        'del_row': this.delRow
+      }
+      handlesMap[type] && handlesMap[type](type)
     },
+    
+    //插入行
+    insertRow(type) {
+      let newItem = {
+        Close: '',
+        Dt: '',
+        TradeCode: ''
+      }
+      console.log(type)
+      if(type==='insert_up_row') {
+        console.log(this.rightMouseMenu)
+        let insertArr = new Array(this.rightMouseMenu.insertUpRows).fill('').map(_ => newItem)
+        console.log(insertArr)
+        this.dataList.splice(this.rightMouseMenu.rindex-1, 0, ...insertArr);
+      }
+    },
+
+    delRow() {
+      this.dataList.splice(this.rightMouseMenu.rindex, 1);
+    }
   },
 }
 </script>
@@ -282,13 +441,25 @@ export default {
 
         .value-label {
           width: 50%;
-          padding: 15px;
+          padding: 2px;
           position: relative;
           text-align: center;
           color: #666;
           &:first-child {
             border-right: 1px solid #dcdfe6;
           }
+          &.select::after {
+            position: absolute;
+            top: 0;
+            left: 0;
+            right: 0;
+            bottom: 0;
+            content: " ";
+            display: block;
+            outline: 0;
+            border: 2px solid #0033ff;
+            box-shadow: 0 0 5px rgba(73, 177, 249, 0.5);
+          }
           .value-style{
             padding:5px;
             border-radius: 4px;
@@ -297,6 +468,25 @@ export default {
             }
           }
         }
+
+        .input-val-box {
+          width: 100%;
+          height: 100%;
+          border: none;
+          text-align: center;
+          color: #666;
+        }
+        .input-val-box:disabled {
+          background: transparent;
+        }
+        input::-webkit-outer-spin-button,
+        input::-webkit-inner-spin-button {
+          -webkit-appearance: none !important;
+          margin: 0;
+        }
+        input[type="number"] {
+          -moz-appearance: textfield;
+        }
       }
       .nodata {
         text-align: center;
@@ -329,24 +519,18 @@ export default {
       }
     }
   }
-  /* .right-lick-menu {
-    position: fixed;
-    z-index: 999;
-    background: #ffffff;
-    border: 1px solid #ececec;
-    box-shadow: 0px 3px 6px rgba(143, 143, 143, 0.16);
-    border-radius: 4px;
-    color: #333;
-    font-size: 15px;
-    padding: 13px 0;
-    .item {
-      line-height: 30px;
-      padding: 0 20px;
-      cursor: pointer;
-      &:hover {
-        background-color: #f5f7fa;
-      }
+}
+</style>
+<style lang="scss">
+.edb-detail-data-wrap {
+  .value-ul {
+    .el-date-editor.el-input {
+      width: 100%;
+    }
+    .el-date-editor .el-input__inner {
+      border: none;
+      text-align: center;
     }
-  } */
+  }
 }
 </style>

+ 1 - 1
src/views/dataEntry_manage/dataEntry/index.vue

@@ -5,7 +5,7 @@
       <div class="left-btn">
         <el-button type="primary" @click="isShowinsert=true"><!-- 导入数据 -->{{$t('ManualEntryPage.tit_insert_data')}}</el-button>
         <el-button type="primary" @click="$router.push({path: '/batchToBase' })"><!-- 批量加入指标库 -->{{$t('ManualEntryPage.batch_addbase')}}</el-button>
-        <el-button v-permission="permissionBtn.dataSourcePermission.manualDataWrite_import" type="primary" @click="$router.push({path: '/online_excel' })"><!-- 在线Excel -->{{$t('ManualEntryPage.online_excel')}}</el-button>
+        <el-button v-permission="permissionBtn.dataSourcePermission.manualDataWrite_import" type="primary" @click="$router.push({path: '/onlineExcelCopy' })"><!-- 在线Excel -->{{$t('ManualEntryPage.online_excel')}}</el-button>
         <el-button type="primary" @click="$router.push({path: '/batchDelList' })"><!-- 批量删除 -->{{$t('ManualEntryPage.batch_del')}}</el-button>
       </div>