|
@@ -1,96 +1,88 @@
|
|
<template>
|
|
<template>
|
|
<m-dialog ref="dialog" title="积分申报" @sure="onSure">
|
|
<m-dialog ref="dialog" title="积分申报" @sure="onSure">
|
|
- <m-card shadow="never" v-loading="loading" style="min-height: 500px">
|
|
|
|
- <template v-if="finished">
|
|
|
|
- <el-descriptions
|
|
|
|
- :column="1"
|
|
|
|
- :labelStyle="{
|
|
|
|
- width: '200px',
|
|
|
|
- 'justify-content': 'flex-end',
|
|
|
|
- 'padding-top': '5px'
|
|
|
|
- }"
|
|
|
|
- >
|
|
|
|
- <el-descriptions-item label="提交月份">
|
|
|
|
- <el-date-picker
|
|
|
|
- v-model="month"
|
|
|
|
- size="small"
|
|
|
|
- type="month"
|
|
|
|
- value-format="yyyy-MM"
|
|
|
|
- placeholder="选择月份">
|
|
|
|
- </el-date-picker>
|
|
|
|
- </el-descriptions-item>
|
|
|
|
- </el-descriptions>
|
|
|
|
- <el-descriptions
|
|
|
|
- v-for="item in items"
|
|
|
|
- :key="item.ruleCategory"
|
|
|
|
- :title="item.ruleCategory"
|
|
|
|
- :column="1"
|
|
|
|
- :labelStyle="{
|
|
|
|
- width: '200px',
|
|
|
|
- 'justify-content': 'flex-end',
|
|
|
|
- 'padding-top': '5px'
|
|
|
|
- }"
|
|
|
|
- >
|
|
|
|
- <el-descriptions-item
|
|
|
|
- v-for="_item in item.item"
|
|
|
|
- :key="_item.employeeScoreRuleItemId"
|
|
|
|
- :label="_item.title"
|
|
|
|
- >
|
|
|
|
- <!-- <div style="width: 100%;"> -->
|
|
|
|
- <template v-if="_item.inputType === 0">
|
|
|
|
|
|
+ <m-card
|
|
|
|
+ shadow="never"
|
|
|
|
+ class="mb-3"
|
|
|
|
+ v-for="(item, index) in queryItems"
|
|
|
|
+ :key="item.key"
|
|
|
|
+ >
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col class="mb-3">
|
|
|
|
+ <div class="d-flex align-center">
|
|
|
|
+ <div style="width: 50px;">
|
|
|
|
+ 类别
|
|
|
|
+ </div>
|
|
|
|
+ <el-select v-model="item.employeeScoreRuleItemId" filterable size="small" @change="onChange($event, index)">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="option in items"
|
|
|
|
+ :key="option.employeeScoreRuleItemId"
|
|
|
|
+ :label="option.title"
|
|
|
|
+ :value="option.employeeScoreRuleItemId"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ <m-button class="ml-auto" type="danger" size="small" @click="onRemove(index)">移除</m-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <template v-if="item.inputType === 0">
|
|
|
|
+ <div class="d-flex">
|
|
|
|
+ <div style="width: 50px;">
|
|
|
|
+ 积分
|
|
|
|
+ </div>
|
|
|
|
+ <el-input-number
|
|
|
|
+ size="small"
|
|
|
|
+ :min="0"
|
|
|
|
+ v-model="item.value"
|
|
|
|
+ ></el-input-number>
|
|
|
|
+ <UploadBtn v-model="item.images"></UploadBtn>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="item.inputType === 2">
|
|
|
|
+ <div class="fullWidth">
|
|
|
|
+ <div class="d-flex mb-3">
|
|
|
|
+ <div style="width: 50px;">
|
|
|
|
+ 积分
|
|
|
|
+ </div>
|
|
<el-input-number
|
|
<el-input-number
|
|
size="small"
|
|
size="small"
|
|
:min="0"
|
|
:min="0"
|
|
- v-model="formValues[_item.employeeScoreRuleItemId].value"
|
|
|
|
|
|
+ placeholder="请输入积分"
|
|
|
|
+ v-model="item.value"
|
|
></el-input-number>
|
|
></el-input-number>
|
|
- <UploadBtn v-model="formValues[_item.employeeScoreRuleItemId].image"></UploadBtn>
|
|
|
|
- </template>
|
|
|
|
- <template v-if="_item.inputType === 2">
|
|
|
|
- <m-card shadow="never" class="fullWidth">
|
|
|
|
- <div class="d-flex mb-3">
|
|
|
|
- <div style="width: 50px;">
|
|
|
|
- 积分
|
|
|
|
- </div>
|
|
|
|
- <el-input-number
|
|
|
|
- size="small"
|
|
|
|
- :min="0"
|
|
|
|
- placeholder="请输入积分"
|
|
|
|
- v-model="formValues[_item.employeeScoreRuleItemId].value"
|
|
|
|
- ></el-input-number>
|
|
|
|
- <UploadBtn v-model="formValues[_item.employeeScoreRuleItemId].image"></UploadBtn>
|
|
|
|
- </div>
|
|
|
|
- <div class="d-flex">
|
|
|
|
- <div style="width: 50px;">
|
|
|
|
- 描述
|
|
|
|
- </div>
|
|
|
|
- <el-input
|
|
|
|
- type="textarea"
|
|
|
|
- :rows="1"
|
|
|
|
- placeholder="请输入类目描述"
|
|
|
|
- v-model="formValues[_item.employeeScoreRuleItemId].desc"
|
|
|
|
- ></el-input>
|
|
|
|
- </div>
|
|
|
|
- </m-card>
|
|
|
|
- </template>
|
|
|
|
- <template v-if="_item.inputType === 3">
|
|
|
|
- <el-radio-group v-model="formValues[_item.employeeScoreRuleItemId].value" class="mt-2">
|
|
|
|
- <el-radio
|
|
|
|
- v-for="radio in _item.child"
|
|
|
|
- :key="radio.employeeScoreRuleItemId"
|
|
|
|
- :label="radio.employeeScoreRuleItemId">
|
|
|
|
- {{ radio.title }}
|
|
|
|
- </el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- <UploadBtn v-model="formValues[_item.employeeScoreRuleItemId].image"></UploadBtn>
|
|
|
|
- </template>
|
|
|
|
- <!-- </div> -->
|
|
|
|
- <!-- <el-upload>
|
|
|
|
- <m-button size="small" type="primary">附件上传</m-button>
|
|
|
|
- </el-upload> -->
|
|
|
|
- </el-descriptions-item>
|
|
|
|
- </el-descriptions>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <UploadBtn v-model="item.images"></UploadBtn>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="d-flex">
|
|
|
|
+ <div style="width: 50px;">
|
|
|
|
+ 描述
|
|
|
|
+ </div>
|
|
|
|
+ <el-input
|
|
|
|
+ type="textarea"
|
|
|
|
+ :rows="1"
|
|
|
|
+ placeholder="请输入类目描述"
|
|
|
|
+ v-model="item.desc"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="item.inputType === 3">
|
|
|
|
+ <div class="d-flex">
|
|
|
|
+ <el-radio-group v-model="item.value" class="mt-2">
|
|
|
|
+ <el-radio
|
|
|
|
+ v-for="radio in item.child"
|
|
|
|
+ :key="radio.employeeScoreRuleItemId"
|
|
|
|
+ :label="radio.employeeScoreRuleItemId">
|
|
|
|
+ {{ radio.title }}
|
|
|
|
+ </el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ <UploadBtn v-model="item.images"></UploadBtn>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
</m-card>
|
|
</m-card>
|
|
|
|
+ <div class="text-center mt-3">
|
|
|
|
+ <m-button type="orange" icon="el-icon-plus" @click="onAdd">添加一条申报</m-button>
|
|
|
|
+ </div>
|
|
</m-dialog>
|
|
</m-dialog>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -108,60 +100,77 @@ export default {
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
- month: null,
|
|
|
|
loading: false,
|
|
loading: false,
|
|
- finished: false,
|
|
|
|
items: [],
|
|
items: [],
|
|
|
|
+ key: 0,
|
|
|
|
+ queryItems: [],
|
|
formValues: {}
|
|
formValues: {}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- created () {
|
|
|
|
- const date = new Date()
|
|
|
|
- this.month = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`
|
|
|
|
- },
|
|
|
|
methods: {
|
|
methods: {
|
|
async open () {
|
|
async open () {
|
|
this.loading = true
|
|
this.loading = true
|
|
|
|
+ this.key = 0
|
|
this.$refs.dialog.open()
|
|
this.$refs.dialog.open()
|
|
try {
|
|
try {
|
|
const { data } = await getAccumulatePointRule()
|
|
const { data } = await getAccumulatePointRule()
|
|
- this.items = data
|
|
|
|
- this.formValues = this.items.reduce((acc, cur) => {
|
|
|
|
- cur.item.forEach(item => {
|
|
|
|
- acc[item.employeeScoreRuleItemId] = {
|
|
|
|
- value: item.inputType === 3 ? null : 0,
|
|
|
|
- desc: null,
|
|
|
|
- maxScore: item.maxScore ? Number(item.maxScore) : item.maxScore,
|
|
|
|
- image: []
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ this.items = data.reduce((acc, cur) => {
|
|
|
|
+ acc.push(...cur.item)
|
|
return acc
|
|
return acc
|
|
- }, {})
|
|
|
|
- this.finished = true
|
|
|
|
|
|
+ }, [])
|
|
|
|
+ const item = this.items[0]
|
|
|
|
+ this.queryItems = [
|
|
|
|
+ {
|
|
|
|
+ ...item,
|
|
|
|
+ key: 0,
|
|
|
|
+ images: null,
|
|
|
|
+ value: item.inputType === 1 ? 0 : null
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
} catch (error) {
|
|
} catch (error) {
|
|
this.$message.error(error)
|
|
this.$message.error(error)
|
|
} finally {
|
|
} finally {
|
|
this.loading = false
|
|
this.loading = false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ onRemove (index) {
|
|
|
|
+ this.queryItems.splice(index, 1)
|
|
|
|
+ },
|
|
|
|
+ onChange (employeeScoreRuleItemId, index) {
|
|
|
|
+ const obj = this.items.find(_e => _e.employeeScoreRuleItemId === employeeScoreRuleItemId)
|
|
|
|
+ Object.assign(this.queryItems[index], {
|
|
|
|
+ ...obj,
|
|
|
|
+ images: null,
|
|
|
|
+ value: 0,
|
|
|
|
+ desc: null
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ onAdd () {
|
|
|
|
+ this.key++
|
|
|
|
+ const item = this.items[0]
|
|
|
|
+ this.queryItems.push({
|
|
|
|
+ ...item,
|
|
|
|
+ key: this.key,
|
|
|
|
+ images: null,
|
|
|
|
+ value: item.inputType === 1 ? 0 : null
|
|
|
|
+ })
|
|
|
|
+ },
|
|
async onSure () {
|
|
async onSure () {
|
|
- const values = Object.values(this.formValues)
|
|
|
|
- if (values.some(item => item.value === null)) {
|
|
|
|
|
|
+ if (this.queryItems.some(item => item.value === null)) {
|
|
this.$message.error('请填写完整再提交')
|
|
this.$message.error('请填写完整再提交')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- const param = Object.keys(this.formValues).map(key => {
|
|
|
|
|
|
+ const param = this.queryItems.map(item => {
|
|
return {
|
|
return {
|
|
- images: this.formValues[key].image,
|
|
|
|
- inputValue: this.formValues[key].value,
|
|
|
|
- desc: this.formValues[key].desc,
|
|
|
|
- employeeScoreRuleItemId: key
|
|
|
|
|
|
+ images: item.images,
|
|
|
|
+ inputValue: item.value,
|
|
|
|
+ desc: item.desc,
|
|
|
|
+ employeeScoreRuleItemId: item.employeeScoreRuleItemId
|
|
}
|
|
}
|
|
})
|
|
})
|
|
this.loading = true
|
|
this.loading = true
|
|
try {
|
|
try {
|
|
await saveAccumulatePoint({
|
|
await saveAccumulatePoint({
|
|
- month: this.month,
|
|
|
|
item: param
|
|
item: param
|
|
})
|
|
})
|
|
this.$refs.dialog.close()
|
|
this.$refs.dialog.close()
|
|
@@ -181,8 +190,7 @@ export default {
|
|
.fullWidth {
|
|
.fullWidth {
|
|
width: 100%;
|
|
width: 100%;
|
|
}
|
|
}
|
|
-.el-radio {
|
|
|
|
- display: block;
|
|
|
|
- margin-bottom: 5px;
|
|
|
|
|
|
+.ml-auto {
|
|
|
|
+ margin-left: auto;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|