提交 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 @@ ...@@ -41,7 +41,7 @@
<div style="display: flex; justify-content: center;align-items: center"> <div style="display: flex; justify-content: center;align-items: center">
<span>值班日期:&nbsp;</span> <span>值班日期:&nbsp;</span>
<DatePicker v-model="dutyDateX" type="daterange" @on-change="dutyDateSelect" placeholder="请选择值班日期" <DatePicker type="daterange" @on-change="dutyDateSelect" placeholder="请选择值班日期"
style="width: 10vw"/> style="width: 10vw"/>
</div> </div>
</Col> </Col>
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
</div> </div>
</template> </template>
<Table <Table
:loading="tableLoading"
:columns="columns" :columns="columns"
:data="data" :data="data"
:height="tableHeightCal"
@on-select="onSelect" @on-select="onSelect"
@on-select-cancel="onSelectCancel" @on-select-cancel="onSelectCancel"
@on-select-all="onSelectAll" @on-select-all="onSelectAll"
...@@ -270,7 +270,8 @@ ...@@ -270,7 +270,8 @@
:mask-closable="false" :mask-closable="false"
title="模板导出" title="模板导出"
@on-ok="exportTemplate"> @on-ok="exportTemplate">
<span>模板年月:</span><DatePicker v-model="tempYearMonth" type="month" format="yyyy-MM" placeholder=""/> <span>模板年月:</span>
<DatePicker v-model="tempYearMonth" type="month" format="yyyy-MM" placeholder=""/>
</Modal> </Modal>
</div> </div>
</template> </template>
...@@ -283,6 +284,7 @@ ...@@ -283,6 +284,7 @@
import util from '@/libs/util'; import util from '@/libs/util';
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import dayjs from 'dayjs' import dayjs from 'dayjs'
import * as hooks from "../../hooks/index"
export default { export default {
//import引入的组件需要注入到对象中才能使用", //import引入的组件需要注入到对象中才能使用",
...@@ -290,6 +292,7 @@ ...@@ -290,6 +292,7 @@
data() { data() {
//这里存放数据", //这里存放数据",
return { return {
tableLoading: false,
fileUploadFlag: false, fileUploadFlag: false,
loadingStatus: false, loadingStatus: false,
file: null, file: null,
...@@ -513,18 +516,10 @@ ...@@ -513,18 +516,10 @@
exportModalShow: false, exportModalShow: false,
// 模板导出选择年月 // 模板导出选择年月
tempYearMonth: '', tempYearMonth: '',
// 默认查询条件值班日期
dutyDateX: [],
}; };
}, },
//监听属性 类似于data概念", //监听属性 类似于data概念",
computed: { computed: {
// table高度计算
tableHeightCal() {
return document.documentElement.clientHeight - 360
},
util() { util() {
return util return util
} }
...@@ -659,11 +654,15 @@ ...@@ -659,11 +654,15 @@
this.updateDutyModal = false this.updateDutyModal = false
}, },
updateOK() { updateOK() {
this.$refs['updateDutyFrom'].validate(async (validate) => { this.$refs['updateDutyFrom'].validate((validate) => {
if (validate) { if (validate) {
hooks.myEncapsulationFunction(async () => {
let date = this.updateDutyFrom let date = this.updateDutyFrom
const res = await api.WatchSave(date) const res = await api.WatchSave(date)
this.getWatchList() this.getWatchList()
this.updateDutyModal = false
return res
})
} }
}) })
}, },
...@@ -707,7 +706,7 @@ ...@@ -707,7 +706,7 @@
content: '是否确认推送?', content: '是否确认推送?',
loading: true, loading: true,
onOk: () => { onOk: () => {
this.pushM(this.pushListSlc).then(() =>{ this.pushM(this.pushListSlc).then(() => {
this.$Modal.remove() this.$Modal.remove()
this.getWatchList() this.getWatchList()
}) })
...@@ -733,7 +732,7 @@ ...@@ -733,7 +732,7 @@
return new Promise(resolve => { return new Promise(resolve => {
api.WatchSendMeg(data).then(res => { api.WatchSendMeg(data).then(res => {
// console.log('推送行res', res) // console.log('推送行res', res)
if (res. code == 1) { if (res.code == 1) {
this.$Message.success({ this.$Message.success({
content: res.msg, content: res.msg,
background: true background: true
...@@ -755,12 +754,15 @@ ...@@ -755,12 +754,15 @@
this.updateDutyModal = true this.updateDutyModal = true
}, },
deleteDuty(e) { deleteDuty(e) {
this.publicConfirm(async () => { this.publicConfirm(() => {
hooks.myEncapsulationFunction(async () => {
const data = { const data = {
id: e.watchid id: e.watchid
} }
const res = await api.WatchDel(data) const res = await api.WatchDel(data)
this.getWatchList() this.getWatchList()
return res
})
}) })
}, },
async search() { async search() {
...@@ -784,12 +786,14 @@ ...@@ -784,12 +786,14 @@
}, },
asyncOK() { asyncOK() {
let data = _.cloneDeep(this.formValidate) let data = _.cloneDeep(this.formValidate)
this.$refs['formValidate'].validate((validate) => {
this.$refs['formValidate'].validate(async (validate) => {
if (validate) { if (validate) {
hooks.myEncapsulationFunction(async () => {
const res = await api.WatchCreate(data) const res = await api.WatchCreate(data)
await this.getWatchList() await this.getWatchList()
this.addDuty = false this.addDuty = false
return res
})
} }
}) })
}, },
...@@ -880,16 +884,14 @@ ...@@ -880,16 +884,14 @@
]) ])
.then(res => { .then(res => {
this.cityListAll = res this.cityListAll = res
console.log("🚀🚀🚀,", res)
}) })
}, },
async getWatchList() { async getWatchList() {
// let a =new Date().toLocaleDateString('cn',{hour12:false}).replace(/\//g, '-'); // let a =new Date().toLocaleDateString('cn',{hour12:false}).replace(/\//g, '-');
console.log("🚀🚀🚀,", this.initDateTime)//2018/12/6 hooks.getInitListRequest(async () => {
this.tableLoading = true
this.pushListSlc = [] this.pushListSlc = []
this.$Spin.show()
let data = { let data = {
"page_index": this.page_index, "page_index": this.page_index,
"page_size": this.page_size, "page_size": this.page_size,
"start_time": this.cityListAlltSearchFlagObject.startTimeSearch !== '' ? this.cityListAlltSearchFlagObject.startTimeSearch : this.cityListAllObject.startTime, "start_time": this.cityListAlltSearchFlagObject.startTimeSearch !== '' ? this.cityListAlltSearchFlagObject.startTimeSearch : this.cityListAllObject.startTime,
...@@ -901,14 +903,12 @@ ...@@ -901,14 +903,12 @@
"watchhour_time": this.cityListAlltSearchFlagObject.dutyHourTime, "watchhour_time": this.cityListAlltSearchFlagObject.dutyHourTime,
"campus_id": this.cityListAlltSearchFlagObject.dutyCampus, "campus_id": this.cityListAlltSearchFlagObject.dutyCampus,
// dutyCampus:'', // dutyCampus:'',
} }
const res = await api.GetWatchList(data) const res = await api.GetWatchList(data)
this.data = res.response.data this.data = res.response.data
this.total = res.response.data_count, this.total = res.response.data_count
this.$Spin.hide() this.tableLoading = false
this.publicMessage(res) })
console.log("🚀🚀🚀,", res)
}, },
currentPage(e) { currentPage(e) {
console.log(e) console.log(e)
...@@ -968,16 +968,6 @@ ...@@ -968,16 +968,6 @@
//生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染 //生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染
mounted() { 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.addDutySearchSelectList()
this.getWatchList() // 初始化值班列表 this.getWatchList() // 初始化值班列表
this.getSearchSelectList() // 初始化搜索select this.getSearchSelectList() // 初始化搜索select
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<div style="display: flex; justify-content: center;align-items: center"> <div style="display: flex; justify-content: center;align-items: center">
<span>值班日期:&nbsp;</span> <span>值班日期:&nbsp;</span>
<DatePicker v-model="dutyDateX" type="daterange" @on-change="signDateSelect" placeholder="请选择值班日期" <DatePicker type="daterange" @on-change="signDateSelect" placeholder="请选择值班日期"
style="width: 10vw"/> style="width: 10vw"/>
</div> </div>
</Col> </Col>
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</ButtonGroup> </ButtonGroup>
</template> </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-cancel="cancelSelection"
@on-select-all="allSelection" @on-select-all-cancel="cancelSelectionAll"> @on-select-all="allSelection" @on-select-all-cancel="cancelSelectionAll">
<template #sign_set="{row}"> <template #sign_set="{row}">
...@@ -134,7 +134,6 @@ ...@@ -134,7 +134,6 @@
show-elevator show-elevator
:total="total" :total="total"
:page-size="page_size" :page-size="page_size"
:page-size-opts="[100, 200, 500, 1000]"
model-value="page_index" model-value="page_index"
@on-change="currentPage" @on-change="currentPage"
@on-page-size-change="currentPageCount" @on-page-size-change="currentPageCount"
...@@ -194,7 +193,7 @@ ...@@ -194,7 +193,7 @@
//例如:import 《组件名称》 from '《组件路径》'; //例如:import 《组件名称》 from '《组件路径》';
import * as api from '../../api/lezRequest' import * as api from '../../api/lezRequest'
import error from "@/plugins/error"; import error from "@/plugins/error";
import dayjs from 'dayjs' import * as hooks from "../../hooks/index"
export default { export default {
//import引入的组件需要注入到对象中才能使用", //import引入的组件需要注入到对象中才能使用",
...@@ -265,7 +264,7 @@ ...@@ -265,7 +264,7 @@
}, },
page_index: 1, page_index: 1,
page_size: 100, page_size: 10,
total: 0, total: 0,
column: [ column: [
{ {
...@@ -315,18 +314,10 @@ ...@@ -315,18 +314,10 @@
} }
], ],
data: [], data: [],
// 默认查询条件值班日期
dutyDateX: [],
}; };
}, },
//监听属性 类似于data概念", //监听属性 类似于data概念",
computed: { computed: {},
// table高度计算
tableHeightCal() {
return document.documentElement.clientHeight - 360
},
},
//监控data中的数据变化", //监控data中的数据变化",
watch: { watch: {
// signArray(newValue ,oldValue){ // signArray(newValue ,oldValue){
...@@ -394,13 +385,16 @@ ...@@ -394,13 +385,16 @@
}, },
signInOrSignOut(e, value) { signInOrSignOut(e, value) {
console.log("🚀🚀🚀,", e) console.log("🚀🚀🚀,", e)
this.publicConfirm(async () => { this.publicConfirm(() => {
hooks.myEncapsulationFunction(async () => {
let data = [{ let data = [{
signid: e.signid, signid: e.signid,
sign: value, sign: value,
}] }]
const res = await api.SignInOrOut(data) const res = await api.SignInOrOut(data)
this.GetSignRecordList() await this.GetSignRecordList()
return res
})
}) })
}, },
...@@ -437,7 +431,7 @@ ...@@ -437,7 +431,7 @@
signDataInputDateSelect(e) { signDataInputDateSelect(e) {
this.signyDataInputObject.watch_date = e[0] + '-' + e[1] this.signyDataInputObject.watch_date = e[0] + '-' + e[1]
this.signyDataInputObject.startTime = e[0] this.signyDataInputObject.startTime = e[0]
this.signyDataInputObject.endTime = e[1] this.signyDataInputObject.startTime = e[1]
console.log("🚀🚀🚀,") console.log("🚀🚀🚀,")
}, },
signCancel() { signCancel() {
...@@ -463,8 +457,9 @@ ...@@ -463,8 +457,9 @@
}) })
}, },
logOk() { logOk() {
this.$refs['formValidate'].validate(async (validate) => { this.$refs['formValidate'].validate((validate) => {
if (validate) { if (validate) {
hooks.myEncapsulationFunction(async () => {
this.buttonLoding = true this.buttonLoding = true
const data = { const data = {
"signId": this.formValidate.signid, "signId": this.formValidate.signid,
...@@ -472,9 +467,11 @@ ...@@ -472,9 +467,11 @@
} }
const res = await api.SignLogSave(data) const res = await api.SignLogSave(data)
this.logModal = false this.logModal = false
this.GetSignRecordList() await this.GetSignRecordList()
// this.publicMessage(res) // this.publicMessage(res)
this.buttonLoding = false this.buttonLoding = false
return res
})
} }
}) })
}, },
...@@ -517,6 +514,7 @@ ...@@ -517,6 +514,7 @@
}, },
async GetSignRecordList() { async GetSignRecordList() {
hooks.getInitListRequest(async () => {
this.loading = true this.loading = true
let data = { let data = {
"dep_id": this.selectObject.dept_idSearch, "dep_id": this.selectObject.dept_idSearch,
...@@ -531,16 +529,12 @@ ...@@ -531,16 +529,12 @@
} }
const res = await api.GetSignRecordList(data) const res = await api.GetSignRecordList(data)
res.response.data.forEach((currentValue, index) => { res.response.data.forEach((currentValue, index) => {
console.log("🚀🚀🚀,", currentValue)
currentValue._disabled = currentValue.sign === 2 || currentValue.sign_set === 1 currentValue._disabled = currentValue.sign === 2 || currentValue.sign_set === 1
}) })
this.data = res.response.data this.data = res.response.data
this.total = res.response.data_count this.total = res.response.data_count
this.publicMessage(res)
this.loading = false this.loading = false
})
console.log("🚀🚀🚀,", res)
}, },
addDutySearchSelectList() { addDutySearchSelectList() {
Promise.all([ Promise.all([
...@@ -633,18 +627,6 @@ ...@@ -633,18 +627,6 @@
//生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染 //生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染
mounted() { 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.GetSignRecordList() // 初始化
this.addDutySearchSelectList() // 获取四个select this.addDutySearchSelectList() // 获取四个select
this.addDutySearchSelectList1() // 获取四个select this.addDutySearchSelectList1() // 获取四个select
......
<template> <template>
<div> <div>
<Card> <Card>
<template #title > <template #title>
<div style="height: 30px;display: flex;align-items: center;"> <div style="height: 30px;display: flex;align-items: center;">
<h3 >操作日志</h3> <h3>操作日志</h3>
</div> </div>
</template> </template>
<!-- <template #extra>--> <!-- <template #extra>-->
<!-- <div style="display: flex;flex-wrap: nowrap;align-items: center; ">--> <!-- <div style="display: flex;flex-wrap: nowrap;align-items: center; ">-->
<!-- <Input v-model="searchValue" placeholder="请输入权限名称进行查找..."></Input>--> <!-- <Input v-model="searchValue" placeholder="请输入权限名称进行查找..."></Input>-->
<!-- <Button type="primary" :disabled="searchValue === ''" @click="searchEvent" style="margin-left: 10px;">查找</Button>--> <!-- <Button type="primary" :disabled="searchValue === ''" @click="searchEvent" style="margin-left: 10px;">查找</Button>-->
<!-- <Button type="primary" @click="addRoleClass" style="margin-left: 10px;">增添用户权限</Button>--> <!-- <Button type="primary" @click="addRoleClass" style="margin-left: 10px;">增添用户权限</Button>-->
<!-- </div>--> <!-- </div>-->
<!-- </template>--> <!-- </template>-->
<Table :columns="columns" :data="data"> <Table :columns="columns" :data="data">
<!-- <template #role_name="{row}">--> <!-- <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>--> <!-- <span v-for="(item,index) in row.role_name" :key="index" style="margin-left: 5px"> <Tag color="success">{{item}}</Tag></span>-->
<!-- </template>--> <!-- </template>-->
<!-- <template #action="{row}">--> <!-- <template #action="{row}">-->
<!-- &lt;!&ndash; <Button type="primary" size="small" @click="update(row)">修改</Button>&ndash;&gt;--> <!-- &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>--> <!-- <Button type="primary" size="small" @click="roleDelete(row)" style="margin-left: 10px;">删除</Button>-->
<!-- <Modal--> <!-- <Modal-->
<!-- v-model="modal"--> <!-- v-model="modal"-->
<!-- :title="`${ModalTitleValue}`"--> <!-- :title="`${ModalTitleValue}`"-->
<!-- @on-ok="modalOk(row)"--> <!-- @on-ok="modalOk(row)"-->
<!-- cancel-text="取消"--> <!-- cancel-text="取消"-->
<!-- ok-text="确认"--> <!-- ok-text="确认"-->
<!-- :mask-closable="false"--> <!-- :mask-closable="false"-->
<!-- >--> <!-- >-->
<!-- <Form :model="formTop" :label-width="80" ref="updateRoleValue" >--> <!-- <Form :model="formTop" :label-width="80" ref="updateRoleValue" >-->
<!-- &lt;!&ndash; :rules="ruleValidate"&ndash;&gt;--> <!-- &lt;!&ndash; :rules="ruleValidate"&ndash;&gt;-->
<!-- &lt;!&ndash; <FormItem label="权限名称" prop="input1" >&ndash;&gt;--> <!-- &lt;!&ndash; <FormItem label="权限名称" prop="input1" >&ndash;&gt;-->
<!-- &lt;!&ndash; <Input v-model="formTop.input1"></Input>&ndash;&gt;--> <!-- &lt;!&ndash; <Input v-model="formTop.input1"></Input>&ndash;&gt;-->
<!-- &lt;!&ndash; </FormItem>&ndash;&gt;--> <!-- &lt;!&ndash; </FormItem>&ndash;&gt;-->
<!-- <FormItem label="选择教师" prop="input2" >--> <!-- <FormItem label="选择教师" prop="input2" >-->
<!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">--> <!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">-->
<!-- <Option v-for="item in cityTeacherList" :value="item.id" :key="item.id" >{{ item.name }}</Option>--> <!-- <Option v-for="item in cityTeacherList" :value="item.id" :key="item.id" >{{ item.name }}</Option>-->
<!-- </Select>--> <!-- </Select>-->
<!-- </FormItem>--> <!-- </FormItem>-->
<!-- <FormItem label="选择权限" prop="input2" >--> <!-- <FormItem label="选择权限" prop="input2" >-->
<!-- <Select v-model="roleSelectCurrentValue" multiple >--> <!-- <Select v-model="roleSelectCurrentValue" multiple >-->
<!-- <Option v-for="item in cityRoleList" :value="item.id" :key="item.id">{{ item.name }}</Option>--> <!-- <Option v-for="item in cityRoleList" :value="item.id" :key="item.id">{{ item.name }}</Option>-->
<!-- </Select>--> <!-- </Select>-->
<!-- </FormItem>--> <!-- </FormItem>-->
<!-- </Form>--> <!-- </Form>-->
<!-- </Modal>--> <!-- </Modal>-->
<!-- </template>--> <!-- </template>-->
</Table> </Table>
<div style="width: 100%;height: 70px;display: flex;align-items: center;"> <div style="width: 100%;height: 70px;display: flex;align-items: center;">
<Page show-total <Page show-total
...@@ -73,86 +73,80 @@ ...@@ -73,86 +73,80 @@
//例如:import 《组件名称》 from '《组件路径》'; //例如:import 《组件名称》 from '《组件路径》';
import * as api from '../../api/lezRequest' import * as api from '../../api/lezRequest'
import Vue from "vue"; import Vue from "vue";
import * as hooks from '@/hooks/index'
export default { export default {
//import引入的组件需要注入到对象中才能使用", //import引入的组件需要注入到对象中才能使用",
components: { components: {},
},
data() { data() {
//这里存放数据", //这里存放数据",
return { return {
total:null, total: null,
page_size:10, page_size: 10,
page_index:1, page_index: 1,
columns:[ columns: [
{ {
title:'操作时间', title: '操作时间',
key:'createtime', key: 'createtime',
minWidth:150, minWidth: 150,
align:'center' align: 'center'
}, },
{ {
title: '姓名', title: '姓名',
key: 'user_name', key: 'user_name',
minWidth: 150, minWidth: 150,
align:'center' align: 'center'
}, },
{ {
title: '工号', title: '工号',
key: 'user_id', key: 'user_id',
minWidth: 150, minWidth: 150,
align:'center' align: 'center'
}, },
{ {
title: '操作内容', title: '操作内容',
key: 'type', key: 'type',
minWidth: 150, minWidth: 150,
align:'center' align: 'center'
}, },
{ {
title: 'IP地址', title: 'IP地址',
key: 'ip', key: 'ip',
minWidth: 150, minWidth: 150,
align:'center' align: 'center'
}, },
], ],
data:[] data: []
}; };
}, },
//监听属性 类似于data概念", //监听属性 类似于data概念",
computed: { computed: {},
},
//监控data中的数据变化", //监控data中的数据变化",
watch: { watch: {},
},
//方法集合", //方法集合",
methods: { methods: {
currentPage(e){ currentPage(e) {
this.page_index = e this.page_index = e
this.GetLogAll() this.GetLogAll()
}, },
currentPageCount(e){ currentPageCount(e) {
this.page_size = e this.page_size = e
this.GetLogAll() this.GetLogAll()
}, },
publicConfirm(publicFunction){ publicConfirm(publicFunction) {
// 公共弹窗删除 // 公共弹窗删除
this.$Modal.confirm({ this.$Modal.confirm({
title: '警告', title: '警告',
content: '<p>是否继续此操作?</p>', content: '<p>是否继续此操作?</p>',
cancelText:"取消", cancelText: "取消",
okText:'确定', okText: '确定',
onOk: async () => { onOk: async () => {
// 接收需执行的方法 // 接收需执行的方法
await publicFunction() await publicFunction()
...@@ -161,14 +155,14 @@ ...@@ -161,14 +155,14 @@
} }
}); });
}, },
publicMessage(res){ // 弹窗封装 publicMessage(res) { // 弹窗封装
if(res.code !== 1){ if (res.code !== 1) {
this.$Message['warning']({ this.$Message['warning']({
background: true, background: true,
content: '操作异常' content: '操作异常'
}); });
}else{ } else {
this.$Spin.hide(); this.$Spin.hide();
this.$Message['success']({ this.$Message['success']({
background: true, background: true,
...@@ -186,7 +180,7 @@ ...@@ -186,7 +180,7 @@
const res = await api.GetLogAll(data) const res = await api.GetLogAll(data)
this.total = res.response.data_count this.total = res.response.data_count
this.data= res.response.data this.data = res.response.data
this.publicMessage(res) this.publicMessage(res)
this.$Spin.hide() this.$Spin.hide()
} }
...@@ -234,11 +228,10 @@ ...@@ -234,11 +228,10 @@
} }
</script> </script>
<style scoped> <style scoped>
.columnsItemMinWidth{ .columnsItemMinWidth {
min-width: 1000px; min-width: 1000px;
} }
</style> </style>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!-- 考勤管理 --> <!-- 考勤管理 -->
<div> <div>
<!-- table列表 --> <!-- table列表 -->
<Table :columns="tableColumns" :data="tableData"> <Table :columns="tableColumns" :data="tableData" :loading="loading1">
<template #action="{ row }"> <template #action="{ row }">
<!-- <a @click="rowEdit(row)">编辑</a> <!-- <a @click="rowEdit(row)">编辑</a>
<Divider type="vertical"/> --> <Divider type="vertical"/> -->
...@@ -69,21 +69,23 @@ ...@@ -69,21 +69,23 @@
</template> </template>
<script> <script>
import * as api from '@/api/lezRequest' import * as api from '@/api/lezRequest'
import * as hooks from '@/hooks/index'
export default { export default {
data() { data() {
return { return {
loading1: false,
tableColumns: [ tableColumns: [
{ title: '序号', type: 'index', width: 80, align: 'center' }, {title: '序号', type: 'index', width: 80, align: 'center'},
{ title: '标题', key: 'title' }, {title: '标题', key: 'title'},
{ title: '地址', key: 'address' }, {title: '地址', key: 'address'},
{ title: '纬度', key: 'latitude' }, {title: '纬度', key: 'latitude'},
{ title: '经度', key: 'longitude' }, {title: '经度', key: 'longitude'},
{ title: '误差', key: 'offset' }, {title: '误差', key: 'offset'},
// { title: '精度', key: 'accuracy' }, // { title: '精度', key: 'accuracy' },
{ title: '创建时间', key: 'createtime' }, {title: '创建时间', key: 'createtime'},
{ title: '操作', slot: 'action', width: 120, align: 'center' }, {title: '操作', slot: 'action', width: 120, align: 'center'},
], ],
tableData: [], tableData: [],
...@@ -96,18 +98,18 @@ export default { ...@@ -96,18 +98,18 @@ export default {
address: undefined, address: undefined,
addrRangeList: [ addrRangeList: [
// { label: '50米', value: 50 }, // { label: '50米', value: 50 },
{ label: '100米', value: 100 }, {label: '100米', value: 100},
{ label: '200米', value: 200 }, {label: '200米', value: 200},
{ label: '300米', value: 300 }, {label: '300米', value: 300},
{ label: '400米', value: 400 }, {label: '400米', value: 400},
{ label: '500米', value: 500 }, {label: '500米', value: 500},
{ label: '600米', value: 600 }, {label: '600米', value: 600},
{ label: '700米', value: 700 }, {label: '700米', value: 700},
{ label: '800米', value: 800 }, {label: '800米', value: 800},
{ label: '900米', value: 900 }, {label: '900米', value: 900},
{ label: '1000米', value: 1000 }, {label: '1000米', value: 1000},
{ label: '2000米', value: 2000 }, {label: '2000米', value: 2000},
{ label: '3000米', value: 3000 }, {label: '3000米', value: 3000},
], ],
locSetModalShow: false, locSetModalShow: false,
// 保存按钮loading // 保存按钮loading
...@@ -232,14 +234,14 @@ export default { ...@@ -232,14 +234,14 @@ export default {
// 获取考勤列表 // 获取考勤列表
getAttendanceList() { getAttendanceList() {
this.$Spin.show() this.loading1 = true
api.GetAttendanceList().then(res => { api.GetAttendanceList().then(res => {
// console.log(res) // console.log(res)
this.tableData = res.response this.tableData = res.response
}).catch(e => { }).catch(e => {
this.globalMessage('error', e) this.globalMessage('error', e)
}).finally(() => { }).finally(() => {
this.$Spin.hide() this.loading1 = false
}) })
}, },
...@@ -252,7 +254,7 @@ export default { ...@@ -252,7 +254,7 @@ export default {
}) })
}, },
}, },
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
......
...@@ -15,15 +15,31 @@ ...@@ -15,15 +15,31 @@
<!-- </div>--> <!-- </div>-->
<!-- </template>--> <!-- </template>-->
<Table :columns="columns" :data="data"> <Table :columns="columns" :data="data" :loading="loading">
<template #action="{row}"> <template #action="{row}">
<Button type="primary" size="small" @click="update(row)">修改</Button> <Button type="primary" size="small" @click="update(row)">修改</Button>
<Button type="error" size="small" @click="Delete(row)" style="margin-left: 10px;">删除</Button> <Button type="error" size="small" @click="Delete(row)" style="margin-left: 10px;">删除</Button>
</template>
</Table>
<div style="width: 100%;height: 70px;display: flex;align-items: center;">
<Page show-total
show-sizer
show-elevator
:total="total"
:page-size="page_size"
model-value="page_index"
@on-change="currentPage"
@on-page-size-change="currentPageCount"
/>
</div>
<!-- <Spin fix :show="spinShow"/>-->
<Modal <Modal
v-model="modal" v-model="modal"
title="配置校区" title="配置校区"
@on-ok="modalOk(row)" @on-ok="modalOk"
cancel-text="取消" cancel-text="取消"
ok-text="确认" ok-text="确认"
:mask-closable="false" :mask-closable="false"
...@@ -46,26 +62,11 @@ ...@@ -46,26 +62,11 @@
<!-- </FormItem>--> <!-- </FormItem>-->
</Form> </Form>
</Modal> </Modal>
</template>
</Table>
<div style="width: 100%;height: 70px;display: flex;align-items: center;">
<Page show-total
show-sizer
show-elevator
:total="total"
:page-size="page_size"
model-value="page_index"
@on-change="currentPage"
@on-page-size-change="currentPageCount"
/>
</div>
<!-- <Spin fix :show="spinShow"/>-->
</div> </div>
</template> </template>
<script> <script>
import * as hooks from '../../../../hooks/index'
import * as api from '../../../../api/lezRequest' import * as api from '../../../../api/lezRequest'
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等) //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
//例如:import 《组件名称》 from '《组件路径》'; //例如:import 《组件名称》 from '《组件路径》';
...@@ -77,6 +78,7 @@ ...@@ -77,6 +78,7 @@
data() { data() {
//这里存放数据", //这里存放数据",
return { return {
loading: false,
spinShow: false, spinShow: false,
modal: false, modal: false,
formTop: { formTop: {
...@@ -148,26 +150,32 @@ ...@@ -148,26 +150,32 @@
}, },
//方法集合" //方法集合"
methods: { methods: {
async modalOk() { modalOk() {
hooks.myEncapsulationFunction(async () => {
let data = { let data = {
"campusid": this.formTop.id, "campusid": this.formTop.id,
"campusname": this.formTop.input1, "campusname": this.formTop.input1,
} }
const res = await api.CampusSave(data) const res = await api.CampusSave(data)
if (res.code === 1) await this.GetCampusList() if (res.code === 1) await this.GetCampusList()
return res
})
}, },
update(e) { update(e) {
console.log(e)
this.formTop.id = e.campusid; this.formTop.id = e.campusid;
this.formTop.input1 = e.campusname; this.formTop.input1 = e.campusname;
this.modal = true this.modal = true
}, },
async DeleteAction() { DeleteAction() {
hooks.myEncapsulationFunction(async () => {
let data = { let data = {
"campusid": this.formTop.id "campusid": this.formTop.id
} }
const res = await api.CampusDel(data) const res = await api.CampusDel(data)
this.GetCampusList() this.GetCampusList()
return res
})
}, },
Delete(e) { Delete(e) {
this.formTop.id = e.campusid this.formTop.id = e.campusid
...@@ -219,8 +227,9 @@ ...@@ -219,8 +227,9 @@
} }
}, },
async GetCampusList() { GetCampusList() {
this.$Spin.show(); hooks.getInitListRequest(async () => {
this.loading = true
let data = { let data = {
name: this.searchValue, name: this.searchValue,
page_size: this.page_size, page_size: this.page_size,
...@@ -229,7 +238,9 @@ ...@@ -229,7 +238,9 @@
const res = await api.GetCampusList(data) const res = await api.GetCampusList(data)
this.data = res.response.data this.data = res.response.data
this.total = res.response.data_count this.total = res.response.data_count
this.publicMessage(res) this.loading = false
})
} }
}, },
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载 //生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
...@@ -15,17 +15,29 @@ ...@@ -15,17 +15,29 @@
<!-- </div>--> <!-- </div>-->
<!-- </template>--> <!-- </template>-->
<Table :columns="columns" :data="data"> <Table :columns="columns" :data="data" :loading="loading">
<template #advance_day="{row}"> <template #advance_day="{row}">
{{ row.advance_day }}天 {{ row.advance_day }}天
</template> </template>
<template #action="{row}"> <template #action="{row}">
<Button type="primary" size="small" @click="update(row)">修改</Button> <Button type="primary" size="small" @click="update(row)">修改</Button>
</template>
</Table>
<div style="width: 100%;height: 70px;display: flex;align-items: center;">
<Page show-total
show-sizer
show-elevator
:total="total"
:page-size="page_size"
model-value="page_index"
@on-change="currentPage"
@on-page-size-change="currentPageCount"
/>
</div>
<Modal <Modal
v-model="modal" v-model="modal"
title="值班类型" title="值班类型"
@on-ok="modalOk(row)" @on-ok="modalOk"
cancel-text="取消" cancel-text="取消"
ok-text="确认" ok-text="确认"
:mask-closable="false" :mask-closable="false"
...@@ -52,26 +64,12 @@ ...@@ -52,26 +64,12 @@
<!-- </FormItem>--> <!-- </FormItem>-->
</Form> </Form>
</Modal> </Modal>
</template>
</Table>
<div style="width: 100%;height: 70px;display: flex;align-items: center;">
<Page show-total
show-sizer
show-elevator
:total="total"
:page-size="page_size"
model-value="page_index"
@on-change="currentPage"
@on-page-size-change="currentPageCount"
/>
</div>
</div> </div>
</template> </template>
<script> <script>
import * as hooks from '../../../../hooks/index'
import * as api from '../../../../api/lezRequest' import * as api from '../../../../api/lezRequest'
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等) //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
//例如:import 《组件名称》 from '《组件路径》'; //例如:import 《组件名称》 from '《组件路径》';
...@@ -83,7 +81,7 @@ ...@@ -83,7 +81,7 @@
data() { data() {
//这里存放数据", //这里存放数据",
return { return {
loading: false,
modal: false, modal: false,
formTop: { formTop: {
time_task_id: '', time_task_id: '',
...@@ -151,7 +149,8 @@ ...@@ -151,7 +149,8 @@
getSelectTime(e) { getSelectTime(e) {
this.formTop.input2 = e this.formTop.input2 = e
}, },
async modalOk() { modalOk() {
hooks.myEncapsulationFunction(async () => {
let data = { let data = {
"megconfigid": this.formTop.id, "megconfigid": this.formTop.id,
"advance_day": this.formTop.input1, "advance_day": this.formTop.input1,
...@@ -160,9 +159,10 @@ ...@@ -160,9 +159,10 @@
} }
const res = await api.GetMessageConfigSave(data) const res = await api.GetMessageConfigSave(data)
await this.GetMessageConfigInfo() await this.GetMessageConfigInfo()
return res
})
}, },
update(e) { update(e) {
console.log(e)
this.formTop.id = e.megconfigid; this.formTop.id = e.megconfigid;
this.formTop.input1 = e.advance_day; this.formTop.input1 = e.advance_day;
this.formTop.input2 = e.remind_time this.formTop.input2 = e.remind_time
...@@ -226,11 +226,14 @@ ...@@ -226,11 +226,14 @@
} }
}, },
async GetMessageConfigInfo(searchValue = '') { async GetMessageConfigInfo(searchValue = '') {
this.$Spin.show(); hooks.getInitListRequest(async () => {
this.loading = true
this.data = [] this.data = []
const res = await api.GetMessageConfigInfo() const res = await api.GetMessageConfigInfo()
this.data.push(res.response) this.data.push(res.response)
this.publicMessage(res) this.loading = false
})
} }
}, },
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载 //生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或