|
@@ -49,16 +49,6 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="canteenName" label="食堂名称" />
|
|
|
- <!-- <el-table-column
|
|
|
- prop="canteenPhotoPath"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- label="照片"
|
|
|
- />
|
|
|
- <el-table-column
|
|
|
- prop="supplyTimeId"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- label="供应时间ID"
|
|
|
- /> -->
|
|
|
<el-table-column prop="founder" label="创建人" />
|
|
|
<el-table-column prop="createTime" label="创建时间" />
|
|
|
<el-table-column label="操作" width="230">
|
|
@@ -154,7 +144,6 @@
|
|
|
<el-upload
|
|
|
element-loading-text="数据上传中请等待..."
|
|
|
action=""
|
|
|
- class="upload-demo"
|
|
|
:on-change="handleChange"
|
|
|
:multiple="false"
|
|
|
:auto-upload="false"
|
|
@@ -197,9 +186,11 @@ export default {
|
|
|
query: {
|
|
|
canteenName: "",
|
|
|
},
|
|
|
+ // 所有时间节点
|
|
|
timeNodeList: [],
|
|
|
// 整体分组
|
|
|
timeNodeOptions: [],
|
|
|
+ // 4个时间段分组
|
|
|
timeNodeOption1: {
|
|
|
label: "早餐",
|
|
|
options: [],
|
|
@@ -216,7 +207,6 @@ export default {
|
|
|
label: "外卖",
|
|
|
options: [],
|
|
|
},
|
|
|
-
|
|
|
// 早餐列表
|
|
|
timeNodeList1: [],
|
|
|
// 中餐列表
|
|
@@ -242,7 +232,9 @@ export default {
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
},
|
|
|
+ // 实际保存的文件File,在文件上传change的时候改变
|
|
|
uploadFiles: [],
|
|
|
+ // 文件上传绑定的list
|
|
|
fileList: [],
|
|
|
};
|
|
|
},
|
|
@@ -261,7 +253,7 @@ export default {
|
|
|
}
|
|
|
this.uploadFiles = fileList;
|
|
|
},
|
|
|
- // 根据选择的时间节点,禁用相同类型的选项
|
|
|
+ // 根据选择的时间节点,保证同一组选项只能选择一个
|
|
|
timeNodeChange() {
|
|
|
// 分别代表早中晚快递选择的数量
|
|
|
let timeNodeNum1 = 0;
|
|
@@ -334,8 +326,8 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ // 监听文件上传改变
|
|
|
handleChange(file, fileList) {
|
|
|
- // 文件改变
|
|
|
this.uploadFiles = fileList;
|
|
|
},
|
|
|
//打开新增食堂界面
|
|
@@ -345,30 +337,7 @@ export default {
|
|
|
.then((r) => {
|
|
|
if (r.data.result) {
|
|
|
// 拿到时间节点,并分组
|
|
|
- this.timeNodeList = r.data.data;
|
|
|
- this.timeNodeList1 = this.timeNodeList.filter((item) => {
|
|
|
- return item.timeNode === 1;
|
|
|
- });
|
|
|
- this.timeNodeList2 = this.timeNodeList.filter((item) => {
|
|
|
- return item.timeNode === 2;
|
|
|
- });
|
|
|
- this.timeNodeList3 = this.timeNodeList.filter((item) => {
|
|
|
- return item.timeNode === 3;
|
|
|
- });
|
|
|
- this.timeNodeList4 = this.timeNodeList.filter((item) => {
|
|
|
- return item.timeNode === 4;
|
|
|
- });
|
|
|
- this.timeNodeOption1.options = this.timeNodeList1;
|
|
|
- this.timeNodeOption2.options = this.timeNodeList2;
|
|
|
- this.timeNodeOption3.options = this.timeNodeList3;
|
|
|
- this.timeNodeOption4.options = this.timeNodeList4;
|
|
|
- this.timeNodeOptions = [];
|
|
|
- this.timeNodeOptions.push(
|
|
|
- this.timeNodeOption1,
|
|
|
- this.timeNodeOption2,
|
|
|
- this.timeNodeOption3,
|
|
|
- this.timeNodeOption4
|
|
|
- );
|
|
|
+ this.updateTimeNodeGroup(r.data.data)
|
|
|
} else {
|
|
|
this.$message.error("获取时间节点列表失败");
|
|
|
}
|
|
@@ -392,30 +361,7 @@ export default {
|
|
|
.then((r) => {
|
|
|
if (r.data.result) {
|
|
|
// 拿到时间节点列表,并分组
|
|
|
- this.timeNodeList = r.data.data;
|
|
|
- this.timeNodeList1 = this.timeNodeList.filter((item) => {
|
|
|
- return item.timeNode === 1;
|
|
|
- });
|
|
|
- this.timeNodeList2 = this.timeNodeList.filter((item) => {
|
|
|
- return item.timeNode === 2;
|
|
|
- });
|
|
|
- this.timeNodeList3 = this.timeNodeList.filter((item) => {
|
|
|
- return item.timeNode === 3;
|
|
|
- });
|
|
|
- this.timeNodeList4 = this.timeNodeList.filter((item) => {
|
|
|
- return item.timeNode === 4;
|
|
|
- });
|
|
|
- this.timeNodeOption1.options = this.timeNodeList1;
|
|
|
- this.timeNodeOption2.options = this.timeNodeList2;
|
|
|
- this.timeNodeOption3.options = this.timeNodeList3;
|
|
|
- this.timeNodeOption4.options = this.timeNodeList4;
|
|
|
- this.timeNodeOptions = [];
|
|
|
- this.timeNodeOptions.push(
|
|
|
- this.timeNodeOption1,
|
|
|
- this.timeNodeOption2,
|
|
|
- this.timeNodeOption3,
|
|
|
- this.timeNodeOption4
|
|
|
- );
|
|
|
+ this.updateTimeNodeGroup(r.data.data)
|
|
|
this.postManagement = JSON.parse(JSON.stringify(data));
|
|
|
if (this.postManagement.supplyTimeId && this.postManagement.supplyTimeId !== '') {
|
|
|
this.postManagement.supplyTimeId =
|
|
@@ -453,7 +399,34 @@ export default {
|
|
|
this.postManagement = JSON.parse(JSON.stringify(data));
|
|
|
this.workDialog = true;
|
|
|
},
|
|
|
- //保存
|
|
|
+ // 更新时间节点的分组
|
|
|
+ updateTimeNodeGroup(data) {
|
|
|
+ this.timeNodeList = data;
|
|
|
+ this.timeNodeList1 = this.timeNodeList.filter((item) => {
|
|
|
+ return item.timeNode === 1;
|
|
|
+ });
|
|
|
+ this.timeNodeList2 = this.timeNodeList.filter((item) => {
|
|
|
+ return item.timeNode === 2;
|
|
|
+ });
|
|
|
+ this.timeNodeList3 = this.timeNodeList.filter((item) => {
|
|
|
+ return item.timeNode === 3;
|
|
|
+ });
|
|
|
+ this.timeNodeList4 = this.timeNodeList.filter((item) => {
|
|
|
+ return item.timeNode === 4;
|
|
|
+ });
|
|
|
+ this.timeNodeOption1.options = this.timeNodeList1;
|
|
|
+ this.timeNodeOption2.options = this.timeNodeList2;
|
|
|
+ this.timeNodeOption3.options = this.timeNodeList3;
|
|
|
+ this.timeNodeOption4.options = this.timeNodeList4;
|
|
|
+ this.timeNodeOptions = [];
|
|
|
+ this.timeNodeOptions.push(
|
|
|
+ this.timeNodeOption1,
|
|
|
+ this.timeNodeOption2,
|
|
|
+ this.timeNodeOption3,
|
|
|
+ this.timeNodeOption4
|
|
|
+ );
|
|
|
+ },
|
|
|
+ // 保存
|
|
|
saveWork() {
|
|
|
if (!this.postManagement.canteenName) {
|
|
|
this.$message.error("请输入食堂名称!");
|
|
@@ -487,6 +460,7 @@ export default {
|
|
|
this.$message.error(r.data.msg);
|
|
|
});
|
|
|
} else {
|
|
|
+ // 新增食堂
|
|
|
let params = new FormData();
|
|
|
this.uploadFiles.forEach((item) => {
|
|
|
params.append("files", item.raw);
|