|
@@ -24,6 +24,8 @@
|
|
import { uploadApi } from '/@/api/product/index';
|
|
import { uploadApi } from '/@/api/product/index';
|
|
import { rtkDevicesaveOrEdit } from '/@/api/rtk/index';
|
|
import { rtkDevicesaveOrEdit } from '/@/api/rtk/index';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
|
+ import { useUserStore } from '/@/store/modules/user';
|
|
|
|
+ import moment from 'moment';
|
|
|
|
|
|
const { t } = useI18n();
|
|
const { t } = useI18n();
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
@@ -33,6 +35,8 @@
|
|
},
|
|
},
|
|
emits: ['update', 'register'],
|
|
emits: ['update', 'register'],
|
|
setup(props, { emit }) {
|
|
setup(props, { emit }) {
|
|
|
|
+ const userStore = useUserStore();
|
|
|
|
+ const iseur = userStore.isEnv;
|
|
const modelRef = ref({
|
|
const modelRef = ref({
|
|
operator: '中国移动',
|
|
operator: '中国移动',
|
|
ipAddr: '120.253.239.161',
|
|
ipAddr: '120.253.239.161',
|
|
@@ -42,7 +46,55 @@
|
|
const fileFlow = reactive({
|
|
const fileFlow = reactive({
|
|
file: null,
|
|
file: null,
|
|
title: '新增RTK账号',
|
|
title: '新增RTK账号',
|
|
- });
|
|
|
|
|
|
+ });let disabledDate = (current: any) => {
|
|
|
|
+ return current && current < moment().subtract(1, 'days').endOf('day');
|
|
|
|
+ };
|
|
|
|
+ let range = (start: any, end: any) => {
|
|
|
|
+ const result = [];
|
|
|
|
+ for (let i = start; i < end; i++) {
|
|
|
|
+ result.push(i);
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ };
|
|
|
|
+ let disabledDateTime = (current: any) => {
|
|
|
|
+ if (current) {
|
|
|
|
+ let today = moment().date();
|
|
|
|
+ if (today == current.date()) {
|
|
|
|
+ let minute = Number(moment().minutes());
|
|
|
|
+ let hour = Number(moment().hour());
|
|
|
|
+ let finalHour: number, finalMinute: number;
|
|
|
|
+ console.log('today', minute, current.hour(), hour);
|
|
|
|
+ // if (current.hour() > hour) {
|
|
|
|
+ // finalMinute = 0;
|
|
|
|
+ // } else {
|
|
|
|
+ if (current.minute() >= 58) {
|
|
|
|
+ finalHour = hour + 1;
|
|
|
|
+ finalMinute = 0;
|
|
|
|
+ } else {
|
|
|
|
+ finalHour = hour;
|
|
|
|
+ finalMinute = minute + 5;
|
|
|
|
+ }
|
|
|
|
+ // }
|
|
|
|
+ console.log('today', finalHour, finalMinute);
|
|
|
|
+ return {
|
|
|
|
+ disabledHours: () => range(0, finalHour),
|
|
|
|
+ disabledMinutes: () => range(0, finalMinute),
|
|
|
|
+ };
|
|
|
|
+ } else if (moment() > current) {
|
|
|
|
+ return {
|
|
|
|
+ disabledHours: () => range(0, 24),
|
|
|
|
+ disabledMinutes: () => range(0, 60),
|
|
|
|
+ disabledSeconds: () => range(0, 60),
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return {
|
|
|
|
+ disabledHours: () => range(0, 24),
|
|
|
|
+ disabledMinutes: () => range(0, 60),
|
|
|
|
+ disabledSeconds: () => range(0, 60),
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ };
|
|
const { createMessage } = useMessage();
|
|
const { createMessage } = useMessage();
|
|
const schemas: FormSchema[] = [
|
|
const schemas: FormSchema[] = [
|
|
{
|
|
{
|
|
@@ -170,6 +222,23 @@
|
|
span: 20,
|
|
span: 20,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ field: 'failureTime',
|
|
|
|
+ component: 'DatePicker',
|
|
|
|
+ label: '到期日期',
|
|
|
|
+ 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 }] =
|
|
const [registerForm, { validate, resetFields, setFieldsValue, updateSchema, clearValidate }] =
|
|
useForm({
|
|
useForm({
|
|
@@ -205,6 +274,7 @@
|
|
{ field: 'port', ifShow },
|
|
{ field: 'port', ifShow },
|
|
{ field: 'userName', ifShow },
|
|
{ field: 'userName', ifShow },
|
|
// { field: 'sgRtkSn', ifShow },
|
|
// { field: 'sgRtkSn', ifShow },
|
|
|
|
+ { field: 'failureTime', ifShow: val == 1 && !iseur },
|
|
{ field: 'password', ifShow },
|
|
{ field: 'password', ifShow },
|
|
{ field: 'operator', ifShow },
|
|
{ field: 'operator', ifShow },
|
|
]);
|
|
]);
|