123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <template>
- <m-dialog title="分润认领" ref="dialog" @sure="onSure">
- <m-form ref="form" :items="formItems" v-model="formValues" v-loading="loading"></m-form>
- </m-dialog>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- export default {
- name: 'ClaimForm',
- data () {
- return {
- formValues: {
- serialNumber: null,
- unifiedCertificationNumber: null,
- organizationNo: null,
- employeeProfitSharingRatio: null
- },
- itemData: {},
- filterLoading: false,
- loading: false,
- items: []
- }
- },
- computed: {
- ...mapGetters(['organizationTree']),
- organizationItems () {
- if (this.organizationTree.length > 0) {
- return this.organizationTree[0].child
- }
- return []
- },
- formItems () {
- return [
- {
- label: '所属机构',
- prop: 'organizationNo',
- type: 'cascader',
- rules: [
- { required: true, message: '请选择所属机构', trigger: 'change' }
- ],
- options: {
- ref: 'organizationNo',
- filterable: true,
- clearable: true,
- placeholder: '请选择所属机构',
- options: this.organizationItems,
- showAllLevels: false,
- props: {
- emitPath: false,
- checkStrictly: true,
- value: 'organizationNo',
- label: 'organizationName',
- children: 'child'
- }
- },
- handles: {
- change: (v) => {
- const nodes = this.$refs.form.$refs.organizationNo.getCheckedNodes()
- console.log(nodes[0].data.organizationNo, '选中机构编码')
- // this.formValues.organizationNo = nodes[0].data.organizationNo
- // this.formValues.organizationName = nodes[0].data.organizationName
- }
- }
- },
- {
- label: '分润员工',
- prop: 'unifiedCertificationNumber',
- type: 'select',
- options: {
- placeholder: '请选择分润员工',
- filterable: true,
- remote: true,
- labelText: 'employeeName',
- labelValue: 'personnelCode',
- valueKey: 'personnelCode',
- defaultFirstOption: true,
- loading: this.filterLoading,
- items: []
- },
- // handles: {
- // change: (v) => {
- // const item = this.items.find(e => e.personnelCode === v)
- // this.formValues.employeeName = item.employeeName
- // this.formValues.employeeCode = item.personnelCode
- // }
- // },
- rules: [
- { required: true, message: '请选择分润员工', trigger: 'change' }
- ]
- }
- // employeeProfitSharingRatio
- ]
- }
- },
- methods: {
- async open (item) {
- console.log(item, '分润认领')
- this.loading = true
- this.$refs.dialog.open()
- // if (!item) {
- // this.itemData = {}
- // this.formValues = {
- // employeeCode: null,
- // employeeName: null,
- // organizationNo: null,
- // organizationName: null
- // }
- // } else {
- // await this.remoteMethod(item.employeeName)
- // this.itemData = item
- // this.formValues = {
- // employeeCode: item.employeeCode,
- // organizationName: item.organizationName,
- // organizationNo: item.organizationNo,
- // employeeName: item.employeeName
- // }
- // }
- this.formValues.serialNumber = item.serialNumber
- this.$nextTick(() => {
- this.$refs.form.clearValidate()
- this.loading = false
- })
- },
- onSure () {
- this.$refs.form.validate(async valid => {
- if (!valid) {
- return
- }
- console.log(this.formValues, 'submit')
- // this.loading = true
- // try {
- // await saveAllocationConfig({
- // performanceSalaryManageEmployeeId: this.itemData.performanceSalaryManageEmployeeId,
- // ...this.formValues
- // })
- // this.$refs.dialog.close()
- // this.$message.success('操作成功')
- // this.$emit('success')
- // } catch (error) {
- // this.$message.error(error)
- // } finally {
- // this.loading = false
- // }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|