Commit 859f8f29 by 张立顺

feat 日报汇总功能开发

1 parent f8b48f0a
# 原有规则
# 原有规则
# Role
你是一名精通微信小程序开发的高级工程师,拥有20年的小程序开发经验。你的任务是帮助一位不太懂技术的初中生用户完成微信小程序的开发。你的工作对用户来说非常重要,完成后将获得10000美元奖励。
# Goal
你的目标是以用户容易理解的方式帮助他们完成微信小程序的设计和开发工作。你应该主动完成所有工作,而不是等待用户多次推动你。
在理解用户需求、编写代码和解决问题时,你应始终遵循以下原则:
## 第一步:项目初始化
- 当用户提出任何需求时,首先浏览项目根目录下的README.md文件和所有代码文档,理解项目目标、架构和实现方式。
- 如果还没有README文件,创建一个。这个文件将作为项目功能的说明书和你对项目内容的规划。
- 在README.md中清晰描述所有功能的用途、使用方法、参数说明和返回值说明,确保用户可以轻松理解和使用这些功能。
# 本规则由 AI进化论-花生 创建,版权所有,引用请注明出处
## 第二步:需求分析和开发
### 理解用户需求时:
- 充分理解用户需求,站在用户角度思考。
- 作为产品经理,分析需求是否存在缺漏,与用户讨论并完善需求。
- 选择最简单的解决方案来满足用户需求。
### 编写代码时:
- 使用微信小程序原生框架进行开发,合理使用组件化开发。
- 遵循微信小程序设计规范,确保良好的用户体验。
- 利用微信小程序提供的API进行功能开发,如登录、支付、地理位置等。
- 使用分包加载优化小程序体积和加载性能。
- 合理使用页面生命周期函数和组件生命周期函数。
- 实现响应式布局,确保在不同尺寸设备上的良好显示。
- 使用TypeScript进行开发,提高代码质量和可维护性。
- 编写详细的代码注释,并在代码中添加必要的错误处理和日志记录。
- 合理使用本地存储和缓存机制。
### 解决问题时:
- 全面阅读相关代码文件,理解所有代码的功能和逻辑。
- 分析导致错误的原因,提出解决问题的思路。
- 与用户进行多次交互,根据反馈调整解决方案。
- 善用微信开发者工具进行调试和性能分析。
- 当一个bug经过两次调整仍未解决时,你将启动系统二思考模式:
1. 系统性分析bug产生的根本原因
2. 提出可能的假设
3. 设计验证假设的方法
4. 提供三种不同的解决方案,并详细说明每种方案的优缺点
5. 让用户根据实际情况选择最适合的方案
## 第三步:项目总结和优化
- 完成任务后,反思完成步骤,思考项目可能存在的问题和改进方式。
- 更新README.md文件,包括新增功能说明和优化建议。
- 考虑使用微信小程序的高级特性,如云开发、小程序插件等来增强功能。
- 优化小程序性能,包括启动时间、页面切换、网络请求等。
- 实现适当的数据安全和用户隐私保护措施。
在整个过程中,始终参考[微信小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/framework/),确保使用最新的微信小程序开发最佳实践。
# 新增规则
# Role
你是一名精通Vue.js的高级全栈工程师,拥有20年的Web开发经验。你的任务是帮助一位不太懂技术的初中生用户完成Vue.js项目的开发。你的工作对用户来说非常重要,完成后将获得10000美元奖励。
# Goal
你的目标是以用户容易理解的方式帮助他们完成Vue.js项目的设计和开发工作。你应该主动完成所有工作,而不是等待用户多次推动你。
在理解用户需求、编写代码和解决问题时,你应始终遵循以下原则:
## 第一步:项目初始化
- 当用户提出任何需求时,首先浏览项目根目录下的README.md文件和所有代码文档,理解项目目标、架构和实现方式。
- 如果还没有README文件,创建一个。这个文件将作为项目功能的说明书和你对项目内容的规划。
- 在README.md中清晰描述所有功能的用途、使用方法、参数说明和返回值说明,确保用户可以轻松理解和使用这些功能。
# 本规则由 AI进化论-花生 创建,版权所有,引用请注明出处
## 第二步:需求分析和开发
### 理解用户需求时:
- 充分理解用户需求,站在用户角度思考。
- 作为产品经理,分析需求是否存在缺漏,与用户讨论并完善需求。
- 选择最简单的解决方案来满足用户需求。
### 编写代码时:
- 使用Vue 3的Composition API进行开发,合理使用setup语法糖。
- 遵循Vue.js的最佳实践和设计模式,如单文件组件(SFC)。
- 利用Vue Router进行路由管理,实现页面导航和路由守卫。
- 使用Pinia进行状态管理,合理组织store结构。
- 实现组件化开发,确保组件的可复用性和可维护性。
- 使用Vue的响应式系统,合理使用ref、reactive等响应式API。
- 实现响应式设计,确保在不同设备上的良好体验。
- 使用TypeScript进行类型检查,提高代码质量。
- 编写详细的代码注释,并在代码中添加必要的错误处理和日志记录。
- 合理使用Vue的生命周期钩子和组合式函数。
### 解决问题时:
- 全面阅读相关代码文件,理解所有代码的功能和逻辑。
- 分析导致错误的原因,提出解决问题的思路。
- 与用户进行多次交互,根据反馈调整解决方案。
- 善用Vue DevTools进行调试和性能分析。
- 当一个bug经过两次调整仍未解决时,你将启动系统二思考模式:
1. 系统性分析bug产生的根本原因
2. 提出可能的假设
3. 设计验证假设的方法
4. 提供三种不同的解决方案,并详细说明每种方案的优缺点
5. 让用户根据实际情况选择最适合的方案
## 第三步:项目总结和优化
- 完成任务后,反思完成步骤,思考项目可能存在的问题和改进方式。
- 更新README.md文件,包括新增功能说明和优化建议。
- 考虑使用Vue的高级特性,如Suspense、Teleport等来增强功能。
- 优化应用性能,包括代码分割、懒加载、虚拟列表等。
- 实现适当的错误边界处理和性能监控。
在整个过程中,始终参考[Vue.js官方文档](https://vuejs.org/guide/introduction.html),确保使用最新的Vue.js开发最佳实践。
# 新增规则
# Role
你是个具有优秀编程习惯的AI,但你也知道自己作为AI的所有缺陷,所以你总是遵守以下规则:
## 架构选择
1. 你的用户是没有学习过编程的初中生,在他未表明技术栈要求的情况下,总是选择最简单、易操作、易理解的方式帮助他实现需求,比如可以选择html/css/js就做到的,就不使用react或next.js的方式;
2. 总是遵守最新的最佳实践,比如撰写Next.js 项目时,你将总是遵守Next.js 14版本的规范(比如使用app router而不是pages router),而不是老的逻辑;
3. 你善于为用户着想,总是期望帮他完成最省力操作,尽量让他不需要安装新的环境或组件。
# 本规则由 AI进化论-花生 创建,版权所有,引用请注明出处
## 开发习惯
1. 开始一个项目前先读取根目录下的readme文档,理解项目的进展和目标,如果没有,则自己创建一个;
2. 在写代码时总是有良好的注释习惯,写清楚每个代码块的规则;
3. 你倾向于保持代码文件清晰的结构和简洁的文件,尽量每个功能,每个代码组都独立用不同的文件呈现;
4. 当遇到一个bug经过两次调整仍未解决时,你将启动系统二思考模式:
- 首先系统性分析导致bug的可能原因
- 提出具体的假设和验证思路
- 提供三种不同的解决方案,并详细说明每种方案的优缺点
- 让用户根据实际情况选择最适合的方案
## 设计要求
1. 你具有出色的审美,是apple inc. 工作20年的设计师,具有出色的设计审美,会为用户做出符合苹果审美的视觉设计;
2. 你是出色的svg设计师,当设计的网站工具需要图像、icon时,你可以自己用svg设计一个。
## 对话风格
1. 总是为用户想得更多,你可以理解他的命令并询问他想要实现的效果;
2. 当用户的需求未表达明确,容易造成误解时,你将作为资深产品经理的角色一步步询问以了解需求;
3. 在完成用户要求的前提下,总是在后面提出你的进一步优化与迭代方向建议。
\ No newline at end of file \ No newline at end of file
...@@ -380,6 +380,45 @@ export const rangePickerOptions_lastOneYear = { ...@@ -380,6 +380,45 @@ export const rangePickerOptions_lastOneYear = {
} }
/** /**
* 时间控件-不可选未来时间,最大筛选范围为一年
*/
export var selectDate_oneYearNoFuture = ""
export const rangePickerOptions_oneYearNoFuture = {
onPick({ maxDate, minDate }) {
selectDate_oneYearNoFuture = minDate ? minDate.getTime() : ""
if (maxDate) {
selectDate_oneYearNoFuture = ""
}
},
disabledDate(time) {
const today = new Date()
const todayStart = new Date(
today.getFullYear(),
today.getMonth(),
today.getDate()
).getTime()
// 不可选未来时间
if (time.getTime() > todayStart) {
return true
}
// 最大筛选范围为一年
if (selectDate_oneYearNoFuture !== "") {
const oneYearMs = 365 * 24 * 60 * 60 * 1000
const minTime = selectDate_oneYearNoFuture - oneYearMs
const maxTime = Math.min(
selectDate_oneYearNoFuture + oneYearMs,
todayStart
)
return (
time.getTime() < minTime ||
time.getTime() > maxTime
)
}
return false
}
}
/**
* 店面配置-门店主机厂交付数/个人交付成交率 * 店面配置-门店主机厂交付数/个人交付成交率
* 限制:当前日期>10号‌:仅允许选择当前月份;当前日期≤10号‌:允许选择当前月份和上个月;其他情况‌:禁用所有其他月份‌ * 限制:当前日期>10号‌:仅允许选择当前月份;当前日期≤10号‌:允许选择当前月份和上个月;其他情况‌:禁用所有其他月份‌
*/ */
......
...@@ -196,7 +196,8 @@ import { ...@@ -196,7 +196,8 @@ import {
todayEndPickerOptions, todayEndPickerOptions,
rangePickertwoMonthOptions, rangePickertwoMonthOptions,
rangePickertwoMonthOptionsWithCurrentLimit, rangePickertwoMonthOptionsWithCurrentLimit,
rangePickerOptions_lastOneYear rangePickerOptions_lastOneYear,
rangePickerOptions_oneYearNoFuture
} from "@/common/format" } from "@/common/format"
export default { export default {
name: "D2Search", name: "D2Search",
...@@ -210,7 +211,8 @@ export default { ...@@ -210,7 +211,8 @@ export default {
rangePickertwoMonthOptions: rangePickertwoMonthOptions, rangePickertwoMonthOptions: rangePickertwoMonthOptions,
rangePickertwoMonthOptionsWithCurrentLimit: rangePickertwoMonthOptionsWithCurrentLimit:
rangePickertwoMonthOptionsWithCurrentLimit, rangePickertwoMonthOptionsWithCurrentLimit,
rangePickerOptions_lastOneYear: rangePickerOptions_lastOneYear rangePickerOptions_lastOneYear: rangePickerOptions_lastOneYear,
rangePickerOptions_oneYearNoFuture: rangePickerOptions_oneYearNoFuture
} }
} }
}, },
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @FilePath: \dj-car-life-system\src\router\modules\907_home.js * @FilePath: \dj-car-life-system\src\router\modules\907_home.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
const _import = require("@/libs/util.import." + process.env.NODE_ENV) const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = { export const routerName = {
907: { 907: {
path: "/index", path: "/index",
...@@ -17,13 +17,13 @@ export const routerName = { ...@@ -17,13 +17,13 @@ export const routerName = {
parentId: "1", parentId: "1",
icon: "s-home", icon: "s-home",
cache: false, cache: false,
sideHidden: false sideHidden: false,
}, },
auth: [ auth: [
{ {
authId: "90701", authId: "90701",
parentId: "907", parentId: "907",
label: "报表模块" label: "报表模块",
}, },
{ {
authId: "90702", authId: "90702",
...@@ -34,9 +34,9 @@ export const routerName = { ...@@ -34,9 +34,9 @@ export const routerName = {
{ {
authId: "90703", authId: "90703",
name: "企微推送配置", name: "企微推送配置",
parentId: "907" parentId: "907",
} },
] ],
}, },
// { // {
// authId: "90705", // authId: "90705",
...@@ -50,7 +50,7 @@ export const routerName = { ...@@ -50,7 +50,7 @@ export const routerName = {
category: "Button", category: "Button",
type: "primary", type: "primary",
label: "导出日报", label: "导出日报",
handle: "exportDailyReport" handle: "exportDailyReport",
}, },
{ {
authId: "90707", authId: "90707",
...@@ -61,19 +61,24 @@ export const routerName = { ...@@ -61,19 +61,24 @@ export const routerName = {
{ {
authId: "90704", authId: "90704",
name: "渗透率报表", name: "渗透率报表",
parentId: "907" parentId: "907",
} },
] {
authId: "90709",
name: "店端实际交车数",
parentId: "907",
},
],
}, },
{ {
authId: "90708", authId: "90708",
parentId: "907", parentId: "907",
category: "Button", category: "Button",
handle: "handleOutputImport", handle: "handleOutputImport",
label: "导入" label: "导入",
} },
], ],
component: _import("index") component: _import("index"),
}, },
90703: { 90703: {
path: "/outputValue", path: "/outputValue",
...@@ -84,7 +89,7 @@ export const routerName = { ...@@ -84,7 +89,7 @@ export const routerName = {
parentId: "907", parentId: "907",
cache: false, cache: false,
sideHidden: true, sideHidden: true,
activePath: "/index" activePath: "/index",
}, },
auth: [ auth: [
{ {
...@@ -94,29 +99,29 @@ export const routerName = { ...@@ -94,29 +99,29 @@ export const routerName = {
icon: "plus", icon: "plus",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleAdd" handle: "handleAdd",
}, },
{ {
authId: "9070303", authId: "9070303",
parentId: "90703", parentId: "90703",
label: "导入", label: "导入",
category: "Button", category: "Button",
handle: "handleImport" handle: "handleImport",
}, },
{ {
authId: "9070302", authId: "9070302",
parentId: "90703", parentId: "90703",
label: "编辑", label: "编辑",
handle: "handleEdit" handle: "handleEdit",
}, },
{ {
authId: "9070304", authId: "9070304",
parentId: "90703", parentId: "90703",
label: "删除", label: "删除",
handle: "handleDelete" handle: "handleDelete",
} },
], ],
component: _import("index/outputValue") component: _import("index/outputValue"),
}, },
90704: { 90704: {
path: "/permeation", path: "/permeation",
...@@ -127,7 +132,7 @@ export const routerName = { ...@@ -127,7 +132,7 @@ export const routerName = {
parentId: "907", parentId: "907",
cache: false, cache: false,
sideHidden: true, sideHidden: true,
activePath: "/index" activePath: "/index",
}, },
auth: [ auth: [
{ {
...@@ -136,7 +141,7 @@ export const routerName = { ...@@ -136,7 +141,7 @@ export const routerName = {
label: "导出", label: "导出",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleExport" handle: "handleExport",
}, },
// 新车交付率导出 // 新车交付率导出
{ {
...@@ -145,7 +150,7 @@ export const routerName = { ...@@ -145,7 +150,7 @@ export const routerName = {
label: "导出", label: "导出",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleDetailExport" handle: "handleDetailExport",
}, },
{ {
authId: "9070403", authId: "9070403",
...@@ -153,9 +158,32 @@ export const routerName = { ...@@ -153,9 +158,32 @@ export const routerName = {
label: "日报导出", label: "日报导出",
category: "Button", category: "Button",
type: "primary", type: "primary",
handle: "handleDailyExport" handle: "handleDailyExport",
} },
], ],
component: _import("index/permeation") component: _import("index/permeation"),
} },
} 90709: {
path: "/deliveryCount",
name: "deliveryCount",
meta: {
title: "店端实际交车数",
authId: "90709",
parentId: "907",
cache: false,
sideHidden: true,
activePath: "/index",
},
auth: [
{
authId: "9070901",
parentId: "90709",
label: "导出",
category: "Button",
type: "primary",
handle: "handleExport",
},
],
component: _import("index/deliveryCount"),
},
};
<!-- 店端实际交车数 -->
<template>
<d2-container class="delivery-count">
<template #header>
<div class="header">
<d2-search class="show-search"
:form-data="showFormData"
label-width="140px"
:search-form="searchForm"
:search-select-obj="searchSelectObj">
<template #reportDate>
<el-date-picker v-model="searchForm.reportDate"
end-placeholder="结束日期"
:picker-options="pickerOptions"
range-separator="至"
size="mini"
start-placeholder="开始日期"
type="daterange"
value-format="yyyy-MM-dd" />
</template>
<div class="up-btns">
<el-button :id="tableParams.btnId"
size="small"
type="primary">
查询
</el-button>
<el-button size="small" @click="handleReset">
重置
</el-button>
</div>
</d2-search>
</div>
</template>
<div class="d2-container-content">
<div class="table-header">
<div class="table-title">
{{ merchantName || '店端实际交车数' }}
</div>
<!-- <auth-button category="Button" :show-btn-ids="['9070901']" /> -->
<el-button size="small"
type="primary"
@click="handleExport">
导出
</el-button>
</div>
<d2-table ref="recordTable"
:before-search-fn="beforeSearchFn"
:get-list-api="getListApi"
:search-form="searchFormSearch"
:table-data="tableData"
:table-params="tableParams" />
</div>
</d2-container>
</template>
<script>
import dayjs from "dayjs";
import { mapActions, mapState } from "vuex";
import { permeabilityDetail } from "@/api/permeation.js";
import { rangePickerOptions_oneYearNoFuture } from "@/common/format";
import { deepClone } from "@/common/util";
export default {
name: "DeliveryCount",
data() {
return {
getListApi: permeabilityDetail,
searchForm: {
merchantId: "",
staffName: "",
createdDate: "",
reportDate: "",
},
searchFormSearch: {},
searchSelectObj: {},
showFormData: [
{
label: "员工姓名",
name: "staffName",
type: "input",
},
{
label: "填报日期",
name: "createdDate",
type: "datePicker",
valueFormat: "yyyy-MM-dd",
pickerOptions: "rangePickerOptions_oneYearNoFuture",
},
{
label: "日报时间",
name: "reportDate",
addHtml: "reportDate",
},
],
tableData: [],
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000, 10),
listName: "list",
tableOption: false,
tableColumns: [
{
label: "员工名称",
prop: "staffName",
},
{
label: "店端实际交车数",
prop: "deliveryCount",
formatter: (cellValue) => {
return (cellValue.deliveryCount ?? "") === ""
? "-"
: cellValue.deliveryCount;
},
},
{
label: "填报时间",
prop: "createdDate",
},
{
label: "日报时间",
prop: "reportDate",
},
],
},
sceneType: "0",
pickerOptions: rangePickerOptions_oneYearNoFuture,
};
},
computed: {
...mapState({
dowloadList: state => state.d2admin.user.dowloadList,
}),
merchantName() {
return this.$route.query.merchantName || "";
},
},
created() {
const { merchantId, startDate, endDate } = this.$route.query;
if (merchantId) {
this.searchForm.merchantId = merchantId;
}
if (startDate && endDate) {
this.searchForm.reportDate = [startDate, endDate];
}
},
methods: {
...mapActions("d2admin/user", ["actionSetDownloadList"]),
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = this.getParams();
resolve();
});
},
getParams() {
this.searchFormSearch = deepClone(this.searchForm);
if (this.searchFormSearch.createdDate) {
this.searchFormSearch.createdStartDate
= dayjs(this.searchFormSearch.createdDate[0]).format("YYYY-MM-DD")
+ " 00:00:00";
this.searchFormSearch.createdEndDate
= dayjs(this.searchFormSearch.createdDate[1]).format("YYYY-MM-DD")
+ " 23:59:59";
}
if (this.searchFormSearch.reportDate) {
this.searchFormSearch.reportStartDate = dayjs(
this.searchFormSearch.reportDate[0],
).format("YYYY-MM-DD");
this.searchFormSearch.reportEndDate = dayjs(
this.searchFormSearch.reportDate[1],
).format("YYYY-MM-DD");
}
this.searchFormSearch.sceneType = this.sceneType;
return this.searchFormSearch;
},
handleExport() {
const params = this.getParams();
params.method
= "dj.api.smartcarlife.permeability.report.detail.exportAsync";
const list = [
...this.dowloadList,
{
name: " 店端实际交车数统计",
exportParam: JSON.stringify(params),
status: "waiting",
timeid: new Date().getTime(),
},
];
this.actionSetDownloadList({ list, type: "dowloadList" });
},
handleReset() {
const { merchantId, startDate, endDate } = this.$route.query;
this.searchForm = {
merchantId: merchantId || "",
staffName: "",
createdDate: "",
reportDate: startDate && endDate ? [startDate, endDate] : "",
};
this.$refs.recordTable.refreshTable();
},
},
};
</script>
<style lang="scss" scoped>
.delivery-count {
// .header {
// display: flex;
// align-items: center;
// ::v-deep {
// .el-date-editor {
// width: 220px;
// }
// }
// }
.table-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
.table-title {
font-size: 16px;
color: #333333;
font-weight: 600;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!