/* * @Author: chenzy13 chenzy13@yusys.com.cn * @Date: 2024-07-10 11:30:26 * @LastEditors: zhanglin3 * @LastEditTime: 2024-09-18 11:18:02 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ /** * 表单字段格式化 * created by kongqf 2019/02/23 */ import { type } from '@yufp/xy-utils'; import formatterFn from '@/utils/formatter'; import { logInfo, checkCtrl } from '@/utils/util.js'; import router from '@/router'; import { DATE_FORMAT, DATE_TIME_FORMAT, OP_ADD, OP_EDIT, OP_DETAIL } from '@/config/constant/app.data.common.js'; // import { deleHistoryRecord } from '@/utils/routeback'; const formFormaterStr = { OP_ADD, OP_EDIT, OP_DETAIL, DATE_FORMAT, DATE_TIME_FORMAT, VALUE_FORMAT: 'yyyy-MM-dd', VALUE_FORMAT_YMDHMS: 'yyyy-MM-dd HH:mm:ss', VALUE_FORMAT_YMDHM: 'yyyy-MM-dd HH:mm', }; const _isObject = function (o) { return type(o) === 'object'; }; const _getParamValue = function (ps) { if (ps.length == 3 && _isObject(ps[0]) && _isObject(ps[1])) { return ps[2]; } return ps[0]; }; /** * 默认mixin配置 */ export default { data() { return formFormaterStr; }, }; // 注册混入的时候没有使用默认的所以这里要添加data不然找不到相关时间变量设置 export const vueMixinButton = { data() { return { ...formFormaterStr, // 当前页面路径存储 parentRoutPath: '/', }; }, created() { // 保存当前路径 this.parentRoutPath = (this.$route || {}).path; }, methods: { // 格式化 ...formatterFn, buttonLogs(btnObj, buttonName) { const zhCn = { button: '按钮', path: '路径:', buttonOperate: '按钮操作:', }; const lang = zhCn; const tab = this.$route || router.history.current; if (!tab || !tab.meta.id) { // toto confirm q确认框无法获取当前页面路由 return; } buttonName = buttonName || (!btnObj.$slots.default ? '' : btnObj.$el.innerText.trim()); const log = { logCtg: '2', oprObj: lang.button, oprCtnt: `${lang.buttonOperate}${buttonName}${lang.button},${lang.path}${tab.meta.routeUrl}`, funcModlName: tab.meta.title, }; logInfo(log); }, checkCtrl(ctrlCode) { // 检查是否有控制点权限,有权限返回false,无权限返回true return !checkCtrl(ctrlCode); }, }, // 路由离开前回调处理返回逻辑 // beforeRouteLeave(to, from, next) { // const curRoute = this.$route; // const flag = this.$store.state.tagsView.closeFlag; // // 页签关闭 标识时,添加处理返回跳转逻辑 // if (flag && curRoute.query && curRoute.query.hisId) { // let path = deleHistoryRecord(curRoute.query.hisId); // if (path) { // path = path.split(':')[1]; // this.$store.commit('tagsView/SET_CLOSE_FLAG', false); // next(path); // 继续导航 // } // } // next(); // }, };