优化代码

This commit is contained in:
java110 2022-07-12 10:47:50 +08:00
parent b6778137b5
commit 73e6f6ef0d
3 changed files with 76 additions and 3 deletions

View File

@ -561,6 +561,32 @@ export function listAllocationStoreHisAuditOrders(_that,_data){
});
}
/**
* 查询我物品类型
* @param {Object} _that 上下文对象
* @param {Object} _data 请求报文
*/
export function listResourceStoreTypes(_that,_data){
return new Promise(function(reslove,reject){
_that.context.get({
url: url.listResourceStoreTypes,
data:_data,
success: function(res) {
reslove(res.data);
},
fail: function(e) {
wx.showToast({
title: "服务器异常了",
icon: 'none',
duration: 2000
})
}
})
});
}
/**
* 物品转赠提交
* @param {Object} _that 上下文对象

View File

@ -3,7 +3,7 @@
<view class="cu-bar bg-white search ">
<view class="search-form round">
<text class="cuIcon-search"></text>
<input type="text" placeholder="输入物品名" v-model="resName" confirm-type="search"></input>
<input type="text" placeholder="输入物品名" v-model="resName" confirm-type="search"></input>
</view>
<view class="search-form round">
<text class="cuIcon-search"></text>
@ -11,6 +11,14 @@
<view>{{storeHouses[storeHousesIndex].shName}}</view>
</picker>
</view>
</view>
<view class="cu-bar bg-white search ">
<view class="search-form round">
<text class="cuIcon-search"></text>
<picker :value="rssIndex" :range="resourceStoreTypes" :range-key="'name'" @change="rssChange">
<view>{{resourceStoreTypes[rssIndex].name}}</view>
</picker>
</view>
<view class="action">
<button class="cu-btn bg-gradual-green shadow-blur round" @tap="$preventClick(_searchStoreHouses)">搜索</button>
</view>
@ -36,6 +44,12 @@
固定资产{{item.isFixedName}}
</view>
</view>
<view class="text-gray text-sm flex">
<view class="text-cut">
规格{{item.rssName}}
</view>
</view>
</view>
</view>
</view>
@ -52,7 +66,8 @@
<script>
import {
queryResourceStoreList,
listStoreHouses
listStoreHouses,
listResourceStoreTypes
} from '../../api/resource/resource.js'
import {getCurrentCommunity} from '../../api/community/community.js'
//
@ -70,10 +85,16 @@
resourceList: [],
page: 1,
selectedResId: [],
rstId:'',
resName: '',
storeHouses: [{
shName: '请选择仓库'
}],
resourceStoreTypes:[{
rstId:'',
name: '请选择类型'
}],
rssIndex:0,
storeHousesIndex: 0,
shId: '',
}
@ -99,6 +120,7 @@
mounted() {
this._loadResourceList();
this._loadStoreHouses();
this._listResourceStoreTypes();
},
methods: {
@ -121,6 +143,19 @@
_that.storeHouses = _that.storeHouses.concat(res.data);
})
},
_listResourceStoreTypes: function(){
let _that = this;
let _objData = {
page: 1,
row: 100,
communityId: getCurrentCommunity().communityId,
};
listResourceStoreTypes(this,_objData)
.then(function(res){
_that.resourceStoreTypes = _that.resourceStoreTypes.concat(res.data);
})
},
storeHousesChange: function(e){
this.storeHousesIndex = e.target.value;
@ -132,6 +167,15 @@
this.shId = selected.shId;
},
rssChange: function(e){
this.rssIndex = e.target.value;
if (this.rssIndex == 0) {
this.rstId = '';
return;
}
let selected = this.resourceStoreTypes[this.rssIndex];
this.rstId = selected.rstId;
},
_searchStoreHouses: function() {
this.resourceList = [];
this.page = 1;
@ -148,6 +192,7 @@
shType: this.shType,
shId: this.shId,
resName: this.resName,
rstId: this.rstId,
isShow: true
};
queryResourceStoreList(this, _data)

View File

@ -155,5 +155,7 @@ export default {
listFeeDetail: baseUrl + "callComponent/propertyFee/listFeeDetail",
repairStop: baseUrl + "callComponent/ownerRepair.repairStop",
repairStart: baseUrl + "callComponent/ownerRepair.repairStart",
listInspectionItemTitle: baseUrl + "app/inspectionItemTitle.listInspectionItemTitle"
listInspectionItemTitle: baseUrl + "app/inspectionItemTitle.listInspectionItemTitle",
listResourceStoreTypes: baseUrl + "app/resourceStoreType.listResourceStoreTypes",
}