Kaynağa Gözat

feat(page-modal): 添加操作成功和失败的提示信息

闪电 11 ay önce
ebeveyn
işleme
9504cf39cf

+ 18 - 5
src/components/page-modal/src/page-modal.vue

24
 
24
 
25
   import JyForm from '@/base-ui/form';
25
   import JyForm from '@/base-ui/form';
26
   import { loadRouteLocation } from 'vue-router';
26
   import { loadRouteLocation } from 'vue-router';
27
+import { ElMessage } from 'element-plus';
27
 
28
 
28
   export default defineComponent({
29
   export default defineComponent({
29
     components: {
30
     components: {
190
 
191
 
191
               useSystemStore()
192
               useSystemStore()
192
                 .editPageDataAction(query)
193
                 .editPageDataAction(query)
193
-                .then(() => {
194
-                  console.log('emit')
195
-                  emit('submit', form);
194
+                .then((res) => {
195
+                  if (res.state && res.state === 'success') {
196
+                    ElMessage.success('操作成功');
197
+                    emit('submit', form);
198
+                  } else {
199
+                    ElMessage.error('操作失败');
200
+                  }
201
+                  
196
                 });
202
                 });
197
             } else {
203
             } else {
198
               // 新建
204
               // 新建
209
 
215
 
210
               useSystemStore()
216
               useSystemStore()
211
                 .createPageDataAction(query)
217
                 .createPageDataAction(query)
212
-                .then(() => {
213
-                  emit('submit', form);
218
+                .then((res) => {
219
+                  // emit('submit', form);
220
+                  if (res.state && res.state === 'success') {
221
+                    ElMessage.success('操作成功');
222
+                    emit('submit', form);
223
+                  } else {
224
+                    ElMessage.error('操作失败');
225
+                  }
214
                 });
226
                 });
215
             }
227
             }
216
           } else {
228
           } else {
229
+            ElMessage.error('操作失败');
217
             console.log('error submit!', fields);
230
             console.log('error submit!', fields);
218
           }
231
           }
219
         });
232
         });

+ 7 - 2
src/store/main/system/system.js

74
       // 1.创建数据的请求
74
       // 1.创建数据的请求
75
       const { pageName, newData, subimitLoding = true, pageNum = 1, pageSize = 10 } = payload
75
       const { pageName, newData, subimitLoding = true, pageNum = 1, pageSize = 10 } = payload
76
       const pageUrl = `${pageName}`
76
       const pageUrl = `${pageName}`
77
-      await createPageData(pageUrl, newData)
77
+      const res = await createPageData(pageUrl, newData)
78
 
78
 
79
       // 2.请求最新的数据
79
       // 2.请求最新的数据
80
       if (subimitLoding) {
80
       if (subimitLoding) {
87
         })
87
         })
88
       }
88
       }
89
 
89
 
90
+      return res;
91
+
90
     },
92
     },
91
     async editPageDataAction(payload) {
93
     async editPageDataAction(payload) {
92
       // 1.编辑数据的请求
94
       // 1.编辑数据的请求
93
       const { pageName, editData, id, idName, subimitLoding = true, pageNum = 1, pageSize = 10 } = payload
95
       const { pageName, editData, id, idName, subimitLoding = true, pageNum = 1, pageSize = 10 } = payload
94
       const pageUrl = `${pageName}`
96
       const pageUrl = `${pageName}`
95
       editData[idName] = id
97
       editData[idName] = id
96
-      await editPageData(pageUrl, editData)
98
+      const res = await editPageData(pageUrl, editData)
99
+      // console.log(res, 'res')
97
       // 2.请求最新的数据
100
       // 2.请求最新的数据
98
       if (subimitLoding) {
101
       if (subimitLoding) {
99
         this.getPageListAction({
102
         this.getPageListAction({
105
           }
108
           }
106
         })
109
         })
107
       }
110
       }
111
+
112
+      return res;
108
       
113
       
109
     },
114
     },
110
     async importPageDataAction(payload) {
115
     async importPageDataAction(payload) {

+ 1 - 1
src/views/main/patientFile/patientFileList/patientFileList.vue

220
 
220
 
221
     const blackSubmit = (data) => {
221
     const blackSubmit = (data) => {
222
       console.log('黑名单', data)
222
       console.log('黑名单', data)
223
-      if (data.patientId) ElMessage.success('加入黑名单成功')
223
+      // if (data.patientId) ElMessage.success('加入黑名单成功')
224
       // blackModalRef.value.dialogVisible = false
224
       // blackModalRef.value.dialogVisible = false
225
     }
225
     }
226
 
226