356 lines
20 KiB
Plaintext
356 lines
20 KiB
Plaintext
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="reg.aspx.cs" Inherits="admin_supplier_reg" 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>
|
||
|
||
function checkNumber(btn) {
|
||
$('#errormsg').hide();
|
||
var _txt = $(btn).val();
|
||
$.ajax({
|
||
method: "POST",
|
||
url: "reg.aspx",
|
||
data: {
|
||
type: 'chkNo',
|
||
txt: _txt,
|
||
id: '<%= Request["num"]%>'
|
||
},
|
||
error: function (xhr, status, error) {
|
||
var errorMessage = xhr.status + ': ' + xhr.statusText
|
||
//alert('Error - ' + errorMessage);
|
||
console.log('Error - ' + errorMessage);
|
||
}
|
||
}).done(function (data) {
|
||
if (data.isOk) {
|
||
|
||
} else {
|
||
console.log(data.msg);
|
||
$('#errormsg').text(data.msg);
|
||
$('#errormsg').show();
|
||
}
|
||
});
|
||
|
||
|
||
}
|
||
|
||
</script>
|
||
<script>
|
||
let VueApp = new Vue({
|
||
el: '#app',
|
||
vuetify: new Vuetify(vuetify_options),
|
||
data() {
|
||
return {
|
||
news_id: '<%= Request["num"] %>',
|
||
options: {},
|
||
search_dialog: {
|
||
controls: {
|
||
search1: {
|
||
id: 'search1',
|
||
title: '供應商分類',
|
||
text_prop: 'kind',
|
||
value_prop: 'num',
|
||
keys: [
|
||
{ id: 'kind', title: '分類名稱', value: '' },
|
||
|
||
],
|
||
api_url: HTTP_HOST + 'api/supplier/GetKindList',
|
||
columns: [
|
||
{ id: 'kind', title: '分類名稱', value: '' },
|
||
],
|
||
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;
|
||
});
|
||
//necessary parameter===
|
||
if (this.search_dialog.current.id == 'search1') {
|
||
search['inTime'] = (this.news_id != '' ? false : true);
|
||
}
|
||
|
||
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["s_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-md">
|
||
<div class="card shadow-sm my-2" id="sec2">
|
||
<div class="card-header py-0">
|
||
<nav class="navbar py-0">
|
||
<div class="nav nav-tabs">
|
||
<button class="nav-link active" id="sec2-tab1" data-bs-toggle="tab" data-bs-target="#sec2-page1"
|
||
type="button" role="tab" aria-controls="home" aria-selected="true">
|
||
基本資料</button>
|
||
</div>
|
||
</nav>
|
||
</div>
|
||
<asp:Panel ID="cardBodyPanel" runat="server" CssClass="card-body">
|
||
<div class="tab-content" id="myTabContent">
|
||
<div class="tab-pane fade show active" id="sec2-page1" role="tabpanel" aria-labelledby="sec2-tab1">
|
||
<div>
|
||
<div class="form-text text-muted">以下 * 欄位為必填欄位</div>
|
||
</div>
|
||
|
||
<div class="row mb-1 label-sm-right">
|
||
<label class="col-sm-2 col-lg-1 col-form-label">供應商編號 *</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="s_number" MaxLength="20" runat="server" CssClass="form-control" onchange="checkNumber(this)" placeholder="請輸入供應商編號(不可重複)"></asp:TextBox>
|
||
<span id="errormsg" class="text-danger" style="display: none;"></span>
|
||
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="s_number" runat="server"
|
||
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
|
||
</div>
|
||
<label class="col-sm-2 col-lg-1 col-form-label">統一編號</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="c_num" MaxLength="8" runat="server" CssClass="form-control" placeholder="請輸入統一編號"></asp:TextBox>
|
||
</div>
|
||
<label class="col-sm-2 col-lg-1 col-form-label">分類 *</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<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="kind_txt" runat="server" placeholder="分類" value="">
|
||
<asp:HiddenField ID="kind" runat="server" Value="" />
|
||
<button class="btn btn-outline-secondary" type="button">
|
||
<i class="mdi mdi-view-list-outline"></i>
|
||
</button>
|
||
</div>
|
||
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="kind_txt" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="row mb-1 label-sm-right">
|
||
<label class="col-sm-2 col-lg-1 col-form-label">供應商名稱/聯絡人 *</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="u_name" MaxLength="20" runat="server" CssClass="form-control" placeholder="請輸入供應商名稱/聯絡人"></asp:TextBox>
|
||
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" ControlToValidate="u_name" runat="server"
|
||
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
|
||
</div>
|
||
<label class="col-sm-2 col-lg-1 col-form-label">電子信箱</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="email" MaxLength="200" runat="server" CssClass="form-control" placeholder="請輸入E-mail,如: taichung@gmail.com"></asp:TextBox>
|
||
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="email" Display="Dynamic" SetFocusOnError="true"
|
||
ErrorMessage="格式有誤!" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row mb-1 label-sm-right">
|
||
<label class="col-sm-2 col-lg-1 col-form-label">聯絡電話1</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="phone1" MaxLength="15" runat="server" CssClass="form-control" data-encrypt="Y" placeholder="請輸入聯絡電話,如: 04-2237-0000"></asp:TextBox>
|
||
<asp:RegularExpressionValidator ControlToValidate="phone1" ErrorMessage="格式有誤" ID="RegularExpressionValidator11" runat="server" ValidationExpression="^[+-]?\d+([+-]?\d*)*$" Display="Dynamic" SetFocusOnError="true" />
|
||
</div>
|
||
<label class="col-sm-2 col-lg-1 col-form-label">聯絡電話2</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="phone2" MaxLength="15" runat="server" CssClass="form-control" data-encrypt="Y" placeholder="請輸入聯絡電話,如: 0987-0000-0000"></asp:TextBox>
|
||
<asp:RegularExpressionValidator ControlToValidate="phone2" ErrorMessage="格式有誤" ID="RegularExpressionValidator2" runat="server" ValidationExpression="^[+-]?\d+([+-]?\d*)*$" Display="Dynamic" SetFocusOnError="true" />
|
||
</div>
|
||
<label class="col-sm-2 col-lg-1 col-form-label">傳真</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="fax" MaxLength="15" runat="server" CssClass="form-control" data-encrypt="Y" placeholder="請輸入聯絡傳真"></asp:TextBox>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row mb-1 label-sm-right">
|
||
<label class="col-sm-2 col-lg-1 col-form-label">地址</label>
|
||
<div class="col-sm-10 col-lg-7">
|
||
<asp:TextBox ID="address" MaxLength="100" runat="server" CssClass="form-control" placeholder="請輸入地址"></asp:TextBox>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row mb-1 label-sm-right">
|
||
<label class="col-sm-2 col-lg-1 col-form-label">型錄連結</label>
|
||
<div class="col-sm-10 col-lg-7">
|
||
<asp:TextBox ID="url" runat="server" CssClass="form-control" placeholder="請輸入型錄連結網址"></asp:TextBox>
|
||
</div>
|
||
</div>
|
||
<div class="row mb-1 label-sm-right">
|
||
<label class="col-sm-2 col-lg-1 col-form-label">附件檔</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:FileUpload ID="FileUpload1" runat="server" accept="image/png, image/jpeg, application/pdf" />
|
||
<asp:HyperLink ID="picLink" runat="server" CssClass="btn btn-sm btn-default " Visible="false" Target="_blank">查看</asp:HyperLink>
|
||
<asp:CheckBox ID="delPic" runat="server" Visible="false" Text="刪除附件" />
|
||
|
||
</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>
|
||
<div class="row mb-1">
|
||
<asp:Panel ID="timePanel1" runat="server" CssClass="col-12 text-right text-primary" Visible="false">建檔時間:<asp:Literal ID="reg_time" runat="server"></asp:Literal></asp:Panel>
|
||
<asp:Panel ID="timePanel2" runat="server" CssClass="col-12 text-right text-primary" Visible="false">最後修改時間:<asp:Literal ID="modify_time" runat="server"></asp:Literal></asp:Panel>
|
||
</div>
|
||
</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> |