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

标签20可设个

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