提交 4b83d67b 编写于 作者: 刘英杰's avatar 刘英杰

优化loading、弹窗显示方式

上级 2864f2d4
import {Message, Modal, Spin} from "view-design";
import Cookies from "js-cookie";
export function publicConfirm(publicFunction) {
// 公共弹窗删除
Modal.confirm({
title: '警告',
content: '<p>是否继续此操作?</p>',
cancelText: "取消",
okText: '确定',
onOk: async () => {
// 接收需执行的方法
await publicFunction()
// this.$Modal.remove();
// this.$Message.info('操作成功!');
}
});
}
export function publicMessage(res) {
// 弹窗封装
if (res.code !== 1) {
Message['warning']({
background: true,
content: '操作异常'
});
} else {
Spin.hide();
Message['success']({
background: true,
content: '操作成功'
});
}
}
export function storageAddEventListener(fun) {
// 监听storage事件,当主页面修改数据时,触发该事件
window.addEventListener('storage', (event) => {
if (event.key === 'updataEvent' && event.newValue === 'getDataEvent') {
//刷新主窗口
// 执行你的逻辑
// 重置存储的值,以便下次触发事件
localStorage.setItem('updataEvent', '');
fun()
}
});
}
export async function myEncapsulationFunction(fun) {
// Spin.show()
let res = await fun()
try {
switch (res.code) {
case 1 :
Message['success']({
background: true,
content: res.msg
});
break;
default :
Message['error']({
background: true,
content: res.msg_detail
});
}
console.log("try")
// Spin.hide()
return res
} catch (e) {
console.log("catch,", e)
Spin.hide()
Message['error']({
background: true,
content: res.msg_detail
});
}
}
export function getInitListRequest(fun) {
try {
fun()
return false
} catch (e) {
Message['error']({
background: true,
content: e
})
return false
}
}
export function getUserRole() {
if (Cookies.get('admin-competition-userinfo')) {
let info = JSON.parse(decodeURIComponent(Cookies.get('admin-competition-userinfo')))
return info ? info.role[0].split('').includes('员') : false
} else {
return false
}
}
......@@ -41,7 +41,7 @@
<div style="display: flex; justify-content: center;align-items: center">
<span>值班日期:&nbsp;</span>
<DatePicker v-model="dutyDateX" type="daterange" @on-change="dutyDateSelect" placeholder="请选择值班日期"
<DatePicker type="daterange" @on-change="dutyDateSelect" placeholder="请选择值班日期"
style="width: 10vw"/>
</div>
</Col>
......@@ -91,13 +91,13 @@
</div>
</template>
<Table
:columns="columns"
:data="data"
:height="tableHeightCal"
@on-select="onSelect"
@on-select-cancel="onSelectCancel"
@on-select-all="onSelectAll"
@on-select-all-cancel="onSelectAllCancel">
:loading="tableLoading"
:columns="columns"
:data="data"
@on-select="onSelect"
@on-select-cancel="onSelectCancel"
@on-select-all="onSelectAll"
@on-select-all-cancel="onSelectAllCancel">
<template #is_lead="{row}">
{{ ['值班教师', '值班领导'][row.is_lead] }}
</template>
......@@ -266,11 +266,12 @@
<!-- 导出模板Modal -->
<Modal
v-model="exportModalShow"
:mask-closable="false"
title="模板导出"
@on-ok="exportTemplate">
<span>模板年月:</span><DatePicker v-model="tempYearMonth" type="month" format="yyyy-MM" placeholder=""/>
v-model="exportModalShow"
:mask-closable="false"
title="模板导出"
@on-ok="exportTemplate">
<span>模板年月:</span>
<DatePicker v-model="tempYearMonth" type="month" format="yyyy-MM" placeholder=""/>
</Modal>
</div>
</template>
......@@ -283,6 +284,7 @@
import util from '@/libs/util';
import Cookies from "js-cookie";
import dayjs from 'dayjs'
import * as hooks from "../../hooks/index"
export default {
//import引入的组件需要注入到对象中才能使用",
......@@ -290,6 +292,7 @@
data() {
//这里存放数据",
return {
tableLoading: false,
fileUploadFlag: false,
loadingStatus: false,
file: null,
......@@ -513,18 +516,10 @@
exportModalShow: false,
// 模板导出选择年月
tempYearMonth: '',
// 默认查询条件值班日期
dutyDateX: [],
};
},
//监听属性 类似于data概念",
computed: {
// table高度计算
tableHeightCal() {
return document.documentElement.clientHeight - 360
},
util() {
return util
}
......@@ -659,11 +654,15 @@
this.updateDutyModal = false
},
updateOK() {
this.$refs['updateDutyFrom'].validate(async (validate) => {
this.$refs['updateDutyFrom'].validate((validate) => {
if (validate) {
let date = this.updateDutyFrom
const res = await api.WatchSave(date)
this.getWatchList()
hooks.myEncapsulationFunction(async () => {
let date = this.updateDutyFrom
const res = await api.WatchSave(date)
this.getWatchList()
this.updateDutyModal = false
return res
})
}
})
},
......@@ -707,7 +706,7 @@
content: '是否确认推送?',
loading: true,
onOk: () => {
this.pushM(this.pushListSlc).then(() =>{
this.pushM(this.pushListSlc).then(() => {
this.$Modal.remove()
this.getWatchList()
})
......@@ -733,7 +732,7 @@
return new Promise(resolve => {
api.WatchSendMeg(data).then(res => {
// console.log('推送行res', res)
if (res. code == 1) {
if (res.code == 1) {
this.$Message.success({
content: res.msg,
background: true
......@@ -755,12 +754,15 @@
this.updateDutyModal = true
},
deleteDuty(e) {
this.publicConfirm(async () => {
const data = {
id: e.watchid
}
const res = await api.WatchDel(data)
this.getWatchList()
this.publicConfirm(() => {
hooks.myEncapsulationFunction(async () => {
const data = {
id: e.watchid
}
const res = await api.WatchDel(data)
this.getWatchList()
return res
})
})
},
async search() {
......@@ -784,12 +786,14 @@
},
asyncOK() {
let data = _.cloneDeep(this.formValidate)
this.$refs['formValidate'].validate(async (validate) => {
this.$refs['formValidate'].validate((validate) => {
if (validate) {
const res = await api.WatchCreate(data)
await this.getWatchList()
this.addDuty = false
hooks.myEncapsulationFunction(async () => {
const res = await api.WatchCreate(data)
await this.getWatchList()
this.addDuty = false
return res
})
}
})
},
......@@ -880,35 +884,31 @@
])
.then(res => {
this.cityListAll = res
console.log("🚀🚀🚀,", res)
})
},
async getWatchList() {
// let a =new Date().toLocaleDateString('cn',{hour12:false}).replace(/\//g, '-');
console.log("🚀🚀🚀,", this.initDateTime)//2018/12/6
this.pushListSlc = []
this.$Spin.show()
let data = {
"page_index": this.page_index,
"page_size": this.page_size,
"start_time": this.cityListAlltSearchFlagObject.startTimeSearch !== '' ? this.cityListAlltSearchFlagObject.startTimeSearch : this.cityListAllObject.startTime,
"end_time": this.cityListAlltSearchFlagObject.endTimeSearch !== '' ? this.cityListAlltSearchFlagObject.endTimeSearch : this.cityListAllObject.endTime,
"is_lead": this.cityListAlltSearchFlagObject.is_lead,
"dep_id": this.cityListAlltSearchFlagObject.dutyDepSelect,
"key_name": this.cityListAlltSearchFlagObject.key_name,
"type_id": this.cityListAlltSearchFlagObject.dutyType,
"watchhour_time": this.cityListAlltSearchFlagObject.dutyHourTime,
"campus_id": this.cityListAlltSearchFlagObject.dutyCampus,
// dutyCampus:'',
}
const res = await api.GetWatchList(data)
this.data = res.response.data
this.total = res.response.data_count,
this.$Spin.hide()
this.publicMessage(res)
console.log("🚀🚀🚀,", res)
hooks.getInitListRequest(async () => {
this.tableLoading = true
this.pushListSlc = []
let data = {
"page_index": this.page_index,
"page_size": this.page_size,
"start_time": this.cityListAlltSearchFlagObject.startTimeSearch !== '' ? this.cityListAlltSearchFlagObject.startTimeSearch : this.cityListAllObject.startTime,
"end_time": this.cityListAlltSearchFlagObject.endTimeSearch !== '' ? this.cityListAlltSearchFlagObject.endTimeSearch : this.cityListAllObject.endTime,
"is_lead": this.cityListAlltSearchFlagObject.is_lead,
"dep_id": this.cityListAlltSearchFlagObject.dutyDepSelect,
"key_name": this.cityListAlltSearchFlagObject.key_name,
"type_id": this.cityListAlltSearchFlagObject.dutyType,
"watchhour_time": this.cityListAlltSearchFlagObject.dutyHourTime,
"campus_id": this.cityListAlltSearchFlagObject.dutyCampus,
// dutyCampus:'',
}
const res = await api.GetWatchList(data)
this.data = res.response.data
this.total = res.response.data_count
this.tableLoading = false
})
},
currentPage(e) {
console.log(e)
......@@ -968,16 +968,6 @@
//生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染
mounted() {
// 默认查询当前月条件初始化
let nowDate = new Date()
let startTime = dayjs(nowDate).format('YYYY-MM-') + dayjs(nowDate).startOf('month').format('DD')
let endTime = dayjs(nowDate).format('YYYY-MM-') + dayjs(nowDate).endOf('month').format('DD')
this.cityListAllObject.startTimeFlag = startTime
this.cityListAllObject.endtTimeFlag = endTime
this.cityListAlltSearchFlagObject.startTimeSearch = startTime
this.cityListAlltSearchFlagObject.endTimeSearch = endTime
this.dutyDateX = [new Date(startTime), new Date(endTime)]
this.addDutySearchSelectList()
this.getWatchList() // 初始化值班列表
this.getSearchSelectList() // 初始化搜索select
......
......@@ -40,7 +40,7 @@
<div style="display: flex; justify-content: center;align-items: center">
<span>值班日期:&nbsp;</span>
<DatePicker v-model="dutyDateX" type="daterange" @on-change="signDateSelect" placeholder="请选择值班日期"
<DatePicker type="daterange" @on-change="signDateSelect" placeholder="请选择值班日期"
style="width: 10vw"/>
</div>
</Col>
......@@ -83,7 +83,7 @@
</ButtonGroup>
</template>
<Table :columns="column" :data="data" :height="tableHeightCal" :loading="loading" @on-select="radioSelection"
<Table :columns="column" :data="data" :loading="loading" @on-select="radioSelection"
@on-select-cancel="cancelSelection"
@on-select-all="allSelection" @on-select-all-cancel="cancelSelectionAll">
<template #sign_set="{row}">
......@@ -134,7 +134,6 @@
show-elevator
:total="total"
:page-size="page_size"
:page-size-opts="[100, 200, 500, 1000]"
model-value="page_index"
@on-change="currentPage"
@on-page-size-change="currentPageCount"
......@@ -194,7 +193,7 @@
//例如:import 《组件名称》 from '《组件路径》';
import * as api from '../../api/lezRequest'
import error from "@/plugins/error";
import dayjs from 'dayjs'
import * as hooks from "../../hooks/index"
export default {
//import引入的组件需要注入到对象中才能使用",
......@@ -265,7 +264,7 @@
},
page_index: 1,
page_size: 100,
page_size: 10,
total: 0,
column: [
{
......@@ -315,18 +314,10 @@
}
],
data: [],
// 默认查询条件值班日期
dutyDateX: [],
};
},
//监听属性 类似于data概念",
computed: {
// table高度计算
tableHeightCal() {
return document.documentElement.clientHeight - 360
},
},
computed: {},
//监控data中的数据变化",
watch: {
// signArray(newValue ,oldValue){
......@@ -394,13 +385,16 @@
},
signInOrSignOut(e, value) {
console.log("🚀🚀🚀,", e)
this.publicConfirm(async () => {
let data = [{
signid: e.signid,
sign: value,
}]
const res = await api.SignInOrOut(data)
this.GetSignRecordList()
this.publicConfirm(() => {
hooks.myEncapsulationFunction(async () => {
let data = [{
signid: e.signid,
sign: value,
}]
const res = await api.SignInOrOut(data)
await this.GetSignRecordList()
return res
})
})
},
......@@ -437,7 +431,7 @@
signDataInputDateSelect(e) {
this.signyDataInputObject.watch_date = e[0] + '-' + e[1]
this.signyDataInputObject.startTime = e[0]
this.signyDataInputObject.endTime = e[1]
this.signyDataInputObject.startTime = e[1]
console.log("🚀🚀🚀,")
},
signCancel() {
......@@ -463,18 +457,21 @@
})
},
logOk() {
this.$refs['formValidate'].validate(async (validate) => {
this.$refs['formValidate'].validate((validate) => {
if (validate) {
this.buttonLoding = true
const data = {
"signId": this.formValidate.signid,
"content": this.formValidate.content
}
const res = await api.SignLogSave(data)
this.logModal = false
this.GetSignRecordList()
// this.publicMessage(res)
this.buttonLoding = false
hooks.myEncapsulationFunction(async () => {
this.buttonLoding = true
const data = {
"signId": this.formValidate.signid,
"content": this.formValidate.content
}
const res = await api.SignLogSave(data)
this.logModal = false
await this.GetSignRecordList()
// this.publicMessage(res)
this.buttonLoding = false
return res
})
}
})
},
......@@ -517,30 +514,27 @@
},
async GetSignRecordList() {
this.loading = true
let data = {
"dep_id": this.selectObject.dept_idSearch,
"key_name": this.selectObject.key_nameSearch,
"start_time": this.selectObject.startTimeSearch === '' ? this.selectObject.startTime : this.selectObject.startTimeSearch,
"end_time": this.selectObject.endTimeSearch === '' ? this.selectObject.endTime : this.selectObject.endTimeSearch,
"type_id": this.selectObject.watchtypeidSearch,
"watchhour_time": this.selectObject.watch_hour_idSearch,
"page_index": this.page_index,
"page_size": this.page_size,
"campus_id": this.selectObject.campusidSearch,
}
const res = await api.GetSignRecordList(data)
res.response.data.forEach((currentValue, index) => {
console.log("🚀🚀🚀,", currentValue)
currentValue._disabled = currentValue.sign === 2 || currentValue.sign_set === 1
hooks.getInitListRequest(async () => {
this.loading = true
let data = {
"dep_id": this.selectObject.dept_idSearch,
"key_name": this.selectObject.key_nameSearch,
"start_time": this.selectObject.startTimeSearch === '' ? this.selectObject.startTime : this.selectObject.startTimeSearch,
"end_time": this.selectObject.endTimeSearch === '' ? this.selectObject.endTime : this.selectObject.endTimeSearch,
"type_id": this.selectObject.watchtypeidSearch,
"watchhour_time": this.selectObject.watch_hour_idSearch,
"page_index": this.page_index,
"page_size": this.page_size,
"campus_id": this.selectObject.campusidSearch,
}
const res = await api.GetSignRecordList(data)
res.response.data.forEach((currentValue, index) => {
currentValue._disabled = currentValue.sign === 2 || currentValue.sign_set === 1
})
this.data = res.response.data
this.total = res.response.data_count
this.loading = false
})
this.data = res.response.data
this.total = res.response.data_count
this.publicMessage(res)
this.loading = false
console.log("🚀🚀🚀,", res)
},
addDutySearchSelectList() {
Promise.all([
......@@ -633,18 +627,6 @@
//生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染
mounted() {
// 默认查询当前月条件初始化
let nowDate = new Date()
let startTime = dayjs(nowDate).format('YYYY-MM-') + dayjs(nowDate).startOf('month').format('DD')
let endTime = dayjs(nowDate).format('YYYY-MM-') + dayjs(nowDate).endOf('month').format('DD')
this.signyDataInputObject.startTime = startTime
this.signyDataInputObject.endTime = endTime
this.selectObject.startTimeSearch = startTime
this.selectObject.endTimeSearch = endTime
this.selectObject.startTime = startTime
this.selectObject.endTime = endTime
this.dutyDateX = [new Date(startTime), new Date(endTime)]
this.GetSignRecordList() // 初始化
this.addDutySearchSelectList() // 获取四个select
this.addDutySearchSelectList1() // 获取四个select
......
<template>
<div>
<Card>
<template #title >
<template #title>
<div style="height: 30px;display: flex;align-items: center;">
<h3 >操作日志</h3>
<h3>操作日志</h3>
</div>
</template>
<!-- <template #extra>-->
<!-- <div style="display: flex;flex-wrap: nowrap;align-items: center; ">-->
<!-- <Input v-model="searchValue" placeholder="请输入权限名称进行查找..."></Input>-->
<!-- <Button type="primary" :disabled="searchValue === ''" @click="searchEvent" style="margin-left: 10px;">查找</Button>-->
<!-- <Button type="primary" @click="addRoleClass" style="margin-left: 10px;">增添用户权限</Button>-->
<!-- </div>-->
<!-- <template #extra>-->
<!-- <div style="display: flex;flex-wrap: nowrap;align-items: center; ">-->
<!-- <Input v-model="searchValue" placeholder="请输入权限名称进行查找..."></Input>-->
<!-- <Button type="primary" :disabled="searchValue === ''" @click="searchEvent" style="margin-left: 10px;">查找</Button>-->
<!-- <Button type="primary" @click="addRoleClass" style="margin-left: 10px;">增添用户权限</Button>-->
<!-- </div>-->
<!-- </template>-->
<!-- </template>-->
<Table :columns="columns" :data="data">
<!-- <template #role_name="{row}">-->
<!-- <span v-for="(item,index) in row.role_name" :key="index" style="margin-left: 5px"> <Tag color="success">{{item}}</Tag></span>-->
<!-- </template>-->
<!-- <template #action="{row}">-->
<!-- &lt;!&ndash; <Button type="primary" size="small" @click="update(row)">修改</Button>&ndash;&gt;-->
<!-- <Button type="primary" size="small" @click="roleDelete(row)" style="margin-left: 10px;">删除</Button>-->
<!-- <Modal-->
<!-- v-model="modal"-->
<!-- :title="`${ModalTitleValue}`"-->
<!-- @on-ok="modalOk(row)"-->
<!-- cancel-text="取消"-->
<!-- ok-text="确认"-->
<!-- :mask-closable="false"-->
<!-- >-->
<!-- <Form :model="formTop" :label-width="80" ref="updateRoleValue" >-->
<!-- &lt;!&ndash; :rules="ruleValidate"&ndash;&gt;-->
<!-- &lt;!&ndash; <FormItem label="权限名称" prop="input1" >&ndash;&gt;-->
<!-- &lt;!&ndash; <Input v-model="formTop.input1"></Input>&ndash;&gt;-->
<!-- &lt;!&ndash; </FormItem>&ndash;&gt;-->
<!-- <FormItem label="选择教师" prop="input2" >-->
<!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">-->
<!-- <Option v-for="item in cityTeacherList" :value="item.id" :key="item.id" >{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
<!-- <FormItem label="选择权限" prop="input2" >-->
<!-- <Select v-model="roleSelectCurrentValue" multiple >-->
<!-- <Option v-for="item in cityRoleList" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
<!-- </Form>-->
<!-- </Modal>-->
<!-- </template>-->
<!-- <template #role_name="{row}">-->
<!-- <span v-for="(item,index) in row.role_name" :key="index" style="margin-left: 5px"> <Tag color="success">{{item}}</Tag></span>-->
<!-- </template>-->
<!-- <template #action="{row}">-->
<!-- &lt;!&ndash; <Button type="primary" size="small" @click="update(row)">修改</Button>&ndash;&gt;-->
<!-- <Button type="primary" size="small" @click="roleDelete(row)" style="margin-left: 10px;">删除</Button>-->
<!-- <Modal-->
<!-- v-model="modal"-->
<!-- :title="`${ModalTitleValue}`"-->
<!-- @on-ok="modalOk(row)"-->
<!-- cancel-text="取消"-->
<!-- ok-text="确认"-->
<!-- :mask-closable="false"-->
<!-- >-->
<!-- <Form :model="formTop" :label-width="80" ref="updateRoleValue" >-->
<!-- &lt;!&ndash; :rules="ruleValidate"&ndash;&gt;-->
<!-- &lt;!&ndash; <FormItem label="权限名称" prop="input1" >&ndash;&gt;-->
<!-- &lt;!&ndash; <Input v-model="formTop.input1"></Input>&ndash;&gt;-->
<!-- &lt;!&ndash; </FormItem>&ndash;&gt;-->
<!-- <FormItem label="选择教师" prop="input2" >-->
<!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">-->
<!-- <Option v-for="item in cityTeacherList" :value="item.id" :key="item.id" >{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
<!-- <FormItem label="选择权限" prop="input2" >-->
<!-- <Select v-model="roleSelectCurrentValue" multiple >-->
<!-- <Option v-for="item in cityRoleList" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
<!-- </Form>-->
<!-- </Modal>-->
<!-- </template>-->
</Table>
<div style="width: 100%;height: 70px;display: flex;align-items: center;">
<Page show-total
......@@ -73,86 +73,80 @@
//例如:import 《组件名称》 from '《组件路径》';
import * as api from '../../api/lezRequest'
import Vue from "vue";
import * as hooks from '@/hooks/index'
export default {
//import引入的组件需要注入到对象中才能使用",
components: {
},
components: {},
data() {
//这里存放数据",
return {
total:null,
page_size:10,
page_index:1,
total: null,
page_size: 10,
page_index: 1,
columns:[
columns: [
{
title:'操作时间',
key:'createtime',
minWidth:150,
align:'center'
title: '操作时间',
key: 'createtime',
minWidth: 150,
align: 'center'
},
{
title: '姓名',
key: 'user_name',
minWidth: 150,
align:'center'
align: 'center'
},
{
title: '工号',
key: 'user_id',
minWidth: 150,
align:'center'
align: 'center'
},
{
title: '操作内容',
key: 'type',
minWidth: 150,
align:'center'
align: 'center'
},
{
title: 'IP地址',
key: 'ip',
minWidth: 150,
align:'center'
align: 'center'
},
],
data:[]
data: []
};
},
//监听属性 类似于data概念",
computed: {
},
computed: {},
//监控data中的数据变化",
watch: {
},
watch: {},
//方法集合",
methods: {
currentPage(e){
currentPage(e) {
this.page_index = e
this.GetLogAll()
},
currentPageCount(e){
currentPageCount(e) {
this.page_size = e
this.GetLogAll()
},
publicConfirm(publicFunction){
publicConfirm(publicFunction) {
// 公共弹窗删除
this.$Modal.confirm({
title: '警告',
content: '<p>是否继续此操作?</p>',
cancelText:"取消",
okText:'确定',
cancelText: "取消",
okText: '确定',
onOk: async () => {
// 接收需执行的方法
await publicFunction()
......@@ -161,14 +155,14 @@
}
});
},
publicMessage(res){ // 弹窗封装
if(res.code !== 1){
publicMessage(res) { // 弹窗封装
if (res.code !== 1) {
this.$Message['warning']({
background: true,
content: '操作异常'
});
}else{
} else {
this.$Spin.hide();
this.$Message['success']({
background: true,
......@@ -186,7 +180,7 @@
const res = await api.GetLogAll(data)
this.total = res.response.data_count
this.data= res.response.data
this.data = res.response.data
this.publicMessage(res)
this.$Spin.hide()
}
......@@ -234,11 +228,10 @@
}
</script>
<style scoped>
.columnsItemMinWidth{
.columnsItemMinWidth {
min-width: 1000px;
}
</style>
......@@ -15,37 +15,12 @@
<!-- </div>-->
<!-- </template>-->
<Table :columns="columns" :data="data">
<Table :columns="columns" :data="data" :loading="loading">
<template #action="{row}">
<Button type="primary" size="small" @click="update(row)">修改</Button>
<Button type="error" size="small" @click="Delete(row)" style="margin-left: 10px;">删除</Button>
<Modal
v-model="modal"
title="配置校区"
@on-ok="modalOk(row)"
cancel-text="取消"
ok-text="确认"
:mask-closable="false"
>
<Form :model="formTop" :label-width="80" ref="updateRoleValue">
<!-- :rules="ruleValidate"-->
<FormItem label="配置校区" prop="input1">
<Input v-model="formTop.input1"></Input>
</FormItem>
<!-- <FormItem label="选择教师" prop="input2" >-->
<!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">-->
<!-- <Option v-for="item in cityTeacherList" :value="item.id" :key="item.id" >{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
<!-- <FormItem label="选择权限" prop="input2" >-->
<!-- <Select v-model="roleSelectCurrentValue" multiple >-->
<!-- <Option v-for="item in cityRoleList" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
</Form>
</Modal>
</template>
</Table>
<div style="width: 100%;height: 70px;display: flex;align-items: center;">
......@@ -61,11 +36,37 @@
/>
</div>
<!-- <Spin fix :show="spinShow"/>-->
<Modal
v-model="modal"
title="配置校区"
@on-ok="modalOk"
cancel-text="取消"
ok-text="确认"
:mask-closable="false"
>
<Form :model="formTop" :label-width="80" ref="updateRoleValue">
<!-- :rules="ruleValidate"-->
<FormItem label="配置校区" prop="input1">
<Input v-model="formTop.input1"></Input>
</FormItem>
<!-- <FormItem label="选择教师" prop="input2" >-->
<!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">-->
<!-- <Option v-for="item in cityTeacherList" :value="item.id" :key="item.id" >{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
<!-- <FormItem label="选择权限" prop="input2" >-->
<!-- <Select v-model="roleSelectCurrentValue" multiple >-->
<!-- <Option v-for="item in cityRoleList" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
</Form>
</Modal>
</div>
</template>
<script>
import * as hooks from '../../../../hooks/index'
import * as api from '../../../../api/lezRequest'
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
//例如:import 《组件名称》 from '《组件路径》';
......@@ -77,6 +78,7 @@
data() {
//这里存放数据",
return {
loading: false,
spinShow: false,
modal: false,
formTop: {
......@@ -148,26 +150,32 @@
},
//方法集合"
methods: {
async modalOk() {
let data = {
"campusid": this.formTop.id,
"campusname": this.formTop.input1,
}
const res = await api.CampusSave(data)
if (res.code === 1) await this.GetCampusList()
modalOk() {
hooks.myEncapsulationFunction(async () => {
let data = {
"campusid": this.formTop.id,
"campusname": this.formTop.input1,
}
const res = await api.CampusSave(data)
if (res.code === 1) await this.GetCampusList()
return res
})
},
update(e) {
console.log(e)
this.formTop.id = e.campusid;
this.formTop.input1 = e.campusname;
this.modal = true
},
async DeleteAction() {
let data = {
"campusid": this.formTop.id
}
const res = await api.CampusDel(data)
this.GetCampusList()
DeleteAction() {
hooks.myEncapsulationFunction(async () => {
let data = {
"campusid": this.formTop.id
}
const res = await api.CampusDel(data)
this.GetCampusList()
return res
})
},
Delete(e) {
this.formTop.id = e.campusid
......@@ -219,17 +227,20 @@
}
},
async GetCampusList() {
this.$Spin.show();
let data = {
name: this.searchValue,
page_size: this.page_size,
page_index: this.page_index,
}
const res = await api.GetCampusList(data)
this.data = res.response.data
this.total = res.response.data_count
this.publicMessage(res)
GetCampusList() {
hooks.getInitListRequest(async () => {
this.loading = true
let data = {
name: this.searchValue,
page_size: this.page_size,
page_index: this.page_index,
}
const res = await api.GetCampusList(data)
this.data = res.response.data
this.total = res.response.data_count
this.loading = false
})
}
},
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
......@@ -15,48 +15,16 @@
<!-- </div>-->
<!-- </template>-->
<Table :columns="columns" :data="data">
<Table :columns="columns" :data="data" :loading="loading">
<template #advance_day="{row}">
{{ row.advance_day }}天
</template>
<template #action="{row}">
<Button type="primary" size="small" @click="update(row)">修改</Button>
<Modal
v-model="modal"
title="值班类型"
@on-ok="modalOk(row)"
cancel-text="取消"
ok-text="确认"
:mask-closable="false"
>
<Form :model="formTop" :label-width="80" ref="updateRoleValue">
<!-- :rules="ruleValidate"-->
<FormItem label="提前天数" prop="input1">
<InputNumber style="width: 100%;" :max="10" :min="1" v-model="formTop.input1"/>
</FormItem>
<FormItem label="提醒时间" prop="input2">
<TimePicker @on-change="getSelectTime" v-model="formTop.input2" format="HH:mm" placeholder="Select time"
style="width:100%;"/>
</FormItem>
<!-- <FormItem label="选择教师" prop="input2" >-->
<!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">-->
<!-- <Option v-for="item in cityTeacherList" :value="item.id" :key="item.id" >{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
<!-- <FormItem label="选择权限" prop="input2" >-->
<!-- <Select v-model="roleSelectCurrentValue" multiple >-->
<!-- <Option v-for="item in cityRoleList" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
</Form>
</Modal>
</template>
</Table>
<div style="width: 100%;height: 70px;display: flex;align-items: center;">
<Page show-total
show-sizer
show-elevator
:total="total"
......@@ -66,12 +34,42 @@
@on-page-size-change="currentPageCount"
/>
</div>
<Modal
v-model="modal"
title="值班类型"
@on-ok="modalOk"
cancel-text="取消"
ok-text="确认"
:mask-closable="false"
>
<Form :model="formTop" :label-width="80" ref="updateRoleValue">
<!-- :rules="ruleValidate"-->
<FormItem label="提前天数" prop="input1">
<InputNumber style="width: 100%;" :max="10" :min="1" v-model="formTop.input1"/>
</FormItem>
<FormItem label="提醒时间" prop="input2">
<TimePicker @on-change="getSelectTime" v-model="formTop.input2" format="HH:mm" placeholder="Select time"
style="width:100%;"/>
</FormItem>
<!-- <FormItem label="选择教师" prop="input2" >-->
<!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">-->
<!-- <Option v-for="item in cityTeacherList" :value="item.id" :key="item.id" >{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
<!-- <FormItem label="选择权限" prop="input2" >-->
<!-- <Select v-model="roleSelectCurrentValue" multiple >-->
<!-- <Option v-for="item in cityRoleList" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </FormItem>-->
</Form>
</Modal>
</div>
</template>
<script>
import * as hooks from '../../../../hooks/index'
import * as api from '../../../../api/lezRequest'
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
//例如:import 《组件名称》 from '《组件路径》';
......@@ -83,7 +81,7 @@
data() {
//这里存放数据",
return {
loading: false,
modal: false,
formTop: {
time_task_id: '',
......@@ -151,18 +149,20 @@
getSelectTime(e) {
this.formTop.input2 = e
},
async modalOk() {
let data = {
"megconfigid": this.formTop.id,
"advance_day": this.formTop.input1,
"remind_time": this.formTop.input2,
"time_task_id": this.formTop.time_task_id
}
const res = await api.GetMessageConfigSave(data)
await this.GetMessageConfigInfo()
modalOk() {
hooks.myEncapsulationFunction(async () => {
let data = {
"megconfigid": this.formTop.id,
"advance_day": this.formTop.input1,
"remind_time": this.formTop.input2,
"time_task_id": this.formTop.time_task_id
}
const res = await api.GetMessageConfigSave(data)
await this.GetMessageConfigInfo()
return res
})
},
update(e) {
console.log(e)
this.formTop.id = e.megconfigid;
this.formTop.input1 = e.advance_day;
this.formTop.input2 = e.remind_time
......@@ -226,11 +226,14 @@
}
},
async GetMessageConfigInfo(searchValue = '') {
this.$Spin.show();
this.data = []
const res = await api.GetMessageConfigInfo()
this.data.push(res.response)
this.publicMessage(res)
hooks.getInitListRequest(async () => {
this.loading = true
this.data = []
const res = await api.GetMessageConfigInfo()
this.data.push(res.response)
this.loading = false
})
}
},
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或