소스 검색

优化

master
yujk 3 년 전
부모
커밋
8e649f66bf
3개의 변경된 파일48개의 추가작업 그리고 38개의 파일을 삭제
  1. +37
    -27
      pages/fixedAssets/add/add.js
  2. +1
    -1
      pages/fixedAssets/add/add.wxml
  3. +10
    -10
      pages/fixedAssets/fixedAssets.js

+ 37
- 27
pages/fixedAssets/add/add.js 파일 보기

@@ -167,43 +167,44 @@ Page({
return mydate
},
goSubmit:function(){
if(this.data.form.code==''||this.data.form.code==null){ //合同编码
if(this.data.form.code===''||this.data.form.code==null){ //合同编码
UTIL.showToastNoneIcon('请填写资产编码!');
return false;
}else if(this.data.form.name==''||this.data.form.name==null){ //合同名称
}else if(this.data.form.name===''||this.data.form.name==null){ //合同名称
UTIL.showToastNoneIcon('请输入资产名称!');
return false;
}else if(this.data.form.assetType==''||this.data.form.assetType==null){ //甲方
}else if(this.data.form.assetType===''||this.data.form.assetType==null){ //甲方
UTIL.showToastNoneIcon('资产类别不能为空!');
return false;
}else if(this.data.form.operationType==''||this.data.form.operationType==null){ //乙方
}else if(this.data.form.operationType===''||this.data.form.operationType==null){ //乙方
UTIL.showToastNoneIcon('经营属性不能为空!');
return false;
}else if(this.data.form.addType == ''||this.data.form.addType==null){//收付款类型
}else if(this.data.form.addType === ''||this.data.form.addType==null){//收付款类型
UTIL.showToastNoneIcon('增加方式能为空!');
return false;
}else if(this.data.form.buildTime == ''||this.data.form.buildTime==null){//合同来源
}else if(this.data.form.buildTime === ''||this.data.form.buildTime==null){//合同来源
UTIL.showToastNoneIcon('构建时间不能为空!');
return false;
}else if(this.data.form.useType == ''||this.data.form.useType==null){//合同金额
}else if(this.data.form.useType === ''||this.data.form.useType==null){//合同金额
UTIL.showToastNoneIcon('使用情况不能为空!');
return false;
}else if(this.data.form.assetStatus == ''||this.data.form.assetStatus==null){//签订日期
}else if(this.data.form.assetStatus === ''||this.data.form.assetStatus==null){//签订日期
UTIL.showToastNoneIcon('资产状态不能为空!');
return false;
}else if(this.data.form.quantity == ''||this.data.form.quantity==null){//开始日期
}else if(this.data.form.quantity === ''||this.data.form.quantity==null){//开始日期
UTIL.showToastNoneIcon('请输入数量、面积!');
return false;
}else if(this.data.form.unit == ''||this.data.form.unit==null){//结束日期
}else if(this.data.form.unit === ''||this.data.form.unit==null){//结束日期
UTIL.showToastNoneIcon('计量单位不能为空!');
return false;
}else if(this.data.form.originalValue == ''||this.data.form.originalValue==null){//单价
}else if(this.data.form.originalValue === ''||this.data.form.originalValue==null){//单价
UTIL.showToastNoneIcon('原值不能为空!');
return false;
}else if(this.data.form.depreciationType == ''||this.data.form.depreciationType==null){//已结款
}else if(this.data.form.depreciationType === ''||this.data.form.depreciationType==null){//已结款
UTIL.showToastNoneIcon('折旧方式不能为空!');
return false;
}else if(this.data.status == '0'){
let that = this
this.setData({'status':'1'})
if(this.data.form.id!=null&&this.data.form.id!=""){
let data = this.data.form;
@@ -219,7 +220,7 @@ Page({
},2000)
}else{
UTIL.showToastNoneIcon('修改失败');
this.setData({'status':'0'})
that.setData({'status':'0'})
}
},
fail: function (response) {
@@ -228,10 +229,10 @@ Page({
} else {
showToastNoneIcon(API.MSG_FAIL_HTTP);
}
this.setData({'status':0})
that.setData({'status':0})
},
complete: function (response) {
this.setData({'status':0})
that.setData({'status':0})
wx.hideNavigationBarLoading();
}
})
@@ -249,7 +250,7 @@ Page({
},2000)
}else{
UTIL.showToastNoneIcon(res.msg);
this.setData({'status':'0'})
that.setData({'status':'0'})
}
},
fail: function (response) {
@@ -258,10 +259,10 @@ Page({
} else {
showToastNoneIcon(API.MSG_FAIL_HTTP);
}
this.setData({'status':0})
that.setData({'status':0})
},
complete: function (response) {
this.setData({'status':0})
that.setData({'status':0})
wx.hideNavigationBarLoading();
}
})
@@ -274,31 +275,40 @@ Page({
})
if(e.currentTarget.dataset.name == 'form.originalValue' ){
this.setData({
'form.netValue' : e.detail.value,
'form.netSalvage' : this.data.form.residualsRate*e.detail.value/100,
'form.perYearDepreciationValue' : (e.detail.value-(this.data.form.residualsRate*e.detail.value/100))/this.data.form.expectedYears.toFixed(2)
'form.perYearDepreciationValue' : ((e.detail.value-(this.data.form.residualsRate*e.detail.value/100))/this.data.form.expectedYears).toFixed(2)
})
if(e.currentTarget.dataset.name == 'form.residualsRate' ){
}
if(e.currentTarget.dataset.name == 'form.residualsRate' &&e.detail.value<=100){
this.setData({
'form.netSalvage' : (this.data.form.originalValue*e.detail.value/100)<this.data.form.originalValue?(this.data.form.originalValue*e.detail.value/100).toFixed(2):this.data.form.originalValue,
})
this.setData({
'form.netSalvage' : this.data.form.originalValue*e.detail.value,
'form.perYearDepreciationValue' : ((this.data.form.originalValue-this.data.form.netSalvage)/this.data.form.expectedYears).toFixed(2),
})
}
if(e.currentTarget.dataset.name == 'form.residualsRate' &&e.detail.value>100){
this.setData({
'form.residualsRate' : 5,
})
}
if(e.currentTarget.dataset.name == 'form.netSalvage' ){
this.setData({
'form.perYearDepreciationValue' : (this.data.form.originalValue-e.detail.value)/this.data.form.expectedYears.toFixed(2)
'form.perYearDepreciationValue' : ((this.data.form.originalValue-e.detail.value)/this.data.form.expectedYears).toFixed(2)
})
}
if(e.currentTarget.dataset.name == 'form.expectedYears' ){
this.setData({
'form.perYearDepreciationValue' : (this.data.form.originalValue-this.data.form.netSalvage)/e.detail.value.toFixed(2)
'form.perYearDepreciationValue' : ((this.data.form.originalValue-this.data.form.netSalvage)/e.detail.value).toFixed(2)
})
}
if(e.currentTarget.dataset.name == 'form.depreciationYears' ){
this.setData({
'form.depreciationValue' : this.data.form.netSalvage*e.detail.value
'form.depreciationValue' : (this.data.form.perYearDepreciationValue*e.detail.value)>this.data.form.originalValue?this.data.form.originalValue:(this.data.form.perYearDepreciationValue*e.detail.value).toFixed(2),
'form.netValue' : (this.data.form.originalValue-(this.data.form.perYearDepreciationValue*e.detail.value))>=0?(this.data.form.originalValue-(this.data.form.perYearDepreciationValue*e.detail.value).toFixed(2)):0
})
}
}
},
/**
@@ -507,7 +517,7 @@ Page({
if(res.data.length>0){
that.setData({
assetStatusOptions:res.data,
'form.assetStatusOptions':res.data[0].dictValue
'form.assetStatus':res.data[0].dictValue
})
}
}


+ 1
- 1
pages/fixedAssets/add/add.wxml 파일 보기

@@ -133,7 +133,7 @@
<text><text style="color:red;margin-right: 22rpx;"></text>数量/面积</text>
</view>
<view>
<input type="text" value="{{form.quantity}}" bindinput="bindNewInput" data-name="form.quantity" type="number" style="text-align: right;margin-top: 20rpx;" />
<input type="text" value="{{form.quantity}}" bindinput="bindNewInput" data-name="form.quantity" type="digit" style="text-align: right;margin-top: 20rpx;" />
</view>
</view>
<view class="section">


+ 10
- 10
pages/fixedAssets/fixedAssets.js 파일 보기

@@ -57,13 +57,6 @@ Page({
scrollHeight:wx.getSystemInfoSync().windowHeight-res[0].height-res[0].top
})
})
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {

//获取附件字典
UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'common_attach', {method:'GET'}, {
success: (res) => {
@@ -74,8 +67,15 @@ Page({
}
}
})

this.getList();
},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {

},
getList:function(){
let params = {
@@ -159,7 +159,6 @@ Page({
url: '/pages/fixedAssets/add/add?id='+e.currentTarget.dataset.id,
})
},
delete(e){
this.setData({
'itemId':e.currentTarget.dataset.id,
@@ -342,7 +341,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {

this.setData({'pageNums':1})
this.getList();
},

/**


불러오는 중...
취소
저장