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

页面修改

parent 7bd1554a
......@@ -88,14 +88,27 @@ export function getItemTypeEnumList(data) {
* 新增/修改值班事项
* @param {JSON参数} data
*/
export function getSetDutyItemModel(data) {
export function saveDutyItem(data) {
return request({
url: '/Duty/GetSetDutyItemModel',
url: '/Duty/SetDutyItem',
method: 'post',
data
})
}
/**
* 根据编号值班事项信息
* @param {JSON参数} data
*/
export function queryDutyItemInfo(data) {
return request({
url: '/Duty/GetDutyItem',
method: 'post',
data
})
}
/**
* 根据班次获取学校信息
* @param {JSON参数} data
......
<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-section>
<div class="text-h6">{{(saveObj&&saveObj.Id>0)?"修改值班事项":"新增值班事项"}}</div>
......@@ -7,7 +7,7 @@
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<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 || '请填写事项名称']" />
</div>
<div class="col-6">
......@@ -38,10 +38,12 @@
<script>
import {
getSetDutyItemModel,
saveDutyItem,
queryDutyItemInfo,
getSchoolListByFrequencyIds,
getDutyFrequencyBySchoolIds,
getDutyFrequencyList
getItemTypeEnumList,
getDutyFrequencyList,
} from "../../api/duty/index"
import {
getSchoolDropdown
......@@ -52,60 +54,85 @@
type: Object,
default: null
},
itemTypeOptions: {
type: Array,
default: []
},
},
data() {
return {
itemArr: [],
FrequencyArr: [],
schoolArr: [],
FrequencyArr: [], //多选班次列表
schoolArr: [], //多选校区列表
msg: {
Id: 0,
ItemName: "",
ItemSchools: "",
ItemType: "",
ItemType: 0,
Shifts: ""
},
persistent: true,
schoolOptions: [],
frequencyOptions: [],
itemTypeOptions: [],
}
},
computed: {},
created() {
this.getCompanyList();
this.getDutyFrequencyList();
this.queryItemTypeEnumList();
},
mounted() {
this.initObj();
},
methods: {
initObj() {
if (this.saveObj && this.saveObj.Id > 0) {
let schoolids = this.saveObj.ItemSchools.split(",");
this.schoolArr = []
schoolids.map((item) => {
this.schoolOptions.map((_item) => {
if (_item.SId == item) {
this.schoolArr.push(_item)
queryDutyItemInfo({
Id: this.saveObj.Id
}).then(res => {
if (res.Code == 1) {
var tempData = res.Data;
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() {
this.$refs.ItemName.validate();
......@@ -117,8 +144,9 @@
!this.$refs.Shifts.hasError &&
!this.$refs.ItemSchools.hasError) {
this.msg.ItemSchools = this.schoolArr.map(item => item.SId).toString();
getSetDutyItemModel(this.msg).then(res => {
saveDutyItem(this.msg).then(res => {
if (res.Code == 1) {
this.clearMsg();
this.$emit('success');
this.closeRuleForm();
}
......
......@@ -2,7 +2,7 @@
<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-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 class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
......@@ -73,7 +73,7 @@
MachineCode: "",
Shifts: '',
SendEmployeeIds: "", //突发事件抄送人员
School_Id: -1,
School_Id: "",
},
frequencyOptions: [], //班次列表
persistent: true,
......
......@@ -20,7 +20,7 @@
<div class="col-2 q-table__title">班次管理</div>
<q-space />
<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>
</template>
<template v-slot:bottom>
......@@ -29,11 +29,10 @@
</template>
<template v-slot:body-cell-optioned="props">
<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)"
label="编辑" />
</q-btn>
<q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delClass(props.row.Id)"
label="删除" />
</q-td>
</template>
</q-table>
......
......@@ -20,7 +20,7 @@
<div class="col-2 q-table__title">值班事项管理</div>
<q-space />
<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>
</template>
<template v-slot:bottom>
......@@ -30,83 +30,36 @@
<template v-slot:body="props">
<q-tr :props="props">
<q-td key="ItemName" :props="props">
<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" />
{{props.row.ItemName}}
</q-td>
<q-td key="ItemType" :props="props">
<span v-if="!props.row.isEdit">{{props.row.ItemType==1?'选择':'手动填写'}}</span>
<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 || '请选择事项类型']" />
{{props.row.ItemType==1?'选择':'手动填写'}}
</q-td>
<q-td key="ShiftsName" :props="props">
<span v-if="!props.row.isEdit">{{props.row.ShiftsName}}</span>
<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 || '请选择归属班次']" />
{{props.row.ShiftsName}}
</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 || '请选择归属校区']" />
{{props.row.SchoolName}}
</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"
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="EditItem(props.row)"
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 flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delItem(props.row.Id)"
label="删除" />
</q-btn>
</q-td>
</q-tr>
</template>
</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>
<AddDutyItem v-if="isShowAdd" @close="resetSearch" :save-obj="itemObj" @success="resetSearch">
</AddDutyItem>
</div>
</template>
<script>
import {
queryDutyItemPage,
removeDutyItem,
getItemTypeEnumList,
getDutyFrequencyList,
getSetDutyItemModel
} from '../../api/duty/index';
import {
getSchoolDropdown
......@@ -121,8 +74,6 @@
return {
loading: false,
schoolOptions: [], //校区
itemTypeOptions: [], //事项类型
frequencyOptions: [], //班次列表
columns: [{
name: 'ItemName',
label: '事项名称',
......@@ -154,12 +105,6 @@
}
],
dataList: [],
msg: {
ItemName: "",
ItemType: "",
Shifts: [],
ItemSchools: []
},
qMsg: {
pageIndex: 1,
pageSize: 10,
......@@ -168,23 +113,17 @@
ItemSchools: [], //所属校区
},
pageCount: 0,
isShowAdd: false, //是否显示添加事项弹窗
itemObj: {}, //事项对象
}
},
created() {
this.getCompanyList();
},
mounted() {
this.getList();
this.getItemTypeEnumList();
this.getCompanyList();
this.getDutyFrequencyList();
},
methods: {
//获取值班事项类型枚举
getItemTypeEnumList() {
getItemTypeEnumList({}).then(res => {
if (res.Code == 1) {
this.itemTypeOptions = res.Data;
}
})
},
//重新查询
resetSearch() {
this.qMsg.pageIndex = 1;
......@@ -199,26 +138,13 @@
getList() {
queryDutyItemPage(this.qMsg).then(res => {
if (res.Code == 1) {
var tempData = res.Data.PageData;
this.pageCount = res.Data.PageCount;
tempData.map(item => {
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;
this.dataList = res.Data.PageData;;
}
})
},
//删除班次
delClass(id) {
//删除值班事项
delItem(id) {
let that = this
this.$q.dialog({
title: '提示信息',
......@@ -239,11 +165,8 @@
})
that.getList()
})
}).onCancel(() => {
});
}).onCancel(() => {});
},
//获取校区列表
getCompanyList() {
getSchoolDropdown({}).then(res => {
......@@ -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() {
this.$refs.dialog.show();
},
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();
})
}
EditItem(obj) {
this.isShowAdd = true;
this.itemObj = obj;
},
}
}
......
......@@ -16,18 +16,17 @@
<div class="col-2 q-table__title">设置</div>
<q-space />
<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>
</template>
<template v-slot:bottom>
</template>
<template v-slot:body-cell-optioned="props">
<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)"
label="编辑" />
</q-btn>
<q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delSet(props.row.Id)"
label="删除" />
</q-td>
</template>
</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