Files
OMS/app/inventorydepth/view/shop/show_relation.html
2026-01-04 19:08:31 +08:00

338 lines
11 KiB
HTML

<!--
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div id="allocation-error" class="error" style="display:none;"></div>
<form method="POST"
action="index.php?app=inventorydepth&ctl=shop&act=saveBranchRelation" id='regulation-apply-form'>
<input type="hidden" name="shop_bn" value="<{$shop_bn}>" />
<input type="hidden" name="shop_id" value="<{$shop_id}>" />
<div id="allocation-edit-form">
<div id="allocation-header" class="allocation-info">
<div id="allocation-stores">
<{include file="shop/shop_relation.html"}>
</div>
</div>
</div>
</form>
<div class="table-action" style="margin:0 auto;">
<{button type="button" label=$___b2c="保存"|t:'b2c' id='regulation-apply-submit'}>
<{button class="btn-secondary " label=$___b2c="取消"|t:'b2c' isclosedialogbtn="true" }>
</div>
<script type="text/javascript">
var id = "<{$id}>";
var shop_bn = "<{$shop_bn}>";
void function(){
$('regulation-apply-submit').removeEvent('click').addEvent('click',function(e){
e.stop();
var branch_id = document.getElementsByName('branch_id')[0].value
// if(branch_id == ''){
// return MessageBox.error("请先选择店铺代码");
// }
var form = $('regulation-apply-form');
W.page(form.action,{
data:form,
onComplete:function(resp){
resp = JSON.decode(resp);
if (resp.error == 'error') {
MessageBox.error(resp.msg);
return ;
} else if (resp.success) {
var dialog = $('regulation-apply-form').getParent('.dialog').retrieve('instance');
dialog.close.delay(200, dialog);
finderGroup['<{$env.get.finder_id}>'].refresh.delay(100,finderGroup['<{$env.get.finder_id}>']);
}
}
});
});
}();
var addDefaulHtml = '<option value="">请选择</option>'
function changeCompany (val) {
if (!val) {
document.getElementById('shop_type').innerHTML = addDefaulHtml
return
}
// 加载店铺类型
loadStype(val);
}
// 加载店铺类型
function loadStype(company_id){
W.page('index.php?app=dacenter&ctl=admin_setting&act=get_stype',{
method:'GET',
data:{
p:[company_id]
},
onRequest: function(resp){
$('shop_type').setHTML('<option value="">请选择</option>');
},
onComplete:function(resp){
resp = JSON.decode(resp)
resp.attrs.each(function(item){
$('shop_type').adopt(new Element('option',{
value: item.attr_code,
text: item.attr_value,
// selected: item.attr_code
}))
})
}
});
}
// 加载订单类型
function loadPoType(channel_code){
W.page('index.php?app=dacenter&ctl=admin_setting&act=get_po_type',{
method:'GET',
data:{
p:[channel_code]
},
onRequest: function(resp){
$('po_type').setHTML('<option value="">请选择</option>');
},
onComplete:function(resp){
resp = JSON.decode(resp)
resp.po_type.each(function(item){
$('po_type').adopt(new Element('option',{
value: item.po_type,
text: item.po_type,
// selected: item.attr_code
}))
})
}
});
}
(function () {
changeShopCode(shop_bn);
})();
// $('goods-filter-btn').addEvent('click',function(e){
// var filter_list = $('filter-list').toQueryString();
// changeShopCode(id,filter_list,'false');
// });
function changeShopCode(shop_bn,search='',status='true') {
var d = $('store-transfer-wrap');
var str_id = '&f[shop_bn]='+shop_bn;
var select = search == '' ? (str_id) : (str_id+'&'+search);
W.page('index.php?app=inventorydepth&ctl=shop&act=getBranchRelation', {
data:select,
onComplete: function (resp) {
resp = JSON.decode(resp)
$E('#store-transfer-wrap .left-panel .transfer-panel__body').setHTML('');
if (resp.success) {
var tpl = '<div class="colum1"><input type="checkbox" value="{branch_id}" /></div><div class="colum22">{branch_bn}</div><div class="colum3">{name}</div>';
resp.data.each(function (item) {
var h = tpl.substitute(item);
var i = new Element('div', {
html: h,
class: 'transfer-panel__item'
})
$E('#store-transfer-wrap .left-panel .transfer-panel__body').adopt(i);
// $E('input', i).addEvent('change', changeLeftStoreStatus);
});
if(status == 'true'){
var str_bound = '';
resp.bound.each(function (item) {
var doted = str_bound==''?'':',';
str_bound = str_bound+doted+item.branch_id;
var h = tpl.substitute(item);
var i = new Element('div', {
html: h,
class: 'transfer-panel__item'
})
$E('#store-transfer-wrap .right-panel .transfer-panel__body').adopt(i);
// $E('input', i).addEvent('change', changeRightStoreStatus);
});
document.getElementById('branch_id').value = str_bound;
var rightNodes = d.getElementsByClassName('right-panel')[0].getElementsByClassName('transfer-panel__item')
for (var i=0; i<rightNodes.length; i++) {
rightNodes[i].getElementsByTagName('input')[0].addEventListener('change', changeRightStoreStatus)
}
}
var leftNodes = d.getElementsByClassName('left-panel')[0].getElementsByClassName('transfer-panel__item')
for (var i=0; i<leftNodes.length; i++) {
leftNodes[i].getElementsByTagName('input')[0].addEventListener('change', changeLeftStoreStatus)
}
}
},
onRequest: function () {
d.getElements('.transfer-panel__body').empty();
// $('branch_id').value = '';
}
});
}
function changeLeftStoreStatus() {
var d = $('store-transfer-wrap');
var nodes = this.getParent().getParent().getParent().children
var checkedLen = 0
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getElementsByTagName('input')[0].checked) {
checkedLen++
}
}
if (checkedLen > 0) {
d.getElementById('left-all').checked = checkedLen == nodes.length
d.getElementsByClassName('transfer-buttons')[0].children[1].classList.add('active');
} else {
d.getElementById('left-all').checked = false
d.getElementsByClassName('transfer-buttons')[0].children[1].classList.remove('active');
}
}
function changeRightStoreStatus () {
var d = $('store-transfer-wrap');
var nodes = this.getParent().getParent().getParent().children
var checkedLen = 0
for (var i=0; i<nodes.length; i++) {
if (nodes[i].getElementsByTagName('input')[0].checked) {
checkedLen++
}
}
if (checkedLen > 0) {
d.getElementById('right-all').checked = checkedLen == nodes.length
d.getElementsByClassName('transfer-buttons')[0].children[0].classList.add('active');
} else {
d.getElementById('right-all').checked = false
d.getElementsByClassName('transfer-buttons')[0].children[0].classList.remove('active');
}
}
</script>
<style type="text/css">
.gridlist thead th {
font-size: 14px;
}
.gridlist tbody td {
font-size: 14px;
}
.allocation-info {
padding-left: 15px;
box-sizing: border-box;
}
.allocation-info .allocation-info__row .allocation-search__col {
display: inline-block;
width: 260px;
font-size: 0;
vertical-align: top;
margin-right: 20px;
height: 34px;
line-height: 34px;
}
.allocation-info .allocation-info__row .allocation-search__col:last-child {
width: 330px;
}
.allocation-info .allocation-info__row .allocation-search__col > div {
display: inline-block;
vertical-align: middle;
font-size: 14px;
}
.allocation-info .allocation-info__row .allocation-search__col .search-label {
width: 90px;
text-align: right;
}
.allocation-info .allocation-info__row .allocation-search__col .search-value {
width: calc(100% - 90px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
}
.allocation-info .allocation-info__row .allocation-search__col .search-value .cal {
margin-top: -3px;
}
.filter-list {
/*border-top: 1px solid #ddd;*/
padding-top: 20px;
margin: 5px 15px 0;
box-sizing: border-box;
}
.filter-list .filter-col {
display: inline-block;
vertical-align: top;
margin-right: 20px;
margin-bottom: 20px;
height: 34px;
}
.filter-list .filter-col:last-child {
margin-right: 0;
}
.filter-list .filter-col > div {
display: inline-block;
vertical-align: middle;
font-size: 14px;
}
.filter-list .filter-col input {
height: 34px;
}
.allocation-table {
width: 1100px;
margin-left: 15px;
}
/* .allocation-table thead, .allocation-table tbody tr {
width: 100%;
display: table;
table-layout: fixed;
}
.allocation-table tbody {
height: 300px;
overflow-y: scroll;
display: block;
} */
.allocation-table tr th, .allocation-table tr td {
padding: 7px 10px;
box-sizing: border-box;
font-size: 12px;
}
.allocation-table tr th {
font-weight: bold;
}
.w-90 {
width: 80px !important;
}
.w-140 {
width: 140px !important;
}
</style>