Commit 4db10ca3 authored by 黄奎's avatar 黄奎

页面修改

parent 7bd1554a
...@@ -88,14 +88,27 @@ export function getItemTypeEnumList(data) { ...@@ -88,14 +88,27 @@ export function getItemTypeEnumList(data) {
* 新增/修改值班事项 * 新增/修改值班事项
* @param {JSON参数} data * @param {JSON参数} data
*/ */
export function getSetDutyItemModel(data) { export function saveDutyItem(data) {
return request({ return request({
url: '/Duty/GetSetDutyItemModel', url: '/Duty/SetDutyItem',
method: 'post', method: 'post',
data data
}) })
} }
/**
* 根据编号值班事项信息
* @param {JSON参数} data
*/
export function queryDutyItemInfo(data) {
return request({
url: '/Duty/GetDutyItem',
method: 'post',
data
})
}
/** /**
* 根据班次获取学校信息 * 根据班次获取学校信息
* @param {JSON参数} data * @param {JSON参数} data
......
<template> <template>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale"> <q-dialog v-model="persistent" content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:800px;"> <q-card style="width: 800px;max-width:800px;">
<q-card-section> <q-card-section>
<div class="text-h6">{{(saveObj&&saveObj.Id>0)?"修改值班事项":"新增值班事项"}}</div> <div class="text-h6">{{(saveObj&&saveObj.Id>0)?"修改值班事项":"新增值班事项"}}</div>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<q-card-section class="q-pt-none scroll" style="max-height: 70vh"> <q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap"> <div class="row wrap">
<div class="col-6"> <div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.ItemName" ref="ItemName" <q-input filled stack-label max-length="20" :dense="false" v-model="msg.ItemName" ref="ItemName"
class="col-6 q-pr-lg q-pb-lg" label="事项名称" :rules="[val => !!val || '请填写事项名称']" /> class="col-6 q-pr-lg q-pb-lg" label="事项名称" :rules="[val => !!val || '请填写事项名称']" />
</div> </div>
<div class="col-6"> <div class="col-6">
...@@ -38,10 +38,12 @@ ...@@ -38,10 +38,12 @@
<script> <script>
import { import {
getSetDutyItemModel, saveDutyItem,
queryDutyItemInfo,
getSchoolListByFrequencyIds, getSchoolListByFrequencyIds,
getDutyFrequencyBySchoolIds, getDutyFrequencyBySchoolIds,
getDutyFrequencyList getItemTypeEnumList,
getDutyFrequencyList,
} from "../../api/duty/index" } from "../../api/duty/index"
import { import {
getSchoolDropdown getSchoolDropdown
...@@ -52,60 +54,85 @@ ...@@ -52,60 +54,85 @@
type: Object, type: Object,
default: null default: null
}, },
itemTypeOptions: {
type: Array,
default: []
},
}, },
data() { data() {
return { return {
itemArr: [], itemArr: [],
FrequencyArr: [], FrequencyArr: [], //多选班次列表
schoolArr: [], schoolArr: [], //多选校区列表
msg: { msg: {
Id: 0, Id: 0,
ItemName: "", ItemName: "",
ItemSchools: "", ItemSchools: "",
ItemType: "", ItemType: 0,
Shifts: "" Shifts: ""
}, },
persistent: true, persistent: true,
schoolOptions: [], schoolOptions: [],
frequencyOptions: [], frequencyOptions: [],
itemTypeOptions: [],
} }
}, },
computed: {}, computed: {},
created() { created() {
this.getCompanyList(); this.getCompanyList();
this.getDutyFrequencyList(); this.getDutyFrequencyList();
this.queryItemTypeEnumList();
}, },
mounted() { mounted() {
this.initObj();
},
methods: {
initObj() {
if (this.saveObj && this.saveObj.Id > 0) { if (this.saveObj && this.saveObj.Id > 0) {
let schoolids = this.saveObj.ItemSchools.split(","); queryDutyItemInfo({
this.schoolArr = [] Id: this.saveObj.Id
schoolids.map((item) => { }).then(res => {
this.schoolOptions.map((_item) => { if (res.Code == 1) {
if (_item.SId == item) { var tempData = res.Data;
this.schoolArr.push(_item) if (tempData) {
this.msg.Id = tempData.Id;
this.msg.ItemName = tempData.ItemName;
this.msg.ItemSchools = tempData.ItemSchools;
this.msg.ItemType = tempData.ItemType;
this.msg.Shifts = tempData.Shifts;
if (tempData.ShiftList && tempData.ShiftList.length > 0) {
this.FrequencyArr = tempData.ShiftList;
}
if (tempData.SchoolList && tempData.SchoolList.length > 0) {
this.schoolArr = tempData.SchoolList;
}
} }
})
})
let frequencyids = this.saveObj.Shifts.split(",");
this.FrequencyArr = []
frequencyids.map((item) => {
this.frequencyOptions.map((_item) => {
if (_item.Id == item) {
this.FrequencyArr.push(_item)
} }
}) })
} else {
this.clearMsg();
}
},
//获取班次列表
getDutyFrequencyList() {
getDutyFrequencyList({}).then(res => {
if (res.Code == 1) {
this.frequencyOptions = res.Data;
}
}) })
this.msg.Id = this.saveObj.Id; },
this.msg.ItemName = this.saveObj.ItemName; //获取值班事项类型枚举
this.msg.ItemType = this.saveObj.ItemType; queryItemTypeEnumList() {
getItemTypeEnumList({}).then(res => {
if (res.Code == 1) {
this.itemTypeOptions = res.Data;
} }
})
},
//清空消息
clearMsg() {
this.msg.Id = 0;
this.msg.ItemName = "";
this.msg.ItemSchools = "";
this.msg.ItemType = "";
this.msg.Shifts = "";
}, },
methods: {
//保存信息 //保存信息
saveRule() { saveRule() {
this.$refs.ItemName.validate(); this.$refs.ItemName.validate();
...@@ -117,8 +144,9 @@ ...@@ -117,8 +144,9 @@
!this.$refs.Shifts.hasError && !this.$refs.Shifts.hasError &&
!this.$refs.ItemSchools.hasError) { !this.$refs.ItemSchools.hasError) {
this.msg.ItemSchools = this.schoolArr.map(item => item.SId).toString(); this.msg.ItemSchools = this.schoolArr.map(item => item.SId).toString();
getSetDutyItemModel(this.msg).then(res => { saveDutyItem(this.msg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.clearMsg();
this.$emit('success'); this.$emit('success');
this.closeRuleForm(); this.closeRuleForm();
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale"> <q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:800px;"> <q-card style="width: 800px;max-width:800px;">
<q-card-section> <q-card-section>
<div class="text-h6">{{(saveObj&&saveObj.Id>0)?"修改设置":"新增设置"}}</div> <div class="text-h6">{{(saveObj&&saveObj.Id>0)?"修改值班设置":"新增值班设置"}}</div>
</q-card-section> </q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh"> <q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap"> <div class="row wrap">
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
MachineCode: "", MachineCode: "",
Shifts: '', Shifts: '',
SendEmployeeIds: "", //突发事件抄送人员 SendEmployeeIds: "", //突发事件抄送人员
School_Id: -1, School_Id: "",
}, },
frequencyOptions: [], //班次列表 frequencyOptions: [], //班次列表
persistent: true, persistent: true,
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<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="addModule(null)" label="新增" /> <q-btn color="accent" size="sm" class="q-mr-md" @click="addModule(null)" label="新增班次" />
</div> </div>
</template> </template>
<template v-slot:bottom> <template v-slot:bottom>
...@@ -29,11 +29,10 @@ ...@@ -29,11 +29,10 @@
</template> </template>
<template v-slot:body-cell-optioned="props"> <template v-slot:body-cell-optioned="props">
<q-td :props="props" style="width:200px;"> <q-td :props="props" style="width:200px;">
<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="addModule(props.row)" <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="addModule(props.row)"
label="编辑" /> label="编辑" />
</q-btn> <q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delClass(props.row.Id)"
label="删除" />
</q-td> </q-td>
</template> </template>
</q-table> </q-table>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<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="EditItem(null)" label="新增事项管理" />
</div> </div>
</template> </template>
<template v-slot:bottom> <template v-slot:bottom>
...@@ -30,83 +30,36 @@ ...@@ -30,83 +30,36 @@
<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> {{props.row.ItemName}}
<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> {{props.row.ItemType==1?'选择':'手动填写'}}
<q-select v-else dense emit-value map-options color="primary" filled clearable option-value="Id"
option-label="Name" :options="itemTypeOptions" v-model="props.row.ItemType" ref="ItemType"
:rules="[val => !!val || '请选择事项类型']" />
</q-td> </q-td>
<q-td key="ShiftsName" :props="props"> <q-td key="ShiftsName" :props="props">
<span v-if="!props.row.isEdit">{{props.row.ShiftsName}}</span> {{props.row.ShiftsName}}
<q-select v-else dense emit-value map-options clearable multiple color="primary" filled option-value="Id"
option-label="Name" :options="frequencyOptions" v-model="props.row.Shifts" ref="Shifts"
:rules="[val => !!val || '请选择归属班次']" />
</q-td> </q-td>
<q-td key="SchoolName" :props="props"> <q-td key="SchoolName" :props="props">
<span v-if="!props.row.isEdit">{{props.row.SchoolName}}</span> {{props.row.SchoolName}}
<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>
<q-td key="optioned" :props="props"> <q-td key="optioned" :props="props">
<q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delClass(props.row.Id)" <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="EditItem(props.row)"
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" /> label="编辑" v-if="!props.row.isEdit" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="save(props.row)" <q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delItem(props.row.Id)"
label="保存" v-if="props.row.isEdit" /> label="删除" />
</q-btn> </q-btn>
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
</q-table> </q-table>
<template>
<q-dialog ref="dialog" @hide="onDialogHide" persistent style="max-width:400px">
<q-card class="q-dialog-plugin">
<div class="q-pa-md">
<q-form @submit="onSubmit" class="q-gutter-md">
<div class="col-6">
<q-input stack-label dense filled ref="addItemName" v-model="msg.ItemName" label="事项名称" lazy-rules
:rules="[(val) => (!!val) || '请输入事项名称']" />
</div>
<div class="col-6">
<q-select stack-label dense 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 class="col-6">
<q-select stack-label dense 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 class="col-6">
<q-select stack-label clearable dense 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">
<q-btn label="取消" flat class="q-ml-sm" text-color="primary" @click="hide"
style="border:1px solid #999" />
<q-btn label="提交" type="Submit" color="primary" style="margin-left:10px;" />
</div>
</q-form>
</div>
</q-card>
</q-dialog>
</template>
</div> </div>
<AddDutyItem v-if="isShowAdd" @close="resetSearch" :save-obj="itemObj" @success="resetSearch">
</AddDutyItem>
</div> </div>
</template> </template>
<script> <script>
import { import {
queryDutyItemPage, queryDutyItemPage,
removeDutyItem, removeDutyItem,
getItemTypeEnumList,
getDutyFrequencyList,
getSetDutyItemModel
} from '../../api/duty/index'; } from '../../api/duty/index';
import { import {
getSchoolDropdown getSchoolDropdown
...@@ -121,8 +74,6 @@ ...@@ -121,8 +74,6 @@
return { return {
loading: false, loading: false,
schoolOptions: [], //校区 schoolOptions: [], //校区
itemTypeOptions: [], //事项类型
frequencyOptions: [], //班次列表
columns: [{ columns: [{
name: 'ItemName', name: 'ItemName',
label: '事项名称', label: '事项名称',
...@@ -154,12 +105,6 @@ ...@@ -154,12 +105,6 @@
} }
], ],
dataList: [], dataList: [],
msg: {
ItemName: "",
ItemType: "",
Shifts: [],
ItemSchools: []
},
qMsg: { qMsg: {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
...@@ -168,23 +113,17 @@ ...@@ -168,23 +113,17 @@
ItemSchools: [], //所属校区 ItemSchools: [], //所属校区
}, },
pageCount: 0, pageCount: 0,
isShowAdd: false, //是否显示添加事项弹窗
itemObj: {}, //事项对象
} }
}, },
created() {
this.getCompanyList();
},
mounted() { mounted() {
this.getList(); this.getList();
this.getItemTypeEnumList();
this.getCompanyList();
this.getDutyFrequencyList();
}, },
methods: { methods: {
//获取值班事项类型枚举
getItemTypeEnumList() {
getItemTypeEnumList({}).then(res => {
if (res.Code == 1) {
this.itemTypeOptions = res.Data;
}
})
},
//重新查询 //重新查询
resetSearch() { resetSearch() {
this.qMsg.pageIndex = 1; this.qMsg.pageIndex = 1;
...@@ -199,26 +138,13 @@ ...@@ -199,26 +138,13 @@
getList() { getList() {
queryDutyItemPage(this.qMsg).then(res => { queryDutyItemPage(this.qMsg).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
var tempData = res.Data.PageData;
this.pageCount = res.Data.PageCount; this.pageCount = res.Data.PageCount;
tempData.map(item => { this.dataList = res.Data.PageData;;
item.Shifts = item.Shifts.split(",").map(_item => {
_item = parseInt(_item)
return _item
})
item.ItemSchools = item.ItemSchools.split(",").map(_item => {
_item = parseInt(_item)
return _item
})
item.isEdit = false
return item
})
this.dataList = tempData;
} }
}) })
}, },
//删除班次 //删除值班事项
delClass(id) { delItem(id) {
let that = this let that = this
this.$q.dialog({ this.$q.dialog({
title: '提示信息', title: '提示信息',
...@@ -239,11 +165,8 @@ ...@@ -239,11 +165,8 @@
}) })
that.getList() that.getList()
}) })
}).onCancel(() => { }).onCancel(() => {});
});
}, },
//获取校区列表 //获取校区列表
getCompanyList() { getCompanyList() {
getSchoolDropdown({}).then(res => { getSchoolDropdown({}).then(res => {
...@@ -252,56 +175,10 @@ ...@@ -252,56 +175,10 @@
} }
}) })
}, },
//获取班次列表
getDutyFrequencyList() {
getDutyFrequencyList({}).then(res => {
if (res.Code == 1) {
this.frequencyOptions = res.Data;
}
})
},
save(item) {
let msg = JSON.parse(JSON.stringify(item))
if (item.isEdit) {
item.isEdit = false
}
msg.Shifts = item.Shifts.join(",")
msg.ItemSchools = item.ItemSchools.join(",")
getSetDutyItemModel(msg).then((res) => {
this.getList();
})
},
//对话框 //对话框
show() { EditItem(obj) {
this.$refs.dialog.show(); this.isShowAdd = true;
}, this.itemObj = obj;
hide() {
this.$refs.dialog.hide();
},
onDialogHide() {
this.$emit("hide");
},
onCancelClick() {
// 我们只需要隐藏对话框
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();
this.hide();
})
}
}, },
} }
} }
......
...@@ -16,18 +16,17 @@ ...@@ -16,18 +16,17 @@
<div class="col-2 q-table__title">设置</div> <div class="col-2 q-table__title">设置</div>
<q-space /> <q-space />
<div class="page-option" style="display:flex"> <div class="page-option" style="display:flex">
<q-btn color="accent" size="sm" class="q-mr-md" @click="addModule(null)" label="新增" /> <q-btn color="accent" size="sm" class="q-mr-md" @click="addModule(null)" label="新增设置" />
</div> </div>
</template> </template>
<template v-slot:bottom> <template v-slot:bottom>
</template> </template>
<template v-slot:body-cell-optioned="props"> <template v-slot:body-cell-optioned="props">
<q-td :props="props" style="width:200px;"> <q-td :props="props" style="width:200px;">
<q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delSet(props.row.Id)"
label="删除" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="addModule(props.row)" <q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="addModule(props.row)"
label="编辑" /> label="编辑" />
</q-btn> <q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delSet(props.row.Id)"
label="删除" />
</q-td> </q-td>
</template> </template>
</q-table> </q-table>
......
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