[bugfix] 修改部分bug Expr2 用例改为老师要求的用例
This commit is contained in:
parent
c0459fcdc7
commit
051f3751a5
|
@ -48,16 +48,8 @@ let beforeFromKey = -1;
|
|||
let beforeToKey = -1;
|
||||
|
||||
function FindOriginOperationIndex(key: string): number {
|
||||
let index = parseInt(key) - 1;
|
||||
index = data.value[index].id;
|
||||
console.log("index", index)
|
||||
if (index === 0)
|
||||
return -1;
|
||||
for (let i = 0; i < originOperations.value.length; i++) {
|
||||
if (originOperations.value[i].id === index)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
let ans = parseInt(key) - 2;
|
||||
return ans < 0? -1: ans;
|
||||
}
|
||||
|
||||
function OnTableBlur(col: number, {key: editedRowKey}: { key: string }, value: number | string) {
|
||||
|
@ -66,7 +58,7 @@ function OnTableBlur(col: number, {key: editedRowKey}: { key: string }, value: n
|
|||
console.log(index, col, value)
|
||||
if (index === -1) {
|
||||
if (col === 2) {
|
||||
startTrack.value = value as number;
|
||||
startTrack.value = parseInt(value as string);
|
||||
tableChanged.value = true;
|
||||
}
|
||||
return;
|
||||
|
@ -200,7 +192,7 @@ function InsertBefore(row: number) {
|
|||
|
||||
function InsertEnd() {
|
||||
originOperations.value.push({
|
||||
id: 0,
|
||||
id: -1,
|
||||
track: -1
|
||||
});
|
||||
tableChanged.value = true;
|
||||
|
@ -210,6 +202,8 @@ function InsertEnd() {
|
|||
function Delete(row: number) {
|
||||
let key = data.value[row - 1].key;
|
||||
let index = FindOriginOperationIndex(key);
|
||||
if(index === -1)
|
||||
return;
|
||||
originOperations.value.splice(index, 1);
|
||||
tableChanged.value = true;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
const operations: Operation[] = [
|
||||
{id: 1, track: 90},
|
||||
{id: 2, track: 60},
|
||||
{id: 3, track: 10},
|
||||
{id: 4, track: 30},
|
||||
{id: 5, track: 20},
|
||||
{id: 6, track: 99},
|
||||
{id: 7, track: 50},
|
||||
{id: 1, track: 98},
|
||||
{id: 2, track: 183},
|
||||
{id: 3, track: 37},
|
||||
{id: 4, track: 122},
|
||||
{id: 5, track: 14},
|
||||
{id: 6, track: 124},
|
||||
{id: 7, track: 65},
|
||||
{id: 8, track: 67},
|
||||
];
|
||||
export default operations;
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import {Algorithm} from "@/logical/expr2/disk.ts";
|
|||
|
||||
const useExpr2Store = defineStore('expr2', {
|
||||
state: () => ({
|
||||
trackCount: 100,
|
||||
trackCount: 200,
|
||||
currentTrack: 0,
|
||||
startTrack: 50,
|
||||
startTrack: 53,
|
||||
operations: operations,
|
||||
originOperations: operations,
|
||||
tableChanged: false,
|
||||
|
|
Loading…
Reference in New Issue