供应链增加人员配置、供应商人员

This commit is contained in:
jjLv 2025-10-17 08:58:23 +08:00
parent 171c87d447
commit c8fa83bd0f
3 changed files with 843 additions and 0 deletions

View File

@ -0,0 +1,35 @@
import request from '@/utils/request'
import { parseStrEmpty } from '@/utils/bonus'
// 系统人员信息详情
export function getListApi(data) {
return request({
url: '/smart-canteen/person_setting/getList',
method: 'get',
params: data
})
}
export function addApi(query) {
return request({
url: '/smart-canteen/person_setting/add',
method: 'post',
data: query
})
}
export function editApi(query) {
return request({
url: '/smart-canteen/person_setting/update',
method: 'post',
data: query
})
}
export function delApi(query) {
return request({
url: '/smart-canteen/person_setting/delete',
method: 'post',
data: query
})
}

View File

@ -0,0 +1,412 @@
<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>
<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">
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" :show-overflow-tooltip="true"/>
<el-table-column label="手机号" align="center" prop="phone" :show-overflow-tooltip="true"/>
<el-table-column label="性别" align="center" prop="sex" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.sex==0"></span>
<span v-if="scope.row.sex==1"></span>
</template>
</el-table-column>
<el-table-column label="角色" align="center" prop="roleName" :show-overflow-tooltip="true"/>
<el-table-column label="照片" align="center" prop="photoUrl" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<img :src="scope.row.faceUrl" v-if="scope.row.faceUrl" alt="" style="width: 80px;height: 40px;" @click="openImg2(scope.row)">
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<div style="width: 100%;height: 600px;overflow-y: auto;">
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<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="name">
<el-input v-model="form.name"
placeholder="请输入姓名"
maxlength="20"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号:" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" maxlength="11"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别:" prop="sex">
<el-select v-model="form.sex" clearable style="width: 100%;">
<el-option label="男" :value="0"></el-option>
<el-option label="女" :value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="角色" prop="roleId">
<el-select
v-model="form.roleId"
style="width: 100%;"
placeholder="请选择角色"
>
<el-option
v-for="item in dict.type.person_role"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</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-col :span="12">
<el-form-item label="照片:">
<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>
</el-row>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="loadingBtn"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisible" width="700px">
<img style="width: 100%;height: 100%;" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
<script>
import { imgUpLoadTwo } from '@/api/system/upload';
import { decryptWithSM4,encryptWithSM4 } from '@/utils/sm';
import { addApi, delApi, editApi, getListApi } from '@/api/kitchen/personSetting'
export default {
name: "",
dicts: [
'person_role',
],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
tableListData: [],
roleOptions: [],
loading2: false,
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
searchValue: undefined,
type: 'headquarters'
},
//
form: {},
//
rules: {
name: [
{ required: true, message: "姓名不能为空", trigger: "blur" }
],
sex: [
{ required: true, message: "性别不能为空", trigger: "change" }
],
roleId: [
{ required: true, message: "角色不能为空", trigger: "change" }
],
phone: [
{
required: true,
message: '手机号不能为空',
trigger: 'blur',
},
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur',
},
],
},
fileList0: [],//
checkUrlList0: [],//
dialogVisible:false,//
dialogImageUrl:"",//
loadingBtn:false
};
},
created() {
this.getList();
},
computed: {
//1
uploadDisabled0() {
return this.checkUrlList0.length > 0
},
},
methods: {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
searchValue: undefined,
type: 'headquarters'
}
this.resetForm("queryForm");
this.handleQuery();
},
/** 查询列表 */
getList() {
this.loading = true;
let param = {
"searchValue":this.queryParams.searchValue,
"type":this.queryParams.type,
}
getListApi(param).then(response => {
this.tableListData = response.rows;
this.tableListData.forEach(item=>{
if(item.phone&&item.phone!=""){
this.$set(item,"phone",decryptWithSM4(item.phone))
}
})
this.total = Number(response.total);
this.loading = false;
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增";
},
/** 修改按钮操作 */
handleUpdate(row) {
console.log("row", row);
this.reset();
getListApi(row.id).then(response => {
console.log("response",response);
this.form = response.rows[0];
if(response.rows[0].photoUrl){
this.fileList0=[{url:response.rows[0].photoUrl}]
this.checkUrlList0=[response.rows[0].photoUrl]
}else{
this.fileList0=[]
this.checkUrlList0=[]
}
this.form.sex = Number(this.form.sex)
console.log(this.form)
this.$set(this.form,"phone",decryptWithSM4(this.form.phone))
this.open = true;
this.title = "修改";
});
},
//
cancel() {
this.open = false;
},
//
reset() {
this.fileList0 = []//
this.checkUrlList0 = []//
this.form = {};
this.resetForm("form");
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.form)
let param = {
...this.form
}
param.phone = encryptWithSM4(this.form.phone)
if (this.form.id != undefined) {
editApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addApi(param).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delApi(row);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//
imgUpLoad0(param, name, index) {
param.type = 'personSetting'
this.loadingBtn=true
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)
}
this.loadingBtn=false
})
.catch((error) => {
this.$modal.msgError(error)
this.loadingBtn=false
})
},
//
handleBeforeUpload(file) {
const isLt = file.size / 1024 / 1024 < 5
if (!isLt) {
this.$modal.msgError(`图片大小不能超过 5 MB`)
return false
}
},
handleExceed(files, fileList) {
this.$message.warning('最多只可以上传一张图片')
},
handleRemove0(file, fileList) {
let sum = 0
this.checkUrlList0.forEach((item, index) => {
if (item == file.url) {
sum = index
}
})
this.checkUrlList0.splice(sum, 1)
this.$set(this.form,"faceUrl","")
},
//
handlePictureCardPreview(file) {
console.log(file)
this.dialogImageUrl = file.url
this.dialogVisible = true
},
openImg(row) {
this.dialogImageUrl = row.healthCertFrontImg;
this.dialogVisible = true;
},
openImg2(row) {
this.dialogImageUrl = row.faceUrl;
this.dialogVisible = true;
}
}
};
</script>
<style lang="scss" scoped>
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
</style>

