Commit d4c5ce11 authored by Facius's avatar Facius

feat: 人员创建

parent 6505881f
...@@ -43,7 +43,6 @@ export default { ...@@ -43,7 +43,6 @@ export default {
watch: { watch: {
visible(val) { visible(val) {
this.show = val this.show = val
console.log('----------------',this.images)
}, },
}, },
methods: { methods: {
......
...@@ -7,26 +7,11 @@ ...@@ -7,26 +7,11 @@
<view class="info-view">{{ textInfo }}</view> <view class="info-view">{{ textInfo }}</view>
</view> </view>
<view class="right-view"> <view class="right-view">
<view <view v-if="isSelect" class="select-view" @click="$u.throttle(handleSelect, 500)" hover-class="u-hover-class">
v-if="isSelect" <u-icon v-if="member.selected" name="checkmark-circle-fill" color="#02A074" size="42"></u-icon>
class="select-view"
@click="$u.throttle(handleSelect, 500)"
hover-class="u-hover-class"
>
<u-icon
v-if="member.selected"
name="checkmark-circle-fill"
color="#02A074"
size="42"
></u-icon>
<view v-else class="select-icon"></view> <view v-else class="select-icon"></view>
</view> </view>
<view <view v-if="isEdit" class="edit-view" @click="$u.throttle(handleClickButtoon, 500)" hover-class="u-hover-class">
v-if="isEdit"
class="edit-view"
@click="$u.throttle(handleClickButtoon, 500)"
hover-class="u-hover-class"
>
<image :src="editImage" class="edit-image"></image> <image :src="editImage" class="edit-image"></image>
</view> </view>
</view> </view>
...@@ -41,7 +26,7 @@ export default { ...@@ -41,7 +26,7 @@ export default {
props: { props: {
member: { member: {
type: Object, type: Object,
default() { default () {
return { return {
memberId: '', memberId: '',
name: '', name: '',
...@@ -56,36 +41,36 @@ export default { ...@@ -56,36 +41,36 @@ export default {
default: 'edit', default: 'edit',
}, },
}, },
data() { data () {
return {} return {}
}, },
computed: { computed: {
baseUrl() { baseUrl () {
return process.uniEnv.qn_base_url return process.uniEnv.qn_base_url
}, },
imagekName() { imagekName () {
var length = (this.member.name || '').length var length = (this.member.name || '').length
return (this.member.name || '').substring(length - 2) return (this.member.name || '').substring(length - 2)
}, },
isSelect() { isSelect () {
return this.type == 'select' return this.type == 'select'
}, },
isEdit() { isEdit () {
return this.type == 'edit' return this.type == 'edit'
}, },
editImage() { editImage () {
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) return this.isEdit ? this.member.phone : '¥' + formatCount(this.member.money || 0)
} }
}, },
created() {}, created () { },
methods: { methods: {
handleClickButtoon() { handleClickButtoon () {
this.$emit('action', this.memberId) this.$emit('action', this.member.memberId)
}, },
handleSelect() { handleSelect () {
this.member.selected = !this.member.selected this.member.selected = !this.member.selected
console.log(this.member) console.log(this.member)
this.$emit('select', this.member.memberId, this.member.selected) this.$emit('select', this.member.memberId, this.member.selected)
...@@ -99,16 +84,19 @@ export default { ...@@ -99,16 +84,19 @@ export default {
min-height: 120rpx; min-height: 120rpx;
border-radius: 8rpx; border-radius: 8rpx;
background-color: #ffffff; background-color: #ffffff;
.content-view { .content-view {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.left-view { .left-view {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 28rpx; font-size: 28rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
.image-view { .image-view {
width: 72rpx; width: 72rpx;
height: 72rpx; height: 72rpx;
...@@ -120,29 +108,32 @@ export default { ...@@ -120,29 +108,32 @@ export default {
color: #ffffff; color: #ffffff;
font-size: 26rpx; font-size: 26rpx;
} }
.info-view {
} .info-view {}
.name-view { .name-view {
margin-right: 32rpx; margin-right: 32rpx;
margin-left: 24rpx; margin-left: 24rpx;
width: 120rpx; width: 120rpx;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
} }
.right-view { .right-view {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
flex: 1; flex: 1;
.select-view { .select-view {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.select-icon { .select-icon {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
...@@ -151,12 +142,14 @@ export default { ...@@ -151,12 +142,14 @@ export default {
} }
} }
} }
.edit-view { .edit-view {
width: 80rpx; width: 80rpx;
height: 72rpx; height: 72rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.edit-image { .edit-image {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
......
<template>
<u-popup v-model="show" safe-area-inset-bottom mode="bottom" width="100%" border-radius="16" :closeable="false" @close="handleChange">
<view class="ppop-cwage-setting">
<WageSetting type="pop" :form="form" :visible.sync="visible" @close="handleClose" @change="handleChange" />
<view class="bottom-view">
<u-button :custom-style="customConFirm" @click="handleClickSure" :loading="buttonLoading">
<view class="confirm-view">确定</view>
</u-button>
</view>
</view>
</u-popup>
</template>
<script>
import WageSetting from './wage-setting'
export default {
components: {
WageSetting
},
props: {
visible: {
type: Boolean,
default: false,
},
},
data () {
return {
form: {
hour: '',
unit: '',
type: 'day', // day;hour
overHour: '',
overUnit: '',
},
buttonLoading: false,
show: false,
}
},
computed: {
customConFirm () {
return {
color: 'transparent',
'background-color': this.canConfirm ? '#02a074' : '#7DCFB8',
height: '104rpx',
'border-radius': '16rpx',
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
},
},
created () { },
methods: {
handleClose () {
this.show = false
this.$emit('update:visible', false)
},
handleChange (key, value) {
this.form[key] = value
},
handleClickSure () {
this.buttonLoading = true
this.$emit('sure', this.form)
}
},
}
</script>
<style scoped lang="scss">
.ppop-cwage-setting {
background-color: #ffffff;
padding: 8rpx;
.bottom-view {
margin: 16rpx 24rpx 36rpx 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
.confirm-view {
color: #ffffff;
height: 104rpx;
line-height: 104rpx;
font-weight: bold;
font-size: 32rpx;
}
}
}
</style>
<template>
<view class="cwage-setting">
<view v-if="isPop" class="close-view" hover-class="u-hover-class" @click="$u.throttle(handleClose, 500)">
<u-icon name="close" color="#333333" size="24"></u-icon>
</view>
<view class="content-view">
<view class="title-view">{{title}}</view>
<view class="part-view">
<view class="label-view">上班</view>
<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')" />
</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')" />
</view>
<view>元 = 1个工</view>
</view>
</view>
<view class="line-view"></view>
<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>
</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="input-view">
<u-input type="digit" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.overHour" placeholder="输入数值" @input="handleInput($event, 'overHour')" />
</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')" />
</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')" />
</view>
<view>元/小时</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
form: {
type: Object,
default () {
return {
hour: '',
unit: '',
type: 'day', // day;hour
overHour: '',
overUnit: '',
}
},
},
type: {
type: String,
default: 'normal',
},
},
data () {
return {}
},
computed: {
placeholderStyle () {
return 'color:#ccc;font-size:28rpx;font-weight: bold;'
},
customStyle () {
return {
fontSize: '28rpx',
textAlign: 'right',
fontWeight: 'bold',
padding: '0 16rpx'
}
},
isPop () {
return this.type == 'pop'
},
title () {
return this.isPop ? '工资设置' : '工资设置(点工)'
},
labels () {
return [{
name: '按工天算',
type: 'day'
}, {
name: '按小时算',
type: 'hour'
}]
},
},
created () { },
methods: {
handleChange (key, value) {
this.$emit('change', key, value)
},
handleSelectType (type) {
this.handleChange('type', type)
},
handleInput (value, key) {
this.handleChange(key, value)
},
handleClose () {
console.log('---handleClose-----')
this.$emit('close')
}
},
}
</script>
<style scoped lang="scss">
.cwage-setting {
min-height: 120rpx;
border-radius: 16rpx;
background-color: #ffffff;
color: #333333;
position: relative;
.close-view {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
width: 80rpx;
height: 80rpx;
right: 0;
top: 0;
z-index: 999;
}
.content-view {
padding: 0 24rpx;
position: relative;
.title-view {
font-size: 28rpx;
font-weight: bold;
padding: 32rpx 0 8rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.line-view {
background-color: #F6F7FA;
height: 2rpx;
width: 100%;
}
.part-view {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
color: #333333;
padding: 20rpx 0;
&.type {
padding: 40rpx 0;
}
.label-view {
height: 70rpx;
line-height: 70rpx;
}
.value-view {
display: flex;
align-items: center;
justify-content: flex-end;
height: 70rpx;
line-height: 70rpx;
.input-view {
width: 160rpx;
}
.type-view {
width: 202rpx;
height: 80rpx;
border-radius: 8rpx;
background-color: #F6F7FA;
color: #8D8D8D;
font-size: 28rpx;
font-weight: bold;
margin-left: 24rpx;
text-align: center;
line-height: 80rpx;
&.selected {
background-color: #02A074;
color: #FFFFFF;
}
}
}
}
}
}
</style>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<view class="info-view"> <view class="info-view">
<view class="part-view"> <view class="part-view">
<view class="label-view">姓名</view> <view class="label-view">姓名</view>
<view class="name-input"> <view class="value-view">
<u-input type="text" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle" <u-input type="text" :clearable="false" :custom-style="customStyle" :placeholder-style="placeholderStyle"
v-model="form.name" placeholder="填写成员姓名" /> v-model="form.name" placeholder="填写成员姓名" />
</view> </view>
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
</view> </view>
</view> </view>
</view> </view>
<WageSetting :form="form" @change="handleChange"/>
</view> </view>
<view class="bottom-view"> <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>
...@@ -37,10 +38,14 @@ ...@@ -37,10 +38,14 @@
<script> <script>
import NavbarRight from '@/components/navbar-right' import NavbarRight from '@/components/navbar-right'
import WageSetting from './components/wage-setting'
import { repairDetail } from '@/api/maintain/index.js';
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
WageSetting
}, },
data () { data () {
return { return {
...@@ -48,6 +53,11 @@ export default { ...@@ -48,6 +53,11 @@ export default {
form: { form: {
name: '', name: '',
phone: '', phone: '',
hour: '',
unit: '',
type: '', // day;hour
overHour: '',
overUnit: '',
}, },
loading: false, loading: false,
buttonLoading: false, buttonLoading: false,
...@@ -89,6 +99,15 @@ export default { ...@@ -89,6 +99,15 @@ export default {
} }
}, },
canConfirm () { 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 return true
}, },
}, },
...@@ -96,10 +115,47 @@ export default { ...@@ -96,10 +115,47 @@ 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()
}
},
methods: {
repairDetail() {
// 测试数据
this.loading = false
this.setForm()
return
this.loading = true;
repairDetail({
id: this.memberId
})
.then(res => {
if (res.data) {
this.setForm(res.data);
}
this.loading = false;
})
.catch(res => {
this.loading = false;
});
},
setForm(data) {
this.form = {
memberId: this.memberId,
name: '张三',
phone: '18766666666',
hour: '2',
unit: '3',
type: 'day', // day;hour
overHour: '4',
overUnit: '4',
};
},
handleChange(key, value) {
this.form[key] = value
} }
}, },
methods: {},
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
...@@ -118,7 +174,7 @@ export default { ...@@ -118,7 +174,7 @@ export default {
padding: 0 24rpx; padding: 0 24rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
margin-bottom: 24rpx;
.line-view { .line-view {
background-color: #F6F7FA; background-color: #F6F7FA;
height: 2rpx; height: 2rpx;
...@@ -146,8 +202,9 @@ export default { ...@@ -146,8 +202,9 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
width: 100%; &.edit {
margin: 16rpx 24rpx 36rpx 24rpx;
}
.confirm-view { .confirm-view {
color: #ffffff; color: #ffffff;
height: 104rpx; height: 104rpx;
...@@ -157,7 +214,7 @@ export default { ...@@ -157,7 +214,7 @@ export default {
} }
.delete-button { .delete-button {
margin-left: 32rpx; // margin-right: 32rpx;
} }
.delete-view { .delete-view {
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
<u-loading mode="flower"></u-loading> <u-loading mode="flower"></u-loading>
</view> </view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
<PopWageSetting :form="form" :visible.sync="visible" @sure="handleClickSure"/>
</view> </view>
</template> </template>
...@@ -48,13 +49,16 @@ ...@@ -48,13 +49,16 @@
import NavbarRight from '@/components/navbar-right'; import NavbarRight from '@/components/navbar-right';
import CellEmployee from './components/cell-employee'; import CellEmployee from './components/cell-employee';
import NoData from '@/components/no-data'; import NoData from '@/components/no-data';
import { repair, repairStatistical } from '@/api/maintain/index.js'; import PopWageSetting from './components/pop-wage-setting'
import { repair } from '@/api/maintain/index.js';
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
CellEmployee, CellEmployee,
NoData NoData,
PopWageSetting
}, },
data () { data () {
return { return {
...@@ -67,7 +71,15 @@ export default { ...@@ -67,7 +71,15 @@ export default {
freshing: false, freshing: false,
current: 1, current: 1,
size: 10, size: 10,
selectedMembers: [] selectedMembers: [],
form: {
hour: '',
unit: '',
type: 'day',
overHour: '',
overUnit: '',
},
visible: false,
}; };
}, },
computed: { computed: {
...@@ -274,10 +286,10 @@ export default { ...@@ -274,10 +286,10 @@ export default {
}, },
handleEditCell (employeeId) { handleEditCell (employeeId) {
this.$u.route({ this.$u.route({
url: '/pages/employees/employee-create', url: '/pages/workpoint/employees/employee-create',
type: 'navigateTo', type: 'navigateTo',
params: { params: {
employeeId: employeeId memberId: employeeId
} }
}); });
}, },
...@@ -308,6 +320,10 @@ export default { ...@@ -308,6 +320,10 @@ export default {
}, },
handleClickConFirm () { handleClickConFirm () {
// this.stringSelectedEmployees // this.stringSelectedEmployees
this.visible = true
},
handleClickSure(form) {
console.log('----handleClickSure-------', form)
} }
} }
}; };
...@@ -379,8 +395,6 @@ export default { ...@@ -379,8 +395,6 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%;
.confirm-view { .confirm-view {
color: #ffffff; color: #ffffff;
height: 104rpx; height: 104rpx;
......
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