Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
P
park-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
huang
park-ui
Commits
764891ea
提交
764891ea
authored
6月 08, 2020
作者:
huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
规则模块页面开发
上级
0200698d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
146 行增加
和
103 行删除
+146
-103
recipeSetting.js
src/api/recipe/recipeSetting.js
+8
-0
index.vue
src/views/recipe/recipeSetting/index.vue
+138
-103
没有找到文件。
src/api/recipe/recipeSetting.js
浏览文件 @
764891ea
...
@@ -7,3 +7,11 @@ export function getRecipeType() {
...
@@ -7,3 +7,11 @@ export function getRecipeType() {
method
:
'get'
,
method
:
'get'
,
})
})
}
}
//根据星期获取菜谱
export
function
getRecipeByWeek
(
week
)
{
return
request
({
url
:
'/recipeWeek/getRecipeByWeek/'
+
week
,
method
:
'get'
,
})
}
src/views/recipe/recipeSetting/index.vue
浏览文件 @
764891ea
...
@@ -16,32 +16,54 @@
...
@@ -16,32 +16,54 @@
<el-table-column
label=
"晚餐"
align=
"center"
:show-overflow-tooltip=
"true"
/>
<el-table-column
label=
"晚餐"
align=
"center"
:show-overflow-tooltip=
"true"
/>
</el-table>
</el-table>
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"420px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-row>
<el-col
:span=
"16"
>
<el-form-item
label=
"菜谱类型"
prop=
"recipeTypeName"
>
<el-input
v-model=
"form.recipeTypeName"
placeholder=
"请输入菜谱类型"
maxlength=
"8"
size=
"small"
clearable
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</el-dialog>
<el-select
v-model=
"value"
placeholder=
"菜谱类型"
style=
"width: 140px"
>
<el-option
v-for=
"item in recipeType"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
<!-- 添加或修改菜谱类型 -->
<!-- 添加或修改菜谱类型 -->
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"520px"
append-to-body
>
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"700px"
append-to-body
>
<div
style=
"display: flex"
>
<el-form
:model=
"breakfastForm"
ref=
"breakfastForm"
label-width=
"100px"
class=
"demo-dynamic"
>
<el-select
v-model=
"value"
placeholder=
"菜谱类型"
style=
"width: 140px"
>
<!--早餐-->
<el-option
v-for=
"item in recipeType"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
<el-form-item
label=
"早餐"
>
</el-select>
</el-form-item>
<el-input
placeholder=
"请输入菜品"
style=
"margin-left: 20px"
></el-input>
<el-form-item
style=
"display: flex"
v-for=
"(recipe, index) in breakfastForm.recipes"
:key=
"recipe.key"
>
</div>
<el-select
v-model=
"recipe.recipeType"
placeholder=
"请选择"
style=
"width: 25%"
>
<el-option
v-for=
"item in recipeType"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-input
v-model=
"recipe.content"
style=
"width: 50%"
></el-input>
<el-button
@
click
.
prevent=
"removeBfRow(recipe)"
>
删除
</el-button>
</el-form-item>
<el-form-item>
<el-button
@
click=
"addBfRow"
>
新增菜谱
</el-button>
</el-form-item>
</el-form>
<!--午餐-->
<el-form
:model=
"lunchForm"
ref=
"lunchForm"
label-width=
"100px"
class=
"demo-dynamic"
>
<el-form-item
label=
"午餐"
>
</el-form-item>
<el-form-item
style=
"display: flex"
v-for=
"(recipe, index) in lunchForm.recipes"
:key=
"recipe.key"
>
<el-select
v-model=
"recipe.recipeType"
placeholder=
"请选择"
style=
"width: 25%"
>
<el-option
v-for=
"item in recipeType"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-input
v-model=
"recipe.content"
style=
"width: 50%"
></el-input>
<el-button
@
click
.
prevent=
"removeLunchRow(recipe)"
>
删除
</el-button>
</el-form-item>
<el-form-item>
<el-button
@
click=
"addLunchRow"
>
新增菜谱
</el-button>
</el-form-item>
</el-form>
<!--晚餐-->
<el-form
:model=
"supperForm"
ref=
"supperForm"
label-width=
"100px"
class=
"demo-dynamic"
>
<el-form-item
label=
"晚餐"
>
</el-form-item>
<el-form-item
style=
"display: flex"
v-for=
"(recipe, index) in supperForm.recipes"
:key=
"recipe.key"
>
<el-select
v-model=
"recipe.recipeType"
placeholder=
"请选择"
style=
"width: 25%"
>
<el-option
v-for=
"item in recipeType"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<el-input
v-model=
"recipe.content"
style=
"width: 50%"
></el-input>
<el-button
@
click
.
prevent=
"removeSupperRow(recipe)"
>
删除
</el-button>
</el-form-item>
<el-form-item>
<el-button
@
click=
"addSupperRow"
>
新增菜谱
</el-button>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
...
@@ -52,42 +74,42 @@
...
@@ -52,42 +74,42 @@
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getRecipeType
}
from
"@/api/recipe/recipeSetting"
;
import
{
getRecipeType
,
getRecipeByWeek
}
from
"@/api/recipe/recipeSetting"
;
export
default
{
export
default
{
//页签缓存页面的name要和路由中的那么要相同,才能缓存,
//页签缓存页面的name要和路由中的那么要相同,才能缓存,
//如果是自定义菜单,则页面的name和菜单管理中路由地址要相同,才能页签缓存
//如果是自定义菜单,则页面的name和菜单管理中路由地址要相同,才
model
能页签缓存
name
:
""
,
name
:
"
recipeSetting
"
,
data
()
{
data
()
{
return
{
return
{
recipeType
:
[],
recipeType
:
[],
value
:
''
,
// 遮罩层
// 遮罩层
loading
:
false
,
loading
:
false
,
id
s
:
[],
// 选中数组
week
s
:
[],
// 选中数组
single
:
true
,
// 非单个禁用
single
:
true
,
// 非单个禁用
multiple
:
true
,
// 非多个禁用
multiple
:
true
,
// 非多个禁用
total
:
0
,
// 总条数
total
:
0
,
// 总条数
currentWeek
:
''
,
//当前选择的星期
recipeWeek
:
[
recipeWeek
:
[
{
{
"week"
:
"星期一"
"week"
:
"星期一"
},
},
{
{
"week"
:
"星期
一
"
"week"
:
"星期
二
"
},
},
{
{
"week"
:
"星期
一
"
"week"
:
"星期
三
"
},
},
{
{
"week"
:
"星期
一
"
"week"
:
"星期
四
"
},
},
{
{
"week"
:
"星期
一
"
"week"
:
"星期
五
"
},
},
{
{
"week"
:
"星期
一
"
"week"
:
"星期
六
"
},
},
{
{
"week"
:
"星期
一
"
"week"
:
"星期
日
"
}
}
],
// 所有菜谱类型列表
],
// 所有菜谱类型列表
title
:
""
,
// 弹出层标题
title
:
""
,
// 弹出层标题
...
@@ -101,7 +123,28 @@
...
@@ -101,7 +123,28 @@
content
:
[
content
:
[
{
required
:
true
,
message
:
"菜谱类型不能为空"
,
trigger
:
"blur"
}
{
required
:
true
,
message
:
"菜谱类型不能为空"
,
trigger
:
"blur"
}
]
]
}
},
breakfastForm
:
{
period
:
'早餐'
,
recipes
:
[{
content
:
''
,
recipeType
:
''
}]
},
lunchForm
:
{
period
:
'午餐'
,
recipes
:
[{
content
:
''
,
recipeType
:
''
}]
},
supperForm
:
{
period
:
'晚餐'
,
recipes
:
[{
content
:
''
,
recipeType
:
''
}]
},
};
};
},
},
created
()
{
created
()
{
...
@@ -123,26 +166,6 @@
...
@@ -123,26 +166,6 @@
}
}
})
})
},
},
addText
(){
let
length
=
this
.
textList
.
length
;
let
cope
=
{
'name'
:
''
}
this
.
textList
.
push
(
cope
);
console
.
log
(
this
.
textList
)
},
delText
(
index
){
this
.
textList
.
splice
(
index
,
1
);
},
/** 获取所有菜谱类型 */
getList
()
{
this
.
loading
=
true
;
getRecipeTypeList
(
this
.
queryParams
).
then
(
response
=>
{
this
.
recipeTypeList
=
response
.
rows
this
.
total
=
response
.
total
this
.
loading
=
false
})
},
// 取消按钮
// 取消按钮
cancel
()
{
cancel
()
{
this
.
open
=
false
;
this
.
open
=
false
;
...
@@ -155,15 +178,10 @@
...
@@ -155,15 +178,10 @@
};
};
this
.
resetForm
(
"form"
);
this
.
resetForm
(
"form"
);
},
},
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"添加菜谱类型"
;
},
//多选框选中数据
//多选框选中数据
handleSelectionChange
(
selection
)
{
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
currentWeek
=
selection
[
0
].
week
this
.
single
=
selection
.
length
!=
1
this
.
single
=
selection
.
length
!=
1
this
.
multiple
=
!
selection
.
length
this
.
multiple
=
!
selection
.
length
},
},
...
@@ -171,56 +189,73 @@
...
@@ -171,56 +189,73 @@
handleUpdate
(
row
)
{
handleUpdate
(
row
)
{
//清空表单
//清空表单
this
.
reset
();
this
.
reset
();
const
id
=
row
.
id
||
this
.
id
s
[
0
]
const
week
=
this
.
week
s
[
0
]
getRecipe
TypeById
(
id
).
then
(
response
=>
{
getRecipe
ByWeek
(
week
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
open
=
true
;
this
.
title
=
"修改菜谱类型"
;
this
.
title
=
"修改菜谱类型"
;
});
});
},
},
/** 提交按钮 */
/** 提交按钮 */
submitForm
:
function
()
{
submitForm
(
formName
)
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
console
.
log
(
this
.
breakfastForm
)
console
.
log
(
this
.
lunchForm
)
console
.
log
(
this
.
supperForm
)
return
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
alert
(
'submit!'
);
if
(
this
.
form
.
id
!=
undefined
)
{
}
else
{
updateRecipeType
(
this
.
form
).
then
(
response
=>
{
console
.
log
(
'error submit!!'
);
if
(
response
.
code
===
200
)
{
return
false
;
this
.
msgSuccess
(
"修改成功"
);
this
.
open
=
false
;
this
.
getList
();
}
else
{
this
.
msgError
(
"修改失败:"
+
response
.
msg
);
}
});
}
else
{
addRecipeType
(
this
.
form
).
then
(
response
=>
{
if
(
response
.
code
===
200
)
{
this
.
msgSuccess
(
"新增成功"
);
this
.
open
=
false
;
this
.
getList
();
}
else
{
this
.
msgError
(
"新增失败:"
+
response
.
msg
);
}
});
}
}
}
});
});
},
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
/**删除早餐列表*/
const
ids
=
row
.
dictId
||
this
.
ids
;
removeBfRow
(
item
)
{
this
.
$confirm
(
'是否确认删除已选中的数据项?'
,
"警告"
,
{
var
index
=
this
.
breakfastForm
.
recipes
.
indexOf
(
item
)
confirmButtonText
:
"确定"
,
if
(
index
!==
-
1
)
{
cancelButtonText
:
"取消"
,
this
.
breakfastForm
.
recipes
.
splice
(
index
,
1
)
type
:
"warning"
}
}).
then
(
function
()
{
},
return
delRecipeType
(
ids
);
/**添加早餐列表*/
}).
then
(()
=>
{
addBfRow
()
{
this
.
getList
();
this
.
breakfastForm
.
recipes
.
push
({
this
.
msgSuccess
(
"删除成功"
);
value
:
''
,
}).
catch
(
function
()
{});
key
:
Date
.
now
()
});
},
/**删除午餐列表*/
removeLunchRow
(
item
)
{
var
index
=
this
.
lunchForm
.
recipes
.
indexOf
(
item
)
if
(
index
!==
-
1
)
{
this
.
lunchForm
.
recipes
.
splice
(
index
,
1
)
}
},
/**添加午餐列表*/
addLunchRow
()
{
this
.
lunchForm
.
recipes
.
push
({
value
:
''
,
key
:
Date
.
now
()
});
},
/**删除晚餐列表*/
removeSupperRow
(
item
)
{
var
index
=
this
.
supperForm
.
recipes
.
indexOf
(
item
)
if
(
index
!==
-
1
)
{
this
.
supperForm
.
recipes
.
splice
(
index
,
1
)
}
},
/**添加晚餐列表*/
addSupperRow
()
{
this
.
supperForm
.
recipes
.
push
({
value
:
''
,
key
:
Date
.
now
()
});
}
}
}
}
};
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论