<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
|
<title>库存明细列表</title>
|
|
<script type="text/javascript">
|
var pageVue = null;
|
function loadJsCss(callback) {
|
var jscss_urls = [];
|
window.top.initJsCss(document, jscss_urls, callback);
|
};
|
|
function initVue() {
|
new ListVue({
|
el: "#vbody",
|
data: {
|
dataname: "wm_book_detail",
|
title: "库存明细列表",
|
orderby: "id",
|
pageAttr: {
|
heightType: "popuppage"
|
},
|
dataRequest: [
|
{
|
name: "org_product",
|
dataname: "md_org_product",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "parent_id='" + window.top.vue.userinfo.org.id + "'",
|
isnotoption: false, //true:不是选项
|
code:"product_category_name",//是下拉选项时设置
|
label:"product_category_name",//是下拉选项时设置
|
},
|
],
|
dataRequestObj: {},
|
|
default_tableData: [],
|
filterfieldClick: {},
|
tablefieldClick: {},
|
formfieldClick: {},
|
|
formData: {},
|
filterData: {},
|
rowkey: "id",
|
lazy: true,
|
selectedparentrow: {},
|
id_: 1,
|
iscustomer: false,
|
|
iseditlist: false,//多选
|
selectedrows: [],
|
},
|
|
created() {
|
if (window.top.vue.userinfo && window.top.vue.userinfo.org && window.top.vue.userinfo.org.is_account) {
|
this.iscustomer = true;
|
}
|
if (window.top.vue.userinfo && window.top.vue.userinfo.currentactor && window.top.vue.userinfo.currentactor.code == "Capacity-Connected") { // 如果是关联经销
|
var org_id_ = window.top.vue.userinfo.org.relationid;
|
var wm_warehouse_ = {
|
name: "wm_warehouse",
|
dataname: "wm_warehouse",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "org_id='" + org_id_ + "' and is_active='T' and type_code<>'Freeze'",
|
isnotoption: false, //true:不是选项
|
code:"code",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
}
|
this.dataRequest.push(wm_warehouse_);
|
}
|
else {
|
var wm_warehouse_ = {
|
name: "wm_warehouse",
|
dataname: "wm_warehouse",//授权产品分类
|
//url: "root/front/getOneDictionary",
|
//paramsobj: { code: "OrgType", },
|
filter: "org_id='" + window.top.vue.userinfo.org.id + "' and is_active='T' and type_code<>'Freeze'",
|
isnotoption: false, //true:不是选项
|
code:"code",//是下拉选项时设置
|
label:"name",//是下拉选项时设置
|
}
|
this.dataRequest.push(wm_warehouse_);
|
}
|
this.popupParames = clone(Root.popupParames);
|
Root.setPopupTitle(this.title);
|
// this.title = this.popupParames.title || this.popupParames.text
|
|
if (this.popupParames.data) {
|
this.formData = this.popupParames.data;
|
}
|
if (this.popupParames.filter) {
|
this.filterTxt = this.popupParames.filter
|
}
|
if (this.popupParames.delta) {
|
this.filterData = this.popupParames.delta;
|
}
|
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
this.isedit = true;
|
}
|
else if (this.popupParames.sceneCode == "addlist") {//新增多条
|
this.iseditlist = true;
|
}
|
}
|
},
|
|
mounted() {
|
var me = this;
|
//预加载数据
|
if (this.dataRequest && this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
//获取数据
|
me.initData();
|
|
// 以服务的方式调用的 Loading 需要异步关闭
|
// me.$nextTick(() => {
|
// hideLoading();
|
|
// //重新设置弹窗宽高
|
// me.$nextTick(function(){
|
// //let w_ = this.$refs.popup_body.offsetWidth + "px";
|
// let w_ = "1000px";
|
// let h_ = this.$refs.popup_body.offsetHeight + "px";
|
// Root.setPopupWH(w_, h_);
|
// })
|
// });
|
});
|
}
|
else {
|
//获取数据
|
me.initData();
|
|
// 以服务的方式调用的 Loading 需要异步关闭
|
// me.$nextTick(() => {
|
// hideLoading();
|
|
// //重新设置弹窗宽高
|
// me.$nextTick(function(){
|
// //let w_ = this.$refs.popup_body.offsetWidth + "px";
|
// let w_ = "1000px";
|
// let h_ = this.$refs.popup_body.offsetHeight + "px";
|
// Root.setPopupWH(w_, h_);
|
// })
|
// });
|
}
|
},
|
|
methods:{
|
//关闭弹窗
|
closeDialog() {
|
this.docloseDialog(true);
|
},
|
|
//关闭前调回调
|
saveAfter() {
|
var me = this;
|
me.docloseDialog();
|
if(this.popupParames.callback) {
|
let obj = {
|
row: clone(this.selectedrow)
|
}
|
this.popupParames.callback(obj, function() {
|
me.docloseDialog();
|
});
|
}
|
else {
|
me.docloseDialog();
|
}
|
},
|
//多选保存
|
saveListAfter() {
|
let me = this;
|
//获取购物车的数据
|
var rows = this.$refs.table1.getShoppingcart();
|
|
if (rows && rows.length) {
|
let obj = {
|
rowlist: clone(rows)
|
}
|
this.popupParames.callback(obj, function() {
|
me.docloseDialog();
|
});
|
}
|
else {
|
Root.message({
|
type: 'errer',
|
message: '请先选取库存明细'
|
});
|
}
|
},
|
initData() {
|
var me = this;
|
// this.getNCCAvailableStock();
|
this.onQuery(function(result, callback) {//查询后的回调,用于获取字段的
|
// 以服务的方式调用的 Loading 需要异步关闭
|
me.$nextTick(() => {
|
hideLoading();
|
|
//重新设置弹窗宽高
|
me.$nextTick(function(){
|
//let w_ = this.$refs.popup_body.offsetWidth + "px";
|
let w_ = "1000px";
|
let h_ = me.$refs.popup_body.offsetHeight + "px";
|
Root.setPopupWH(w_, h_);
|
})
|
});
|
if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
|
var metas = clone(result.meta[me.dataname].fields);
|
var filterFields_ = [];
|
var tableFields_ = [];
|
|
metas.map(f=>{
|
f.isshow = "T";
|
if(f.field == "org_code" || f.field == "org_name" || f.field == "price" || f.field == "amt"){
|
if(me.iscustomer){
|
f.isfilter = false;
|
f.isshow = "F";
|
}
|
}
|
else if(f.field == "warehouse_name" || f.field == "warehouse_code"){
|
if(me.formData.from_warehouse_name){
|
f.isfilter = false;
|
f.isshow = "F";
|
}
|
}
|
|
if (f.isfilter) {
|
if(f.field == "category_name") {//授权产品
|
f.options = me.dataRequestObj.org_product;
|
}
|
if (f.field == "warehouse_name") {//仓库名称
|
f.options = me.dataRequestObj.wm_warehouse
|
}
|
|
filterFields_.push(clone(f));
|
}
|
else {
|
var filter_f = clone(f);
|
filter_f.isshow = "F";
|
filterFields_.push(filter_f);
|
}
|
if (f.field == "cpid" || f.field == "is_active") {
|
|
}
|
else {
|
tableFields_.push(clone(f));
|
}
|
})
|
if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
|
me.filterFields = clone(filterFields_);
|
me.tableFields = clone(tableFields_);
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
}
|
|
me.onQueryAfter();
|
|
// var tableData_ = clone(me.tableData);
|
// tableData_.map(stock=>{
|
// //rowkey
|
// var key_ = stock.product_code + "_" + stock.batch_no
|
// if (stock.batch_sn) {//有序列号
|
// key_ = stock.product_code + "_" + stock.batch_no + "_" + stock.batch_sn
|
// }
|
// if (me.filterData[key_]) {
|
// // stock.cssname = "z_notrowclick";
|
// stock.h_classname = "z_notrowclick";
|
// }
|
|
// })
|
// me.tableData = clone(tableData_);
|
}
|
|
if (callback) {
|
callback();
|
}
|
});
|
},
|
|
onQueryAfter() {
|
var me = this;
|
var tableData_ = clone(me.tableData);
|
tableData_.map(stock=>{
|
//rowkey
|
var key_ = stock.product_code + "_" + stock.batch_no
|
if (stock.batch_sn) {//有序列号
|
key_ = stock.product_code + "_" + stock.batch_no + "_" + stock.batch_sn
|
}
|
if (me.filterData[key_]) {
|
// stock.cssname = "z_notrowclick";
|
stock.h_classname = "z_notrowclick";
|
}
|
|
})
|
me.tableData = clone(tableData_);
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//筛选字段事件设置
|
this.filterfieldClick = {
|
|
};
|
//表格字段事件设置
|
this.tablefieldClick = {
|
|
};
|
|
//表单字段事件设置
|
this.formfieldClick = {
|
|
};
|
},
|
|
|
loadClick(tree, treeNode, resolve) {
|
var me = this;
|
var body_ = [];
|
if (!this.selectedparentrow.id) {
|
Root.message({
|
type: 'warning',
|
message: '未获取到物料'
|
});
|
resolve([])
|
return
|
}
|
var param = {
|
dataname: "wm_sn",
|
filter: "book_detail_id='" + this.selectedparentrow.id + "'"
|
}
|
Server.call("root/data/getEntitySet", param, function(result) {
|
console.log(result);
|
var stockList = [];
|
if (result.data && result.data.entityset) {
|
var natpnumobj_ = {}
|
result.data.entityset.map(stock=>{
|
//rowkey
|
var row_ = clone(me.selectedparentrow);
|
var key_ = me.selectedparentrow.product_code +"_"+ me.selectedparentrow.batch_no +"_"+ stock.batch_sn;
|
row_.id = key_;
|
// row_.nonhandnum = 1;
|
row_.qty = 1;
|
row_.batch_sn = stock.batch_sn;
|
// row_.is_sn_active = null;
|
row_.h_classname = null;
|
row_.haschildren = null;
|
if (me.filterData[key_]) {
|
row_.h_classname = "z_notrowclick";
|
}
|
stockList.push(row_);
|
})
|
|
}
|
resolve(stockList)
|
}, function(errorncc) {
|
console.log("获取库存失败", errorncc);
|
Root.message({
|
type: 'warning',
|
message: '未获取到该库存的现存'
|
});
|
resolve([])
|
})
|
},
|
rowClick(obj) {
|
this.selectedrow = {};
|
this.selectedparentrow = {};
|
// if (obj.row.is_sn_active) {//有序列号
|
// this.$refs.table1.setCurrentRow()
|
// this.selectedparentrow = obj.row;
|
// if (obj.event.currentTarget.firstElementChild.firstElementChild.firstElementChild.tagName == 'DIV') {
|
// obj.event.currentTarget.firstElementChild.firstElementChild.firstElementChild.click();
|
// } else {
|
// obj.event.currentTarget.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.click();
|
// }
|
// return;
|
// }
|
if (this.filterData[obj.row.vsncode]) {
|
this.$refs.table1.setCurrentRow()
|
return;
|
}
|
if (this.filterData[obj.row.materialcode]) {
|
this.$refs.table1.setCurrentRow()
|
return;
|
}
|
|
this.selectedrow = obj.row;
|
|
if (this.onRowClick) {
|
this.onRowClick.call(this, obj);
|
return;
|
}
|
},
|
|
rowDblclick(obj) {
|
// if (obj.row.is_sn_active) {//有序列号
|
// this.$refs.table1.setCurrentRow()
|
// return;
|
// }
|
|
if (this.iseditlist) {
|
// this.saveListAfter();
|
}
|
else {
|
if (this.filterData[obj.row.vsncode]) {
|
this.$refs.table1.setCurrentRow()
|
return;
|
}
|
|
if (this.filterData[obj.row.materialcode]) {
|
this.$refs.table1.setCurrentRow()
|
return;
|
}
|
|
this.selectedrow = obj.row;
|
if (this.isedit) {
|
this.saveAfter();
|
}
|
}
|
},
|
|
selectionChange(obj){
|
var me = this;
|
me.selectedrows = obj;
|
},
|
saveShoppingcart(list) {
|
var me = this;
|
me.selectedrows = list;
|
},
|
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
.el-table__body tr.z_notrowclick>td{
|
background-color: #aaa !important;
|
}
|
.el-table__body tr.z_notrowclick>td:hover {
|
cursor: not-allowed;
|
}
|
</style>
|
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="padding: 0 20px;">
|
<!-- 标题 -->
|
<div class="popup_el-dialog__header">
|
<div class="dialog-title">
|
<i class="iconfont icon-customermanagement"></i>
|
<span>{{title}}</span>
|
</div>
|
</div>
|
<!-- 主体 -->
|
<div class="topbar-line">
|
<div class="query-bar">
|
<h-form-filter ref="form1"
|
:form-attr="filterAttr"
|
:table-fields="filterFields"
|
:form-data="filterObj"
|
:table-field-click="filterfieldClick"
|
|
v-on:on-query="onQuery"
|
v-on:on-init-query="onInitFilter"
|
>
|
</h-form-filter>
|
</div>
|
</div>
|
|
<div class="h_dialog__body">
|
<h-table
|
v-if="isRefresh && tableFields && tableFields.length"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight"
|
:table-field-click="tablefieldClick"
|
:is-highlight-row="isedit"
|
:is-pagination="true"
|
:rowkey="rowkey"
|
:lazy="lazy"
|
|
v-on:get-data="getData"
|
v-on:row-click="rowClick"
|
v-on:load-click="loadClick"
|
v-on:row-dblclick="rowDblclick"
|
|
:select-table-data="selectedrows"
|
:is-selection="iseditlist"
|
:isshow-shoppingcart="iseditlist"
|
v-on:selection-change="selectionChange"
|
v-on:save-shoppingcart="saveShoppingcart"
|
>
|
</h-table>
|
<!-- v-on:get-data="getData" -->
|
</div>
|
|
<!-- 底部工具栏 -->
|
<div class="el-dialog__footer">
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button size="small" v-if="isedit" :disabled="!(selectedrow && selectedrow.id)" type="primary" @click="saveAfter">确 定</el-button>
|
<el-button size="small" v-else-if="iseditlist" type="primary" @click="saveListAfter">确 定</el-button>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
|
</body>
|
</html>
|