From f39fb3a2d0c2d66f1a8af4f6a253afc34c254e7d Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期日, 28 四月 2024 23:58:36 +0800
Subject: [PATCH] update
---
src/views/console/base/Shiftsystem.vue | 133 ++++++++++++++++++++++++---------
src/config/table.js | 12 +-
src/views/console/base/shift-calendar.vue | 45 ++++++-----
src/api/model/calender.js | 18 ++--
4 files changed, 135 insertions(+), 73 deletions(-)
diff --git a/src/api/model/calender.js b/src/api/model/calender.js
index 884e450..f6f8002 100644
--- a/src/api/model/calender.js
+++ b/src/api/model/calender.js
@@ -1,7 +1,7 @@
/*
* @Date: 2024-04-04 23:26:03
* @LastEditors: Sneed
- * @LastEditTime: 2024-04-09 21:20:10
+ * @LastEditTime: 2024-04-28 22:52:35
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/api/model/calender.js
*/
import config from "@/config"
@@ -11,29 +11,29 @@
getList: {
url: `${config.API_URL}/blade-cps/calendar/page`,
name: "鑾峰彇鏃ュ巻鍒楄〃",
- post: async function(data,params){
- return await http.post(this.url, data, {params});
+ post: async function (data, params) {
+ return await http.post(this.url, data, { params });
},
},
getShiftsystemList: {
url: `${config.API_URL}/blade-cps/shift/page`,
name: "鑾峰彇鐝埗鍒楄〃",
- post: async function({data,params}){
- return await http.post(this.url, {},{data, params});
+ get: async function (data) {
+ return await http.post(this.url, data, { params: { current: data.current, size: data.size } });
},
},
getShiftsystemInfo: {
url: `${config.API_URL}/blade-cps/shift/`,
name: "鑾峰彇鐝埗淇℃伅",
- get: async function({id}){
- return await http.get(`${this.url}${id}`, {},{});
+ get: async function ({ id }) {
+ return await http.get(`${this.url}${id}`, {}, {});
},
},
getShiftsystemDetail: {
url: `${config.API_URL}/blade-system/param/detail?paramKey=system.shift.max`,
name: "鑾峰彇鐝埗淇℃伅闄愬埗",
- get: async function(){
- return await http.get(this.url, {},{});
+ get: async function () {
+ return await http.get(this.url, {}, {});
},
},
}
\ No newline at end of file
diff --git a/src/config/table.js b/src/config/table.js
index 31d20ac..f10d398 100644
--- a/src/config/table.js
+++ b/src/config/table.js
@@ -36,11 +36,11 @@
*/
columnSettingSave: function (tableName, column) {
return new Promise((resolve) => {
- setTimeout(()=>{
+ setTimeout(() => {
//杩欓噷涓轰簡婕旂ず浣跨敤浜唖ession鍜宻etTimeout婕旂ず锛屽紑鍙戞椂搴旂敤鏁版嵁璇锋眰
tool.session.set(tableName, column)
resolve(true)
- },1000)
+ }, 1000)
})
},
/**
@@ -52,9 +52,9 @@
return new Promise((resolve) => {
//杩欓噷涓轰簡婕旂ず浣跨敤浜唖ession鍜宻etTimeout婕旂ず锛屽紑鍙戞椂搴旂敤鏁版嵁璇锋眰
const userColumn = tool.session.get(tableName)
- if(userColumn){
+ if (userColumn) {
resolve(userColumn)
- }else{
+ } else {
resolve(column)
}
})
@@ -67,10 +67,10 @@
columnSettingReset: function (tableName, column) {
return new Promise((resolve) => {
//杩欓噷涓轰簡婕旂ず浣跨敤浜唖ession鍜宻etTimeout婕旂ず锛屽紑鍙戞椂搴旂敤鏁版嵁璇锋眰
- setTimeout(()=>{
+ setTimeout(() => {
tool.session.remove(tableName)
resolve(column)
- },1000)
+ }, 1000)
})
}
}
diff --git a/src/views/console/base/Shiftsystem.vue b/src/views/console/base/Shiftsystem.vue
index c8d8412..6bdda03 100644
--- a/src/views/console/base/Shiftsystem.vue
+++ b/src/views/console/base/Shiftsystem.vue
@@ -1,71 +1,130 @@
<!--
* @Date: 2024-04-09 20:19:46
* @LastEditors: Sneed
- * @LastEditTime: 2024-04-09 21:57:50
+ * @LastEditTime: 2024-04-28 23:55:44
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/base/Shiftsystem.vue
-->
<template>
<el-container>
<el-aside width="320px">
- <el-button type="primary" @click="add">鏂板缓鐝埗</el-button>
- <el-table :data="tableData" stripe style="width: 100%" @row-click="rowClick">
- <el-table-column prop="code" label="鐝埗缂栧彿" />
+ <scTable style="width: 100%;" ref="table" row-key="id" border :params="params" :apiObj="apiObj" stripe
+ :hideDo="true" paginationLayout="total, prev, pager, next" @dataChange="dataChange"
+ @row-click="rowClick" highlight-current-row>
+ <el-table-column prop="code" label="鐝埗缂栧彿" width="100px" />
<el-table-column prop="name" label="鐝埗鍚嶇О" />
- </el-table>
+ </scTable>
</el-aside>
<el-container>
- <ul>
- <li>
- <span>鐝埗缂栧彿</span>
- {{ info.code }}
- </li>
- <li>
- <span>鐝埗棰滆壊</span>
- {{ info.code }}
- </li>
- <li>
- <span>寮�濮�-缁撴潫鏃堕棿</span>
- {{ info.code }}
- </li>
- </ul>
+ <el-header>
+ <el-button style="margin-left: auto;" size="small" @click="table_add" type="primary"
+ icon="el-icon-plus"></el-button>
+ <el-button @click="table_edit" type="primary" size="small">缂栬緫</el-button>
+ <el-button type="danger" plain icon="el-icon-delete" size="small" @click="del"></el-button>
+ </el-header>
+ <el-main>
+ <el-row>
+ <el-col :span="2">
+ 鐝埗缂栧彿
+ </el-col>
+ <el-col :span="6">
+ {{ info.code }}
+ </el-col>
+ <el-col :span="2">
+ 鐝埗棰滆壊
+ </el-col>
+ <el-col :span="6">
+ <el-color-picker size="small" v-model="info.colour" />
+ </el-col>
+ <el-col :span="2">
+ 寮�濮�-缁撴潫鏃堕棿
+ </el-col>
+ <el-col :span="6">
+ {{ dateFormat(info.startTime) }} - {{ dateFormat(info.endTime | dateFormat) }}
+ </el-col>
+ </el-row>
+ <el-row style="margin-top: 20px;">
+ <el-timeline style="max-width: 600px">
+ <el-timeline-item v-for="(activity, index) in activities" :key="index"
+ :timestamp="activity.time">
+ {{ activity.title }}
+ </el-timeline-item>
+ </el-timeline>
+ </el-row>
+ <el-row>
+
+ </el-row>
+ </el-main>
</el-container>
- <Dialog ref="dialog" :option="{types,status,group}"></Dialog>
+ <Dialog ref="dialog" :option="{ types, status, group }"></Dialog>
</el-container>
</template>
<script>
import Dialog from './Dialog.vue'
+import moment from 'moment';
export default {
components: {
Dialog
},
- data () {
- return {
- tableData: [],
- info: {
- code: ''
+ computed: {
+ dateFormat: () => {
+ return value => {
+ if (isNaN(value)) return ''
+ let pre = '褰撴棩'
+ let add = value / (24 * 60)
+ if (add < 0) {
+ pre = '涓婃棩'
+ } else if (add >= 1) {
+ pre = '娆℃棩'
+ }
+ let base = moment().format('YYYY-MM-DD') + ' 00:00'
+ let current = moment(base).add(value, 'm')
+ return pre + moment(current).format('HH:mm');
}
+ },
+ activities() {
+ if (!this.info?.shiftDetailVOList?.length) return []
+ return this.info.shiftDetailVOList.map(item => {
+ return {
+ title: `鐝鍚嶇О锛�${item.indexName}`,
+ time: `${this.dateFormat(item.shiftStartTime)}-${this.dateFormat(item.shiftEndTime)}`
+ }
+ })
}
},
- created () {
- this.$API.calender.getShiftsystemList.post({params: {current:1,size: 15},data: {
- code: "",name: "",statusList: [1]
- }}).then(res => {
- this.tableData = res?.data?.records || []
- let current = this.tableData?.[0] || ''
- current.id && this.rowClick(current)
- })
+ data() {
+ return {
+ apiObj: this.$API.calender.getShiftsystemList,
+ params: {
+ statusList: [1],
+ code: '',
+ name: ''
+ },
+ info: {
+ code: ''
+ },
+ }
+ },
+ created() {
},
methods: {
+ dataChange(res, tableData) {
+ let current = tableData?.[0] || {}
+ current.id && this.rowClick(current)
+ },
rowClick(row) {
- console.log(row)
- this.$API.calender.getShiftsystemInfo.get({id: row.id}).then(res => {
- console.log(res.data)
+ this.$API.calender.getShiftsystemInfo.get({ id: row.id }).then(res => {
this.info = res.data
})
},
- add () {
+ table_add() {
this.$refs.dialog.open()
+ },
+ table_edit() {
+ this.$refs.dialog.open()
+ },
+ del() {
+
}
},
}
diff --git a/src/views/console/base/shift-calendar.vue b/src/views/console/base/shift-calendar.vue
index 0faa3cc..caf7245 100644
--- a/src/views/console/base/shift-calendar.vue
+++ b/src/views/console/base/shift-calendar.vue
@@ -1,11 +1,12 @@
<!--
* @Date: 2024-04-04 21:51:24
* @LastEditors: Sneed
- * @LastEditTime: 2024-04-09 20:19:15
+ * @LastEditTime: 2024-04-28 23:45:46
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/base/shift-calendar.vue
-->
<template>
- <el-main style="height: 100%;background-color: #fff;">
+ <el-main>
+ <el-card shadow="never">
<el-tabs tab-position="top" class="custom-tabs" v-model="activeName">
<el-tab-pane label="鐢熶骇鏃ュ巻" name="1">
<CalenderTab></CalenderTab>
@@ -14,34 +15,36 @@
<ShiftsystemVue></ShiftsystemVue>
</el-tab-pane>
</el-tabs>
+ </el-card>
</el-main>
</template>
<script>
- import CalenderTab from './CalenderTab.vue';
+import CalenderTab from './CalenderTab.vue';
import ShiftsystemVue from './Shiftsystem.vue';
- export default {
- components: {
- CalenderTab,
- ShiftsystemVue
- },
- data () {
- return {
- activeName: '1'
- }
+export default {
+ components: {
+ CalenderTab,
+ ShiftsystemVue
+ },
+ data() {
+ return {
+ activeName: '2'
}
}
+}
</script>
<style lang="scss" scoped>
.el-tabs--card {
- height: calc(100vh - 110px - 56px);
- /* overflow-y: auto; */
+ // height: calc(100vh - 110px - 56px);
+ /* overflow-y: auto; */
}
+
.el-tab-pane {
- height: calc(100vh - 110px - 56px);
- overflow-y: auto;
+ // height: calc(100vh - 110px - 56px);
+ // overflow-y: auto;
}
- // .custom-tabs {
- // height: 500px;
- // overflow: scroll;
- // }
-</style>
\ No newline at end of file
+
+// .custom-tabs {
+// height: 500px;
+// overflow: scroll;
+// }</style>
\ No newline at end of file
--
Gitblit v1.9.3