Commit 891bbee4 authored by 黄奎's avatar 黄奎

页面修改

parent 13c5735b
...@@ -40,9 +40,9 @@ export function getDutyFrequencyList(data) { ...@@ -40,9 +40,9 @@ export function getDutyFrequencyList(data) {
* 值班事项列表 * 值班事项列表
* @param {JSON参数} data * @param {JSON参数} data
*/ */
export function getDutyItemList(data) { export function queryDutyItemPage(data) {
return request({ return request({
url: '/Duty/GetDutyItemList', url: '/Duty/GetDutyItemPage',
method: 'post', method: 'post',
data data
}) })
......
<template> <template>
<div class="page-body"> <div class="page-body">
<div class="page-content"> <div class="page-content">
<q-table :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table" <q-table :pagination='qMsg' :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table"
separator="none" :data="dataList" :columns="columns" row-key="name" inline :pagination='pagination'> separator="none" :data="dataList" :columns="columns" row-key="name">
<template v-slot:top="props"> <template v-slot:top="props">
<div class="col-2 q-table__title">值班事项管理</div> <div class="col-2 q-table__title">值班事项管理</div>
<q-space /> <q-space />
<div class="page-option"> <div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" @click="show" label="新增事项管理" /> <q-btn color="accent" size="sm" class="q-mr-md" @click="show" label="新增事项管理" />
</div> </div>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td key="ItemName" :props="props"> <q-td key="ItemName" :props="props">
<span v-if="!props.row.isEdit">{{props.row.ItemName}}</span> <span v-if="!props.row.isEdit">{{props.row.ItemName}}</span>
<q-input v-else v-model="props.row.ItemName" dense clearable style="padding-bottom:25px"/> <q-input v-else v-model="props.row.ItemName" dense clearable style="padding-bottom:25px" />
</q-td> </q-td>
<q-td key="ItemType" :props="props"> <q-td key="ItemType" :props="props">
<span v-if="!props.row.isEdit">{{props.row.ItemType==1?'选择':'手动填写'}}</span> <span v-if="!props.row.isEdit">{{props.row.ItemType==1?'选择':'手动填写'}}</span>
<q-select <q-select v-else dense emit-value map-options color="primary" filled clearable option-value="Id"
v-else option-label="Name" :options="itemTypeOptions" v-model="props.row.ItemType" ref="ItemType"
dense :rules="[val => !!val || '请选择事项类型']" />
emit-value </q-td>
map-options <q-td key="ShiftsName" :props="props">
color="primary" <span v-if="!props.row.isEdit">{{props.row.ShiftsName}}</span>
filled <q-select v-else dense emit-value map-options clearable multiple color="primary" filled option-value="Id"
clearable option-label="Name" :options="frequencyOptions" v-model="props.row.Shifts" ref="Shifts"
option-value="Id" :rules="[val => !!val || '请选择归属班次']" />
option-label="Name" </q-td>
:options="itemTypeOptions" <q-td key="SchoolName" :props="props">
v-model="props.row.ItemType" <span v-if="!props.row.isEdit">{{props.row.SchoolName}}</span>
ref="ItemType" <q-select v-else clearable dense emit-value map-options multiple color="primary" filled option-value="SId"
:rules="[val => !!val || '请选择事项类型']" option-label="SName" :options="schoolOptions" v-model="props.row.ItemSchools" ref="school"
/> :rules="[val => !!val || '请选择归属校区']" />
</q-td> </q-td>
<q-td key="ShiftsName" :props="props"> <q-td key="optioned" :props="props">
<span v-if="!props.row.isEdit">{{props.row.ShiftsName}}</span> <q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delClass(props.row.Id)"
<q-select label="删除" />
v-else <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="props.row.isEdit=true"
dense label="编辑" v-if="!props.row.isEdit" />
emit-value <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="save(props.row)"
map-options label="保存" v-if="props.row.isEdit" />
clearable </q-btn>
multiple </q-td>
color="primary" </q-tr>
filled </template>
option-value="Id"
option-label="Name"
:options="frequencyOptions"
v-model="props.row.Shifts"
ref="Shifts"
:rules="[val => !!val || '请选择归属班次']"
/>
</q-td>
<q-td key="SchoolName" :props="props">
<span v-if="!props.row.isEdit">{{props.row.SchoolName}}</span>
<q-select
v-else
clearable
dense
emit-value
map-options
multiple
color="primary"
filled
option-value="SId"
option-label="SName"
:options="schoolOptions"
v-model="props.row.ItemSchools"
ref="school"
:rules="[val => !!val || '请选择归属校区']"
/>
</q-td>
<q-td key="optioned" :props="props">
<q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delClass(props.row.Id)"
label="删除" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="props.row.isEdit=true"
label="编辑" v-if="!props.row.isEdit"/>
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="save(props.row)"
label="保存" v-if="props.row.isEdit"/>
</q-btn>
</q-td>
</q-tr>
</template>
<template v-slot:bottom> <template v-slot:bottom>
</template> </template>
</q-table> </q-table>
<template> <template>
<q-dialog ref="dialog" @hide="onDialogHide" persistent style="max-width:400px"> <q-dialog ref="dialog" @hide="onDialogHide" persistent style="max-width:400px">
<q-card class="q-dialog-plugin" > <q-card class="q-dialog-plugin">
<div class="q-pa-md" > <div class="q-pa-md">
<q-form @submit="onSubmit" class="q-gutter-md"> <q-form @submit="onSubmit" class="q-gutter-md">
<div class="col-6"> <div class="col-6">
<q-input <q-input stack-label dense filled ref="addItemName" v-model="msg.ItemName" label="事项名称" lazy-rules
stack-label :rules="[(val) => (!!val) || '请输入事项名称']" />
dense
filled
ref="addItemName"
v-model="msg.ItemName"
label="事项名称"
lazy-rules
:rules="[(val) => (!!val) || '请输入事项名称']"
/>
</div> </div>
<div class="col-6"> <div class="col-6">
<q-select <q-select stack-label dense emit-value map-options color="primary" filled clearable option-value="Id"
stack-label option-label="Name" :options="itemTypeOptions" v-model="msg.ItemType" ref="addItemType" label="事项类型"
dense :rules="[val => !!val || '请选择事项类型']" />
emit-value
map-options
color="primary"
filled
clearable
option-value="Id"
option-label="Name"
:options="itemTypeOptions"
v-model="msg.ItemType"
ref="addItemType"
label="事项类型"
:rules="[val => !!val || '请选择事项类型']"
/>
</div> </div>
<div class="col-6"> <div class="col-6">
<q-select <q-select stack-label dense emit-value map-options clearable multiple color="primary" filled
stack-label option-value="Id" option-label="Name" :options="frequencyOptions" v-model="msg.Shifts"
dense ref="addShifts" label="归属班次" :rules="[val => !!val || '请选择归属班次']" />
emit-value
map-options
clearable
multiple
color="primary"
filled
option-value="Id"
option-label="Name"
:options="frequencyOptions"
v-model="msg.Shifts"
ref="addShifts"
label="归属班次"
:rules="[val => !!val || '请选择归属班次']"
/>
</div> </div>
<div class="col-6"> <div class="col-6">
<q-select <q-select stack-label clearable dense emit-value map-options multiple color="primary" filled
stack-label option-value="SId" option-label="SName" :options="schoolOptions" v-model="msg.ItemSchools"
clearable ref="addschool" label="校区" :rules="[val => !!val || '请选择归属校区']" />
dense </div>
emit-value
map-options
multiple
color="primary"
filled
option-value="SId"
option-label="SName"
:options="schoolOptions"
v-model="msg.ItemSchools"
ref="addschool"
label="校区"
:rules="[val => !!val || '请选择归属校区']"
/>
</div>
<div style="float:right;margin-bottom:20px"> <div style="float:right;margin-bottom:20px">
<q-btn label="取消" flat class="q-ml-sm" text-color="primary" @click="hide" style="border:1px solid #999"/> <q-btn label="取消" flat class="q-ml-sm" text-color="primary" @click="hide"
<q-btn style="border:1px solid #999" />
label="提交" <q-btn label="提交" type="Submit" color="primary" style="margin-left:10px;" />
type="Submit"
color="primary"
style="margin-left:10px;"
/>
</div> </div>
</q-form> </q-form>
</div> </div>
...@@ -182,13 +91,15 @@ ...@@ -182,13 +91,15 @@
</template> </template>
<script> <script>
import { import {
getDutyItemList, queryDutyItemPage,
removeDutyItem, removeDutyItem,
getItemTypeEnumList, getItemTypeEnumList,
getDutyFrequencyList, getDutyFrequencyList,
getSetDutyItemModel getSetDutyItemModel
} from '../../api/duty/index'; } from '../../api/duty/index';
import { getSchoolDropdown } from '../../api/school/index';//获取校区列表 import {
getSchoolDropdown
} from '../../api/school/index'; //获取校区列表
import AddDutyItem from './addDutyItem'; import AddDutyItem from './addDutyItem';
export default { export default {
...@@ -200,12 +111,9 @@ ...@@ -200,12 +111,9 @@
loading: false, loading: false,
isShowsetForm: false, isShowsetForm: false,
ruleObj: {}, //传入参数 ruleObj: {}, //传入参数
schoolOptions:[],//校区 schoolOptions: [], //校区
itemTypeOptions:[],//事项类型 itemTypeOptions: [], //事项类型
frequencyOptions:[],//班次列表 frequencyOptions: [], //班次列表
pagination:{
rowsPerPage:0
},
columns: [{ columns: [{
name: 'ItemName', name: 'ItemName',
label: '事项名称', label: '事项名称',
...@@ -218,13 +126,13 @@ ...@@ -218,13 +126,13 @@
field: 'ItemType', field: 'ItemType',
align: 'left', align: 'left',
}, },
{ {
name: 'ShiftsName', name: 'ShiftsName',
label: '归属班次', label: '归属班次',
field: 'ShiftsName', field: 'ShiftsName',
align: 'left', align: 'left',
}, },
{ {
name: 'SchoolName', name: 'SchoolName',
label: '归属校区', label: '归属校区',
field: 'SchoolName', field: 'SchoolName',
...@@ -237,12 +145,18 @@ ...@@ -237,12 +145,18 @@
} }
], ],
dataList: [], dataList: [],
msg:{ msg: {
ItemName:"", ItemName: "",
ItemType:"", ItemType: "",
Shifts:[], Shifts: [],
ItemSchools:[] ItemSchools: []
} },
qMsg: {
pageIndex: 1,
pageSize: 5,
rowsPerPage: 5,
},
pageCount: 0,
} }
}, },
mounted() { mounted() {
...@@ -252,38 +166,46 @@ ...@@ -252,38 +166,46 @@
this.getDutyFrequencyList(); this.getDutyFrequencyList();
}, },
methods: { methods: {
//获取值班事项类型枚举 //获取值班事项类型枚举
getItemTypeEnumList(){ getItemTypeEnumList() {
getItemTypeEnumList({}).then(res => { getItemTypeEnumList({}).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.itemTypeOptions = res.Data; this.itemTypeOptions = res.Data;
} }
}) })
}, },
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.getList();
},
//获取数据 //获取数据
getList() { getList() {
getDutyItemList({}).then(res => { queryDutyItemPage(this.qMsg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
var tempData = res.Data.PageData;
res.Data.map(item=>{ this.pageCount = res.Data.PageCount;
tempData.map(item => {
item.Shifts=item.Shifts.split(",").map(_item=>{ _item= parseInt(_item)
return _item item.Shifts = item.Shifts.split(",").map(_item => {
_item = parseInt(_item)
return _item
}) })
item.ItemSchools=item.ItemSchools.split(",").map(_item=>{ _item= parseInt(_item) item.ItemSchools = item.ItemSchools.split(",").map(_item => {
return _item _item = parseInt(_item)
return _item
}) })
item.isEdit=false item.isEdit = false
return item return item
}) })
this.dataList = res.Data; this.dataList = tempData;
} }
}) })
}, },
//删除班次 //删除班次
delClass(id){ delClass(id) {
let that=this let that = this
this.$q.dialog({ this.$q.dialog({
title: '提示信息', title: '提示信息',
message: '是否确定删除?', message: '是否确定删除?',
...@@ -292,25 +214,27 @@ ...@@ -292,25 +214,27 @@
ok: "确定", ok: "确定",
cancel: "取消", cancel: "取消",
}).onOk(() => { }).onOk(() => {
removeDutyItem({Id:id.toString()}).then((res)=>{ removeDutyItem({
that.$q.notify({ Id: id.toString()
}).then((res) => {
that.$q.notify({
icon: 'iconfont icon-chenggong', icon: 'iconfont icon-chenggong',
// color: 'accent', // color: 'accent',
timeout: 2000, timeout: 2000,
message: res.Message, message: res.Message,
position: 'top' position: 'top'
}) })
that.getList() that.getList()
}) })
}).onCancel(() => { }).onCancel(() => {
}); });
}, },
//获取校区列表 //获取校区列表
getCompanyList() { getCompanyList() {
getSchoolDropdown({}).then(res => { getSchoolDropdown({}).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
...@@ -319,76 +243,77 @@ ...@@ -319,76 +243,77 @@
}) })
}, },
//获取班次列表 //获取班次列表
getDutyFrequencyList(){ getDutyFrequencyList() {
getDutyFrequencyList({}).then(res => { getDutyFrequencyList({}).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.frequencyOptions = res.Data; this.frequencyOptions = res.Data;
} }
}) })
}, },
save(item){ save(item) {
let msg=JSON.parse(JSON.stringify(item)) let msg = JSON.parse(JSON.stringify(item))
if(item.isEdit){ if (item.isEdit) {
item.isEdit=false item.isEdit = false
} }
msg.Shifts=item.Shifts.join(",") msg.Shifts = item.Shifts.join(",")
msg.ItemSchools=item.ItemSchools.join(",") msg.ItemSchools = item.ItemSchools.join(",")
getSetDutyItemModel(msg).then((res)=>{ getSetDutyItemModel(msg).then((res) => {
this.getList(); this.getList();
}) })
}, },
//对话框 //对话框
show() { show() {
this.$refs.dialog.show(); this.$refs.dialog.show();
}, },
hide() { hide() {
this.$refs.dialog.hide(); this.$refs.dialog.hide();
}, },
onDialogHide() { onDialogHide() {
// QDialog发出“hide”事件时 // QDialog发出“hide”事件时
// 需要发出 // 需要发出
this.$emit("hide"); this.$emit("hide");
}, },
onCancelClick() { onCancelClick() {
// 我们只需要隐藏对话框 // 我们只需要隐藏对话框
this.hide(); this.hide();
}, },
onSubmit() {
this.$refs.addItemName.validate();
this.$refs.addItemType.validate();
this.$refs.addShifts.validate();
this.$refs.addschool.validate();
if (!this.$refs.addItemName.hasError &&
!this.$refs.addItemType.hasError &&
!this.$refs.addShifts.hasError &&
!this.$refs.addschool.hasError) {
let msg=JSON.parse(JSON.stringify(this.msg))
msg.ItemSchools=this.msg.ItemSchools.toString(),
msg.Shifts=this.msg.Shifts.toString(),
getSetDutyItemModel(msg).then((res)=>{
this.getList(); onSubmit() {
this.hide(); this.$refs.addItemName.validate();
}) this.$refs.addItemType.validate();
this.$refs.addShifts.validate();
this.$refs.addschool.validate();
if (!this.$refs.addItemName.hasError &&
!this.$refs.addItemType.hasError &&
!this.$refs.addShifts.hasError &&
!this.$refs.addschool.hasError) {
let msg = JSON.parse(JSON.stringify(this.msg))
msg.ItemSchools = this.msg.ItemSchools.toString(),
msg.Shifts = this.msg.Shifts.toString(),
getSetDutyItemModel(msg).then((res) => {
this.getList();
this.hide();
})
}
},
}
},
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg-white { .bg-white {
background-color: #ffffff; background-color: #ffffff;
} }
@import url('~assets/css/table.sass') @import url('~assets/css/table.sass')
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment