提交 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,13 +91,13 @@ ...@@ -91,13 +91,13 @@
</div> </div>
</template> </template>
<Table <Table
:columns="columns" :loading="tableLoading"
:data="data" :columns="columns"
:height="tableHeightCal" :data="data"
@on-select="onSelect" @on-select="onSelect"
@on-select-cancel="onSelectCancel" @on-select-cancel="onSelectCancel"
@on-select-all="onSelectAll" @on-select-all="onSelectAll"
@on-select-all-cancel="onSelectAllCancel"> @on-select-all-cancel="onSelectAllCancel">
<template #is_lead="{row}"> <template #is_lead="{row}">
{{ ['值班教师', '值班领导'][row.is_lead] }} {{ ['值班教师', '值班领导'][row.is_lead] }}
</template> </template>
...@@ -266,11 +266,12 @@ ...@@ -266,11 +266,12 @@
<!-- 导出模板Modal --> <!-- 导出模板Modal -->
<Modal <Modal
v-model="exportModalShow" v-model="exportModalShow"
: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) {
let date = this.updateDutyFrom hooks.myEncapsulationFunction(async () => {
const res = await api.WatchSave(date) let date = this.updateDutyFrom
this.getWatchList() const res = await api.WatchSave(date)
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(() => {
const data = { hooks.myEncapsulationFunction(async () => {
id: e.watchid const data = {
} id: e.watchid
const res = await api.WatchDel(data) }
this.getWatchList() const res = await api.WatchDel(data)
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) {
const res = await api.WatchCreate(data) hooks.myEncapsulationFunction(async () => {
await this.getWatchList() const res = await api.WatchCreate(data)
this.addDuty = false await this.getWatchList()
this.addDuty = false
return res
})
} }
}) })
}, },
...@@ -880,35 +884,31 @@ ...@@ -880,35 +884,31 @@
]) ])
.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.pushListSlc = [] this.tableLoading = true
this.$Spin.show() this.pushListSlc = []
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, "end_time": this.cityListAlltSearchFlagObject.endTimeSearch !== '' ? this.cityListAlltSearchFlagObject.endTimeSearch : this.cityListAllObject.endTime,
"end_time": this.cityListAlltSearchFlagObject.endTimeSearch !== '' ? this.cityListAlltSearchFlagObject.endTimeSearch : this.cityListAllObject.endTime, "is_lead": this.cityListAlltSearchFlagObject.is_lead,
"is_lead": this.cityListAlltSearchFlagObject.is_lead, "dep_id": this.cityListAlltSearchFlagObject.dutyDepSelect,
"dep_id": this.cityListAlltSearchFlagObject.dutyDepSelect, "key_name": this.cityListAlltSearchFlagObject.key_name,
"key_name": this.cityListAlltSearchFlagObject.key_name, "type_id": this.cityListAlltSearchFlagObject.dutyType,
"type_id": this.cityListAlltSearchFlagObject.dutyType, "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)
} this.data = res.response.data
const res = await api.GetWatchList(data) this.total = res.response.data_count
this.data = res.response.data this.tableLoading = false
this.total = res.response.data_count, })
this.$Spin.hide()
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(() => {
let data = [{ hooks.myEncapsulationFunction(async () => {
signid: e.signid, let data = [{
sign: value, signid: e.signid,
}] sign: value,
const res = await api.SignInOrOut(data) }]
this.GetSignRecordList() const res = await api.SignInOrOut(data)
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,18 +457,21 @@ ...@@ -463,18 +457,21 @@
}) })
}, },
logOk() { logOk() {
this.$refs['formValidate'].validate(async (validate) => { this.$refs['formValidate'].validate((validate) => {
if (validate) { if (validate) {
this.buttonLoding = true hooks.myEncapsulationFunction(async () => {
const data = { this.buttonLoding = true
"signId": this.formValidate.signid, const data = {
"content": this.formValidate.content "signId": this.formValidate.signid,
} "content": this.formValidate.content
const res = await api.SignLogSave(data) }
this.logModal = false const res = await api.SignLogSave(data)
this.GetSignRecordList() this.logModal = false
// this.publicMessage(res) await this.GetSignRecordList()
this.buttonLoding = false // this.publicMessage(res)
this.buttonLoding = false
return res
})
} }
}) })
}, },
...@@ -517,30 +514,27 @@ ...@@ -517,30 +514,27 @@
}, },
async GetSignRecordList() { async GetSignRecordList() {
this.loading = true hooks.getInitListRequest(async () => {
let data = { this.loading = true
"dep_id": this.selectObject.dept_idSearch, let data = {
"key_name": this.selectObject.key_nameSearch, "dep_id": this.selectObject.dept_idSearch,
"start_time": this.selectObject.startTimeSearch === '' ? this.selectObject.startTime : this.selectObject.startTimeSearch, "key_name": this.selectObject.key_nameSearch,
"end_time": this.selectObject.endTimeSearch === '' ? this.selectObject.endTime : this.selectObject.endTimeSearch, "start_time": this.selectObject.startTimeSearch === '' ? this.selectObject.startTime : this.selectObject.startTimeSearch,
"type_id": this.selectObject.watchtypeidSearch, "end_time": this.selectObject.endTimeSearch === '' ? this.selectObject.endTime : this.selectObject.endTimeSearch,
"watchhour_time": this.selectObject.watch_hour_idSearch, "type_id": this.selectObject.watchtypeidSearch,
"page_index": this.page_index, "watchhour_time": this.selectObject.watch_hour_idSearch,
"page_size": this.page_size, "page_index": this.page_index,
"campus_id": this.selectObject.campusidSearch, "page_size": this.page_size,
} "campus_id": this.selectObject.campusidSearch,
const res = await api.GetSignRecordList(data) }
res.response.data.forEach((currentValue, index) => { const res = await api.GetSignRecordList(data)
console.log("🚀🚀🚀,", currentValue) res.response.data.forEach((currentValue, index) => {
currentValue._disabled = currentValue.sign === 2 || currentValue.sign_set === 1 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() { 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>
<template> <template>
<!-- 考勤管理 --> <!-- 考勤管理 -->
<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"/> -->
<a @click="rowDelete(row)">删除</a> <a @click="rowDelete(row)">删除</a>
</template> </template>
</Table> </Table>
<!-- <div id="tmap"></div> --> <!-- <div id="tmap"></div> -->
<!-- 编辑(位置选择)Modal --> <!-- 编辑(位置选择)Modal -->
<Modal <Modal
v-model="editModalShow" v-model="editModalShow"
mask-closable mask-closable
:title="`${isEdit ? '编辑' : '添加'}考勤地点`" :title="`${isEdit ? '编辑' : '添加'}考勤地点`"
@on-cancle="address = undefined"> @on-cancle="address = undefined">
<template> <template>
<iframe <iframe
id="mapPage" id="mapPage"
width="100%" width="100%"
height="500px" height="500px"
frameborder="0" frameborder="0"
:src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=ZNMBZ-NYOEO-WNMWL-SJF4C-MWKQT-KJB7W&referer=myapp`"> :src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=ZNMBZ-NYOEO-WNMWL-SJF4C-MWKQT-KJB7W&referer=myapp`">
</iframe> </iframe>
<!-- <div id="tmap"></div> --> <!-- <div id="tmap"></div> -->
</template> </template>
<template #footer> <template #footer>
<Button type="primary" :disabled="address == undefined" @click="nextStep">下一步</Button> <Button type="primary" :disabled="address == undefined" @click="nextStep">下一步</Button>
</template> </template>
</Modal> </Modal>
<!-- 地点设置Modal --> <!-- 地点设置Modal -->
<Modal <Modal
v-model="locSetModalShow" v-model="locSetModalShow"
mask-closable mask-closable
title="地点设置"> title="地点设置">
<template> <template>
<Form label-colon :label-width="100"> <Form label-colon :label-width="100">
<Row> <Row>
<Col span="24"> <Col span="24">
<FormItem label="标题"> <FormItem label="标题">
<Input v-model="addrTitle" type="text"/> <Input v-model="addrTitle" type="text"/>
</FormItem> </FormItem>
</Col> </Col>
<Col span="24"> <Col span="24">
<FormItem label="地点名称"> <FormItem label="地点名称">
<Input v-model="addrName" type="text"/> <Input v-model="addrName" type="text"/>
</FormItem> </FormItem>
</Col> </Col>
<Col span="24"> <Col span="24">
<FormItem label="打卡范围"> <FormItem label="打卡范围">
<Select v-model="addrRange"> <Select v-model="addrRange">
<Option v-for="item in addrRangeList" :key="item.value" :value="item.value">{{ item.label }}</Option> <Option v-for="item in addrRangeList" :key="item.value" :value="item.value">{{ item.label }}</Option>
</Select> </Select>
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
</Form> </Form>
</template> </template>
<template #footer> <template #footer>
<Button @click="locSetModalShow = false">上一步</Button> <Button @click="locSetModalShow = false">上一步</Button>
<Button type="primary" :loading="btSaveLoading" @click="saveAttendance">确定</Button> <Button type="primary" :loading="btSaveLoading" @click="saveAttendance">确定</Button>
</template> </template>
</Modal> </Modal>
</div> </div>
</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 {
tableColumns: [ loading1: false,
{ title: '序号', type: 'index', width: 80, align: 'center' }, tableColumns: [
{ title: '标题', key: 'title' }, {title: '序号', type: 'index', width: 80, align: 'center'},
{ title: '地址', key: 'address' }, {title: '标题', key: 'title'},
{ title: '纬度', key: 'latitude' }, {title: '地址', key: 'address'},
{ title: '经度', key: 'longitude' }, {title: '纬度', key: 'latitude'},
{ title: '误差', key: 'offset' }, {title: '经度', key: 'longitude'},
// { title: '精度', key: 'accuracy' }, {title: '误差', key: 'offset'},
{ title: '创建时间', key: 'createtime' }, // { title: '精度', key: 'accuracy' },
{ title: '操作', slot: 'action', width: 120, align: 'center' }, {title: '创建时间', key: 'createtime'},
], {title: '操作', slot: 'action', width: 120, align: 'center'},
tableData: [], ],
tableData: [],
// true.编辑 false.添加 // true.编辑 false.添加
isEdit: false, isEdit: false,
editModalShow: false, editModalShow: false,
addrTitle: '', addrTitle: '',
addrName: undefined, addrName: undefined,
addrRange: 100, addrRange: 100,
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
btSaveLoading: false, btSaveLoading: false,
} }
}, },
computed: {}, computed: {},
created() { created() {
this.getAttendanceList() this.getAttendanceList()
}, },
mounted() { mounted() {
var that = this var that = this
window.addEventListener('message', function (event) { window.addEventListener('message', function (event) {
// 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息 // 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息
var loc = event.data; var loc = event.data;
if (loc && loc.module == 'locationPicker') {//防止其他应用也会向该页面post信息,需判断module是否为'locationPicker' if (loc && loc.module == 'locationPicker') {//防止其他应用也会向该页面post信息,需判断module是否为'locationPicker'
// console.log('location', loc); // console.log('location', loc);
that.address = loc that.address = loc
} }
}, false); }, false);
}, },
methods: { methods: {
// 添加考勤下一步 // 添加考勤下一步
nextStep() { nextStep() {
// console.log('输出地址测试', this.address) // console.log('输出地址测试', this.address)
this.addrName = this.address.poiname this.addrName = this.address.poiname
this.addrTitle = this.address.poiname this.addrTitle = this.address.poiname
this.locSetModalShow = true this.locSetModalShow = true
}, },
// 保存考勤 // 保存考勤
saveAttendance() { saveAttendance() {
let data = { let data = {
// attendanceid: "string", // attendanceid: "string",
title: this.addrTitle, title: this.addrTitle,
address: this.addrName, address: this.addrName,
latitude: this.address.latlng.lat, latitude: this.address.latlng.lat,
longitude: this.address.latlng.lng, longitude: this.address.latlng.lng,
offset: this.addrRange, offset: this.addrRange,
// accuracy: 0, // accuracy: 0,
// createtime: "2023-11-18T08:35:09.494Z" // createtime: "2023-11-18T08:35:09.494Z"
} }
this.btSaveLoading = true this.btSaveLoading = true
api.AttendanceSave(data).then(res => { api.AttendanceSave(data).then(res => {
// console.log('保存考勤', res) // console.log('保存考勤', res)
if (res.code == 1) { if (res.code == 1) {
this.globalMessage('success', res.response) this.globalMessage('success', res.response)
this.getAttendanceList() this.getAttendanceList()
this.editModalShow = false this.editModalShow = false
this.locSetModalShow = false this.locSetModalShow = false
this.address = undefined this.address = undefined
this.addrName = undefined this.addrName = undefined
} else { } else {
this.globalMessage('error', res.msg_detail) this.globalMessage('error', res.msg_detail)
} }
}).catch(e => { }).catch(e => {
this.globalMessage('error', e) this.globalMessage('error', e)
}).finally(() => { }).finally(() => {
this.btSaveLoading = false this.btSaveLoading = false
}) })
}, },
// rowEdit(row) {
// console.log('编辑',row)
// this.isEdit = true
// this.editModalShow = true
// // var center = new window.TMap.LatLng(Number(row.latitude), Number(row.longitude))
// // var map = new window.TMap.Map(document.getElementById('tmap'), {
// // center: center,//设置地图中心点坐标
// // zoom: 17.2, //设置地图缩放级别
// // pitch: 43.5, //设置俯仰角
// // rotation: 45 //设置地图旋转角度
// // });
// this.$nextTick(() => { // rowEdit(row) {
// var center = new TMap.LatLng(39.984104, 116.307503); // console.log('编辑',row)
// //初始化地图 // this.isEdit = true
// var map = new TMap.Map("mapPage", { // this.editModalShow = true
// zoom: 12, //设置地图缩放级别 // // var center = new window.TMap.LatLng(Number(row.latitude), Number(row.longitude))
// center: center //设置地图中心点坐标 // // var map = new window.TMap.Map(document.getElementById('tmap'), {
// }); // // center: center,//设置地图中心点坐标
// // zoom: 17.2, //设置地图缩放级别
// // pitch: 43.5, //设置俯仰角
// // rotation: 45 //设置地图旋转角度
// // });
// var circle = new TMap.MultiCircle({ // this.$nextTick(() => {
// map, // var center = new TMap.LatLng(39.984104, 116.307503);
// styles: { // 设置圆形样式 // //初始化地图
// 'circle': new TMap.CircleStyle({ // var map = new TMap.Map("mapPage", {
// 'color': 'rgba(41,91,255,0.16)', // zoom: 12, //设置地图缩放级别
// 'showBorder': true, // center: center //设置地图中心点坐标
// 'borderColor': 'rgba(41,91,255,1)', // });
// 'borderWidth': 2,
// }),
// },
// geometries: [{
// styleId: 'circle',
// center: center,
// radius: 6500,
// }],
// });
// })
// },
rowDelete(row) {
// console.log('删除',row)
this.$Modal.confirm({
title: '提示',
content: `是否确认删除考勤 ${row.title} ?`,
loading: true,
onOk: () => {
api.AttendanceDel(row.attendanceid).then(res => {
// console.log('删除考勤', res)
if (res.code == 1) {
this.globalMessage('success', res.response)
this.$Modal.remove()
this.getAttendanceList()
} else {
this.globalMessage('error', res.msg_detail)
}
}).catch(e => {
this.globalMessage('error', e)
})
}
})
},
// 获取考勤列表 // var circle = new TMap.MultiCircle({
getAttendanceList() { // map,
this.$Spin.show() // styles: { // 设置圆形样式
api.GetAttendanceList().then(res => { // 'circle': new TMap.CircleStyle({
// console.log(res) // 'color': 'rgba(41,91,255,0.16)',
this.tableData = res.response // 'showBorder': true,
// 'borderColor': 'rgba(41,91,255,1)',
// 'borderWidth': 2,
// }),
// },
// geometries: [{
// styleId: 'circle',
// center: center,
// radius: 6500,
// }],
// });
// })
// },
rowDelete(row) {
// console.log('删除',row)
this.$Modal.confirm({
title: '提示',
content: `是否确认删除考勤 ${row.title} ?`,
loading: true,
onOk: () => {
api.AttendanceDel(row.attendanceid).then(res => {
// console.log('删除考勤', res)
if (res.code == 1) {
this.globalMessage('success', res.response)
this.$Modal.remove()
this.getAttendanceList()
} else {
this.globalMessage('error', res.msg_detail)
}
}).catch(e => { }).catch(e => {
this.globalMessage('error', e) this.globalMessage('error', e)
}).finally(() => {
this.$Spin.hide()
}) })
}, }
})
},
globalMessage(type, content, time = 3, background = true) { // 获取考勤列表
this.$Message[type]({ getAttendanceList() {
type: type, this.loading1 = true
content: content, api.GetAttendanceList().then(res => {
duration: time, // console.log(res)
background: background, this.tableData = res.response
}) }).catch(e => {
}, this.globalMessage('error', e)
}).finally(() => {
this.loading1 = false
})
},
globalMessage(type, content, time = 3, background = true) {
this.$Message[type]({
type: type,
content: content,
duration: time,
background: background,
})
},
}, },
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
</style> </style>
\ No newline at end of file
...@@ -15,37 +15,12 @@ ...@@ -15,37 +15,12 @@
<!-- </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>
<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> </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;">
...@@ -61,11 +36,37 @@ ...@@ -61,11 +36,37 @@
/> />
</div> </div>
<!-- <Spin fix :show="spinShow"/>--> <!-- <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> </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() {
let data = { hooks.myEncapsulationFunction(async () => {
"campusid": this.formTop.id, let data = {
"campusname": this.formTop.input1, "campusid": this.formTop.id,
} "campusname": this.formTop.input1,
const res = await api.CampusSave(data) }
if (res.code === 1) await this.GetCampusList() const res = await api.CampusSave(data)
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() {
let data = { hooks.myEncapsulationFunction(async () => {
"campusid": this.formTop.id let data = {
} "campusid": this.formTop.id
const res = await api.CampusDel(data) }
this.GetCampusList() const res = await api.CampusDel(data)
this.GetCampusList()
return res
})
}, },
Delete(e) { Delete(e) {
this.formTop.id = e.campusid this.formTop.id = e.campusid
...@@ -219,17 +227,20 @@ ...@@ -219,17 +227,20 @@
} }
}, },
async GetCampusList() { GetCampusList() {
this.$Spin.show(); hooks.getInitListRequest(async () => {
let data = { this.loading = true
name: this.searchValue, let data = {
page_size: this.page_size, name: this.searchValue,
page_index: this.page_index, page_size: this.page_size,
} page_index: this.page_index,
const res = await api.GetCampusList(data) }
this.data = res.response.data const res = await api.GetCampusList(data)
this.total = res.response.data_count this.data = res.response.data
this.publicMessage(res) this.total = res.response.data_count
this.loading = false
})
} }
}, },
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载 //生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
...@@ -15,48 +15,16 @@ ...@@ -15,48 +15,16 @@
<!-- </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>
<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> </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
show-sizer show-sizer
show-elevator show-elevator
:total="total" :total="total"
...@@ -66,12 +34,42 @@ ...@@ -66,12 +34,42 @@
@on-page-size-change="currentPageCount" @on-page-size-change="currentPageCount"
/> />
</div> </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> </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,18 +149,20 @@ ...@@ -151,18 +149,20 @@
getSelectTime(e) { getSelectTime(e) {
this.formTop.input2 = e this.formTop.input2 = e
}, },
async modalOk() { modalOk() {
let data = { hooks.myEncapsulationFunction(async () => {
"megconfigid": this.formTop.id, let data = {
"advance_day": this.formTop.input1, "megconfigid": this.formTop.id,
"remind_time": this.formTop.input2, "advance_day": this.formTop.input1,
"time_task_id": this.formTop.time_task_id "remind_time": this.formTop.input2,
} "time_task_id": this.formTop.time_task_id
const res = await api.GetMessageConfigSave(data) }
await this.GetMessageConfigInfo() const res = await api.GetMessageConfigSave(data)
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.data = [] this.loading = true
const res = await api.GetMessageConfigInfo() this.data = []
this.data.push(res.response) const res = await api.GetMessageConfigInfo()
this.publicMessage(res) this.data.push(res.response)
this.loading = false
})
} }
}, },
//生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载 //生命周期 - 创建之前",数据模型未加载,方法未加载,html模板未加载
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或