lanjianrong 3 anni fa
parent
commit
9f3d033fa3
1 ha cambiato i file con 16 aggiunte e 64 eliminazioni
  1. 16 64
      src/pages/Role/Statistic/index.tsx

+ 16 - 64
src/pages/Role/Statistic/index.tsx

@@ -189,9 +189,9 @@ const Statistic = () => {
                         onChange(checked) {
                           if (!checked) {
                             formRef.current?.setFieldsValue({
-                              showSoftwareUsage: false,
-                              showInvoiceTrends: false,
-                              showInvoiceAggregate: false
+                              'software-usage': [],
+                              'invoice-aggregate': [],
+                              'invoice-trends': []
                             })
                           }
                         }
@@ -205,79 +205,31 @@ const Statistic = () => {
                       }
                     />
                     <div className="ml-25px">
-                      <ProFormSwitch
-                        fieldProps={{
-                          onChange(checked) {
-                            if (!checked) {
-                              formRef.current?.setFieldsValue({ 'software-usage': [] })
-                            }
-                            // 判断最外层按钮是否关闭
-                            if (checked && !formRef.current?.getFieldValue('showProduct')) {
-                              formRef.current?.setFieldsValue({ showProduct: true })
-                            }
-                          }
-                        }}
-                        name="showSoftwareUsage"
-                        label="软件锁用量"
-                      />
-                      <ProFormDependency name={['showSoftwareUsage']}>
-                        {({ showSoftwareUsage }) => (
+                      <ProFormDependency name={['showProduct']}>
+                        {({ showProduct }) => (
                           <ProFormCheckbox.Group
-                            wrapperCol={{ offset: 2 }}
                             name="software-usage"
-                            options={[
-                              { value: 'access', label: '查看', disabled: !showSoftwareUsage }
-                            ]}
+                            label="软件锁用量"
+                            options={[{ value: 'access', label: '查看', disabled: !showProduct }]}
                           />
                         )}
                       </ProFormDependency>
-                      <ProFormSwitch
-                        fieldProps={{
-                          onChange(checked) {
-                            if (!checked) {
-                              formRef.current?.setFieldsValue({ 'software-usage': [] })
-                            }
-                            if (checked && !formRef.current?.getFieldValue('showProduct')) {
-                              formRef.current?.setFieldsValue({ showProduct: true })
-                            }
-                          }
-                        }}
-                        name="showInvoiceAggregate"
-                        label="发票收款入账汇总"
-                      />
-                      <ProFormDependency name={['showInvoiceAggregate']}>
-                        {({ showInvoiceAggregate }) => (
+
+                      <ProFormDependency name={['showProduct']}>
+                        {({ showProduct }) => (
                           <ProFormCheckbox.Group
-                            wrapperCol={{ offset: 2 }}
                             name="invoice-aggregate"
-                            options={[
-                              { value: 'access', label: '查看', disabled: !showInvoiceAggregate }
-                            ]}
+                            label="发票收款入账汇总"
+                            options={[{ value: 'access', label: '查看', disabled: !showProduct }]}
                           />
                         )}
                       </ProFormDependency>
-                      <ProFormSwitch
-                        fieldProps={{
-                          onChange(checked) {
-                            if (!checked) {
-                              formRef.current?.setFieldsValue({ 'invoice-trends': [] })
-                            }
-                            if (checked && !formRef.current?.getFieldValue('showProduct')) {
-                              formRef.current?.setFieldsValue({ showProduct: true })
-                            }
-                          }
-                        }}
-                        name="showInvoiceTrends"
-                        label="发票收款入账趋势"
-                      />
-                      <ProFormDependency name={['showInvoiceTrends']}>
-                        {({ showInvoiceTrends }) => (
+                      <ProFormDependency name={['showProduct']}>
+                        {({ showProduct }) => (
                           <ProFormCheckbox.Group
-                            wrapperCol={{ offset: 2 }}
                             name="invoice-trends"
-                            options={[
-                              { value: 'access', label: '查看', disabled: !showInvoiceTrends }
-                            ]}
+                            label="发票收款入账趋势"
+                            options={[{ value: 'access', label: '查看', disabled: !showProduct }]}
                           />
                         )}
                       </ProFormDependency>