修复bug

This commit is contained in:
Jerry
2024-08-14 23:31:15 +08:00
parent 24ba8f571c
commit 3a347a3a1a
19 changed files with 261 additions and 105 deletions

View File

@@ -1,7 +1,9 @@
import { API_CONTEXT } from '../config';
import { loginParam, LoginUserInfo } from '@/types/upms/login';
import { UserInfo } from '@/types/upms/user';
import { BaseController } from '@/api/BaseController';
import { API_CONTEXT } from '../config';
import { RequestOption, TableData } from '@/common/http/types';
import { ANY_OBJECT } from '@/types/generic';
export default class LoginController extends BaseController {
static login(params: loginParam) {
@@ -11,4 +13,8 @@ export default class LoginController extends BaseController {
static logout() {
return super.post(API_CONTEXT + '/upms/login/doLogout', {});
}
static changePassword(params: ANY_OBJECT, httpOptions?: RequestOption) {
return super.post(API_CONTEXT + '/upms/login/changePassword', params, httpOptions);
}
}

View File

@@ -0,0 +1,121 @@
<template>
<div class="form-single-fragment" style="position: relative">
<el-form
ref="formModifyPassword"
:model="formData"
class="full-width-input"
:rules="rules"
style="width: 100%"
label-width="120px"
:size="defaultFormItemSize"
label-position="right"
@submit.prevent
>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="旧密码" prop="oldPassword">
<el-input
class="input-item"
v-model.trim="formData.oldPassword"
type="password"
show-password
:clearable="true"
placeholder="旧密码"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="新密码" prop="password">
<el-input
class="input-item"
v-model.trim="formData.password"
type="password"
show-password
:clearable="true"
placeholder="新密码"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="新密码确认" prop="repeatPassword">
<el-input
class="input-item"
v-model.trim="formData.repeatPassword"
type="password"
show-password
:clearable="true"
placeholder="新密码确认"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-row class="no-scroll flex-box" type="flex" justify="end">
<el-button :size="defaultFormItemSize" :plain="true" @click="onCancel(false)">
取消
</el-button>
<el-button type="primary" :size="defaultFormItemSize" @click="onSave()">
保存
</el-button>
</el-row>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script setup lang="ts">
import { ElMessage } from 'element-plus';
import { encrypt } from '@/common/utils';
import LoginController from '@/api/system/LoginController';
import { DialogProp } from '@/components/Dialog/types';
import { ANY_OBJECT } from '@/types/generic';
const props = defineProps<{
dialog?: DialogProp<ANY_OBJECT>;
}>();
const formModifyPassword = ref();
const formData = reactive({
oldPassword: undefined,
password: undefined,
repeatPassword: undefined,
});
const rules = ref({
oldPassword: [{ required: true, message: '请输入旧密码', trigger: 'blur' }],
password: [{ required: true, message: '请输入新密码', trigger: 'blur' }],
repeatPassword: [{ required: true, message: '请输入新密码', trigger: 'blur' }],
});
const onCancel = () => {
if (props.dialog) {
props.dialog.cancel();
}
};
const onSave = () => {
formModifyPassword.value.validate(valid => {
if (!valid) return;
if (formData.password !== formData.repeatPassword) {
ElMessage.error('两次密码输入不一致,请核对!');
return;
}
let params = {
oldPass: encrypt(formData.oldPassword),
newPass: encrypt(formData.password),
};
LoginController.changePassword(params)
.then(res => {
ElMessage.success('密码修改成功');
if (props.dialog) {
props.dialog.submit(res);
}
})
.catch(e => {
console.error(e);
});
});
};
</script>
<style></style>

View File

@@ -138,7 +138,10 @@ import { useUpload } from '@/common/hooks/useUpload';
import Sidebar from './components/Sidebar.vue';
import BreadCrumb from './components/BreadCrumb.vue';
import TagPanel from './components/TagPanel.vue';
import { useCommon } from '@/common/hooks/useCommon';
import FormModifyPassword from './components/formModifyPassword/index.vue';
const { Dialog } = useCommon();
const router = useRouter();
const route = useRoute();
const layoutStore = useLayoutStore();
@@ -331,13 +334,12 @@ const handleCommand = (command: string) => {
});
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消退出',
});
console.log('取消退出');
});
break;
case 'modifyPassword':
Dialog.show('修改密码', FormModifyPassword, { area: '500px' }, {});
break;
default:
ElMessage.warning(`click on item ${command}`);
break;

