|
@@ -26,8 +26,9 @@
|
|
import { uploadApi } from '/@/api/product/index';
|
|
import { uploadApi } from '/@/api/product/index';
|
|
import { copyTextToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
import { copyTextToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
import { ResultEnum } from '/@/enums/httpEnum';
|
|
import { ResultEnum } from '/@/enums/httpEnum';
|
|
- import { authorizeInstalladdOrUpdate, checkMachineCode } from '/@/api/authorizeModeling';
|
|
|
|
|
|
+ import { authorizeRtkAdd, checkMachineCode } from '/@/api/authorizeModeling';
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
|
+ import moment from 'moment';
|
|
import { otherInfoStore } from '/@/store/modules/other';
|
|
import { otherInfoStore } from '/@/store/modules/other';
|
|
import { incrementUseTypeList } from '/@/api/account';
|
|
import { incrementUseTypeList } from '/@/api/account';
|
|
|
|
|
|
@@ -51,35 +52,39 @@
|
|
const { createMessage, createConfirm, createSuccessModal } = useMessage();
|
|
const { createMessage, createConfirm, createSuccessModal } = useMessage();
|
|
const schemas: FormSchema[] = [
|
|
const schemas: FormSchema[] = [
|
|
{
|
|
{
|
|
- field: 'id',
|
|
|
|
|
|
+ field: 'rtkSnCode',
|
|
component: 'Input',
|
|
component: 'Input',
|
|
show: false,
|
|
show: false,
|
|
label: 'id',
|
|
label: 'id',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- field: 'machineCode1',
|
|
|
|
|
|
+ field: 'validDay',
|
|
component: 'Select',
|
|
component: 'Select',
|
|
required: true,
|
|
required: true,
|
|
- defaultValue: 1,
|
|
|
|
|
|
+ defaultValue: '1年',
|
|
label: '*差分账号期限',
|
|
label: '*差分账号期限',
|
|
componentProps: {
|
|
componentProps: {
|
|
rows: 4,
|
|
rows: 4,
|
|
options: [
|
|
options: [
|
|
{
|
|
{
|
|
label: '1年',
|
|
label: '1年',
|
|
- value: 1,
|
|
|
|
|
|
+ value: '1年',
|
|
},
|
|
},
|
|
]
|
|
]
|
|
},
|
|
},
|
|
colProps: { span: 20 },
|
|
colProps: { span: 20 },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- field: 'machineCode',
|
|
|
|
- component: 'DatePicker',
|
|
|
|
|
|
+ field: 'validTime',
|
|
|
|
+ component: 'RangePicker',
|
|
required: true,
|
|
required: true,
|
|
|
|
+ defaultValue: [ dayjs().format('YYYY-MM-DD'), dayjs().add(12, 'month').format('YYYY-MM-DD')],
|
|
|
|
+ // defaultValue: ['2025-03-12', '2025-04-24'],
|
|
label: '差分账号期限',
|
|
label: '差分账号期限',
|
|
componentProps: {
|
|
componentProps: {
|
|
rows: 4,
|
|
rows: 4,
|
|
|
|
+ valueFormat: 'YYYY-MM-DD',
|
|
|
|
+ format: 'YYYY-MM-DD',
|
|
},
|
|
},
|
|
colProps: { span: 20 },
|
|
colProps: { span: 20 },
|
|
},
|
|
},
|
|
@@ -103,36 +108,59 @@
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
data && onDataReceive(data);
|
|
data && onDataReceive(data);
|
|
});
|
|
});
|
|
|
|
+ const useTypeChange = (value) => {
|
|
|
|
+ updateSchema([
|
|
|
|
+ { field: 'projectNum', ifShow: value == '4' },
|
|
|
|
+ { field: 'companyName', ifShow: value != '3' },
|
|
|
|
+ { field: 'businessDept', ifShow: value != '3' },
|
|
|
|
+ { field: 'businessName', ifShow: value != '3' },
|
|
|
|
+ { field: 'customerName', ifShow: value != '3' },
|
|
|
|
+ { field: 'customerType', ifShow: value != '3' },
|
|
|
|
+ { field: 'endCustomer', ifShow: value != '3' },
|
|
|
|
+ { field: 'customerPayTime', required: value == '4' },
|
|
|
|
+ ]);
|
|
|
|
+ };
|
|
async function onDataReceive(data) {
|
|
async function onDataReceive(data) {
|
|
resetFields();
|
|
resetFields();
|
|
fileFlow.id = data.id;
|
|
fileFlow.id = data.id;
|
|
fileFlow.key = data.authorizeKey;
|
|
fileFlow.key = data.authorizeKey;
|
|
- // setFieldsValue(data);
|
|
|
|
|
|
+ console.log('data', [dayjs('2015-06-06', 'YYYY-MM-DD'), dayjs('2015-06-06', 'YYYY-MM-DD')])
|
|
|
|
+ updateSchema([
|
|
|
|
+ {
|
|
|
|
+ field: 'useType',
|
|
|
|
+ componentProps: {
|
|
|
|
+ onChange: useTypeChange,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ])
|
|
|
|
+ // setFieldsValue({
|
|
|
|
+ // ...data,
|
|
|
|
+ // // validTime: [moment().add(-6, 'day'), moment()]
|
|
|
|
+ // });
|
|
}
|
|
}
|
|
async function handleConfirm() {
|
|
async function handleConfirm() {
|
|
- const { id, machineCode } = await validate();
|
|
|
|
- let res = await checkMachineCode({ machineCode: machineCode.replace(/\s*/g, '') });
|
|
|
|
- console.log('res', res, !id);
|
|
|
|
- if (!id && res && res.id) {
|
|
|
|
- createConfirm({
|
|
|
|
- iconType: 'warning',
|
|
|
|
- title: () => h('span', '温馨提示'),
|
|
|
|
- content: () => h('span', `当前设备已存在授权记录。`),
|
|
|
|
- okText: '继续',
|
|
|
|
- onOk: async () => {
|
|
|
|
- handleSubmit();
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- createConfirm({
|
|
|
|
- iconType: 'warning',
|
|
|
|
- title: () => h('span', '温馨提示'),
|
|
|
|
- content: () => h('span', `确定要${id ? '编辑' : '新增'}授权吗?`),
|
|
|
|
- onOk: async () => {
|
|
|
|
- handleSubmit();
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ // const { id, machineCode } = await validate();
|
|
|
|
+ // console.log('res', res, !id);
|
|
|
|
+ // if (!id && res && res.id) {
|
|
|
|
+ // createConfirm({
|
|
|
|
+ // iconType: 'warning',
|
|
|
|
+ // title: () => h('span', '温馨提示'),
|
|
|
|
+ // content: () => h('span', `当前设备已存在授权记录。`),
|
|
|
|
+ // okText: '继续',
|
|
|
|
+ // onOk: async () => {
|
|
|
|
+ // handleSubmit();
|
|
|
|
+ // },
|
|
|
|
+ // });
|
|
|
|
+ // } else {
|
|
|
|
+ createConfirm({
|
|
|
|
+ iconType: 'warning',
|
|
|
|
+ title: () => h('span', '温馨提示'),
|
|
|
|
+ content: () => h('span', `确定要新增授权吗?`),
|
|
|
|
+ onOk: async () => {
|
|
|
|
+ handleSubmit();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
const handleSubmit = async () => {
|
|
const handleSubmit = async () => {
|
|
try {
|
|
try {
|
|
@@ -140,11 +168,11 @@
|
|
console.log('validate', params);
|
|
console.log('validate', params);
|
|
const apiData = {
|
|
const apiData = {
|
|
...params,
|
|
...params,
|
|
- snCodes: params.snCodes && params.snCodes.replace(/\s*/g, ''),
|
|
|
|
- machineCode: params.machineCode.replace(/\s*/g, ''),
|
|
|
|
|
|
+ validStartTime: params.validTime[0],
|
|
|
|
+ validEndTime: params.validTime[1],
|
|
userId: params.id,
|
|
userId: params.id,
|
|
};
|
|
};
|
|
- let res = await authorizeInstalladdOrUpdate(apiData);
|
|
|
|
|
|
+ let res = await authorizeRtkAdd(apiData);
|
|
closeModal();
|
|
closeModal();
|
|
resetFields();
|
|
resetFields();
|
|
createSuccessModal({
|
|
createSuccessModal({
|