瀏覽代碼

删除客户资料

huangbin 4 年之前
父節點
當前提交
3378d82b83

+ 0 - 25
src/common/setup/modal/interface.ts

@@ -1,25 +0,0 @@
-// 弹窗名
-export interface ModalName {
-    notice: string; // 消息
-    logout: string; // 退出登录
-    drawer: string; // 下单通用界面
-
-    addCustomInfo: string; // 新增客户资料
-    custom_info_btn_modify: string; // 修改客户资料
-    custom_info_btn_disable: string; // 停用客户资料
-    custom_info_btn_delete: string; // 删除客户资料
-    custom_info_btn_recover: string; // 恢复客户资料
-    customDetail: string; // 客户资料详情
-
-    addSpotContract: string; // 新增现货合同
-    resubmitSpotContract: string; // 重新提交现货合同
-    modifySpotContract: string; // 修改现货合同
-    deleteSpotContract: string; // 删除现货合同
-    spotContractDetail: string; // 现货合同详情
-    spotContractFinish: string; // 现货合同 正常完结
-    spotContractCheck: string; // 现货合同 审核
-    spotContractCancel: string; // 现货合同 撤销
-
-    addGoods: string; // 新增商品
-    purchase_pending_someprice: string; //点价登记
-}

+ 12 - 6
src/common/setup/modal/modal.ts

@@ -1,15 +1,13 @@
 import { ModalName } from '@/common/constants/modalName';
-import { inject, provide, ref, watchEffect } from 'vue';
-
-// 控制弹窗
-
+import { inject, provide, ref, SetupContext, watchEffect } from 'vue';
 
 /**
  * 控制关闭弹窗
  * @param modelName 相对应的弹窗组件名
+ * @param context 上次ui上下文,用于关闭弹窗时候需要刷新数据
  * @returns 
  */
