优化代码

This commit is contained in:
java110 2022-12-15 19:00:47 +08:00
parent f126c160f9
commit 433186b1d9
2 changed files with 77 additions and 81 deletions

View File

@ -11,7 +11,7 @@
<div class="row">
<div class="col-sm-3">
<div class="form-group">
<select class="custom-select" v-model="assetInventoryManageInfo.conditions.shId">
<select class="custom-select" v-model="assetInventoryManageInfo.conditions.shId">
<option selected disabled value="">请选择仓库</option>
<option v-for="(item,index) in assetInventoryManageInfo.storehouses" :key="index"
v-bind:value="item.shId">
@ -22,8 +22,7 @@
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请输入盘点人"
v-model="assetInventoryManageInfo.conditions.staffName" class=" form-control">
<input type="text" placeholder="请输入盘点人" v-model="assetInventoryManageInfo.conditions.staffName" class=" form-control">
</div>
</div>
<div class="col-sm-3">
@ -35,12 +34,10 @@
</select>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_queryAssetInventoryMethod()">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryAssetInventoryMethod()">
<i class="fa fa-search"></i> 查询
</button>
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_resetAssetInventoryMethod()">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_resetAssetInventoryMethod()">
<i class="fa fa-repeat"></i> 重置
</button>
</div>
@ -63,61 +60,56 @@
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center">盘点单号</th>
<th class="text-center">盘点名称</th>
<th class="text-center">盘点时间</th>
<th class="text-center">盘点仓库</th>
<th class="text-center">盘点人</th>
<th class="text-center">状态</th>
<th class="text-center">创建时间</th>
<th class="text-center">操作</th>
</tr>
<tr>
<th class="text-center">盘点单号</th>
<th class="text-center">盘点名称</th>
<th class="text-center">盘点时间</th>
<th class="text-center">盘点仓库</th>
<th class="text-center">盘点人</th>
<th class="text-center">状态</th>
<th class="text-center">创建时间</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="assetInventory in assetInventoryManageInfo.assetInventorys">
<td class="text-center">{{assetInventory.aiId}}</td>
<td class="text-center">{{assetInventory.name}}</td>
<td class="text-center">{{assetInventory.invTime}}</td>
<td class="text-center">{{assetInventory.shName}}</td>
<td class="text-center">{{assetInventory.staffName}}</td>
<td class="text-center">{{assetInventory.stateName}}</td>
<td class="text-center">{{assetInventory.createTime}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openInStockAssetInventoryModel(assetInventory)">详情
<tr v-for="assetInventory in assetInventoryManageInfo.assetInventorys">
<td class="text-center">{{assetInventory.aiId}}</td>
<td class="text-center">{{assetInventory.name}}</td>
<td class="text-center">{{assetInventory.invTime}}</td>
<td class="text-center">{{assetInventory.shName}}</td>
<td class="text-center">{{assetInventory.staffName}}</td>
<td class="text-center">{{assetInventory.stateName}}</td>
<td class="text-center">{{assetInventory.createTime}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openInStockAssetInventoryModel(assetInventory)">详情
</button>
</div>
<div class="btn-group" v-if="assetInventory.state == '1000'">
<button class="btn-white btn btn-xs"
v-on:click="_openEditAssetInventoryModel(assetInventory)">编辑
</div>
<div class="btn-group" v-if="assetInventory.state == '1000' && assetInventory.staffId == assetInventoryManageInfo.curStaffId">
<button class="btn-white btn btn-xs" v-on:click="_openEditAssetInventoryModel(assetInventory)">编辑
</button>
</div>
<div class="btn-group" v-if="assetInventory.state == '2000'">
<button class="btn-white btn btn-xs"
v-on:click="_openCancelAssetInventoryModel(assetInventory)">取消申请
</div>
<div class="btn-group" v-if="assetInventory.state == '2000' && assetInventory.staffId == assetInventoryManageInfo.curStaffId">
<button class="btn-white btn btn-xs" v-on:click="_openCancelAssetInventoryModel(assetInventory)">取消申请
</button>
</div>
<div class="btn-group" v-if="assetInventory.state == '2000'">
<button class="btn-white btn btn-xs"
v-on:click="_openAuditAssetInventoryModel(assetInventory)">审核
</div>
<div class="btn-group" v-if="assetInventory.state == '2000'">
<button class="btn-white btn btn-xs" v-on:click="_openAuditAssetInventoryModel(assetInventory)">审核
</button>
</div>
<div class="btn-group" v-if="assetInventory.state != '4000'">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteAssetInventoryModel(assetInventory)">删除
</div>
<div class="btn-group" v-if="assetInventory.state != '4000' && assetInventory.staffId == assetInventoryManageInfo.curStaffId">
<button class="btn-white btn btn-xs" v-on:click="_openDeleteAssetInventoryModel(assetInventory)">删除
</button>
</div>
</td>
</tr>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="12">
<ul class="pagination float-right"></ul>
</td>
</tr>
<tr>
<td colspan="12">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->

View File

@ -1,7 +1,7 @@
/**
入驻小区
**/
(function (vc) {
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
@ -19,26 +19,28 @@
staffName: '',
state: '',
communityId: vc.getCurrentCommunity().communityId
}
},
curStaffId: ''
}
},
_initMethod: function () {
_initMethod: function() {
$that.assetInventoryManageInfo.curStaffId = vc.getData('/nav/getUserInfo').userId;
$that._listShopHouses();
vc.component._listAssetInventorys(DEFAULT_PAGE, DEFAULT_ROWS);
vc.getDict('asset_inventory', "state", function (_data) {
vc.getDict('asset_inventory', "state", function(_data) {
vc.component.assetInventoryManageInfo.states = _data;
});
},
_initEvent: function () {
vc.on('assetInventoryManage', 'listAssetInventory', function (_param) {
_initEvent: function() {
vc.on('assetInventoryManage', 'listAssetInventory', function(_param) {
vc.component._listAssetInventorys(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
vc.on('pagination', 'page_event', function(_currentPage) {
vc.component._listAssetInventorys(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listAssetInventorys: function (_page, _rows) {
_listAssetInventorys: function(_page, _rows) {
vc.component.assetInventoryManageInfo.conditions.page = _page;
vc.component.assetInventoryManageInfo.conditions.row = _rows;
var param = {
@ -48,7 +50,7 @@
//发送get请求
vc.http.apiGet('assetInventory.listAssetInventory',
param,
function (json, res) {
function(json, res) {
var _assetInventoryManageInfo = JSON.parse(json);
vc.component.assetInventoryManageInfo.total = _assetInventoryManageInfo.total;
vc.component.assetInventoryManageInfo.records = _assetInventoryManageInfo.records;
@ -58,76 +60,77 @@
dataCount: vc.component.assetInventoryManageInfo.total,
currentPage: _page
});
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddAssetInventoryModal: function () {
vc.jumpToPage("/#/pages/property/assetInventoryIn" );
_openAddAssetInventoryModal: function() {
vc.jumpToPage("/#/pages/property/assetInventoryIn");
},
_openEditAssetInventoryModel: function (_assetInventory) {
_openEditAssetInventoryModel: function(_assetInventory) {
vc.jumpToPage('/#/pages/property/assetInventoryEdit?aiId=' + _assetInventory.aiId);
},
_openAuditAssetInventoryModel: function (_assetInventory) {
_openAuditAssetInventoryModel: function(_assetInventory) {
vc.jumpToPage('/#/pages/property/assetInventoryAudit?aiId=' + _assetInventory.aiId);
},
_openInStockAssetInventoryModel: function (_assetInventory) {
_openInStockAssetInventoryModel: function(_assetInventory) {
vc.jumpToPage('/#/pages/property/assetInventoryInStock?aiId=' + _assetInventory.aiId);
},
_openDeleteAssetInventoryModel: function (_assetInventory) {
_openDeleteAssetInventoryModel: function(_assetInventory) {
vc.emit('deleteAssetInventory', 'openDeleteAssetInventoryModal', _assetInventory);
},
_openCancelAssetInventoryModel: function (_assetInventory) {
_openCancelAssetInventoryModel: function(_assetInventory) {
vc.emit('cancelAssetInventory', 'openCancelAssetInventoryModal', _assetInventory);
},
//查询
_queryAssetInventoryMethod: function () {
_queryAssetInventoryMethod: function() {
vc.component._listAssetInventorys(DEFAULT_PAGE, DEFAULT_ROWS);
},
//重置
_resetAssetInventoryMethod: function () {
_resetAssetInventoryMethod: function() {
vc.component.assetInventoryManageInfo.conditions.shId = "";
vc.component.assetInventoryManageInfo.conditions.staffName = "";
vc.component.assetInventoryManageInfo.conditions.state = "";
vc.component._listAssetInventorys(DEFAULT_PAGE, DEFAULT_ROWS);
},
_getInvLoss: function (_assetInventory) {
_getInvLoss: function(_assetInventory) {
let _invLoss = parseInt(_assetInventory.quantity) - parseInt(_assetInventory.invQuantity);
if (_invLoss > 0) {
return _invLoss;
}
return 0;
},
_getInvProfit: function (_assetInventory) {
_getInvProfit: function(_assetInventory) {
let _invProfit = parseInt(_assetInventory.invQuantity) - parseInt(_assetInventory.quantity);
if (_invProfit > 0) {
return _invProfit;
}
return 0;
},
_getInvLossMoney: function (_assetInventory) {
_getInvLossMoney: function(_assetInventory) {
let _invLoss = parseInt(_assetInventory.quantityMoney) - parseInt(_assetInventory.invQuantityMoney);
if (_invLoss > 0) {
return _invLoss;
}
return 0;
},
_getInvProfitMoney: function (_assetInventory) {
_getInvProfitMoney: function(_assetInventory) {
let _invProfit = parseInt(_assetInventory.invQuantityMoney) - parseInt(_assetInventory.quantityMoney);
if (_invProfit > 0) {
return _invProfit;
}
return 0;
},
_moreCondition: function () {
_moreCondition: function() {
if (vc.component.assetInventoryManageInfo.moreCondition) {
vc.component.assetInventoryManageInfo.moreCondition = false;
} else {
vc.component.assetInventoryManageInfo.moreCondition = true;
}
},
_listShopHouses: function (_page, _rows) {
_listShopHouses: function(_page, _rows) {
var param = {
params: {
page: 1,
@ -138,14 +141,15 @@
//发送get请求
vc.http.apiGet('resourceStore.listStorehouses',
param,
function (json, res) {
function(json, res) {
var _shopHouseManageInfo = JSON.parse(json);
vc.component.assetInventoryManageInfo.storehouses = _shopHouseManageInfo.data;
}, function (errInfo, error) {
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
}
}
});
})(window.vc);
})(window.vc);