|
@@ -23,11 +23,10 @@
|
|
|
{{ (sorts.page - 1) * sorts.limit + scope.$index + 1 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="canteenName" label="食堂名称" :show-overflow-tooltip="true" min-width="160" />
|
|
|
- <el-table-column prop="founder" :show-overflow-tooltip="true" label="创建人" />
|
|
|
- <el-table-column prop="principal" :show-overflow-tooltip="true" label="负责人" />
|
|
|
- <el-table-column prop="complaintPhone" :show-overflow-tooltip="true" label="投诉电话" />
|
|
|
- <el-table-column prop="takeoutPhone" :show-overflow-tooltip="true" label="外卖电话" />
|
|
|
+ <el-table-column prop="canteenName" label="姓名" :show-overflow-tooltip="true" min-width="160" />
|
|
|
+ <el-table-column prop="founder" :show-overflow-tooltip="true" label="负责区域" />
|
|
|
+ <el-table-column prop="principal" :show-overflow-tooltip="true" label="联系电话" />
|
|
|
+ <el-table-column prop="complaintPhone" :show-overflow-tooltip="true" label="当前状态" />
|
|
|
<el-table-column prop="createTime" :show-overflow-tooltip="true" label="创建时间" width="160" />
|
|
|
<el-table-column prop="updateTime" :show-overflow-tooltip="true" label="更新时间" width="160" />
|
|
|
<el-table-column label="操作" width="140">
|
|
@@ -46,73 +45,37 @@
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
<!-- 新增/编辑食堂 -->
|
|
|
- <el-dialog :visible.sync="workDialog" width="40%" class="detailDialog" :close-on-click-modal="false" top="40px">
|
|
|
+ <el-dialog :visible.sync="workDialog" width="35%" class="detailDialog" :close-on-click-modal="false" top="200px">
|
|
|
<div slot="title">
|
|
|
<div class="addTitle">{{ workTitle }}</div>
|
|
|
</div>
|
|
|
- <div style="height: 65vh; overflow: auto; padding-right: 20px">
|
|
|
+ <div style="height: 25vh; overflow: auto; padding-right: 20px">
|
|
|
<el-form :model="postManagement" label-width="80px">
|
|
|
<el-row>
|
|
|
<el-col :span="22">
|
|
|
- <el-form-item class="input-star" label="食堂名称" prop="canteenName">
|
|
|
- <el-input v-model="postManagement.canteenName" placeholder="请输入食堂名称">
|
|
|
+ <el-form-item class="input-star" label="姓名" prop="name">
|
|
|
+ <el-input v-model="postManagement.name" placeholder="请输入工人姓名">
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="22">
|
|
|
- <el-form-item class="input-star" label="供应时间" prop="url">
|
|
|
- <el-select v-model="postManagement.supplyTimeId" @change="timeNodeChange" @remove-tag="timeNodeChange"
|
|
|
- @visible-change="timeNodeChange" multiple placeholder="请选择" style="width: 100%">
|
|
|
- <el-option-group v-for="group in timeNodeOptions" :key="group.label" :label="group.label">
|
|
|
- <el-option v-for="item in group.options" :key="item.id" :label="
|
|
|
- item.supplyStartTime +
|
|
|
- ' —— ' +
|
|
|
- item.supplyEndTime +
|
|
|
- ' (' +
|
|
|
- group.label +
|
|
|
- ')'
|
|
|
- " :value="item.id" :disabled="item.disabled">
|
|
|
- </el-option>
|
|
|
- </el-option-group>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="22">
|
|
|
- <el-form-item class="input-star" label="负责人" prop="principal">
|
|
|
- <el-input v-model="postManagement.principal" maxlength="32" placeholder="请输入食堂负责人">
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="22">
|
|
|
- <el-form-item class="input-star" label="投诉电话" prop="complaintPhone">
|
|
|
- <el-input v-model="postManagement.complaintPhone" placeholder="请输入食堂投诉电话" maxlength="12">
|
|
|
+ <el-form-item class="input-star" label="负责区域" prop="region">
|
|
|
+ <el-input v-model="postManagement.region" maxlength="32" placeholder="请输入工人负责区域">
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="22">
|
|
|
- <el-form-item label="外卖电话" prop="takeoutPhone">
|
|
|
- <el-input v-model="postManagement.takeoutPhone" placeholder="请输入外卖电话" maxlength="12">
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item class="input-star" label="联系电话" prop="phoneNum">
|
|
|
+ <el-input v-model="postManagement.phoneNum" placeholder="请输入工人电话" maxlength="12">
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="食堂图片" prop="url"> </el-form-item>
|
|
|
- <el-upload element-loading-text="数据上传中请等待..." action="" :on-change="handleChange" :multiple="false"
|
|
|
- :auto-upload="false" :http-request="saveWork" list-type="picture-card"
|
|
|
- accept="image/png,image/jpg,image/jpeg,image/bmp" :show-file-list="true" :file-list="fileList"
|
|
|
- :on-remove="picRemove">
|
|
|
- <i class="el-icon-plus"></i>
|
|
|
- </el-upload>
|
|
|
+ <el-col :span="8" >
|
|
|
+ <el-button @click="hasWxUser" style="margin-left: 40px;" type="primary">检索</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
@@ -127,10 +90,9 @@
|
|
|
|
|
|
<script>
|
|
|
import api from "../../api";
|
|
|
+ import Repair from "@/api/repair";
|
|
|
|
|
|
|
|
|
- import CONFIG from "../../../vue.config"
|
|
|
-
|
|
|
export default {
|
|
|
name: "CanteenManage",
|
|
|
created() {
|
|
@@ -147,33 +109,7 @@
|
|
|
query: {
|
|
|
canteenName: "",
|
|
|
},
|
|
|
- // 所有时间节点
|
|
|
- timeNodeList: [],
|
|
|
- // 整体分组
|
|
|
- timeNodeOptions: [],
|
|
|
- // 4个时间段分组
|
|
|
- timeNodeOption1: {
|
|
|
- label: "早餐",
|
|
|
- options: [],
|
|
|
- },
|
|
|
- timeNodeOption2: {
|
|
|
- label: "中餐",
|
|
|
- options: [],
|
|
|
- },
|
|
|
- timeNodeOption3: {
|
|
|
- label: "晚餐",
|
|
|
- options: [],
|
|
|
- },
|
|
|
- timeNodeOption4: {
|
|
|
- label: "外卖",
|
|
|
- options: [],
|
|
|
- },
|
|
|
- // 早餐列表
|
|
|
- timeNodeList1: [],
|
|
|
- // 中餐列表
|
|
|
- timeNodeList2: [],
|
|
|
- timeNodeList3: [],
|
|
|
- timeNodeList4: [],
|
|
|
+
|
|
|
// 列表数据
|
|
|
tableData: [],
|
|
|
// 总数
|
|
@@ -181,15 +117,12 @@
|
|
|
//新增/编辑食堂界面
|
|
|
workDialog: false,
|
|
|
//新增/编辑食堂标题
|
|
|
- workTitle: "新增食堂",
|
|
|
+ workTitle: "新增工人",
|
|
|
// 新增/编辑表单
|
|
|
postManagement: {
|
|
|
- canteenName: "",
|
|
|
- canteenPhotoPath: "",
|
|
|
- supplyTimeId: [],
|
|
|
- principal: "",
|
|
|
- complaint_phone: "",
|
|
|
- takeout_phone: "",
|
|
|
+ name: "",
|
|
|
+ region: "",
|
|
|
+ phoneNum: "",
|
|
|
},
|
|
|
// 分页
|
|
|
sorts: {
|
|
@@ -203,20 +136,19 @@
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- // 删除文件
|
|
|
- picRemove(file, fileList) {
|
|
|
- if (this.postManagement.canteenPhotoPath) {
|
|
|
- let temp = this.postManagement.canteenPhotoPath.split(",");
|
|
|
- for (let i = 0; i < temp.length; i++) {
|
|
|
- if (temp[i] == file.name) {
|
|
|
- temp[i] = temp[i] + "x";
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- this.postManagement.canteenPhotoPath = temp.join(",");
|
|
|
- }
|
|
|
- this.uploadFiles = fileList;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检索当前手机号是否存在微信用户
|
|
|
+ */
|
|
|
+ hasWxUser(){
|
|
|
+ console.log(123);
|
|
|
+ Repair.hasWxUser({
|
|
|
+ "phoneNum":this.postManagement.phoneNum
|
|
|
+ }).then((r)=>{
|
|
|
+ console.log(r);
|
|
|
+ })
|
|
|
},
|
|
|
+
|
|
|
// 列表排序
|
|
|
compare(property) {
|
|
|
return function (a, b) {
|
|
@@ -225,130 +157,7 @@
|
|
|
return value1 - value2;
|
|
|
};
|
|
|
},
|
|
|
- // 供应时间按早中晚外卖排序
|
|
|
- supplyTimeIdSort() {
|
|
|
- // 存在供应时间才排序
|
|
|
- if (
|
|
|
- this.postManagement.supplyTimeId &&
|
|
|
- this.postManagement.supplyTimeId.length > 0
|
|
|
- ) {
|
|
|
- let supplyList = this.postManagement.supplyTimeId;
|
|
|
- let supplyData = [];
|
|
|
- supplyList.forEach((id) => {
|
|
|
- let node = this.timeNodeList.find((item) => item.id === id)
|
|
|
- if (node) {
|
|
|
- supplyData.push(node);
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- supplyData = supplyData.sort(this.compare("timeNode"));
|
|
|
- this.postManagement.supplyTimeId = [];
|
|
|
- supplyData.forEach((item) => {
|
|
|
- this.postManagement.supplyTimeId.push(item.id);
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- // 根据选择的时间节点,保证同一组选项只能选择一个
|
|
|
- timeNodeChange() {
|
|
|
- // 排序
|
|
|
- this.supplyTimeIdSort();
|
|
|
- // 分别代表早中晚快递选择的数量
|
|
|
- let timeNodeNum1 = 0;
|
|
|
- let timeNodeNum2 = 0;
|
|
|
- let timeNodeNum3 = 0;
|
|
|
- let timeNodeNum4 = 0;
|
|
|
- if (
|
|
|
- this.postManagement.supplyTimeId &&
|
|
|
- this.postManagement.supplyTimeId.length > 0
|
|
|
- ) {
|
|
|
- // 遍历已选择的选项
|
|
|
- this.postManagement.supplyTimeId.forEach((item) => {
|
|
|
- let index = this.timeNodeList.findIndex(function (node) {
|
|
|
- return item === node.id;
|
|
|
- });
|
|
|
- // 找到时间节点类型
|
|
|
- if (index !== -1) {
|
|
|
- let nodeType = this.timeNodeList[index].timeNode;
|
|
|
- switch (nodeType) {
|
|
|
- case 1:
|
|
|
- timeNodeNum1++;
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- timeNodeNum2++;
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- timeNodeNum3++;
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- timeNodeNum4++;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- if (timeNodeNum1 > 0) {
|
|
|
- this.timeNodeList1.forEach((node1) => {
|
|
|
- node1.disabled = true;
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.timeNodeList1.forEach((node1) => {
|
|
|
- node1.disabled = false;
|
|
|
- });
|
|
|
- }
|
|
|
- if (timeNodeNum2 > 0) {
|
|
|
- this.timeNodeList2.forEach((node1) => {
|
|
|
- node1.disabled = true;
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.timeNodeList2.forEach((node1) => {
|
|
|
- node1.disabled = false;
|
|
|
- });
|
|
|
- }
|
|
|
- if (timeNodeNum3 > 0) {
|
|
|
- this.timeNodeList3.forEach((node1) => {
|
|
|
- node1.disabled = true;
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.timeNodeList3.forEach((node1) => {
|
|
|
- node1.disabled = false;
|
|
|
- });
|
|
|
- }
|
|
|
- if (timeNodeNum4 > 0) {
|
|
|
- this.timeNodeList4.forEach((node1) => {
|
|
|
- node1.disabled = true;
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.timeNodeList4.forEach((node1) => {
|
|
|
- node1.disabled = false;
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- // 监听文件上传改变
|
|
|
- handleChange(file, fileList) {
|
|
|
- if (file.raw.type === 'image/png' || file.raw.type === 'image/jpg' || file.raw.type ===
|
|
|
- 'image/jpeg' ||
|
|
|
- file.raw.type === 'image/bmp') {
|
|
|
- this.uploadFiles = fileList;
|
|
|
- } else {
|
|
|
- this.$message.error('只能上传jpg或png或bmp或jpeg格式!');
|
|
|
- fileList.splice(-1);
|
|
|
- }
|
|
|
- },
|
|
|
- //打开新增食堂界面
|
|
|
- openAddWork() {
|
|
|
- api
|
|
|
- .supplyTimeList()
|
|
|
- .then((r) => {
|
|
|
- if (r.data.result) {
|
|
|
- // 拿到时间节点,并分组
|
|
|
- this.updateTimeNodeGroup(r.data.data);
|
|
|
- } else {
|
|
|
- this.$message.error("获取时间节点列表失败");
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.$message.error("获取时间节点列表失败");
|
|
|
- });
|
|
|
+ openAddWork(){
|
|
|
this.postManagement = {
|
|
|
canteenName: "",
|
|
|
canteenPhotoPath: "",
|
|
@@ -357,106 +166,19 @@
|
|
|
complaint_phone: "",
|
|
|
takeout_phone: "",
|
|
|
};
|
|
|
- this.fileList = [];
|
|
|
- this.workTitle = "新增食堂";
|
|
|
- this.workDialog = true;
|
|
|
- },
|
|
|
- //打开修改食堂界面
|
|
|
- openModifyWorkDialog(data) {
|
|
|
- api
|
|
|
- .supplyTimeList()
|
|
|
- .then((r) => {
|
|
|
- if (r.data.result) {
|
|
|
- // 拿到时间节点列表,并分组
|
|
|
- this.updateTimeNodeGroup(r.data.data);
|
|
|
- this.postManagement = JSON.parse(JSON.stringify(data));
|
|
|
- if (
|
|
|
- this.postManagement.supplyTimeId &&
|
|
|
- this.postManagement.supplyTimeId !== ""
|
|
|
- ) {
|
|
|
- this.postManagement.supplyTimeId =
|
|
|
- this.postManagement.supplyTimeId.split(",");
|
|
|
- }
|
|
|
- this.timeNodeChange();
|
|
|
- this.fileList = [];
|
|
|
- let params = {
|
|
|
- picId: this.postManagement.canteenPhotoPath,
|
|
|
- };
|
|
|
- if (params.picId && params.picId !== "") {
|
|
|
- api
|
|
|
- .getFoodPicByPicId({
|
|
|
- params,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.data.result) {
|
|
|
- this.fileList = res.data.data.map((item) => {
|
|
|
- return {
|
|
|
- url: this.imgUrl + item.path,
|
|
|
- name: item.id,
|
|
|
- };
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- this.$message.error("获取时间节点列表失败2");
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.$message.error("获取时间节点列表失败1");
|
|
|
- });
|
|
|
- this.workTitle = "编辑食堂";
|
|
|
- this.postManagement = JSON.parse(JSON.stringify(data));
|
|
|
+ this.workTitle = "新增工人";
|
|
|
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
|
|
|
- );
|
|
|
- },
|
|
|
- isMobile(value) {
|
|
|
- if (!value || value === "") {
|
|
|
- return false;
|
|
|
- }
|
|
|
- const mobileReg =
|
|
|
- /^(([1][3,4,5,7,8]\d{9})|([0]\d{10,11})|(\d{7,8})|(\d{4}|\d{3})-(\d{7,8}))$/;
|
|
|
- if (!mobileReg.test(value)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- },
|
|
|
- isTel(value) {
|
|
|
- if (!value || value === "") {
|
|
|
- return false;
|
|
|
- }
|
|
|
- const phoneReg = /^\d{3}-\d{8}|\d{4}-\d{7}$/;
|
|
|
- if (!phoneReg.test(value)) {
|
|
|
- return false;
|
|
|
+ // 监听文件上传改变
|
|
|
+ handleChange(file, fileList) {
|
|
|
+ if (file.raw.type === 'image/png' || file.raw.type === 'image/jpg' || file.raw.type ===
|
|
|
+ 'image/jpeg' ||
|
|
|
+ file.raw.type === 'image/bmp') {
|
|
|
+ this.uploadFiles = fileList;
|
|
|
+ } else {
|
|
|
+ this.$message.error('只能上传jpg或png或bmp或jpeg格式!');
|
|
|
+ fileList.splice(-1);
|
|
|
}
|
|
|
- return true;
|
|
|
},
|
|
|
// 保存
|
|
|
saveWork() {
|
|
@@ -530,7 +252,7 @@
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- this.$message.error(r.data.msg);
|
|
|
+ // this.$message.error(r.data.msg);
|
|
|
});
|
|
|
} else {
|
|
|
// 新增食堂
|
|
@@ -547,7 +269,7 @@
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- this.$message.error(r.data.msg);
|
|
|
+ // this.$message.error(r.data.msg);
|
|
|
});
|
|
|
}
|
|
|
},
|