Commit 65d1c7b3 authored by 刘文虎's avatar 刘文虎
parents efeff16e 2d14b4ee
Pipeline #3571 canceled with stages
...@@ -80,4 +80,54 @@ export async function settleProject(data) { ...@@ -80,4 +80,54 @@ export async function settleProject(data) {
data, data,
noLoading: true noLoading: true
}) })
}
// 项目成员
export async function getProjectMembers(data) {
return request({
url: `/rest/project/member/page`,
method: 'GET',
data,
noLoading: true
})
}
// 项目成员
export async function getProjectMembersKnow(data) {
return request({
url: `/rest/project/member/all`,
method: 'GET',
data,
noLoading: true
})
}
// 新增、更新项目成员
export async function updateProjectMember(data) {
return request({
url: `/rest/project/member/save`,
method: 'POST',
data,
noLoading: true
})
}
// 项目成员信息
export async function getProjectMemberInfo(data) {
return request({
url: `/rest/project/member/info`,
method: 'GET',
data,
noLoading: true
})
}
// 删除项目成员
export async function deleteProjectMember(data) {
return request({
url: `/rest/project/member`,
method: 'DELETE',
data,
noLoading: true
})
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="left-view"> <view class="left-view">
<view class="image-view">{{ imagekName }}</view> <view class="image-view">{{ imagekName }}</view>
<view class="name-view">{{ member.name }}</view> <view class="name-view">{{ member.name }}</view>
<view class="info-view">{{ textInfo }}</view> <view :class="['info-view', {select: isSelect}]">{{ textInfo }}</view>
</view> </view>
<view class="right-view"> <view class="right-view">
<view v-if="isSelect" class="select-view" @click="$u.throttle(handleSelect, 500)" hover-class="u-hover-class"> <view v-if="isSelect" class="select-view" @click="$u.throttle(handleSelect, 500)" hover-class="u-hover-class">
...@@ -28,10 +28,10 @@ export default { ...@@ -28,10 +28,10 @@ export default {
type: Object, type: Object,
default () { default () {
return { return {
memberId: '', id: '',
name: '', name: '',
money: '', notSettleAmount: '',
phone: '', mobile: '',
} }
}, },
}, },
...@@ -62,25 +62,26 @@ export default { ...@@ -62,25 +62,26 @@ export default {
return this.baseUrl + 'bianjifuwufenlei@3x.png' return this.baseUrl + 'bianjifuwufenlei@3x.png'
}, },
textInfo () { textInfo () {
return this.isEdit ? this.member.phone : '¥' + formatCount(this.member.money || 0) var count = (Number(this.member.notSettleAmount || 0) == 0 ? '' : '¥' + formatCount(this.member.notSettleAmount || 0))
var mobile = this.member.mobile ? (this.member.mobile.substring(0, 3) + ' ' + this.member.mobile.substring(3, 7) + ' ' + this.member.mobile.substring(7, 11)) : ''
return this.isEdit ? count : mobile
} }
}, },
created () { }, created () { },
methods: { methods: {
handleClickButton () { handleClickButton () {
this.$emit('action', this.member.memberId) this.$emit('action', this.member.id)
}, },
handleSelect () { handleSelect () {
this.member.selected = !this.member.selected this.member.selected = !this.member.selected
console.log(this.member) this.$emit('select', this.member.id, this.member.selected)
this.$emit('select', this.member.memberId, this.member.selected)
}, },
}, },
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.cell-employee { .cell-employee {
padding: 32rpx 0 32rpx 24rpx; padding:28rpx 0 28rpx 24rpx;
min-height: 120rpx; min-height: 120rpx;
border-radius: 8rpx; border-radius: 8rpx;
background-color: #ffffff; background-color: #ffffff;
...@@ -109,12 +110,17 @@ export default { ...@@ -109,12 +110,17 @@ export default {
font-size: 26rpx; font-size: 26rpx;
} }
.info-view {} .info-view {
color: #fc524d;
&.select {
color: #333333;
}
}
.name-view { .name-view {
margin-right: 32rpx; margin-right: 32rpx;
margin-left: 24rpx; margin-left: 24rpx;
width: 120rpx; max-width: 120rpx;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
......
<template> <template>
<u-popup v-model="show" safe-area-inset-bottom mode="bottom" width="100%" border-radius="16" :closeable="false" @close="handleClose"> <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"> <view class="ppop-cwage-setting">
<WageSetting type="pop" :form="form" @close="handleClose" :fill.sync="canConfirm" @change="handleChange" /> <!-- v-if 可以清空上次填写 -->
<WageSetting v-if="visible" type="pop" :form="salary" @close="handleClose" :fill.sync="canConfirm" @change="handleChange" />
<view class="bottom-view"> <view class="bottom-view">
<u-button :custom-style="customConFirm" @click="handleClickSure" :loading="buttonLoading"> <u-button :custom-style="customConFirm" @click="handleClickSure" :loading="buttonLoading">
<view class="confirm-view">确定</view> <view class="confirm-view">确定</view>
...@@ -24,7 +25,7 @@ export default { ...@@ -24,7 +25,7 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
form: { form: { // 项目值
type: Object, type: Object,
default() { default() {
return { return {
...@@ -44,7 +45,17 @@ export default { ...@@ -44,7 +45,17 @@ export default {
return { return {
buttonLoading: false, buttonLoading: false,
show: false, show: false,
canConfirm: false canConfirm: false,
salary: { // 用户输入值
id: '',
normalUnitHours: '',
normalUnitMoney: '',
overHoursMoney: '',
overType: 'UNIT',
overUnitHours: '',
overUnitMoney: '',
projectId: '',
},
} }
}, },
computed: { computed: {
...@@ -60,9 +71,11 @@ export default { ...@@ -60,9 +71,11 @@ export default {
}, },
watch: { watch: {
visible(val) { visible(val) {
if (val && this.form.id) { // 老项目才用项目值刷新用户输入值;新项目保留用户输入值
this.salary = {...this.form}
}
this.show = val this.show = val
this.buttonLoading = false this.buttonLoading = false
console.log('-----created---0--', this.form)
}, },
}, },
created () { created () {
...@@ -73,13 +86,11 @@ export default { ...@@ -73,13 +86,11 @@ export default {
this.$emit('update:visible', false) this.$emit('update:visible', false)
}, },
handleChange (key, value) { handleChange (key, value) {
this.form[key] = value this.salary[key] = value
console.log('---handleChange----0---', key, value)
this.$emit('change', key, value)
}, },
handleClickSure () { handleClickSure () {
this.buttonLoading = true this.buttonLoading = true
this.$emit('sure', {...this.form}) this.$emit('sure', {...this.salary})
this.handleClose() this.handleClose()
} }
}, },
......
...@@ -93,7 +93,10 @@ export default { ...@@ -93,7 +93,10 @@ export default {
fontSize: '28rpx', fontSize: '28rpx',
textAlign: 'right', textAlign: 'right',
fontWeight: 'bold', fontWeight: 'bold',
padding: '0 16rpx' padding: '0 16rpx',
'background-color': '#f6f6f6',
'border-radius': '8rpx'
} }
}, },
isPop () { isPop () {
...@@ -122,18 +125,20 @@ export default { ...@@ -122,18 +125,20 @@ export default {
'overType', 'overType',
'overUnitHours', 'overUnitHours',
'overUnitMoney'] 'overUnitMoney']
} },
},
watch: {
form(value) {
this.$emit('update:fill', this.checkForm())
},
}, },
created () { created () {
}, },
methods: { methods: {
handleChange (key, value) { handleChange (key, value) {
this.form[key] = value
this.$emit('update:fill', this.checkForm())
this.$emit('change', key, value) this.$emit('change', key, value)
}, },
handleSelectType (type) { handleSelectType (type) {
console.log('-------', type)
this.handleChange('overType', type) this.handleChange('overType', type)
}, },
handleInput (value, key) { handleInput (value, key) {
...@@ -218,7 +223,8 @@ export default { ...@@ -218,7 +223,8 @@ export default {
line-height: 70rpx; line-height: 70rpx;
.input-view { .input-view {
width: 160rpx; width: 146rpx;
margin: 0 8rpx;
} }
.type-view { .type-view {
......
...@@ -19,19 +19,20 @@ ...@@ -19,19 +19,20 @@
</view> </view>
</view> </view>
</view> </view>
<WageSetting :form="form" :fill.sync="canConfirm" @change="handleChange"/> <WageSetting :form="form" :fill.sync="fill" @change="handleChange"/>
</view> </view>
<view :class="['bottom-view', {edit: memberId}]"> <view :class="['bottom-view', {edit: memberId}]">
<u-button v-if="memberId" :custom-style="customDelete" @click="handleClickDelete" class="delete-button"> <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>
<u-button :custom-style="customConFirm" @click="handleClickConFirm" :loading="buttonLoading"> <u-button :custom-style="customConFirm" @click="handleClickConfirm" :loading="buttonLoading">
<view class="confirm-view">保存</view> <view class="confirm-view">保存</view>
</u-button> </u-button>
</view> </view>
<view class="loading-view" v-if="loading"> <view class="loading-view" v-if="loading">
<u-loading mode="flower"></u-loading> <u-loading mode="flower"></u-loading>
</view> </view>
<PopNormal :visible.sync="visible" title="删除提醒" content="确认删除该成员吗?" @confirm="handleClickSure" />
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
...@@ -39,13 +40,15 @@ ...@@ -39,13 +40,15 @@
<script> <script>
import NavbarRight from '@/components/navbar-right' import NavbarRight from '@/components/navbar-right'
import WageSetting from './components/wage-setting' import WageSetting from './components/wage-setting'
import PopNormal from '@/components/pop-normal';
import { repairDetail } from '@/api/maintain/index.js'; import { updateProjectMember,getProjectMemberInfo,deleteProjectMember, getProjectSalary } from '@/api/project/index.js';
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
WageSetting WageSetting,
PopNormal
}, },
data () { data () {
return { return {
...@@ -63,7 +66,8 @@ export default { ...@@ -63,7 +66,8 @@ export default {
}, },
loading: false, loading: false,
buttonLoading: false, buttonLoading: false,
canConfirm: false, fill: false,
visible: false,
} }
}, },
computed: { computed: {
...@@ -100,6 +104,9 @@ export default { ...@@ -100,6 +104,9 @@ export default {
'border-radius': '16rpx', 'border-radius': '16rpx',
width: this.memberId ? '470rpx' : '686rpx', width: this.memberId ? '470rpx' : '686rpx',
} }
},
canConfirm() {
return this.fill && this.form.memberName && this.form.memberMobile
} }
}, },
onLoad (options) { onLoad (options) {
...@@ -109,24 +116,24 @@ export default { ...@@ -109,24 +116,24 @@ export default {
if (options && options.memberId) { if (options && options.memberId) {
this.memberId = options.memberId this.memberId = options.memberId
this.loading = true this.loading = true
this.repairDetail() this.getProjectMemberInfo() // 编辑就优先个人工资设置,没有再调项目工资设置
} else {
this.getProjectSalary() // 新建就直接用项目工资设置
} }
}, },
methods: { methods: {
repairDetail() { getProjectMemberInfo() {
// 测试数据
this.loading = false
this.setForm()
return
this.loading = true; this.loading = true;
repairDetail({ getProjectMemberInfo({
id: this.memberId projectId: this.projectId,
memberId: this.memberId,
}) })
.then(res => { .then(res => {
if (res.data) { if (res.data) {
this.setForm(res.data); this.setForm(res.data);
if (Number(res.data.normalUnitHours || 0) == 0) {
this.getProjectSalary()
}
} }
this.loading = false; this.loading = false;
}) })
...@@ -136,25 +143,106 @@ export default { ...@@ -136,25 +143,106 @@ export default {
}, },
setForm(data) { setForm(data) {
this.form = { this.form = {
memberId: data.memberId, memberId: [this.memberId],
projectId: data.projectId, projectId: this.projectId,
memberName: data.memberName, memberName: data.name,
memberMobile: data.memberMobile, memberMobile: data.mobile,
normalUnitHours : data.normalUnitHours, normalUnitHours : data.normalUnitHours,
normalUnitMoney : data.normalUnitMoney, normalUnitMoney : data.normalUnitMoney,
overHoursMoney : data.overHoursMoney, overHoursMoney : data.overHoursMoney,
overType : data.overType, overType : data.overType.code,
overUnitHours : data.overUnitHours, overUnitHours : data.overUnitHours,
overUnitMoney : data.overUnitMoney, overUnitMoney : data.overUnitMoney,
}; };
}, },
getProjectSalary () {
this.loading = true;
getProjectSalary({
id: this.projectId
})
.then(res => {
if (res.data) {
this.setSalary(res.data)
}
this.loading = false;
})
.catch(res => {
this.loading = false;
});
},
setSalary (data) {
this.form.normalUnitHours = data.normalUnitHours
this.form.normalUnitMoney = data.normalUnitMoney
this.form.overHoursMoney = data.overHoursMoney
this.form.overType = data.overType.code
this.form.overUnitHours = data.overUnitHours
this.form.overUnitMoney = data.overUnitMoney
},
handleChange(key, value) { handleChange(key, value) {
this.form[key] = value this.form[key] = value
}, },
handleClickDelete() { handleClickDelete() {
this.visible = true
} },
handleClickSure() {
this.deleteProjectMember()
},
handleClickConfirm() {
this.updateProjectMember()
},
deleteProjectMember() {
deleteProjectMember({
memberId: this.memberId,
projectId: this.projectId
})
.then(res => {
if (res.data) {
this.$refs.uToast.show({
title: '删除成功',
type: 'success',
duration: 1500,
callback: () => {
this.goBack()
}
});
}
})
.catch(res => {
});
},
updateProjectMember() {
this.buttonLoading = true
if (!this.form.projectId) {
this.form.projectId = this.projectId
}
updateProjectMember(this.form)
.then(res => {
if (res.data) {
this.$refs.uToast.show({
title: '保存成功',
type: 'success',
duration: 1500,
callback: () => {
this.goBack()
}
});
}
})
.catch(res => {
this.buttonLoading = false
});
},
goBack () {
uni.$emit('employees-changed')
uni.$emit('project-detail')
this.$u.route({
type: 'navigateBack',
params: {
}
})
},
}, },
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<NavbarRight title="项目管理" /> <NavbarRight title="项目管理" />
<view class="content-view"> <view class="content-view">
<view class="info-view"> <view class="info-view">
<view class="part-view" hover-class="u-cell-class" @click="$u.throttle(handleClickName, 500)"> <view class="part-view" hover-class="u-hover-class" @click="$u.throttle(handleClickName, 500)">
<view class="label-view">项目名称</view> <view class="label-view">项目名称</view>
<view class="value-view"> <view class="value-view">
<view>{{form.name}}</view> <view>{{form.name}}</view>
...@@ -11,26 +11,26 @@ ...@@ -11,26 +11,26 @@
</view> </view>
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
<view class="part-view" hover-class="u-cell-class" @click="$u.throttle(handleClicSalary, 500)"> <view class="part-view" hover-class="u-hover-class" @click="$u.throttle(handleClicSalary, 500)">
<view class="label-view">点工工资</view> <view class="label-view">点工工资</view>
<view class="value-view"> <view class="value-view">
<view v-if="salary">已设置</view> <view v-if="salary.id">已设置</view>
<view v-else class="no-info">未设置</view> <view v-else class="no-info">未设置</view>
<u-icon class="icon-view" name="arrow-right" color="#CCCCCC" size="24"></u-icon> <u-icon class="icon-view" name="arrow-right" color="#CCCCCC" size="24"></u-icon>
</view> </view>
</view> </view>
</view> </view>
<view class="info-view"> <view class="info-view">
<view class="part-view" hover-class="u-cell-class" @click="$u.throttle(handleClickMember, 500)"> <view class="part-view" hover-class="u-hover-class" @click="$u.throttle(handleClickMember, 500)">
<view class="label-view">项目成员</view> <view class="label-view">项目成员</view>
<view class="value-view"> <view class="value-view">
<view v-if="memberCount">{{memberCount}}</view> <view v-if="form.memberCount">{{form.memberCount}}</view>
<view v-else class="no-info">未选择</view> <view v-else class="no-info">未选择</view>
<u-icon class="icon-view" name="arrow-right" color="#CCCCCC" size="24"></u-icon> <u-icon class="icon-view" name="arrow-right" color="#CCCCCC" size="24"></u-icon>
</view> </view>
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
<view class="part-view" hover-class="u-cell-class" @click="$u.throttle(handleClicBill, 500)"> <view class="part-view" hover-class="u-hover-class" @click="$u.throttle(handleClicBill, 500)">
<view class="label-view">项目账单</view> <view class="label-view">项目账单</view>
<view class="value-view"> <view class="value-view">
<view class="settle-view" v-if="notSettleAmount">{{notSettleAmount}}</view> <view class="settle-view" v-if="notSettleAmount">{{notSettleAmount}}</view>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<view class="loading-view" v-if="loading"> <view class="loading-view" v-if="loading">
<u-loading mode="flower"></u-loading> <u-loading mode="flower"></u-loading>
</view> </view>
<PopWageSetting :form="salary" :visible.sync="visible" @change="handleChange" @sure="handleClickSure" /> <PopWageSetting :form="salary" :visible.sync="visible" @sure="handleClickSure" />
<PopNormal :visible.sync="visiblePop" :loadingShow="true" :title="currentPopInfo.title" <PopNormal :visible.sync="visiblePop" :loadingShow="true" :title="currentPopInfo.title"
:content="currentPopInfo.content" @confirm="handleClickConfirm" /> :content="currentPopInfo.content" @confirm="handleClickConfirm" />
<u-toast ref="uToast" /> <u-toast ref="uToast" />
...@@ -60,15 +60,17 @@ ...@@ -60,15 +60,17 @@
<script> <script>
import NavbarRight from '@/components/navbar-right' import NavbarRight from '@/components/navbar-right'
import PopNormal from '@/components/pop-normal'
import PopWageSetting from '@/pages/workpoint/employees/components/pop-wage-setting' import PopWageSetting from '@/pages/workpoint/employees/components/pop-wage-setting'
import { formatCount } from '@/utils/common.js'; import { formatCount } from '@/utils/common.js';
import { getProjectDetail, getProjectSalary, setProjectSalary, updateProject } from '@/api/project/index.js'; import { getProjectDetail, getProjectSalary, setProjectSalary, updateProject, deleteProject } from '@/api/project/index.js';
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
PopWageSetting PopWageSetting,
PopNormal
}, },
data () { data () {
return { return {
...@@ -79,13 +81,21 @@ export default { ...@@ -79,13 +81,21 @@ export default {
memberCount: '', memberCount: '',
notSettleAmount: '', notSettleAmount: '',
}, },
salary: null, salary: {
id: '',
normalUnitHours: '',
normalUnitMoney: '',
overHoursMoney: '',
overType: 'UNIT',
overUnitHours: '',
overUnitMoney: '',
projectId: '',
},
loading: false, loading: false,
buttonLoading: false, buttonLoading: false,
visible: false, visible: false,
currentPopInfo: {}, currentPopInfo: {},
visiblePop: false visiblePop: false,
} }
}, },
computed: { computed: {
...@@ -115,24 +125,12 @@ export default { ...@@ -115,24 +125,12 @@ export default {
customConFirm () { customConFirm () {
return { return {
color: 'transparent', color: 'transparent',
'background-color': this.canConfirm ? '#02a074' : '#7DCFB8', 'background-color': '#02a074',
height: '104rpx', height: '104rpx',
'border-radius': '16rpx', 'border-radius': '16rpx',
width: '330rpx', width: '330rpx',
} }
}, },
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
},
canClosed () { canClosed () {
return Number(this.form.notSettleAmount || 0) != 0 return Number(this.form.notSettleAmount || 0) != 0
}, },
...@@ -229,14 +227,7 @@ export default { ...@@ -229,14 +227,7 @@ export default {
setProjectSalary(params) setProjectSalary(params)
.then(res => { .then(res => {
if (res.data) { if (res.data) {
uni.$emit('projects-changed') this.setSuccess()
this.$refs.uToast.show({
title: '设置成功',
type: 'success',
duration: 1500,
callback: () => {
}
});
} }
}) })
.catch(res => { .catch(res => {
...@@ -299,14 +290,13 @@ export default { ...@@ -299,14 +290,13 @@ export default {
}); });
uni.$once('input-sure-project-create', res => { uni.$once('input-sure-project-create', res => {
this.form.name = res.content this.form.name = res.content
this.updateProject({...this.form}) this.updateProject({ ...this.form })
}); });
}, },
updateProject (params) { updateProject (params) {
updateProject(params) updateProject(params)
.then(res => { .then(res => {
let data = res.data; let data = res.data;
console.log('------updateProject-------', data)
if (data) { if (data) {
this.setSuccess() this.setSuccess()
} }
...@@ -317,16 +307,16 @@ export default { ...@@ -317,16 +307,16 @@ export default {
}); });
}, },
setSuccess() { setSuccess () {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '设置成功', title: '设置成功',
type: 'success', type: 'success',
duration: 1500, duration: 1500,
callback: () => { callback: () => {
this.reloadList() this.reloadList()
uni.$emit('projects-changed') uni.$emit('projects-changed')
} }
}); });
}, },
handleClicSalary () { handleClicSalary () {
this.visible = true this.visible = true
...@@ -352,16 +342,13 @@ export default { ...@@ -352,16 +342,13 @@ export default {
handleClickSure (form) { handleClickSure (form) {
this.setProjectSalary(form) this.setProjectSalary(form)
}, },
handleChange(key, value) {
this.salary[key] = value
},
handleClickDelete () { handleClickDelete () {
this.currentPopInfo = this.popInfos[0] this.currentPopInfo = this.popInfos[0]
this.visible = true this.visiblePop = true
}, },
handleClickSetting () { handleClickSetting () {
this.currentPopInfo = this.popInfos[1] this.currentPopInfo = this.popInfos[1]
this.visible = true this.visiblePop = true
}, },
handleClickConfirm () { handleClickConfirm () {
switch (this.currentPopInfo.action) { switch (this.currentPopInfo.action) {
......
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