View File

@@ -25,6 +25,7 @@ import 'element-plus/theme-chalk/el-cascader-panel.css';
import 'element-plus/theme-chalk/el-tree.css';
import 'element-plus/theme-chalk/el-date-picker.css';
import 'element-plus/theme-chalk/el-input-number.css';
import 'element-plus/theme-chalk/el-switch.css';
// 其它样式
import '@/assets/online-icon/iconfont.css';

View File

@@ -244,7 +244,7 @@ const props = withDefaults(
},
);
const table = ref<ANY_OBJECT>();
const table = ref();
const form = inject('form', () => {
console.error('OnlineCustomTable: form not injected');
return { isEdit: false } as ANY_OBJECT;
@@ -403,10 +403,12 @@ const onRadioSelectChange = () => {
props.onRadioChange(selectRow);
}
};
// const setSelectedRow = (rowNum: number) => {
// table.value.getTableImpl().setRadioRow(props.dataList[rowNum]);
// nextTick(onRadioSelectChange);
// };
const setSelectedRow = (rowNum: number) => {
nextTick(() => {
table.value.getTableImpl().setRadioRow(props.dataList[rowNum]);
onRadioSelectChange();
});
};
// 取消行内编辑
// const cancelRowEvent = (row: ANY_OBJECT) => {
// if (form().isEdit) return;
@@ -554,6 +556,10 @@ watch(
refreshColumn();
},
);
defineExpose({
setSelectedRow,
});
</script>
<style scoped>

View File