View File

@ -0,0 +1,396 @@
<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>
<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">
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" :show-overflow-tooltip="true"/>
<el-table-column label="手机号" align="center" prop="phone" :show-overflow-tooltip="true"/>
<el-table-column label="性别" align="center" prop="sex" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.sex==0"></span>
<span v-if="scope.row.sex==1"></span>
</template>
</el-table-column>
<el-table-column label="角色" align="center" prop="roleName" :show-overflow-tooltip="true"/>
<el-table-column label="照片" align="center" prop="photoUrl" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<img :src="scope.row.faceUrl" v-if="scope.row.faceUrl" alt="" style="width: 80px;height: 40px;" @click="openImg2(scope.row)">
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<div style="width: 100%;height: 600px;overflow-y: auto;">
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<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="name">
<el-input v-model="form.name"
placeholder="请输入姓名"
maxlength="20"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号:" prop="phone">
<el-input v-model="form.phone" placeholder="请输入手机号" maxlength="11"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别:" prop="sex">
<el-select v-model="form.sex" clearable style="width: 100%;">
<el-option label="男" :value="0"></el-option>
<el-option label="女" :value="1"></el-option>
</el-select>
</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-col :span="12">
<el-form-item label="照片:">
<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>
</el-row>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="loadingBtn"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisible" width="700px">
<img style="width: 100%;height: 100%;" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
<script>
import { imgUpLoadTwo } from '@/api/system/upload';
import { decryptWithSM4,encryptWithSM4 } from '@/utils/sm';
import { addApi, delApi, editApi, getListApi } from '@/api/kitchen/personSetting'
export default {
name: "",
dicts: [
'person_role',
],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
tableListData: [],
roleOptions: [],
loading2: false,
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
searchValue: undefined,
type: 'supplier'
},
//
form: {
roleId: 1
},
//
rules: {
name: [
{ required: true, message: "姓名不能为空", trigger: "blur" }
],
sex: [
{ required: true, message: "性别不能为空", trigger: "change" }
],
phone: [
{
required: true,
message: '手机号不能为空',
trigger: 'blur',
},
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur',
},
],
},
fileList0: [],//
checkUrlList0: [],//
dialogVisible:false,//
dialogImageUrl:"",//
loadingBtn:false
};
},
created() {
this.getList();
},
computed: {
//1
uploadDisabled0() {
return this.checkUrlList0.length > 0
},
},
methods: {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
searchValue: undefined,
type: 'supplier'
}
this.resetForm("queryForm");
this.handleQuery();
},
/** 查询列表 */
getList() {
this.loading = true;
let param = {
"searchValue":this.queryParams.searchValue,
"type":this.queryParams.type,
}
getListApi(param).then(response => {
this.tableListData = response.rows;
this.tableListData.forEach(item=>{
if(item.phone&&item.phone!=""){
this.$set(item,"phone",decryptWithSM4(item.phone))
}
})
this.total = Number(response.total);
this.loading = false;
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增";
},
/** 修改按钮操作 */
handleUpdate(row) {
console.log("row", row);
this.reset();
getListApi(row.id).then(response => {
console.log("response",response);
this.form = response.rows[0];
if(response.rows[0].photoUrl){
this.fileList0=[{url:response.rows[0].photoUrl}]
this.checkUrlList0=[response.rows[0].photoUrl]
}else{
this.fileList0=[]
this.checkUrlList0=[]
}
this.form.sex = Number(this.form.sex)
console.log(this.form)
this.$set(this.form,"phone",decryptWithSM4(this.form.phone))
this.open = true;
this.title = "修改";
});
},
//
cancel() {
this.open = false;
},
//
reset() {
this.fileList0 = []//
this.checkUrlList0 = []//
this.form = {};
this.resetForm("form");
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.form)
let param = {
...this.form
}
param.phone = encryptWithSM4(this.form.phone)
param.roleId = 1
if (this.form.id != undefined) {
editApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addApi(param).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delApi(row);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//
imgUpLoad0(param, name, index) {
param.type = 'personSetting'
this.loadingBtn=true
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)
}
this.loadingBtn=false
})
.catch((error) => {
this.$modal.msgError(error)
this.loadingBtn=false
})
},
//
handleBeforeUpload(file) {
const isLt = file.size / 1024 / 1024 < 5
if (!isLt) {
this.$modal.msgError(`图片大小不能超过 5 MB`)
return false
}
},
handleExceed(files, fileList) {
this.$message.warning('最多只可以上传一张图片')
},
handleRemove0(file, fileList) {
let sum = 0
this.checkUrlList0.forEach((item, index) => {
if (item == file.url) {
sum = index
}
})
this.checkUrlList0.splice(sum, 1)
this.$set(this.form,"faceUrl","")
},
//
handlePictureCardPreview(file) {
console.log(file)
this.dialogImageUrl = file.url
this.dialogVisible = true
},
openImg(row) {
this.dialogImageUrl = row.healthCertFrontImg;
this.dialogVisible = true;
},
openImg2(row) {
this.dialogImageUrl = row.faceUrl;
this.dialogVisible = true;
}
}
};
</script>
<style lang="scss" scoped>
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
</style>