CzRger 6 months ago
parent
commit
3877bd4ac0
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/views/manage/theme/relation-detail.vue

+ 4 - 4
src/views/manage/theme/relation-detail.vue

@@ -213,8 +213,8 @@ const onSubmit = () => {
     } as any).then(() => {
       state.loading = true
       const params = {...state.form}
-      params.indexCondition = JSON.stringify(state.conditionTable.data)
-      params.indexOrder = JSON.stringify(state.sortTable.data)
+      params.indexCondition = state.conditionTable.data.length > 0 ? JSON.stringify(state.conditionTable.data) : ''
+      params.indexOrder = state.sortTable.data.length > 0 ? JSON.stringify(state.sortTable.data) : ''
       if (props.transfer.mode === 'add') {
         params.themeId = props.transfer.themeId
         params.indexId = props.transfer.indexId
@@ -254,8 +254,8 @@ const initDetail = () => {
   sysThemeIndexFindById(props.transfer.id).then(res => {
     if (res.code === 200) {
       state.form = res.data
-      state.conditionTable.data = JSON.parse(state.form.indexCondition)
-      state.sortTable.data = JSON.parse(state.form.indexOrder)
+      state.conditionTable.data = state.form.indexCondition ? JSON.parse(state.form.indexCondition) : []
+      state.sortTable.data = state.form.indexOrder ? JSON.parse(state.form.indexOrder) : []
       initText(state.form.indexId)
     } else {
       ElMessage.error(res.msg)