<template>
|
<basic-container
|
:class="[
|
$store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
|
$store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
|
]"
|
>
|
<avue-crud
|
class="tablesss"
|
:option="option"
|
:table-loading="loading"
|
:data="data"
|
:page.sync="page"
|
ref="crud"
|
@row-del="rowDel"
|
v-model="form"
|
:permission="permissionList"
|
@row-update="rowUpdate"
|
@row-save="rowSave"
|
:before-open="beforeOpen"
|
@filter="filterChange"
|
@search-change="searchChange"
|
@search-reset="searchReset"
|
@selection-change="selectionChange"
|
@current-change="currentChange"
|
@size-change="sizeChange"
|
@refresh-change="refreshChange"
|
@on-load="onLoad"
|
>
|
<!-- <template slot="menuLeft">
|
<el-button
|
type="danger"
|
size="small"
|
icon="el-icon-delete"
|
plain
|
@click="handleDelete"
|
>删 除
|
</el-button>
|
</template> -->
|
<!-- <template slot-scope="{ type, size, row }" slot="menu">
|
<el-button :size="size" :type="type" @click="handleUploadPage(row)"
|
>附件上传
|
</el-button>
|
</template> -->
|
</avue-crud>
|
</basic-container>
|
</template>
|
|
<script>
|
import { workreplyColumn } from "./data";
|
import {
|
getListPageReply,
|
remove,
|
update,
|
add,
|
getDetail
|
} from "@/api/workreport/workreport";
|
import { getDept } from "@/api/system/dept";
|
import { mapGetters } from "vuex";
|
|
export default {
|
data() {
|
return {
|
form: {},
|
query: {},
|
loading: true,
|
deptCategory: "",
|
deptId: "",
|
userId: "",
|
permissionAdd: "",
|
permissionDelete: "",
|
permissionView: "",
|
permissionEdit: "",
|
page: {
|
pageSize: 10,
|
currentPage: 1,
|
total: 0,
|
...this.$store.state.control.changePageSize
|
},
|
selectionList: [],
|
option: {
|
height: "auto",
|
calcHeight: 30,
|
dialogWidth: 1000,
|
tip: false,
|
searchShow: true,
|
searchMenuSpan: 6,
|
editBtnText: "回复",
|
updateBtnText: "提交",
|
editTitle: "回复",
|
border: true, //liu
|
index: true,
|
stripe: true,
|
viewBtn: true,
|
selection: true,
|
excelBtn: false,
|
menuWidth: 320,
|
dialogClickModal: false,
|
column: workreplyColumn,
|
...this.$store.state.control.clearOtherBut
|
},
|
data: []
|
};
|
},
|
computed: {
|
...mapGetters(["permission"]),
|
permissionList() {
|
return {
|
addBtn: this.vaildData(null, false),
|
viewBtn: this.vaildData(this.permission.workreply_view, false),
|
delBtn: this.vaildData(null, false),
|
editBtn: this.vaildData(this.permission.workreply_edit, false)
|
};
|
},
|
ids() {
|
let ids = [];
|
this.selectionList.forEach(ele => {
|
ids.push(ele.id);
|
});
|
return ids.join(",");
|
}
|
},
|
mounted() {
|
this.$store.commit("setWindowSizeHeightAdd");
|
},
|
methods: {
|
rowSave(row, done, loading) {
|
row.category = 1;
|
row.deptId = this.deptId;
|
add(row).then(
|
() => {
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!"
|
});
|
done();
|
},
|
error => {
|
window.console.log(error);
|
loading();
|
}
|
);
|
},
|
rowUpdate(row, index, done, loading) {
|
update(row).then(
|
() => {
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!"
|
});
|
done();
|
},
|
error => {
|
window.console.log(error);
|
loading();
|
}
|
);
|
},
|
rowDel(row) {
|
this.$confirm("确定将选择数据删除?", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
return remove(row.id);
|
})
|
.then(() => {
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!"
|
});
|
});
|
},
|
searchReset() {
|
this.query = {};
|
this.onLoad(this.page);
|
},
|
searchChange(params, done) {
|
this.query = params;
|
this.page.currentPage = 1;
|
this.onLoad(this.page, params);
|
done();
|
},
|
selectionChange(list) {
|
this.selectionList = list;
|
},
|
selectionClear() {
|
this.selectionList = [];
|
this.$refs.crud.toggleSelection();
|
},
|
handleDelete() {
|
if (this.selectionList.length === 0) {
|
this.$message.warning("请选择至少一条数据");
|
return;
|
}
|
this.$confirm("确定将选择数据删除?", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
return remove(this.ids);
|
})
|
.then(() => {
|
this.onLoad(this.page);
|
this.$message({
|
type: "success",
|
message: "操作成功!"
|
});
|
this.$refs.crud.toggleSelection();
|
});
|
},
|
beforeOpen(done, type) {
|
if (["edit", "view"].includes(type)) {
|
getDetail(this.form.id).then(res => {
|
this.form = res.data.data;
|
});
|
}
|
done();
|
},
|
currentChange(currentPage) {
|
this.page.currentPage = currentPage;
|
},
|
sizeChange(pageSize) {
|
this.page.pageSize = pageSize;
|
},
|
refreshChange() {
|
this.onLoad(this.page, this.query);
|
},
|
onLoad(page, params = {}) {
|
this.deptId = JSON.parse(
|
window.localStorage.getItem("saber-userInfo")
|
).content.dept_id;
|
|
this.userId = JSON.parse(
|
window.localStorage.getItem("saber-userInfo")
|
).content.user_id;
|
|
var that = this;
|
getDept(this.deptId).then(res => {
|
var deptCategory = res.data.data.deptCategory;
|
deptCategory == 1
|
? (that.deptCategory = true)
|
: (that.deptCategory = false);
|
|
// const { releaseTimeRange } = this.query;
|
// if (that.deptCategory) {
|
params["deptId"] = this.deptId;
|
params["userId"] = this.userId;
|
// }
|
let values = {
|
...params
|
};
|
// if (releaseTimeRange) {
|
// values = {
|
// ...params,
|
// startTime: releaseTimeRange[0],
|
// endTime: releaseTimeRange[1],
|
// ...this.query,
|
// };
|
// values.releaseTimeRange = null;
|
// }
|
this.loading = true;
|
getListPageReply(page.currentPage, page.pageSize, values).then(res => {
|
const data = res.data.data;
|
this.page.total = data.total;
|
this.data = data.records;
|
this.loading = false;
|
this.$store.commit("setWindowSizeHeightAdd");
|
this.selectionClear();
|
});
|
});
|
}
|
}
|
};
|
</script>
|
|
<style></style>
|