Commit efeff16e authored by 刘文虎's avatar 刘文虎

账单编辑

parent db95db03
......@@ -9,4 +9,30 @@ export function getLists(data) {
})
}
export function exportBill(data) {
return request({
url: `/rest/project/record/export`,
method: 'GET',
responseType:'ArrayBuffer',
data,
noLoading:true
})
}
export function getBillInfo(data) {
return request({
url: `/rest/project/record`,
method: 'GET',
data,
noLoading:true
})
}
export function deleteBill(data) {
return request({
url: `/rest/project/record/detail`,
method: 'DELETE',
data,
noLoading:true
})
}
\ No newline at end of file
......@@ -191,17 +191,15 @@
"navigationStyle": "custom"
}
} ,{
"path" : "quoted-price/create/classification",
"style" :
{
"navigationBarTitleText": "服务分类",
"enablePullDownRefresh": false,
}, {
"path": "quoted-price/create/classification",
"style": {
"navigationBarTitleText": "服务分类",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
]
}
}]
}, {
"root": "pages/mine",
"pages": [{
......@@ -451,90 +449,88 @@
{
"root": "pages/workpoint",
"pages": [{
"path" : "workpoint-create/workpoint-create",
"style" :
{
"navigationBarTitleText": "记工时",
"enablePullDownRefresh": false
}
}
,{
"path" : "loan-statement/loan-statement",
"style" :
{
"navigationBarTitleText": "借支/结算",
"enablePullDownRefresh": false
}
}
,{
"path": "employees/index",
"name": "employee-list",
"style": {
"navigationBarTitleText": "项目成员",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
},{
"path": "employees/employee-create",
"name": "employee-create",
"style": {
"navigationBarTitleText": "新建成员",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
},{
"path": "project/index",
"name": "project",
"style": {
"navigationBarTitleText": "项目列表",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
},{
"path": "project/project-edit",
"name": "project-edit",
"style": {
"navigationBarTitleText": "项目管理",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
}
,{
"path" : "project-bill/project-bill",
"name":"project-bill",
"style" :
{
"navigationBarTitleText": "项目账单",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "project-bill/export",
"style" :
{
"navigationBarTitleText": "账单导出",
"enablePullDownRefresh": false
}
}
,{
"path" : "member/member",
"style" :
{
"navigationBarTitleText": "成员列表",
"enablePullDownRefresh": false
}
}
]
"path": "workpoint-create/create",
"style": {
"navigationBarTitleText": "记工时",
"enablePullDownRefresh": false
}
}, {
"path": "workpoint-create/edit",
"style": {
"navigationBarTitleText": "记工时",
"enablePullDownRefresh": false
}
}, {
"path": "loan-statement/loan-statement",
"style": {
"navigationBarTitleText": "借支/结算",
"enablePullDownRefresh": false
}
}, {
"path": "employees/index",
"name": "employee-list",
"style": {
"navigationBarTitleText": "项目成员",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
}, {
"path": "employees/employee-create",
"name": "employee-create",
"style": {
"navigationBarTitleText": "新建成员",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
}, {
"path": "project/index",
"name": "project",
"style": {
"navigationBarTitleText": "项目列表",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
}, {
"path": "project/project-edit",
"name": "project-edit",
"style": {
"navigationBarTitleText": "项目管理",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
}, {
"path": "project-bill/project-bill",
"name": "project-bill",
"style": {
"navigationBarTitleText": "项目账单",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "project-bill/export",
"style": {
"navigationBarTitleText": "账单导出",
"enablePullDownRefresh": false
}
}, {
"path": "member/member",
"style": {
"navigationBarTitleText": "成员列表",
"enablePullDownRefresh": false
}
}
]
}
],
"globalStyle": {
......
......@@ -217,6 +217,11 @@ export default {
path: '/pages/card/payee-code',
name: '收款码'
},
{
image: this.baseUrl + 'jigongshi@3x.png',
path: '/pages/workpoint/project/index',
name: '记工时'
},
{
image: this.baseUrl + 'famingpian@3x.png',
path: '/pages/card/index',
......@@ -753,7 +758,7 @@ export default {
display: flex;
justify-content: space-between;
align-items: center;
margin: 72rpx 56rpx 64rpx 56rpx;
margin: 72rpx 32rpx 64rpx 32rpx;
.item-view {
display: flex;
align-items: center;
......
......@@ -105,8 +105,8 @@ export default {
let startTime = '';
let endTime = '';
if (range) {
startTime = range[0] + ' 00:00:00';
endTime = range[1] + ' 23:59:59';
startTime = range[0];
endTime = range[1];
}
this.downloadExcel({ startTime, endTime });
// 导出
......@@ -132,11 +132,18 @@ export default {
if (this.platform === '4') {
if (this.type === 'maintain') {
// 维修账单
url = apiUrl + '/rest/repair/export';
url = apiUrl + '/rest/repair/export?';
} else {
// 日常账单
url = apiUrl + '/rest/bookRecord/export';
url = apiUrl + '/rest/bookRecord/export?';
}
let keys=Object.keys(params)
keys.map((key,index)=>{
url+=`${key}=${params[key]}`
if(index!==keys.length-1){
url+='&'
}
})
res = await downLoadFile(url);
console.log(res);
} else {
......
......@@ -568,7 +568,7 @@ export default {
handleClickAgain() {
this.handleClickSure(()=>{
this.$u.route({
url: 'pages/workpoint/workpoint-create/workpoint-create',
url: 'pages/workpoint/loan-statement/loan-statement',
type: 'redirectTo',
params: {
projectId: this.projectId
......
......@@ -45,14 +45,14 @@ export default {
return name.slice(-2);
},
toBill() {
// this.$u.route({
// url: '/pages/maintain-bill/index',
// type: 'navigateTo',
// params: {
// customerId:this.detail.customerId,
// onlyDebt:1,
// }
// });
this.$u.route({
url: '/pages/workpoint/workpoint-create/edit',
type: 'navigateTo',
params: {
recordId:this.detail.id,
projectId:this.detail.projectId,
}
});
}
}
};
......
......@@ -33,8 +33,8 @@
成员
</view>
<view class="placeholder" @click="openSelect">
<text class="value-text" v-if="form.userName">{{ form.userName }}</text>
<text v-else>选择项目</text>
<text class="value-text" v-if="memberName">{{ memberName }}</text>
<text v-else>选择成员</text>
<u-icon name="arrow-right" class="arrow"></u-icon>
</view>
</view>
......@@ -48,14 +48,24 @@
</view>
</view>
<file-list ref="file-list" fileName="账单"></file-list>
<u-select
v-model="selectShow"
mode="single-column"
value-name='id'
label-name='name'
:list="memberList"
@confirm="selectConfirm"
></u-select>
</view>
</template>
<script>
import DateRangePicker from '@/components/date-range-picker/uni-datetime-picker.vue';
import FileList from '@/pages/mine/import-export/components/file-list.vue';
import { exportBill } from '@/api/bill/index.js';
// import { exportBill } from '@/api/bill/index.js';
import { repairExport } from '@/api/maintain/index.js';
import { getMembers} from '@/api/workpoint/index.js';
import { exportBill } from '@/api/workpoint/project-bill.js';
import { downLoad, downLoadFile, saveFile } from '@/utils/download.js';
import { mapGetters } from 'vuex';
export default {
......@@ -65,12 +75,17 @@ export default {
},
data() {
return {
selectShow:false,
memberList:[],
type: 'bill',
confirmText: '导出',
showAll: true,
daterange: [],
currentIndex: 1,
loading: false
loading: false,
projectId:'',
memberId:'',
memberName:'',
};
},
computed: {
......@@ -90,13 +105,9 @@ export default {
}
},
onLoad(options) {
if (options && options.type) {
if (options.type === 'maintain') {
uni.setNavigationBarTitle({
title: '服务帐单导出'
});
}
this.type = options.type;
if (options && options.projectId) {
this.projectId = options.projectId;
this.getMembersOptions()
}
},
onReady() {
......@@ -104,7 +115,26 @@ export default {
},
methods: {
openSelect(){
this.selectShow=true
},
async getMembersOptions() {
try {
let { data } = await getMembers({ projectId: this.projectId });
data.map(item=>{
item.value=item.id
item.label=item.name
})
this.memberList=data||[]
} catch (e) {
//TODO handle the exception
console.log(e);
}
},
selectConfirm(e) {
if (e && e[0]) {
this.memberId = e[0].value;
this.memberName = e[0].label;
}
},
initDate() {
var endDay = this.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd');
......@@ -117,8 +147,8 @@ export default {
let startTime = '';
let endTime = '';
if (range) {
startTime = range[0] + ' 00:00:00';
endTime = range[1] + ' 23:59:59';
startTime = range[0];
endTime = range[1];
}
this.downloadExcel({ startTime, endTime });
// 导出
......@@ -133,32 +163,28 @@ export default {
try {
let { startTime, endTime } = date;
let params = {
start: startTime,
end: endTime
happenStart: startTime,
happenEnd: endTime,
memberId:this.memberId,
projectId:this.projectId
};
console.log(params);
let res = null;
const globalUrl = process.uniEnv || {};
let apiUrl = globalUrl.apiUrl;
let url = '';
if (this.platform === '4') {
if (this.type === 'maintain') {
// 维修账单
url = apiUrl + '/rest/repair/export';
} else {
// 日常账单
url = apiUrl + '/rest/bookRecord/export';
}
let url = `${apiUrl}/rest/project/record/export?`;
let keys=Object.keys(params)
keys.map((key,index)=>{
url+=`${key}=${params[key]}`
if(index!==keys.length-1){
url+='&'
}
})
res = await downLoadFile(url);
console.log(res);
console.log(url);
} else {
if (this.type === 'maintain') {
// 维修账单
res = await repairExport(params);
} else {
// 日常账单
res = await exportBill(params);
}
res = await exportBill(params);
}
this.saveFile(res);
} catch (e) {
......
......@@ -138,6 +138,7 @@ export default {
async getMembersOptions() {
try {
let { data } = await getMembers({ projectId: this.projectId });
data.unshift({id:'',name:'全部成员'})
data.map(item=>{
item.value=item.id
item.label=item.name
......@@ -157,13 +158,13 @@ export default {
handleSelectFilter() {
this.selectShow=true
},
handleClickChange(){
handleClickChange(range){
this.daterange = range;
this.onRefresh();
},
handlClickRight() {
uni.navigateTo({
url:'/pages/workpoint/project-bill/export'
url:`/pages/workpoint/project-bill/export?projectId=${this.projectId}`
})
},
changeSearch() {
......
......@@ -66,7 +66,7 @@ export default {
return {
'edit': '/pages/workpoint/project/project-edit',
'loan': '/pages/workpoint/loan-statement/loan-statement',
'work': '/pages/workpoint/workpoint-create/workpoint-create'
'work': '/pages/workpoint/workpoint-create/create'
}
},
customLoan () {
......
......@@ -372,7 +372,6 @@ export default {
// this.repairDetail();
this.getProjectInfo();
}
this.getProjectList()
},
onReady() {
this.$refs.uForm.setRules(this.rules);
......@@ -382,6 +381,7 @@ export default {
uni.$off(this.notification);
},
onShow() {
this.getProjectList()
this.getMembersOptions();
},
methods: {
......@@ -413,6 +413,8 @@ export default {
if (e && e[0]) {
this.form.projectId = e[0].value;
this.form.projectName = e[0].label;
this.projectId=e[0].value;
this.getMembersOptions();
}
},
handleChangeUnit(e) {
......@@ -587,6 +589,9 @@ export default {
unitPrice
};
}
if(!Number(form.overNumber)){
form.overType=''
}
console.log(form);
this.edit(form,callback);
} else {
......@@ -651,7 +656,7 @@ export default {
handleClickAgain() {
this.handleClickSure(()=>{
this.$u.route({
url: 'pages/workpoint/workpoint-create/workpoint-create',
url: 'pages/workpoint/workpoint-create/create',
type: 'redirectTo',
params: {
projectId: this.projectId
......
This diff is collapsed.
......@@ -33,7 +33,7 @@ export const whiteList = ['/pages/index/index', '/pages/index/schedule/schedule'
]; // 路由白名单
export const responseWhiteList = ['/rest/bookRecord/export', '/rest/repair/export', '/rest/exchangeCode/check',
'/rest/exchangeCode/exchange'
'/rest/exchangeCode/exchange','/rest/project/record/export'
]; // 请求URL白名单,此名单内的请求不作状态码判断,在resolve中直接返回
export const sceneOptions = {
trip: "TRIP",
......
......@@ -4,7 +4,7 @@ import {
export const minPopupOptions = [
{
label: '记工时',
path: '/pages/workpoint/project/index',
path: '/pages/workpoint/workpoint-create/create',
icon: 'jigongshitanchu@3x.png',
type: '0',
},
......
......@@ -86,15 +86,15 @@ export const projectBillTabs = [{
name: ''
}, {
title: '记工',
name: 'TIME'
name: '1'
},
{
title: '借支',
name: 'BORROWING'
name: '2'
},
{
title: '结算',
name: 'SETTLE'
name: '3'
},
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment