From a4dff39e4fd1e29b4b94997c79a1dd5f575f56de Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期一, 29 七月 2024 11:15:42 +0800 Subject: [PATCH] 测试完成 --- src/components/Regular/index.vue | 121 ++++++++++++++++++++++++++++++++-------- 1 files changed, 96 insertions(+), 25 deletions(-) diff --git a/src/components/Regular/index.vue b/src/components/Regular/index.vue index a1b49cb..42b2e87 100644 --- a/src/components/Regular/index.vue +++ b/src/components/Regular/index.vue @@ -3,7 +3,7 @@ <div class="topicxq" v-for="item in TargetoptionList"> <el-row :gutter="10"> <el-col :span="12" - ><el-form-item label="閫夐」鍚�"> + ><el-form-item label="閫夐」鍚嶇О"> <el-input type="text" placeholder="璇疯緭鍏�" @@ -13,7 +13,15 @@ </el-input> </el-form-item ></el-col> <el-col :span="12" - ><el-form-item label="鑺傜偣ID"> + ><el-form-item label="棰勮鍊�"> + <el-radio-group v-model="item.isabnormal"> + <el-radio :label="1">鏄�</el-radio> + <el-radio :label="0">鍚�</el-radio> + </el-radio-group> + </el-form-item></el-col + > + <el-col :span="12" v-if="intent" + ><el-form-item label="閫夐」鑺傜偣"> <el-input type="text" placeholder="璇疯緭鍏ヨ妭鐐�" @@ -23,7 +31,19 @@ </el-input> </el-form-item ></el-col> </el-row> - <el-row :gutter="10"> + <el-row :gutter="10" v-if="!intent"> + <el-col :span="20" + ><el-form-item label="閫夐」璇存槑"> + <el-input + type="text" + placeholder="璇疯緭鍏�" + v-model="item.optiondesc" + show-word-limit + > + </el-input> </el-form-item + ></el-col> + </el-row> + <el-row :gutter="10" v-if="intent"> <el-col :span="12" ><el-form-item label="澶勭悊"> <el-input @@ -36,17 +56,17 @@ </el-input> </el-form-item ></el-col> <el-col :span="12" - ><el-form-item label="閫変腑璺宠浆(缂�)"> + ><el-form-item label="閫変腑璺宠浆"> <el-input type="text" placeholder="璇疯緭鍏ラ鐩妭鐐�" - v-model="item.jump" + v-model="item.nextQuestion" show-word-limit > </el-input> </el-form-item ></el-col> </el-row> - <el-form-item label="鍏抽敭瀛�(鍚�)" prop="desc"> + <el-form-item label="鍏抽敭瀛�(鍚�)" prop="desc" v-if="hasValue"> <div class="xinz-inf"> <el-tag :key="crux" @@ -55,7 +75,7 @@ closable effect="dark" :disable-transitions="false" - @close="handleClosecrux(crux, item)" + @close="handleClosecrux(crux, item, 1)" > {{ crux }} </el-tag> @@ -88,7 +108,7 @@ > </div> </el-form-item> - <el-form-item label="鍏抽敭瀛�(闈�)" prop="desc"> + <el-form-item label="鍏抽敭瀛�(闈�)" prop="desc" v-if="hasValue"> <div class="xinz-inf"> <el-tag :key="crux" @@ -97,7 +117,7 @@ closable effect="dark" :disable-transitions="false" - @close="handleClosecrux(crux, item)" + @close="handleClosecrux(crux, item, 2)" > {{ crux }} </el-tag> @@ -130,15 +150,35 @@ > </div> </el-form-item> + <el-form-item label="閫夐」鏂囦欢" prop="sickness"> + <div style="width: 40vw"> + <el-upload + class="upload-demo" + :action="uploadImgUrl" + :headers="headers" + accept=".jpg,.png,image/*" + :on-success="handleChange.bind(this, item)" + > + <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> + </el-upload> + <div style="margin: 20px"> + <el-image + style="width: 100px; height: 100px" + :src="item.picturePath" + :preview-src-list="[...item.picturePath]" + > + </el-image> + </div> + </div> + </el-form-item> <el-row :gutter="10"> - <el-col :span="16"> + <el-col :span="16" v-if="intent"> <el-form-item label="璇煶鏂囦欢"> <el-upload class="upload-demo" style="display: flex" action="https://jsonplaceholder.typicode.com/posts/" - :on-change="handleChange" :file-list="fileList" :limit="1" :on-exceed="handleExceed" @@ -147,7 +187,7 @@ </el-upload> </el-form-item></el-col > - <el-col :span="8"> + <el-col :span="intent ? 8 : 22"> <div style="text-align: right; padding-right: 10px"> <el-button v-if="controlsc" @@ -185,6 +225,7 @@ <script> import store from "@/store"; +import { getToken } from "@/utils/auth"; export default { data() { @@ -197,6 +238,10 @@ url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100", }, ], + headers: { + Authorization: "Bearer " + getToken(), + }, + uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/uploadSort", whether: 1, //1涓哄叧閿瘝锛�2涓哄惁瀹氬叧閿瘝 inputValue: "", inputVisible: false, @@ -218,14 +263,19 @@ type: Boolean, default: true, }, + intent: { + type: Boolean, + default: true, + }, + hasValue: { + type: Boolean, + default: true, + }, }, created() { this.regular = store.getters.regular; this.noregular = store.getters.noregular; - - - }, methods: { @@ -254,18 +304,22 @@ } regex = regex.slice(0, -1); regexno = regexno.slice(0, -1); + if (regexno) { + hostregexno = "^(?!.*(?:" + `${regexno}` + ")).*$"; + } else { + hostregexno = ""; + } hostregex = "(?=.*(?:" + `${regex}` + ")).*$"; - hostregexno = "^(?!.(?:" + `${regexno}` + ")).*$"; - this.TargetoptionList[index].hostregex = hostregex; - this.TargetoptionList[index].hostregex2 = hostregexno; + this.TargetoptionList[index].targetregex = hostregex; + this.TargetoptionList[index].targetregex2 = hostregexno; console.log(hostregex, "纭畾瀛楀尮閰�"); console.log(hostregexno, "鍚﹀畾瀛楀尮閰�"); this.handleSelectionChange(); }, // 鎺у埗鏂囦欢 - handleChange(file, fileList) { - this.fileList = fileList.slice(-3); - }, + // handleChange(file, fileList) { + // this.fileList = fileList.slice(-3); + // }, // 鏂囦欢瓒呭嚭涓暟闄愬埗鏃剁殑閽╁瓙 handleExceed(files, fileList) { this.$message.warning( @@ -275,16 +329,22 @@ ); }, - handleClosecrux(crux, item) { - if (this.whether == 1) { - this.dynamiccruxs.splice(this.dynamiccruxs.indexOf(crux), 1); + handleClosecrux(crux, item, whether) { + if (whether == 1) { + item.dynamiccruxs.splice(item.dynamiccruxs.indexOf(crux), 1); + console.log(1); + console.log(item.dynamiccruxs); + console.log(item.nodynamiccruxs); } else { - this.nodynamiccruxs.splice(this.nodynamiccruxs.indexOf(crux), 1); + console.log(2); + item.nodynamiccruxs.splice(item.nodynamiccruxs.indexOf(crux), 1); } this.generateRegex(item); }, handleInputConfirm(row) { + console.log(this.TargetoptionList, "TargetoptionList"); let index = this.TargetoptionList.indexOf(row); + console.log(1112); if (this.whether == 1 && this.inputValue) { if ( this.TargetoptionList[index].dynamiccruxs.indexOf(this.inputValue) == @@ -333,6 +393,17 @@ console.log(this.TargetoptionList); this.$emit("handleSelectionChange", selection); }, + // 閫夐」鏂囦欢涓婁紶 + handleChange(item, response, file, fileList) { + console.log(response, "response"); + console.log(item, "item"); + console.log(this.TargetoptionList, "this.TargetoptionList"); + let index = this.TargetoptionList.findIndex( + (obj) => obj.guid == item.guid + ); + console.log(index); + this.TargetoptionList[index].picturePath = response.url; + }, }, }; </script> -- Gitblit v1.9.3