286 lines
14 KiB
Plaintext
286 lines
14 KiB
Plaintext
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="attendances.aspx.cs" Inherits="admin_hr_attendances" ValidateRequest="false" %>
|
|
|
|
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content4" ContentPlaceHolderID="footer_script" runat="Server">
|
|
<script>
|
|
let VueApp = new Vue({
|
|
el: '#app',
|
|
vuetify: new Vuetify(vuetify_options),
|
|
data() {
|
|
return {
|
|
options: {},
|
|
search_dialog: {
|
|
controls: {
|
|
search1: {
|
|
id: 'search1',
|
|
title: '人員',
|
|
text_prop: 'u_name',
|
|
value_prop: 'num',
|
|
keys: [
|
|
{ id: 'm_number', title: '編號', value: '' },
|
|
{ id: 'u_name', title: '姓名', value: '' },
|
|
{ id: 'sex', title: '性別', value: '' },
|
|
],
|
|
api_url: HTTP_HOST + 'api/member/GetList',
|
|
columns: [
|
|
{ id: 'm_number', title: '編號'},
|
|
{ id: 'u_name', title: '姓名'},
|
|
{ id: 'sex', title: '性別'},
|
|
],
|
|
selected: {},
|
|
select(t) {
|
|
console.log("select search1", t);
|
|
|
|
}
|
|
},
|
|
|
|
},
|
|
show: false,
|
|
current: {},
|
|
list: [],
|
|
count: 0,
|
|
page:1,
|
|
loading: false,
|
|
footer: {
|
|
showFirstLastPage: true,
|
|
disableItemsPerPage: true,
|
|
itemsPerPageAllText: '',
|
|
itemsPerPageText:'',
|
|
},
|
|
},
|
|
snackbar: {
|
|
show: false,
|
|
text: "",
|
|
}
|
|
|
|
}
|
|
},
|
|
mounted() {
|
|
this.search_dialog.current = this.search_dialog.controls.search1
|
|
//console.log("mounted");
|
|
},
|
|
watch: {
|
|
options: {
|
|
handler() {
|
|
//console.log("watch1", this.search_dialog, this.search_dialog.page);
|
|
this.search_get()
|
|
console.log("watch2", this.search_dialog, this.search_dialog.page);
|
|
},
|
|
deep: true,
|
|
},
|
|
},
|
|
methods: {
|
|
search_show(curr) {
|
|
//console.log("btn_click:", curr, curr.api_url);
|
|
this.search_dialog.current = curr;
|
|
this.search_clear()
|
|
//this.search_get()//清除完自動會重抓, 故取消
|
|
this.search_dialog.show = true;
|
|
},
|
|
search_clear() {
|
|
if (!this.search_dialog.current.keys) return;
|
|
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
|
|
this.search_get()
|
|
},
|
|
search_get() {
|
|
if (!this.search_dialog.current.keys) return;
|
|
let api_url = this.search_dialog.current.api_url;
|
|
let keys = this.search_dialog.current.keys;
|
|
//const { page, itemsPerPage } = this.options
|
|
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
|
|
this.search_dialog.page = this.options.page??1
|
|
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
|
|
var search = {};//post body
|
|
keys.forEach((t, i) => {
|
|
search[t.id] = t.value;
|
|
});
|
|
|
|
console.log("search_get", api_url, search, params, this.options);
|
|
this.search_dialog.loading = true
|
|
axios.post(api_url, search, { params: params })
|
|
.then(response => {
|
|
this.search_dialog.list = response.data.list
|
|
this.search_dialog.count = response.data.count
|
|
this.search_dialog.loading = false
|
|
})
|
|
.catch(error => {
|
|
console.log(error)
|
|
this.search_dialog.list = []
|
|
this.search_dialog.count = 0
|
|
this.search_dialog.loading = false
|
|
this.snackbar.text = "錯誤:" + error
|
|
this.snackbar.show=true
|
|
})
|
|
},
|
|
search_headers() {
|
|
if (!this.search_dialog.current.columns) return;
|
|
r = [];
|
|
this.search_dialog.current.columns.forEach((t, i) => {
|
|
r.push({
|
|
text: t.title,
|
|
align: 'start',
|
|
sortable: false,
|
|
value: t.id,
|
|
})
|
|
})
|
|
return r
|
|
},
|
|
search_select(row) {
|
|
let curr = this.search_dialog.current;
|
|
let target = $(`[data-search-control=${curr.id}]`);
|
|
curr.selected = row;
|
|
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
|
|
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
|
|
if (curr.select instanceof Function) {
|
|
curr.select(row);
|
|
}
|
|
this.search_dialog.show = false;
|
|
console.log(row, row["u_name"], row["f_number"], curr.id, target);
|
|
},
|
|
},
|
|
computed: {
|
|
},
|
|
})
|
|
</script>
|
|
</asp:Content>
|
|
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
|
|
<div class="scroll-nav nav nav-tabs mb-2 mb-sm-0 d-none d-sm-flex">
|
|
</div>
|
|
<div class="">
|
|
<asp:Button ID="add" runat="server" Text="送出" OnClick="add_Click" CssClass="btn btn-primary" />
|
|
<asp:Button ID="edit" runat="server" Text="修改" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary" />
|
|
<asp:Button ID="goback" runat="server" Text="回列表" Visible="false" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
|
|
</div>
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
|
<uc1:alert runat="server" ID="L_msg" Text="" />
|
|
<div id="content" class="container-fluid">
|
|
|
|
<div class="card shadow-sm my-3">
|
|
<div class="card-header">
|
|
考勤管理
|
|
</div>
|
|
<asp:Panel ID="cardBodyPanel" runat="server" CssClass="card-body">
|
|
<div>
|
|
<div class="form-text text-muted">以下 * 欄位為必填欄位</div>
|
|
</div>
|
|
|
|
<div class="row g-1 gx-lg-2">
|
|
<label class="col-sm-2 col-form-label">人員 *</label>
|
|
<div class="col-sm-10 col-lg-4">
|
|
<%-- <asp:DropDownList ID="mem_num" CssClass="form-select" runat="server" data-int="Y">
|
|
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
|
|
</asp:DropDownList>--%>
|
|
<div class="input-group mb-3" data-search-control="search1" @click="search_show(search_dialog.controls.search1)">
|
|
<input class="form-control search-text" type="text" readonly
|
|
id="mem_num_txt" runat="server" placeholder="人員" value="" >
|
|
<asp:HiddenField ID="mem_num" runat="server" Value="" />
|
|
<button class="btn btn-outline-secondary" type="button" >
|
|
<i class="mdi mdi-view-list-outline"></i>
|
|
</button>
|
|
</div>
|
|
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="mem_num_txt"
|
|
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
|
|
</div>
|
|
|
|
<label class="col-sm-2 col-form-label">出勤型態 *</label>
|
|
<div class="col-sm-10 col-lg-4">
|
|
<asp:DropDownList ID="check_type" CssClass="form-select" runat="server" data-int="Y">
|
|
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
|
|
</asp:DropDownList>
|
|
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="check_type"
|
|
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
|
|
</div>
|
|
|
|
<label class="col-sm-2 col-form-label">日期 * </label>
|
|
<div class="col-sm-10 col-lg-4">
|
|
<asp:TextBox ID="check_date" runat="server" CssClass="form-control" TextMode="Date"></asp:TextBox>
|
|
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="check_date"
|
|
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
|
|
</div>
|
|
|
|
<label class="col-sm-2 col-form-label">時間 *</label>
|
|
<div class="col-sm-10 col-lg-4">
|
|
<asp:TextBox ID="check_time" runat="server" CssClass="form-control" TextMode="Time"></asp:TextBox>
|
|
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="check_time"
|
|
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
|
|
</div>
|
|
|
|
<label class="col-sm-2 col-form-label">請假時數 </label>
|
|
<div class="col-sm-10 col-lg-4">
|
|
<asp:TextBox ID="hour" MaxLength="5" runat="server" CssClass="form-control" placeholder="請輸入請假時數"></asp:TextBox>
|
|
<asp:RegularExpressionValidator ControlToValidate="hour" Display="Dynamic" SetFocusOnError="true"
|
|
ErrorMessage="只能輸入數字" ValidationGroup="Required" ID="RegularExpressionValidator3"
|
|
runat="server" ValidationExpression="^(-?\d+)(\.\d+)?$" />
|
|
|
|
</div>
|
|
|
|
<label class="col-sm-2 col-form-label">IP </label>
|
|
<div class="col-sm-10 col-lg-4">
|
|
<asp:Literal ID="ip" runat="server"></asp:Literal>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="row mb-1">
|
|
<label class="col-form-label">備註</label>
|
|
<div class="">
|
|
<asp:TextBox ID="demo" runat="server" Rows="5" TextMode="MultiLine" CssClass="form-control" placeholder="請輸入備註"></asp:TextBox>
|
|
</div>
|
|
</div>
|
|
|
|
</asp:Panel>
|
|
</div>
|
|
<v-dialog v-model="search_dialog.show" max-width="500px">
|
|
<v-card>
|
|
<v-card-title class="justify-space-between grey lighten-2">
|
|
查詢:{{search_dialog.current.title}}
|
|
<v-btn icon @click="search_dialog.show=false"><v-icon>mdi-close</v-icon></v-btn>
|
|
</v-card-title>
|
|
<v-card-text >
|
|
<v-row>
|
|
<v-col v-for="item in search_dialog.current.keys"
|
|
:cols="search_dialog.current.keys.length>1?6:12" >
|
|
<v-text-field v-model="item.value" :label="item.title"></v-text-field>
|
|
</v-col>
|
|
<v-col cols="12" class="text-end">
|
|
<v-btn color="primary" elevation="0" @click="search_get()">查詢</v-btn>
|
|
<v-btn elevation="0" @click="search_clear()">清除條件</v-btn>
|
|
</v-col>
|
|
</v-row>
|
|
<v-data-table
|
|
:headers="search_headers()"
|
|
:items="search_dialog.list"
|
|
:footer-props="search_dialog.footer"
|
|
:items-per-page="10"
|
|
:server-items-length="search_dialog.count"
|
|
:page.sync="search_dialog.page"
|
|
:options.sync="options"
|
|
@click:row="search_select"
|
|
></v-data-table>
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<v-snackbar
|
|
v-model="snackbar.show"
|
|
timeout="2000"
|
|
>
|
|
{{ snackbar.text }}
|
|
<template v-slot:action="{ attrs }">
|
|
<v-btn
|
|
text
|
|
v-bind="attrs"
|
|
@click="snackbar.show = false"
|
|
>
|
|
關閉
|
|
</v-btn>
|
|
</template>
|
|
</v-snackbar>
|
|
</div>
|
|
|
|
</asp:Content>
|
|
|