From 005f9d6f7cbb56dc8549ff6cbeb98190438ba220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A3=B7=E5=8F=B6?= <14103883+leaf-phos@user.noreply.gitee.com> Date: Sat, 7 Dec 2024 16:21:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E8=B0=83=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/user.js | 8 + src/api/yh/shift.js | 53 +++ src/components/Business/User/UserDialog.vue | 2 + src/components/Business/User/UserDrawer.vue | 7 + src/components/Business/User/UserInput.vue | 2 +- src/components/StartEndDatePicker/index.vue | 58 +++ src/utils/constants.js | 63 +++ src/utils/index.js | 16 + .../edit/components/ReportProductEdit.vue | 16 +- .../edit/components/ReportProductRowEdit.vue | 6 + .../components/ReportProductUserListEdit.vue | 10 +- .../components/UserProductBatchDialog.vue | 14 +- src/views/yh/shift/index.vue | 389 ++++++++++++++++++ 13 files changed, 639 insertions(+), 5 deletions(-) create mode 100644 src/api/yh/shift.js create mode 100644 src/components/StartEndDatePicker/index.vue create mode 100644 src/views/yh/shift/index.vue diff --git a/src/api/system/user.js b/src/api/system/user.js index 4ac28c3..2ea737e 100644 --- a/src/api/system/user.js +++ b/src/api/system/user.js @@ -9,6 +9,14 @@ export function listUser(query) { params: query }) } +// 查询包含调班的用户列表 +export function listUserWithShift(query) { + return request({ + url: '/system/user/shiftList', + method: 'get', + params: query + }) +} // 查询用户列表ByIds export function listUserByIds(userIds) { diff --git a/src/api/yh/shift.js b/src/api/yh/shift.js new file mode 100644 index 0000000..b3f6dd0 --- /dev/null +++ b/src/api/yh/shift.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询调班列表 +export function listShift(query) { + return request({ + url: '/yh/shift/list', + method: 'get', + params: query + }) +} + +// 查询调到本部门的列表 +export function listTargetShift(query) { + return request({ + url: '/yh/shift/targetList', + method: 'get', + params: query + }) +} + +// 查询调班详细 +export function getShift(shiftId) { + return request({ + url: '/yh/shift/' + shiftId, + method: 'get' + }) +} + +// 新增调班 +export function addShift(data) { + return request({ + url: '/yh/shift', + method: 'post', + data: data + }) +} + +// 修改调班 +export function updateShift(data) { + return request({ + url: '/yh/shift', + method: 'put', + data: data + }) +} + +// 删除调班 +export function delShift(shiftId) { + return request({ + url: '/yh/shift/' + shiftId, + method: 'delete' + }) +} diff --git a/src/components/Business/User/UserDialog.vue b/src/components/Business/User/UserDialog.vue index f35c10f..9836150 100644 --- a/src/components/Business/User/UserDialog.vue +++ b/src/components/Business/User/UserDialog.vue @@ -8,7 +8,9 @@ ref="check" :multiple="multiple" :init-select="initSelect" + :list-api="listApi" v-on="$listeners" + :query="query" /> diff --git a/src/components/StartEndDatePicker/index.vue b/src/components/StartEndDatePicker/index.vue new file mode 100644 index 0000000..e89fef7 --- /dev/null +++ b/src/components/StartEndDatePicker/index.vue @@ -0,0 +1,58 @@ + + diff --git a/src/utils/constants.js b/src/utils/constants.js index 0141709..7041af0 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -1,4 +1,6 @@ // 视图 +import {getLastDate, getLastDateTimeEnd, getLastDateTimeStart, getLastMonth, getLastMonthTimeEnd} from "@/utils/index"; + export const views = { } @@ -110,3 +112,64 @@ export const OperLogBizType = { MATERIAL: "4", // 物料 UNIT: "5", // 单位 } + +// 日期选择器快捷选项 +export const DatePickerOptions = { + // 默认 + DEFAULT: { + shortcuts: [{ + text: '最近一周', + onClick(picker) { + const end = getLastDate(0); + const start = getLastDate(6); + picker.$emit('pick', [start, end]); + } + }, { + text: '最近一个月', + onClick(picker) { + const end = getLastDate(0); + const start = getLastMonth(1); + picker.$emit('pick', [start, end]); + } + }, { + text: '最近三个月', + onClick(picker) { + const end = getLastDate(0); + const start = getLastMonth(3); + picker.$emit('pick', [start, end]); + } + }] + }, + // 未来 + FUTURE: { + shortcuts: [{ + text: '明天', + onClick(picker) { + const end = getLastDateTimeEnd(-1); + const start = getLastDateTimeStart(-1); + picker.$emit('pick', [start, end]); + } + },{ + text: '未来一周', + onClick(picker) { + const end = getLastDateTimeEnd(-6); + const start = getLastDateTimeStart(0); + picker.$emit('pick', [start, end]); + } + }, { + text: '未来一个月', + onClick(picker) { + const end = getLastMonthTimeEnd(-1); + const start = getLastDateTimeStart(0); + picker.$emit('pick', [start, end]); + } + }, { + text: '未来三个月', + onClick(picker) { + const end = getLastMonthTimeEnd(-3); + const start = getLastDateTimeStart(0); + picker.$emit('pick', [start, end]); + } + }] + } +} diff --git a/src/utils/index.js b/src/utils/index.js index d4dff41..e4b4a9b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -466,6 +466,22 @@ export function getLastMonth(n) { return date; } +export function getLastMonthTimeEndStr(n) { + let date = getLastMonth(n) + return parseTime(date, "{y}-{m}-{d} 23:59:59"); +} +export function getLastMonthTimeEnd(n) { + return new Date(getLastMonthTimeEndStr(n)); +} + +export function getLastMonthTimeStartStr(n) { + let date = getLastMonth(n) + return parseTime(date, "{y}-{m}-{d} 00:00:00"); +} +export function getLastMonthTimeStart(n) { + return new Date(getLastMonthTimeStartStr(n)) +} + // 获取前n月的日期字符串 export function getLastMonthDateStr(n) { let date = getLastMonth(n); diff --git a/src/views/yh/report/edit/components/ReportProductEdit.vue b/src/views/yh/report/edit/components/ReportProductEdit.vue index 25a56b8..222d587 100644 --- a/src/views/yh/report/edit/components/ReportProductEdit.vue +++ b/src/views/yh/report/edit/components/ReportProductEdit.vue @@ -128,7 +128,13 @@ - + @@ -208,6 +215,13 @@ export default { } }, computed: { + // 用户查询条件 + userQuery() { + return { + shiftDate: this.form.reportDate, + targetDeptId: this.form.deptId + } + }, // 获取属性名 getProp() { return (index, prop) => { diff --git a/src/views/yh/report/edit/components/ReportProductRowEdit.vue b/src/views/yh/report/edit/components/ReportProductRowEdit.vue index 932271f..a67ae15 100644 --- a/src/views/yh/report/edit/components/ReportProductRowEdit.vue +++ b/src/views/yh/report/edit/components/ReportProductRowEdit.vue @@ -44,6 +44,7 @@ :price="form.pricePrice" :price-unit="form.priceUnit" :rules="rules.userProdList" + :user-query="userQuery" />
关联订单
@@ -94,6 +95,11 @@ export default { visible: { type: Boolean, default: false, + }, + // 用户查询条件 + userQuery: { + type: Object, + default: () => ({}) } }, data() { diff --git a/src/views/yh/report/edit/components/ReportProductUserListEdit.vue b/src/views/yh/report/edit/components/ReportProductUserListEdit.vue index 2c57842..8361684 100644 --- a/src/views/yh/report/edit/components/ReportProductUserListEdit.vue +++ b/src/views/yh/report/edit/components/ReportProductUserListEdit.vue @@ -4,7 +4,7 @@ @@ -49,7 +49,9 @@ @@ -62,6 +64,7 @@ import UserDialog from "@/components/Business/User/UserDialog.vue"; import UserInput from "@/components/Business/User/UserInput.vue"; import {calcMulDecimal} from "@/utils/money"; import UserDrawer from "@/components/Business/User/UserDrawer.vue"; +import {listUserWithShift} from "@/api/system/user"; export default { name: "ReportProductUserListEdit", @@ -86,6 +89,10 @@ export default { rules: { type: Object, default: () => ({}) + }, + userQuery: { + type: Object, + default: () => ({}) } }, data() { @@ -101,6 +108,7 @@ export default { } }, methods: { + listUserWithShift, // 添加用户产量 handleAddUserProduct() { this.showUserDialog = true; diff --git a/src/views/yh/report/edit/components/UserProductBatchDialog.vue b/src/views/yh/report/edit/components/UserProductBatchDialog.vue index c74232e..b44c055 100644 --- a/src/views/yh/report/edit/components/UserProductBatchDialog.vue +++ b/src/views/yh/report/edit/components/UserProductBatchDialog.vue @@ -25,7 +25,7 @@ @@ -58,6 +58,8 @@ @@ -74,15 +76,22 @@ import UserInput from "@/components/Business/User/UserInput.vue"; import UserDialog from "@/components/Business/User/UserDialog.vue"; import {isEmpty} from "@/utils"; import {IncomeMode} from "@/utils/constants"; +import UserDrawer from "@/components/Business/User/UserDrawer.vue"; +import {listUserWithShift} from "@/api/system/user"; export default { name: "UserProductBatchDialog", - components: {UserDialog, UserInput, FormCol}, + components: {UserDrawer, UserDialog, UserInput, FormCol}, props: { show: { type: Boolean, default: false }, + // 用户查询条件 + userQuery: { + type: Object, + default: () => ({}) + } }, computed: { IncomeMode() { @@ -106,6 +115,7 @@ export default { } }, methods: { + listUserWithShift, onSubmit() { this.$emit('submit', this.form); }, diff --git a/src/views/yh/shift/index.vue b/src/views/yh/shift/index.vue new file mode 100644 index 0000000..eef43d8 --- /dev/null +++ b/src/views/yh/shift/index.vue @@ -0,0 +1,389 @@ + + +