-export function closeModal(modelName: keyof ModalName) {
+export function closeModal(modelName: keyof ModalName, context?: SetupContext) {
     // 控制弹窗 flag
     const visible = ref<boolean>(false);
     const show = inject(modelName, ref<boolean>(false))
@@ -23,7 +21,13 @@ export function closeModal(modelName: keyof ModalName) {
         visible.value = false;
         show.value = false
     }
-    return { visible, cancel }
+    // 组件关闭弹窗需要刷新列表数据
+    function refresh() {
+        context?.emit('refresh')
+        cancel()
+
+    }
+    return { visible, cancel, refresh }
 }
 
 /**
@@ -45,4 +49,6 @@ export function openModal(modelName: keyof ModalName, data?: any) {
     return { openAction }
 }
 
+
+
 export type { ModalName };

+ 2 - 0
src/views/birkin-bag/custom/compoments/detail/index.vue

@@ -33,6 +33,8 @@ export default defineComponent({
         },
     },
     setup(props) {
+        console.log('open');
+
         const { visible, cancel } = closeModal('detail');
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);

+ 12 - 10
src/views/birkin-bag/custom/list/unsubmit/index.vue

@@ -31,8 +31,9 @@
     <!-- 新增 -->
     <AddCustom @refresh="queryTable" />
     <!-- 详情 -->
-    <CustomDetail :selectedRow="selectedRow"
-                  @refresh="queryTable" />
+    <!-- <CustomDetail :selectedRow="selectedRow"
+                  @refresh="queryTable" /> -->
+    <Middle :selectedRow="selectedRow" />
     <!-- 修改 -->
     <ModifyCustom :selectedRow="selectedRow"
                   @refresh="queryTable" />
@@ -50,6 +51,7 @@ import { filterCustomTable, CustomDetail, ModifyCustom, DisableCustom, AddCustom
 import { queryTableList, QueryCustomInfoType } from '../index';
 import { getStatusName } from '@/common/constants/enumsName';
 import { getCardTypeEnumItemName } from '@/common/constants/enumsName';
+import Middle from './compoments/controlModal/index.vue';
 
 export default defineComponent({
     name: 'custom_info_unsubmit',
@@ -62,6 +64,7 @@ export default defineComponent({
         AddCustom,
         DeleteCustom,
         BtnList,
+        Middle,
     },
     setup() {
         // 表头数据
@@ -108,14 +111,13 @@ export default defineComponent({
 
 <style lang="less">
 .custom_info_unsubmit {
-  .topTable {
-    .operBtn.ant-btn {
-      margin-top: 0;
-      margin-bottom: 0;
-      height: 26px;
-      line-height: 26px;
-      
+    .topTable {
+        .operBtn.ant-btn {
+            margin-top: 0;
+            margin-bottom: 0;
+            height: 26px;
+            line-height: 26px;
+        }
     }
-  }
 }
 </style>

+ 54 - 0
src/views/information/custom/list/unsubmit/compoments/controlModal/index.vue

@@ -0,0 +1,54 @@
+<template>
+  <div>
+    <!-- 详情 -->
+    <Detail :selectedRow="selectedRow"
+            @cancel="cancelDetail"
+            v-if="visibleDetail" />
+    <Delete :selectedRow="selectedRow" />
+  </div>
+</template>
+
+<script lang="ts">
+import { defineComponent, PropType } from 'vue';
+import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { closeModal } from '@/common/setup/modal';
+import Detail from '@/views/birkin-bag/custom/compoments/detail/index.vue';
+import Delete from '../delete/index.vue';
+
+export default defineComponent({
+    name: 'custom-detail-modal',
+    components: { Detail, Delete },
+    props: {
+        selectedRow: {
+            type: Object as PropType<QueryCustomInfoType>,
+            default: {},
+        },
+    },
+    setup(props, context) {
+        // 详情
+        const { visible: visibleDetail, cancel: cancelDetail, refresh: refreshDetail } = closeModal('detail');
+        // 删除客户资料
+        const { visible: visibleDelete, cancel: cancelDelete, refresh: refreshDelete } = closeModal('custom_info_btn_delete');
+        return {
+            visibleDetail,
+            cancelDetail,
+            visibleDelete,
+            cancelDelete,
+            refreshDelete,
+        };
+    },
+});
+</script>
+
+<style lang="less">
+.custom-detail {
+    .ant-form.inlineForm {
+        margin-top: 20px;
+    }
+    .upload {
+        .look {
+            margin-left: 0;
+        }
+    }
+}
+</style>;

+ 68 - 0
src/views/information/custom/list/unsubmit/compoments/delete/index.vue

@@ -0,0 +1,68 @@
+<template>
+  <!-- 删除客户资料-->
+  <a-modal class="commonModal recover-custom"
+           title="删除客户资料"
+           @cancel="cancel"
+           centered
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">删除客户资料
+      </a-button>
+    </template>
+    <Detail :selectedRow="selectedRow" />
+  </a-modal>
+</template>
+
+<script lang="ts">
+import { defineComponent, PropType, ref } from 'vue';
+import { DeleteUserReq, QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { Modal } from 'ant-design-vue';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { QueryDeleteUserInfoApply } from '@/services/go/ermcp/customInfo';
+import Detail from '@/views/information/custom/compoments/common-detail/index.vue';
+
+export default defineComponent({
+    name: 'recover-custom',
+    components: { Detail },
+    props: {
+        selectedRow: {
+            type: Object as PropType<QueryCustomInfoType>,
+            default: {},
+        },
+    },
+    setup(props, context) {
+        const loading = ref<boolean>(false);
+
+        function submit() {
+            Modal.confirm({
+                title: '是否确认删除客户资料',
+                okText: '确认删除',
+                cancelText: '取消',
+                onOk() {
+                    let reqParams: DeleteUserReq = {
+                        userID: props.selectedRow.userid,
+                    };
+                    requestResultLoadingAndInfo(QueryDeleteUserInfoApply, reqParams, loading, ['删除成功', '删除失败:']).then(() => {
+                        context.emit('refresh');
+                    });
+                },
+                onCancel() {},
+            });
+        }
+
+        return {
+            submit,
+            loading,
+        };
+    },
+});
+</script>
+
+<style lang="less">
+.recover-custom {
+}
+</style
+>;

+ 12 - 10
src/views/information/custom/list/unsubmit/index.vue

@@ -31,8 +31,9 @@
     <!-- 新增 -->
     <AddCustom @refresh="queryTable" />
     <!-- 详情 -->
-    <CustomDetail :selectedRow="selectedRow"
-                  @refresh="queryTable" />
+    <!-- <CustomDetail :selectedRow="selectedRow"
+                  @refresh="queryTable" /> -->
+    <Middle :selectedRow="selectedRow" />
     <!-- 修改 -->
     <ModifyCustom :selectedRow="selectedRow"
                   @refresh="queryTable" />
@@ -50,6 +51,7 @@ import { filterCustomTable, CustomDetail, ModifyCustom, DisableCustom, AddCustom
 import { queryTableList, QueryCustomInfoType } from '../index';
 import { getStatusName } from '@/common/constants/enumsName';
 import { getCardTypeEnumItemName } from '@/common/constants/enumsName';
+import Middle from './compoments/controlModal/index.vue';
 
 export default defineComponent({
     name: 'custom_info_unsubmit',
@@ -62,6 +64,7 @@ export default defineComponent({
         AddCustom,
         DeleteCustom,
         BtnList,
+        Middle,
     },
     setup() {
         // 表头数据
@@ -108,14 +111,13 @@ export default defineComponent({
 
 <style lang="less">
 .custom_info_unsubmit {
-  .topTable {
-    .operBtn.ant-btn {
-      margin-top: 0;
-      margin-bottom: 0;
-      height: 26px;
-      line-height: 26px;
-      
+    .topTable {
+        .operBtn.ant-btn {
+            margin-top: 0;
+            margin-bottom: 0;
+            height: 26px;
+            line-height: 26px;
+        }
     }
-  }
 }
 </style>