|
@@ -1,20 +1,23 @@
|
|
|
<template>
|
|
|
<div class="textarea w100">
|
|
|
- <el-input
|
|
|
- v-model="value"
|
|
|
- type="textarea"
|
|
|
- show-word-limit
|
|
|
- :autosize="{ minRows: props.minRows, maxRows: props.maxRows }"
|
|
|
- :placeholder="props.placeholder"
|
|
|
- :maxlength="props.maxlength"
|
|
|
- :disabled="props.disabled"
|
|
|
- class="textarea-content"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- <span class="buttons">
|
|
|
- <el-button @click="showAdvice" class="default-button" :disabled="props.disabled">常用意见</el-button>
|
|
|
- <el-button type="primary" @click="onAddAdvice" :disabled="props.disabled">添加到常用意见</el-button>
|
|
|
- </span>
|
|
|
+ <div style="position: relative">
|
|
|
+ <el-input
|
|
|
+ v-model="value"
|
|
|
+ type="textarea"
|
|
|
+ show-word-limit
|
|
|
+ :autosize="{ minRows: props.minRows, maxRows: props.maxRows }"
|
|
|
+ :placeholder="props.placeholder"
|
|
|
+ :maxlength="props.maxlength"
|
|
|
+ :disabled="props.disabled"
|
|
|
+ class="textarea-content"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ <span class="buttons">
|
|
|
+ <el-button @click="textCheck" class="default-button" :disabled="props.disabled" v-if="props.showTextCheck">文本检查</el-button>
|
|
|
+ <el-button @click="showAdvice" class="default-button" :disabled="props.disabled">常用意见</el-button>
|
|
|
+ <el-button type="primary" @click="onAddAdvice" :disabled="props.disabled">添加到常用意见</el-button>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
<el-drawer v-model="state.showDrawer" :size="props.drawerWidth" :show-close="false" :modal="props.modal">
|
|
|
<template #header="{ close }">
|
|
|
<div class="comments-header">
|
|
@@ -73,7 +76,7 @@
|
|
|
</ul>
|
|
|
</template>
|
|
|
</template>
|
|
|
- <el-empty v-if="!state.adviceList.length && state.active !== 'add'"/>
|
|
|
+ <el-empty v-if="!state.adviceList.length && state.active !== 'add'" />
|
|
|
<!-- 新增意见 -->
|
|
|
<template v-if="state.active === 'add'">
|
|
|
<div>
|
|
@@ -84,8 +87,8 @@
|
|
|
type="textarea"
|
|
|
:autosize="{ minRows: 10, maxRows: 10 }"
|
|
|
placeholder="请填写常用意见内容"
|
|
|
- show-word-limit
|
|
|
- maxlength="200"
|
|
|
+ show-word-limit
|
|
|
+ maxlength="200"
|
|
|
>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
@@ -106,6 +109,9 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-drawer>
|
|
|
+ <div v-if="wrongText" class="wrong-text">
|
|
|
+ <span class="wrong-label">错别字:</span><span class="color-danger wrong-content">{{ wrongText }}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -118,7 +124,7 @@ const emit = defineEmits(['chooseAdvice', 'update:modelValue']);
|
|
|
const props = defineProps({
|
|
|
modal: {
|
|
|
type: Boolean,
|
|
|
- default:false,
|
|
|
+ default: false,
|
|
|
},
|
|
|
modelValue: {
|
|
|
type: String,
|
|
@@ -156,6 +162,11 @@ const props = defineProps({
|
|
|
type: [Number, String],
|
|
|
default: '35%',
|
|
|
},
|
|
|
+ showTextCheck: {
|
|
|
+ // 是否展示文本检查
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
} as any);
|
|
|
const activeName = ref('personal'); // 默认选中tab
|
|
|
const value = computed({
|
|
@@ -235,7 +246,7 @@ const getList = async () => {
|
|
|
// 切换tab查询意见
|
|
|
const handleClick = (val: string) => {
|
|
|
isOpen.value = val === 'public';
|
|
|
- if(isOpen.value) state.manage = false;
|
|
|
+ if (isOpen.value) state.manage = false;
|
|
|
getList();
|
|
|
};
|
|
|
// 选中常用意见(管理)
|
|
@@ -276,7 +287,7 @@ const deleteAdvice = () => {
|
|
|
type: 'warning',
|
|
|
})
|
|
|
.then(() => {
|
|
|
- const ids = state.chooseAdvice.map((item: any) => item.id);
|
|
|
+ const ids = state.chooseAdvice.map((item: any) => item.id);
|
|
|
deleteCommon({ ids }).then(() => {
|
|
|
ElMessage.success('操作成功');
|
|
|
resetState();
|
|
@@ -310,6 +321,36 @@ const chooseAdvice = (item: any) => {
|
|
|
const closeDialog = () => {
|
|
|
state.showDrawer = false;
|
|
|
};
|
|
|
+// 文件检查
|
|
|
+const wrongText = ref('');
|
|
|
+const textCheck = () => {
|
|
|
+ ElMessageBox.confirm(`确认要检查文本内容?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true,
|
|
|
+ cancelButtonClass: 'default-button',
|
|
|
+ autofocus: false,
|
|
|
+ beforeClose: (action, instance, done) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ instance.confirmButtonLoading = true;
|
|
|
+ instance.confirmButtonText = '检查中,请稍后';
|
|
|
+ setTimeout(() => {
|
|
|
+ done();
|
|
|
+ instance.confirmButtonLoading = false;
|
|
|
+ }, 700);
|
|
|
+ } else {
|
|
|
+ done();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ ElMessage.success('检查成功');
|
|
|
+ wrongText.value = '';
|
|
|
+ closeDialog();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
// 暴露变量
|
|
|
defineExpose({
|
|
|
openDialog,
|
|
@@ -318,17 +359,16 @@ defineExpose({
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.textarea {
|
|
|
- .textarea-content{
|
|
|
- position: relative;
|
|
|
- :deep(.el-input__count) {
|
|
|
- font-size: 16px;
|
|
|
- bottom: 18px;
|
|
|
- right: 250px;
|
|
|
- }
|
|
|
- }
|
|
|
+ .textarea-content {
|
|
|
+ :deep(.el-input__count) {
|
|
|
+ font-size: 16px;
|
|
|
+ bottom: 15px;
|
|
|
+ right: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
.buttons {
|
|
|
position: absolute;
|
|
|
- right: 10px;
|
|
|
+ right: 80px;
|
|
|
bottom: 10px;
|
|
|
}
|
|
|
:deep(.el-textarea__inner) {
|
|
@@ -360,6 +400,20 @@ defineExpose({
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.wrong-text{
|
|
|
+ line-height: 24px;
|
|
|
+ display: flex;
|
|
|
+ margin-top: 5px;
|
|
|
+ .wrong-label{
|
|
|
+ flex: 0 0 auto;
|
|
|
+ }
|
|
|
+ .wrong-content{
|
|
|
+ align-items: center;
|
|
|
+ flex:1;
|
|
|
+ min-width: 0;
|
|
|
+ word-break: break-all;
|
|
|
+ }
|
|
|
+}
|
|
|
.comments-header {
|
|
|
.active {
|
|
|
color: var(--el-color-primary);
|