Ver Fonte

修改登录账户

huangbin há 4 anos atrás
pai
commit
d3adf4e6c5

+ 4 - 4
src/common/components/buttonList/index.vue

@@ -19,14 +19,14 @@ export default defineComponent({
             default: [],
             type: Array as PropType<BtnList[]>,
         },
-        index: {
-            default: 0,
-            type: Number,
+        selectedData: {
+            default: {},
+            type: Object,
         },
     },
     setup(props, context) {
         function onClick(fn: Function) {
-            context.emit('onClick', props.index);
+            context.emit('onClick', props.selectedData);
             fn && fn();
         }
         return { onClick };

+ 64 - 57
src/views/information/account_info/compoments/modify-business/index.vue

@@ -1,7 +1,7 @@
 <template>
-  <!-- 修改账户 -->
+  <!-- 修改登录账户 -->
   <a-modal class="commonModal add-business-info"
-           title="修改业务账户"
+           title="修改登录账户"
            v-model:visible="visible"
            @cancel="cancel"
            centered
@@ -20,14 +20,15 @@
       <a-row :gutter="24">
         <a-col :span="12">
           <a-form-item label="账户角色"
-                       name="userinfotype">
-            <a-checkbox-group class="commonCheckboxGroup">
+                       name="roleids">
+            <a-checkbox-group class="commonCheckboxGroup"
+                              v-model:value="formState.roleids">
               <a-row>
                 <a-col :span="12">
-                  <a-checkbox value="A">业务员</a-checkbox>
+                  <a-checkbox :value="22">业务员</a-checkbox>
                 </a-col>
                 <a-col :span="12">
-                  <a-checkbox value="B">跟单员</a-checkbox>
+                  <a-checkbox :value="23">跟单员</a-checkbox>
                 </a-col>
               </a-row>
             </a-checkbox-group>
@@ -35,33 +36,29 @@
         </a-col>
         <a-col :span="12">
           <a-form-item label="账户名称"
-                       name="">
+                       name="logincode">
             <a-input class="dialogInput"
                      style="width: 200px"
+                     v-model:value="formState.logincode"
                      placeholder="请输入账户名称" />
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="登录账号"
-                       name="">
+                       name="accountname">
             <a-input class="dialogInput"
                      style="width: 200px"
+                     readonly
+                     v-model:value="formState.accountname"
                      placeholder="请输入登录账号" />
           </a-form-item>
         </a-col>
         <a-col :span="12">
-          <a-form-item label="登录密码"
-                       name="">
-            <a-input-password class="dialogInput"
-                              style="width: 200px"
-                              placeholder="请输入登录密码" />
-          </a-form-item>
-        </a-col>
-        <a-col :span="24">
           <a-form-item label="手机号码"
-                       name="">
+                       name="mobile">
             <a-input class="dialogInput"
                      style="width: 200px"
+                     v-model:value="formState.mobile"
                      placeholder="请输入手机号码" />
           </a-form-item>
         </a-col>
@@ -72,55 +69,64 @@
 
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
-import { initData } from '@/common/methods/index';
-import { defineComponent, ref, reactive, toRaw, UnwrapRef } from 'vue';
-import { AllEnums } from '@/services/go/commonService/interface';
-import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+import { defineComponent, ref, toRaw, watchEffect, PropType } from 'vue';
+import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+import { handleBusinessForm } from '../setup';
+import { BusinessFormState } from '../interface';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { loginAccountOperate } from '@/services/proto/accountinfo';
+import { mergeTwoObj } from '@/utils/objHandle';
+import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
 
 export default defineComponent({
     name: 'add-custom',
     components: {},
-    setup() {
+    props: {
+        selectedData: {
+            default: {},
+            type: Object as PropType<ErmcpLoginUser>,
+        },
+    },
+    setup(props, context) {
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_business_btn_modify');
-        // 证件类型
-        // const cardTypeList = ref<AllEnums[]>(getCardType());
-        // // 表单
-        // const formRef = ref();
-        // const formState: UnwrapRef<FormState> = reactive(initFormState());
-        // const rules = {
-        //     userinfotype: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
-        //     customername: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
-        //     nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
-        //     cardtype: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
-        // };
-        // // 下单方法
-        // const { loading, applyAction } = handleApply();
-        // function isPersonal(): boolean {
-        //     return formState.userinfotype === '1';
-        // }
-        // function submit() {
-        //     formRef.value
-        //         .validate()
-        //         .then(() => {
-        //             const param = toRaw(formState);
-        //             applyAction(param);
-        //             console.log('values', formState);
-        //         })
-        //         .catch((error: ValidateErrorEntity<FormState>) => {
-        //             console.log('error', error);
-        //         });
-        // }
+        const { rules, formState, formRef } = handleBusinessForm();
+        const loading = ref<boolean>(false);
+        watchEffect(() => {
+            if (visible.value) {
+                mergeTwoObj(formState, props.selectedData);
+                // roletype	:string;//角色类型(逗号隔开,如22,23), 22:业务员 23:跟单员 24:交易员
+                formState.roleids = props.selectedData.roletype.split(',').map((e) => +e);
+            }
+        });
+        function submit() {
+            formRef.value
+                .validate()
+                .then(() => {
+                    const param = toRaw(formState);
+                    const reqParam = {
+                        operatetype: 2,
+                    };
+                    Object.assign(reqParam, param);
+                    console.log('reqParam', reqParam);
+
+                    requestResultLoadingAndInfo(loginAccountOperate, reqParam, loading, ['修改账户成功', '修改账户失败:']).then(() => {
+                        cancel();
+                        context.emit('refresh');
+                    });
+                })
+                .catch((error: ValidateErrorEntity<BusinessFormState>) => {
+                    console.log('error', error);
+                });
+        }
         return {
-            // formState,
-            // rules,
-            // formRef,
-            // cardTypeList,
-            // isPersonal,
+            formState,
+            rules,
+            formRef,
             visible,
             cancel,
-            // submit,
-            // loading,
+            submit,
+            loading,
         };
     },
 });
@@ -221,3 +227,4 @@ export default defineComponent({
 }
 </style
 >;
+

+ 5 - 5
src/views/information/account_info/compoments/reset-business/index.vue

@@ -1,7 +1,7 @@
 <template>
-  <!-- 修改业务账户 -->
+  <!-- 重置登录账户密码 -->
   <a-modal class="add-custom"
-           title="重置业务账户密码"
+           title="重置登录账户密码"
            v-model:visible="visible"
            @cancel="cancel"
            centered
@@ -13,7 +13,7 @@
                 :loading="loading"
                 @click="submit">完成</a-button>
     </template>
-     <a-form class="inlineForm"
+    <a-form class="inlineForm"
             ref="formRef"
             :model="formState"
             :rules="rules">
@@ -21,7 +21,7 @@
         <a-col :span="12">
           <a-form-item label="登录账号"
                        name="userinfotype">
-           <span class="white">Y001</span>
+            <span class="white">Y001</span>
           </a-form-item>
         </a-col>
         <a-col :span="12">
@@ -40,7 +40,7 @@
                               placeholder="请输入8到20个字符的新密码" />
           </a-form-item>
         </a-col>
-         <a-col :span="12">
+        <a-col :span="12">
           <a-form-item label="确认新密码"
                        name="">
             <a-input-password class="dialogInput"

+ 21 - 15
src/views/information/account_info/list/account_info_business/index.vue

@@ -34,15 +34,14 @@
             <a-col :span="12">{{item.rolename}}({{item.userlist.length}})</a-col>
             <a-col :span="12">
               <BtnList :btnList="commonBtn"
-                       :index="i"
+                       :selectedData="item"
                        @onClick="openAction" />
             </a-col>
           </a-row>
         </template>
         <a-collapse class="busyCollapse"
-                    @change="collapseChange(sub)"
-                    v-for="(sub, i) in item.userlist"
-                    :key="i + '11'"
+                    v-for="(sub, j) in item.userlist"
+                    :key="j + '11'"
                     :bordered="false">
           <a-collapse-panel :show-arrow="false">
             <template #header>
@@ -51,20 +50,22 @@
                 <a-col :span="12">{{getLoginStatusEnumItemName(sub.loginstatus)}}</a-col>
               </a-row>
             </template>
-            <BtnList :btnList="forDataBtn" />
+            <BtnList :btnList="forDataBtn"
+                     :selectedData="sub"
+                     @onClick="chooseAction" />
           </a-collapse-panel>
         </a-collapse>
       </a-collapse-panel>
     </a-collapse>
     <Add @refresh="queryTable"
          :roleid="roleid" />
-    <Modify @selectedData="selectedData"
+    <Modify :selectedData="selectedData"
             @refresh="queryTable" />
-    <Reset @selectedData="selectedData"
+    <Reset :selectedData="selectedData"
            @refresh="queryTable" />
     <Locked />
     <Cancel />
-    <Detail @selectedData="selectedData" />
+    <Detail :selectedData="selectedData" />
   </div>
 </template>
 
@@ -72,7 +73,6 @@
 import { defineComponent, initData, getBtnList, contextMenu, BtnList } from '@/common/export/table';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import { queryTableList } from './setup';
-import { handleCollapse } from '../setup';
 import { getLoginStatusEnumItemName } from '@/common/constants/enumsName';
 import Add from '../../compoments/add-business/index.vue';
 import Modify from '../../compoments/modify-business/index.vue';
@@ -80,9 +80,9 @@ import Reset from '../../compoments/reset-business/index.vue';
 import Locked from '../../compoments/locked-business/index.vue';
 import Cancel from '../../compoments/cancel-business/index.vue';
 import Detail from '../../compoments/business-detail/index.vue';
-import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
+import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
 import { getUserName } from '@/services/bus/user';
-import { ref } from 'vue';
+import { reactive, ref } from 'vue';
 
 export default defineComponent({
     name: 'account_info_business',
@@ -100,16 +100,21 @@ export default defineComponent({
     setup() {
         const { loading, tableList, queryTable } = queryTableList();
         const { commonBtn, forDataBtn } = getBtnList('account_info_business', true);
-        const { selectedData, collapseChange } = handleCollapse<ErmcpLoginUser>();
+        // 角色id
         const roleid = ref<number>(0);
+        // 操作相关选中的数据
+        const selectedData = reactive({});
         initData(() => {
             queryTable();
         });
         // 查询
         function search(value: any) {}
         // 处理新增弹窗传递数据
-        function openAction(index: number) {
-            roleid.value = tableList.value[index].roleid;
+        function openAction(item: ErmcpLoginUserEx) {
+            roleid.value = item.roleid;
+        }
+        function chooseAction(item: ErmcpLoginUser) {
+            Object.assign(selectedData, item);
         }
         return {
             commonBtn,
@@ -120,10 +125,11 @@ export default defineComponent({
             getLoginStatusEnumItemName,
             queryTable,
             selectedData,
-            collapseChange,
+            // collapseChange,
             getUserName,
             openAction,
             roleid,
+            chooseAction,
         };
     },
 });

+ 0 - 14
src/views/information/account_info/list/setup.ts

@@ -1,17 +1,3 @@
-import { reactive } from "vue";
-
-/**
- * 处理折叠面板打开时候选中的数据
- * @returns 
- */
-export function handleCollapse<T>() {
-    const selectedData = reactive({})
-    function collapseChange(value: T) {
-        Object.assign(selectedData, value)
-    }
-    return { selectedData, collapseChange }
-}
-
 
 /**
  * 获取账户状态

+ 0 - 3
src/views/information/spot-contract/components/modify/index.vue

@@ -422,9 +422,6 @@ import { handleFormRule, handleContract, handleDeliveryGoods, handleAmout, handl
 import { addContractReq } from '@/views/information/spot-contract/components/add/setup';
 import { mergeTwoObj } from '@/utils/objHandle';
 
-interface Obj {
-    [props: string]: any;
-}
 export default defineComponent({
     name: 'modify-spot-contract',
     props: {