From f488fea65d0c0e96fb3e3c3ec835e4f324d11caa Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期三, 05 六月 2024 17:48:22 +0800 Subject: [PATCH] 测试完成 --- src/views/repositoryai/general/particulars/index.vue | 518 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 390 insertions(+), 128 deletions(-) diff --git a/src/views/repositoryai/general/particulars/index.vue b/src/views/repositoryai/general/particulars/index.vue index a5f229d..8a161a6 100644 --- a/src/views/repositoryai/general/particulars/index.vue +++ b/src/views/repositoryai/general/particulars/index.vue @@ -1,20 +1,63 @@ <template> <div> <el-card style="margin: 20px" class="box-card"> + <el-form + :model="baseForm" + :rules="bases" + ref="baseForm" + label-width="100px" + class="demo-baseForm" + > + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="妯$増鍚嶇О" prop="extName"> + <el-input + v-model="baseForm.extName" + placeholder="璇疯緭鍏�" + ></el-input> </el-form-item + ></el-col> + <el-col :span="12"> + <el-form-item label="妯$増鍒嗙被" prop="groupID"> + <el-select v-model="baseForm.groupID" placeholder="璇烽�夋嫨鍒嗙被"> + <el-option + v-for="item in deptOptions" + :key="item.intertcatid" + :label="item.categoryname" + :value="item.intertcatid" + > + </el-option> + </el-select> </el-form-item + ></el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="妯$増姒傝堪" prop="name"> + <el-input + v-model="baseForm.note" + placeholder="璇疯緭鍏�" + ></el-input> </el-form-item + ></el-col> + <el-col :span="12"> + <el-form-item label="鏄惁鍙敤" prop="resource"> + <el-select v-model="baseForm.isEnable" placeholder="璇烽�夋嫨鐘舵��"> + <el-option + v-for="item in usable" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> </el-form-item + ></el-col> + </el-row> + </el-form> <div class="elcardiv"> <div class="leftvlue-jbxx">璇濇湳鍒楄〃</div> <el-divider></el-divider> <el-table :data="targetList" :row-class-name="tableRowClassName"> <el-table-column label="搴忓彿" align="center" key="id" prop="id" /> - <el-table-column - label="闂涓婚锛堢己锛�" - align="center" - key="extName" - prop="extName" - width="200" - :show-overflow-tooltip="true" - /> + <el-table-column label="闂鏂囨湰" align="center" @@ -24,41 +67,15 @@ :show-overflow-tooltip="true" > </el-table-column> - <el-table-column - label="鍥炲璇煶锛堢己锛�" - align="center" - key="switchTexty" - width="200" - prop="switchTexty" - :show-overflow-tooltip="true" - > - </el-table-column> - <el-table-column - label="閫傜敤鏂瑰紡锛堢己锛�" - align="center" - key="suitWay" - prop="suitWay" - > - <template slot-scope="scope"> - <span v-for="item in scope.row.suitWay">{{ item }}</span> - </template> - </el-table-column> <el-table-column - label="璇█锛堢己锛�" - align="center" - key="language" - prop="language" - width="120" - /> - <el-table-column - label="鏄惁鍙敤锛堟敼锛�" + label="鏄惁鍙敤" align="center" key="isEnable" prop="isEnable" > <template slot-scope="scope"> - <dict-tag :options="usable" :value="scope.row.isEnable" /> + <span>{{ scope.row.isEnable == 1 ? "鍋滅敤" : "鍚敤" }}</span> </template> </el-table-column> <el-table-column @@ -81,8 +98,7 @@ <el-button size="medium" type="text" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:user:edit']" + @click="handleUpdate(scope.row, scope.$index)" ><span class="button-textxg" ><i class="el-icon-edit"></i>淇敼</span ></el-button @@ -92,7 +108,6 @@ size="medium" type="text" @click="handleDelete(scope.row)" - v-hasPermi="['system:user:remove']" ><span class="button-textsc" ><i class="el-icon-delete"></i>鍒犻櫎</span ></el-button @@ -110,44 +125,17 @@ <div style="margin: 15px; margin-top: 50px"> <div class="leftvlue-jbxx">璇濇湳缂栬緫</div> <el-divider></el-divider> + + <el-form-item label="璇濇湳鏂囨湰" prop="name"> + <el-input + v-model="ruleForm.switchText" + placeholder="璇疯緭鍏�" + ></el-input> + </el-form-item> <el-row :gutter="20"> <el-col :span="12"> - <el-form-item label="妯$増鍚嶇О" prop="name"> - <el-input - v-model="ruleForm.name" - placeholder="璇疯緭鍏�" - ></el-input> </el-form-item - ></el-col> - <el-col :span="12"> - <el-form-item label="妯$増鍒嗙被" prop="resource"> - <el-select - v-model="ruleForm.groupID" - placeholder="璇烽�夋嫨鍒嗙被" - > - <el-option - v-for="item in deptOptions" - :key="item.intertcatid" - :label="item.categoryname" - :value="item.intertcatid" - > - </el-option> - </el-select> </el-form-item - ></el-col> - </el-row> - <el-row :gutter="20"> - <el-col :span="12"> - <el-form-item label="闂涓婚" prop="name"> - <el-input - v-model="ruleForm.name" - placeholder="璇疯緭鍏�" - ></el-input> </el-form-item - ></el-col> - <el-col :span="12"> - <el-form-item label="鏄惁鍙敤" prop="resource"> - <el-select - v-model="ruleForm.assortid" - placeholder="璇烽�夋嫨鐘舵��" - > + <el-form-item label="鏄惁鍚敤" prop="resource"> + <el-select v-model="ruleForm.isEnable" placeholder="璇烽�夋嫨"> <el-option v-for="item in usable" :key="item.value" @@ -157,30 +145,11 @@ </el-option> </el-select> </el-form-item ></el-col> - </el-row> - - <el-form-item label="闂鏂囨湰" prop="name"> - <el-input v-model="ruleForm.name" placeholder="璇疯緭鍏�"></el-input> - </el-form-item> - <el-row :gutter="20"> <el-col :span="12"> - <el-form-item label="璇█" prop="resource"> - <el-select v-model="ruleForm.language" placeholder="璇烽�夋嫨"> + <el-form-item label="鏄惁涓虹粨鏉熻" prop="resource"> + <el-select v-model="ruleForm.isEnd" placeholder="璇烽�夋嫨"> <el-option - v-for="item in languagelist" - :key="item.label" - :label="item.label" - :value="item.label" - > - </el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="閫傜敤鏂瑰紡" prop="resource"> - <el-select v-model="ruleForm.mode" placeholder="璇烽�夋嫨"> - <el-option - v-for="item in mode" + v-for="item in usablend" :key="item.value" :label="item.label" :value="item.value" @@ -203,18 +172,109 @@ <!-- <el-input v-model="indexform.userName" maxlength="30" /> --> </el-form-item> - <el-form-item label="鍖归厤鏂囨湰" prop="desc"> - <el-input - type="textarea" - placeholder="璇疯緭鍏ュ尮閰嶆鍒�" - v-model="ruleForm.desc" - ></el-input> + <el-form-item label="鍏抽敭瀛�(鍚�)" prop="desc"> + <div class="xinz-inf"> + <el-tag + :key="crux" + type="success" + v-for="crux in ruleForm.dynamiccruxs" + closable + effect="dark" + :disable-transitions="false" + @close="handleClosecrux(crux, ruleForm, 1)" + > + {{ crux }} + </el-tag> + <el-select + v-model="inputValue" + v-if="inputVisible" + @change="handleInputConfirm(ruleForm)" + filterable + remote + allow-create + reserve-keyword + default-first-option + :loading="loading" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="ruleForms in regular" + :key="ruleForms.label" + :label="ruleForms.label" + :value="ruleForms.label" + > + </el-option> + </el-select> + <el-button + v-else + class="button-new-tag" + size="small" + @click="showInput(ruleForm)" + >+ 鏂板</el-button + > + </div> + </el-form-item> + <el-form-item label="鍏抽敭瀛�(闈�)" prop="desc"> + <div class="xinz-inf"> + <el-tag + :key="crux" + type="warning" + v-for="crux in ruleForm.nodynamiccruxs" + closable + effect="dark" + :disable-transitions="false" + @close="handleClosecrux(crux, ruleForm, 2)" + > + {{ crux }} + </el-tag> + <el-select + v-model="inputValue" + v-if="noinputVisible" + @change="handleInputConfirm(ruleForm)" + filterable + remote + allow-create + reserve-keyword + default-first-option + :loading="loading" + placeholder="璇烽�夋嫨" + > + <el-option + v-for="ruleForms in noregular" + :key="ruleForms.value" + :label="ruleForms.label" + :value="ruleForms.label" + > + </el-option> + </el-select> + <el-button + v-else + class="button-new-tag" + size="small" + @click="showInputno(ruleForm)" + >+ 鏂板</el-button + > + </div> </el-form-item> <el-form-item> <el-button type="primary" @click="submitForm('ruleForm')" - >绔嬪嵆鍒涘缓</el-button + >淇濆瓨妯$増</el-button > - <el-button @click="resetForm('ruleForm')">閲嶇疆</el-button> + <el-button + v-if="ruleForm.id" + type="primary" + plain + @click="modification('edit')" + >淇濆瓨璇濇湳</el-button + > + <el-button + v-else + type="success" + plain + @click="modification('add')" + >鏂板璇濇湳</el-button + > + <el-button @click="resetForm('ruleForm')">鍏抽棴</el-button> </el-form-item> </div> </el-form> @@ -229,6 +289,8 @@ editgeneravaluel, addgeneravaluel, getgeneravaluelinfo, + addgeneral, + editgeneral, getgeneralinfo, getgeneralclassify, delgeneravaluelinfo, @@ -240,47 +302,76 @@ loading: false, id: null, usable: [], + index: "", languagelist: [], - deptOptions:[], + deptOptions: [], mode: [], - pitchon: "杩樺ソ鍚�", - targetList: [{ switchText: "杩樺ソ鍚�" }, { switchText: "杩樹笉閿�" }], + pitchon: "", + targetList: [], fileList: [ { name: "food.jpeg", url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100", }, ], + usablend: [ + { + value: 0, + label: "闈炵粨鏉熻", + }, + { + value: 1, + label: "缁撴潫璇�", + }, + ], ruleForm: { - name: "", - region: "", - date1: "", - date2: "", - delivery: false, - type: [], - resource: "", - desc: "*(浜簗鎵搢鐝晩|鍞旂郴鐪熶汉(杈箌鍜絴鍜�)*(鍗曚綅|鍦版柟鍖婚櫌|涓績|鍗敓|璁憳|鏈嶅姟)", + dynamiccruxs: [], + nodynamiccruxs: [], + }, + baseForm: { + extName: "", }, rules: {}, + bases: {}, + whether: 1, //1涓哄叧閿瘝锛�2涓哄惁瀹氬叧閿瘝 + inputValue: "", + inputVisible: false, + noinputVisible: false, + loading: false, + regular: [], + noregular: [], + nodynamiccruxs: ["鍒�", "涓�"], + dynamiccruxs: ["濂�"], }; }, created() { + this.id = this.$route.query.id; this.getList(); - this.usable = store.getters.usable; + this.usable = store.getters.usablesz; this.languagelist = store.getters.languagelist; this.mode = store.getters.mode; + this.regular = store.getters.regular; + this.noregular = store.getters.noregular; }, methods: { getList() { - this.loading = true; - this.id = this.$route.query.id; - getgeneralinfo({ pid: this.id }).then((res) => { - this.targetList = res.rows; - console.log(this.targetList); - this.loading = false; - }); + if (this.id) { + this.$modal.loading("璇风◢鍊�..."); + getgeneralinfo(this.id).then((res) => { + if (res.code == 200) { + this.baseForm = res.data; + } + this.$modal.closeLoading(); + }); + getgeneravaluellist({ extID: this.id }).then((res) => { + if (res.code == 200) { + this.targetList = res.rows; + } + this.$modal.closeLoading(); + }); + } getgeneralclassify({}).then((res) => { this.deptOptions = res.rows; console.log(res); @@ -289,11 +380,86 @@ /** 鏂板鎸夐挳鎿嶄綔 */ handleAdd() {}, /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { + handleUpdate(row, index) { this.pitchon = row.switchText; + this.ruleForm = row; + this.index = index; }, - submitForm() {}, - resetForm() {}, + // 鍒犻櫎 + handleDelete(item) { + this.$modal + .confirm("鏄惁纭鍒犻櫎璇ヨ瘽鏈」锛�") + .then((res) => { + if (item.id) { + delgeneravaluelinfo(item.id).then((res) => { + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }); + } + this.targetList = this.targetList.filter((obj) => obj !== item); + }) + .catch(() => {}); + }, + // 淇濆瓨涓昏〃 + submitForm() { + if (this.baseForm.id) { + editgeneral(this.baseForm).then((res) => { + if (res.code == 200) { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.savetalk(); + } + }); + } else { + addgeneral(this.baseForm).then((res) => { + if (res.code == 200) { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.baseForm.id = res.data.id; + this.id = res.data.id; + this.savetalk(); + } + }); + } + }, + // 淇濆瓨璇濇湳 + savetalk() { + this.targetList.forEach((obj) => { + if (obj.id) { + editgeneravaluel(obj).then((res) => { + this.getList(); + }); + } else { + obj.extID = this.baseForm.id; + addgeneravaluel(obj).then((res) => { + this.getList(); + }); + } + }); + }, + modification(type) { + if (type == "add") { + console.log(this.ruleForm, "ruleForm"); + this.targetList.push(this.ruleForm); + } else { + this.targetList[this.index] = this.ruleForm; + } + this.ruleForm = {}; + }, + // 鍏抽棴 + resetForm() { + this.$confirm("鍗冲皢閫�鍑洪〉闈�, 璇风‘璁ゆ暟鎹槸鍚︿繚瀛�?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + this.$router.go(-1); + }) + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑�", + }); + }); + }, // 鏂囦欢---------------------- // 鎺у埗鏂囦欢 handleChange(file, fileList) { @@ -309,10 +475,84 @@ }, tableRowClassName({ row, rowIndex }) { if (row.switchText == this.pitchon) { - console.log(123); return "warning-row"; } return ""; + }, + // 姝e垯----------------- + // 鐢熸垚姝e垯 + generateRegex(row) { + let regex = ""; + let regexno = ""; + let hostregex = ""; + let hostregexno = ""; + + for (let i = 0; i < this.ruleForm.dynamiccruxs.length; i++) { + regex += `${this.ruleForm.dynamiccruxs[i]}|`; + } + for (let i = 0; i < this.ruleForm.nodynamiccruxs.length; i++) { + regexno += `${this.ruleForm.nodynamiccruxs[i]}|`; + } + regex = regex.slice(0, -1); + regexno = regexno.slice(0, -1); + hostregex = "(?=.*(?:" + `${regex}` + ")).*$"; + hostregexno = "^(?!.(?:" + `${regexno}` + ")).*$"; + this.ruleForm.selfRegex = hostregex; + this.ruleForm.selfRegex2 = hostregexno; + console.log(hostregex, "纭畾瀛楀尮閰�"); + console.log(hostregexno, "鍚﹀畾瀛楀尮閰�"); + }, + 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 { + console.log(2); + item.nodynamiccruxs.splice(item.nodynamiccruxs.indexOf(crux), 1); + } + this.generateRegex(item); + }, + handleInputConfirm(row) { + // let index = this.TargetoptionList.indexOf(row); + console.log(this.ruleForm.dynamiccruxs); + console.log(this.ruleForm.nodynamiccruxs); + if (this.whether == 1 && this.inputValue) { + console.log(1); + if (this.ruleForm.dynamiccruxs.indexOf(this.inputValue) == -1) { + this.ruleForm.dynamiccruxs.push(this.inputValue); + console.log(2); + } else { + this.$message.error("鍏抽敭瀛楀凡瀛樺湪"); + } + // this.inputVisible = false; + this.inputVisible = false; + } else if (this.whether == 2 && this.inputValue) { + console.log(this.ruleForm.nodynamiccruxs.indexOf(this.inputValue)); + if (this.ruleForm.nodynamiccruxs.indexOf(this.inputValue) == -1) { + this.ruleForm.nodynamiccruxs.push(this.inputValue); + } else { + this.$message.error("鍏抽敭瀛楀凡瀛樺湪"); + } + // this.noinputVisible = false; + this.noinputVisible = false; + } + this.generateRegex(row); + + this.inputValue = ""; + }, + showInput(row) { + // let index = this.TargetoptionList.indexOf(row); + this.inputVisible = true; + // this.$set(this.ruleForm, "inputVisible", true); + this.whether = 1; + }, + showInputno(row) { + // let index = this.TargetoptionList.indexOf(row); + this.noinputVisible = true; + // this.$set(this.ruleForm, "noinputVisible", true); + this.whether = 2; }, }, }; @@ -334,6 +574,28 @@ .button-textsc { color: rgb(235, 23, 23); } +.topicxq { + background-color: #e2f5fc; + border-radius: 4px; + margin-top: 10px; + padding: 10px; +} + +.el-tag + .el-tag { + margin-left: 10px; +} +.button-new-tag { + margin-left: 10px; + height: 32px; + line-height: 30px; + padding-top: 0; + padding-bottom: 0; +} +.input-new-tag { + width: 90px; + margin-left: 10px; + vertical-align: bottom; +} ::v-deep.el-table .warning-row { background: rgb(193, 208, 250); } -- Gitblit v1.9.3