Browse Source

值班人员 common.js 提交

wangqin
Joe 1 year ago
parent
commit
a5e7ae18eb
  1. 9
      ruoyi-ui/src/views/JiHeExpressway/components/Dialog/index.vue
  2. 2
      ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/index.vue
  3. 284
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/dutyOfficer/components/ModifyDutyInformationTable.vue
  4. 102
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/dutyOfficer/index.vue
  5. 11
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/emergencyAgencies/index.vue
  6. 6
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/index.vue
  7. 39
      ruoyi-ui/src/views/JiHeExpressway/scss/el-reset.scss
  8. 2
      ruoyi-ui/src/views/JiHeExpressway/scss/reset.scss
  9. 56
      ruoyi-ui/src/views/JiHeExpressway/utils/common.js

9
ruoyi-ui/src/views/JiHeExpressway/components/Dialog/index.vue

@ -178,7 +178,14 @@ export default {
width: 100%;
justify-content: flex-end;
margin-bottom: 21px;
padding: 0 36px;
padding: 0 27px;
::v-deep {
>div {
min-width: 96px;
}
}
// padding: 21px 36px;
// padding-top: 9px;
}

2
ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/index.vue

@ -238,7 +238,7 @@ export default {
return new Promise((resolve, reject) => {
this.$refs.ElFormRef.validate((bool) => {
if (bool) resolve(cloneDeep(this.modelFormData))
else reject()
else reject("表单验证未通过")
})
})
}

284
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/dutyOfficer/components/ModifyDutyInformationTable.vue

