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