-- 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> <template>
<a-input <a-input
v-model:value="modelV" v-model:value="modelV.value"
:placeholder="placeholder" :placeholder="placeholder"
:show-count="showCount" :show-count="showCount"
:maxlength="maxlength" :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> </div>
</template> </template>
<script setup> <script setup>
import {defineProps, defineEmits, watch, ref, onMounted} from "vue"; import {defineProps, defineEmits, watch, ref} from "vue";
import {validateName} from "@/api/index1"; import {validateName} from "@/api/index1";
import {throttle} from "@/api/method"; import {Form} from "ant-design-vue";
const props = defineProps({ const props = defineProps({
value: { value: {
@@ -38,51 +36,52 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
}); validated: {
type: Number,
const emit = defineEmits({}); default: 0,
const modelV = ref();
const validating = ref(false)
const validated = ref(true)
onMounted(() => {
modelV.value = props.value;
});
watch(
() => props.value,
() => {
if (props.value !== modelV.value) {
modelV.value = props.value;
} }
});
const emit = defineEmits(["update:value",'update:validated']);
const modelV = ref({
value: props.value
});
const rulesRef = ref({
value: [{
required: true,
validator: validateValue,
trigger: "change",
message: "请输入名称",
},
],
});
Form.useForm(modelV, rulesRef, { debounce: { wait: 800 } });
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("请输入名称");
}
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();
} }
); );
watch(modelV, () => {
emit("update:value", modelV.value);
});
function validate() {
console.log('validate')
;
}
function validateNameFun() {
validateName({name: props.value, type: props.type, id: props.id}).then(res => {
validating.value = false
validated.value = res.data.data !== 1
}
)
}
const throttleValidateName = throttle(validateNameFun, 500)
function validateProName() {
validating.value = true
validated.value = true
props.value && throttleValidateName()
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -94,6 +93,7 @@ function validateProName() {
} }
} }
.road { .road {
.ant-input-affix-wrapper { .ant-input-affix-wrapper {
padding: 0px 8px; padding: 0px 8px;
@@ -102,8 +102,6 @@ function validateProName() {
} }
.b_input, .b_input,
.i1_input { .i1_input {
.ant-input-affix-wrapper { .ant-input-affix-wrapper {

View File

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

File diff suppressed because it is too large Load Diff