@ -1,42 +1,43 @@
<template>
<Dialog v-model="visibleModel" title="修改值班信息表">
<Dialog v-model="visibleModel" :title="`${data ? '修改' : '新增'}值班信息表`">
<div class="ModifyDutyInformationTable">
<div class="search">
<InputSearch style="width: 402px;" />
</div>
<div class="body">
<div class="people">
<div v-for="item in 36" :key="item">
<span>甘易玫</span>
<span>13011600555</span>
<Form v-if="!data" :formList="formList" column="2" ref="FormRef" />
<div v-if="peopleList.length" class="people">
<div v-for=" item in peopleList " :key="item.id" @click="chooseDutyPerson(item)">
<span>{{ item.name || '-' }}</span>
<span>{{ item.contactNumber || '-' }}</span>
</div>
</div>
<div v-else class="people no-data">暂无人员</div>
<img src="./../images/Line.svg">
<div class="dutyPeople">
<div class="line">
<p>白天值班:</p>
<div :class="['line', { active: active == 'dayShift' }]">
<p @click="active = 'dayShift'">白天值班:</p>
<div>
<p v-for="item in 15">甘易玫</p>
<p v-for=" item in dayShift" :key="item.id" @click="removeDutyPerson(item)">{{ item.name }}</p>
<div class="no-data" v-if="!dayShift.length">未添加人员</div>
</div>
</div>
<div class="line">
<p>晚上值班:</p>
<div :class="['line', { active: active == 'graveyardShift' }]">
<p @click="active = 'graveyardShift'">晚上值班:</p>
<div>
<p v-for="item in 15">甘易玫</p>
<p v-for=" item in graveyardShift" :key="item.id" @click="removeDutyPerson(item)">{{ item.name }}</p>
<div class="no-data" v-if="!graveyardShift.length">未添加人员</div>
</div>
</div>
</div>
<div>
<Form :formList="formList" :rules="{ '桩号:': [{ required: true, message: '年龄不能为空' }] }" column="1"
style="flex: 1;" />
</div>
</div>
<div class="bottom">
<Button>确认</Button>
<Button :style="{ backgroundColor: '#C9C9C9' }"> 取消</Button>
</div>
</div>
<template #footer>
<Button :style="{ backgroundColor: '#C9C9C9' }" @click.native="$emit('close')"> 取消</Button>
<Button @click.native="submit">确认</Button>
</template>
</Dialog>
</template>
@ -46,6 +47,11 @@ import Button from "@screen/components/Buttons/Button.vue"
import InputSearch from '@screen/components/InputSearch/index.vue';
import Form from '@screen/components/FormConfig';
import { loadingMessage } from '@screen/utils/common';
import request from "@/utils/request";
import { Message } from "element-ui";
export default {
name: 'ModifyDutyInformationTable',
components: {
@ -58,6 +64,10 @@ export default {
visible: {
type: Boolean,
default: false
},
data: {
type: Object,
default: null
}
},
emit: ['close'],
@ -65,21 +75,32 @@ export default {
return {
formList: [
{
label: "操作人员:",
key: "input",
type: "input",
label: "驻点:",
key: "station",
type: "select",
required: true,
options: {
placeholder: "请输入人员名称"
options: []
},
ons: {
change: (id) => this.getPeopleList(id)
}
}
},
{
label: "日期:",
key: "date",
required: true,
type: "datePicker",
options: {
valueFormat: "yyyy-MM-dd"
}
},
],
list: Array.from({ length: 15 }).map(item => ({
title: "123456",
list: Array.from({ length: 15 }).map((_, index) => ({
name: index,
phone: "12345678901"
}))
}))
value2: null,
dayShift: [],
graveyardShift: [],
peopleList: [],
active: 'dayShift'
}
},
computed: {
@ -91,6 +112,175 @@ export default {
this.$emit('close', bool);
}
}
},
watch: {
visible: {
immediate: true,
handler(bool) {
if (!bool) return;
if (!this.data) {
//
request({
url: `/business/employees/organization`,
method: "POST",
data: {}
})
.then((result) => {
if (result.code != 200) return;
const data = [];
result.data.forEach(item => {
if (item.organizationType == 2) {
data.push({
key: item.id,
label: item.organizationName,
disabled: false
})
}
})
this.formList[0].options.options = data;
})
.catch((err) => {
});
return;
}
this.getPeopleList(this.data.station);
this.dayShift = [...this.data.dayShift || []];
this.graveyardShift = [...this.data.graveyardShift || []];
}
}
},
methods: {
chooseDutyPerson(item) {
const hasInserted = this[this.active].find(_item => _item.id === item.id);
if (hasInserted) return Message.warning("人员已存在");
this[this.active].push(item)
},
removeDutyPerson(item) {
const index = this[this.active].findIndex(_item => _item.id === item.id);
if (index === -1) return Message.warning("人员不存在");
this[this.active].splice(index, 1);
},
getPeopleList(id) {
this.peopleList = [];
this.dayShift = [];
this.graveyardShift = [];
const closeMessage = loadingMessage({ message: "人员获取中..." });
request({
url: `/business/employees/list`,
method: "GET",
params: {
organizationId: id
}
})
.then((result) => {
if (result.code != 200) return Message.error("人员获取失败");
if (!result.rows?.length) return Message.warning("该驻点下暂无人员");
Message.success("人员获取成功")
this.peopleList = result.rows;
})
.catch((err) => {
Message.error("人员获取失败")
})
.finally(() => {
closeMessage();
})
},
updateData(data) {
return request({
url: `/business/shifts`,
method: "POST",
data: {
date: data.date,
employeesJson: [
...this.dayShift.map(({ id }) => ({
employeesId: id,
scheduling: 1,
station: data.station
})),
...this.graveyardShift.map(({ id }) => ({
employeesId: id,
scheduling: 2,
station: data.station
})),
]
}
})
},
async submit() {
let data = this.data;
if (this.$refs.FormRef)
data = await this.$refs.FormRef.validate();
console.log("%c [ data ]-202-「ModifyDutyInformationTable.vue」", "font-size:15px; background:#9afce6; color:#deffff;", data, this.value2);
const closeMessage = loadingMessage({ message: "正在保存值班信息..." });
if (!this.data) {
this.updateData(data)
.then((result) => {
if (result.code != 200) return Message.error("保存失败");
Message.success("保存成功");
this.$emit('close')
})
.catch((err) => {
Message.error("保存失败")
})
.finally(() => {
closeMessage();
})
return;
} else {
const deleteIds = [];
(this.data.dayShift || []).forEach(item => {
const findIndex = this.dayShift.findIndex(_item => _item.id === item.id);
if (findIndex === -1) deleteIds.push(item.id)
});
(this.data.graveyardShift || []).forEach(item => {
const findIndex = this.graveyardShift.findIndex(_item => _item.id === item.id);
if (findIndex === -1) deleteIds.push(item.id)
})
Promise.allSettled([
request({
url: `/business/shifts/${deleteIds.join()}`,
method: "DELETE",
data: {}
}),
this.updateData(this.data)
])
.then(([del, update]) => {
if (del.status === 'rejected' && update.status === 'rejected') return Message.error("修改失败");
if (del.value.code != '200' && update.value.code != '200') return Message.error("修改失败");
this.$emit('close')
})
.finally(() => {
closeMessage();
})
}
}
}
}
</script>
@ -130,8 +320,8 @@ export default {
overflow-y: auto;
>div {
background: #0D5F79;
height: 65px;
background: linear-gradient(180deg, #00AEE5 0%, #0086B1 100%);
border-radius: 2px;
font-size: 16px;
font-family: PingFang SC, PingFang SC;
@ -146,6 +336,10 @@ export default {
cursor: pointer;
padding: 9px 12px;
}
.active {
background: linear-gradient(180deg, #00AEE5 0%, #0086B1 100%);
}
}
.dutyPeople {
@ -153,6 +347,12 @@ export default {
flex-direction: column;
gap: 9px;
.active {
p {
background: linear-gradient(180deg, rgba(1, 167, 220, 0) 0%, #01A7DC 100%);
}
}
>div {
display: flex;
gap: 9px;
@ -161,7 +361,7 @@ export default {
overflow: hidden;
p {
background: linear-gradient(180deg, rgba(1, 167, 220, 0) 0%, #01A7DC 100%);
background: linear-gradient(180deg, rgba(0, 148, 255, 0) 0%, rgba(37, 124, 255, .15) 100%);
height: 42px;
display: flex;
align-items: center;
@ -190,15 +390,5 @@ export default {
}
}
}
.bottom {
display: flex;
gap: 15px;
justify-content: end;
>div {
width: 96px;
}
}
}
</style>

102
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/dutyOfficer/index.vue

@ -20,7 +20,7 @@
</template>
上传
</ButtonGradient>
<ButtonGradient>
<ButtonGradient @click.native="handleModifyDutyInformationTable(true)">
<template #prefix>
<img src="@screen/images/insert.svg" />
</template>
@ -53,9 +53,9 @@
</div>
</div>
</template>
<template #content-key_1="{ data }">
<div class="item-parent" v-if="data.key_1 && data.key_1.length">
<div class="item" v-for="item in data.key_1">
<template #content-dayShift="{ data }">
<div class="item-parent" v-if="data.dayShift && data.dayShift.length">
<div class="item" v-for="item in data.dayShift">
<img src="@screen/images/form/people.svg" />
{{ item.name }}
</div>
@ -64,9 +64,9 @@
无值班人员
</div>
</template>
<template #content-key_2="{ data }">
<div class="item-parent" v-if="data.key_2 && data.key_2.length">
<div class="item" v-for="item in data.key_2">
<template #content-graveyardShift="{ data }">
<div class="item-parent" v-if="data.graveyardShift && data.graveyardShift.length">
<div class="item" v-for="item in data.graveyardShift">
<img src="@screen/images/form/people.svg" />
{{ item.name }}
</div>
@ -75,20 +75,20 @@
无值班人员
</div>
</template>
<template #operation-content>
<ButtonGradient class="operate-button" @click.native="handleModifyDutyInformationTable(true)">
<template #operation-content="{ data }">
<ButtonGradient class="operate-button" @click.native="handleModifyDutyInformationTable(true, data)">
<template #prefix>
<img src="@screen/images/form/edit.svg" />
</template>
修改
</ButtonGradient>
<ButtonGradient class="operate-button" @click.native="handleOperateRecord(true)">
<ButtonGradient class="operate-button" @click.native="handleOperateRecord(true, data)">
<template #prefix>
<img src="@screen/images/form/record.svg" />
</template>
记录
</ButtonGradient>
<ButtonGradient class="operate-button">
<ButtonGradient class="operate-button" @click.native="handleDelete(data)">
<template #prefix>
<img src="@screen/images/form/delete.svg" />
</template>
@ -98,7 +98,8 @@
</SpecialTable>
<OperateRecord :visible="operateRecordVisible" @close="handleOperateRecord(false)" />
<ModifyDutyInformationTable :visible="modifyDutyInformationTableVisible"
<ModifyDutyInformationTable :visible="modifyDutyInformationTableVisible" :data="dialogData"
@close="handleModifyDutyInformationTable(false)" />
</div>
</template>
@ -113,8 +114,9 @@ import InputSearch from '@screen/components/InputSearch/index.vue';
import { searchFormList } from "./data";
import request from "@/utils/request";
import { setLoading } from "@screen/utils/index.js"
import { delay, exportFile } from "@screen/utils/common";
import { delay, exportFile, confirm } from "@screen/utils/common";
import { SchedulingEnum } from "@screen/utils/enum.js"
import { Message } from "element-ui";
export default {
name: 'DutyOfficer',
@ -125,7 +127,7 @@ export default {
ButtonGradient,
InputSearch
},
inject: ['getPagination', 'setTotal'],
inject: ['getPagination', 'setTotal', 'setCurrentPage'],
data() {
return {
columns: [
@ -140,20 +142,21 @@ export default {
width: "240px"
},
{
key: "key_1",
key: "dayShift",
title: "白班",
width: "510px"
},
{
key: "key_2",
key: "graveyardShift",
title: "夜班",
width: "510px"
},
],
data: [],
searchFormList: [],
operateRecordVisible: false,
modifyDutyInformationTableVisible: false
modifyDutyInformationTableVisible: false,
dialogData: null
}
},
created() {
@ -163,8 +166,11 @@ export default {
handleOperateRecord(bool) {
this.operateRecordVisible = bool;
},
handleModifyDutyInformationTable(bool) {
handleModifyDutyInformationTable(bool, data) {
if (!bool) this.setCurrentPage(1);
this.modifyDutyInformationTableVisible = bool;
this.dialogData = data;
},
handleExport() {
exportFile({
@ -202,30 +208,50 @@ export default {
...this.searchData,
...this.getPagination()
}
}).then(result => {
if (result.code != 200) return;
this.data = result.rows.map(item => {
const result = {
date: item.date,
organizationName: item.organizationName[0].organizationName,
}
})
.then(result => {
if (result.code != 200) return;
this.data = result.rows.map(item => {
const result = {
date: item.date,
organizationName: item.organizationName,
station: item.station,
id: item.id
}
item.organizationName.forEach(item => {
const key = `key_${item.scheduling}`;
if (!result[key]) result[key] = [];
item.shiftsList.forEach(item => {
const key = { 1: 'dayShift', 2: 'graveyardShift' }[item.scheduling];
if (!result[key]) result[key] = [];
result[key].push({
name: item.name,
});
})
result[key].push(item);
})
return result
});
this.total = result.total;
}).finally(() => {
closeLoading();
return result
});
this.total = result.total;
})
.finally(() => {
closeLoading();
})
},
async handleDelete(data) {
await confirm({ message: "是否要删除该值班信息?" });
request({
url: `/business/shifts/${data.id}`,
method: "DELETE",
data: {}
})
.then(result => {
if (result.code != 200) return Message.error("删除失败");
this.setCurrentPage(1)
Message.success("删除成功")
})
.catch(() => {
Message.error("删除失败")
})
}
}
}

11
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/emergencyAgencies/index.vue

@ -57,7 +57,8 @@ import AddNEditDialog from "./components/AddNEditDialog.vue"
import { searchFormList } from "./data";
import request from "@/utils/request";
import { setLoading } from "@screen/utils/index.js"
import { delay, exportFile } from "@screen/utils/common";
import { delay, exportFile, confirm } from "@screen/utils/common";
import { Message } from "element-ui";
//
export default {
@ -110,9 +111,11 @@ export default {
this.getData();
},
methods: {
handleDelete(data) {
async handleDelete(data) {
await confirm({ message: "是否要删除该机构?" });
request({
url: `/business/shifts/${data.dcOrganizations.id}`,
url: `/business/shifts/${data.id}`,
method: "DELETE",
data: {}
})
@ -160,7 +163,7 @@ export default {
}).then(result => {
if (result.code != 200) return;
this.data = result.data;
this.data = result.rows;
this.setTotal(result.total)
}).finally(() => {
closeLoading();

6
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/index.vue

@ -48,7 +48,7 @@ import { Message } from "element-ui";
import { searchFormList } from "./data";
import request from "@/utils/request";
import { setLoading } from "@screen/utils/index.js"
import { delay, exportFile } from "@screen/utils/common";
import { delay, exportFile, confirm } from "@screen/utils/common";
//
export default {
@ -73,7 +73,9 @@ export default {
this.getSearchOptions();
},
methods: {
handleDelete(data) {
async handleDelete(data) {
await confirm({ message: "是否要删除该人员?" });
request({
url: `/business/employees/${data.id}`,
method: "DELETE",

39
ruoyi-ui/src/views/JiHeExpressway/scss/el-reset.scss

@ -157,6 +157,12 @@ div.el-date-editor {
div.el-popover:has(> .el-date-picker),
div.el-picker-panel.el-date-picker.el-popper,
div.el-picker-panel.el-date-range-picker.el-popper {
.next-month,
.prev-month {
span {
color: rgba(255, 255, 255, 0.3) !important;
}
}
position: relative;
background: #064258;
border-radius: 2px 2px 2px 2px;
@ -516,3 +522,36 @@ div.el-popper.global-input-search-popover {
}
}
}
.el-message-box__wrapper {
.el-message-box {
background: #29647d;
border: 0;
border-radius: 3px;
.el-message-box__header {
.el-message-box__title {
color: #fff;
}
button {
i {
color: #fff;
}
}
}
.el-message-box__content {
.el-message-box__message {
color: #fff;
}
}
.el-message-box__btns {
.el-button {
background: rgba(0, 179, 204, 0.3);
color: #fff;
}
.el-button--primary {
background: #00b3cc;
}
}
}
}

2
ruoyi-ui/src/views/JiHeExpressway/scss/reset.scss

@ -44,7 +44,7 @@ body {
}
.no-data {
display: flex;
display: flex !important;
align-items: center;
justify-content: center;
color: #fff;

56
ruoyi-ui/src/views/JiHeExpressway/utils/common.js

@ -1,5 +1,5 @@
import request from "@/utils/request";
import { Message } from "element-ui";
import { Message, MessageBox } from "element-ui";
export function delay(ms = 240) {
return new Promise((resolve) => setTimeout(() => resolve(void 0), ms));
@ -18,12 +18,7 @@ export function exportFile({
ext = "xlsx",
} = {}) {
if (!url) return;
const loadingMessage = Message.info({
message: `文件下载中...`,
duration: 0,
customClass: "loading-message",
iconClass: "el-icon-loading",
});
const closeMessage = loadingMessage({ message: "文件下载中..." });
request({
url,
@ -52,5 +47,50 @@ export function exportFile({
.catch((err) => {
Message.error("文件下载失败");
})
.finally(() => loadingMessage.close());
.finally(() => closeMessage());
}
/**
*
* @param {ElMessageOptions} options
* @returns
*/
export function loadingMessage({ message, ...args } = {}) {
if (!message) return;
const loadingMessage = Message.info({
message,
duration: 0,
customClass: "loading-message",
iconClass: "el-icon-loading",
...args,
});
return () => loadingMessage.close();
}
/**
*
* @param {{ message: string, title: string; [x: string]: any }} param0
* @returns
*/
export function confirm({
title = "提示",
message = "确定要执行该操作吗?",
...args
} = {}) {
return new Promise((resolve, reject) => {
MessageBox.confirm(message, title, {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
...args,
})
.then(() => {
resolve();
})
.catch(() => {
reject("取消 Confirm");
});
});
}

Loading…
Cancel
Save