|
@@ -0,0 +1,87 @@
|
|
|
+<template>
|
|
|
+ <m-dialog ref="editDialog" v-bind="$attrs" @sure="handleSaveEdit">
|
|
|
+ <m-form ref="formRef" :items="items" v-model="query"></m-form>
|
|
|
+ </m-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { saveRoster } from '@/api/system'
|
|
|
+export default {
|
|
|
+ name: 'roster-edit',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ items: [
|
|
|
+ { label: '上级机构', prop: 'parentOrganizationName', type: 'input', options: { placeholder: '请输入上级机构' }, rules: { required: true, message: '请输入上级机构', trigger: 'blur' } },
|
|
|
+ { label: '部门名称', prop: 'deptName', type: 'input', options: { placeholder: '请输入部门名称' }, rules: { required: true, message: '请输入部门名称', trigger: 'blur' } },
|
|
|
+ { label: '员工名称', prop: 'employeeName', type: 'input', options: { placeholder: '请输入员工名称' }, rules: { required: true, message: '请输入员工名称', trigger: 'blur' } },
|
|
|
+ { label: '人员类别', prop: 'personnelCategory', type: 'input', options: { placeholder: '请输入人员类别' }, rules: { required: true, message: '请输入人员类别', trigger: 'blur' } },
|
|
|
+ { label: '岗位名称', prop: 'postName', type: 'input', options: { placeholder: '请输入岗位名称' }, rules: { required: true, message: '请输入岗位名称', trigger: 'blur' } },
|
|
|
+ { label: '岗位序列', prop: 'positionSequence', type: 'input', options: { placeholder: '请输入岗位序列' }, rules: [{ required: true, message: '请输入岗位序列', trigger: 'blur' }] },
|
|
|
+ { label: '岗位类别', prop: 'positionCategory', type: 'input', options: { placeholder: '请输入岗位类别' }, rules: [{ required: true, message: '请输入岗位类别', trigger: 'blur' }] },
|
|
|
+ { label: '职务层级', prop: 'jobLevel', type: 'input', options: { placeholder: '请输入职务层级' }, rules: [{ required: true, message: '请输入职务层级', trigger: 'blur' }] },
|
|
|
+ { label: '通行证号', prop: 'passes', type: 'input', options: { placeholder: '请输入通行证号' }, rules: [{ required: true, message: '请输入通行证号', trigger: 'blur' }] },
|
|
|
+ {
|
|
|
+ label: '工行时间',
|
|
|
+ prop: 'tradeUnionsTime',
|
|
|
+ type: 'datePicker',
|
|
|
+ options: { placeholder: '请选择工行时间' },
|
|
|
+ rules: [{ required: true, message: '请选择工行时间', trigger: 'blur' }]
|
|
|
+ },
|
|
|
+ { label: '薪酬档次', prop: 'salaryCategory', type: 'number', options: { placeholder: '薪酬档次' }, rules: [{ required: true, message: '请输入薪酬档次', trigger: 'blur' }] },
|
|
|
+ { label: '薪酬级别', prop: 'salaryLevel', type: 'number', options: { placeholder: '薪酬级别' }, rules: [{ required: true, message: '请输入薪酬级别', trigger: 'blur' }] }
|
|
|
+ ],
|
|
|
+ query: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.init()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init () {
|
|
|
+ this.query = this.items.reduce((res, item) => {
|
|
|
+ res[item.prop] = null
|
|
|
+ return res
|
|
|
+ }, {})
|
|
|
+ },
|
|
|
+ open (item) {
|
|
|
+ if (item) {
|
|
|
+ Object.keys(this.query).forEach(key => {
|
|
|
+ this.query[key] = item[key]
|
|
|
+ })
|
|
|
+ this.query.personnelCode = item.personnelCode
|
|
|
+ } else {
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
+ this.$refs.editDialog.open()
|
|
|
+ },
|
|
|
+ handleSaveEdit () {
|
|
|
+ this.$refs.formRef.validate(async valid => {
|
|
|
+ if (!valid) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const { tradeUnionsTime, ...obj } = this.query
|
|
|
+ const date = new Date(tradeUnionsTime)
|
|
|
+ // 获取年、月、日
|
|
|
+ const year = date.getFullYear()
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0') // 月份从0开始,所以要加1
|
|
|
+ const day = String(date.getDate()).padStart(2, '0')
|
|
|
+ try {
|
|
|
+ await saveRoster({
|
|
|
+ ...obj,
|
|
|
+ tradeUnionsTime: `${year}${month}${day}`
|
|
|
+ })
|
|
|
+ this.$message.success('保存成功')
|
|
|
+ this.$refs.editDialog.close()
|
|
|
+ this.$emit('refresh')
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+
|
|
|
+</style>
|