bonus-ui/src/views/kitchen/staffManage/staff/index.vue

826 lines
35 KiB
Vue
Raw Normal View History

2025-06-16 15:57:53 +08:00
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="关键字" prop="searchValue">
<el-input v-model="queryParams.searchValue" placeholder="请输入员工姓名,编号,手机号" maxlength="20" clearable style="width: 240px"/>
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-select v-model="queryParams.sex" style="width: 240px" clearable>
<el-option label="男" value="0"></el-option>
<el-option label="女" value="1"></el-option>
</el-select>
</el-form-item>
2025-06-23 16:09:03 +08:00
<el-form-item label="岗位" prop="postName">
<el-input v-model="queryParams.postName" placeholder="请输入员工岗位" maxlength="20" clearable style="width: 240px"/>
2025-06-16 15:57:53 +08:00
</el-form-item>
2025-06-23 16:09:03 +08:00
<el-form-item label="人脸状态" prop="faceState">
<el-select v-model="queryParams.faceState" style="width: 240px" clearable>
2025-06-16 15:57:53 +08:00
<el-option label="开启" value="0"></el-option>
<el-option label="停用" value="1"></el-option>
</el-select>
</el-form-item>
2025-06-23 16:09:03 +08:00
<el-form-item label="健康证" prop="healthCertStatus">
<el-select v-model="queryParams.healthCertStatus" placeholder="健康证状态" style="width: 240px" clearable>
2025-06-16 15:57:53 +08:00
<el-option label="正常" value="0"></el-option>
<el-option label="过期" value="1"></el-option>
<el-option label="缺失" value="2"></el-option>
<el-option label="临期" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableListData" height="800">
2025-06-17 17:49:22 +08:00
<el-table-column label="序号" align="center" width="80" type="index">
2025-06-16 15:57:53 +08:00
<template slot-scope="scope">
2025-06-17 17:49:22 +08:00
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
2025-06-16 15:57:53 +08:00
</template>
2025-06-17 17:49:22 +08:00
</el-table-column>
2025-06-23 16:09:03 +08:00
<el-table-column label="员工编号" align="center" prop="staffNo" :show-overflow-tooltip="true"/>
<el-table-column label="员工名称" align="center" prop="staffName" :show-overflow-tooltip="true" />
<el-table-column label="手机号" align="center" prop="mobile" :show-overflow-tooltip="true"/>
<el-table-column label="性别" align="center" prop="sex" :show-overflow-tooltip="true">
2025-06-19 16:09:31 +08:00
<template slot-scope="scope">
<span v-if="scope.row.sex==0"></span>
<span v-if="scope.row.sex==1"></span>
</template>
</el-table-column>
2025-06-23 16:09:03 +08:00
<el-table-column label="岗位名称" align="center" prop="postName" :show-overflow-tooltip="true"/>
<el-table-column label="员工照片" align="center" prop="faceUrl" :show-overflow-tooltip="true" width="120">
2025-06-19 16:09:31 +08:00
<template slot-scope="scope">
2025-06-23 16:09:03 +08:00
<img :src="scope.row.faceUrl" v-if="scope.row.faceUrl" alt="" style="width: 80px;height: 40px;" @click="openImg2(scope.row)">
2025-06-19 16:09:31 +08:00
<span v-else></span>
</template>
</el-table-column>
2025-06-23 16:09:03 +08:00
<el-table-column label="人脸状态" align="center" prop="faceState" :show-overflow-tooltip="true" width="150">
2025-06-19 16:09:31 +08:00
<template slot-scope="scope">
2025-06-23 16:09:03 +08:00
<!-- <span v-if="scope.row.faceState==0">开启</span>
<span v-if="scope.row.faceState==1">关闭</span> -->
<el-switch @change="changeSwitch(scope.row)"
v-model="scope.row.faceState"
:active-value="1" active-text="开启"
:inactive-value="2" inactive-text="关闭">
</el-switch>
2025-06-19 16:09:31 +08:00
</template>
</el-table-column>
2025-06-23 16:09:03 +08:00
<el-table-column label="健康证照片" align="center" prop="healthCertFrontImg" :show-overflow-tooltip="true" width="120">
2025-06-19 16:09:31 +08:00
<template slot-scope="scope">
<img :src="scope.row.healthCertFrontImg" v-if="scope.row.healthCertFrontImg" alt="" style="width: 80px;height: 40px;" @click="openImg(scope.row)">
<span v-else></span>
</template>
</el-table-column>
2025-06-23 16:09:03 +08:00
<el-table-column label="出入权限" align="center" prop="" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope">
<span style="color: #1890ff;" @click="openAccessAuth(scope.row)">查看</span>
</template>
</el-table-column>
<el-table-column label="健康证状态" align="center" prop="healthCertStatusName" :show-overflow-tooltip="true" width="150">
2025-06-19 16:09:31 +08:00
<template slot-scope="scope">
<div>{{ scope.row.healthCertStatusName }}</div>
<div>有效期至{{ scope.row.healthCertExpire }}</div>
</template>
</el-table-column>
2025-06-23 16:09:03 +08:00
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
2025-06-16 15:57:53 +08:00
<template slot-scope="scope">
2025-06-17 17:49:22 +08:00
<el-button
2025-06-16 15:57:53 +08:00
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
2025-06-17 17:49:22 +08:00
>编辑</el-button>
<el-button
2025-06-16 15:57:53 +08:00
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
2025-06-17 17:49:22 +08:00
>删除</el-button>
2025-06-16 15:57:53 +08:00
</template>
2025-06-17 17:49:22 +08:00
</el-table-column>
2025-06-16 15:57:53 +08:00
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改参数配置对话框 -->
2025-06-19 10:40:59 +08:00
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<div style="width: 100%;height: 600px;overflow-y: auto;">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="24">
<div style="font-size: 18px;font-weight: bold;border-left: 4px solid #1890FF;padding-left: 4px;margin-bottom: 20px;">
个人信息
</div>
</el-col>
<el-col :span="12">
2025-06-23 16:09:03 +08:00
<el-form-item label="员工名称:" prop="staffName">
<el-input v-model="form.staffName"
placeholder="请输入员工名称"
maxlength="30"
/>
2025-06-19 10:40:59 +08:00
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="员工编号:" prop="staffNo">
<el-input v-model="form.staffNo"
placeholder="请输入员工编号"
maxlength="30"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="员工性别:" prop="sex">
2025-06-23 16:09:03 +08:00
<el-select v-model="form.sex" clearable style="width: 100%;">
<el-option label="男" :value="0"></el-option>
<el-option label="女" :value="1"></el-option>
2025-06-19 10:40:59 +08:00
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
2025-06-23 16:09:03 +08:00
<el-form-item label="手机号:" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入手机号" maxlength="11"/>
2025-06-19 10:40:59 +08:00
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="关联食堂:" prop="canteenId">
<el-select v-model="form.canteenId" style="width: 100%;" placeholder="请选择关联食堂">
<el-option
v-for="item in canteenOptions"
:key="item.canteenId"
:label="item.canteenName"
:value="item.canteenId"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
2025-06-23 16:09:03 +08:00
<el-form-item label="岗位名称:" prop="postName">
<el-input v-model="form.postName" placeholder="请输入岗位名称" maxlength="20" />
2025-06-19 10:40:59 +08:00
</el-form-item>
</el-col>
2025-06-23 16:09:03 +08:00
<el-col :span="24">
<div style="font-size: 18px;font-weight: bold;border-left: 4px solid #1890FF;padding-left: 4px;margin-bottom: 20px;">
人脸信息
</div>
</el-col>
<el-col :span="12">
<el-form-item label="人脸照片:" prop="faceUrl">
<el-upload
:http-request="
(obj) => imgUpLoad0(obj, 'fileUrl')
"
action="#"
:limit="1"
:file-list="fileList0"
:show-file-list="true"
list-type="picture-card"
accept=".png, .jpg, .jpeg"
:class="{ disabled: uploadDisabled0 }"
:before-upload="handleBeforeUpload"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove0"
>
<i
class="el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
</el-form-item>
</el-col>
2025-06-19 10:40:59 +08:00
<el-col :span="24">
<div style="font-size: 18px;font-weight: bold;border-left: 4px solid #1890FF;padding-left: 4px;margin-bottom: 20px;">
健康证信息
</div>
</el-col>
2025-06-23 16:09:03 +08:00
2025-06-19 10:40:59 +08:00
<el-col :span="24">
<el-form-item label="健康证到期:" prop="healthCertExpire">
<el-date-picker v-model="form.healthCertExpire" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 45%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="健康证正面照片:" prop="healthCertFrontImg">
<el-upload
:http-request="
2025-06-23 16:09:03 +08:00
(obj) => imgUpLoad1(obj, 'fileUrl')
2025-06-19 10:40:59 +08:00
"
action="#"
:limit="1"
2025-06-23 16:09:03 +08:00
:file-list="fileList1"
2025-06-19 10:40:59 +08:00
:show-file-list="true"
list-type="picture-card"
accept=".png, .jpg, .jpeg"
2025-06-23 16:09:03 +08:00
:class="{ disabled: uploadDisabled1 }"
2025-06-19 10:40:59 +08:00
:before-upload="handleBeforeUpload"
:on-preview="handlePictureCardPreview"
2025-06-23 16:09:03 +08:00
:on-remove="handleRemove1"
2025-06-19 10:40:59 +08:00
>
<i
class="el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="健康证反面照片:" prop="healthCertBackImg">
<el-upload
:http-request="
(obj) => imgUpLoad2(obj, 'fileUrl')
"
action="#"
:limit="1"
:file-list="fileList2"
:show-file-list="true"
list-type="picture-card"
accept=".png, .jpg, .jpeg"
:class="{ disabled: uploadDisabled2 }"
:before-upload="handleBeforeUpload"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove2"
>
<i
class="el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="24">
<div style="font-size: 18px;font-weight: bold;border-left: 4px solid #1890FF;padding-left: 4px;margin-bottom: 20px;">
出入权限
</div>
</el-col>
</el-row>
<el-row :span="24" v-for="(item,index) in accessAuthorityList" :key="index">
<el-col :span="8">
2025-06-19 16:09:31 +08:00
<el-form-item label="关联门禁设备:" prop="deviceId">
<el-select v-model="item.deviceId" style="width: 100%;" placeholder="请选择关联门禁设备" :loading="loading2" @change="chosenDevice">
2025-06-19 10:40:59 +08:00
<el-option
2025-06-19 16:09:31 +08:00
v-for="items in devicesOptions"
:disabled="items.disabled"
:key="items.deviceId"
:label="items.deviceName"
:value="items.deviceId"
2025-06-19 10:40:59 +08:00
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备位置:" prop="location">
2025-06-19 16:09:31 +08:00
<el-input v-model="item.location"
2025-06-19 10:40:59 +08:00
placeholder="设备位置"
maxlength="30" disabled
/>
</el-form-item>
</el-col>
<el-col :span="8" style="display: flex;align-items: center;height: 40px;padding-left: 20px;">
<el-button
type="primary"
plain
2025-06-19 16:09:31 +08:00
size="mini" v-if="index==accessAuthorityList.length-1"
2025-06-19 10:40:59 +08:00
@click="addDevice"
>新增</el-button>
<el-button
type="info"
plain
2025-06-19 16:09:31 +08:00
size="mini" v-if="accessAuthorityList.length>1"
2025-06-19 10:40:59 +08:00
@click="delDevice(index)"
2025-06-19 16:09:31 +08:00
>删除</el-button>
2025-06-19 10:40:59 +08:00
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div style="font-size: 18px;font-weight: bold;border-left: 4px solid #1890FF;padding-left: 4px;margin-bottom: 20px;">
留样柜权限
</div>
</el-col>
<el-col :span="12">
2025-06-19 16:09:31 +08:00
<el-form-item label="留样柜权限:" prop="simpleCabinetStatus">
<el-switch v-model="simpleCabinetStatus"
2025-06-19 10:40:59 +08:00
active-text="开启" inactive-text="关闭"
2025-06-19 16:09:31 +08:00
:active-value="1" :inactive-value="2">
2025-06-19 10:40:59 +08:00
</el-switch>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
2025-06-16 15:57:53 +08:00
</el-dialog>
2025-06-23 16:09:03 +08:00
<el-dialog :title="title" :visible.sync="open2" width="900px" append-to-body>
<div style="width: 100%;height: 300px;overflow-y: auto;">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="24">
<div style="font-size: 18px;font-weight: bold;border-left: 4px solid #1890FF;padding-left: 4px;margin-bottom: 20px;">
出入权限
</div>
</el-col>
</el-row>
<el-row :span="24" v-for="(item,index) in accessAuthorityList" :key="index">
<el-col :span="8">
<el-form-item label="关联门禁设备:" prop="deviceId">
<el-select v-model="item.deviceId" style="width: 100%;" placeholder="请选择关联门禁设备" disabled @change="chosenDevice">
<el-option
v-for="items in devicesOptions"
:disabled="items.disabled"
:key="items.deviceId"
:label="items.deviceName"
:value="items.deviceId"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备位置:" prop="location">
<el-input v-model="item.location"
placeholder="设备位置"
maxlength="30" disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div style="font-size: 18px;font-weight: bold;border-left: 4px solid #1890FF;padding-left: 4px;margin-bottom: 20px;">
留样柜权限
</div>
</el-col>
<el-col :span="12">
<el-form-item label="留样柜权限:" prop="simpleCabinetStatus">
<el-switch v-model="simpleCabinetStatus" disabled
active-text="开启" inactive-text="关闭"
:active-value="1" :inactive-value="2">
</el-switch>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="open2=false"> </el-button>
<el-button @click="open2=false"> </el-button>
</div>
</el-dialog>
2025-06-16 15:57:53 +08:00
<el-dialog :visible.sync="dialogVisible" width="700px">
<img style="width: 100%;height: 100%;" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
<script>
2025-06-19 10:40:59 +08:00
import { getCanteenByAreaApi } from "@/api/base/stall";
2025-06-19 16:09:31 +08:00
import { getKitchenDeviceSelectApi } from "@/api/kitchen/devices";
2025-06-23 16:09:03 +08:00
import { getStaffListApi,getStaffInfoApi,addKitchenStaffApi,editKitchenStaffApi,delStaffApi,editStaffFaceStateApi} from '@/api/kitchen/staff';
2025-06-16 15:57:53 +08:00
import { imgUpLoadTwo } from '@/api/system/upload';
export default {
2025-06-19 10:40:59 +08:00
name: "",
dicts: [],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
//表格数据
tableListData: [],
// 食堂选项
canteenOptions:[],
2025-06-19 16:09:31 +08:00
// 设备选项
devicesOptions:[],
loading2: false,
2025-06-19 10:40:59 +08:00
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
2025-06-23 16:09:03 +08:00
open2: false,
2025-06-19 10:40:59 +08:00
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
canteenName: undefined,
areaNameStr: undefined,
},
// 表单参数
form: {},
2025-06-19 16:09:31 +08:00
//员工设备权限
accessAuthorityList:[
{
deviceId:"",
location:""
}
],
simpleCabinetStatus:1,
2025-06-19 10:40:59 +08:00
// 表单校验
rules: {
2025-06-23 16:09:03 +08:00
staffName: [
{ required: true, message: "员工名称不能为空", trigger: "blur" }
],
staffNo: [
{ required: true, message: "员工编号不能为空", trigger: "blur" }
],
sex: [
{ required: true, message: "员工性别不能为空", trigger: "change" }
],
mobile: [
{
required: true,
message: '手机号不能为空',
trigger: 'blur',
},
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur',
},
2025-06-19 10:40:59 +08:00
],
canteenId: [
{ required: true, message: "关联食堂不能为空", trigger: "change" }
],
2025-06-23 16:09:03 +08:00
postName: [
{ required: true, message: "员工岗位名称不能为空", trigger: "blur" }
],
2025-06-19 10:40:59 +08:00
},
2025-06-23 16:09:03 +08:00
fileList0: [],//图片
checkUrlList0: [],//图片
fileList1: [],//图片
checkUrlList1: [],//图片
2025-06-19 10:40:59 +08:00
fileList2: [],//图片
checkUrlList2: [],//图片
dialogVisible:false,//图片弹窗
dialogImageUrl:"",//图片弹窗
};
},
2025-06-23 16:09:03 +08:00
created() {
2025-06-19 10:40:59 +08:00
this.getList();
},
computed: {
2025-06-16 15:57:53 +08:00
//图片上传1张后隐藏上传框
2025-06-23 16:09:03 +08:00
uploadDisabled0() {
return this.checkUrlList0.length > 0
},
uploadDisabled1() {
return this.checkUrlList1.length > 0
2025-06-16 15:57:53 +08:00
},
uploadDisabled2() {
return this.checkUrlList2.length > 0
},
2025-06-19 10:40:59 +08:00
},
methods: {
// 食堂选项
getCanteenList(){
getCanteenByAreaApi({}).then((response) => {
this.canteenOptions = response.rows
2025-06-18 11:01:40 +08:00
})
2025-06-17 17:49:22 +08:00
},
2025-06-19 16:09:31 +08:00
// 门禁设备选项
getKitchenDeviceSelect(){
getKitchenDeviceSelectApi({deviceType:3}).then((response) => {
this.devicesOptions = response.data
})
},
2025-06-16 15:57:53 +08:00
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 查询列表 */
getList() {
this.loading = true;
let param = {
2025-06-19 16:52:42 +08:00
"searchValue":this.queryParams.searchValue,
"sex":this.queryParams.sex,
2025-06-23 16:09:03 +08:00
"faceState":this.queryParams.faceState,
"postName":this.queryParams.postName,
"healthCertStatus":this.queryParams.healthCertStatus,
2025-06-19 10:40:59 +08:00
"pageNum": this.queryParams.pageNum,
2025-06-19 16:52:42 +08:00
"pageSize": this.queryParams.pageSize
2025-06-23 16:09:03 +08:00
}
2025-06-19 10:40:59 +08:00
getStaffListApi(param).then(response => {
this.tableListData = response.rows;
2025-06-16 15:57:53 +08:00
this.total = Number(response.total);
this.loading = false;
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增";
},
/** 修改按钮操作 */
handleUpdate(row) {
2025-06-19 10:40:59 +08:00
this.reset();
getStaffInfoApi(row.staffId).then(response => {
this.form = response.data;
2025-06-19 16:09:31 +08:00
if(response.data.healthCertFrontImg){
2025-06-23 16:09:03 +08:00
this.fileList0=[{url:response.data.faceUrl}]
this.checkUrlList0=[response.data.faceUrl]
}else{
this.fileList0=[]
this.checkUrlList0=[]
}
if(response.data.healthCertFrontImg){
this.fileList1=[{url:response.data.healthCertFrontImg}]
this.checkUrlList1=[response.data.healthCertFrontImg]
2025-06-19 16:09:31 +08:00
}else{
2025-06-23 16:09:03 +08:00
this.fileList1=[]
this.checkUrlList1=[]
2025-06-19 16:09:31 +08:00
}
if(response.data.healthCertBackImg){
this.fileList2=[{url:response.data.healthCertBackImg}]
this.checkUrlList2=[response.data.healthCertBackImg]
}else{
this.fileList2=[]
this.checkUrlList2=[]
}
console.log(this.form)
if(this.form.accessAuthorityList&&this.form.accessAuthorityList.length>0){
console.log(this.form.accessAuthorityList)
2025-06-19 16:30:34 +08:00
this.accessAuthorityList = []
2025-06-19 16:09:31 +08:00
this.form.accessAuthorityList.forEach(item=>{
if(item.deviceType==3){
this.accessAuthorityList.push(item)
this.$forceUpdate()
}
if(item.deviceType==7){
2025-06-19 16:30:34 +08:00
this.simpleCabinetStatus = Number(item.privilegeValue)
2025-06-19 16:09:31 +08:00
}
})
}
console.log(this.accessAuthorityList)
2025-06-16 15:57:53 +08:00
this.open = true;
this.title = "修改";
2025-06-19 10:40:59 +08:00
});
2025-06-16 15:57:53 +08:00
},
// 取消按钮
cancel() {
this.open = false;
},
// 表单重置
reset() {
2025-06-19 10:40:59 +08:00
this.getCanteenList();
2025-06-19 16:09:31 +08:00
this.getKitchenDeviceSelect();
this.fileList = []//图片
this.checkUrlList = []//图片
this.fileList2 = []//图片
this.checkUrlList2 = []//图片
this.accessAuthorityList = [{
deviceId:"",
location:""
}]
this.simpleCabinetStatus=1
2025-06-16 15:57:53 +08:00
this.form = {};
this.resetForm("form");
2025-06-19 10:40:59 +08:00
},
2025-06-23 16:09:03 +08:00
changeSwitch(row){
console.log(row.faceState)
let param = {
staffId:row.staffId,
faceState:row.faceState
}
editStaffFaceStateApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.getList();
});
},
openAccessAuth(row){
this.getKitchenDeviceSelect();
if(row.accessAuthorityList&&row.accessAuthorityList.length>0){
console.log(row.accessAuthorityList)
this.accessAuthorityList = []
row.accessAuthorityList.forEach(item=>{
if(item.deviceType==3){
this.accessAuthorityList.push(item)
this.$forceUpdate()
}
if(item.deviceType==7){
this.simpleCabinetStatus = Number(item.privilegeValue)
}
})
}
console.log(this.accessAuthorityList)
this.open2=true
this.title = "出入权限";
2025-06-19 10:40:59 +08:00
},
//添加设备
addDevice(){
2025-06-19 16:09:31 +08:00
if(this.accessAuthorityList.length<this.devicesOptions.length){
this.accessAuthorityList.push({
deviceId:"",
location:""
})
}
2025-06-19 10:40:59 +08:00
},
//删除设备
delDevice(index){
2025-06-19 16:09:31 +08:00
this.accessAuthorityList.splice(index,1)
},
chosenDevice(e){
let index = this.devicesOptions.findIndex(v=>v.deviceId==e)
let index2 = this.accessAuthorityList.findIndex(v=>v.deviceId==e)
this.accessAuthorityList[index2].deviceName = this.devicesOptions[index].deviceName;
this.accessAuthorityList[index2].deviceType = this.devicesOptions[index].deviceType;
this.accessAuthorityList[index2].privilegeValue = 1;
this.accessAuthorityList[index2].location = this.devicesOptions[index].subPlace;
this.loading2=true
this.setDisabled()
this.loading2=false
2025-06-19 10:40:59 +08:00
},
2025-06-19 16:09:31 +08:00
//组成成分,已选过的原料不能再选择
setDisabled(){
this.devicesOptions.forEach(item=>{
let index = this.accessAuthorityList.findIndex(v=>v.deviceId==item.deviceId)
if(index!=-1){
item.disabled = true
}else{
item.disabled = false
}
})
},
2025-06-16 15:57:53 +08:00
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
2025-06-19 16:09:31 +08:00
if (valid) {
let arr = [{
deviceId:"",
deviceName:"",
deviceType:7,
privilegeValue:this.simpleCabinetStatus,
location:""
}]
this.form.accessAuthorityList = this.accessAuthorityList.concat(arr)
console.log(this.form)
2025-06-19 10:40:59 +08:00
if (this.form.staffId != undefined) {
editKitchenStaffApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
2025-06-16 15:57:53 +08:00
} else {
2025-06-19 10:40:59 +08:00
addKitchenStaffApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
2025-06-16 15:57:53 +08:00
}
}
});
},
/** 删除按钮操作 */
2025-06-19 10:40:59 +08:00
handleDelete(row) {
2025-06-16 15:57:53 +08:00
this.$modal.confirm('是否确认删除数据项?').then(function() {
2025-06-19 10:40:59 +08:00
return delStaffApi(row.staffId);
2025-06-16 15:57:53 +08:00
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
// 图片上传
2025-06-23 16:09:03 +08:00
imgUpLoad0(param, name, index) {
param.type = 'canteen'
imgUpLoadTwo(param).then((res) => {
if (res.code == 200) {
this.checkUrlList0.push(res.data.url)
this.$set(this.form,"faceUrl",res.data.url)
} else {
this.$modal.msgError(res.msg)
}
})
.catch((error) => {
this.$modal.msgError(error)
})
},
imgUpLoad1(param, name, index) {
2025-06-16 15:57:53 +08:00
param.type = 'canteen'
imgUpLoadTwo(param).then((res) => {
if (res.code == 200) {
2025-06-23 16:09:03 +08:00
this.checkUrlList1.push(res.data.url)
2025-06-19 16:09:31 +08:00
this.$set(this.form,"healthCertFrontImg",res.data.url)
} else {
this.$modal.msgError(res.msg)
}
})
.catch((error) => {
this.$modal.msgError(error)
})
},
imgUpLoad2(param, name, index) {
param.type = 'canteen'
imgUpLoadTwo(param).then((res) => {
if (res.code == 200) {
this.checkUrlList2.push(res.data.url)
this.$set(this.form,"healthCertBackImg",res.data.url)
2025-06-16 15:57:53 +08:00
} else {
this.$modal.msgError(res.msg)
}
})
.catch((error) => {
this.$modal.msgError(error)
})
},
// 上传之前
handleBeforeUpload(file) {
const isLt = file.size / 1024 / 1024 < 5
if (!isLt) {
this.$modal.msgError(`图片大小不能超过 5 MB`)
return false
}
},
handleExceed(files, fileList) {
this.$message.warning('最多只可以上传一张图片')
},
2025-06-23 16:09:03 +08:00
handleRemove0(file, fileList) {
let sum = 0
this.checkUrlList.forEach((item, index) => {
if (item == file.url) {
sum = index
}
})
this.checkUrlList0.splice(sum, 1)
this.$set(this.form,"faceUrl","")
},
handleRemove1(file, fileList) {
2025-06-16 15:57:53 +08:00
let sum = 0
this.checkUrlList.forEach((item, index) => {
if (item == file.url) {
sum = index
}
})
2025-06-23 16:09:03 +08:00
this.checkUrlList1.splice(sum, 1)
2025-06-19 16:09:31 +08:00
this.$set(this.form,"healthCertFrontImg","")
2025-06-16 15:57:53 +08:00
},
handleRemove2(file, fileList) {
let sum = 0
this.checkUrlList2.forEach((item, index) => {
if (item == file.url) {
sum = index
}
})
2025-06-19 16:09:31 +08:00
this.checkUrlList2.splice(sum,1)
this.$set(this.form,"healthCertBackImg","")
2025-06-16 15:57:53 +08:00
},
//图片点击查看
handlePictureCardPreview(file) {
console.log(file)
this.dialogImageUrl = file.url
this.dialogVisible = true
2025-06-19 16:09:31 +08:00
},
openImg(row) {
this.dialogImageUrl = row.healthCertFrontImg;
this.dialogVisible = true;
},
openImg2(row) {
2025-06-23 16:09:03 +08:00
this.dialogImageUrl = row.faceUrl;
2025-06-19 16:09:31 +08:00
this.dialogVisible = true;
2025-06-16 15:57:53 +08:00
}
}
};
</script>
<style lang="scss" scoped>
//隐藏图片上传框的css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
</style>