839 lines
45 KiB
Plaintext
839 lines
45 KiB
Plaintext
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="news_reg.aspx.cs" Inherits="admin_stock_new_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>
|
||
let VueApp = new Vue({
|
||
el: '#app',
|
||
vuetify: new Vuetify(vuetify_options),
|
||
data() {
|
||
return {
|
||
this_id: '<%= Request["num"] %>',
|
||
options: {},
|
||
optionsDetail: { multiSort: false },
|
||
search_dialog: {
|
||
controls: {
|
||
search1: {
|
||
id: 'search1',
|
||
title: '倉庫',
|
||
text_prop: 'kind',
|
||
value_prop: 'num',
|
||
keys: [
|
||
{ id: 'kind', title: '倉庫名稱', value: '' },
|
||
],
|
||
api_url: HTTP_HOST + 'api/stock/GetKindList',
|
||
columns: [
|
||
{ id: 'kind', title: '倉庫名稱', value: '' },
|
||
],
|
||
selected: {},
|
||
select(t) {
|
||
console.log("select search1", t);
|
||
}
|
||
},
|
||
search2: {
|
||
id: 'search2',
|
||
title: '相關活動',
|
||
text_prop: 'subject',
|
||
value_prop: 'num',
|
||
keys: [
|
||
{ id: 'subject', title: '活動名稱', value: '' },
|
||
{ id: 'kindTxt', title: '活動分類' },
|
||
],
|
||
api_url: HTTP_HOST + 'api/activity/GetList',
|
||
columns: [
|
||
{ id: 'subject', title: '活動名稱' },
|
||
{ id: 'kindTxt', title: '活動分類' },
|
||
],
|
||
selected: {},
|
||
select(t) {
|
||
console.log("select search2", t);
|
||
//帶出明細
|
||
if (t != null) {
|
||
|
||
}
|
||
}
|
||
},
|
||
search3: {
|
||
id: 'search3',
|
||
title: '品項',
|
||
text_prop: 'subject',
|
||
value_prop: 'num',
|
||
keys: [
|
||
{ id: 'subject', title: '項目名稱', value: '' },
|
||
{ id: 'kindTxt', title: '項目分類' },
|
||
],
|
||
api_url: HTTP_HOST + 'api/activity/GetItemList',
|
||
columns: [
|
||
{ id: 'subject', title: '項目名稱' },
|
||
{ id: 'kindTxt', title: '項目分類' },
|
||
],
|
||
selected: {},
|
||
select(t) {
|
||
console.log("select search3", t);
|
||
getFinalStock();
|
||
}
|
||
},
|
||
search4: {
|
||
id: 'search4',
|
||
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 search4", t);
|
||
|
||
}
|
||
},
|
||
search5: {
|
||
id: 'search5',
|
||
title: '供應商',
|
||
text_prop: 'u_name',
|
||
value_prop: 'num',
|
||
keys: [
|
||
{ id: 's_number', title: '供應商編號', value: '' },
|
||
{ id: 'u_name', title: '供應商名稱/聯絡人', value: '' },
|
||
{ id: 'kindTxt', title: '分類', value: '' },
|
||
],
|
||
api_url: HTTP_HOST + 'api/supplier/GetList',
|
||
columns: [
|
||
{ id: 's_number', title: '供應商編號' },
|
||
{ id: 'u_name', title: '供應商名稱/聯絡人' },
|
||
{ id: 'kindTxt', title: '分類' },
|
||
],
|
||
selected: {},
|
||
select(t) {
|
||
console.log("select search5", t);
|
||
//帶出明細
|
||
if (t != null) {
|
||
|
||
}
|
||
}
|
||
}, search6: {
|
||
id: 'search6',
|
||
title: '庫存進出原因',
|
||
text_prop: 'kind',
|
||
value_prop: 'num',
|
||
keys: [
|
||
{ id: 'kind', title: '庫存進出原因', value: '' },
|
||
],
|
||
api_url: HTTP_HOST + 'api/stock/GetReasonList',
|
||
columns: [
|
||
{ id: 'kind', title: '庫存進出原因', value: '' },
|
||
],
|
||
selected: {},
|
||
select(t) {
|
||
console.log("select search6", t);
|
||
}
|
||
},
|
||
|
||
},
|
||
show: false,
|
||
current: {},
|
||
list: [],
|
||
count: 0,
|
||
page:1,
|
||
loading: false,
|
||
footer: {
|
||
showFirstLastPage: true,
|
||
disableItemsPerPage: true,
|
||
itemsPerPageAllText: '',
|
||
itemsPerPageText:'',
|
||
},
|
||
},
|
||
//檔案上傳
|
||
filePath: '<%= ResolveUrl( Model.stock.Dir) %>/',
|
||
filerules:[
|
||
value => !value || value.size < 2000000 || '檔案限制 2 MB 以內',
|
||
value => !!value || '檔案必填',
|
||
],
|
||
searchDetail: '',
|
||
headersDetail: [
|
||
{ text: '檔案名稱', value: 'pic1', sortable: false },
|
||
{ text: '', value: 'actions', sortable: false, width: "200px" },
|
||
],
|
||
desserts: [],
|
||
desserts_count: 0,
|
||
editedIndex: -1,
|
||
editedItem: {
|
||
id: 0,
|
||
num: 0,
|
||
stock_num: 0,
|
||
pic1: '',
|
||
pic1_name: '',
|
||
pic1push: [],
|
||
},
|
||
defaultItem: {
|
||
id: 0,
|
||
num: 0,
|
||
stock_num: 0,
|
||
pic1: '',
|
||
pic1_name: '',
|
||
pic1push: [],
|
||
},
|
||
snackbar: {
|
||
show: false,
|
||
text: "",
|
||
},
|
||
category: '<%= _cate %>',
|
||
actItem_num: '<%= _item %>',
|
||
stock_kind:'<%= _kind %>',
|
||
|
||
|
||
}
|
||
},
|
||
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,
|
||
},
|
||
optionsDetail: {
|
||
handler() {
|
||
this.initialize();
|
||
},
|
||
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 == 'search3') {
|
||
search['category'] = "3";//備品
|
||
}
|
||
if (this.search_dialog.current.id == 'search6') {
|
||
let _c = $("#<%= category.ClientID %>").val();
|
||
if (!!_c) {
|
||
search['category'] = _c;//進出類型
|
||
}
|
||
}
|
||
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;
|
||
},
|
||
initialize() {
|
||
if (this.this_id != '') {
|
||
const { sortBy, sortDesc, page, itemsPerPage } = this.optionsDetail
|
||
const params = {
|
||
sortBy: sortBy[0], sortDesc: sortDesc[0],
|
||
page: page, pageSize: itemsPerPage,
|
||
};
|
||
var searchItemDetail = {
|
||
stock_num: this.this_id,
|
||
}
|
||
axios
|
||
.post(HTTP_HOST + 'api/stock/GetStockFiles', searchItemDetail, { params: params })
|
||
.then(response => {
|
||
this.desserts = response.data.list
|
||
this.desserts_count = response.data.count
|
||
})
|
||
.catch(
|
||
error => console.log(error)
|
||
)
|
||
}
|
||
},
|
||
cancel() {
|
||
|
||
this.spliceNullData();
|
||
this.close();
|
||
},
|
||
spliceNullData() {
|
||
|
||
//if new data ,then splice it
|
||
if (this.editedItem.num == 0) {
|
||
|
||
for (var i = 0; i < this.desserts.map(x => x.id).length; i++) {
|
||
if (this.desserts[i].id == this.editedItem.id) {
|
||
this.desserts.splice(i, 1); break;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
close() {
|
||
setTimeout(() => {
|
||
this.editedItem = $.extend(true, {}, this.defaultItem);
|
||
this.editedIndex = -1;
|
||
}, 300)
|
||
},
|
||
addNew() {
|
||
|
||
this.spliceNullData();
|
||
|
||
//addObj.id = this.desserts.length + 1;
|
||
|
||
var keysArr = [];
|
||
for (var i = 0; i < this.desserts.map(x => x.id).length; i++) {
|
||
//console.log(this.desserts[i].id)
|
||
keysArr.push(parseInt(this.desserts[i].id));
|
||
}
|
||
var _c = Math.max.apply(null, keysArr);
|
||
|
||
const addObj = $.extend(true, {}, this.defaultItem);
|
||
addObj.id = (isFinite(_c) ? _c : 0) + 1;
|
||
this.desserts.unshift(addObj);
|
||
this.editItem(addObj);
|
||
},
|
||
editItem(item) {
|
||
this.editedIndex = this.desserts.indexOf(item);
|
||
this.editedItem = $.extend(true, {}, item);
|
||
}, save() {
|
||
if (this.editedIndex > -1) {
|
||
if (this.this_id != '') {
|
||
if (this.editedItem.pic1push != null) {
|
||
|
||
var reader = new FileReader();
|
||
|
||
reader.onload = function (e) {
|
||
|
||
//const imgObj = new Image()
|
||
//imgObj.src = e.target.result
|
||
//var img = document.getElementById("ttt");
|
||
//img.setAttribute("src", e.target.result)
|
||
|
||
if (e.total <= 2000000) {
|
||
|
||
//上傳檔案
|
||
const formData = new FormData();
|
||
formData.append('file-to-upload', VueApp.editedItem.pic1push)
|
||
//formData.append('Dir', "stock");
|
||
axios
|
||
.post(HTTP_HOST + 'api/stock/uploadFiles', formData, {
|
||
Headers: {
|
||
'Content-Type': 'multipart/form-data'
|
||
}
|
||
})
|
||
.then(response => {
|
||
|
||
if (response.data != "") {
|
||
|
||
//寫入
|
||
var stock_files = {
|
||
stock_num: VueApp.this_id,
|
||
pic1: response.data,
|
||
pic1_name: VueApp.editedItem.pic1push.name,
|
||
}
|
||
|
||
axios
|
||
.post(HTTP_HOST + 'api/stock/SaveFileData', stock_files)
|
||
.then(response => {
|
||
VueApp.editedItem.num = response.data;
|
||
VueApp.editedItem.pic1 = stock_files.pic1;
|
||
VueApp.editedItem.pic1_name = stock_files.pic1_name;
|
||
Object.assign(VueApp.desserts[VueApp.editedIndex], VueApp.editedItem)
|
||
VueApp.close()
|
||
})
|
||
.catch(
|
||
error => console.log(error)
|
||
|
||
)
|
||
}
|
||
|
||
|
||
})
|
||
.catch(
|
||
error => {
|
||
console.log(error)
|
||
VueApp.snackbar.text = "錯誤:" + error.response.data.message
|
||
VueApp.snackbar.show = true
|
||
}
|
||
)
|
||
} else {
|
||
VueApp.snackbar.text = "檔案限制 2 MB 以內";
|
||
VueApp.snackbar.show = true
|
||
}
|
||
|
||
}
|
||
|
||
reader.readAsDataURL(this.editedItem.pic1push);
|
||
|
||
}
|
||
else {
|
||
this.snackbar.text = "請選擇檔案";
|
||
this.snackbar.show = true
|
||
}
|
||
} else {
|
||
this.snackbar.text = "庫存資料錯誤";
|
||
this.snackbar.show = true
|
||
}
|
||
|
||
}
|
||
},
|
||
deleteItem(item) {
|
||
if (confirm('確定要刪除此筆資料嗎?')) {
|
||
const index = this.desserts.indexOf(item);
|
||
if (item.num > 0) {
|
||
if (index != -1) {
|
||
axios
|
||
.delete(HTTP_HOST + 'api/stock/DeleteFilesItem/' + item.num)
|
||
.then(response => {
|
||
console.log("del", item);
|
||
this.desserts.splice(index, 1)
|
||
this.desserts_count = this.desserts_count - 1;
|
||
})
|
||
.catch(error => console.log(error))
|
||
}
|
||
} else {
|
||
this.desserts.splice(index, 1)
|
||
}
|
||
}
|
||
},
|
||
isPhoto(name) {
|
||
const n = name.split('.')[1];
|
||
const type = new Array("jpg", "jpeg", "gif", "png", "bmp");
|
||
return type.indexOf(n) > -1 ? true : false
|
||
},
|
||
},
|
||
computed: {
|
||
},
|
||
})
|
||
|
||
function changeCate() {
|
||
$("#<%= reasonTxt.ClientID %>").val('');
|
||
$("#<%= reason.ClientID %>").val('');
|
||
}
|
||
function getFinalStock() {
|
||
const _num = '<%= Request["num"] %>';
|
||
if (_num == '') {
|
||
const _cate = $("#<%= category.ClientID %>").val();
|
||
const _kind = $("#<%= kind.ClientID %>").val();
|
||
const _item = $("#<%= actItem_num.ClientID %>").val();
|
||
const _qty = $("#<%= qty.ClientID %>").val();
|
||
//console.log(_cate, _kind, _item, _qty)
|
||
if (_kind != '' && _item != '') {
|
||
//上一筆的結餘量
|
||
$.ajax({
|
||
method: "POST",
|
||
url: "news_reg.aspx",
|
||
data: {
|
||
type: 'getFinalStock',
|
||
kind: _kind,
|
||
item: _item,
|
||
},
|
||
error: function (xhr, status, error) {
|
||
var errorMessage = xhr.status + ': ' + xhr.statusText
|
||
//alert('Error - ' + errorMessage);
|
||
console.log('Error - ' + errorMessage);
|
||
}
|
||
}).done(function (data) {
|
||
if (data.isOk) {
|
||
let _q = parseInt(data.fQty);
|
||
if ((!isNaN(_qty)) && _qty != '' && _cate != '') {
|
||
if (_cate == 1 || _cate == 4) {
|
||
_q += parseInt(_qty);
|
||
} else if (_cate == 2 || _cate == 3) {
|
||
_q -= parseInt(_qty);
|
||
}
|
||
}
|
||
if (_q < 0) { _q = _q+"(結餘量不可為負)" }
|
||
$('#L1').text(_q)
|
||
|
||
} else {
|
||
console.log(data.msg);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
}
|
||
</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-3" >
|
||
<div class="card-body">
|
||
※ 庫存管理原則 :<br>
|
||
1. 數量依庫別,品項計算<br>
|
||
2. 若跨庫提領/新增,要分別記錄
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card shadow-sm my-3" 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>
|
||
<button class="nav-link" id="sec2-tab2" data-bs-toggle="tab" data-bs-target="#sec2-page2"
|
||
type="button" role="tab" aria-controls="profile" aria-selected="false">
|
||
檔案上傳</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 class="form-text text-muted">除備註欄位,其餘欄位建立後不可修改</div>
|
||
</div>
|
||
|
||
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }">
|
||
<label class="col-sm-2 col-lg-1 col-form-label">單據日期 *</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="uptime" runat="server" CssClass="form-control " TextMode="Date" autocomplete="off" data-date-format="yyyy-mm-dd"></asp:TextBox>
|
||
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate="uptime" 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:DropDownList ID="category" CssClass="form-select" runat="server" data-int="Y" v-model="category" onchange="changeCate();getFinalStock();" >
|
||
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
|
||
</asp:DropDownList>
|
||
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="category"
|
||
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">
|
||
<div class="input-group mb-3" data-search-control="search6" @click=" search_show(search_dialog.controls.search6)" v-if="category !='' ">
|
||
<input class="form-control search-text" type="text" readonly
|
||
id="reasonTxt" runat="server" placeholder="異動原因" value="">
|
||
<asp:HiddenField ID="reason" runat="server" Value="" />
|
||
<button class="btn btn-outline-secondary" type="button">
|
||
<i class="mdi mdi-view-list-outline"></i>
|
||
</button>
|
||
</div>
|
||
<div class="input-group mb-3" v-else>
|
||
<div class='pt-2'>請先選擇進出類型</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }">
|
||
<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="RequiredFieldValidator7" ControlToValidate="kind_txt" 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">
|
||
<div class="input-group mb-3" data-search-control="search2" @click="search_show(search_dialog.controls.search2)">
|
||
<input class="form-control search-text" type="text" readonly
|
||
id="activity_num_txt" runat="server" placeholder="相關活動" value="">
|
||
<asp:HiddenField ID="activity_num" runat="server" Value="" />
|
||
<button class="btn btn-outline-secondary" type="button">
|
||
<i class="mdi mdi-view-list-outline"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }">
|
||
|
||
<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="search3" @click="search_show(search_dialog.controls.search3)">
|
||
<input class="form-control search-text" type="text" readonly
|
||
id="actItem_num_txt" runat="server" placeholder="品項" value="">
|
||
<asp:HiddenField ID="actItem_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="RequiredFieldValidator2" ControlToValidate="actItem_num_txt" 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="qty" MaxLength="7" runat="server" CssClass="form-control" placeholder="請輸入數量" onchange="getFinalStock();" ></asp:TextBox>
|
||
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" ControlToValidate="qty" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
|
||
<asp:RegularExpressionValidator ControlToValidate="qty" Display="Dynamic" SetFocusOnError="true" ErrorMessage="只能輸入數字" ValidationGroup="Required" ID="RegularExpressionValidator1" runat="server" ValidationExpression="^(\d+)?$" />
|
||
</div>
|
||
<label class="col-sm-2 col-lg-1 col-form-label">結餘量</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<div class='pt-2'>
|
||
<span id="L1"><asp:Literal ID="final_stock" runat="server"></asp:Literal></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<asp:PlaceHolder ID="Panel1" runat="server">
|
||
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }" v-show="category =='1' ">
|
||
<label class="col-sm-2 col-lg-1 col-form-label">進貨單價</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="price" MaxLength="7" runat="server" CssClass="form-control" placeholder="請輸入進貨單價"></asp:TextBox>
|
||
<asp:RegularExpressionValidator ControlToValidate="price" Display="Dynamic" SetFocusOnError="true" ErrorMessage="只能輸入數字" ValidationGroup="Required" ID="priceREV" runat="server" ValidationExpression="^(\d+)?$" />
|
||
</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="search5" @click="search_show(search_dialog.controls.search5)">
|
||
<input class="form-control search-text" type="text" readonly
|
||
id="supplierTxt" runat="server" placeholder="供應商" value="">
|
||
<asp:HiddenField ID="supplier" runat="server" Value="" />
|
||
<button class="btn btn-outline-secondary" type="button">
|
||
<i class="mdi mdi-view-list-outline"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</asp:PlaceHolder>
|
||
|
||
<div class="row mb-1 label-sm-right " :class="{readonly : this_id !='' }">
|
||
<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="search4" @click="search_show(search_dialog.controls.search4)">
|
||
<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-lg-1 col-form-label">外部借出人</label>
|
||
<div class="col-sm-10 col-lg-3">
|
||
<asp:TextBox ID="debtor" MaxLength="20" runat="server" CssClass="form-control" placeholder="請輸入外部借出人"></asp:TextBox>
|
||
</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>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="tab-pane fade giftItems label-sm-right" id="sec2-page2" role="tabpanel" aria-labelledby="sec2-tab2">
|
||
|
||
<v-card class="mx-auto mt-10" outlined v-if="this_id!=''">
|
||
<v-data-table
|
||
hide-default-header
|
||
:headers="headersDetail"
|
||
:items="desserts"
|
||
<%-- :search="searchDetail"--%>
|
||
:options.sync="optionsDetail" class="elevation-1" fixed-header height="550px"
|
||
<%-- :server-items-length="desserts_count"--%>
|
||
>
|
||
<v-divider inset></v-divider>
|
||
<template v-slot:top>
|
||
<v-toolbar flat color="white">
|
||
<div class="d-flex w-100">
|
||
|
||
<%--<v-text-field v-model="searchDetail" append-icon="mdi-magnify" label="查詢" dense outlined single-line hide-details></v-text-field>--%>
|
||
<v-btn
|
||
color="primary"
|
||
class="ml-2 white--text"
|
||
@click="addNew">
|
||
<v-icon dark>mdi-plus</v-icon>新增
|
||
</v-btn>
|
||
|
||
</div>
|
||
</v-toolbar>
|
||
<div class="form-text text-muted ml-5">檔案限制 2 MB 以內,僅接受jpg、png、pdf格式</div>
|
||
</template>
|
||
<template v-slot:item.pic1="{ item }" :cols="12" >
|
||
<div class="input-group mb-3" v-if="item.id === editedItem.id">
|
||
<v-file-input v-model="editedItem.pic1push"
|
||
required :rules="filerules" accept="image/png, image/jpeg, application/pdf"
|
||
show-size label="請選擇檔案"
|
||
truncate-length="25">
|
||
</v-file-input>
|
||
</div>
|
||
<template v-else>
|
||
<template v-if="isPhoto(item.pic1)">
|
||
<a :href="filePath+item.pic1" target="_blank" >
|
||
<v-img
|
||
max-height="138"
|
||
max-width="250"
|
||
:lazy-src="filePath+item.pic1"
|
||
:src="filePath+item.pic1"
|
||
:alt="item.pic1_name"
|
||
></v-img>
|
||
</a>
|
||
</template>
|
||
<template v-else>
|
||
<v-btn
|
||
outlined color="primary" class="ma-2" elevation="3" download
|
||
:href="filePath+item.pic1"
|
||
>
|
||
{{item.pic1_name}}
|
||
<v-icon right dark >mdi-cloud-download</v-icon>
|
||
</v-btn>
|
||
</template>
|
||
</template>
|
||
</template>
|
||
<template v-slot:item.actions="{ item }">
|
||
<div v-if="item.id === editedItem.id">
|
||
<v-icon color="red" class="mr-3" @click="cancel">
|
||
mdi-window-close
|
||
</v-icon>
|
||
<v-icon color="green" @click="save">
|
||
mdi-content-save
|
||
</v-icon>
|
||
|
||
</div>
|
||
<div v-else>
|
||
<v-icon color="red" @click="deleteItem(item)">
|
||
mdi-delete
|
||
</v-icon>
|
||
</div>
|
||
</template>
|
||
|
||
</v-data-table>
|
||
</v-card>
|
||
<div class="mx-auto" v-else >
|
||
<p class="lead">請先儲存庫存管理後再新增檔案上傳</p>
|
||
</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>
|
||
|