This commit is contained in:
2026-07-19 19:48:17 +08:00
parent 59bb0ff824
commit 07c5027ad8
+152 -67
View File
@@ -127,8 +127,7 @@
value="內容尺寸">
<v-card flat>
<v-card-text>
<div class="form-floating mb-3">
<%--<div class="form-floating mb-3">--%>
<v-row>
<v-col cols="12" class="pa-0">
<v-tabs
@@ -137,15 +136,38 @@
color="primary"
align-tabs="start"
center-active
show-arrows
v-resize="onTabsResize"
>
<v-tab key="000001" value="000001" class="d-flex flex-column py-2">
<button type="button" class="btn btn-info" @click.prevent="newPaperSize">新增尺寸</button>
</v-tab>
<v-tab v-for="item in allSize" :key="item.id" :value="item.id" class="d-flex flex-column py-2">
<button tytpe="button" class="btn btn-info" @click.prevent="changePaper1(item)"><span class=" limit-text mt-1">{{ item.name }}</span></button>
<button tytpe="button" class="btn btn-info" @click.prevent="changePaper1(item)"
@contextmenu.prevent="openPaperMenu($event,item.id)"><span class=" limit-text mt-1">{{ item.name }}</span></button>
</v-tab>
</v-tabs>
</v-col>
</v-row>
</div>
<v-menu
absolute
offset-y
:position-x="paperMenuX"
:position-y="paperMenuY"
v-model="showPaperMenu"
>
<v-list>
<v-list-item
:key="showPaperMenu">
<v-list-item-title>
<button class="btn btn-primary" @click.prevent="removePaper()">刪除</button>
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
<%--</div>--%>
</v-card-text>
</v-card>
</v-tab-item>
<v-tab-item
@@ -160,6 +182,8 @@
color="primary"
align-tabs="start"
center-active
show-arrows
v-resize="onTabsResize"
>
<v-tab v-for="item in allSize" :key="item.id" :value="item.id" class="d-flex flex-column py-2">
<button tytpe="button" class="btn btn-info" @click.prevent="changePrintSize(item.id)"><span class=" limit-text mt-1">{{ item.name }}</span></button>
@@ -250,7 +274,7 @@
value="存檔">
<v-card flat>
<v-card-text>
<span class="btn btn-sm btn-outline-info w-100 mb-2" onclick="saveStyle()">存檔</span>
<span class="btn btn-sm btn-outline-info w-100 mb-2" @click.prevent="saveStyle">存檔</span>
</v-card-text>
</v-card>
</v-tab-item>
@@ -259,39 +283,19 @@
<div class="d-flex overflow-hidden" style="height: 1920px">
<div class="p-2 text-white floting-box" style="width: 250px; left: 20px; top: 80px;">
<%-- <h6 class="border-bottom pb-2">設計工具箱</h6>--%>
<div class="input-group mb-3">
<v-list flat disabled style="width: 250px;">
<v-subheader>型版屬性</v-subheader>
<v-list-item-group color="primary">
<v-list-item >
<v-list-item-content>
<v-list-item-title>型版名稱:</v-list-item-title>
<input type="text" v-model="styleName" />
</v-list-item-content>
</v-list-item>
<v-list-item >
<v-list-item-content>
<v-list-item-title>內容尺寸:{{getParseName(paperSize,"content")}}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item >
<v-list-item-content>
<v-list-item-title >列印尺寸:{{ getParseName(printSize,"print") }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item >
<v-list-item-content>
<v-list-item-title >列印模式:{{ getParseName(printMode,"mode") }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item >
<v-list-item-content>
<v-list-item-title> 底圖:{{ backendInp }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-item-group>
</v-list>
</div>
<v-card>
<v-card-title>
型版屬性
</v-card-title>
<v-card-text>
型版名稱: <v-text-field type="input" v-model="styleName"></v-text-field><br>
內容尺寸:{{getParseName(paperSize,"content")}}<br>
列印尺寸:{{ getParseName(printSize,"print") }}<br>
列印模式:{{ getParseName(printMode,"mode") }}<br>
底圖:{{ backendInp }}
</v-card-text>
</v-card>
</div>
<div id="printArea" style="width: 100vw; height: 100vh">
@@ -390,6 +394,59 @@
</v-btn>
</template>
</v-snackbar>
<v-dialog
v-model="paperDialog"
width="600" height="800" :z-index="3000"
>
<v-card>
<v-card-text>
<v-text-field v-model="newPaper.paperName" label="尺寸名稱"></v-text-field>
<v-text-field v-model="newPaper.paperWidth" label="寬度(mm)"></v-text-field>
<v-text-field v-model="newPaper.paperHeight" label="高度(mm)"></v-text-field>
</v-card-text>
<v-card-actions>
<v-btn
class="ms-auto"
@click="savePaperSize"
>確定</v-btn>
<v-btn
class="ms-auto"
@click="paperDialog = false"
>取消</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog
v-model="removeDialog"
width="auto"
:z-index="3000"
>
<v-card>
<v-card-text>
確定刪除?
</v-card-text>
<v-card-actions>
<v-btn
class="ms-auto"
v-if="removeTarget=='paper'"
@click="confirmRemovePaper"
>確定</v-btn>
<v-btn
class="ms-auto"
v-if="removeTarget=='style'"
@click="confirmRemoveStyle"
>確定</v-btn>
<v-btn
class="ms-auto"
@click="removeDialog = false"
>取消</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" runat="Server">
</asp:Content>
@@ -440,9 +497,17 @@
},
styleName: "",
showStyleMenu: false,
showPaperMenu: false,
styleMenuX: 0,
styleMenuY: 0,
styleMenuStyle:""
styleMenuStyle: "",
removeDialog: false,
removeTarget: "",
removeStyleID: "",
removePaperID: "",
paperMenuX: 0,
paperMenuY: 0,
paperDialog:false,
}
},
computed: {
@@ -462,9 +527,7 @@
getParseName(id, classes) {
if (id != null) {
if (classes === "style") {
let data = this.allStyle.find(x => x.styleID === id)
return data?.name
} else if (classes === "content") {
let data = this.allSize.find(x => x.id === id)
@@ -497,12 +560,22 @@
this.styleMenuX = e.clientX;
this.styleMenuY = e.clientY;
this.styleMenuStyle = `top:${e.clientY}px,left:${e.clientX}px`
this.styleID=id
this.styleID = id
this.removeStyleID = id
//console.log("QQOO_openStyleMenu:",id);
},
closeStyleMenu() {
this.showStyleMenu = false;
},
openPaperMenu(e, id) {
this.paperMenuX = e.clientX
this.paperMenuY = e.clientY
this.showPaperMenu = true
this.removePaperID=id
},
closePaperMenu() {
this.showPaperMenu = false;
},
print() {
let self = this;
let s = this.allStyle.find(x => x.styleID == this.styleID)
@@ -697,11 +770,11 @@
}
}
});
$("#paperSize").append("<option value='newsize' >新增尺寸</option>")
/*$("#paperSize").append("<option value='newsize' >新增尺寸</option>")
this.allSize.forEach(x => {
$("#paperSize").append("<option value='" + x.id + "'>" + x.name + "(" + x.width + "*" + x.height + ")</option>")
$("#printSize").append("<option value='" + x.id + "'>" + x.name + "(" + x.width + "*" + x.height + ")</option>");
})
})*/
},
async getElements() {
let self = this
@@ -712,7 +785,6 @@
//if (response.result=="Y") {
if (response.status == "200") {
let data = response.data;
console.log("data:", data)
if (data.result == "Y") {
data.data.forEach(x => {
self.tabletElements.push(x);
@@ -724,7 +796,7 @@
async getStyles() {
let self = this
self.allSize.length = 0
$(".style-menu").html("")
// $(".style-menu").html("")
await axios
.post(HTTP_HOST + 'api/tablet/GetStyleData', {})
.then(response => {
@@ -734,10 +806,10 @@
if (data.result == "Y") {
data.data.forEach(x => {
self.allStyle.push(x);
$(".style-menu").append("<li><span class='dropdown-item style-item' data-value='" + x.styleID + "'>" + x.name + "</span></li>");
//$(".style-menu").append("<li><span class='dropdown-item style-item' data-value='" + x.styleID + "'>" + x.name + "</span></li>");
});
this.bindDropdown();
//this.bindDropdown();
}
}
//}
@@ -774,7 +846,6 @@
let obj = this.elements
let s = this.allStyle.find(x => x.styleID == id)
let size = this.allSize.find(x => x.id == s.paperSize)
//this.showStyleMenu = true;
this.paper.width = size.width;
this.paper.height = size.height;
this.rosterLimit = s.rosterLimit;
@@ -784,6 +855,7 @@
this.printMode = s.printMode
this.perpage = s.perpage
this.styleID = id
this.styleName=s.name
//this.rosterLimit = s.rosterLimit
//$("#paperSize").val(s.paperSize);
@@ -879,9 +951,9 @@
});
}
},
async removePaper() {
async confirmRemovePaper() {
let self = this;
let paperSize =this.paperSize //$("#paperSize").val()
let paperSize = this.removePaperID //$("#paperSize").val()
//console.log("paperSize:",paperSize);
if (paperSize == "newsize" || paperSize == "" || paperSize == null || paperSize == undefined) {
@@ -894,31 +966,34 @@
.post(HTTP_HOST + 'api/tablet/DelPaperSize', ps)
.then(response => {
if (response.status == "200") {
//if (response.data.result == "Y") {
$("#toast_body").html(`${response.data.message}`)
self.toast.show();
//}
this.snackbar.text = `${response.data.message}`;
this.snackbar.show = true
if (response.data.result == "Y") {
self.getPaperSize()
//$("#paperSize").val("")
this.paperSize=""
this.paperSize = ""
this.changePaper()
}
} else {
this.snackbar.text = "存檔失敗";
this.snackbar.show=true
}
this.removeDialog = false;
});
},
async removeStyle() {
async removePaper() {
this.removeDialog = true;
this.removeTarget = "paper";
console.log("QQOO", this.removeStyle)
},
async confirmRemoveStyle() {
let self = this;
let sID = this.styleID
let sID = this.removeStyleID;
//console.log("styleID:", sID);
if (sID == "000001" || sID == null || sID == undefined) {
//$("#toast_body").html("請選擇要刪除的版型")
//self.toast.show();
this.snackbar.text = "請選擇要刪除的版型"
this.snackbar.show=true
this.snackbar.show = true
return false
}
let ps = { styleID: sID }
@@ -926,17 +1001,22 @@
.post(HTTP_HOST + 'api/tablet/DelTabletStyle', ps)
.then(response => {
if (response.status == "200") {
//if (response.data.result == "Y") {
$("#toast_body").html(`${response.data.message}`)
self.toast.show();
//}
if (response.data.result == "Y") {
self.getStyles()
}
}
});
},
async removeStyle() {
this.removeDialog = true;
this.removeTarget = "style";
console.log("QQOO",this.removeStyle)
},
async newPaperSize() {
this.paperDialog = true
},
async savePaperSize() {
let ps = {
paperName: this.newPaper.paperName, //$("#paperName").val(),
@@ -957,6 +1037,10 @@
//$("#paperSize").val("")
self.paperSize=""
self.changePaper()
self.paperDialog = false
self.newPaper.paperName = ""
self.newPaper.paperWidth = 0
self.newPaper.paperHeight =0
}
}
});
@@ -1423,6 +1507,7 @@
$("#toast_body").html(`${"ok"}`)
self.toast.show();
this.getStyles();
}
}
});