Commit 59212aa5 authored by 姬鋆屾's avatar 姬鋆屾

feated:对列表优化显示及头像优化显示,增加复职功能,修改bug

parent 1e802661
......@@ -25,6 +25,7 @@ export default {
this.changePath("device");
}
this.query = Object.assign({}, this.query, route.query);
this.getData();
},
},
......@@ -63,6 +64,14 @@ export default {
return;
}
this.tableData.loading = true;
console.log(this.query);
if (this.$route.path == "/user/list") {
this.query.userType
? (this.query.userTypeList = [])
: "userType" in this.query
? (this.query.userTypeList = [])
: (this.query.userTypeList = ["0", "1"]);
}
this.$post(this.pageInfo.list, this.query, {
cancelToken: this.source.token,
})
......
exports.install = function (Vue) {
exports.install = function(Vue) {
// 把需要暴露出去的方法挂载到Vue原型上,避免了全局变量过多的问题
Vue.prototype.refreshData = function () {
console.log("刷新设备列表")
const component = findComponentDownward(this, 'Device')
console.log("component",component)
if(component){
component.getData()
}
}
Vue.prototype.refreshData = function() {
console.log("刷新设备列表");
const component = findComponentDownward(this, "Device");
console.log("component", component);
if (component) {
component.getData();
}
};
};
/**
/**
* 由一个组件,向下找到最近的指定组件
* @param {*} context 当前上下文,比如你要基于哪个组件来向上寻找,一般都是基于当前的组件,也就是传入 this
* @param {*} componentName 要找的组件的 name
*/
function findComponentDownward(context, componentName) {
const childrens = context.$children
let children = null
function findComponentDownward(context, componentName) {
const childrens = context.$children;
let children = null;
if (childrens.length) {
for (const child of childrens) {
const name = child.$options.name
const name = child.$options.name;
if (name === componentName) {
children = child
break
children = child;
break;
} else {
children = findComponentDownward(child, componentName)
if (children) break
}
children = findComponentDownward(child, componentName);
if (children) break;
}
}
return children
}
\ No newline at end of file
return children;
}
......@@ -53,8 +53,7 @@
@click="handleDelete(index)"
type="danger"
>删除
</el-link
>
</el-link>
</div>
</li>
</transition-group>
......@@ -62,7 +61,6 @@
</template>
<script>
export default {
props: {
// 值
......@@ -86,18 +84,18 @@ export default {
// 是否显示提示
isShowTip: {
type: Boolean,
default: true
default: true,
},
//保存服务器路径前缀地址
prePath: {
type: String,
default: '',
default: "",
},
//默认文件名称
fileName: {
type: String,
default: '',
}
default: "",
},
},
data() {
return {
......@@ -112,14 +110,14 @@ export default {
watch: {
value: {
handler(val) {
if (val&&val!=='') {
if (val && val !== "") {
this.showFileList();
} else {
this.fileList = [];
return [];
}
}
}
},
},
},
computed: {
......@@ -129,16 +127,15 @@ export default {
},
},
methods: {
showFileList(){
showFileList() {
let temp = 1;
// 首先将值转为数组
const filePathlist = this.value.split(',');
const filePathlist = this.value.split(",");
// 然后将数组转为对象数组
const fileNamelist =this.fileName.split(',');
const fileNamelist = this.fileName.split(",");
for (var i = 0; i < filePathlist.length; i++) {
if(filePathlist[i]==='') continue
let item = {}
if (filePathlist[i] === "") continue;
let item = {};
if (fileNamelist.length === filePathlist.length) {
item.name = fileNamelist[i];
} else {
......@@ -146,11 +143,10 @@ export default {
}
item.url = filePathlist[i];
item.uid = new Date().getTime() + temp++;
this.fileList.push(item)
this.fileList.push(item);
}
},
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 校检文件类型
......@@ -165,7 +161,9 @@ export default {
return false;
});
if (!isTypeOk) {
this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
this.$message.error(
`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
);
return false;
}
}
......@@ -190,13 +188,17 @@ export default {
// 上传成功回调
handleUploadSuccess(res, file) {
if (res.code === 1) {
this.fileList.push({name: res.fileName, url: res.url, uid: new Date().getTime()});
this.fileList.push({
name: res.fileName,
url: res.url,
uid: new Date().getTime(),
});
let newFileList = this.fileList.map(i => i.url);
let newFileNameList = this.fileList.map(i => i.name);
let newFileList = this.fileList.map((i) => i.url);
let newFileNameList = this.fileList.map((i) => i.name);
this.$emit("input", newFileList.join(","));
this.$emit("getFileName", newFileNameList.join(","));
this.fileList =[]
this.fileList = [];
this.$message.success("上传成功");
} else {
this.$message.error(res.msg);
......@@ -206,11 +208,11 @@ export default {
handleDelete(index) {
//todo 删除文件
this.fileList.splice(index, 1);
let newFileList = this.fileList.map(i => i.url);
let newFileNameList = this.fileList.map(i => i.name);
let newFileList = this.fileList.map((i) => i.url);
let newFileNameList = this.fileList.map((i) => i.name);
this.$emit("input", newFileList.join(","));
this.$emit("getFileName", newFileNameList.join(","));
this.fileList =[]
this.fileList = [];
// this.$emit("input", '');
},
// 获取文件名称
......@@ -220,11 +222,14 @@ export default {
} else {
return name;
}
}
},
},
created() {
console.log("file create")
this.$nextTick(() => {
console.log(this.list);
this.showFileList();
});
// this.fileList = this.list;
},
};
......
<template>
<div>
<el-image
v-for="val in realSrcList"
:key="val"
:src="`${val}`"
fit="cover"
:style="`width:${realWidth};height:${realHeight};margin-right:10px;margin-bottom:10px`"
:preview-src-list="realSrcList"
>
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
</template>
<script>
export default {
name: "ImagePreview",
props: {
src: {
type: String,
required: true,
},
width: {
type: [Number, String],
default: "",
},
height: {
type: [Number, String],
default: "",
},
},
computed: {
realSrc() {
let real_src = this.src.split(",");
return real_src;
},
realSrcList() {
let real_src_list = this.src.split(",");
let srcList = [];
real_src_list.forEach((item) => {
return srcList.push(item);
});
return srcList;
},
realWidth() {
return typeof this.width == "string" ? this.width : `${this.width}px`;
},
realHeight() {
return typeof this.height == "string" ? this.height : `${this.height}px`;
},
},
};
</script>
<style lang="scss" scoped>
.el-image {
border-radius: 5px;
background-color: #ebeef5;
box-shadow: 0 0 5px 1px #ccc;
::v-deep .el-image__inner {
transition: all 0.3s;
cursor: pointer;
&:hover {
transform: scale(1.2);
}
}
::v-deep .image-slot {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
color: #909399;
font-size: 30px;
}
}
</style>
......@@ -256,6 +256,7 @@ export default {
}
});
this.form = Object.assign({}, this.form, newFormData);
//this.form = Object.assign({}, this.form, data);
},
cleanForm() {
......@@ -277,6 +278,11 @@ export default {
onSubmit() {
let { path, query } = this.$route;
let data = this.decode(this.form);
for (let val in data) {
if (val == "userType") {
query.userTypeList = [];
}
}
this.$router.push({
path: path,
query: Object.assign({}, query, data),
......
......@@ -3,15 +3,22 @@
<template>
<div class="my-upload">
<label>
<el-button icon='el-icon-upload' size='mini' :loading='loading'>{{loading ? '上传中...' : tip}}</el-button>
<input type="file" @change='chooseFile' :disabled="loading" ref="referenceUpload">
<el-button icon="el-icon-upload" size="mini" :loading="loading">{{
loading ? "上传中..." : tip
}}</el-button>
<input
type="file"
@change="chooseFile"
:disabled="loading"
ref="referenceUpload"
/>
</label>
<div v-if='value' class='flex'>
<div v-if="value" class="flex">
<div style="margin-right: 20px">
<div v-if='type === "thumb"' class='thumb' :style="imgCover"></div>
<div v-else>文件名: {{value}}</div>
<div v-if="type === 'thumb'" class="thumb" :style="imgCover"></div>
<div v-else>文件名: {{ value }}</div>
</div>
<!-- <div>
<!-- <div>
<el-button icon="el-icon-delete" size='mini' plain @click='del'>删除</el-button>
</div>-->
</div>
......@@ -23,37 +30,39 @@ export default {
props: {
value: {
type: String,
default: '',
default: "",
},
type: { // 展示类型,文件名或缩略图 filename | thumb
type: {
// 展示类型,文件名或缩略图 filename | thumb
type: String,
default: 'filename',
default: "filename",
},
tip: { // 按钮文字
tip: {
// 按钮文字
type: String,
default: '上传文件',
default: "上传文件",
},
prePath: {
type: String,
default: '',
}
default: "",
},
},
methods: {
del() {
this.$emit("input", "")
this.$emit("input", "");
},
async chooseFile(e) {
this.loading = true;
console.log(e);
try {
const {code, url} = await this.$upload('file/upload', {
const { code, url } = await this.$upload("file/upload", {
uploadFile: e.target.files[0],
prePath: this.prePath
prePath: this.prePath,
});
if(code === 1) {
this.$emit('input', url)
}else{
this.$message.error('上传文件失败');
if (code === 1) {
this.$emit("input", url);
} else {
this.$message.error("上传文件失败");
}
} catch (error) {
this.$message.error(error.message);
......@@ -65,21 +74,21 @@ export default {
computed: {
imgCover() {
return `background-image: url(${this.value})`;
}
},
},
data() {
return {
loading: false,
}
}
}
};
},
};
</script>
<style lang="less">
.my-upload{
label{
.my-upload {
label {
position: relative;
input{
input {
display: block;
position: absolute;
width: 100%;
......@@ -89,7 +98,7 @@ export default {
opacity: 0;
}
}
.thumb{
.thumb {
width: 80px;
height: 80px;
background-size: contain;
......@@ -99,7 +108,7 @@ export default {
border-radius: 5px;
overflow: hidden;
}
p{
p {
color: #666;
font-size: 14px;
}
......
......@@ -61,7 +61,18 @@ export default {
style="width: 70px; height: 70px"
src={row.photoPath}
preview-src-list={[row.photoPath]}
></el-image>
>
<div
slot="error"
class="image-slot"
style="width: 70px; height: 70px;display:flex;justify-content: center;align-items: center;"
>
<i
class="el-icon-picture-outline"
style="font-size:26px"
></i>
</div>
</el-image>
) : (
"--"
);
......
......@@ -101,7 +101,18 @@ export default {
style="width: 70px; height: 70px"
src={row.photoPath}
preview-src-list={[row.photoPath]}
></el-image>
>
<div
slot="error"
class="image-slot"
style="width: 70px; height: 70px;display:flex;justify-content: center;align-items: center;"
>
<i
class="el-icon-picture-outline"
style="font-size:26px"
></i>
</div>
</el-image>
) : (
"--"
);
......
......@@ -45,8 +45,32 @@
</div>
<div class="jyitem">
<div class="leftlabel">附件</div>
<!-- <Field label="附件名称,多个逗号分割" prop="fileName" v-model="form.fileName" placeholder="请输入附件名称,多个逗号分割"/>
<Field label="附件地址,多个逗号分割"><fileUpload v-model="form.filePath" prePath="/file/fileupload"/></Field> -->
<image-preview-single
v-if="form.filePath && form.filePath != ''"
:src="form.filePath"
:width="'100px'"
:height="'100px'"
/>
<div v-else>--</div>
<!-- <Field
label="附件名称,多个逗号分割"
prop="fileName"
v-model="form.fileName"
placeholder="请输入附件名称,多个逗号分割"
/> -->
<!-- <Field label="附件地址,多个逗号分割">
<fileUpload
v-model="form.filePath"
prePath=""
/>
</Field> -->
<!-- <el-upload
class="upload-demo"
:action="uploadFileUrl + '?prePath=' + '/file/fileupload'"
:file-list="fileList"
>
</el-upload> -->
</div>
<div class="jyitem">
<div class="leftlabel">提交日期</div>
......@@ -145,10 +169,11 @@
<script>
import moment from "moment";
import form from "@/assets/mixins/formdialog";
import ImagePreviewSingle from "@/components/ImagePreviewSingle.vue";
export default {
name: "FeedbackDetail",
mixins: [form],
components: {},
components: { ImagePreviewSingle },
watch: {
form(newval) {
if (newval.createTime) {
......@@ -163,6 +188,8 @@ export default {
},
data() {
return {
fileList: [],
uploadFileUrl: "/enterprise/file/commonupload", // 上传的地址
createTime: "",
// 遮罩层
loading: true,
......@@ -215,7 +242,7 @@ export default {
],
replyContent: [
{ required: true, message: "请输入回复", trigger: "blur" },
{ max: 64, message: "最多只能录入64个字符", trigger: "blur" },
{ max: 200, message: "最多只能录入200个字符", trigger: "blur" },
],
feedbackType: [
{ required: true, message: "请输入反馈类型 ", trigger: "blur" },
......@@ -275,6 +302,15 @@ export default {
/**获取数据前弹框 */
beforeRender(data) {
data.entity.deptId = String(data.entity.deptId);
let arr = data.entity.filePath.split(",");
this.fileList = arr.map((v, i) => {
let obj = {
name: "附件" + (i + 1),
url: v,
};
return obj;
});
console.log(this.fileList);
return data;
},
/**获取数据后弹框 */
......@@ -376,7 +412,7 @@ export default {
padding: 20px;
}
}
/deep/.el-form-item__error{
/deep/.el-form-item__error {
font-size: 14px;
}
</style>
\ No newline at end of file
......@@ -132,7 +132,7 @@ export default {
label: "真实姓名",
prop: "feedbackName",
formatter: this.formatter,
width: 120,
width: 100,
},
{
label: "联系电话",
......
......@@ -58,7 +58,18 @@ export default {
style="width: 70px; height: 70px"
src={row.labelLogoPath}
preview-src-list={[row.labelLogoPath]}
></el-image>
>
<div
slot="error"
class="image-slot"
style="width: 70px; height: 70px;display:flex;justify-content: center;align-items: center;"
>
<i
class="el-icon-picture-outline"
style="font-size:26px"
></i>
</div>
</el-image>
) : (
"--"
);
......
......@@ -31,6 +31,19 @@ export default {
toView(row) {
this.$refs.drawerform.view(row);
},
// 复职操作
handleReback(row) {
this.$post("/staff/leave/save", { id: row.id, staffStatus: 1 })
.then((res) => {
if (res.code == 1) {
this.$message.success("复职成功!");
this.getData();
}
})
.catch((error) => {
this.$message.error(error.message);
});
},
},
data() {
return {
......@@ -53,7 +66,7 @@ export default {
{ type: "selection", width: 60 },
{ type: "index", label: "序号", width: 50 },
{ label: "员工姓名", prop: "name" },
{ label: "员工姓名", prop: "name", width: 120 },
{
label: "照片",
......@@ -64,33 +77,79 @@ export default {
style="width: 70px; height: 70px"
src={row.photoPath}
preview-src-list={[row.photoPath]}
></el-image>
>
<div
slot="error"
class="image-slot"
style="width: 70px; height: 70px;display:flex;justify-content: center;align-items: center;"
>
<i
class="el-icon-picture-outline"
style="font-size:26px"
></i>
</div>
</el-image>
) : (
"--"
);
},
width: 110,
width: 100,
},
{ label: "邮件地址", prop: "email" },
{ label: "邮件地址", prop: "email", width: 160 },
{ label: "联系电话", prop: "phoneNumber" },
{ label: "联系电话", prop: "phoneNumber", width: 120 },
{ label: "所属公司", prop: "companyIds", formatter: this.formatters },
{
label: "所属公司",
prop: "companyIds",
formatter: this.formatters,
},
{ label: "职位名称", prop: "positionName" },
{ label: "职位名称", prop: "positionName", width: 120 },
{
label: "员工状态",
prop: "staffStatus",
formatter: this.formatter,
width: 80,
},
{
label: "离职时间",
prop: "leaveDate",
formatter: this.formatterDate,
width: 140,
},
{
label: "操作用户",
prop: "createUserId",
formatter: this.formatter,
width: 120,
},
// {
// label: "操作",
// width: 100,
// formatter: (row) => {
// return row.staffStatus == 3 ? (
// <div>
// <el-button
// type="text"
// icon="el-icon-refresh-left"
// size="mini"
// onClick={() => {
// this.handleReback(row);
// }}
// title="复职"
// >
// 复职
// </el-button>
// </div>
// ) : (
// "--"
// );
// },
// },
],
},
};
......
......@@ -30,6 +30,19 @@ export default {
toView(row) {
this.$refs.drawerform.view(row);
},
// 复职操作
handleReback(row) {
this.$post("/staff/save", { id: row.id, staffStatus: 1 })
.then((res) => {
if (res.code == 1) {
this.$message.success("复职成功!");
this.getData();
}
})
.catch((error) => {
this.$message.error(error.message);
});
},
// 离职操作
toDimission(row) {
console.log(row);
......@@ -59,16 +72,17 @@ export default {
},
// 重写getData
async getData() {
this.query = Object.assign(
{ staffStatus: 1 },
this.query,
this.$route.query
);
this.query = Object.assign(this.query, this.$route.query);
try {
await this.beforeFecth();
} catch (error) {
return;
}
this.query.staffStatus
? ""
: "staffStatus" in this.query
? ""
: (this.query.staffStatus = 1);
this.tableData.loading = true;
this.$post(this.pageInfo.list, this.query, {
cancelToken: this.source.token,
......@@ -95,6 +109,12 @@ export default {
return {
config: {
search: [
{
name: "staffStatus",
type: "select",
placeholder: "请选择员工状态",
label: "员工状态",
},
{
name: "companyId",
type: "select",
......@@ -123,14 +143,30 @@ export default {
style="width: 70px; height: 70px"
src={row.photoPath}
preview-src-list={[row.photoPath]}
></el-image>
>
<div
slot="error"
class="image-slot"
style="width: 70px; height: 70px;display:flex;justify-content: center;align-items: center;"
>
<i
class="el-icon-picture-outline"
style="font-size:26px"
></i>
</div>
</el-image>
) : (
"--"
);
},
width: 110,
},
{
label: "员工状态",
prop: "staffStatus",
formatter: this.formatter,
width: 80,
},
{ label: "联系电话", prop: "phoneNumber", width: 110 },
{
......@@ -168,7 +204,38 @@ export default {
label: "操作",
width: 180,
formatter: (row) => {
return (
return row.staffStatus == 3 ? (
<div>
<table-buttons
noAdd
noView
row={row}
onEdit={this.toEdit}
onView={this.toView}
onDel={this.toDel}
/>
{/* <span
onClick={() => {
this.toDimission(row);
}}
style="color:#409EFF;margin-left:10px;cursor:pointer"
>
<i class="el-icon-document-delete"></i>
离职
</span> */}
<el-button
type="text"
icon="el-icon-refresh-left"
size="mini"
onClick={() => {
this.handleReback(row);
}}
title="复职"
>
复职
</el-button>
</div>
) : (
<div>
<table-buttons
noAdd
......
<template>
<div class="page">
<LayoutTable :data="tableData" :config="tableConfig" />
<LayoutTable :data="tableData" :config="tableConfig" ref="layouttable" />
<dialog-show ref="dialogform" @ok="getData" />
<el-dialog title="用户已分配的角色" :visible.sync="role.visible">
......@@ -49,6 +49,9 @@ import table from "@/assets/mixins/table";
export default {
mixins: [table],
components: { dialogShow },
mounted() {
console.log(this.$refs.layouttable.$refs.searchform);
},
methods: {
// 打开弹窗
async findRole({ id }) {
......@@ -223,6 +226,9 @@ export default {
name: "userType",
type: "select",
label: "用户类型",
change: (val) => {
console.log(val);
},
},
{
name: "loginName",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment