提交 0415e3a9 编写于 作者: alex.zhang's avatar alex.zhang

标签20可设个

上级 fa173bf1
...@@ -90,44 +90,9 @@ ...@@ -90,44 +90,9 @@
> >
<el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
<div style="margin-top: 20px; margin-left: 110px"> <div>
<el-select v-model="tag01" placeholder="请选择标签"> <div v-for="(u,i) in labelList" style="margin-top: 20px; margin-left: 110px">
<el-option <el-select v-model="labelList[i]" placeholder="请选择标签">
v-for="item in allLabelList"
:key="item.code"
:label="item.value"
:value="item.code"
></el-option>
</el-select>
<el-button v-if="labelCount==1" @click="addTagNew">+</el-button>
<el-button v-if="labelCount>1" @click="deleteTag(1)">-</el-button>
</div>
<div v-if="labelCount>1" style="margin-top: 20px; margin-left: 110px">
<el-select v-model="tag02" placeholder="请选择标签">
<el-option
v-for="item in allLabelList"
:key="item.code"
:label="item.value"
:value="item.code"
></el-option>
</el-select>
<el-button v-if="labelCount==2" @click="addTagNew">+</el-button>
<el-button @click="deleteTag(2)">-</el-button>
</div>
<div v-if="labelCount>2" style="margin-top: 20px; margin-left: 110px">
<el-select v-model="tag03" placeholder="请选择标签">
<el-option
v-for="item in allLabelList"
:key="item.code"
:label="item.value"
:value="item.code"
></el-option>
</el-select>
<el-button v-if="labelCount==3" @click="addTagNew">+</el-button>
<el-button @click="deleteTag(3)">-</el-button>
</div>
<div v-if="labelCount>3" style="margin-top: 20px; margin-left: 110px">
<el-select v-model="tag04" placeholder="请选择标签">
<el-option <el-option
v-for="item in allLabelList" v-for="item in allLabelList"
:key="item.code" :key="item.code"
...@@ -135,19 +100,9 @@ ...@@ -135,19 +100,9 @@
:value="item.code" :value="item.code"
></el-option> ></el-option>
</el-select> </el-select>
<el-button v-if="labelCount==4" @click="addTagNew">+</el-button> <el-button v-if="i==labelList.length-1 && i<19" @click="addTagNew">+</el-button>
<el-button @click="deleteTag(4)">-</el-button> <el-button v-if="labelList.length>1" @click="deleteTag(i)">-</el-button>
</div> </div>
<div v-if="labelCount>4" style="margin-top: 20px; margin-left: 110px">
<el-select v-model="tag05" placeholder="请选择标签">
<el-option
v-for="item in allLabelList"
:key="item.code"
:label="item.value"
:value="item.code"
></el-option>
</el-select>
<el-button @click="deleteTag(5)">-</el-button>
</div> </div>
<div slot="footer" style="text-align: center"> <div slot="footer" style="text-align: center">
...@@ -266,11 +221,11 @@ export default { ...@@ -266,11 +221,11 @@ export default {
setStatusVisible: false, setStatusVisible: false,
labelProjectMainId: "", labelProjectMainId: "",
tag01: "", // tag01: "",
tag02: "", // tag02: "",
tag03: "", // tag03: "",
tag04: "", // tag04: "",
tag05: "", // tag05: "",
labelCount: 1, labelCount: 1,
labelList: [], labelList: [],
allLabelList: [], allLabelList: [],
...@@ -312,18 +267,18 @@ export default { ...@@ -312,18 +267,18 @@ export default {
labelProjectMainId: [ labelProjectMainId: [
{ required: true, message: "请选择项目名称", trigger: "blur" }, { required: true, message: "请选择项目名称", trigger: "blur" },
], ],
// dingdingNumber: [ dingdingNumber: [
// { {
// required: true, required: false,
// validator: checkNumLength, validator: checkNumLength,
// message: "请输入正确格式的审批编号", message: "请输入正确格式的审批编号",
// trigger: ["blur", "change"], trigger: ["blur", "change"],
// }, },
// { {
// pattern: /^[5A-Za-z0-9-\_]+$/, pattern: /^[5A-Za-z0-9-\_]+$/,
// message: "只能输入英文,数字,下划线,横线", message: "只能输入英文,数字,下划线,横线",
// }, },
// ], ],
// dingdingDate: [ // dingdingDate: [
// { required: true, message: "请选择日期", trigger: "change" }, // { required: true, message: "请选择日期", trigger: "change" },
// ], // ],
...@@ -440,28 +395,8 @@ export default { ...@@ -440,28 +395,8 @@ export default {
{}, {},
(data) => { (data) => {
this.labelList = data.data; this.labelList = data.data;
if (this.labelList && this.labelList.length > 0) { if (this.labelList.length <= 0) {
this.labelCount = this.labelList.length; this.labelList = [""];
console.log(
"getHistoryLabel() : this.labelCount = " + this.labelCount
);
if (this.labelCount > 0) {
for (let item in this.labelList) {
if (item == 0) {
this.tag01 = this.labelList[item];
} else if (item == 1) {
this.tag02 = this.labelList[item];
} else if (item == 2) {
this.tag03 = this.labelList[item];
} else if (item == 3) {
this.tag04 = this.labelList[item];
} else if (item == 4) {
this.tag05 = this.labelList[item];
}
}
}
} else {
this.labelCount = 1;
} }
} }
); );
...@@ -471,30 +406,10 @@ export default { ...@@ -471,30 +406,10 @@ export default {
this.getHistoryLabel(); this.getHistoryLabel();
}, },
addTagNew() { addTagNew() {
this.labelCount++; this.labelList.push("");
}, },
deleteTag(index) { deleteTag(index) {
this.recodeTag(index); this.labelList.splice(index, 1);
this.labelCount--;
},
recodeTag(index) {
if (index == 1) {
this.tag01 = this.tag02;
this.tag02 = this.tag03;
this.tag03 = this.tag04;
this.tag04 = this.tag05;
} else if (index == 2) {
this.tag02 = this.tag03;
this.tag03 = this.tag04;
this.tag04 = this.tag05;
} else if (index == 3) {
this.tag03 = this.tag04;
this.tag04 = this.tag05;
} else if (index == 4) {
this.tag04 = this.tag05;
} else if (index == 5) {
this.tag05 = "";
}
}, },
setTagSave() { setTagSave() {
if (this.labelProjectMainId == null || this.labelProjectMainId == "") { if (this.labelProjectMainId == null || this.labelProjectMainId == "") {
...@@ -502,14 +417,6 @@ export default { ...@@ -502,14 +417,6 @@ export default {
return; return;
} }
this.labelList = [
this.tag01,
this.tag02,
this.tag03,
this.tag04,
this.tag05,
];
let checkTagValid = false; let checkTagValid = false;
for (let item = 0; item < this.labelList.length; item++) { for (let item = 0; item < this.labelList.length; item++) {
if (this.labelList[item] != null && this.labelList[item] != "") { if (this.labelList[item] != null && this.labelList[item] != "") {
...@@ -523,6 +430,17 @@ export default { ...@@ -523,6 +430,17 @@ export default {
return; return;
} }
for (let item = 0; item < this.labelList.length; item++) {
console.log("setTagSave() : item = " + item);
if (this.labelList[item] == "") {
this.deleteTag(item);
if (item != 0) {
item--;
}
}
}
let req = { let req = {
codes: this.labelList, codes: this.labelList,
projectMainId: this.labelProjectMainId, projectMainId: this.labelProjectMainId,
...@@ -543,11 +461,11 @@ export default { ...@@ -543,11 +461,11 @@ export default {
); );
}, },
clearLabelData() { clearLabelData() {
this.tag01 = ""; // this.tag01 = "";
this.tag02 = ""; // this.tag02 = "";
this.tag03 = ""; // this.tag03 = "";
this.tag04 = ""; // this.tag04 = "";
this.tag05 = ""; // this.tag05 = "";
this.labelList = []; this.labelList = [];
}, },
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册