248 lines
11 KiB
Plaintext
248 lines
11 KiB
Plaintext
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" EnableEventValidation="false" CodeFile="index.aspx.cs" Inherits="admin_hr_index" %>
|
|
|
|
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
|
|
<div class="mb-2 mb-sm-0">
|
|
<a href="reg.aspx" class="btn btn-primary">
|
|
<i class="mdi mdi-plus"></i>新增
|
|
</a>
|
|
<a @click="deleteAll" class="btn btn-outline-danger" title="刪除勾選的資料" ><i class="mdi mdi-trash-can"></i> 刪除勾選</a>
|
|
</div>
|
|
<div class="">
|
|
|
|
<asp:LinkButton ID="excel" runat="server" CssClass="btn btn-outline-success"
|
|
OnClick="excel_Click"><span class="fa-solid fa-file-excel"></span> 匯出Excel</asp:LinkButton>
|
|
</div>
|
|
</asp:Content>
|
|
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" runat="Server">
|
|
|
|
|
|
<script>
|
|
Vue.filter('timeString', function (value, myFormat) {
|
|
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
|
|
});
|
|
|
|
let VueApp=new Vue({
|
|
el: '#app',
|
|
vuetify: new Vuetify(vuetify_options),
|
|
data() {
|
|
return {
|
|
options: { multiSort: false },
|
|
data_table: {
|
|
loading: true,
|
|
list: [],
|
|
selected: [],
|
|
singleSelect: false,
|
|
count: 0,
|
|
page: 1,
|
|
pageSize: 10,
|
|
header: [
|
|
{ text: '人員編號', value: 'm_number' },
|
|
{ text: '人員姓名', value: 'u_name'},
|
|
{ text: '性別', value: 'sex' },
|
|
{ text: '組別', value: 'group_kindTxt2' },
|
|
{ text: '職稱', value: 'title_kindTxt' },
|
|
{ text: '上班時間', value: 'starttime' },
|
|
{ text: '備註', value: 'demo', sortable: false },
|
|
{ text: '', value: 'slot_btn', sortable: false, align: 'end' },
|
|
|
|
],
|
|
footer:{
|
|
showFirstLastPage: true,
|
|
itemsPerPageOptions:[5,10,20,30],
|
|
},
|
|
},
|
|
search: {
|
|
group_kind: 0,
|
|
title_kind: 0,
|
|
u_name: '',
|
|
starttime:'',
|
|
offtime: ''
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
options: {
|
|
handler() {
|
|
this.getDefault()
|
|
},
|
|
deep: true,
|
|
},
|
|
|
|
},
|
|
methods: {
|
|
getDefault(clearpage=false) {
|
|
const { sortBy, sortDesc, page, itemsPerPage } = this.options
|
|
const params = {
|
|
sortBy: sortBy[0], sortDesc: sortDesc[0],
|
|
page: clearpage? '1': page, pageSize: itemsPerPage
|
|
};
|
|
this.data_table.loading = true
|
|
axios
|
|
.post(HTTP_HOST + 'api/member/GetList', this.search, { params: params })
|
|
.then(response => {
|
|
this.data_table.list = response.data.list
|
|
this.data_table.count = response.data.count;
|
|
this.data_table.loading = false
|
|
})
|
|
.catch(error => console.log(error))
|
|
},
|
|
editItem(item) {
|
|
console.log("edit", item);
|
|
},
|
|
deleteItem(item) {
|
|
|
|
if (confirm('是否確定刪除此筆資料?')) {
|
|
const index = this.data_table.list.indexOf(item)
|
|
if (index != -1) {
|
|
axios
|
|
.delete(HTTP_HOST + 'api/member/' + item.num)
|
|
.then(response => {
|
|
console.log("del", item);
|
|
this.data_table.list.splice(index, 1);
|
|
this.data_table.count = this.data_table.list.length
|
|
})
|
|
.catch(error => console.log(error))
|
|
}
|
|
}
|
|
},
|
|
deleteAll() {
|
|
if (confirm('是否確定刪除已勾選的資料?')) {
|
|
axios
|
|
.delete(HTTP_HOST + 'api/member/Delete/' + this.data_table.selected.map(x => x.num))
|
|
.then(response => {
|
|
//console.log("delAll");
|
|
//for (var i = 0; i < this.data_table.selected.length; i++) {
|
|
// const index = this.data_table.list.indexOf(this.data_table.selected[i]);
|
|
// this.data_table.list.splice(index, 1);
|
|
//}
|
|
//this.data_table.selected = [];
|
|
//this.data_table.count = this.data_table.list.length
|
|
location.reload();
|
|
})
|
|
.catch(error => console.log(error))
|
|
}
|
|
},
|
|
btn_search() {
|
|
//this.options.page = 1;
|
|
this.getDefault(true)
|
|
},
|
|
btn_all() {
|
|
clearObjProps(this.search);
|
|
this.btn_search()
|
|
},
|
|
demoOpen(item) {
|
|
if (item.demo != null && item.demo != '')
|
|
msgbox($('#dd_' + item.num).html());
|
|
}
|
|
|
|
},
|
|
computed: {
|
|
pageCount() {
|
|
return Math.ceil(this.data_table.count / this.data_table.pageSize)
|
|
},
|
|
},
|
|
})
|
|
</script>
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
|
<uc1:alert runat="server" ID="L_msg" Text="" />
|
|
<div id="content" class="container-fluid">
|
|
<v-data-table
|
|
v-model="data_table.selected"
|
|
:items="data_table.list"
|
|
:search-props="search"
|
|
item-key="num"
|
|
:options.sync="options"
|
|
:headers="data_table.header"
|
|
:footer-props="data_table.footer"
|
|
:server-items-length="data_table.count"
|
|
:loading="data_table.loading"
|
|
:single-select="data_table.singleSelect"
|
|
show-select
|
|
hide-default-footer
|
|
:page.sync="data_table.page"
|
|
:items-per-page.sync="data_table.pageSize"
|
|
class="elevation-1">
|
|
<template #item.demo="{ item }" >
|
|
<div v-if="item.demo !=null && item.demo !=''" class="d-none" :id="'dd_'+item.num">{{ item.demo}} </div>
|
|
<a v-if="item.demo !=null && item.demo !=''" class="btn btn-outline-secondary btn-sm" @click="demoOpen(item)" >
|
|
<i class='mdi mdi-magnify'></i></a>
|
|
</template>
|
|
<template #item.slot_btn="{ item }">
|
|
<a :href="'reg.aspx?num='+item.num" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>修改</a>
|
|
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>
|
|
</template>
|
|
</v-data-table>
|
|
<v-container>
|
|
<v-row class="align-baseline" wrap>
|
|
<v-col cols="12" md="9">
|
|
<v-pagination
|
|
v-model="data_table.page"
|
|
:length="pageCount">
|
|
</v-pagination>
|
|
</v-col>
|
|
<v-col class="text-truncate text-right" cols="12" md="2">
|
|
共 {{ data_table.count }} 筆, 頁數:
|
|
</v-col>
|
|
<v-col cols="6" md="1">
|
|
<v-text-field
|
|
v-model="data_table.page"
|
|
type="number"
|
|
hide-details
|
|
dense
|
|
min="1"
|
|
:max="pageCount"
|
|
@input="data_table.page = parseInt($event, 10)"
|
|
></v-text-field>
|
|
</v-col>
|
|
</v-row>
|
|
</v-container>
|
|
</div>
|
|
<div id="print_data">
|
|
</div>
|
|
|
|
</asp:Content>
|
|
|
|
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" runat="Server">
|
|
<div id="search_panel" alt="查詢公告資料">
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">組別</label>
|
|
<asp:DropDownList ID="s_kind" runat="server" CssClass="form-select" v-model="search.group_kind">
|
|
<asp:ListItem Value="" Text=""></asp:ListItem>
|
|
</asp:DropDownList>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">職稱</label>
|
|
<asp:DropDownList ID="s_kind2" runat="server" CssClass="form-select" v-model="search.title_kind">
|
|
<asp:ListItem Value="" Text=""></asp:ListItem>
|
|
</asp:DropDownList>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">人員姓名 </label>
|
|
<asp:TextBox ID="s_u_name" runat="server" CssClass="form-control" v-model="search.u_name" placeholder="可輸入關鍵字查詢"></asp:TextBox>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">上班時間</label>
|
|
<div class="input-group">
|
|
<input type="time" v-model="search.starttime" class="form-control" id="s_starttime" runat="server">
|
|
<span class="input-group-text">~</span>
|
|
<input type="time" v-model="search.offtime" class="form-control" id="s_offtime" runat="server">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3 p-2 border-top">
|
|
<a @click="btn_search" class="btn btn-outline-primary"><i class="mdi mdi-filter"></i> 搜尋</a>
|
|
<a class="btn btn-outline-secondary" @click="btn_all"><i class="mdi mdi-filter-remove"></i> 所有資料</a>
|
|
</div>
|
|
</div>
|
|
|
|
</asp:Content>
|
|
|