|
@@ -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>
|