2023-05-04 18:16:22 +08:00
|
|
|
<template>
|
|
|
|
<n-form label-placement="left" label-width="auto" :model="form">
|
2023-12-11 09:07:11 +08:00
|
|
|
<n-form-item :label="`${type}*`" path="scroe.value">
|
|
|
|
<n-input-number v-model:value="form.score.value" :placeholder="`输入${type}`" :max="form.score.maxValue"
|
2023-05-11 22:02:41 +08:00
|
|
|
:min="form.score.minValue" :precision="2"/>
|
2023-05-04 18:16:22 +08:00
|
|
|
</n-form-item>
|
2023-12-11 09:07:11 +08:00
|
|
|
<n-form-item :label="`${type}原因*`" path="score.reason">
|
|
|
|
<n-input type="textarea" v-model:value="form.score.reason" :placeholder="`输入${type}原因`" @keydown.enter.prevent />
|
2023-05-04 18:16:22 +08:00
|
|
|
</n-form-item>
|
2023-05-11 22:02:41 +08:00
|
|
|
<!--
|
2023-05-04 18:16:22 +08:00
|
|
|
<n-space>
|
|
|
|
<n-form-item label="填报人*" path="score.userName">
|
|
|
|
<n-input v-model:value="form.score.userName" placeholder="输入填报人" readonly />
|
|
|
|
</n-form-item>
|
|
|
|
<n-form-item label="填报日期*" path="score.date">
|
|
|
|
<n-input v-model:value="form.score.date" placeholder="输入填报日期" readonly />
|
|
|
|
</n-form-item>
|
|
|
|
</n-space>
|
2023-05-11 22:02:41 +08:00
|
|
|
-->
|
2023-05-04 18:16:22 +08:00
|
|
|
<n-space justify="end">
|
|
|
|
<n-button type="primary" @click="onConfirmClick">确定</n-button>
|
|
|
|
</n-space>
|
|
|
|
</n-form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
NForm,
|
|
|
|
NFormItem,
|
|
|
|
NInput,
|
|
|
|
NInputNumber,
|
|
|
|
NButton,
|
|
|
|
NSpace,
|
|
|
|
|
|
|
|
useMessage
|
|
|
|
} from 'naive-ui'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Scroing',
|
|
|
|
components: {
|
|
|
|
NForm,
|
|
|
|
NFormItem,
|
|
|
|
NInput,
|
|
|
|
NInputNumber,
|
|
|
|
NButton,
|
|
|
|
NSpace,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
rowKey: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
rowIndex: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
score: {
|
|
|
|
required: false,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
reason: {
|
|
|
|
required: false,
|
|
|
|
},
|
|
|
|
minScore: {
|
|
|
|
required: false,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
maxScore: {
|
|
|
|
required: false,
|
|
|
|
default: 100
|
2023-12-11 09:07:11 +08:00
|
|
|
},
|
|
|
|
type: {
|
|
|
|
required: false,
|
|
|
|
default: '分数'
|
2023-05-04 18:16:22 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
let vueSelf = this;
|
|
|
|
return {
|
|
|
|
message: useMessage(),
|
|
|
|
form: {
|
|
|
|
score: {
|
|
|
|
value: vueSelf.score,
|
|
|
|
maxValue: vueSelf.maxScore,
|
|
|
|
minValue: vueSelf.minScore,
|
|
|
|
reason: vueSelf.reason,
|
2023-05-11 22:02:41 +08:00
|
|
|
// userId: '1',
|
|
|
|
// userName: '管理员',
|
|
|
|
// date: ''
|
2023-05-04 18:16:22 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
scroe: {
|
|
|
|
value: [
|
|
|
|
{
|
|
|
|
required: true,
|
2023-12-11 09:07:11 +08:00
|
|
|
message: `请输入${this.type}`
|
2023-05-04 18:16:22 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onConfirmClick() {
|
|
|
|
if(this.form.score.value === null) {
|
2023-12-11 09:07:11 +08:00
|
|
|
this.message.error(`请输入${this.type}`)
|
2023-05-04 18:16:22 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(!this.form.score.reason) {
|
2023-12-11 09:07:11 +08:00
|
|
|
this.message.error(`请输入${this.type}原因`)
|
2023-05-04 18:16:22 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$emit('confirm', this.rowKey, this.rowIndex, {
|
|
|
|
score: this.form.score.value,
|
|
|
|
reason: this.form.score.reason,
|
|
|
|
userId: this.form.score.userId,
|
|
|
|
userName: this.form.score.userName,
|
|
|
|
date: this.form.score.date,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getCurrentDate() {
|
|
|
|
let date = new Date();
|
|
|
|
let year = date.getFullYear();
|
|
|
|
let month = date.getMonth() + 1;
|
|
|
|
month = month < 10 ? `0${month}` : month;
|
|
|
|
let day = date.getDay();
|
|
|
|
day = day < 10 ? `0${day}` : day;
|
|
|
|
return `${year}-${month}-${day}`;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
2023-05-11 22:02:41 +08:00
|
|
|
// this.form.score.date = this.getCurrentDate()
|
2023-05-04 18:16:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
|
|
|
|
</style>
|