提交 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,9 +91,9 @@
</div>
</template>
<Table
:loading="tableLoading"
:columns="columns"
:data="data"
:height="tableHeightCal"
@on-select="onSelect"
@on-select-cancel="onSelectCancel"
@on-select-all="onSelectAll"
......@@ -270,7 +270,8 @@
:mask-closable="false"
title="模板导出"
@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>
</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) {
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 () => {
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) {
hooks.myEncapsulationFunction(async () => {
const res = await api.WatchCreate(data)
await this.getWatchList()
this.addDuty = false
return res
})
}
})
},
......@@ -880,16 +884,14 @@
])
.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
hooks.getInitListRequest(async () => {
this.tableLoading = true
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,
......@@ -901,14 +903,12 @@
"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)
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 () => {
this.publicConfirm(() => {
hooks.myEncapsulationFunction(async () => {
let data = [{
signid: e.signid,
sign: value,
}]
const res = await api.SignInOrOut(data)
this.GetSignRecordList()
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,8 +457,9 @@
})
},
logOk() {
this.$refs['formValidate'].validate(async (validate) => {
this.$refs['formValidate'].validate((validate) => {
if (validate) {
hooks.myEncapsulationFunction(async () => {
this.buttonLoding = true
const data = {
"signId": this.formValidate.signid,
......@@ -472,9 +467,11 @@
}
const res = await api.SignLogSave(data)
this.logModal = false
this.GetSignRecordList()
await this.GetSignRecordList()
// this.publicMessage(res)
this.buttonLoding = false
return res
})
}
})
},
......@@ -517,6 +514,7 @@
},
async GetSignRecordList() {
hooks.getInitListRequest(async () => {
this.loading = true
let data = {
"dep_id": this.selectObject.dept_idSearch,
......@@ -531,16 +529,12 @@
}
const res = await api.GetSignRecordList(data)
res.response.data.forEach((currentValue, index) => {
console.log("🚀🚀🚀,", currentValue)
currentValue._disabled = currentValue.sign === 2 || currentValue.sign_set === 1
})
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>
......@@ -2,7 +2,7 @@
<!-- 考勤管理 -->
<div>
<!-- table列表 -->
<Table :columns="tableColumns" :data="tableData">
<Table :columns="tableColumns" :data="tableData" :loading="loading1">
<template #action="{ row }">
<!-- <a @click="rowEdit(row)">编辑</a>
<Divider type="vertical"/> -->
......@@ -69,21 +69,23 @@
</template>
<script>
import * as api from '@/api/lezRequest'
import * as api from '@/api/lezRequest'
import * as hooks from '@/hooks/index'
export default {
export default {
data() {
return {
loading1: false,
tableColumns: [
{ title: '序号', type: 'index', width: 80, align: 'center' },
{ title: '标题', key: 'title' },
{ title: '地址', key: 'address' },
{ title: '纬度', key: 'latitude' },
{ title: '经度', key: 'longitude' },
{ title: '误差', key: 'offset' },
{title: '序号', type: 'index', width: 80, align: 'center'},
{title: '标题', key: 'title'},
{title: '地址', key: 'address'},
{title: '纬度', key: 'latitude'},
{title: '经度', key: 'longitude'},
{title: '误差', key: 'offset'},
// { title: '精度', key: 'accuracy' },
{ title: '创建时间', key: 'createtime' },
{ title: '操作', slot: 'action', width: 120, align: 'center' },
{title: '创建时间', key: 'createtime'},
{title: '操作', slot: 'action', width: 120, align: 'center'},
],
tableData: [],
......@@ -96,18 +98,18 @@ export default {
address: undefined,
addrRangeList: [
// { label: '50米', value: 50 },
{ label: '100米', value: 100 },
{ label: '200米', value: 200 },
{ label: '300米', value: 300 },
{ label: '400米', value: 400 },
{ label: '500米', value: 500 },
{ label: '600米', value: 600 },
{ label: '700米', value: 700 },
{ label: '800米', value: 800 },
{ label: '900米', value: 900 },
{ label: '1000米', value: 1000 },
{ label: '2000米', value: 2000 },
{ label: '3000米', value: 3000 },
{label: '100米', value: 100},
{label: '200米', value: 200},
{label: '300米', value: 300},
{label: '400米', value: 400},
{label: '500米', value: 500},
{label: '600米', value: 600},
{label: '700米', value: 700},
{label: '800米', value: 800},
{label: '900米', value: 900},
{label: '1000米', value: 1000},
{label: '2000米', value: 2000},
{label: '3000米', value: 3000},
],
locSetModalShow: false,
// 保存按钮loading
......@@ -232,14 +234,14 @@ export default {
// 获取考勤列表
getAttendanceList() {
this.$Spin.show()
this.loading1 = true
api.GetAttendanceList().then(res => {
// console.log(res)
this.tableData = res.response
}).catch(e => {
this.globalMessage('error', e)
}).finally(() => {
this.$Spin.hide()
this.loading1 = false
})
},
......@@ -252,7 +254,7 @@ export default {
})
},
},
}
}
</script>
<style scoped lang="less">
......
......@@ -15,15 +15,31 @@
<!-- </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>
</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
v-model="modal"
title="配置校区"
@on-ok="modalOk(row)"
@on-ok="modalOk"
cancel-text="取消"
ok-text="确认"
:mask-closable="false"
......@@ -46,26 +62,11 @@
<!-- </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"
:page-size="page_size"
model-value="page_index"
@on-change="currentPage"
@on-page-size-change="currentPageCount"
/>
</div>
<!-- <Spin fix :show="spinShow"/>-->
</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() {
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() {
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,8 +227,9 @@
}
},
async GetCampusList() {
this.$Spin.show();
GetCampusList() {
hooks.getInitListRequest(async () => {
this.loading = true
let data = {
name: this.searchValue,
page_size: this.page_size,
......@@ -229,7 +238,9 @@
const res = await api.GetCampusList(data)
this.data = res.response.data
this.total = res.response.data_count
this.publicMessage(res)
this.loading = false
})
}
},
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
......@@ -15,17 +15,29 @@
<!-- </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>
</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
v-model="modal"
title="值班类型"
@on-ok="modalOk(row)"
@on-ok="modalOk"
cancel-text="取消"
ok-text="确认"
:mask-closable="false"
......@@ -52,26 +64,12 @@
<!-- </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"
:page-size="page_size"
model-value="page_index"
@on-change="currentPage"
@on-page-size-change="currentPageCount"
/>
</div>
</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,7 +149,8 @@
getSelectTime(e) {
this.formTop.input2 = e
},
async modalOk() {
modalOk() {
hooks.myEncapsulationFunction(async () => {
let data = {
"megconfigid": this.formTop.id,
"advance_day": this.formTop.input1,
......@@ -160,9 +159,10 @@
}
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();
hooks.getInitListRequest(async () => {
this.loading = true
this.data = []
const res = await api.GetMessageConfigInfo()
this.data.push(res.response)
this.publicMessage(res)
this.loading = false
})
}
},
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或