新增每周食谱

This commit is contained in:
xiayuping666
2024-01-31 17:40:36 +08:00
parent 4438dbfe4d
commit ad52fa5c78
9 changed files with 544 additions and 1 deletions
+15
View File
@@ -599,5 +599,20 @@ export default {
"icon": "el-icon-magic-stick" "icon": "el-icon-magic-stick"
} }
}, },
{
"path": "/recipe",
"name": "recipe",
"component": "recipe",
"meta": {
"title": "message.router.recipe",
"isLink": "",
"isHide": false,
"isKeepAlive": true,
"isAffix": true,
"isIframe": false,
"roles": ["admin", "common"],
"icon": "el-icon-s-opportunity"
}
}
] ]
} }
+2
View File
@@ -223,5 +223,7 @@
"icon": "iconfont icon-neiqianshujuchucun" "icon": "iconfont icon-neiqianshujuchucun"
} }
} }
] ]
} }
+2 -1
View File
@@ -53,7 +53,8 @@ export default {
rolePermissions:"rolePermissions", rolePermissions:"rolePermissions",
setScoreRules:'setScoreRules', setScoreRules:'setScoreRules',
facultyInformation:'facultyInformation', facultyInformation:'facultyInformation',
attendanceMachineEquipmentManagement:'attendanceMachineEquipmentManagement' attendanceMachineEquipmentManagement:'attendanceMachineEquipmentManagement',
recipe: 'recipe'
}, },
staticRoutes: { staticRoutes: {
signIn: 'signIn', signIn: 'signIn',
+1
View File
@@ -54,6 +54,7 @@ export default {
schoolAlbumManagement:'学校画册管理', schoolAlbumManagement:'学校画册管理',
facultyInformation:'教职工信息', facultyInformation:'教职工信息',
attendanceMachineEquipmentManagement:'考勤机设备管理', attendanceMachineEquipmentManagement:'考勤机设备管理',
recipe: '每周食谱'
}, },
staticRoutes: { staticRoutes: {
+1
View File
@@ -54,6 +54,7 @@ export default {
facultyInformation:'教職工信息', facultyInformation:'教職工信息',
deviceManagement:'人脸设备管理', deviceManagement:'人脸设备管理',
attendanceMachineEquipmentManagement:'考勤機設備管理', attendanceMachineEquipmentManagement:'考勤機設備管理',
recipe: '每周食谱',
}, },
staticRoutes: { staticRoutes: {
signIn: '登入', signIn: '登入',
+32
View File
@@ -0,0 +1,32 @@
import request from '@/utils/request';
// 获取设备数据列表
export const rqGetDeviceList = (current,size) => request({
url: `/attendance/equipment/device?current=${current}&size=${size}`,
method: 'get',
})
// 添加或者修改
export const rqAddOrModifyDevice = (data) => {
if(data.deviceId){
return request({
url: '/attendance/equipment/device',
method: 'put',
data
})
}else{
return request({
url: '/attendance/equipment/device',
method: 'post',
data
})
}
}
// 删除
export const rqDeleteDevice = (id) => request({
url: `/attendance/equipment/device/${id}`,
method: 'delete',
})
+52
View File
@@ -0,0 +1,52 @@
export default [
{
label: "设备id",
prop: "deviceId",
type: "text",
},
{
label: "账号名称",
prop: "username",
type: "text",
},
{
label: "设备名称",
prop: "deviceName",
type: "text",
},
{
label: "用户名",
prop: "username",
type: "image",
},
{
label: "密码",
prop: "password",
type: "text",
},
{
label: "设备标签",
prop: "deviceLabel",
type: "text",
},
{
label: "设备地址",
prop: "deviceUrl",
type: "text",
},
{
label: "设备状态",
prop: "deviceStatus",
type: "text",
},
{
label: "设备物理地址",
prop: "macAddress",
type: "text",
},
]
@@ -0,0 +1,115 @@
<template>
<el-table
border
:header-cell-style="{
background: '#f5f7fa',
}"
:data="tableData"
style="width: 100%; margin-top: 20px"
height="650"
size="mini"
>
<el-table-column
v-if="
column.label !== 'id' &&
column.label !== '审批人Id' &&
column.label !== '抄送人Id'
"
v-for="(column, index) in tableColumns"
:key="index"
:prop="column.prop"
:label="column.label"
width="auto"
>
<template slot-scope="scope">
<span v-if="column.type === 'text'"> {{ scope.row[column.prop] }}</span>
<div v-else-if="column.type === 'image'">
<img style="width: 200px; height: 100px" :src="scope.row[column.prop]" />
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="160">
<template slot-scope="scope">
<el-button
@click="handleEdit(scope.row)"
class="el-icon-edit"
type="text"
size="small"
>编辑</el-button
>
<el-popconfirm @confirm="handleDelete(scope.row)" :title="'确定要删除吗?'">
<el-button
slot="reference"
style="margin-left: 10px; color: red"
class="el-icon-delete"
type="text"
size="small"
>删除</el-button
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
</template>
<script>
export default {
name: "CommonTablesImg",
props: {
columns: {
type: Array,
required: true,
},
data: {
type: Array,
required: true,
},
deleteFunc: {
type: Function,
default: () => {},
},
editFunc: {
type: Function,
default: () => {},
},
},
data() {
return {};
},
methods: {
// 删除事件
handleDelete(row) {
this.deleteFunc(row.id);
},
// 编辑事件
handleEdit(row) {
console.log(row);
this.editFunc(row);
},
},
computed: {
tableColumns() {
// 处理传进来的列配置,返回符合 Element UI 表格要求的配置
return this.columns.map((column) => {
return {
label: column.label,
prop: column.prop,
type: column.type,
};
});
},
tableData() {
// 处理传进来的数据,返回符合 Element UI 表格要求的数据
return this.data.map((rowData) => {
let row = {};
for (let column of this.columns) {
row[column.prop] = rowData[column.prop];
}
return row;
});
},
},
};
</script>
<style lang="scss" scoped></style>
+324
View File
@@ -0,0 +1,324 @@
<template>
<div class="box">
<div class="form-adapt-container">
<el-card shadow="hover">
<CommonHead
@search-data="searchForm"
@reset-data="reset"
@newly-data="add"
></CommonHead>
<!-- newly-data删除所选事件 -->
<!-- reset-data重置表单内容 -->
<!-- search-data搜索事件接收被搜索的内容 -->
</el-card>
<el-card shadow="hover">
<el-select v-model="value" placeholder="请选择学期">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-select v-model="value" placeholder="请选择周次">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-table
:data="tableData1"
style="width: 100%"
row-key="id"
border
lazy
:load="load"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column
prop="date"
label="日期"
width="180">
</el-table-column>
<el-table-column
prop="name"
label="姓名"
width="180">
</el-table-column>
<el-table-column
prop="address"
label="地址">
</el-table-column>
</el-table>
</el-card>
<Pagination
:total="total"
:pageNum="query.pageNum"
:pageSize="query.pageSize"
@clickCurrent="onClickCurrent"
@clickSize="onClickSize"
/>
</div>
</div>
</template>
<script>
import columns from "./columns";
import { rqGetDeviceList, rqAddOrModifyDevice, rqDeleteDevice } from "./api";
import { formatDate } from "@/com/index";
export default {
name: "deviceManagement",
data() {
return {
columns,
total: 0,
query: {
pageNum: 1,
pageSize: 10,
},
loading: false,
equipmentList: [],
dialogVisible: false,
from: {
// 设备名称
deviceName: "",
// 设备标签
deviceLabel: "",
// 设备地址
deviceUrl: "",
// 设备物理地址
macAddress: "",
// 设备账号
username: "",
// 设备密码
password: "",
},
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
value: '',
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 弄'
}],
// 对话框表单验证
rules: {
deviceName: [{ required: true, message: "请输入设备名称", trigger: "change" }],
deviceLabel: [{ required: true, message: "请选择设备标签", trigger: "change" }],
deviceUrl: [{ required: true, message: "请输入设备地址", trigger: "change" }],
macAddress: [{ required: true, message: "请输入设备物理", trigger: "change" }],
username: [{ required: true, message: "请输入设备账号名称", trigger: "change" }],
password: [{ required: true, message: "请输入设备密码", trigger: "change" }],
},
};
},
created() {
// this.getAttendanceFormData();
},
methods: {
load(tree, treeNode, resolve) {
console.log(tree)
console.log(treeNode)
console.log(resolve)
if(tree.id == 32){
setTimeout(() => {
resolve([
{
id: 34,
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
id: 39,
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄',
hasChildren: true
}
])
}, 500)
}else {
setTimeout(() => {
resolve([
{
id: 31,
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
id: 32,
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄',
hasChildren: true
}
])
}, 500)
}
},
// 搜索按钮
searchForm() {
this.$message("正在搜索");
},
// 重置按钮
reset() {
this.bus.$emit("onCurrentContextmenuClick", {
id: 0,
path: this.$route.path,
});
},
// 添加
add() {
console.log(888);
this.dialogVisible = true;
// 清除数据
this.from = {
// 设备名称
deviceName: "",
// 设备标签
deviceLabel: "",
// 设备地址
deviceUrl: "",
// 设备物理地址
macAddress: "",
// 设备账号
username: "",
// 设备密码
password: "",
};
},
// 删除
async deleteData(row) {
console.log(row.deviceId);
let res = await rqDeleteDevice(row.deviceId);
if (res.code == 200) {
this.$message({
message: "删除成功",
type: "success",
});
this.getAttendanceFormData();
} else {
this.$message({
message: "删除失败",
type: "error",
});
}
console.log(row);
},
// 编辑
editData(item) {
console.log(item);
this.dialogVisible = true;
this.from = { ...item };
},
// 点击切换页数
onClickCurrent(val) {
this.query.pageNum = val;
this.getAttendanceFormData();
},
// 点击了每页页数
onClickSize(val) {
this.query.pageSize = val;
this.getAttendanceFormData();
},
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
})
.catch((_) => {});
},
// 获取设备列表
async getAttendanceFormData() {
try {
this.loading = true;
let result = await rqGetDeviceList(this.query.pageNum, this.query.pageSize);
if (result.code == 200) {
this.loading = false;
let arr = result.data.records;
arr.forEach((item, index) => {
item.createTime = formatDate(item.createTime, "-");
item.updateTime = formatDate(item.updateTime, "-");
});
this.equipmentList = arr;
this.total = result.data.total;
} else {
this.loading = false;
this.$message.error("网络错误");
}
} catch (error) {
this.loading = false;
this.$message.error("网络错误");
}
},
// 确认新增或者修改按钮
confirmSettingRules() {
this.$refs.ruleForm.validate(async (success) => {
if (success) {
this.dialogVisible = false;
delete this.from.createTime;
delete this.from.updateTime;
let result = await rqAddOrModifyDevice(this.from);
if (result.code == 200) {
this.$message({
message: this.from.deviceId ? "修改成功" : "添加成功",
type: "success",
});
this.getAttendanceFormData();
this.from = {};
} else {
this.$message.error("添加失败");
}
} else {
return false;
}
});
},
},
};
</script>
<style lang="scss" scoped></style>