Browse Source

修改账目管理bug

wangwei 3 years ago
parent
commit
70521a0177

+ 3 - 14
src/views/money/bill/customCom/CustomApiTypeSelect.vue

@@ -28,7 +28,6 @@
     watchEffect,
     computed,
     unref,
-    watch,
     reactive,
     toRefs,
     onUpdated,
@@ -43,7 +42,7 @@
   import { useI18n } from '/@/hooks/web/useI18n';
   import { propTypes } from '/@/utils/propTypes';
 
-  type OptionsItem = { label: string; value: string; disabled?: boolean };
+  type OptionsItem = { label: string; value: string | number; disabled?: boolean };
 
   export default defineComponent({
     name: 'CustomApiTypeSelect',
@@ -59,7 +58,6 @@
         propTypes.string,
         propTypes.array,
       ]),
-      hideid: Number,
       numberToString: propTypes.bool,
       api: {
         type: Function as PropType<(arg?: Recordable) => Promise<OptionsItem[]>>,
@@ -112,13 +110,6 @@
         props.immediate && fetch();
       });
 
-      watch(
-        () => props.hideid,
-        () => {
-          fetch();
-        },
-        { deep: true }
-      );
       onUpdated(() => {
         if (typeof props.value === 'string') {
           reactData.disabled = true;
@@ -136,12 +127,10 @@
           const result = await api(props.params);
           const res: OptionsItem[] = [];
           result.list.map((item) => {
-            if (item.id !== props.hideid) {
-              res.push({ label: item.name, value: item.id });
-            }
+            res.push({ label: item.name, value: item.id });
           });
           if (props.type === 2) {
-            res.unshift({ label: '会费', value: '0' });
+            res.unshift({ label: '会费', value: 0 });
           }
           if (Array.isArray(res)) {
             options.value = res;

+ 3 - 5
src/views/money/bill/data.ts

@@ -276,7 +276,6 @@ export const schemas: FormSchema[] = [
       span: adaptWidth.elContainer,
     },
     render: ({ model, field }) => {
-      const hideid = model.inaccount;
       const filter = JSON.stringify({ inOut: model.type });
       const params = {
         filter: filter,
@@ -284,9 +283,8 @@ export const schemas: FormSchema[] = [
       return h(CustomApiTypeSelect, {
         placeholder: '交易名称',
         api: getTypeList,
-        value: model.account,
+        value: model.typename,
         type: model.type,
-        hideid: hideid,
         params: params,
         onChange(value) {
           model[field] = value;
@@ -381,13 +379,13 @@ export const schemas: FormSchema[] = [
       });
     },
     show: ({ values }) => {
-      if (values.typename === '会费' || (values.typename && values.typename.name === '会费')) {
+      if (values.typename === '会费' || values.typename === 0) {
         return true;
       }
       return false;
     },
     required: ({ values }) => {
-      if (values.typename === '会费' || (values.typename && values.typename.name === '会费')) {
+      if (values.typename === '会费' || values.typename === 0) {
         return true;
       }
       return false;