tangning 8 månader sedan
förälder
incheckning
a59d59b7f8
2 ändrade filer med 31 tillägg och 24 borttagningar
  1. 30 24
      src/views/product/rtk/AddModal.vue
  2. 1 0
      src/views/productOperation/cameraScene.vue

+ 30 - 24
src/views/product/rtk/AddModal.vue

@@ -22,7 +22,7 @@
   import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { uploadApi } from '/@/api/product/index';
-  import { rtkaccountFormSchema } from './data'
+  import { rtkaccountFormSchema } from './data';
   import { rtkDevicesaveOrEdit } from '/@/api/rtk/index';
   import { useI18n } from '/@/hooks/web/useI18n';
   import { useUserStore } from '/@/store/modules/user';
@@ -47,7 +47,8 @@
       const fileFlow = reactive({
         file: null,
         title: '新增RTK账号',
-      });let disabledDate = (current: any) => {
+      });
+      let disabledDate = (current: any) => {
         return current && current < moment().subtract(1, 'days').endOf('day');
       };
       let range = (start: any, end: any) => {
@@ -148,7 +149,7 @@
           componentProps: {
             maxLength: 50,
             onChange: (value) => {
-              handlertkSn(value.target.value);
+              // handlertkSn(value.target.value);
             },
           },
           colProps: {
@@ -199,7 +200,7 @@
             {
               required: true,
               // @ts-ignore
-              validator: (rule, value, ) => {
+              validator: (rule, value) => {
                 function isSpec(s) {
                   var pattern = /[~!@#$%^&*<>|']/gi;
                   return pattern.test(s);
@@ -284,29 +285,32 @@
           },
           // required: true,
         },
-        {
-          field: 'failureTime',
-          component: 'DatePicker',
-          label: '到期日期',
-          ifShow: false,
-          colProps: {
-            span: 16,
-          },
-          componentProps: {
-            disabledDate: disabledDate,
-            disabledTime: disabledDateTime,
-            showTime: { defaultValue: moment('23:59:59', 'HH:mm:ss') },
-            valueFormat: 'YYYY-MM-DD HH:mm:ss',
-
-            // defaultValue: dayjs().add(7, 'day').format('YYYY-MM-DD') + ' 23:59:59',
-            format: 'YYYY-MM-DD HH:mm:ss',
-          },
-        },
       ];
       const [registerForm, { validate, resetFields, setFieldsValue, updateSchema, clearValidate }] =
         useForm({
           labelWidth: 120,
-          schemas: [...schemas, ...rtkaccountFormSchema ],
+          schemas: [
+            ...schemas,
+            ...rtkaccountFormSchema,
+            {
+              field: 'failureTime',
+              component: 'DatePicker',
+              label: '到期日期',
+              ifShow: false,
+              colProps: {
+                span: 16,
+              },
+              componentProps: {
+                disabledDate: disabledDate,
+                disabledTime: disabledDateTime,
+                showTime: { defaultValue: moment('23:59:59', 'HH:mm:ss') },
+                valueFormat: 'YYYY-MM-DD HH:mm:ss',
+
+                // defaultValue: dayjs().add(7, 'day').format('YYYY-MM-DD') + ' 23:59:59',
+                format: 'YYYY-MM-DD HH:mm:ss',
+              },
+            },
+          ],
           showActionButtonGroup: false,
           actionColOptions: {
             span: 18,
@@ -321,7 +325,7 @@
       function onDataReceive(data) {
         modelRef.value = data;
         fileFlow.title = data.id ? '编辑RTK' : '新增RTK';
-        handlertkSn(data.cameraSn ? true : false);
+        // handlertkSn(data.cameraSn ? true : false);
         resetFields();
         console.log('data', data);
         handlertkuserType(data.accountType != null ? data.accountType : 0);
@@ -334,6 +338,7 @@
         console.log('val', val);
         updateSchema([
           { field: 'accountType', ifShow: val != 0 },
+          { field: 'failureTime', ifShow: val == 0 },
         ]);
       }
       function handlertkuserType(val) {
@@ -348,6 +353,7 @@
           // { field: 'failureTime', ifShow: val == 0 && !iseur },
           { field: 'password', ifShow },
           { field: 'operator', ifShow },
+          { field: 'failureTime', ifShow },
         ]);
       }
       function handleCarmanType(val) {

+ 1 - 0
src/views/productOperation/cameraScene.vue

@@ -250,6 +250,7 @@
         tableType.value = val;
         let sgetForm = getForm();
         if(sgetForm){
+          sgetForm.resetFields()
           sgetForm.updateSchema(getSchemas(val))
         }
         console.log('sgetForm', sgetForm);