提交 2864f2d4 编写于 作者: 刘英杰's avatar 刘英杰

优化loading、弹窗

上级 cc29572f
......@@ -15,15 +15,30 @@
<!-- </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>
<Modal
v-model="modal"
title="值班类型"
@on-ok="modalOk(row)"
@on-ok="modalOk"
cancel-text="取消"
ok-text="确认"
:mask-closable="false"
......@@ -35,7 +50,7 @@
</FormItem>
<FormItem label="时间" prop="input2">
<TimePicker @on-change="selectTileValue" format="HH:mm" type="timerange" placement="bottom-end"
placeholder="Select time" style="width: 100%"/>
placeholder="请选择时间" style="width: 100%"/>
</FormItem>
<!-- <FormItem label="选择教师" prop="input2" >-->
<!-- <Select v-model="teacherSelectCurrentValue" filterable placeholder="请选择或搜索...">-->
......@@ -49,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 '《组件路径》';
......@@ -80,6 +81,7 @@
data() {
//这里存放数据",
return {
loading: false,
modal: false,
formTop: {
id: '',
......@@ -158,7 +160,8 @@
this.formTop.input2 = e[1]
console.log("🚀🚀🚀,", e[1])
},
async modalOk() {
modalOk() {
hooks.myEncapsulationFunction(async () => {
let data = {
"watchhourid": this.formTop.id,
"watchhourname": this.formTop.timeName,
......@@ -166,22 +169,26 @@
"watchhour_end_time": this.formTop.input2,
}
const res = await api.WatchHourSave(data)
this.GetWatchHourList()
await this.GetWatchHourList()
return res
})
},
update(e) {
console.log(e)
this.formTop.id = e.watchhourid;
this.formTop.timeName = e.watchhourname;
this.modal = true
},
async DeleteAction() {
hooks.myEncapsulationFunction(async () => {
let data = {
id: this.formTop.id
}
const res = await api.WatchHourDel(data)
this.GetWatchHourList()
await this.GetWatchHourList()
return res
})
},
Delete(e) {
this.formTop.id = e.watchhourid
......@@ -232,7 +239,9 @@
}
},
async GetWatchHourList(searchValue = '') {
this.$Spin.show();
hooks.getInitListRequest(async () => {
this.loading = true
let data = {
condition: this.searchValue,
page_size: this.page_size,
......@@ -241,7 +250,9 @@
const res = await api.GetWatchHourList(data)
this.data = res.response.data
this.total = res.response.data_count
this.publicMessage(res)
this.loading = false
})
}
},
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
......@@ -15,7 +15,7 @@
<!-- </div>-->
<!-- </template>-->
<Table :columns="columns" :data="data">
<Table :columns="columns" :data="data" :loading="loading">
<!-- 签到类型 -->
<template #sign_type="{ row }">
<span v-if="row.sign_type == 0">免打卡</span>
......@@ -26,10 +26,24 @@
<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>
<Modal
v-model="modal"
title="值班类型"
@on-ok="modalOk(row)"
@on-ok="modalOk"
cancel-text="取消"
ok-text="确认"
:mask-closable="false"
......@@ -68,27 +82,13 @@
<!-- </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 api from '../../../../api/lezRequest'
import * as hooks from '../../../../hooks/index'
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
//例如:import 《组件名称》 from '《组件路径》';
export default {
......@@ -111,6 +111,7 @@
page_size: 10,
page_index: 1,
total: null,
loading: false,
columns: [
{
title: '序号',
......@@ -182,7 +183,8 @@
},
//方法集合",
methods: {
async modalOk() {
modalOk() {
hooks.myEncapsulationFunction(async () => {
let data = {
"watchtypeid": this.formTop.id,
"watchtypename": this.formTop.input1,
......@@ -191,8 +193,9 @@
"sign_type": this.formTop.type,
}
const res = await api.WatchTypeSave(data)
this.GetWatchTypeList()
await this.GetWatchTypeList()
return res
})
},
update(e) {
// console.log(e)
......@@ -204,11 +207,14 @@
this.modal = true
},
async DeleteAction() {
hooks.myEncapsulationFunction(async () => {
let data = {
id: this.formTop.id
}
const res = await api.WatchTypeDel(data)
this.GetWatchTypeList()
await this.GetWatchTypeList()
return res
})
},
Delete(e) {
this.formTop.id = e.watchtypeid
......@@ -259,7 +265,8 @@
}
},
async GetWatchTypeList(searchValue = '') {
this.$Spin.show();
hooks.getInitListRequest(async () => {
this.loading = true
let data = {
name: this.searchValue,
page_size: this.page_size,
......@@ -268,12 +275,14 @@
const res = await api.GetWatchTypeList(data)
this.data = res.response.data
this.total = res.response.data_count
this.publicMessage(res)
this.loading = false
})
}
},
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
beforeCreate() {
console.info("🚀🚀🚀,")
},
//生命周期 - 创建完成(可以访问当前this实例)",数据模型已加载,方法已加载,html模板已加载,html模板未渲染
......
......@@ -114,6 +114,7 @@
<script>
import * as api from '../../api/lezRequest'
import * as hooks from '@/hooks/index'
export default {
name: 'numberLimit',
......
......@@ -167,6 +167,7 @@
//例如:import 《组件名称》 from '《组件路径》';
import * as api from '../../api/lezRequest'
import Vue from "vue";
import * as hooks from '@/hooks/index'
export default {
//import引入的组件需要注入到对象中才能使用",
......
......@@ -16,8 +16,7 @@
</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="roleDelete(row)" style="margin-left: 10px;">删除</Button>
......@@ -64,6 +63,7 @@
//例如:import 《组件名称》 from '《组件路径》';
import * as api from '../../api/lezRequest'
import Vue from "vue";
import * as hooks from '@/hooks/index'
export default {
//import引入的组件需要注入到对象中才能使用",
......@@ -71,6 +71,7 @@
data() {
//这里存放数据",
return {
loading: false,
searchValue: '', // 搜索框的值
total: null,
page_size: 10,
......@@ -250,8 +251,10 @@
},
async GetUserRoleList() {
this.$Spin.show();
hooks.getInitListRequest(async () => {
// 获取初始话列表
this.loading = true
let data = {
"page_index": this.page_index,
"page_size": this.page_size,
......@@ -261,7 +264,9 @@
this.data = []
this.data = res.response.data
this.total = res.response.data_count
this.publicMessage(res)
this.loading = false
})
}
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或