@@ -170,13 +170,10 @@ const uploadWidgetImpl = reactive(
const getDisabledStatus = () => {
if (form().isEdit) return true;
let formWidgetAuth: ANY_OBJECT | null = null;
if (form().formAuth) {
formWidgetAuth = form().formAuth();
if (formWidgetAuth != null) {
formWidgetAuth = formWidgetAuth.pc[pps.widget.variableName];
}
}
const formWidgetAuth: ANY_OBJECT | null = form().formAuth && form().formAuth() && form().formAuth().pc
? form().formAuth().pc[pps.widget.variableName]
: null;
if (formWidgetAuth && formWidgetAuth.disabled) return true;
return props.widget.props.disabled;
};

View File

@@ -355,13 +355,9 @@ const getWidgetProps = computed(() => {
});
const getDisabledStatus = () => {
let formWidgetAuth: ANY_OBJECT | null = null;
if (form().formAuth) {
formWidgetAuth = form().formAuth();
if (formWidgetAuth != null) {
formWidgetAuth = formWidgetAuth.pc[pps.widget.variableName];
}
}
const formWidgetAuth: ANY_OBJECT | null = form().formAuth && form().formAuth() && form().formAuth().pc
? form().formAuth().pc[pps.widget.variableName]
: null;
if (formWidgetAuth && formWidgetAuth.disabled) return true;
return pps.widget.props.disabled;
};
@@ -400,6 +396,8 @@ const onValueInput = (val: ANY_OBJECT | undefined) => {
if (multiSelect.value && Array.isArray(tempValue) /*&& tempValue.length > 0*/) {
tempValue = tempValue.join(',') + ',';
}
} else {
tempValue = val;
}
console.log('widget update:value', tempValue);
emit('update:value', tempValue);
@@ -413,10 +411,9 @@ const onValueChange = (
) => {
let tempVal: ValueType | undefined = undefined;
let dictData = null;
tempVal = parseValue(val);
console.log('widget onValueChange >>>', val);
if (val) {
tempVal = parseValue(val);
if (val != null) {
if (multiSelect.value) {
dictData = val
.map((item: string) => {
@@ -442,8 +439,6 @@ const onValueChange = (
}
}
}
// 这个似乎没有起到什么作用
emit('change', tempVal, {
dictData: dictData,
selectRow: selectRow,

View File

@@ -314,6 +314,7 @@ import { useLayoutStore } from '@/store';
import OnlineFilterBox from '../OnlineQueryForm/OnlineFilterBox.vue';
import { useDict } from '../../hooks/useDict';
import { useForm } from '../hooks/useForm';
import { useFormExpose } from '../hooks/useFormExpose';
const { fetchUpload } = useUpload();
@@ -411,6 +412,7 @@ provide('form', () => {
filter: {
name: leftFilter.value,
},
instanceData: () => useFormExpose(formData),
};
});
@@ -775,7 +777,7 @@ const onOperationClick = (operation: ANY_OBJECT | null, row: ANY_OBJECT | null =
} else if (operation.type === SysCustomWidgetOperationType.EXPORT) {
onExport(operation);
} else if (operation.type === SysCustomWidgetOperationType.PRINT) {
onPrint(operation, row, queryTable.value.showName + '.pdf');
onPrint(operation, row, selectRows.value, queryTable.value.showName + '.pdf');
} else if (operation.type === SysCustomWidgetOperationType.START_FLOW) {
onStartFlow(operation, row);
} else {

View File

@@ -284,6 +284,7 @@ provide('form', () => {
return props.currentWidget === widget;
},
getWidgetObject: widgetData.getWidgetObject,
instanceData: () => useFormExpose(formData),
};
});
@@ -301,7 +302,7 @@ const onOperationClick = (operation: ANY_OBJECT) => {
} else {
keyName = masterTable.value.relation.variableName;
}
onPrint(operation, formData[keyName], form.value.formName + '.pdf');
onPrint(operation, formData[keyName], null, form.value.formName + '.pdf');
};
const onCancel = () => {

View File

@@ -169,6 +169,7 @@ provide('form', () => {
return props.currentWidget === widget;
},
getWidgetObject: widgetData.getWidgetObject,
instanceData: () => useFormExpose(formData),
};
});
@@ -495,7 +496,7 @@ const onOperationClick = (operation: ANY_OBJECT, row: ANY_OBJECT | null) => {
} else if (operation.type === SysCustomWidgetOperationType.EXPORT) {
onExport(operation);
} else if (operation.type === SysCustomWidgetOperationType.PRINT) {
if (row) onPrint(operation, row, queryTable.value.showName + '.pdf');
if (row) onPrint(operation, row, null, queryTable.value.showName + '.pdf');
} else {
handlerOperation(operation, {
isEdit: dialogParams.value.isEdit,

View File

@@ -239,7 +239,6 @@ const {
} = useForm(props);
provide('form', () => {
console.log('provide form5', props, form);
return {
...form.value,
mode: props.mode || 'pc',
@@ -263,6 +262,7 @@ provide('form', () => {
return props.currentWidget === widget;
},
getWidgetObject: widgetData.getWidgetObject,
instanceData: () => useFormExpose(formData),
};
});
@@ -582,7 +582,7 @@ const onOperationClick = (operation: ANY_OBJECT, row: ANY_OBJECT | null) => {
} else if (operation.type === SysCustomWidgetOperationType.EXPORT) {
onExport(operation);
} else if (operation.type === SysCustomWidgetOperationType.PRINT) {
onPrint(operation, row, queryTable.value.showName + '.pdf');
onPrint(operation, row, selectRows.value, queryTable.value.showName + '.pdf');
} else if (operation.type === SysCustomWidgetOperationType.START_FLOW) {
console.log('启动流程');
onStartFlow(operation, row);

View File

@@ -134,6 +134,7 @@ provide('form', () => {
return props.currentWidget === widget;
},
getWidgetObject: widgetData.getWidgetObject,
instanceData: () => useFormExpose(formData),
formAuth: () => {
return formAuth.value;
},

View File

@@ -128,6 +128,7 @@ import { FlowEntryController, FlowOperationController } from '@/api/flow';
import widgetData from '@/online/config/index';
import { useLayoutStore } from '@/store';
import { useForm } from '../hooks/useForm';
import { useFormExpose } from '../hooks/useFormExpose';
const emit = defineEmits<{
tableClick: [ANY_OBJECT];
@@ -160,6 +161,7 @@ const {
isReady,
dialogParams,
form,
formData,
checkOperationPermCode,
checkOperationDisabled,
checkOperationVisible,
@@ -180,6 +182,7 @@ provide('form', () => {
return props.currentWidget === widget;
},
getWidgetObject: widgetData.getWidgetObject,
instanceData: () => useFormExpose(formData),
};
});

View File

@@ -25,9 +25,10 @@ import { useFormConfig } from '@/pages/online/hooks/useFormConfig';
import widgetData from '@/online/config/index';
import combinedDict from '@/common/staticDict/combined';
import { pattern } from '@/common/utils/validate';
import { post } from '@/common/http/request';
//import { API_CONTEXT } from '@/api/config';
import { post, downloadBlob } from '@/common/http/request';
import { API_CONTEXT } from '@/api/config';
import { useThirdParty } from '@/components/thirdParty/hooks';
import { useFormExpose } from './useFormExpose';
const StaticDict = { ...combinedDict };
@@ -143,8 +144,9 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
}
};
const getWidgetVisible = widget => {
const formWidgetAuth: ANY_OBJECT | null =
formAuth.value && formAuth.value.pc ? formAuth.value.pc[widget.variableName] : null;
const formWidgetAuth: ANY_OBJECT | null = formAuth.value && formAuth.value.pc
? formAuth.value.pc[widget.variableName]
: null;
if (formWidgetAuth && formWidgetAuth.hide) return false;
return true;
};
@@ -815,50 +817,79 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
// });
// });
};
const getPrintParamItem = (row, printParamList) => {
let param;
if (Array.isArray(printParamList)) {
param = printParamList
.map(item => {
const columnId = item.paramValue;
if (columnId != null) {
const column = dialogParams.value.formConfig.columnMap.get(columnId);
const value = row ? (row || {})[column.columnName] : getWidgetValueByColumn(column);
if (item.paramName != null && value != null) {
return {
paramName: item.paramName,
paramValue: value,
};
}
}
return null;
})
.filter(item => item != null);
}
return param;
};
// TODO onPrint
const onPrint = (operation: ANY_OBJECT, row: ANY_OBJECT | null, fileName: string) => {
const onPrint = (
operation: ANY_OBJECT,
row: ANY_OBJECT | null,
selectRows: ANY_OBJECT[] | undefined | null,
fileName: string,
) => {
console.log('onPrint', operation, row, fileName);
if (operation == null) return;
// let printParam
// if (row != null) {
// let temp = getPrintParamItem(row, operation.printParamList)
// printParam = temp ? [temp] : []
// } else {
// if (this.selectRows.length <= 0) {
// ElMessage.error('请选择要打印的数据!')
// return
// }
// printParam = this.selectRows
// .map((row) => {
// return this.getPrintParamItem(row, operation.printParamList)
// })
// .filter((item) => item != null)
// }
// let params = {
// datasourceId: masterTable.value.datasource.datasourceId,
// printId: operation.printTemplateId,
// printParams: printParam,
// }
// post(
// API_CONTEXT + '/online/onlineOperation/print/' +
// masterTable.value.datasource.variableName,
// params
// )
// .then((res) => {
// let downloadUrl = res.data
// ajax
// .fetchDownloadBlob(downloadUrl, {}, fileName, 'get')
// .then((blobData) => {
// let pdfUrl = window.URL.createObjectURL(blobData)
// window.open('./lib/pdfjs/web/viewer.html?file=' + pdfUrl)
// })
// .catch((e) => {
// console.log(e)
// ElMessage.error(e)
// })
// })
// .catch((e) => {})
let printParam;
if (row != null) {
const temp = getPrintParamItem(row, operation.printParamList);
printParam = temp ? [temp] : [];
} else {
if (selectRows == null || selectRows?.length <= 0) {
ElMessage.error('请选择要打印的数据!');
return;
}
printParam = selectRows
.map(row => {
return getPrintParamItem(row, operation.printParamList);
})
.filter(item => item != null);
}
const params = {
datasourceId: masterTable.value.datasource.datasourceId,
printId: operation.printTemplateId,
printParams: printParam,
};
post(
API_CONTEXT + '/online/onlineOperation/print/' + masterTable.value.datasource.variableName,
params,
)
.then(res => {
const downloadUrl = res.data;
console.log('downloadUrl', downloadUrl);
downloadBlob(downloadUrl as string, {}, 'get')
.then(blobData => {
const pdfUrl = window.URL.createObjectURL(blobData as Blob);
window.open('./lib/pdfjs/web/viewer.html?file=' + pdfUrl);
})
.catch(e => {
console.log(e);
ElMessage.error(e);
});
})
.catch(e => {
console.log(e);
});
};
const masterTablePrimaryKey = computed(() => {

View File

@@ -28,7 +28,6 @@
:value="item.id"
:label="item.name"
/>
:key="item.id" :value="item.id" :label="item.name" />
</el-select>
</el-form-item>
<el-form-item
@@ -37,8 +36,8 @@
key="express"
>
<el-input
:value="flowConditionForm.body"
@input="onExpressionBodyChange"
:model-value="flowConditionForm.body"
@update:modelValue="onExpressionBodyChange"
clearable
type="textarea"
:disabled="flowConditionForm.type === 'operation'"

View File

@@ -80,10 +80,6 @@
<vxe-column title="按钮名称" min-width="100px">
<template v-slot="scope">
<span style="font-size: 12px">{{ scope.row.label }}</span>
<!-- <el-button class="table-btn" link style="text-decoration: underline;"
@click="onEditOperation(scope.row)">
{{scope.row.label}}
</el-button> -->
</template>
</vxe-column>
<vxe-column title="按钮类型" min-width="100px">
@@ -237,7 +233,9 @@ const onSetOnlineFormAuth = () => {
formWidgetConfig.mobile.widgetList.length > 0
) {
tempConfig.mobile = {
widgetList: formWidgetConfig.mobile.widgetList.map(subWidget => formatOnlineFormInfo(subWidget))
widgetList: formWidgetConfig.mobile.widgetList.map(subWidget =>
formatOnlineFormInfo(subWidget),
),
};
}
}
@@ -246,12 +244,12 @@ const onSetOnlineFormAuth = () => {
'设置表单权限',
FormSetOnlineFormAuth,
{
area: ['1000px', '700px']
area: ['1000px', '700px'],
},
{
formAuth: formData.value.formAuth || {},
formWidgetConfig: tempConfig,
path: 'thirdSetOnlineFormAuth'
path: 'thirdSetOnlineFormAuth',
},
{
width: '1000px',

View File

@@ -101,7 +101,7 @@ const buildWidgetAuthInfo = (widget, authData) => {
const onSubmit = () => {
let authData = {
pc: {},
mobile: {}
mobile: {},
};
pcFormWidgetList.value.forEach(item => {
buildWidgetAuthInfo(item, authData.pc);
@@ -124,7 +124,7 @@ const setParentStatus = (widget, fieldName, val) => {
activeTableData.value,
widget.formId,
'formId',
'children'
'children',
);
if (Array.isArray(parentPath)) {
parentPath.forEach(parent => {
@@ -146,9 +146,7 @@ const setChildStatus = (widget, fieldName, val) => {
const onWidgetDisableChange = (widget, val) => {
// 当val为true时当前组件的所有子组件都禁用当val为false时当前组件的父组件都启用
val
? setChildStatus(widget, 'disabled', val)
: setParentStatus(widget, 'disabled', val);
val ? setChildStatus(widget, 'disabled', val) : setParentStatus(widget, 'disabled', val);
if (activeName.value === 'pc') {
pcFormWidgetList.value = [...pcFormWidgetList.value];
} else {
@@ -158,9 +156,7 @@ const onWidgetDisableChange = (widget, val) => {
const onWidgetHideChange = (widget, val) => {
// 当val为true时当前组件的所有子组件都隐藏当val为false时当前组件的父组件都显示
val
? setChildStatus(widget, 'hidden', val)
: setParentStatus(widget, 'hidden', val);
val ? setChildStatus(widget, 'hidden', val) : setParentStatus(widget, 'hidden', val);
if (activeName.value === 'pc') {
pcFormWidgetList.value = [...pcFormWidgetList.value];
} else {