Commit db95db03 authored by 刘文虎's avatar 刘文虎
parents c29a3458 617203a2
Pipeline #3550 canceled with stages
......@@ -10,7 +10,7 @@ export async function deleteProject(data) {
})
}
// 新增、更新项目
// 恢复项目
export async function recoveryProject(data) {
return request({
url: `/rest/project/recovery`,
......@@ -21,7 +21,7 @@ export async function recoveryProject(data) {
}
// 新增、更新项目
export async function editProject(data) {
export async function updateProject(data) {
return request({
url: `/rest/project/save`,
method: 'POST',
......@@ -41,4 +41,43 @@ export async function getProjectList(data) {
})
}
// 项目详情
export async function getProjectDetail(data) {
return request({
url: `/rest/project/detail`,
method: 'GET',
data,
noLoading: true
})
}
// 项目详情
export async function getProjectSalary(data) {
return request({
url: `/rest/project/salary`,
method: 'GET',
data,
noLoading: true
})
}
// 项目薪水设置
export async function setProjectSalary(data) {
return request({
url: `/rest/project/salarySet`,
method: 'POST',
data,
noLoading: true
})
}
// 结清项目
export async function settleProject(data) {
return request({
url: `/rest/project/settle`,
method: 'POST',
data,
noLoading: true
})
}
\ No newline at end of file
......@@ -56,7 +56,7 @@
</u-button>
</view>
<view class="right-view">
<u-button :custom-style="customConFirm" @click="handleClickConfirm">
<u-button :loading="loading" :custom-style="customConFirm" @click="handleClickConfirm">
<view class="confirm-view">{{ confirmText }}</view>
</u-button>
</view>
......@@ -116,6 +116,10 @@ export default {
type: String,
default: 'normal',
},
loadingShow: {
type: Boolean,
default: false
}
},
data() {
return {
......@@ -126,6 +130,7 @@ export default {
watch: {
visible(val) {
this.show = val
this.loading = false
if (val) {
this.select = false
}
......@@ -171,6 +176,7 @@ export default {
this.$emit('update:visible', val)
},
handleClickConfirm() {
this.loading = this.loadingShow
this.changeVisibleValue(false)
this.$emit('confirm', this.select)
if (this.isShare || this.isRenew) {
......
......@@ -200,6 +200,10 @@ export default {
this.whiteSpace = options.whiteSpace;
this.inputStyle.whiteSpace = 'pre-wrap';
}
setTimeout(() => {
console.log('----disabled----------', this.disabled)
}, 3000);
},
onUnload() {
let notification = `input-sure-${this.type}`;
......
<template>
<u-popup v-model="show" safe-area-inset-bottom mode="bottom" width="100%" border-radius="16" :closeable="false" @close="handleClose">
<view class="ppop-cwage-setting">
<WageSetting type="pop" :form="form" @close="handleClose" @change="handleChange" />
<WageSetting type="pop" :form="form" @close="handleClose" :fill.sync="canConfirm" @change="handleChange" />
<view class="bottom-view">
<u-button :custom-style="customConFirm" @click="handleClickSure" :loading="buttonLoading">
<view class="confirm-view">确定</view>
......@@ -24,18 +24,27 @@ export default {
type: Boolean,
default: false,
},
form: {
type: Object,
default() {
return {
id : '',
normalUnitHours : '',
normalUnitMoney : '',
overHoursMoney : '',
overType : 'UNIT', // UNIT:按工时;HOURS:按小时
overUnitHours : '',
overUnitMoney : '',
projectId : '',
}
}
}
},
data () {
return {
form: {
hour: '',
unit: '',
type: 'day', // day;hour
overHour: '',
overUnit: '',
},
buttonLoading: false,
show: false,
canConfirm: false
}
},
computed: {
......@@ -48,21 +57,16 @@ export default {
width: '686rpx',
}
},
canConfirm () {
for (var item in this.form) {
if (this.form[item] == '' || this.form[item] == null) {
return false
}
}
return true
},
},
watch: {
visible(val) {
this.show = val
this.buttonLoading = false
console.log('-----created---0--', this.form)
},
},
created () { },
created () {
},
methods: {
handleClose () {
this.show = false
......@@ -70,10 +74,13 @@ export default {
},
handleChange (key, value) {
this.form[key] = value
console.log('---handleChange----0---', key, value)
this.$emit('change', key, value)
},
handleClickSure () {
this.buttonLoading = true
this.$emit('sure', this.form)
this.$emit('sure', {...this.form})
this.handleClose()
}
},
}
......
......@@ -10,12 +10,12 @@
<view class="value-view">
<view class="input-view">
<u-input type="digit" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.hour" placeholder="输入数值" @input="handleInput($event, 'hour')" />
v-model="form.normalUnitHours" placeholder="输入数值" @input="handleInput($event, 'normalUnitHours')" />
</view>
<view>小时 =</view>
<view class="input-view">
<u-input type="digit" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.unit" placeholder="输入金额" @input="handleInput($event, 'unit')" />
v-model="form.normalUnitMoney" placeholder="输入金额" @input="handleInput($event, 'normalUnitMoney')" />
</view>
<view>元 = 1个工</view>
</view>
......@@ -24,29 +24,30 @@
<view :class="['part-view', 'type']">
<view class="label-view">加班类型</view>
<view class="value-view">
<view v-for="(item, index) in labels" :key="index" :class="['type-view', {selected: item.type == form.type}]"
class="select-view" hover-class="u-hover-class" @click="handleSelectType(item.type)">{{item.name}}</view>
<view v-for="(item, index) in labels" :key="index"
:class="['type-view', {selected: item.type == form.overType}]" class="select-view"
hover-class="u-hover-class" @click="handleSelectType(item.type)">{{item.name}}</view>
</view>
</view>
<view class="line-view"></view>
<view class="part-view">
<view class="label-view">加班</view>
<view class="value-view" v-if="form.type == 'day'">
<view class="value-view" v-if="form.overType == 'UNIT'">
<view class="input-view">
<u-input type="digit" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.overHour" placeholder="输入数值" @input="handleInput($event, 'overHour')" />
v-model="form.overUnitHours" placeholder="输入数值" @input="handleInput($event, 'overUnitHours')" />
</view>
<view>小时 =</view>
<view class="input-view">
<u-input type="digit" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.overUnit" placeholder="输入金额" @input="handleInput($event, 'overUnit')" />
v-model="form.overUnitMoney" placeholder="输入金额" @input="handleInput($event, 'overUnitMoney')" />
</view>
<view>元 = 1个工</view>
</view>
<view class="value-view" v-else>
<view class="input-view">
<u-input type="digit" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.overUnit" placeholder="输入金额" @input="handleInput($event, 'overUnit')" />
v-model="form.overHoursMoney" placeholder="输入金额" @input="handleInput($event, 'overHoursMoney')" />
</view>
<view>元/小时</view>
</view>
......@@ -64,11 +65,14 @@ export default {
type: Object,
default () {
return {
hour: '',
unit: '',
type: 'day', // day;hour
overHour: '',
overUnit: '',
id: '',
normalUnitHours: '',
normalUnitMoney: '',
overHoursMoney: '',
overType: 'UNIT', // UNIT:按工时;HOURS:按小时
overUnitHours: '',
overUnitMoney: '',
projectId: '',
}
},
},
......@@ -101,27 +105,50 @@ export default {
labels () {
return [{
name: '按工天算',
type: 'day'
type: 'UNIT'
}, {
name: '按小时算',
type: 'hour'
type: 'HOURS'
}]
},
checkKeys () {
return this.form && this.form.overType == 'HOURS' ? [
'normalUnitHours',
'normalUnitMoney',
'overHoursMoney',
'overType'] : [
'normalUnitHours',
'normalUnitMoney',
'overType',
'overUnitHours',
'overUnitMoney']
}
},
created () {
},
created () { },
methods: {
handleChange (key, value) {
this.form[key] = value
this.$emit('update:fill', this.checkForm())
this.$emit('change', key, value)
},
handleSelectType (type) {
this.handleChange('type', type)
console.log('-------', type)
this.handleChange('overType', type)
},
handleInput (value, key) {
this.handleChange(key, value)
},
handleClose () {
console.log('---handleClose-----')
this.$emit('close')
},
checkForm () {
for (var item of this.checkKeys) {
if (this.form[item] == '' || this.form[item] == null) {
return false
}
}
return true
}
},
}
......
......@@ -7,7 +7,7 @@
<view class="label-view">姓名</view>
<view class="value-view">
<u-input type="text" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.name" placeholder="填写成员姓名" />
v-model="form.memberName" placeholder="填写成员姓名" />
</view>
</view>
<view class="line-view"></view>
......@@ -15,15 +15,15 @@
<view class="label-view">手机号码</view>
<view class="value-view">
<u-input maxlength="11" type="number" :clearable="false" :custom-style="customStyle"
:placeholder-style="placeholderStyle" v-model="form.phone" placeholder="填写手机号码" />
:placeholder-style="placeholderStyle" v-model="form.memberMobile" placeholder="填写手机号码" />
</view>
</view>
</view>
<WageSetting :form="form" @change="handleChange"/>
<WageSetting :form="form" :fill.sync="canConfirm" @change="handleChange"/>
</view>
<view :class="['bottom-view', {edit: memberId}]">
<u-button v-if="memberId" :custom-style="customDelete" @click="handleClickDelete" class="delete-button">
<view class="delete-view">修改</view>
<view class="delete-view">删除</view>
</u-button>
<u-button :custom-style="customConFirm" @click="handleClickConFirm" :loading="buttonLoading">
<view class="confirm-view">保存</view>
......@@ -50,17 +50,20 @@ export default {
data () {
return {
memberId: '',
projectId: '',
form: {
name: '',
phone: '',
hour: '',
unit: '',
type: '', // day;hour
overHour: '',
overUnit: '',
memberName: '',
memberMobile: '',
normalUnitHours : '',
normalUnitMoney : '',
overHoursMoney : '',
overType : 'UNIT', // UNIT:按工时;HOURS:按小时
overUnitHours : '',
overUnitMoney : '',
},
loading: false,
buttonLoading: false,
canConfirm: false,
}
},
computed: {
......@@ -97,21 +100,12 @@ export default {
'border-radius': '16rpx',
width: this.memberId ? '470rpx' : '686rpx',
}
},
canConfirm () {
for (var item in this.form) {
if (this.form.type == 'hour' && item == 'overHour') {
continue
}
if (this.form[item] == '' || this.form[item] == null) {
return false
}
}
return true
},
}
},
onLoad (options) {
if (options && options.projectId) {
this.projectId = options.projectId
}
if (options && options.memberId) {
this.memberId = options.memberId
this.loading = true
......@@ -142,18 +136,23 @@ export default {
},
setForm(data) {
this.form = {
memberId: this.memberId,
name: '张三',
phone: '18766666666',
hour: '2',
unit: '3',
type: 'day', // day;hour
overHour: '4',
overUnit: '4',
memberId: data.memberId,
projectId: data.projectId,
memberName: data.memberName,
memberMobile: data.memberMobile,
normalUnitHours : data.normalUnitHours,
normalUnitMoney : data.normalUnitMoney,
overHoursMoney : data.overHoursMoney,
overType : data.overType,
overUnitHours : data.overUnitHours,
overUnitMoney : data.overUnitMoney,
};
},
handleChange(key, value) {
this.form[key] = value
},
handleClickDelete() {
}
},
}
......
......@@ -331,6 +331,7 @@ export default {
duration: 1500,
callback: () => {
uni.$emit('employees-changed', this.stringSelectedEmployees)
uni.$emit('project-detail')
this.$u.route({
type: 'navigateBack',
params: {
......
......@@ -60,7 +60,7 @@ export default {
return this.baseUrl + 'xiangmuguanliicon@3x.png'
},
textInfo () {
return '¥' + formatCount(this.project.notSettleAmount || 0)
return Number(this.project.notSettleAmount || 0) != 0 ? '¥ ' + formatCount(this.project.notSettleAmount || 0) : '¥ --'
},
paths () {
return {
......
<template>
<view class="projects-view">
<NavbarRight v-if="isClosed" title="已结清" />
<NavbarRight v-else backTextBold backText="项目列表" text="已结清" :image="rightImage" @click="handlClickRight" />
<NavbarRight v-else backTextBold text="已结清" :image="rightImage"
:backText="platform == '4' ? '' : '项目列表'"
:title="platform == '4' ? '项目列表' : ''"
@click="handlClickRight" />
<view class="content-view">
<scroll-view scroll-y style="height: 100%; width: 100%" @scrolltolower="reachBottom" scroll-anchoring
refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
......@@ -27,7 +30,7 @@
<view class="loading-view" v-if="loading && !freshing">
<u-loading mode="flower"></u-loading>
</view>
<PopNormal :visible.sync="visible" :type="currentPopInfo.type" :title="currentPopInfo.title"
<PopNormal :visible.sync="visible" :title="currentPopInfo.title"
:content="currentPopInfo.content" @confirm="handleClickConfirm" />
<u-toast ref="uToast" />
</view>
......@@ -38,10 +41,11 @@ import NavbarRight from '@/components/navbar-right';
import CellProject from './components/cell-project';
import CellProjectClosed from './components/cell-project-closed';
import PopNormal from '@/components/pop-normal';
import { mapGetters } from 'vuex';
import NoData from '@/components/no-data';
import { getProjectList, deleteProject, editProject, recoveryProject } from '@/api/project/index.js';
import { getProjectList, deleteProject, updateProject, recoveryProject } from '@/api/project/index.js';
export default {
components: {
......@@ -66,6 +70,8 @@ export default {
};
},
computed: {
...mapGetters(['platform']),
baseUrl () {
return process.uniEnv.qn_base_url;
},
......@@ -75,6 +81,9 @@ export default {
isClosed () {
return this.type == 'closed'
},
isNormal () {
return this.type == 'normal'
},
noData () {
return {
image: this.baseUrl + 'wuweixiuzhangdan@3x.png',
......@@ -112,7 +121,7 @@ export default {
this.type = options.type
}
if (this.isEdit) {
if (this.isNormal) {
uni.$on('projects-changed', res => {
this.reloadList();
});
......@@ -122,7 +131,7 @@ export default {
this.reloadList();
},
onUnload () {
if (this.isEdit) {
if (this.isNormal) {
uni.$off('projects-changed');
}
},
......@@ -142,48 +151,6 @@ export default {
size: this.size,
})
.then(res => {
// var res = {
// data: {
// projects: [
// {
// id: '1',
// name: '张三子',
// money: '1000',
// time: '2022-02-03 11:11:11',
// },
// {
// id: '2',
// name: '李四',
// money: '2000',
// time: '2022-02-03 11:11:11',
// },
// {
// id: '3',
// name: '王五',
// money: '32000',
// time: '2022-02-03 11:11:11',
// },
// {
// id: '4',
// name: 'fdasfasf',
// money: '4000',
// time: '2022-02-03 11:11:11',
// },
// {
// id: '5',
// name: '成吉思汗',
// money: '5000',
// time: '2022-02-03 11:11:11',
// },
// {
// id: '6',
// name: '弗朗西斯科',
// money: '6000',
// time: '2022-02-03 11:11:11',
// }
// ]
// }
// }
let data = res.data;
if (this.current == 1) {
this.projects = [];
......@@ -211,7 +178,7 @@ export default {
})
.then(res => {
let data = res.data;
console.log('-----deleteProject--------', data)
console.log('-----deleteProject--------', data)
if (data) {
this.$refs.uToast.show({
title: '删除成功',
......@@ -235,14 +202,14 @@ export default {
})
.then(res => {
let data = res.data;
console.log('------recoveryProject-------', data)
console.log('------recoveryProject-------', data)
if (data) {
this.$refs.uToast.show({
title: '恢复成功',
type: 'success',
duration: 1500,
callback: () => {
uni.$emit('projects-changed', this.stringSelectedEmployees)
uni.$emit('projects-changed')
this.reloadList()
}
});
......@@ -254,11 +221,11 @@ export default {
});
},
editProject (params) {
editProject(params)
updateProject (params) {
updateProject(params)
.then(res => {
let data = res.data;
console.log('------reditProject-------', data)
console.log('------updateProject-------', data)
if (data) {
this.$refs.uToast.show({
title: '创建成功',
......@@ -293,19 +260,21 @@ export default {
this.getProjectList();
},
handleEditCell (employeeId) {
this.$u.route({
url: '/pages/workpoint/projects/project-create',
type: 'navigateTo',
params: {
memberId: employeeId
}
});
},
handleClickAction (id, action) {
this.currentPopInfo = this.popInfos[action]
this.currentPopInfo.projectId = id
this.visible = true
if (action == 'edit') {
this.$u.route({
url: '/pages/workpoint/projects/project-edit',
type: 'navigateTo',
params: {
projectId: id
}
});
} else {
this.currentPopInfo = this.popInfos[action]
this.currentPopInfo.projectId = id
this.visible = true
}
},
handleClickConfirm () {
switch (this.currentPopInfo.action) {
......@@ -336,7 +305,7 @@ export default {
});
uni.$once('input-sure-project-create', res => {
console.log(res)
this.editProject({
this.updateProject({
name: res.content
})
});
......
This diff is collapsed.
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