Ver a proveniência

优化

master
yujk há 3 anos
ascendente
cometimento
653075b064
4 ficheiros alterados com 719 adições e 0 eliminações
  1. +381
    -0
      pages/contractAssets/fixedAssets.js
  2. +14
    -0
      pages/contractAssets/fixedAssets.json
  3. +52
    -0
      pages/contractAssets/fixedAssets.wxml
  4. +272
    -0
      pages/contractAssets/fixedAssets.wxss

+ 381
- 0
pages/contractAssets/fixedAssets.js Ver ficheiro

@@ -0,0 +1,381 @@
// pages/bank/bank.js
import * as UTIL from '../../utils/util.js';
import * as API from '../../utils/API.js';
let EVN_CONFIG = require('../../env/env');
const DISTRIBUTE_ENVIROMENT = 'IMGURL';
let {
URL_PREFIX,
} = EVN_CONFIG[DISTRIBUTE_ENVIROMENT];
const app = getApp();
Page({

/**
* 页面的初始数据
*/
data: {
isIPX: app.globalData.isIPX,
list:[],
isLoading:false,
pageNums:1,
scrollHeight:"",
name:"",
showUpload:false,
uploadOptions:[],
fileList:[],
showPopup:false,
fileEvent:{},
itemId:"",
assetTypeOptions:[]
},
goAdd(){
wx.navigateTo({
url: 'add/add',
})
},
back:function(){
wx.navigateBack({
delta: 1
})
},
assetTypeDict(val){
this.data.assetTypeOptions.map(res => {
if(res.dictValue == val){
return res.dictLabel
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var that = this;
let qu = wx.createSelectorQuery()
qu.select("#top_view").boundingClientRect()
qu.select("#top_ban").boundingClientRect()
qu.exec(res => {
that.setData({
scrollHeight:wx.getSystemInfoSync().windowHeight-res[0].height-res[0].top
})
})
this.setData({'itemId':options.id})
},

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

//获取附件字典
UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'common_attach', {method:'GET'}, {
success: (res) => {
if(res.data.length>0){
this.setData({
uploadOptions:res.data,
})
}
}
})

this.getList();
},
getList:function(){
let params = {
pageNum:this.data.pageNums,
pageSize:10,
name:this.data.name,
isMin:"Y",
useType:'2',
operationType:'1',
assetStatus:'1'
}
UTIL.httpRequest(API.URL_GET_PERMANENTLIST,params,{
success: (res) => {
console.log(res);
let _this = this
if(res.code == 200){
if(this.data.pageNums!=1&&this.data.list.length<res.total){
let lists = this.data.list.concat(res.rows)
//获取资产类别
UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'asset_type', {method:'GET'}, {
success: (r) => {
if(r.data.length>0){
let li = lists.map( res => {
r.data.map(rr => {
if(res.assetType == rr.dictValue){
res.assetType = rr.dictLabel
}
})
return res
})
_this.setData({list:li})
}else{
_this.setData({list:lists})
}
}
})
}else if(this.data.pageNums==1){
//获取资产类别
UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'asset_type', {method:'GET'}, {
success: (r) => {
if(r.data.length>0){
let li = res.rows.map( ress => {
r.data.map(rr => {
if(ress.assetType == rr.dictValue){
ress.assetType = rr.dictLabel
}
})
return ress
})
_this.setData({list:li})
}else{
_this.setData({list:res.rows})
}
}
})
}
}else{
UTIL.showToastNoneIcon(res.msg);
}
}
})
},
paging(){
this.setData({
pageNums:this.data.pageNums+1,
})
this.getList();
},
goSearch(e){
this.setData({name:e.detail});
this.setData({pageNums:1});
this.getList();
},
goUpdate(e){
let data = e.currentTarget.dataset.item;
data.method = "POST";
data.assetTable = "t_asset_permanent"
data.assetId = e.currentTarget.dataset.item.id
data.contractionId = this.data.itemId
data.num = e.currentTarget.dataset.item.quantity
UTIL.httpRequest(API.URL_GET_ASSETADD,data,{
success: (res) => {
if(res.code == 200){
UTIL.showToastNoneIcon(res.msg);
wx.navigateBack({
delta: 1
})
}else{
UTIL.showToastNoneIcon(res.msg);
}
}
})
},
delete(e){
UTIL.httpRequest(API.URL_GET_PERMANENTDELETE + e.currentTarget.dataset.id, {method:'GET'}, {
success: (res) => {
if(res.code==200){
let new_list = this.data.list
new_list.splice(e.currentTarget.dataset.index,1)
this.setData({'list':new_list})
UTIL.showToastNoneIcon('删除成功!');
}else{
UTIL.showToastNoneIcon('删除失败!');
}
}
})
},
upload(e){
this.setData({itemId:e.currentTarget.dataset.id});
this.asyncFun(e.currentTarget.dataset.id)
},
asyncFun(id){
this.setData({"fileList":[]})
let uploadList = this.data.uploadOptions
let newList = []
let _this = this
uploadList.map( res => {
let oData = {
tableId: id,
tableName: "t_asset_permanent", //上传表
bizPath: "asset",
fileType: res.dictValue, //附件类型 1原始发票 2会议纪要 3会议照片 4 参会人员签字
method:'GET'
}
UTIL.httpRequest(API.URL_GET_ATTACHMENTLIST, oData, {
success: (rr) => {
if(rr.rows.length>0){
rr.rows.map((rrr,index) => {
rrr.url = URL_PREFIX + rrr.fileUrl
if(index==rr.rows.length-1){
newList.push(Object.assign({},res,{"list":rr.rows}))
_this.setData({"fileList":_this.data.fileList.concat(newList)});
_this.setData({"showUpload":true})
}
})
}else{
let newuploadList = uploadList
newuploadList.map(rd => {
rd.list = newList
})
_this.setData({"fileList":newuploadList});
_this.setData({"showUpload":true})
}
},
fail:(rr) =>{
console.log(rr);
},
complete:(rr) => {
console.log(rr);
}
})
})

},
closeBox(){
this.setData({"showUpload":false})
},
deleteImg(event){
this.setData({"fileEvent":event})
this.setData({"showPopup":true});
},
cancelTem:function(e){
this.setData({"fileEvent":"{}"});
this.setData({"showPopup":false});
},
confirmTem:function(e){
let event = this.data.fileEvent
console.log(event);
UTIL.httpRequest(API.URL_GET_GETFILEREMOVE+event.detail.file.id , {method:'GET'}, {
success: (res) => {
if(res.code==200){
let ll = this.data.fileList
var jsonlist = ll[event.target.dataset.idx].list;
jsonlist.splice(event.detail.index, 1)
ll[event.target.dataset.idx].list = jsonlist
this.setData({"fileList":ll})
this.setData({showPopup:false});
wx.showToast({
title: '删除成功!',
icon: 'success',
duration: 2000,
})
}
}
})
},
uploadFile(uploadFile,event) {
let _this = this
return new Promise((resolve, reject) => {
wx.uploadFile({
url: API.URL_GET_UPLOAD,
filePath: uploadFile.file.file[0].url,
name: 'file',
header: {
"Content-Type": "multipart/form-data",//记得设置
"chartset":"utf-8",
'Authorization':'Bearer '+getApp().globalData.userInfo.token
},
formData:uploadFile,
success: (res) => {
res.data = JSON.parse(res.data);
if(res.statusCode == 200){
let files = _this.data.fileList
let fName = res.data.fileUrl.split('/')
let fLength = fName.length
files[event.currentTarget.dataset.idx].list.push({
"fileName": fName[fLength-1],
"fileType": "0",
"fileUrl":res.data.fileUrl ,
"id": res.data.id,
"tableId": 6,
"url":URL_PREFIX+res.data.fileUrl
})
_this.setData({"fileList":files})
wx.hideLoading()
}
},
fail: (err) => {
//上传失败:修改pedding为reject
reject(err)
}
});
})
},
afterRead(event) {
let _this = this
wx.showLoading({
title: '上传中...'
})
let fileForm={
file: event.detail,
fileType:event.currentTarget.dataset.idx,
tableName: "t_asset_permanent", //上传表
bizPath: "asset",
tableId:_this.data.itemId
}
this.uploadFile(fileForm,event)
},
lookDown(file,detail){
// 获取指定字符串最后一次出现的位置,返回index
var index1 = file.detail.url.lastIndexOf('.');
// substr(start, length) 抽取从start下标开始的length个字符,返回新的字符串;
var style = file.detail.url.substr(index1 + 1)
//判断图片类型,不需要下载,不做处理
if(style=='png'||style=='jpg'||style=='jpeg'||style=='bmp'||style=='gif'||style=='webp'||style=='psd'||style== 'svg'||style=='tiff'){
//判断非图片类型
}else{
wx.downloadFile({
url: file.detail.url,
success(data){
wx.openDocument({
filePath: data.tempFilePath,
fileType: style,
showMenu:true,
success(res){
}
})
}
})
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide() {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload() {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},

/**
* 用户点击右上角分享
*/
onShareAppMessage() {

}
})

+ 14
- 0
pages/contractAssets/fixedAssets.json Ver ficheiro

@@ -0,0 +1,14 @@
{
"usingComponents": {
"van-checkbox": "@vant/weapp/checkbox/index",
"van-checkbox-group": "@vant/weapp/checkbox-group/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-search": "@vant/weapp/search/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-swipe-cell": "@vant/weapp/swipe-cell/index",
"van-action-sheet": "@vant/weapp/action-sheet/index",
"van-upload": "@vant/weapp/uploader/index"
}
}

+ 52
- 0
pages/contractAssets/fixedAssets.wxml Ver ficheiro

@@ -0,0 +1,52 @@
<!--pages/fixedAssets/fixedAssets.wxml-->
<view class="ns" id="top_ban" style="height:{{isIPX?'88px':'64px'}};">
<image src="../../image/apply/back.png" style="top:{{isIPX?'54px':'30px'}};" mode="widthFix" bindtap="back" referrer="no-referrer|origin|unsafe-url"></image>
<text style="top:{{isIPX?'54px':'30px'}};">可关联固定资产</text>
</view>

<view class="search_box" id="top_view" style="margin-top:{{isIPX?'100px':'75px'}};">
<van-search
value="{{ name }}"
shape="round"
background="transparent"
placeholder="请输入搜索关键词"
clearable
bind:change="goSearch"
/>
</view>
<scroll-view scroll-y refresher-threshold="0" style="height:{{scrollHeight}}px" bindscrolltolower="paging" lower-threshold="100">
<van-swipe-cell class="workflow" wx:for="{{list}}" wx:key="index" wx:for-item="item" >
<view class="li" bindtap="goUpdate" data-item="{{item}}">
<view class="tit_box">
<image src="/image/icon/fixedAssets_icon.png" style="width: 15px;height: 15px;margin-right: 10px;" referrer="no-referrer|origin|unsafe-url"></image>
<text class="tit">{{item.name}}</text>
<view style="flex:1;">
<text wx:if="{{item.useType=='1'}}" style="text-align: center;float:right;font-size:12px;background:rgb(235, 154, 4,0.2);color:rgb(235, 154, 4);width:50px;line-height: 20px;">自用</text>
<text wx:if="{{item.useType=='2'}}" style="text-align: center;float:right;font-size:12px;background:rgb(235, 154, 4,0.2);color:rgb(235, 154, 4);width:50px;line-height: 20px;">闲置</text>
<text wx:if="{{item.useType=='3'}}" style="text-align: center;float:right;font-size:12px;background:rgb(235, 154, 4,0.2);color:rgb(235, 154, 4);width:70px;line-height: 20px;">出租或出借</text>
<text wx:if="{{item.useType=='4'}}" style="text-align: center;float:right;font-size:12px;background:rgb(235, 4, 4,0.2);color:rgb(235, 4, 4);width:50px;line-height: 20px;">其他</text>
</view>
</view>
<view class="detail_box">
<view style="width: 55%;margin-left:5%;">{{item.code}}</view>
<view style="width: 40%;">
{{item.assetType}}
</view>
</view>

<view class="detail_box">
<view style="width: 60%;">
<image src="/image/icon/clock_icon.png" style="width: 15px;height: 15px;border-radius:5px;margin-right: 5px;"></image>
<text>{{item.buildTime}}</text>
</view>
<view style="width: 40%;text-align: right;">
原值:
<text style="color:red">¥{{item.originalValue}}</text>
</view>
</view>
</view>
</van-swipe-cell>
</scroll-view>
<modal hidden="{{!showPopup}}" title="是否删除?" confirm-text="是" cancel-text="否" bindcancel="cancelTem" bindconfirm="confirmTem">
</modal>

+ 272
- 0
pages/contractAssets/fixedAssets.wxss Ver ficheiro

@@ -0,0 +1,272 @@
/* pages/bank/bank.wxss */
.van-search__content {
border: 1px solid #5CAE77!important;
background: #fff!important;
}
van-search {
flex: 1;
}
.search_box{
display: flex;
}
.add_btn{
flex: 0.2;
padding: var(--search-padding,10px 12px);
padding-left: 0;
}
.add_btn text{
background-color: #62AD66;
display: block;
height: 100%;
text-align: center;
line-height: 36px;
color: #fff;
border-radius: 36px;
box-shadow: 0px 5px 5px #ddd;
}
text{display: block;}
.work_plan{
padding: 40rpx 32.5rpx 30rpx;
display: flex;
}

.work_plan .menu_item{
background-color: #fff;
box-shadow: 2px 5px 5px #ddd;
border-radius: 60rpx;
text-align: center;
position: relative;
margin-right: 20px;
padding: 8px 10px;
}
.work_plan .menu_item.active{
background-color: #2C8E68;
color: #fff;
}
.work_plan .menu_item .remind{
height: 30rpx;
background: #e90101;
color: #fff;
font-size: 26rpx;
position: absolute;
line-height: 30rpx;
padding:0 10rpx;
border-radius: 25px;
top: -10rpx;
right: -10rpx;
}

.work_plan .more{
flex: 1;
text-align: center;
line-height: 60rpx;
font-size: 36rpx;
color: #31936c;
}
.deleteBox{
width: 130px;
text-align: center;
height: 100%;
background: #F6F6F6;
align-items: center;
display: flex;
}
.workflow .workflow_list{
height: 150rpx;
background-color: #fff;
border-radius: 24rpx;
box-shadow:0rpx 0rpx 10rpx rgba(0,0,0,.1);
margin-bottom: 20rpx;
padding:15rpx 25rpx 10rpx 35rpx;
}
.workflow .workflow_list .process_intro{
display: flex;
height: 62rpx;
align-items: center;
}

.workflow .process_intro .name{
width: 390rpx;
font-size: 34rpx;
margin-right: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.workflow .process_intro .name .name_tit{
width: 290rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.van-swipe-cell {
width: 94%;
background: #fff;
border-radius: 10px;
box-shadow: 2px 5px 5px #ddd;
margin: 0 auto;
margin-bottom: 15px;
}
.li{
width: 100%;
padding: 14px;
}
.tit_box{
display: flex;
}
.detail_box{
margin-top: 10px;
display: flex;
justify-content: space-between;
}
.li view text{
/* margin-top: 15px; */
}
.li .detail_box view{
display: flex;
align-items: center;
}
.li .detail_box view text{
color: #666666;
font-size: 12px;
}

.li view text:nth-child(1){
margin-top: 0px;
}
.li .fksr{
display: flex;
align-items: center;
margin-top: 15px;
color: #2C8E68;
font-size: 16px;
}
.li .wtj{
display: flex;
align-items: center;
justify-content: center;
padding: 3px 8px;
border-radius: 5px;
font-size: 14px;
}
.no{
background-color:#fbe3e3;
color: #e90000;
}
.white{
background-color:#feeadc;
color: #fc9a55;
}
.yes{
background-color:#ddeee3;
color: #5cae77;
}
.other{
background-color:#f0f1f6;
color: #878787;
}
.li .tit{
font-size: 14px;
color: #444444;
line-height: 14px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
word-break: break-all;
overflow: hidden;
}
.li .fj_name{
font-size: 14px;
color: #B3DB62;
line-height: 25px;
}
.li .time{
font-size: 14px;
color: #9B9CAA;
}
.li .money{
font-size: 18px;
color: #5CAE77;
}
.van-checkbox__label {
display: flex;
justify-content: space-between;
width: 100%;
}

.van-checkbox__icon-wrap {
border-radius: 5px;
}
.van-checkbox__icon {
border-radius: 5px;
border: 2px solid #2C8E68!important;
background-color: rgba(44, 142, 104, 0.2);
}
.bottom{
width: 100%;
margin: 0 auto;
text-align: center;
padding: 15px 0;
display: flex;
position: fixed;
bottom: 0%;
background: #fff;
box-shadow: 0 0 5px #ddd;
}

.bottom view {
width: 47%;
margin: 0 auto;
border-radius: 30px;
display: inline-block;
}

.bottom .btn2{
border: 1px solid transparent;
padding: 10px 0px;
background-image: linear-gradient(to right, #2C8E68, #5CAE77);
color: #fff;
}

.downView{
display: flex;
justify-content: center;
align-items: center;
padding: 0 20px;
border: 1px solid #5CAE77;
border-radius: 50px;
background: #fff;
margin-left: auto;
}
.downView image{
width: 10px;
height: 8px;
margin-left: 10px;
}
.fj-box text{
background-color: #5CAE77;
color: #ffffff;
text-align: center;
border-radius: 5px;
white-space:pre-wrap;
padding: 5rpx 8rpx;
width: 50rpx;
margin: 0px 14px;
font-size: 24rpx;
}
.fj-li{
margin-top: 20px;
display: flex;
/* flex-wrap: wrap; */
}
.fj-li .img_li{
width: 100%;
height: 18.5vw;
}

.fj-li .img_add{
overflow: hidden;
}
.van-icon-description{
font-size: 60px;
}

Carregando…
Cancelar
Guardar