feat(WIP): ReservedCommand 선택창을 vue-multiselect로 변경

- vue-select는 취소
This commit is contained in:
2021-12-05 16:41:13 +09:00
parent 8152d84e72
commit 23bcae567f
3 changed files with 12 additions and 40 deletions
+2 -1
View File
@@ -475,7 +475,8 @@ function getCommandTable(General $general){
if (!$commandObj->canDisplay()) {
continue;
}
$subList[Util::getClassNameFromObj($commandObj)] = [
$subList[] = [
'value'=>Util::getClassNameFromObj($commandObj),
'compansation'=>$commandObj->getCompensationStyle(),
'possible'=>$commandObj->hasMinConditionMet(),
'title'=>$commandObj->getCommandDetailTitle(),
+10 -38
View File
@@ -132,12 +132,13 @@
<v-multiselect
v-model="selectedCommand"
:allow-empty="false"
:options="compiledCommandList"
:options="commandList"
:group-select="true"
group-values="values"
group-label="category"
label="title"
track-by="value"
open-direction="top"
>
</v-multiselect>
<!--<b-form-select v-model="selectedCommand"
@@ -173,9 +174,9 @@ import { joinYearMonth } from "./util/joinYearMonth";
import { parseTime } from "./util/parseTime";
import { parseYearMonth } from "./util/parseYearMonth";
import { sammoAPI } from "./util/sammoAPI";
import { unwrap_any } from "./util/unwrap_any";
type commandItem = {
value: string;
title: string;
compensation: number;
possible: boolean;
@@ -186,7 +187,7 @@ declare const maxTurn: number;
declare const maxPushTurn: number;
declare const commandList: {
category: string;
values: Record<string, commandItem>;
values: commandItem[];
}[];
declare const serverNow: string;
@@ -395,11 +396,13 @@ export default defineComponent({
turnList.push(turnIdx);
}
if (listReqArgCommand.has(this.selectedCommand)) {
const commandName = this.selectedCommand.value;
if (listReqArgCommand.has(commandName)) {
document.location.href = stringifyUrl({
url: "b_processing.php",
query: {
command: unwrap_any<string>(this.selectedCommand),
command: commandName,
turnList: turnList.join("_"),
},
});
@@ -409,7 +412,7 @@ export default defineComponent({
try {
await sammoAPI("Command/ReserveCommand", {
turnList,
action: this.selectedCommand,
action: commandName,
});
} catch (e) {
console.error(e);
@@ -431,7 +434,7 @@ export default defineComponent({
const pressed = Array.from<boolean>({ length: maxTurn }).fill(false);
pressed[0] = true;
const selectedCommand = "휴식";//FIXME: 새 구성에 따르면 Object임.
const selectedCommand = commandList[0].values[0];
const emptyTurn: TurnObjWithTime[] = Array.from<TurnObjWithTime>({
length: maxTurn,
@@ -444,43 +447,12 @@ export default defineComponent({
time: "",
});
const compiledCommandList: {
category: string;
values: {
title: string;
value: null | string;
reqArg: boolean,
possible?: boolean;
compensation?: number;
}[];
}[] = [];
for (const category of commandList) {
const categoryList: (typeof compiledCommandList)[0]['values'] = [];
for (const [commandValue, commandInfo] of Object.entries(
category.values
)) {
categoryList.push({
reqArg: commandInfo.reqArg,
title: commandInfo.title,
value: commandValue,
possible: commandInfo.possible,
compensation: commandInfo.compensation,
});
}
compiledCommandList.push({
category: category.category,
values: categoryList,
});
}
return {
maxTurn,
flippedMaxTurn: 16,
viewMaxTurn: 16,
maxPushTurn,
commandList,
compiledCommandList,
serverNow: formatTime(serverNowObj, "HH:mm:ss"),
timeDiff,
pressed,
-1
View File
@@ -40,7 +40,6 @@
"summernote": "^0.8.18",
"vue": "^3.2.2",
"vue-multiselect": "^3.0.0-alpha.2",
"vue-select": "^4.0.0-beta.1",
"vue-types": "^4.1.0",
"vuedraggable": "^4.1.0"
},