huangbin пре 4 година
родитељ
комит
f0a0619cbc

+ 8 - 6
src/services/go/ermcp/customInfo/index.ts

@@ -1,9 +1,9 @@
 /** ================================= 客户资料 ================================**/
 
-import { BaseResponse, commonSearch_go, commonUpdate_go } from '@/services/go/index';
 import APP from '@/services';
+import { BaseResponse, commonSearch_go, commonUpdate_go } from '@/services/go/index';
+import { AddUserInfoApplyReq, ModifyUserInfoApplyReq, ModifyUserInfoReq, QueryCustomInfoType } from './interface';
 import { QueryCustomInfoEnum } from './type';
-import {AddUserInfoApplyReq, ModifyUserInfoApplyReq, ModifyUserInfoReq, QueryCustomInfoType} from './interface';
 /** ================================= 信息 客户资料 ================================**/
 /**
  * 查询客户资料
@@ -62,9 +62,11 @@ export function QueryModifyUserInfo(req: ModifyUserInfoReq): Promise<BaseRespons
  * @constructor
  */
 export function QueryDeleteUserInfoApply(userID: number): Promise<string> {
-    return commonSearch_go('/Erms3/DeleteUserInfoApply', { userID }, ).catch((err) => {
-        throw new Error(`删除客户申请: ${err.message}`);
-    });
+    return commonSearch_go('/Erms3/DeleteUserInfoApply', { userID },)
+        .then(() => 'ok')
+        .catch((err) => {
+            throw new Error(`删除客户申请: ${err.message}`);
+        });
 }
 
 /**
@@ -74,7 +76,7 @@ export function QueryDeleteUserInfoApply(userID: number): Promise<string> {
  * @constructor
  */
 export function UpdateUserAccountStatus(userID: number, accountStatus: number): Promise<BaseResponse> {
-    return commonUpdate_go('/User/UpdateUserAccountStatus', { userID, accountStatus }, ).catch((err) => {
+    return commonUpdate_go('/User/UpdateUserAccountStatus', { userID, accountStatus },).catch((err) => {
         throw new Error(`更新用户状态: ${err.message}`);
     });
 }

+ 5 - 1
src/services/request/request.ts

@@ -27,7 +27,11 @@ request.interceptors.response.use(
     (response) => {
         // 状态码为2开头,对响应数据做点什么
         // console.log(response.data);
-        return response;
+        if (response.data.code === 200) {
+            return response;
+        } else {
+            return Promise.reject(response.data.msg);
+        }
     },
     async (error) => {
         // 状态码不为2开头,对响应错误做点什么

+ 104 - 100
src/views/information/custom/compoments/delete/index.vue

@@ -11,107 +11,107 @@
                 :loading="loading"
                 @click="submit">删除客户资料</a-button>
     </template>
-      <a-form class="inlineForm"
-              :form="form"
-              @submit="handleSearch">
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="客户类型">
-                      <span class="white">{{ selectedRow.userinfotype === '2' ? '企业' : '个人' }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="企业名称">
-                      <span class="white">{{ formatValue(selectedRow.customername) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="企业简称">
-                      <span class="white">{{ formatValue(selectedRow.nickname) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="证件类型">
-                      <span class="white">{{ formatValue(selectedRow.cardtypename) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="法定代表人">
-                      <span class="white">{{ formatValue(selectedRow.legalpersonname) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="证件号码">
-                      <span class="white">{{ formatValue(selectedRow.cardnum) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="纳税人识别号">
-                      <span class="white">{{ formatValue(selectedRow.taxpayernum) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="营业执照">
-                      <a class="blue">查看附件</a>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="联系人">
-                      <span class="white">{{ formatValue(selectedRow.contactname) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="联系人手机号">
-                      <span class="white">{{ formatValue(selectedRow.mobile) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="联系电话">
-                      <span class="white">{{ formatValue(selectedRow.telphone) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="状态">
-                      <span class="green">{{ formatValue(getStatusName(selectedRow.status)) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="24">
-                  <a-form-item label="通讯地址">
-                      <span class="white">{{ formatValue(selectedRow.address) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="24">
-                  <a-form-item label="备注">
-                      <span class="white">{{ formatValue(selectedRow.remark) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-      </a-form>
+    <a-form class="inlineForm"
+            :form="form"
+            @submit="handleSearch">
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="客户类型">
+            <span class="white">{{ selectedRow.userinfotype === '2' ? '企业' : '个人' }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="企业名称">
+            <span class="white">{{ formatValue(selectedRow.customername) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="企业简称">
+            <span class="white">{{ formatValue(selectedRow.nickname) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="证件类型">
+            <span class="white">{{ formatValue(selectedRow.cardtypename) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="法定代表人">
+            <span class="white">{{ formatValue(selectedRow.legalpersonname) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="证件号码">
+            <span class="white">{{ formatValue(selectedRow.cardnum) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="纳税人识别号">
+            <span class="white">{{ formatValue(selectedRow.taxpayernum) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="营业执照">
+            <a class="blue">查看附件</a>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="联系人">
+            <span class="white">{{ formatValue(selectedRow.contactname) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="联系人手机号">
+            <span class="white">{{ formatValue(selectedRow.mobile) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="联系电话">
+            <span class="white">{{ formatValue(selectedRow.telphone) }}</span>
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="状态">
+            <span class="green">{{ formatValue(getStatusName(selectedRow.status)) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="24">
+        <a-col :span="24">
+          <a-form-item label="通讯地址">
+            <span class="white">{{ formatValue(selectedRow.address) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+      <a-row :gutter="24">
+        <a-col :span="24">
+          <a-form-item label="备注">
+            <span class="white">{{ formatValue(selectedRow.remark) }}</span>
+          </a-form-item>
+        </a-col>
+      </a-row>
+    </a-form>
   </a-modal>
 </template>
 
 <script lang="ts">
-import {defineComponent, PropType, ref} from 'vue';
+import { defineComponent, PropType, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
-import {deleteUserInfo} from "@/views/information/custom/compoments/setup";
-import {QueryCustomInfoType} from "@/services/go/ermcp/customInfo/interface";
-import {formatValue} from "@/common/methods";
-import {getStatusName} from "@/views/information/custom/setup";
-import {Modal} from "ant-design-vue";
+import { deleteUserInfo } from '@/views/information/custom/compoments/setup';
+import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { formatValue } from '@/common/methods';
+import { getStatusName } from '@/views/information/custom/setup';
+import { Modal } from 'ant-design-vue';
 
 export default defineComponent({
     name: 'recover-custom',
@@ -122,16 +122,20 @@ export default defineComponent({
             default: {},
         },
     },
-    setup(props) {
+    setup(props, context) {
         const { visible, cancel } = closeModal('custom_info_btn_delete');
-        const {loading, deleteCustomerInfo} = deleteUserInfo();
-        function submit(){
+        const { loading, deleteCustomerInfo } = deleteUserInfo();
+        function submit() {
             Modal.confirm({
                 title: '是否确认删除客户资料',
                 okText: '确认删除',
                 cancelText: '取消',
                 onOk() {
-                    deleteCustomerInfo(props.selectedRow.userid, cancel)
+                    deleteCustomerInfo(props.selectedRow.userid).then(() => {
+                        cancel();
+                        // 通知上层  刷新数据
+                        context.emit('refresh');
+                    });
                 },
                 onCancel() {
                     console.log('Cancel');

+ 22 - 27
src/views/information/custom/compoments/setup.ts

@@ -1,9 +1,9 @@
-import {QueryDeleteUserInfoApply, QueryModifyUserInfo, UpdateUserAccountStatus} from "@/services/go/ermcp/customInfo";
-import {ModifyUserInfoReq} from "@/services/go/ermcp/customInfo/interface";
-import {ref} from "vue";
-import {message} from 'ant-design-vue';
-import {userInfoCheck} from "@/services/proto/accountinfo";
-import {UserInfoCheckMangeReq} from "@/services/proto/accountinfo/interface";
+import { QueryDeleteUserInfoApply, QueryModifyUserInfo, UpdateUserAccountStatus } from "@/services/go/ermcp/customInfo";
+import { ModifyUserInfoReq } from "@/services/go/ermcp/customInfo/interface";
+import { userInfoCheck } from "@/services/proto/accountinfo";
+import { UserInfoCheckMangeReq } from "@/services/proto/accountinfo/interface";
+import { message } from 'ant-design-vue';
+import { ref } from "vue";
 
 /**
  *  撤销客户资料 撤销后的数据会进入草稿(未提交)
@@ -27,11 +27,11 @@ export function cancelCustomInfo() {
                 cancelCustomInfo
                 message.error("撤销失败")
             }).finally(() => {
-            loading.value = false
-        })
+                loading.value = false
+            })
     }
 
-    return {loading, ModifyUserInfo}
+    return { loading, ModifyUserInfo }
 }
 
 /**
@@ -65,11 +65,11 @@ export function updateUserAccount() {
                 cancelCustomInfo
                 message.error("请求失败")
             }).finally(() => {
-            loading.value = false
-        })
+                loading.value = false
+            })
     }
 
-    return {loading, ModifyUserInfo}
+    return { loading, ModifyUserInfo }
 }
 
 /**
@@ -94,11 +94,11 @@ export function checkCustomInfo() {
             .catch((err) => {
                 message.error("提交失败")
             }).finally(() => {
-            loading.value = false
-        })
+                loading.value = false
+            })
     }
 
-    return {loading, checkCustomerInfo}
+    return { loading, checkCustomerInfo }
 }
 
 /**
@@ -108,26 +108,21 @@ export function deleteUserInfo() {
     const loading = ref<boolean>(false);
 
     // 这里调用的是修改客户申请接口
-    function deleteCustomerInfo(userID: number, callback: Function) {
-        QueryDeleteUserInfoApply(userID)
+    function deleteCustomerInfo(userID: number) {
+        return QueryDeleteUserInfoApply(userID)
             .then((res) => {
-                if (res === 'OK') {
-                    message.success("删除成功")
-                    console.log('撤销客户资料成功');
-                    callback()
-                } else {
-                    message.error("删除失败:" + res)
-                }
+                message.success("删除成功")
+                Promise.resolve('ok')
             })
             .catch((err) => {
                 cancelCustomInfo
                 message.error("删除失败")
             }).finally(() => {
-            loading.value = false
-        })
+                loading.value = false
+            })
     }
 
-    return {loading, deleteCustomerInfo}
+    return { loading, deleteCustomerInfo }
 }
 
 

+ 48 - 54
src/views/information/custom/list/stop-use/index.vue

@@ -1,59 +1,52 @@
 <template>
-    <!-- 客户信息: 停用 -->
-    <div class="custom-normal"
-         :loading="loading">
-        <filterCustomTable @search="search">
-            <BtnList :btnList="commonBtn"/>
-        </filterCustomTable>
-        <contextMenu :contextMenuList="forDataBtn">
-            <a-table :columns="columns"
-                     class="topTable"
-                     :expandedRowKeys="expandedRowKeys"
-                     :customRow="Rowclick"
-                     :pagination="false"
-                     rowKey="key"
-                     :data-source="tableList">
-                <!-- 额外的展开行 -->
-                <template #expandedRowRender="{  }">
-                    <BtnList :btnList="forDataBtn"/>
-                </template>
-                <template #userinfotype="{ text }">
-                    <a>{{ text === '2' ? '企业' : '个人' }}</a>
-                </template>
-                <template #status="{ text }">
-                    <a>{{ getStatusName(text) }}</a>
-                </template>
-                <template #cardtype="{ text }">
-                    <a>{{ getCardTypeName(text) }}</a>
-                </template>
-            </a-table>
-        </contextMenu>
-        <!-- 新增 -->
-        <AddCustom/>
-        <!-- 详情 -->
-        <CustomDetail :selectedRow="selectedRow"/>
-        <!-- 删除 -->
-        <DeleteCustom :selectedRow="selectedRow"/>
-        <!-- 恢复客户资料 -->
-        <RecoverCustom :selectedRow="selectedRow"/>
-    </div>
+  <!-- 客户信息: 停用 -->
+  <div class="custom-normal"
+       :loading="loading">
+    <filterCustomTable @search="search">
+      <BtnList :btnList="commonBtn" />
+    </filterCustomTable>
+    <contextMenu :contextMenuList="forDataBtn">
+      <a-table :columns="columns"
+               class="topTable"
+               :expandedRowKeys="expandedRowKeys"
+               :customRow="Rowclick"
+               :pagination="false"
+               rowKey="key"
+               :data-source="tableList">
+        <!-- 额外的展开行 -->
+        <template #expandedRowRender="{  }">
+          <BtnList :btnList="forDataBtn" />
+        </template>
+        <template #userinfotype="{ text }">
+          <a>{{ text === '2' ? '企业' : '个人' }}</a>
+        </template>
+        <template #status="{ text }">
+          <a>{{ getStatusName(text) }}</a>
+        </template>
+        <template #cardtype="{ text }">
+          <a>{{ getCardTypeName(text) }}</a>
+        </template>
+      </a-table>
+    </contextMenu>
+    <!-- 新增 -->
+    <AddCustom />
+    <!-- 详情 -->
+    <CustomDetail :selectedRow="selectedRow" />
+    <!-- 删除 -->
+    <DeleteCustom :selectedRow="selectedRow"
+                  @refresh="queryTable" />
+    <!-- 恢复客户资料 -->
+    <RecoverCustom :selectedRow="selectedRow" />
+  </div>
 </template>
 
 <script lang="ts">
-import {
-    defineComponent,
-    initData,
-    getTableColumns,
-    getTableEvent,
-    getBtnList,
-    contextMenu,
-    BtnList
-} from '@/common/export/table';
+import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
 
-import {filterCustomTable, CustomDetail, DeleteCustom, RecoverCustom, AddCustom} from '../../compoments';
+import { filterCustomTable, CustomDetail, DeleteCustom, RecoverCustom, AddCustom } from '../../compoments';
 
-import {queryTableList, getFilterTableCB, QueryCustomInfoType} from '../index';
-import {getCardTypeName, getStatusName} from "@/views/information/custom/setup";
+import { queryTableList, getFilterTableCB, QueryCustomInfoType } from '../index';
+import { getCardTypeName, getStatusName } from '@/views/information/custom/setup';
 
 export default defineComponent({
     name: 'custom-normal',
@@ -68,13 +61,13 @@ export default defineComponent({
     },
     setup() {
         // 表头数据
-        const {columns, registerColumn, updateColumn, filteredInfo} = getTableColumns();
+        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
         // 表格事件
-        const {expandedRowKeys, selectedRow, Rowclick} = getTableEvent<QueryCustomInfoType>({});
+        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<QueryCustomInfoType>({});
         // 表格操作按钮列表
-        const {commonBtn, forDataBtn} = getBtnList('custom_info_disabled', true);
+        const { commonBtn, forDataBtn } = getBtnList('custom_info_disabled', true);
         // 表格列表数据
-        const {loading, tableList, queryTable} = queryTableList(4);
+        const { loading, tableList, queryTable } = queryTableList(4);
         initData(() => {
             // 获取列表数据
             queryTable();
@@ -102,6 +95,7 @@ export default defineComponent({
             search,
             getStatusName,
             getCardTypeName,
+            queryTable,
         };
     },
 });