You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
184 lines
4.0 KiB
184 lines
4.0 KiB
<script lang="ts" setup>
|
|
import { computed, onBeforeMount, ref } from 'vue'
|
|
import { useDictionary } from '@/store/modules/dictonary'
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'commit', value: any, isOther: boolean)
|
|
}>()
|
|
|
|
const dictonaryStore = useDictionary()
|
|
|
|
const show = ref(false)
|
|
const cardStyle = {
|
|
'width': '520px',
|
|
'--n-padding-bottom': '10px',
|
|
'--n-padding-left': '0px',
|
|
}
|
|
|
|
function showModal() {
|
|
show.value = true
|
|
}
|
|
|
|
function closeModal() {
|
|
show.value = false
|
|
}
|
|
|
|
defineExpose({
|
|
showModal,
|
|
})
|
|
|
|
const backOptions = ref<any[]>([])
|
|
const reasonOptions = ref<any[]>([])
|
|
const selectBackId = ref(null)
|
|
const selectRejectId = ref(null)
|
|
const otherValue = ref(null)
|
|
const showOther = computed(() => {
|
|
return selectRejectId.value === 'other'
|
|
})
|
|
|
|
const comomitValue = computed(() => {
|
|
return selectRejectId.value === 'other' ? otherValue.value : selectRejectId.value
|
|
})
|
|
|
|
async function handleSumbit(e: MouseEvent) {
|
|
e.preventDefault()
|
|
closeModal()
|
|
emit('commit', comomitValue, selectRejectId.value === 'other')
|
|
}
|
|
|
|
onBeforeMount(async () => {
|
|
const tfList = await dictonaryStore.fetchTFList()
|
|
|
|
reasonOptions.value = tfList.map((item) => {
|
|
return {
|
|
label: item.name,
|
|
value: item.id,
|
|
}
|
|
})
|
|
|
|
// 添加其他选项
|
|
reasonOptions.value.push({
|
|
label: '其他',
|
|
value: 'other',
|
|
})
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<n-modal v-model:show="show" transform-origin="center">
|
|
<n-card :style="cardStyle" :bordered="false" size="huge" role="dialog" aria-modal="true">
|
|
<div class="wrapper">
|
|
<div class="wrapper-header">
|
|
<span class="wrapper-left">选择不通过原因</span>
|
|
<div class="wrapper-right">
|
|
<div class="wrapper-right-close" @pointerdown="closeModal">
|
|
<div class="wrapper-right-icon" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="wrapper-content">
|
|
<span>处理方式</span>
|
|
<n-select filterable v-model:value="selectBackId" style="margin-top: 10px;" :options="backOptions" />
|
|
</div>
|
|
<div class="wrapper-content">
|
|
<span>不通过原因</span>
|
|
<n-select filterable v-model:value="selectRejectId" style="margin-top: 10px;" :options="reasonOptions" />
|
|
<n-input v-show="showOther" v-model:value="otherValue" type="textarea" placeholder="备注内容" style="margin-top: 10px;" />
|
|
</div>
|
|
</div>
|
|
<template #footer>
|
|
<div class="wrapper-footer">
|
|
<n-button type="info" @click="handleSumbit">
|
|
确认
|
|
</n-button>
|
|
<n-button secondary style="margin-left:15px" @click="closeModal">
|
|
取消
|
|
</n-button>
|
|
</div>
|
|
</template>
|
|
</n-card>
|
|
</n-modal>
|
|
</template>
|
|
|
|
<style lang="less" scoped>
|
|
.wrapper {
|
|
&-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 10px;
|
|
}
|
|
|
|
&-left {
|
|
font-weight: bold;
|
|
font-size: 16px;
|
|
}
|
|
|
|
&-right {
|
|
&-close {
|
|
width: 18px;
|
|
height: 18px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
&-icon {
|
|
background: #000;
|
|
display: inline-block;
|
|
width: 18px;
|
|
height: 1px;
|
|
transform: rotate(45deg);
|
|
-webkit-transform: rotate(45deg);
|
|
margin-bottom: 8px;
|
|
|
|
&:after {
|
|
content: '';
|
|
display: block;
|
|
width: 18px;
|
|
height: 1px;
|
|
background: #000;
|
|
transform: rotate(-90deg);
|
|
-webkit-transform: rotate(-90deg);
|
|
}
|
|
}
|
|
}
|
|
|
|
&-content {
|
|
padding: 18px 10px;
|
|
}
|
|
|
|
&-footer {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
&-info {
|
|
font-weight: bold;
|
|
position: relative;
|
|
|
|
&:before {
|
|
background-color: #1980ff;
|
|
content: '';
|
|
width: 5px;
|
|
border-radius: 2px;
|
|
top: 0;
|
|
bottom: 0;
|
|
position: absolute;
|
|
}
|
|
}
|
|
}
|
|
|
|
::v-deep(.n-card.n-card--content-segmented > .n-card__content:not(:first-child)) {
|
|
border: 0px;
|
|
}
|
|
|
|
::v-deep(.n-card > .n-card-header) {
|
|
--n-padding-top: 0px;
|
|
--n-padding-bottom: 12px;
|
|
}
|
|
|
|
::v-deep(.n-divider:not(.n-divider--vertical)) {
|
|
margin-top: 0px;
|
|
margin-bottom: 0px;
|
|
}
|
|
</style>
|