提交 466138d1 编写于 作者: 钟一霄's avatar 钟一霄

用户管理添加角色时新增[系部干事]院系选择,新增编辑功能;值班安排模板导出新增年月选择,新增推送功能

上级 3cdb3639
...@@ -61,11 +61,19 @@ export function GetUserList(data) { ...@@ -61,11 +61,19 @@ export function GetUserList(data) {
}); });
} }
export function GetUserInfo(data) { export function GetUserInfo(id) {
// 获取用户详细 // 获取用户详细
return request({ return request({
url: '/api/UserInfo/api/UserInfo/GetUserInfo', url: `/api/UserInfo/api/UserInfo/GetUserInfo?id=${id}`,
method: 'get', method: 'get',
});
}
export function UserUpdateSave(data) {
// 修改用户
return request({
url: '/api/UserInfo/api/UserInfo/UserUpdateSave',
method: 'post',
data data
}); });
} }
...@@ -306,12 +314,11 @@ export function WatchDataExport(data) { ...@@ -306,12 +314,11 @@ export function WatchDataExport(data) {
}); });
} }
export function WatchImportTemplate(data) { export function WatchImportTemplate(year, month) {
// 值班模版导出 // 值班模版导出
return request({ return request({
url: '/api/Watch/api/Watch/WatchImportTemplate', url: `/api/Watch/api/Watch/WatchImportTemplate?year=${year}&month=${month}`,
method: 'get', method: 'get',
data
}); });
} }
...@@ -324,6 +331,15 @@ export function WatchImport(data) { ...@@ -324,6 +331,15 @@ export function WatchImport(data) {
}); });
} }
export function WatchSendMeg(data) {
// 量发送消息提醒
return request({
url: '/api/Watch/api/Watch/WatchSendMeg',
method: 'post',
data
});
}
export function GetWatchHourTime(data) { export function GetWatchHourTime(data) {
// 获取值班时段(选择框) // 获取值班时段(选择框)
return request({ return request({
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<template #extra> <template #extra>
<div style="display: flex;align-items: center;justify-content: center;"> <div style="display: flex;align-items: center;justify-content: center;">
<Button style="margin-right: 8px;" type="warning" @click="batchPush">批量推送</Button>
<ButtonGroup> <ButtonGroup>
<Button @click="handleButtonClick('addDuty')" icon="ios-add-circle-outline">增添值班</Button> <Button @click="handleButtonClick('addDuty')" icon="ios-add-circle-outline">增添值班</Button>
<Button @click="dutyDataImport" label="dutyDataOutput" icon="ios-log-out">数据导出 <Button @click="dutyDataImport" label="dutyDataOutput" icon="ios-log-out">数据导出
...@@ -81,19 +82,27 @@ ...@@ -81,19 +82,27 @@
</Button> </Button>
<Button style="display: flex;align-items: center;" icon="ios-cloud-upload-outline" <Button style="display: flex;align-items: center;" icon="ios-cloud-upload-outline"
@click="handleButtonClick('dutyModelInput')" label="dutyModelInput"> @click="handleButtonClick('dutyModelInput')" label="dutyModelInput">
模版导入 模板导入
</Button> </Button>
<Button @click="handleButtonClick('dutyModelOutput')" label="dutyModelOutput" icon="ios-log-out">模版导出 <!-- <Button @click="handleButtonClick('dutyModelOutput')" label="dutyModelOutput" icon="ios-log-out">模板导出 -->
<Button @click="exportModalShow = true" label="dutyModelOutput" icon="ios-log-out">模板导出
</Button> </Button>
</ButtonGroup> </ButtonGroup>
</div> </div>
</template> </template>
<Table :columns="columns" :data="data"> <Table
:columns="columns"
:data="data"
@on-select="onSelect"
@on-select-cancel="onSelectCancel"
@on-select-all="onSelectAll"
@on-select-all-cancel="onSelectAllCancel">
<template #is_lead="{row}"> <template #is_lead="{row}">
{{ ['值班教师', '值班领导'][row.is_lead] }} {{ ['值班教师', '值班领导'][row.is_lead] }}
</template> </template>
<template #action="{row}"> <template #action="{row}">
<div style="display: flex;justify-content: space-evenly"> <div style="display: flex;justify-content: space-evenly">
<Button @click="pushDuty(row)" type="warning" size="small">推送</Button>
<Button @click="updateDuty(row)" type="primary" size="small">修改</Button> <Button @click="updateDuty(row)" type="primary" size="small">修改</Button>
<Button @click="deleteDuty(row)" type="primary" size="small">删除</Button> <Button @click="deleteDuty(row)" type="primary" size="small">删除</Button>
</div> </div>
...@@ -106,6 +115,7 @@ ...@@ -106,6 +115,7 @@
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"
...@@ -252,6 +262,15 @@ ...@@ -252,6 +262,15 @@
<!-- <Button type="primary" @click="dutyModelImportOK" :loading="loadingStatus">确定</Button>--> <!-- <Button type="primary" @click="dutyModelImportOK" :loading="loadingStatus">确定</Button>-->
</template> </template>
</Modal> </Modal>
<!-- 导出模板Modal -->
<Modal
v-model="exportModalShow"
:mask-closable="false"
title="模板导出"
@on-ok="exportTemplate">
<span>模板年月:</span><DatePicker v-model="tempYearMonth" type="month" format="yyyy-MM" placeholder=""/>
</Modal>
</div> </div>
</template> </template>
...@@ -262,6 +281,7 @@ ...@@ -262,6 +281,7 @@
import _ from "lodash"; import _ from "lodash";
import util from '@/libs/util'; import util from '@/libs/util';
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import dayjs from 'dayjs'
export default { export default {
//import引入的组件需要注入到对象中才能使用", //import引入的组件需要注入到对象中才能使用",
...@@ -335,7 +355,7 @@ ...@@ -335,7 +355,7 @@
watch_date: [{type: 'string', required: true, message: '值班日期不能为空!', trigger: 'change'}], watch_date: [{type: 'string', required: true, message: '值班日期不能为空!', trigger: 'change'}],
is_lead: [{type: 'number', required: true, message: '值班权限不能为空!', trigger: 'change'}], is_lead: [{type: 'number', required: true, message: '值班权限不能为空!', trigger: 'change'}],
campusid: [{type: 'string', required: true, message: '值班类型不能为空!', trigger: 'change'}], campusid: [{type: 'string', required: true, message: '值班类型不能为空!', trigger: 'change'}],
watch_hour_id: [{type: 'string', required: true, message: '值班时段不能为空!', trigger: 'change'}], // watch_hour_id: [{type: 'string', required: true, message: '值班时段不能为空!', trigger: 'change'}],
watchtypeid: [{type: 'string', required: true, message: '值班校区不能为空!', trigger: 'change'}], watchtypeid: [{type: 'string', required: true, message: '值班校区不能为空!', trigger: 'change'}],
dept_id: [{type: 'string', required: true, message: '值班部门不能为空!', trigger: 'change'}], dept_id: [{type: 'string', required: true, message: '值班部门不能为空!', trigger: 'change'}],
}, },
...@@ -346,7 +366,7 @@ ...@@ -346,7 +366,7 @@
watch_date: [{type: 'string', required: true, message: '值班日期不能为空!', trigger: 'blur'}], watch_date: [{type: 'string', required: true, message: '值班日期不能为空!', trigger: 'blur'}],
is_lead: [{type: 'number', required: true, message: '值班权限不能为空!', trigger: 'change'}], is_lead: [{type: 'number', required: true, message: '值班权限不能为空!', trigger: 'change'}],
campusid: [{type: 'string', required: true, message: '值班类型不能为空!', trigger: 'change'}], campusid: [{type: 'string', required: true, message: '值班类型不能为空!', trigger: 'change'}],
watch_hour_id: [{type: 'string', required: true, message: '值班时段不能为空!', trigger: 'change'}], // watch_hour_id: [{type: 'string', required: true, message: '值班时段不能为空!', trigger: 'change'}],
watchtypeid: [{type: 'string', required: true, message: '值班校区不能为空!', trigger: 'change'}], watchtypeid: [{type: 'string', required: true, message: '值班校区不能为空!', trigger: 'change'}],
dept_id: [{type: 'string', required: true, message: '值班部门不能为空!', trigger: 'change'}], dept_id: [{type: 'string', required: true, message: '值班部门不能为空!', trigger: 'change'}],
}, },
...@@ -357,7 +377,7 @@ ...@@ -357,7 +377,7 @@
watch_date: [{type: 'string', required: true, message: '值班日期不能为空!', trigger: 'change'}], watch_date: [{type: 'string', required: true, message: '值班日期不能为空!', trigger: 'change'}],
is_lead: [{type: 'number', required: true, message: '值班权限不能为空!', trigger: 'change'}], is_lead: [{type: 'number', required: true, message: '值班权限不能为空!', trigger: 'change'}],
campusid: [{type: 'string', required: true, message: '值班类型不能为空!', trigger: 'change'}], campusid: [{type: 'string', required: true, message: '值班类型不能为空!', trigger: 'change'}],
watch_hour_id: [{type: 'string', required: true, message: '值班时段不能为空!', trigger: 'change'}], // watch_hour_id: [{type: 'string', required: true, message: '值班时段不能为空!', trigger: 'change'}],
watchtypeid: [{type: 'string', required: true, message: '值班校区不能为空!', trigger: 'change'}], watchtypeid: [{type: 'string', required: true, message: '值班校区不能为空!', trigger: 'change'}],
dept_id: [{type: 'string', required: true, message: '值班部门不能为空!', trigger: 'change'}], dept_id: [{type: 'string', required: true, message: '值班部门不能为空!', trigger: 'change'}],
...@@ -399,7 +419,7 @@ ...@@ -399,7 +419,7 @@
endTimeSearch: '', endTimeSearch: '',
}, },
buttonSize: '', buttonSize: '',
searchSlecte: ['值班时段', '值班类型', '值班部门', '值班校区'], searchSlecte: [/*'值班时段',*/ '值班类型', '值班部门', '值班校区'],
cityListAll: [], cityListAll: [],
model1: '', model1: '',
model2: '', model2: '',
...@@ -408,9 +428,21 @@ ...@@ -408,9 +428,21 @@
pageKey: 1, pageKey: 1,
total: 0, total: 0,
page_index: 1, page_index: 1,
page_size: 10, page_size: 100,
is_lead: 3, is_lead: 3,
columns: [ columns: [
{
type: 'selection',
width: 60,
align: 'center',
fixed: 'left',
},
{
title: "序号",
type: 'index',
width: 80,
align: 'center'
},
{ {
title: "值班日期", title: "值班日期",
key: 'watch_date', key: 'watch_date',
...@@ -467,12 +499,21 @@ ...@@ -467,12 +499,21 @@
{ {
title: "操作", title: "操作",
slot: 'action', slot: 'action',
minWidth: 130, minWidth: 160,
align: 'center', align: 'center',
fixed: 'right'
} }
], ],
data: [], data: [],
// 多选推送已选中列表
pushListSlc: [],
// 导出模板Modal显示
exportModalShow: false,
// 模板导出选择年月
tempYearMonth: '',
}; };
}, },
//监听属性 类似于data概念", //监听属性 类似于data概念",
...@@ -626,6 +667,81 @@ ...@@ -626,6 +667,81 @@
const day = dateObject.getDate() const day = dateObject.getDate()
return `${year}-${month}-${day}` return `${year}-${month}-${day}`
}, },
// table选择
onSelect(val, row) {
// console.log(val, row)
this.pushListSlc.push(row.watchid)
},
onSelectCancel(val, row) {
// console.log(val, row)
let i = this.pushListSlc.findIndex(a => a == row.watchid)
this.pushListSlc.splice(i, 1)
},
onSelectAll(val) {
// console.log(val)
this.pushListSlc = val.map(a => a.watchid)
},
onSelectAllCancel(val) {
// console.log(val)
this.pushListSlc = []
},
// 批量推送
batchPush() {
if (this.pushListSlc.length == 0) {
this.$Message.warning({
content: '请选择要推送的人员',
background: true,
})
return
}
this.$Modal.confirm({
title: '提示',
content: '是否确认推送?',
loading: true,
onOk: () => {
this.pushM(this.pushListSlc).then(() =>{
this.$Modal.remove()
this.getWatchList()
})
}
})
},
// 推送行
pushDuty(row) {
// console.log('推送行', row)
this.$Modal.confirm({
title: '提示',
content: '是否确认推送?',
loading: true,
onOk: () => {
this.pushM([row.watchid]).then(() => {
this.$Modal.remove()
})
}
})
},
// 推送方法
pushM(data) {
return new Promise(resolve => {
api.WatchSendMeg(data).then(res => {
// console.log('推送行res', res)
if (res. code == 1) {
this.$Message.success({
content: res.msg,
background: true
})
} else {
this.$Message.error({
content: res.msg_detail,
background: true
})
}
}).finally(() => {
resolve()
})
})
},
updateDuty(e) { updateDuty(e) {
// this.addDutySearchSelectList() // this.addDutySearchSelectList()
this.updateDutyFrom = _.cloneDeep(e) this.updateDutyFrom = _.cloneDeep(e)
...@@ -673,6 +789,15 @@ ...@@ -673,6 +789,15 @@
asyncCancel() { asyncCancel() {
this.addDuty = false this.addDuty = false
}, },
// 导出模板
exportTemplate() {
// console.log('导出模板', this.tempYearMonth)
let date = dayjs(this.tempYearMonth).format('YYYY-MM').split('-')
api.WatchImportTemplate(date[0], date[1]).then(res => {
// console.log('导出模板', res)
window.open(res.response)
})
},
async handleButtonClick(name) { async handleButtonClick(name) {
switch (name) { switch (name) {
case 'addDuty' : case 'addDuty' :
...@@ -701,7 +826,7 @@ ...@@ -701,7 +826,7 @@
Promise.all([ Promise.all([
this.getSearchSelectListPromiseAllAction("dutyType", '值班类型', "watchtypeid", api.GetWatchTypeSelect), this.getSearchSelectListPromiseAllAction("dutyType", '值班类型', "watchtypeid", api.GetWatchTypeSelect),
this.getSearchSelectListPromiseAllAction("dutyHourTime", '值班时段', "watch_hour_id", api.GetWatchHourTime), // this.getSearchSelectListPromiseAllAction("dutyHourTime", '值班时段', "watch_hour_id", api.GetWatchHourTime),
this.getSearchSelectListPromiseAllAction("campusname", '值班校区', "campusid", api.GetWatchCampusSelect), this.getSearchSelectListPromiseAllAction("campusname", '值班校区', "campusid", api.GetWatchCampusSelect),
this.getSearchSelectListPromiseAllAction("dept_name", '值班部门', "dept_id", api.GetWatchDepSelect), this.getSearchSelectListPromiseAllAction("dept_name", '值班部门', "dept_id", api.GetWatchDepSelect),
]) ])
...@@ -754,6 +879,7 @@ ...@@ -754,6 +879,7 @@
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 console.log("🚀🚀🚀,", this.initDateTime)//2018/12/6
this.pushListSlc = []
this.$Spin.show() this.$Spin.show()
let data = { let data = {
......
...@@ -34,16 +34,23 @@ ...@@ -34,16 +34,23 @@
ok-text="确认" ok-text="确认"
:mask-closable="false" :mask-closable="false"
> >
<Form :model="formTop" :label-width="80" ref="updateRoleValue"> <Form :model="formTop" :label-width="100" ref="updateRoleValue">
<!-- :rules="ruleValidate"--> <!-- :rules="ruleValidate"-->
<FormItem label="值班类型" prop="input1"> <FormItem label="值班类型" prop="input1">
<Input v-model="formTop.input1"></Input> <Input v-model="formTop.input1"></Input>
</FormItem> </FormItem>
<FormItem label="值班时间" prop="input2">
<Select v-model="formTop.input3" placeholder="">
<Option v-for="item in watchHourTimeList" :key="item.id" :value="item.id">
{{ item.name }}
</Option>
</Select>
</FormItem>
<FormItem label="值班类型备注" prop="input2"> <FormItem label="值班类型备注" prop="input2">
<Input v-model="formTop.input2"></Input> <Input v-model="formTop.input2"></Input>
</FormItem> </FormItem>
<FormItem label="签到类型"> <FormItem label="签到类型">
<Select v-model="formTop.type"> <Select v-model="formTop.type" placeholder="">
<Option :value="0">免打卡</Option> <Option :value="0">免打卡</Option>
<Option :value="1">无定位打卡</Option> <Option :value="1">无定位打卡</Option>
<Option :value="2">定位拍照打卡</Option> <Option :value="2">定位拍照打卡</Option>
...@@ -92,11 +99,13 @@ ...@@ -92,11 +99,13 @@
data() { data() {
//这里存放数据", //这里存放数据",
return { return {
watchHourTimeList: [],
modal: false, modal: false,
formTop: { formTop: {
id: '', id: '',
input1: '', input1: '',
input2: '', input2: '',
input3: '',
type: '', type: '',
}, },
page_size: 10, page_size: 10,
...@@ -113,6 +122,10 @@ ...@@ -113,6 +122,10 @@
title: '值班类型', title: '值班类型',
key: 'watchtypename', key: 'watchtypename',
}, },
{
title: '值班时间',
key: 'watchhourname',
},
{ {
title: '类型备注', title: '类型备注',
key: 'watchtype_remark', key: 'watchtype_remark',
...@@ -148,6 +161,8 @@ ...@@ -148,6 +161,8 @@
let data = { let data = {
"watchtypename": this.input.input1, "watchtypename": this.input.input1,
"watchtype_remark": this.input.input2, "watchtype_remark": this.input.input2,
"watchhour_id": this.input.input3,
"sign_type": this.input.type,
} }
const res = await api.WatchTypeSave(data) const res = await api.WatchTypeSave(data)
await this.GetWatchTypeList() await this.GetWatchTypeList()
...@@ -172,6 +187,7 @@ ...@@ -172,6 +187,7 @@
"watchtypeid": this.formTop.id, "watchtypeid": this.formTop.id,
"watchtypename": this.formTop.input1, "watchtypename": this.formTop.input1,
"watchtype_remark": this.formTop.input2, "watchtype_remark": this.formTop.input2,
"watchhour_id": this.formTop.input3,
"sign_type": this.formTop.type, "sign_type": this.formTop.type,
} }
const res = await api.WatchTypeSave(data) const res = await api.WatchTypeSave(data)
...@@ -183,6 +199,7 @@ ...@@ -183,6 +199,7 @@
this.formTop.id = e.watchtypeid; this.formTop.id = e.watchtypeid;
this.formTop.input1 = e.watchtypename; this.formTop.input1 = e.watchtypename;
this.formTop.input2 = e.watchtype_remark this.formTop.input2 = e.watchtype_remark
this.formTop.input3 = e.watchhour_id
this.formTop.type = e.sign_type this.formTop.type = e.sign_type
this.modal = true this.modal = true
}, },
...@@ -271,6 +288,11 @@ ...@@ -271,6 +288,11 @@
//生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染 //生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染
mounted() { mounted() {
this.GetWatchTypeList() this.GetWatchTypeList()
// 获取值班时段(选择框)
api.GetWatchHourTime().then(res => {
// console.log('获取值班时段(选择框)', res)
this.watchHourTimeList = res.response
})
}, },
//生命周期 - 更新之前",数据模型已更新,html模板未更新 //生命周期 - 更新之前",数据模型已更新,html模板未更新
......
...@@ -56,9 +56,23 @@ ...@@ -56,9 +56,23 @@
<FormItem v-if="showComponent.type" label="值班名称" prop="input1"> <FormItem v-if="showComponent.type" label="值班名称" prop="input1">
<Input v-model="formTop.input1"></Input> <Input v-model="formTop.input1"></Input>
</FormItem> </FormItem>
<FormItem v-if="showComponent.type" label="值班时间" prop="input3">
<Select v-model="formTop.input3" placeholder="">
<Option v-for="item in watchHourTimeList" :key="item.id" :value="item.id">
{{ item.name }}
</Option>
</Select>
</FormItem>
<FormItem v-if="showComponent.type" label="值班备注" prop="input2"> <FormItem v-if="showComponent.type" label="值班备注" prop="input2">
<Input v-model="formTop.input2"></Input> <Input v-model="formTop.input2"></Input>
</FormItem> </FormItem>
<FormItem v-if="showComponent.type" label="签到类型">
<Select v-model="formTop.type" placeholder="">
<Option :value="0">免打卡</Option>
<Option :value="1">无定位打卡</Option>
<Option :value="2">定位拍照打卡</Option>
</Select>
</FormItem>
<!--校区--> <!--校区-->
<FormItem v-if="showComponent.campus" label="校区名称" prop="input1"> <FormItem v-if="showComponent.campus" label="校区名称" prop="input1">
<Input v-model="formTop.input1"></Input> <Input v-model="formTop.input1"></Input>
...@@ -104,6 +118,7 @@ ...@@ -104,6 +118,7 @@
</template> </template>
<script> <script>
import * as api from '@/api/lezRequest.js'
import watchType from '@/pages/systemConfiguration/component/initialComponent/watchType.vue' import watchType from '@/pages/systemConfiguration/component/initialComponent/watchType.vue'
import Campus from '@/pages/systemConfiguration/component/initialComponent/Campus.vue' import Campus from '@/pages/systemConfiguration/component/initialComponent/Campus.vue'
import MessageConfig from '@/pages/systemConfiguration/component/initialComponent/MessageConfig.vue' import MessageConfig from '@/pages/systemConfiguration/component/initialComponent/MessageConfig.vue'
...@@ -125,6 +140,7 @@ ...@@ -125,6 +140,7 @@
//这里存放数据", //这里存放数据",
return { return {
// spinShow:true, // spinShow:true,
watchHourTimeList: [],
showComponent: { showComponent: {
type: true, type: true,
time: false, time: false,
...@@ -139,6 +155,8 @@ ...@@ -139,6 +155,8 @@
formTop: { //值班类型数据对象 formTop: { //值班类型数据对象
input1: '', input1: '',
input2: '', input2: '',
input3: '',
type: '',
flag: false, // 增添modal确认按钮 flag flag: false, // 增添modal确认按钮 flag
searchFlag: false, // 点击查找 按钮flag searchFlag: false, // 点击查找 按钮flag
timeName1: '' timeName1: ''
...@@ -205,6 +223,8 @@ ...@@ -205,6 +223,8 @@
this.searchValue = '' this.searchValue = ''
this.formTop.input1 = '' this.formTop.input1 = ''
this.formTop.input2 = '' this.formTop.input2 = ''
this.formTop.input3 = ''
this.formTop.type = ''
this.formTop.timeName1 = '' this.formTop.timeName1 = ''
break; break;
case 'info': case 'info':
...@@ -216,6 +236,8 @@ ...@@ -216,6 +236,8 @@
this.searchValue = '' this.searchValue = ''
this.formTop.input1 = '' this.formTop.input1 = ''
this.formTop.input2 = '' this.formTop.input2 = ''
this.formTop.input3 = ''
this.formTop.type = ''
this.formTop.timeName1 = '' this.formTop.timeName1 = ''
break; break;
...@@ -228,6 +250,8 @@ ...@@ -228,6 +250,8 @@
this.searchValue = '' this.searchValue = ''
this.formTop.input1 = '' this.formTop.input1 = ''
this.formTop.input2 = '' this.formTop.input2 = ''
this.formTop.input3 = ''
this.formTop.type = ''
this.formTop.timeName1 = '' this.formTop.timeName1 = ''
break; break;
case 'campus': case 'campus':
...@@ -239,6 +263,8 @@ ...@@ -239,6 +263,8 @@
this.searchValue = '' this.searchValue = ''
this.formTop.input1 = '' this.formTop.input1 = ''
this.formTop.input2 = '' this.formTop.input2 = ''
this.formTop.input3 = ''
this.formTop.type = ''
this.formTop.timeName1 = '' this.formTop.timeName1 = ''
break; break;
case 'attendance': case 'attendance':
...@@ -250,6 +276,8 @@ ...@@ -250,6 +276,8 @@
this.searchValue = '' this.searchValue = ''
this.formTop.input1 = '' this.formTop.input1 = ''
this.formTop.input2 = '' this.formTop.input2 = ''
this.formTop.input3 = ''
this.formTop.type = ''
this.formTop.timeName1 = '' this.formTop.timeName1 = ''
break; break;
} }
...@@ -270,7 +298,11 @@ ...@@ -270,7 +298,11 @@
//生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染 //生命周期 - 挂载完成(可以访问DOM元素)",html模板已渲染
mounted() { mounted() {
// 获取值班时段(选择框)
api.GetWatchHourTime().then(res => {
// console.log('获取值班时段(选择框)', res)
this.watchHourTimeList = res.response
})
}, },
//生命周期 - 更新之前",数据模型已更新,html模板未更新 //生命周期 - 更新之前",数据模型已更新,html模板未更新
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
</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>-->
<Button type="primary" size="small" @click="roleUpdate(row)" style="margin-left: 10px;">修改</Button>
<Button type="error" size="small" @click="roleDelete(row)" style="margin-left: 10px;">删除</Button> <Button type="error" size="small" @click="roleDelete(row)" style="margin-left: 10px;">删除</Button>
</template> </template>
...@@ -82,7 +83,7 @@ ...@@ -82,7 +83,7 @@
:width="800" :width="800"
> >
<div style="display: flex;"> <div style="display: flex; flex-wrap: wrap;">
<CheckboxGroup style="margin-bottom: 15px" v-model="modalSelect.checkboxValue"> <CheckboxGroup style="margin-bottom: 15px" v-model="modalSelect.checkboxValue">
<Checkbox v-for="(item,index) in modalSelect.rList" :label="item.id" :key="index" <Checkbox v-for="(item,index) in modalSelect.rList" :label="item.id" :key="index"
border><span>{{ item.name }}</span></Checkbox> border><span>{{ item.name }}</span></Checkbox>
...@@ -95,6 +96,18 @@ ...@@ -95,6 +96,18 @@
</Button> </Button>
<Button type="text" @click="searchReset" style="margin-left: 10px;">重置</Button> <Button type="text" @click="searchReset" style="margin-left: 10px;">重置</Button>
</div> </div>
<!-- 注意!系部选择框根据[系部干事]是否勾选显示,[系部干事]id不为定值,部署时要跟后端确定改id -->
<!-- watch中、编辑Modal中也有使用到这个id的,注意修改 -->
<div
v-if="modalSelect.checkboxValue.some(a => a == '8169147c-e4b1-41c0-9464-92bf446ec049')"
style="width: 100%; margin-bottom: 15px;">
<span>系部:</span>
<Select style="width: 600px" v-model="modalSelect.deptSlcList" multiple filterable placeholder="">
<Option v-for="item in deptList" :key="item.value" :value="item.value">
{{ item.lable }}
</Option>
</Select>
</div>
</div> </div>
<Table :columns="modalSelect.column" :data="modalSelect.tList" @on-select-all="modalTableSelectAll" <Table :columns="modalSelect.column" :data="modalSelect.tList" @on-select-all="modalTableSelectAll"
...@@ -120,6 +133,32 @@ ...@@ -120,6 +133,32 @@
</template> </template>
</Modal> </Modal>
<!-- 编辑Modal -->
<Modal
v-model="editRoleModalShow"
title="编辑教师权限"
:mask-closable="false"
@on-cancel="editCancel">
<CheckboxGroup style="margin-bottom: 15px" v-model="modalSelect.checkboxValue">
<Checkbox v-for="(item,index) in modalSelect.rList" :label="item.id" :key="index"
border><span>{{ item.name }}</span></Checkbox>
</CheckboxGroup>
<div
v-if="modalSelect.checkboxValue.some(a => a == '8169147c-e4b1-41c0-9464-92bf446ec049')"
style="width: 100%; margin-bottom: 15px;">
<span>系部:</span>
<Select style="width: 445px" v-model="modalSelect.deptSlcList" multiple filterable placeholder="">
<Option v-for="item in deptList" :key="item.value" :value="item.value">
{{ item.lable }}
</Option>
</Select>
</div>
<template #footer>
<Button type="text" @click="editCancel" style="margin-left: 10px;">取消</Button>
<Button type="primary" @click="editSubmit" style="margin-left: 10px;">确认</Button>
</template>
</Modal>
</div> </div>
</template> </template>
...@@ -135,6 +174,10 @@ ...@@ -135,6 +174,10 @@
data() { data() {
//这里存放数据", //这里存放数据",
return { return {
// 系部列表
deptList: [],
// 编辑时选中的userid
userid: '',
modalSelect: { modalSelect: {
pageKey: 1, pageKey: 1,
checkboxValue: [], checkboxValue: [],
...@@ -157,6 +200,8 @@ ...@@ -157,6 +200,8 @@
key: 'number' key: 'number'
} }
], ],
// 已选系部列表
deptSlcList: [],
tList: [], tList: [],
rList: [], rList: [],
tid: [], tid: [],
...@@ -195,10 +240,22 @@ ...@@ -195,10 +240,22 @@
// align: 'center', // align: 'center',
}, },
{
title: '工号',
key: 'card_name'
},
{ {
title: '用户名称', title: '用户名称',
key: 'name' key: 'name'
}, },
{
title: '部门',
key: 'dept'
},
{
title: '电话',
key: 'mobile'
},
{ {
title: '权限名称', title: '权限名称',
slot: 'role_name', slot: 'role_name',
...@@ -215,9 +272,12 @@ ...@@ -215,9 +272,12 @@
title: '操作', title: '操作',
slot: 'action', slot: 'action',
align: 'center', align: 'center',
width: 150,
} }
], ],
data: [] data: [],
// 编辑权限Modal显示
editRoleModalShow: false,
}; };
}, },
//监听属性 类似于data概念", //监听属性 类似于data概念",
...@@ -233,6 +293,10 @@ ...@@ -233,6 +293,10 @@
watch: { watch: {
"modalSelect.checkboxValue"(newValue, oldValue) { "modalSelect.checkboxValue"(newValue, oldValue) {
console.log(newValue) console.log(newValue)
// checkbox没选中[系部干事]时清空系部选择框的值
if (!newValue.some(a => a == '8169147c-e4b1-41c0-9464-92bf446ec049')) {
this.modalSelect.deptSlcList = []
}
}, },
'formTop.input1'(newValue, oldValue) { 'formTop.input1'(newValue, oldValue) {
console.log(newValue) console.log(newValue)
...@@ -277,6 +341,7 @@ ...@@ -277,6 +341,7 @@
let data = { let data = {
tid: this.modalSelect.tid, tid: this.modalSelect.tid,
role: this.modalSelect.checkboxValue, role: this.modalSelect.checkboxValue,
dept_id: this.modalSelect.deptSlcList,
} }
const res = await api.UserInfoSave(data) const res = await api.UserInfoSave(data)
this.modalSelect.modal = false this.modalSelect.modal = false
...@@ -368,6 +433,47 @@ ...@@ -368,6 +433,47 @@
const res = await api.UserInfoDel(data) const res = await api.UserInfoDel(data)
await this.GetUserList() await this.GetUserList()
}, },
// 编辑用户
roleUpdate(row) {
// console.log('编辑用户', row)
this.editRoleModalShow = true
this.userid = row.userid
api.GetUserInfo(this.userid).then(res => {
// console.log('编辑用户res', res)
this.modalSelect.checkboxValue = res.response.roleid.split('|')
this.modalSelect.deptSlcList = res.response.admin_dept_id.split('|')
})
},
// 编辑用户提交
editSubmit() {
let data = {
userid: this.userid,
role: this.modalSelect.checkboxValue,
dept_id: this.modalSelect.deptSlcList
}
this.$Modal.confirm({
title: '提示',
content: '是否确认修改?',
loading: true,
onOk: () => {
api.UserUpdateSave(data).then(res => {
console.log('编辑用户提交res', res)
if (res.code == 1) {
this.$Message.success({content: res.response, background: true})
this.$Modal.remove()
this.editRoleModalShow = false
this.GetUserList()
}
})
}
})
},
// 编辑用户Modal取消
editCancel() {
this.editRoleModalShow = false
this.modalSelect.checkboxValue = []
this.modalSelect.deptSlcList = []
},
async roleDelete(e) { async roleDelete(e) {
//删除用户 //删除用户
this.formTop.roleId = e.userid; this.formTop.roleId = e.userid;
...@@ -468,6 +574,14 @@ ...@@ -468,6 +574,14 @@
mounted() { mounted() {
this.GetUserList() this.GetUserList()
this.getTorR() this.getTorR()
// 获取值班部门(选择框)
api.GetWatchDepSelect().then(res => {
// console.log('获取值班部门', res)
this.deptList = res.response.map(a => {
return {value: a.id, lable: a.name}
})
})
}, },
//生命周期 - 更新之前",数据模型已更新,html模板未更新 //生命周期 - 更新之前",数据模型已更新,html模板未更新
......
...@@ -14,16 +14,6 @@ import Cookies from 'js-cookie'; ...@@ -14,16 +14,6 @@ import Cookies from 'js-cookie';
Vue.use(VueRouter); Vue.use(VueRouter);
function getUrlKey(name) {
return (
decodeURIComponent(
(new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
location.href
) || [, ""])[1].replace(/\+/g, "%20")
) || null
);
}
// 导出路由 在 main.js 里使用 // 导出路由 在 main.js 里使用
const router = new VueRouter({ const router = new VueRouter({
routes, routes,
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或