Commit dc36a1e7 by Jaxon

Merge branch 'SAAS+V5.8.4' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into feature/584/jaxon
2 parents 0c637ea9 54dd3312
......@@ -27,6 +27,7 @@ export default antfu({
"array-bracket-spacing": ["error", "always"],
},
rules: {
"unicorn/prefer-node-protocol":"off",
"curly": ["error", "all"],
"vue/no-deprecated-slot-attribute": "off",
"vue/no-deprecated-v-on-native-modifier": "off",
......
......@@ -59,15 +59,19 @@ export default {
eventType,
pagePath: route.path,
};
if (!prePagePath)
if (!prePagePath) {
prePagePath = this.getPrePagePath(this);
}
item.prePagePath = prePagePath || "/index";
if (batchId)
if (batchId) {
item.batchId = batchId;
if (eventCode)
}
if (eventCode) {
item.eventCode = eventCode;
if (businessParam)
}
if (businessParam) {
item.businessParam = JSON.stringify(businessParam);
}
if (!recordList) {
recordList = [item];
} else {
......@@ -79,8 +83,9 @@ export default {
console.log("---------------- 重新打开定时埋点 ----------------");
this.sendTrack(); // 开启定时埋点
}
if (recordList.length > 9)
if (recordList.length > 9) {
this.sendTrackData();
}
},
getRandomString(length = 30) {
const characters
......@@ -94,8 +99,9 @@ export default {
return result;
},
onPageShow() {
if (this.track_page_view_flag)
if (this.track_page_view_flag) {
return;
}
if (!this.track_batchId) {
this.track_batchId = `DJ_${this.getRandomString()}_${Date.now()}`;
}
......@@ -127,8 +133,9 @@ export default {
}, 10e3);
}
let trackParams = {};
if (this.track_businessParam_key)
if (this.track_businessParam_key) {
trackParams = this[this.track_businessParam_key] || {};
}
this.setReportTrackData(
2,
this.track_event_code,
......@@ -166,8 +173,11 @@ export default {
reportTrack({
recordList: JSON.parse(recordList),
}).then((res) => {
if (res)
if (res) {
localStorage.removeItem("recordList");
}
}).catch((e) => {
console.log("发送出错", e);
});
} else {
clearInterval(window.TRACK_TIMER);
......
......@@ -1474,7 +1474,7 @@ export const routerName = {
parentId: "912250101",
label: "详情",
handle: "handleViewDetail",
}
},
],
component: _import(
"residentManage/supervisionManagement/mission/detail",
......@@ -1508,11 +1508,11 @@ export const routerName = {
},
912300101: {
path: "/resident-manage/task-center/detail",
path: "/resident-manage/task-center-detail",
name: "residentManageTaskCenterDetail",
meta: {
title: "详情",
authId: "9123001",
authId: "912300101",
parentId: "91230",
activePath: "/resident-manage/task-center",
},
......
......@@ -6,13 +6,17 @@ import DescriptionImageList from "@/components/descriptions/components/imageList
import { statusOptions } from "@/views/residentManage/taskCenter/constant";
import "dayjs/locale/zh-cn";
if (typeof dayjs === "undefined") {
console.error("[cover2Descriptions] dayjs 未加载,请检查 CDN 顺序");
}
dayjs.extend(isSameOrBefore);
dayjs.extend(isSameOrAfter);
dayjs.extend(customParseFormat);
function parseDatetime(value) {
if (!value)
if (!value) {
return "-";
}
const formats = [
"YYYY-MM-DDTHH:mm:ss",
......@@ -124,8 +128,9 @@ function renderLink() {
},
render: (h, { data, schemaItem, schema }) => {
const { fieldValue, linkAlias } = schemaItem.meta;
if (!fieldValue)
if (!fieldValue) {
return h("span", "-");
}
const linkProps = {
class: "link-type",
......@@ -195,8 +200,9 @@ function renderAttachment() {
style: { marginLeft: "8px", lineHeight: 1 },
on: {
click: (e) => {
if (!fileUrl)
if (!fileUrl) {
return;
}
e.preventDefault();
window.open(fileUrl, "_blank");
},
......
......@@ -9,7 +9,7 @@
{{ detail.title }}
</span>
</div>
<div class="description-wrapper">
<div v-if="descriptionSchema.length" class="description-wrapper">
<Descriptions :data="detail"
:schema="descriptionSchema">
</Descriptions>
......@@ -53,40 +53,47 @@ export default {
},
async mounted() {
const { query } = this.$route;
this.taskId = query.taskId;
this.pageLoading = true;
try {
const { query } = this.$route;
if (!query?.taskId) {
return;
}
this.taskId = query?.taskId;
await this.getData(query.taskId);
const schema = await getTaskCenterTaskDescriptionSchema();
const dynamicSchema = this?.detail?.bizDisplayInfo || [];
// dynamicSchema.push({
// fieldId: "100",
await this.getData(query.taskId);
const schema = await getTaskCenterTaskDescriptionSchema();
const dynamicSchema = this?.detail?.bizDisplayInfo || [];
// dynamicSchema.push({
// fieldId: "100",
// fieldName: "枚举",
// fieldName: "枚举",
// fieldType: "ENUM",
// fieldType: "ENUM",
// fieldValue: ["男", "女","男", "女",],
// fieldValue: ["男", "女","男", "女",],
// linkAlias: null,
// });
if (dynamicSchema && dynamicSchema.length) {
schema.splice(6, 0, ...(this?.detail?.bizDisplayInfo || []).map(item => ({
name: item.fieldId,
label: item.fieldName,
col: 24,
parentProps: {
className: "",
},
labelWidth: "120px",
meta: item,
...cover2Descriptions?.[toUpper(item.fieldType)]?.(),
})));
console.log("descriptionSchema", schema);
this.descriptionSchema = schema;
} else {
// linkAlias: null,
// });
if (dynamicSchema && dynamicSchema.length) {
schema.splice(6, 0, ...(this?.detail?.bizDisplayInfo || []).map(item => ({
name: item.fieldId,
label: item.fieldName,
col: 24,
parentProps: {
className: "",
},
labelWidth: "120px",
meta: item,
...cover2Descriptions?.[toUpper(item.fieldType)]?.(),
})));
this.descriptionSchema = schema;
} else {
// 如果是空的, 去除两条横线
this.descriptionSchema = schema.filter(item => !item.divider);
this.descriptionSchema = schema.filter(item => !item.divider);
}
} finally {
this.pageLoading = false;
}
},
methods: {
......
......@@ -249,13 +249,16 @@ export default {
},
// 查看
async handleDetail({ taskId, bizTypeName, bizType }) {
this.setReportTrackData(0, "task_web_view_detail", { taskId, bizTypeName, bizType });
this.$router.push({
path: "/resident-manage/task-center/detail",
query: {
taskId,
},
});
try {
this.setReportTrackData(0, "task_web_view_detail", { taskId, bizTypeName, bizType });
} finally {
this.$router.push({
name: "residentManageTaskCenterDetail",
query: {
taskId,
},
});
}
},
handleChangeSort(command) {
if (this.table.searchForm.orderBy === command) {
......
const expiryKeys = [
"compulsoryInsuranceExpiry",
"annualInspectionExpiry",
"commercialInsuranceExpiry",
];
function getLocalDate(value) {
if (!value) {
return null;
}
if (value instanceof Date) {
return new Date(value.getFullYear(), value.getMonth(), value.getDate());
}
const matched = String(value).match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})/);
if (matched) {
return new Date(
Number(matched[1]),
Number(matched[2]) - 1,
Number(matched[3]),
);
}
const date = new Date(value);
if (Number.isNaN(date.getTime())) {
return null;
}
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
export function getExpiryTextStyle(item, row) {
if (!item || !expiryKeys.includes(item.key) || !row) {
return {};
}
const expiryDate = getLocalDate(row[item.key]);
if (!expiryDate) {
return {};
}
const now = new Date();
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const diffDays = Math.ceil((expiryDate.getTime() - today.getTime()) / 86400000);
if (diffDays < 0) {
return { color: "#EB4E4E" };
}
if (diffDays <= 30) {
return { color: "#FF8D1A" };
}
return {};
}
import { getExpiryTextStyle } from "./vehicleInfoExpiry";
describe("vehicleInfo expiry date colors", () => {
beforeEach(() => {
jest.useFakeTimers("modern");
jest.setSystemTime(new Date(2026, 6, 6));
});
afterEach(() => {
jest.useRealTimers();
});
it("marks expired expiry fields red", () => {
const style = getExpiryTextStyle(
{ key: "annualInspectionExpiry" },
{ annualInspectionExpiry: "2026-07-05" },
);
expect(style).toEqual({ color: "#EB4E4E" });
});
it("marks expiry fields within thirty days orange", () => {
const style = getExpiryTextStyle(
{ key: "commercialInsuranceExpiry" },
{ commercialInsuranceExpiry: "2026-08-05" },
);
expect(style).toEqual({ color: "#FF8D1A" });
});
it("keeps non-expiry fields and later dates default", () => {
expect(getExpiryTextStyle(
{ key: "licensePlate" },
{ licensePlate: "A12345" },
)).toEqual({});
expect(getExpiryTextStyle(
{ key: "compulsoryInsuranceExpiry" },
{ compulsoryInsuranceExpiry: "2026-08-06" },
)).toEqual({});
});
});
const VueFilenameInjector = require("./tools/vue-filename-injector");
const ThemeColorReplacer = require("webpack-theme-color-replacer");
const forElementUI = require("webpack-theme-color-replacer/forElementUI");
// const HardPlugin = require('hard-source-webpack-plugin') // 使用缓存,优化启动速度
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
const ThemeColorReplacer = require("webpack-theme-color-replacer");
const forElementUI = require("webpack-theme-color-replacer/forElementUI");
const VueFilenameInjector = require("./tools/vue-filename-injector");
// const SpeedMeasurePlugin = require('speed-measure-webpack-plugin')
const timeStamp = new Date().getTime();
const CopyDir = require("./plugins/copyDir");
// const AsyncRomveDir = require('./plugins/removeDir')
const os = require("os");
const CopyDir = require("./plugins/copyDir");
// const { defineConfig } = require('@vue/cli-service')
/**
* 获取当前机器的ip地址
*/
function getIpAddress() {
var ifaces = os.networkInterfaces();
for (var dev in ifaces) {
let ifaces = os.networkInterfaces();
for (let dev in ifaces) {
const iface = ifaces[dev];
for (let i = 0; i < iface.length; i++) {
......@@ -28,7 +28,8 @@ function getIpAddress() {
}
// 拼接路径
const path = require("path");
const resolve = (dir) => path.join(__dirname, dir);
const resolve = dir => path.join(__dirname, dir);
// 增加环境变量
process.env.VUE_APP_VERSION = require("./package.json").version;
......@@ -43,8 +44,8 @@ const isDev = process.env.NODE_ENV !== "development";
*/
function isLowMemBuild() {
if (
process.env.VUE_LOW_MEM_BUILD === "1" ||
process.env.VUE_LOW_MEM_BUILD === "true"
process.env.VUE_LOW_MEM_BUILD === "1"
|| process.env.VUE_LOW_MEM_BUILD === "true"
) {
return true;
}
......@@ -147,21 +148,21 @@ module.exports = {
config.externals = {
// vue: "Vue",
"vue-router": "VueRouter",
vuex: "Vuex",
axios: "axios",
"vuex": "Vuex",
"axios": "axios",
"js-cookie": "Cookies",
nprogress: "NProgress",
echarts: "echarts",
"nprogress": "NProgress",
"echarts": "echarts",
"ua-parser-js": "UAParser",
qs: "Qs",
html2canvas: "html2canvas",
"qs": "Qs",
"html2canvas": "html2canvas",
// "element-ui": "ELEMENT",
dayjs: "dayjs",
// "dayjs": "dayjs",
// "vue-qr": "vue-qr",
xlsx: "XLSX",
"xlsx": "XLSX",
// 与 CDN UMD 全局名一致(非 BScroll)
// "better-scroll": "BetterScroll",
BScroll: "better-scroll",
"BScroll": "better-scroll",
// lodash: "_",
};
}
......@@ -227,7 +228,7 @@ module.exports = {
configFile: path.resolve(__dirname, ".sentryclirc"),
// 与部署路径一致,便于 Sentry 将 map 与线上资源对齐
urlPrefix: `~${publicPath}`,
})
}),
);
}
......@@ -283,12 +284,12 @@ module.exports = {
// optional. Resolve result css code as you wish.
return resultCss.replace(
/process.env.VUE_APP_ELEMENT_COLOR/g,
process.env.VUE_APP_ELEMENT_COLOR
process.env.VUE_APP_ELEMENT_COLOR,
);
},
matchColors: [
...forElementUI.getElementUISeries(
process.env.VUE_APP_ELEMENT_COLOR
process.env.VUE_APP_ELEMENT_COLOR,
), // Element-ui主色系列
],
externalCssFiles: [
......@@ -302,15 +303,15 @@ module.exports = {
.when(
process.env.NODE_ENV === "development",
// sourcemap不包含列信息
(config) => config.devtool("cheap-source-map")
config => config.devtool("cheap-source-map"),
)
// TRAVIS 构建 vue-loader 添加 filename
.when(
process.env.VUE_APP_BUILD_MODE === "TRAVIS" ||
process.env.NODE_ENV === "development",
process.env.VUE_APP_BUILD_MODE === "TRAVIS"
|| process.env.NODE_ENV === "development",
VueFilenameInjector(config, {
propName: process.env.VUE_APP_SOURCE_VIEWER_PROP_NAME,
})
}),
);
// svg
const svgRule = config.module.rule("svg");
......@@ -329,7 +330,8 @@ module.exports = {
const imagesRule = config.module.rule("images");
imagesRule
.test(/\.(png|jpe?g|gif|webp|svg)(\?.*)?$/)
.exclude.add(resolve("src/assets/svg-icons/icons"))
.exclude
.add(resolve("src/assets/svg-icons/icons"))
.end();
// 重新设置 alias
config.resolve.alias
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!