🐞 fix(标签): 标签模块parentId传空字符串

dev
zhangjiabao 8 months ago
parent 649647add1
commit ab562bad25

@ -51,9 +51,9 @@ export default {
* @param {*} data
* @returns
*/
update(data) {
update(id, data) {
return request({
url: `/luoo-tag/tag/${data.id}`,
url: `/luoo-tag/tag/${id}`,
method: "put",
data
});

@ -355,7 +355,7 @@ export default {
let queryParam = {
...param
};
queryParam.level = this.tagType
queryParam.level = this.tagType;
if (param.timeRange) {
if (param.timeRange[0]) {
queryParam.createTimeStart = param.timeRange[0] + " 00:00:00";
@ -391,15 +391,15 @@ export default {
fetchParentNameList() {
tagApi.parentNameList().then(res => {
if (res.code === 200) {
if(!res.data){
this.queryForm.remoteData.parentTag = []
return
if (!res.data) {
this.queryForm.remoteData.parentTag = [];
return;
}
let newList = []
for(let index in res.data){
if(res.data[index].level === 1){
newList.push(res.data[index])
let newList = [];
for (let index in res.data) {
if (res.data[index].level === 1) {
newList.push(res.data[index]);
}
}
this.queryForm.remoteData.parentTag = newList;
@ -511,9 +511,18 @@ export default {
handleDialogSubmit() {
this.$refs.modifyDialogForm.validate(valid => {
if (valid) {
let data = {
nameCh: this.modifyDialog.form.data["nameCh"],
nameEn: this.modifyDialog.form.data["nameEn"],
parentId:
this.modifyDialog.form.data["parentId"] === null ||
this.modifyDialog.form.data["parentId"] === undefined
? ""
: this.modifyDialog.form.data["parentId"]
};
//
if (this.modifyDialog.type === 0) {
tagApi.create(this.modifyDialog.form.data).then(res => {
tagApi.create(data).then(res => {
if (res.code === 200) {
this.$message.success(res.message);
this.modifyDialog.visible = false;
@ -530,7 +539,7 @@ export default {
//
if (this.modifyDialog.type === 1) {
tagApi.update(this.modifyDialog.form.data).then(res => {
tagApi.update(this.modifyDialog.form.data.id, data).then(res => {
if (res.code === 200) {
this.$message.success(res.message);
this.modifyDialog.visible = false;
@ -544,7 +553,7 @@ export default {
//
if (this.modifyDialog.type === 2) {
tagApi.create(this.modifyDialog.form.data).then(res => {
tagApi.create(data).then(res => {
if (res.code === 200) {
this.$message.success(res.message);
this.modifyDialog.visible = false;

Loading…
Cancel
Save