-- fix 评估

This commit is contained in:
yuping
2023-02-28 20:03:54 +08:00
parent 378c91b1c4
commit c4f12a5b3a
3 changed files with 463 additions and 834 deletions

View File

@@ -1,20 +1,18 @@
<template>
<a-input
v-model:value="modelV"
v-model:value="modelV.value"
:placeholder="placeholder"
:show-count="showCount"
:maxlength="maxlength"
:validate="validate"
@change="validateProName"
/>
<div style="color: red; font-size: 10px" v-if="modelV && !validated">
<div style="color: red; font-size: 10px" v-if="modelV.value && validated===0">
名称重复请重新输入
</div>
</template>
<script setup>
import {defineProps, defineEmits, watch, ref, onMounted} from "vue";
import {defineProps, defineEmits, watch, ref} from "vue";
import {validateName} from "@/api/index1";
import {throttle} from "@/api/method";
import {Form} from "ant-design-vue";
const props = defineProps({
value: {
@@ -38,70 +36,70 @@ const props = defineProps({
type: Boolean,
default: false,
},
validated: {
type: Number,
default: 0,
}
});
const emit = defineEmits({});
const emit = defineEmits(["update:value",'update:validated']);
const modelV = ref();
const validating = ref(false)
const validated = ref(true)
onMounted(() => {
modelV.value = props.value;
const modelV = ref({
value: props.value
});
watch(
() => props.value,
() => {
if (props.value !== modelV.value) {
modelV.value = props.value;
}
}
);
watch(modelV, () => {
emit("update:value", modelV.value);
const rulesRef = ref({
value: [{
required: true,
validator: validateValue,
trigger: "change",
message: "请输入名称",
},
],
});
function validate() {
console.log('validate')
;
}
Form.useForm(modelV, rulesRef, { debounce: { wait: 800 } });
function validateNameFun() {
validateName({name: props.value, type: props.type, id: props.id}).then(res => {
validating.value = false
validated.value = res.data.data !== 1
watch(props, () => {
modelV.value.value = props.value;
});
watch(() => modelV.value.value, () => {
emit("update:validated", 1);
emit("update:value", modelV.value.value);
});
async function validateValue() {
if (!modelV.value.value) {
return Promise.reject("请输入名称");
}
)
}
const throttleValidateName = throttle(validateNameFun, 500)
function validateProName() {
validating.value = true
validated.value = true
props.value && throttleValidateName()
return validateName({ name: modelV.value.value, type: props.type, id: props.id }).then(res => {
if (res.data.data === 1) {
emit("update:validated", 0);
return Promise.reject("名称重复");
}
emit("update:validated", 2);
return Promise.resolve();
}
);
}
</script>
<style lang="scss">
.pro {
.pro {
.ant-input-affix-wrapper {
padding: 4px 8px;
border-radius: 8px;
}
}
.road {
}
.road {
.ant-input-affix-wrapper {
padding: 0px 8px;
border-radius: 8px;
}
}
}
.b_input,

View File

@@ -92,9 +92,7 @@
</div>
</template>
<script>
import { reactive, toRefs, computed } from "vue";
// import { message } from "ant-design-vue";
// import { createResearch } from "../../api/indexResearch";
import {reactive, toRefs} from "vue";
import ResearchAddSingle from "./components/ResearchAddSingle.vue";
import ResearchAddMulti from "./components/ResearchAddMulti.vue";
import ResearchAddAsk from "./components/ResearchAddAsk.vue";
@@ -104,7 +102,7 @@ import {
traverseArr,
filterCommon,
deepCloneFilterString,
} from "../../utils/utils";
} from "@/utils/utils";
import {
queryResearchDetailById,
editResearchMessage,
@@ -112,9 +110,8 @@ import {
deleteChoiceQuestion,
deleteQuestionScAndQa,
} from "@/api/indexResearch";
import { useRouter } from "vue-router";
import store from "@/store";
import { message } from "ant-design-vue";
import {useRoute, useRouter} from "vue-router";
import {message} from "ant-design-vue";
export default {
name: "ResearchAdd",
@@ -126,10 +123,11 @@ export default {
},
setup() {
const router = useRouter();
const route = useRoute();
const state = reactive({
assessmentId: "", //编辑时候传
assessmentName: "",
assessmentNameNew: computed(() => store.state.assessmentName),
assessmentNameNew: route.query.name,
allFormsData: [],
valueMore: "",
@@ -612,10 +610,12 @@ export default {
width: 100%;
display: flex;
flex-direction: column;
.header {
width: 100%;
display: flex;
justify-content: space-between;
.title {
color: #000000;
font-size: 18px;
@@ -624,10 +624,12 @@ export default {
padding-left: 37px;
//font-weight: 500;
}
.goback {
padding-right: 70px;
//padding-top: 37px;
position: relative;
.return {
display: inline-block;
width: 42px;
@@ -636,6 +638,7 @@ export default {
margin-right: 10px;
background-image: url("../../assets/images/projectadd/return.png");
}
.returntext {
display: inline-block;
position: absolute;
@@ -645,16 +648,19 @@ export default {
}
}
}
.addtype {
display: flex;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
margin-right: 20px;
align-items: center;
margin-left: 41px;
.addtypen {
color: #6f6f6f;
font-size: 14px;
}
.types {
cursor: pointer;
width: 80px;
@@ -667,11 +673,13 @@ export default {
align-items: center;
margin: 20px 10px;
}
.typesCur {
color: #fff;
background: #4ea6ff;
}
}
.content {
display: flex;
flex-direction: column;
@@ -680,9 +688,11 @@ export default {
min-width: 690px;
margin-left: 38px;
margin-top: 20px;
.tagbox {
display: flex;
justify-content: space-between;
.tagname {
width: 90px;
height: 32px;
@@ -696,6 +706,7 @@ export default {
color: rgba(64, 158, 255, 1);
font-size: 16px;
}
.deleteop {
display: flex;
justify-content: center;
@@ -707,6 +718,7 @@ export default {
border: 1px solid #4ea6ff;
border-radius: 8px;
cursor: pointer;
.del_text {
color: #4ea6ff;
font-size: 14px;
@@ -714,21 +726,25 @@ export default {
}
}
}
.scorebox {
display: flex;
align-items: center;
margin-top: 20px;
margin-left: 70px;
.scoretext {
font-size: 14px;
color: #56a3f9;
}
.number {
display: flex;
border: 1px solid #d7e5fd;
border-radius: 5px;
margin: 0 10px;
padding: 5px;
.btn {
width: 40px;
height: 40px;
@@ -744,30 +760,36 @@ export default {
line-height: 24px;
cursor: pointer;
}
.curBtn {
background: #56a3f9;
color: #fff;
}
}
}
.picture {
width: 100px;
display: flex;
flex-direction: column;
margin-top: 20px;
margin-left: 133px;
.pictureimg {
width: 100px;
height: 100px;
}
.picturename {
color: #6f6f6f;
font-size: 14px;
}
}
.options {
display: flex;
}
.delete {
cursor: pointer;
margin-top: 32px;
@@ -776,10 +798,12 @@ export default {
color: #4ea6ff;
font-size: 14px;
}
.name2 {
display: flex;
align-items: flex-start;
}
.name {
width: 60%;
// background-color: lightcoral;
@@ -794,20 +818,24 @@ export default {
align-items: center;
justify-content: flex-end;
flex-shrink: 0;
.nameimg {
width: 10px;
height: 10px;
}
}
.inname {
color: #6f6f6f;
font-size: 14px;
margin-left: 7px;
font-weight: 700;
}
.in {
margin-left: 14px;
flex: 1;
.assess {
display: flex;
width: 226px;
@@ -822,6 +850,7 @@ export default {
justify-content: center;
align-items: center;
}
.assesswhole {
width: 50%;
background: rgba(86, 163, 249, 0.1);
@@ -831,6 +860,7 @@ export default {
justify-content: center;
align-items: center;
}
.ratio {
position: absolute;
right: 10px;
@@ -839,24 +869,29 @@ export default {
font-size: 14px;
}
}
.addimg {
cursor: pointer;
color: rgba(78, 166, 255, 1);
font-size: 14px;
}
.text {
color: rgba(109, 117, 132, 1);
font-size: 14px;
//line-height: 24px;
}
.ant-radio-wrapper {
}
.ant-input {
border-radius: 5px;
// height: 120%;
width: 100%;
height: 35px;
}
.ant-select-selector {
border-radius: 5px;
// height: 120%;
@@ -864,26 +899,32 @@ export default {
height: 40px;
}
}
.numberInp {
width: 200px;
.ant-input-number {
width: 200px;
height: 40px;
border-radius: 8px;
}
// .ant-input-number-input-wrap {
// width: 200px;
// }
}
}
}
.name2 {
display: flex;
align-items: flex-start;
}
.opinion {
display: flex;
margin-top: 30px;
.namebox {
width: 120px;
display: flex;
@@ -891,27 +932,33 @@ export default {
justify-content: flex-end;
flex-shrink: 0;
}
.in {
margin-left: 14px;
width: 500px;
.ant-input-textarea-show-count {
position: relative;
height: 110px;
}
.ant-input-textarea-show-count::after {
position: absolute;
right: 10px;
bottom: 0px;
}
.ant-input {
border-radius: 8px;
}
}
}
.footer {
width: 100%;
margin-top: 31px;
margin-bottom: 14px;
.btn {
display: flex;
margin-bottom: 20px;
@@ -922,6 +969,7 @@ export default {
.uploadContent {
display: block !important;
.uploadBtn {
margin-left: 120px !important;
}

File diff suppressed because it is too large Load Diff