Commit a6ee4caf authored by 罗超's avatar 罗超

事项管理

parent c4617401
......@@ -9,28 +9,29 @@
<div class="col-6">
<q-select
v-model="msg.EmployeeName"
:options="EmployeeList"
v-model="EmployeeName"
:options="EmployeeListOption"
color="primary"
filled
emit-value
stack-label
clearable
label="值班管理员"
option-label="EmployeeName"
optionValue="Id"
option-value="Id"
ref="EmployeeName"
:rules="[val => !!val || '请选择值班管理员']"
class="col-6 q-pr-lg q-pb-lg"
/>
</div>
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.MachineCode" ref="MachineCode"
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.MachineCode" stack-label ref="MachineCode"
class="col-6 q-pr-lg q-pb-lg" label="值班机器码" :rules="[val => !!val || '请填写值班机器码']" />
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-select
stack-label
v-model="ShiftsNameArr"
multiple
:options="frequencyOptions"
......@@ -45,6 +46,22 @@
class="col-6 q-pr-lg q-pb-lg"
/>
</div>
<div class="col-6">
<q-select
stack-label
v-model="schoolName"
:options="schoolOptions"
color="primary"
filled
clearable
label="校区"
option-label="SName"
option-value="SId"
ref="school"
:rules="[val => !!val || '请选择校区']"
class="col-6 q-pr-lg q-pb-lg"
/>
</div>
</div>
</q-card-section>
<q-card-actions align="right" class="bg-white">
......@@ -56,7 +73,6 @@
</template>
<script>
import { queryEmployee } from '../../api/users/user';//获取业务员
import { getSetDutyConfigModel } from "../../api/duty/index"
export default {
props: {
......@@ -67,16 +83,26 @@
frequencyOptions:{
type:Array,
default:[]
},
schoolOptions:{
type:Array,
default:[]
},
EmployeeListOption:{
type:Array,
default:[]
}
},
data() {
return {
ShiftsNameArr:[],
EmployeeName:"",
schoolName:[],
msg: {
Id: 0,
EmployeeName:"",
EmployeeIds:"",
MachineCode:"",
ShiftsName:'',
Shifts:'',
},
persistent: true,
EmployeeList:[]
......@@ -84,9 +110,11 @@
}
},
computed: {},
created() {},
created() {
},
mounted() {
this.getEmployee(0);
if (this.saveObj && this.saveObj.Id > 0) {
let ShiftsNameids=this.saveObj.Shifts.split(",");
this.ShiftsNameArr=[]
......@@ -100,27 +128,34 @@
this.msg.Id = this.saveObj.Id;
this.msg.EmployeeName = this.saveObj.Name;
this.msg.MachineCode = this.saveObj.MachineCode;
this.msg.ShiftsName = this.saveObj.ShiftsName;
console.log(this.saveObj,this.frequencyOptions,ShiftsNameids)
console.log(this.saveObj)
let res_schoolName= this.schoolOptions.filter((item)=>{
return item.SName==this.saveObj.SchoolName
})
this.schoolName=res_schoolName[0]
let res_EmployeeName= this.EmployeeListOption.filter((item)=>{
return item.EmployeeName==this.saveObj.EmployeeName
})
this.EmployeeName=res_EmployeeName[0]
}
},
methods: {
changeschool(){
console.log(this.msg.School_Ids)
},
//保存信息
saveRule() {
console.log(this.msg)
this.$refs.EmployeeName.validate();
this.$refs.frequency.validate();
this.$refs.MachineCode.validate();
this.$refs.school.validate();
if (!this.$refs.EmployeeName.hasError &&
!this.$refs.frequency.hasError &&
!this.$refs.MachineCode.hasError ) {
this.msg.Shifts=this.schoolArr.map(item=>item.SId).toString();
!this.$refs.MachineCode.hasError&&
!this.$refs.school.hasError ) {
this.msg.EmployeeIds=this.EmployeeName.Id||""
this.msg.School_Id=this.schoolName.SId||""
this.msg.Shifts=this.ShiftsNameArr.map(item=>item.Id).toString();
getSetDutyConfigModel(this.msg).then(res => {
if (res.Code == 1) {
this.$emit('success');
......@@ -134,20 +169,7 @@
this.$emit('close');
this.persistent = false
},
//获取业务员
getEmployee(id) {
var qMsg = {
Dept_Id: 0
}
qMsg.Dept_Id=id;
queryEmployee(qMsg).then(res => {
if(res.Code==1){
this.EmployeeList = res.Data;
}
}).catch(() => {
})
},
},
}
......
......@@ -7,7 +7,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="show" label="新增事项管理" />
</div>
</template>
......@@ -22,6 +22,8 @@
<q-select
v-else
dense
emit-value
map-options
color="primary"
filled
clearable
......@@ -38,6 +40,8 @@
<q-select
v-else
dense
emit-value
map-options
clearable
multiple
color="primary"
......@@ -46,6 +50,7 @@
option-label="Name"
:options="frequencyOptions"
v-model="props.row.ShiftsName"
ref="Shifts"
:rules="[val => !!val || '请选择归属班次']"
/>
......@@ -56,6 +61,8 @@
v-else
clearable
dense
emit-value
map-options
multiple
color="primary"
filled
......@@ -63,7 +70,7 @@
option-label="SName"
:options="schoolOptions"
v-model="props.row.SchoolName"
ref="Shifts"
ref="school"
:rules="[val => !!val || '请选择归属校区']"
/>
</q-td>
......@@ -77,13 +84,99 @@
</q-btn>
</q-td>
</q-tr>
</template>
<template v-slot:bottom>
</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>
</div>
</template>
......@@ -144,7 +237,8 @@
msg:{
ItemName:"",
ItemType:"",
Shifts:[],
ItemSchools:[]
}
}
},
......@@ -203,35 +297,7 @@
},
//关闭弹窗
closeruleset() {
this.isShowsetForm = false;
},
//刷新列表
refreshRule() {
this.getList();
},
//1启用 2禁用 3删除
getStart(item, type) {
let msg = {
RuleId: item.Id,
Type: type
}
SetOKRRuleState(msg).then(res => {
if (res.Code == 1) {
this.getList();
}
})
},
//新增
addModule(obj) {
if (obj) {
this.ruleObj = obj
} else {
this.ruleObj = null
}
this.isShowsetForm = true
},
//获取校区列表
getCompanyList() {
getSchoolDropdown({}).then(res => {
......@@ -249,18 +315,60 @@
})
},
save(item){
let msg={
Id:item.Id,
ItemName:item.ItemName,
Shifts:item.Shifts,
ItemSchools:item.ItemSchools,
ItemType:item.ItemType.Id
if(item.isEdit){
item.isEdit=false
}
console.log(item,msg)
// getSetDutyItemModel(msg).then((res)=>{
// })
item.isEdit=false
}
// let msg={
// Id:item.Id,
// ItemName:item.ItemName,
// Shifts:item.Shifts,
// ItemSchools:item.ItemSchools,
// ItemType:item.ItemType
// }
// console.log(item)
getSetDutyItemModel(item).then((res)=>{
})
},
//对话框
show() {
this.$refs.dialog.show();
},
hide() {
this.$refs.dialog.hide();
},
onDialogHide() {
// QDialog发出“hide”事件时
// 需要发出
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(),
// this.save(msg)
console.log(msg)
}
},
}
}
......
......@@ -21,7 +21,7 @@
<q-space />
<div class="page-option" style="display:flex">
<q-btn color="accent" size="sm" class="q-mr-md" @click="addModule(null)" label="新增" />
<q-select dense filled v-model="School_Id" label-color="grey-11" clearable bg-color="primary" emit-value :options="schoolOptions" label="选择校区" option-label="SName" option-value="SId" class="chooseSchool" @input="changeSchool">
<q-select dense filled v-model="School_Id" label-color="grey-11" clearable bg-color="primary" emit-value map-options :options="schoolOptions" label="选择校区" option-label="SName" option-value="SId" class="chooseSchool" @input="changeSchool">
</q-select>
</div>
......@@ -38,7 +38,7 @@
</q-td>
</template>
</q-table>
<AddDutySet v-if="isShowsetForm" @close="closeruleset" :save-obj="ruleObj" @success="refreshRule" :frequencyOptions="frequencyOptions">
<AddDutySet v-if="isShowsetForm" @close="closeruleset" :save-obj="ruleObj" @success="refreshRule" :frequencyOptions="frequencyOptions" :schoolOptions="schoolOptions" :EmployeeListOption="EmployeeListOption">
</AddDutySet>
</div>
</div>
......@@ -50,6 +50,7 @@
removeDutyConfig
} from '../../api/duty/index';
import { getSchoolDropdown } from '../../api/school/index';//获取校区列表
import { queryEmployee } from '../../api/users/user';//获取业务员
import AddDutySet from './addDutySet';
export default {
components: {
......@@ -63,6 +64,7 @@
ruleObj: {}, //传入参数
schoolOptions:[],
frequencyOptions:[],
EmployeeListOption:[],
columns: [{
name: 'EmployeeName',
label: '值班管理员:',
......@@ -77,11 +79,16 @@
},
{
name: 'ShiftsName',
label: '班次管理:',
label: '班次:',
field: 'ShiftsName',
align: 'left',
},
{
name: 'SchoolName',
label: '校区',
field: 'SchoolName',
align: 'left',
},
{
name: 'optioned',
label: '操作',
......@@ -95,6 +102,7 @@
this.getList();
this.getCompanyList();
this.getDutyFrequencyList();
this.getEmployee(0);
},
methods: {
//获取数据
......@@ -120,7 +128,6 @@
removeDutyConfig({Id:id.toString()}).then((res)=>{
that.$q.notify({
icon: 'iconfont icon-chenggong',
// color: 'accent',
timeout: 2000,
message: res.Message,
position: 'top'
......@@ -142,18 +149,6 @@
refreshRule() {
this.getList();
},
//1启用 2禁用 3删除
getStart(item, type) {
let msg = {
RuleId: item.Id,
Type: type
}
SetOKRRuleState(msg).then(res => {
if (res.Code == 1) {
this.getList();
}
})
},
//新增
addModule(obj) {
if (obj) {
......@@ -181,7 +176,21 @@
},
changeSchool(){
this.getList();
}
},
//获取业务员
getEmployee(id) {
var qMsg = {
Dept_Id: 0
}
qMsg.Dept_Id=id;
queryEmployee(qMsg).then(res => {
if(res.Code==1){
this.EmployeeListOption = res.Data;
}
}).catch(() => {
})
},
}
}
......
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