完成每日食谱
This commit is contained in:
+72
-1
@@ -36,6 +36,22 @@ export function postSemester (data) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 修改食谱大标题
|
||||||
|
export function putSemester (data) {
|
||||||
|
return request({
|
||||||
|
url: '/semester/recipe',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 删除食谱大标题
|
||||||
|
export function deleteSemester (data) {
|
||||||
|
return request({
|
||||||
|
url: '/semester/recipe/'+data,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 通过学期食谱标题id添加这学期的每周食谱
|
// 通过学期食谱标题id添加这学期的每周食谱
|
||||||
export function postWeek (data) {
|
export function postWeek (data) {
|
||||||
return request({
|
return request({
|
||||||
@@ -44,6 +60,24 @@ export function postWeek (data) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改每周
|
||||||
|
export function putWeek (data) {
|
||||||
|
return request({
|
||||||
|
url: '/week/recipe',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 通过学期食谱标题id添加这学期的每周食谱
|
||||||
|
export function deleteWeek (data) {
|
||||||
|
return request({
|
||||||
|
url: '/week/recipe/'+data,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 添加这周每日食谱
|
// 添加这周每日食谱
|
||||||
export function postMeal (data) {
|
export function postMeal (data) {
|
||||||
return request({
|
return request({
|
||||||
@@ -53,7 +87,6 @@ export function postMeal (data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 修改这周每日食谱
|
// 修改这周每日食谱
|
||||||
export function putMeal (data) {
|
export function putMeal (data) {
|
||||||
return request({
|
return request({
|
||||||
@@ -63,3 +96,41 @@ export function putMeal (data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 班级类别列表
|
||||||
|
export function getClass (campusId) {
|
||||||
|
return request({
|
||||||
|
url: '/recipe/type/list',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
campusId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 添加班级类别
|
||||||
|
export function postClass (tName) {
|
||||||
|
return request({
|
||||||
|
url: '/recipe/type',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
tName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 修改班级类别
|
||||||
|
export function putClass (data) {
|
||||||
|
return request({
|
||||||
|
url: '/recipe/type',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 删除班级类别
|
||||||
|
export function deleteClass (data) {
|
||||||
|
return request({
|
||||||
|
url: '/recipe/type/'+data,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,14 @@
|
|||||||
>新增周次</el-button
|
>新增周次</el-button
|
||||||
>
|
>
|
||||||
<el-button @click="updateTwoClick" icon="el-icon-edit" size="mini" >修改周次</el-button>
|
<el-button @click="updateTwoClick" icon="el-icon-edit" size="mini" >修改周次</el-button>
|
||||||
<el-button @click="resetClick" type="info" size="mini" icon="iconfont icon-biaodan"
|
<el-button @click="newlyClassClick" type="warning" size="mini" icon="el-icon-plus">新增食谱总类别</el-button>
|
||||||
|
<el-button @click="updateClassClick" icon="el-icon-edit" size="mini" >修改食谱类别</el-button>
|
||||||
|
<!-- <el-button @click="resetClick" type="info" size="mini" icon="iconfont icon-biaodan"
|
||||||
>重置</el-button
|
>重置</el-button
|
||||||
>
|
>
|
||||||
<el-button @click="searchClick" type="warning" size="mini" icon="el-icon-search"
|
<el-button @click="searchClick" type="warning" size="mini" icon="el-icon-search"
|
||||||
>搜索</el-button
|
>搜索</el-button
|
||||||
>
|
> -->
|
||||||
<el-input
|
<el-input
|
||||||
v-if="false"
|
v-if="false"
|
||||||
v-model="searchData"
|
v-model="searchData"
|
||||||
@@ -51,6 +53,14 @@ export default {
|
|||||||
// 在此处调用父组件传入的方法叫父组件做事情
|
// 在此处调用父组件传入的方法叫父组件做事情
|
||||||
this.$emit("update-two-data");
|
this.$emit("update-two-data");
|
||||||
},
|
},
|
||||||
|
newlyClassClick() {
|
||||||
|
// 在此处调用父组件传入的方法叫父组件做事情
|
||||||
|
this.$emit("newly-class-data");
|
||||||
|
},
|
||||||
|
updateClassClick() {
|
||||||
|
// 在此处调用父组件传入的方法叫父组件做事情
|
||||||
|
this.$emit("update-class-data");
|
||||||
|
},
|
||||||
resetClick() {
|
resetClick() {
|
||||||
this.$emit("reset-data");
|
this.$emit("reset-data");
|
||||||
},
|
},
|
||||||
|
|||||||
+202
-53
@@ -9,6 +9,8 @@
|
|||||||
@newly-two-data="addWeek"
|
@newly-two-data="addWeek"
|
||||||
@update-data="updateClick"
|
@update-data="updateClick"
|
||||||
@update-two-data="updateTwoClick"
|
@update-two-data="updateTwoClick"
|
||||||
|
@newly-class-data="addClass"
|
||||||
|
@update-class-data="updateClassClick"
|
||||||
></CommonHead>
|
></CommonHead>
|
||||||
<!-- newly-data删除所选事件 -->
|
<!-- newly-data删除所选事件 -->
|
||||||
<!-- reset-data重置表单内容 -->
|
<!-- reset-data重置表单内容 -->
|
||||||
@@ -25,7 +27,7 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<el-select @change="onChangeWeek" v-model="query.wId" clearable placeholder="请选择周次" >
|
<el-select @change="onChangeWeek" v-model="query.wId" clearable placeholder="请选择周次" style="margin-right: 20px;">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in weekArr"
|
v-for="item in weekArr"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -33,6 +35,7 @@
|
|||||||
:value="item.id">
|
:value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<el-button v-if="query.wId" @click="addSelectClass" type="primary" size="mini" >添加食谱类别</el-button>
|
||||||
<div v-for="item in allClass" style="width: 100%; margin-top: 20px;">
|
<div v-for="item in allClass" style="width: 100%; margin-top: 20px;">
|
||||||
<h4 style="line-height: 50px;">{{ item.tName }}</h4>
|
<h4 style="line-height: 50px;">{{ item.tName }}</h4>
|
||||||
<el-table
|
<el-table
|
||||||
@@ -95,9 +98,34 @@
|
|||||||
@clickSize="onClickSize"
|
@clickSize="onClickSize"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog title="新增食谱标题" :visible.sync="isRecipeModel">
|
<el-dialog :title="addTitle" :visible.sync="isRecipeModel">
|
||||||
|
<el-form v-if="addTitle == '添加食谱类别'">
|
||||||
<el-form ref="form" width="30%"
|
<el-form-item label="食谱类别">
|
||||||
|
<el-select v-model="form.tName" clearable placeholder="请选择食谱类别" >
|
||||||
|
<el-option
|
||||||
|
v-for="item in classArr"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.tName"
|
||||||
|
:value="item.tName">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="onClickAdd()" type="primary" >立即添加</el-button>
|
||||||
|
<el-button @click="isRecipeModel = false">取消</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-form v-else-if="addTitle == '新增食谱总类别'" ref="form" width="30%"
|
||||||
|
:before-close="handleClose" label-width="80px" >
|
||||||
|
<el-form-item label="食谱类别">
|
||||||
|
<el-input v-model="tName" placeholder="请输入食谱类别:例如幼儿班食谱" ></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="onClickCreateType()" type="primary" >立即创建</el-button>
|
||||||
|
<el-button @click="isRecipeModel = false">取消</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-form v-else ref="form" width="30%"
|
||||||
:before-close="handleClose" label-width="80px" >
|
:before-close="handleClose" label-width="80px" >
|
||||||
<el-form-item label="食谱标题">
|
<el-form-item label="食谱标题">
|
||||||
<el-input v-model="form.sName" placeholder="请输入食谱标题:例如2024年春期食谱" :disabled="form.rId ? true : false"></el-input>
|
<el-input v-model="form.sName" placeholder="请输入食谱标题:例如2024年春期食谱" :disabled="form.rId ? true : false"></el-input>
|
||||||
@@ -147,21 +175,32 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!-- 修改食谱 -->
|
<!-- 修改食谱 -->
|
||||||
<el-dialog title="修改" width="25%" :visible.sync="isUpdateModel">
|
<el-dialog :title="updateTitle" width="25%" :visible.sync="isUpdateModel">
|
||||||
<div class="content" style=" height: 400px; overflow: scroll;">
|
<div v-if="updateTitle == '修改食谱'" class="content" style=" height: 400px; overflow: scroll;">
|
||||||
<div v-for=" (item, index) in termArr" :key="index" style="display: flex; height: 30px; align-items: center;">
|
<div v-for=" (item, index) in termArr" :key="index" style="display: flex; height: 30px; align-items: center;">
|
||||||
<div v-if="!item.isEdit" style="font-size: 14px; flex: 1;">{{ item.sName }} </div>
|
<div v-if="!item.isEdit" style="font-size: 14px; flex: 1;">{{ item.sName }} </div>
|
||||||
<el-input v-if="item.isEdit" v-model="item.sName" style="font-size: 14px; flex: 1;"></el-input>
|
<el-input v-if="item.isEdit" v-model="item.sName" style="font-size: 14px; flex: 1;"></el-input>
|
||||||
<i @click="onClickUpdateTerm(index)" class="el-icon-edit" style="cursor: pointer;margin-right: 20px;">{{ item.isEdit ? '修改' : '保存' }}</i>
|
<i @click="onClickUpdateTerm(item)" class="el-icon-edit" style="cursor: pointer;margin-right: 20px;">{{ !item.isEdit ? '修改' : '保存' }}</i>
|
||||||
<i @click="onClickRemoveTerm(index)" class="el-icon-delete" style="cursor: pointer;">删除</i>
|
<i @click="onClickRemoveTerm(item)" class="el-icon-delete" style="cursor: pointer;">删除</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-form ref="form" width="30%" :before-close="handleClose" label-width="80px" >
|
<div v-else-if="updateTitle == '修改周'" class="content" style=" height: 400px; overflow: scroll;">
|
||||||
<el-form-item>
|
<div v-for=" (item, index) in weekArr" :key="index" style="display: flex; height: 30px; align-items: center;">
|
||||||
<el-button @click="onClickSubmitTerm()" type="primary" >提交</el-button>
|
<div v-if="!item.isEdit" style="font-size: 14px; flex: 1;">{{ item.wName }} </div>
|
||||||
<el-button @click="isUpdateModel = false">取消</el-button>
|
<el-input v-if="item.isEdit" v-model="item.wName" style="font-size: 14px; flex: 1;"></el-input>
|
||||||
</el-form-item>
|
<i @click="onClickUpdateWeek(item)" class="el-icon-edit" style="cursor: pointer;margin-right: 20px;">{{ !item.isEdit ? '修改' : '保存' }}</i>
|
||||||
</el-form>
|
<i @click="onClickRemoveWeek(item)" class="el-icon-delete" style="cursor: pointer;">删除</i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="updateTitle == '修改食谱类别'" class="content" style=" height: 400px; overflow: scroll;">
|
||||||
|
<div v-for=" (item, index) in classArr" :key="index" style="display: flex; height: 30px; align-items: center;">
|
||||||
|
<div v-if="!item.isEdit" style="font-size: 14px; flex: 1;">{{ item.tName }} </div>
|
||||||
|
<el-input v-if="item.isEdit" v-model="item.tName" style="font-size: 14px; flex: 1;"></el-input>
|
||||||
|
<i @click="onClickUpdateType(item)" class="el-icon-edit" style="cursor: pointer;margin-right: 20px;">{{ !item.isEdit ? '修改' : '保存' }}</i>
|
||||||
|
<i @click="onClickRemoveType(item)" class="el-icon-delete" style="cursor: pointer;">删除</i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -169,7 +208,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import columns from "./columns";
|
import columns from "./columns";
|
||||||
import { getSemester, getWeek, getRecipe, postSemester, postWeek, postMeal, putMeal } from "./api";
|
import { getSemester, getWeek, getRecipe, postSemester, postWeek, postMeal, putMeal, putSemester ,deleteSemester,
|
||||||
|
putWeek, deleteWeek, getClass, postClass, putClass, deleteClass
|
||||||
|
} from "./api";
|
||||||
import { formatDate } from "@/com/index";
|
import { formatDate } from "@/com/index";
|
||||||
import CommonHead from './components/CommonHead.vue'
|
import CommonHead from './components/CommonHead.vue'
|
||||||
|
|
||||||
@@ -184,6 +225,7 @@ export default {
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
rId: '',
|
rId: '',
|
||||||
wId: '',
|
wId: '',
|
||||||
|
tName: '',
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
equipmentList: [],
|
equipmentList: [],
|
||||||
@@ -193,31 +235,10 @@ export default {
|
|||||||
wName: '',
|
wName: '',
|
||||||
rId: '',
|
rId: '',
|
||||||
},
|
},
|
||||||
tableData1: [{
|
|
||||||
id: 1,
|
|
||||||
date: '2016-05-02',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
|
||||||
}, {
|
|
||||||
id: 2,
|
|
||||||
date: '2016-05-04',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1517 弄'
|
|
||||||
}, {
|
|
||||||
id: 3,
|
|
||||||
date: '2016-05-01',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1519 弄',
|
|
||||||
hasChildren: true
|
|
||||||
}, {
|
|
||||||
id: 4,
|
|
||||||
date: '2016-05-03',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1516 弄'
|
|
||||||
}],
|
|
||||||
tableData: [],
|
tableData: [],
|
||||||
termArr: [], // 学期数组
|
termArr: [], // 学期数组
|
||||||
weekArr: [], // 周次数组
|
weekArr: [], // 周次数组
|
||||||
|
classArr: [], // 类别数组
|
||||||
isRecipeModel: false,
|
isRecipeModel: false,
|
||||||
isMealModel: false,
|
isMealModel: false,
|
||||||
isUpdateModel: false,
|
isUpdateModel: false,
|
||||||
@@ -233,6 +254,9 @@ export default {
|
|||||||
allClass: {}, // 所有班级
|
allClass: {}, // 所有班级
|
||||||
defaultTable: [], // 默认表格
|
defaultTable: [], // 默认表格
|
||||||
mealTitle: '新增食物',
|
mealTitle: '新增食物',
|
||||||
|
updateTitle: '修改食谱',
|
||||||
|
addTitle: '新增食谱',
|
||||||
|
tName: '', // 食谱类别
|
||||||
// 对话框表单验证
|
// 对话框表单验证
|
||||||
rules: {
|
rules: {
|
||||||
deviceName: [{ required: true, message: "请输入设备名称", trigger: "change" }],
|
deviceName: [{ required: true, message: "请输入设备名称", trigger: "change" }],
|
||||||
@@ -257,9 +281,24 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
CommonHead,
|
CommonHead,
|
||||||
},
|
},
|
||||||
created() {
|
async created() {
|
||||||
|
// console.log(config)
|
||||||
// this.getAttendanceFormData();
|
// this.getAttendanceFormData();
|
||||||
this.semesterList()
|
// this.semesterList()
|
||||||
|
getSemester().then( res =>{
|
||||||
|
this.termArr = res.rows.map( item =>{ item.isEdit = false; return item} )
|
||||||
|
if(this.termArr.length > 0){
|
||||||
|
this.query.rId = this.termArr[0].id
|
||||||
|
getWeek(this.query.rId).then(res => {
|
||||||
|
this.weekArr = res.data.map( item =>{ item.isEdit = false ; return item })
|
||||||
|
if(this.weekArr.length > 0){
|
||||||
|
this.query.wId = this.weekArr[0].id
|
||||||
|
this.recipeList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.classList()
|
||||||
this.defaultTable = []
|
this.defaultTable = []
|
||||||
for( let key in this.weekEnum){
|
for( let key in this.weekEnum){
|
||||||
let obj = {
|
let obj = {
|
||||||
@@ -274,25 +313,87 @@ export default {
|
|||||||
}
|
}
|
||||||
this.tableData = this.defaultTable
|
this.tableData = this.defaultTable
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
'query.wId'(newVal, oldVal) {
|
||||||
|
if(newVal){
|
||||||
|
this.recipeList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 点击
|
// 点击修改
|
||||||
onClickSubmitTerm() {
|
onClickUpdateTerm(item) {
|
||||||
|
console.log(item)
|
||||||
|
let obj = { id: item.id, sName: item.sName }
|
||||||
|
if(item.isEdit){ // 说明是保存
|
||||||
|
putSemester(obj).then(res =>{
|
||||||
|
this.$message({ message: "修改成功", type: "success", });
|
||||||
|
this.semesterList()
|
||||||
|
})
|
||||||
|
}else { // 说明是修改
|
||||||
|
item.isEdit = true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onClickUpdateTerm(index) {
|
onClickRemoveTerm(item) {
|
||||||
this.termArr[index].isEdit = true
|
deleteSemester(item.id).then(res =>{
|
||||||
|
this.$message({ message: "删除成功", type: "success", });
|
||||||
|
this.semesterList()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
onClickRemoveTerm(index) {
|
// 修改周
|
||||||
this.termArr.splice(index, 1)
|
onClickUpdateWeek(item) {
|
||||||
|
console.log(item)
|
||||||
|
let obj = { id: item.id, wName: item.wName }
|
||||||
|
if(item.isEdit){ // 说明是保存
|
||||||
|
putWeek(obj).then(res =>{
|
||||||
|
this.$message({ message: "修改成功", type: "success", });
|
||||||
|
this.weekList()
|
||||||
|
})
|
||||||
|
}else { // 说明是修改
|
||||||
|
item.isEdit = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//删除周
|
||||||
|
onClickRemoveWeek(item) {
|
||||||
|
deleteWeek(item.id).then(res =>{
|
||||||
|
this.$message({ message: "删除成功", type: "success", });
|
||||||
|
this.weekList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 修改食谱类别
|
||||||
|
onClickUpdateType(item) {
|
||||||
|
console.log(item)
|
||||||
|
let obj = { id: item.id, tName: item.tName }
|
||||||
|
if(item.isEdit){ // 说明是保存
|
||||||
|
putClass(obj).then(res =>{
|
||||||
|
this.$message({ message: "修改成功", type: "success", });
|
||||||
|
this.classList()
|
||||||
|
})
|
||||||
|
}else { // 说明是修改
|
||||||
|
item.isEdit = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//删除食谱类别
|
||||||
|
onClickRemoveType(item) {
|
||||||
|
deleteClass(item.id).then(res =>{
|
||||||
|
this.$message({ message: "删除成功", type: "success", });
|
||||||
|
this.classList()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 点击修改食谱
|
// 点击修改食谱
|
||||||
updateClick() {
|
updateClick() {
|
||||||
this.isUpdateModel = true
|
this.isUpdateModel = true
|
||||||
|
this.updateTitle ='修改食谱'
|
||||||
},
|
},
|
||||||
// 点击修改周
|
// 点击修改周
|
||||||
updateTwoClick() {
|
updateTwoClick() {
|
||||||
this.isUpdateModel = true
|
this.isUpdateModel = true
|
||||||
|
this.updateTitle ='修改周'
|
||||||
|
},
|
||||||
|
// 点击修改食谱类别
|
||||||
|
updateClassClick() {
|
||||||
|
this.isUpdateModel = true
|
||||||
|
this.updateTitle = '修改食谱类别'
|
||||||
},
|
},
|
||||||
// 点击提交新增食物
|
// 点击提交新增食物
|
||||||
onClickSubmit () {
|
onClickSubmit () {
|
||||||
@@ -377,6 +478,29 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
// 点击创建类别
|
||||||
|
onClickCreateType() {
|
||||||
|
postClass(this.tName).then(res =>{
|
||||||
|
this.isRecipeModel = false
|
||||||
|
this.$message({ message: '新增成功',type: 'success', });
|
||||||
|
this.classList()
|
||||||
|
this.tName = ''
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onClickAdd() {
|
||||||
|
console.log(this.query)
|
||||||
|
console.log(this.form)
|
||||||
|
let obj = {
|
||||||
|
tName: this.form.tName,
|
||||||
|
wId: this.query.wId
|
||||||
|
}
|
||||||
|
postMeal(obj).then(res =>{
|
||||||
|
this.isRecipeModel = false
|
||||||
|
this.$message({ message: '添加成功',type: 'success', });
|
||||||
|
this.recipeList()
|
||||||
|
this.reset()
|
||||||
|
})
|
||||||
|
},
|
||||||
// 获取学期列表
|
// 获取学期列表
|
||||||
semesterList() {
|
semesterList() {
|
||||||
getSemester().then( res =>{
|
getSemester().then( res =>{
|
||||||
@@ -388,9 +512,11 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
weekList() {
|
weekList() {
|
||||||
console.log()
|
|
||||||
getWeek(this.query.rId).then(res =>{
|
getWeek(this.query.rId).then(res =>{
|
||||||
this.weekArr = res.data
|
this.weekArr = res.data.map( item =>{
|
||||||
|
item.isEdit = false
|
||||||
|
return item
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 班级列表
|
// 班级列表
|
||||||
@@ -409,6 +535,15 @@ export default {
|
|||||||
console.log(this.allClass)
|
console.log(this.allClass)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 所有类别列表
|
||||||
|
classList() {
|
||||||
|
getClass().then(res =>{
|
||||||
|
this.classArr = res.data.map(item =>{
|
||||||
|
item.isEdit = false
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
// 点击选择学期
|
// 点击选择学期
|
||||||
onChangeTerm(value) {
|
onChangeTerm(value) {
|
||||||
console.log(value)
|
console.log(value)
|
||||||
@@ -418,11 +553,11 @@ export default {
|
|||||||
this.allClass = []
|
this.allClass = []
|
||||||
this.weekList()
|
this.weekList()
|
||||||
},
|
},
|
||||||
|
// 点击选择周次
|
||||||
onChangeWeek(value) {
|
onChangeWeek(value) {
|
||||||
console.log(value)
|
console.log(value)
|
||||||
this.query.wId = value
|
this.query.wId = value
|
||||||
this.allClass = []
|
this.allClass = []
|
||||||
|
|
||||||
this.recipeList(this.query.wId)
|
this.recipeList(this.query.wId)
|
||||||
},
|
},
|
||||||
// 搜索按钮
|
// 搜索按钮
|
||||||
@@ -435,21 +570,24 @@ export default {
|
|||||||
sName: "",
|
sName: "",
|
||||||
wName: '',
|
wName: '',
|
||||||
rId: '',
|
rId: '',
|
||||||
|
tName: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 添加食谱
|
// 添加食谱
|
||||||
add() {
|
add() {
|
||||||
this.reset()
|
this.reset()
|
||||||
this.isRecipeModel = true
|
this.isRecipeModel = true
|
||||||
|
this.addTitle = '新增食谱'
|
||||||
},
|
},
|
||||||
// 添加周次
|
// 添加周次
|
||||||
addWeek() {
|
addWeek() {
|
||||||
|
this.addTitle = '新增周次'
|
||||||
console.log(this.form)
|
console.log(this.form)
|
||||||
if( this.query.rId) {
|
if( this.query.rId) { // 判断是否选择了学期
|
||||||
this.form.sName = this.termArr.find(item => item.id == this.query.rId).sName;
|
this.form.sName = this.termArr.find(item => item.id == this.query.rId).sName; // 获取学期名称
|
||||||
this.form.rId = this.query.rId
|
this.form.rId = this.query.rId
|
||||||
}
|
}
|
||||||
if( this.form.rId){
|
if( this.form.rId){ // 判断是否选择了学期
|
||||||
this.isRecipeModel = true
|
this.isRecipeModel = true
|
||||||
}else{
|
}else{
|
||||||
this.$message({
|
this.$message({
|
||||||
@@ -458,6 +596,17 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
addSelectClass() {
|
||||||
|
this.addTitle = '添加食谱类别'
|
||||||
|
this.isRecipeModel = true
|
||||||
|
|
||||||
|
},
|
||||||
|
addClass() {
|
||||||
|
// this.$message("新增班级类别");
|
||||||
|
this.addTitle = '新增食谱总类别'
|
||||||
|
this.isRecipeModel = true
|
||||||
|
this.tName = ''
|
||||||
|
},
|
||||||
// 删除
|
// 删除
|
||||||
async deleteData(row) {
|
async deleteData(row) {
|
||||||
console.log(row.deviceId);
|
console.log(row.deviceId);
|
||||||
|
|||||||
Reference in New Issue
Block a user