Commit 254df117 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化页面组件

parent e77312e7
#门户 #门户
VUE_APP_API_portal_URL=http://192.168.0.98:11072 VUE_APP_API_portal_URL=http://192.168.0.98:11072
# 系统名称
VUE_APP_sysName = '数字化样表系统'
#开发环境 #开发环境
NODE_ENV = "development" NODE_ENV = "development"
VUE_APP_API_BASE_URL=http://192.168.0.98:11078 VUE_APP_API_BASE_URL=http://192.168.0.98:11078
#图片地址拼接
VUE_APP_API_IMG_URL=http://192.168.0.98:11078/
\ No newline at end of file
...@@ -4,5 +4,4 @@ VUE_APP_API_BASE_URL=/basics_api ...@@ -4,5 +4,4 @@ VUE_APP_API_BASE_URL=/basics_api
#门户 #门户
VUE_APP_API_portal_URL=/portal_home VUE_APP_API_portal_URL=/portal_home
#图片地址拼接
VUE_APP_API_IMG_URL=
...@@ -353,21 +353,21 @@ ...@@ -353,21 +353,21 @@
.auto-scroll{ .auto-scroll{
overflow-y: auto; overflow-y: auto;
} }
::-webkit-scrollbar { // ::-webkit-scrollbar {
width: 6px; // width: 6px;
height: 6px; // height: 6px;
overflow-y: auto; // overflow-y: auto;
} // }
::-webkit-scrollbar-thumb { // ::-webkit-scrollbar-thumb {
border-radius: 6px; // border-radius: 6px;
background-color: rgba(144, 147, 153, 0.5); // background-color: rgba(144, 147, 153, 0.5);
} // }
::-webkit-scrollbar-track { // ::-webkit-scrollbar-track {
border-radius: 6px; // border-radius: 6px;
background: rbga(0, 0, 0, 0); // background: rbga(0, 0, 0, 0);
} // }
.autoWidth { .autoWidth {
min-width: 120px; min-width: 120px;
......
<template>
<div class="tab-header">
<i v-if="icon" :class="['mr5', 'primary', icon]"></i>
<span class="label">{{ label }}</span>
</div>
</template>
<script>
export default {
name: "TabHeader",
props: {
icon: {
type: String,
default: "",
},
label: {
type: String,
default: "",
},
},
};
</script>
<style lang="less" scoped>
.tab-header {
display: flex;
align-items: center;
width: 100%;
height: 40px;
padding: 0px 15px;
font-size: 14px;
position: relative;
cursor: default;
&::after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
z-index: 1;
}
.label {
font-weight: bold;
color: rgba(0, 0, 0, 0.65);
}
}
</style>
<template>
<el-date-picker
:value="value"
type="daterange"
:value-format="valueFormat"
unlink-panels
:picker-options="pickerOptions"
:clearable="Clearable"
v-bind="$attrs"
@input="handleChange"
v-on="$listeners"
>
</el-date-picker>
</template>
<script>
export default {
name: "YDatePicker",
model: {
event: "change",
prop: "value",
},
props: {
value: {
type: Array,
default: () => {
return [];
},
},
clearable: {
type: Boolean,
default: false,
},
valueFormat: {
type: String,
default: "yyyy-MM-dd",
},
},
data() {
return {
pickerOptions: {
shortcuts: [
{
text: "今天",
onClick(picker) {
const end = new Date();
const start = new Date();
picker.$emit("pick", [start, end]);
},
},
{
text: "最近一周",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近一个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近三个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit("pick", [start, end]);
},
},
],
},
};
},
computed: {
Clearable() {
return !!this.clearable;
},
},
methods: {
handleChange(val) {
this.$emit("change", val);
},
},
};
</script>
<style lang="less" scoped></style>
<template>
<div class="pagination" v-if="total">
<el-pagination
:background="background"
:layout="layout"
:pager-count="5"
:total="total"
:current-page="current"
:page-size="PageSize"
:page-sizes="pageSizes"
v-bind="$attrs"
@current-change="changePagination"
@size-change="changeSize"
v-on="$listeners"
>
</el-pagination>
</div>
</template>
<script>
import { pageSizeOptions } from "@/config";
export default {
name: "YPagination",
props: {
total: {
required: true,
type: Number,
default: 0,
},
pageSize: {
required: true,
type: Number,
default: 10,
},
page: {
required: true,
type: Number,
default: 1,
},
layout: {
type: String,
default: "total,prev,pager,next,sizes,jumper",
},
pageSizes: {
type: Array,
default: () => pageSizeOptions,
},
background: {
type: Boolean,
default: true,
},
},
data() {
return {};
},
computed: {
PageSize: {
get() {
return this.pageSize;
},
set(value) {
this.$emit("update:pageSize", value);
},
},
current: {
get() {
return this.page;
},
set(value) {
this.$emit("update:page", value);
},
},
},
methods: {
changePagination(cur) {
this.current = cur;
if (this.$listeners.change) {
this.$listeners.change();
}
this.$emit("currentChange", cur);
},
changeSize(size) {
this.PageSize = size;
if (this.$listeners.change) {
this.$listeners.change();
}
this.$emit("sizeChange", size);
},
},
};
</script>
<style lang="less" scoped></style>
<template>
<div>
<el-switch
:value="value"
class="y-switch"
:active-value="activeValue"
:inactive-value="inactiveValue"
v-bind="$attrs"
v-on="$listeners"
>
</el-switch>
</div>
</template>
<script>
export default {
name: "YSwitch",
model: {
prop: "value",
event: "change",
},
props: {
value: {
default: 0,
},
activeValue: {
default: 1,
},
inactiveValue: {
default: 0,
},
},
methods: {},
};
</script>
<style lang="less" scoped>
:deep(.el-switch) {
.el-switch__label {
position: absolute;
display: none;
color: #fff;
}
.el-switch__label--right {
z-index: 1;
left: 0px; /*不同场景下可能不同,自行调整*/
}
.el-switch__label--left {
z-index: 1;
right: 0px; /*不同场景下可能不同,自行调整*/
}
.el-switch__label.is-active {
display: block;
}
.el-switch__core,
.el-switch .el-switch__label {
width: 60px !important; /*开关按钮的宽度大小*/
}
}
</style>
<template>
<div class="y-table">
<el-table
ref="MyTable"
v-loading="loading"
:data="data"
style="width: 100%"
:size="size"
:row-key="rowkey"
v-bind="$attrs"
v-on="$listeners"
>
<template v-for="(v, i) in column">
<el-table-column
v-if="!v.slot"
:key="i"
:reserve-selection="v.reserveSelection"
:prop="v.prop"
:type="v.type"
:index="v.index"
:label="v.label"
:width="v.width"
:align="v.align"
:fixed="v.fixed"
:formatter="v.formatter"
:min-width="v.minWidth"
:show-overflow-tooltip="v.showOverflowTooltip"
>
</el-table-column>
<el-table-column
v-else
:key="'a' + i"
:reserve-selection="v.reserveSelection"
:prop="v.prop"
:type="v.type"
:index="v.index"
:label="v.label"
:width="v.width"
:align="v.align"
:fixed="v.fixed"
:formatter="v.formatter"
:min-width="v.minWidth"
:show-overflow-tooltip="v.showOverflowTooltip"
>
<template slot-scope="scope">
<slot :name="v.prop" v-bind="scope"></slot>
</template>
</el-table-column>
</template>
</el-table>
</div>
</template>
<script>
export default {
name: "YTable",
props: {
loading: {
type: Boolean,
default: false,
},
size: {
type: String,
default: "",
},
data: {
type: Array,
default: () => [],
},
column: {
type: Array,
default: () => [],
},
rowkey: {
type: [String, Function],
default: "id",
},
},
data() {
return {};
},
watch: {
data: {
handler() {
this.$nextTick(() => {
this.$refs.MyTable.bodyWrapper.scrollTop = 0;
this.$refs.MyTable.bodyWrapper.scrollLeft = 0;
});
},
immediate: true,
deep: true,
},
},
computed: {},
created() {},
methods: {
clearSelection() {
this.$refs.MyTable.clearSelection();
},
toggleAllSelection() {
this.$refs.MyTable.toggleAllSelection();
},
clearSort() {
this.$refs.MyTable.clearSort();
},
doLayout() {
this.$refs.MyTable.doLayout();
},
clearFilter() {
this.$refs.MyTable.clearFilter(...arguments);
},
sort() {
this.$refs.MyTable.sort(...arguments);
},
toggleRowExpansion() {
this.$refs.MyTable.toggleRowExpansion(...arguments);
},
setCurrentRow() {
this.$refs.MyTable.setCurrentRow(...arguments);
},
toggleRowSelection() {
this.$refs.MyTable.toggleRowSelection(...arguments);
},
},
};
</script>
<style lang="less" scoped>
.y-table {
width: 100%;
height: 100%;
}
</style>
<template>
<div>
<el-upload
v-if="listType === 'picture' || listType === 'text'"
ref="upload"
:headers="Headers"
:name="name"
:list-type="listType"
:action="action"
:multiple="multiple"
:accept="accept"
:limit="limit"
:file-list="FileList"
v-bind="$attrs"
v-on="$listeners"
:before-upload="beforeUpload"
:on-preview="handlePreview"
:on-success="handleSuccess"
:on-remove="handleRemove"
:on-exceed="handleExceed"
>
<slot>
<el-button size="small" type="primary">点击上传</el-button>
</slot>
</el-upload>
<el-upload
v-else
ref="upload"
:headers="Headers"
:name="name"
:list-type="listType"
:action="action"
:multiple="multiple"
:accept="accept"
:limit="limit"
:file-list="FileList"
v-bind="$attrs"
v-on="$listeners"
:before-upload="beforeUpload"
:on-preview="handlePreview"
:on-success="handleSuccess"
:on-remove="handleRemove"
:on-exceed="handleExceed"
>
<slot>
<i class="el-icon-plus"></i>
</slot>
</el-upload>
<!-- 图片查看 -->
<el-image-viewer
v-if="preview"
:appendToBody="false"
:on-close="closePreview"
:url-list="filepaths"
/>
<!-- 视频\音频预览 -->
<div class="preview-box" v-if="show">
<video
v-if="previewData.type === 'video'"
class="h-[400px]"
:src="previewData.url"
autoplay
muted
controls
></video>
<audio
v-else-if="previewData.type === 'audio'"
:src="previewData.url"
autoplay
controls
></audio>
<i class="el-icon-circle-close" @click="show = false"></i>
</div>
</div>
</template>
<script>
import ElImageViewer from "element-ui/packages/image/src/image-viewer";
import { mapGetters } from "vuex";
export default {
name: "YUpload",
model: {
prop: "value",
event: "success",
},
components: {
ElImageViewer,
},
props: {
name: {
type: String,
default: "file",
},
listType: {
type: String,
default: "text",
},
fileList: {
type: Array,
default: () => [],
},
multiple: {
type: Boolean,
default: false,
},
value: {
required: true,
type: [String, Array],
default: "",
},
headers: {
type: Object,
default: () => {},
},
// 文件限制
accept: {
type: String,
default: "",
},
// 上传数量
limit: {
type: Number,
validator: (value) => {
return value >= 0;
},
default: 1, // 0为不限制
},
// 上传文件大小限制mb 0为不限制
maxSize: {
type: Number,
validator: (value) => {
return value >= 0;
},
default: 10,
},
action: {
type: String,
default: "/fm/file/commonupload",
},
},
data() {
return {
FileList: [],
imageType: ["png", "jpg", "jpeg", "gif", "svg"],
videoType: ["mp4", "avi", "wmv", "rmvb", "flv", "mkv"],
audioType: [
"mp3",
"wav",
"amr",
"aac",
"ogg",
"wma",
"flac",
"ape",
"mid",
"m4a",
"m4r",
"m4p",
"m4b",
],
// 图片预览
filepaths: [],
preview: false,
previewData: {
type: "",
url: "",
},
show: false,
};
},
watch: {
fileList: {
handler(newValue) {
this.initFileList(newValue);
},
deep: true,
immediate: true,
},
},
computed: {
...mapGetters(["token"]),
Headers() {
let form = {
Authorization: this.token,
};
return {
...form,
...this.headers,
};
},
},
created() {},
methods: {
// 初始化文件列表
initFileList(fileList) {
this.FileList = fileList.map((v) => {
return {
uid: v.url,
name: v.name,
url: v.url,
status: "success",
};
});
},
// 上传成功
handleSuccess(response, file, fileList) {
if (this.limit) {
fileList = fileList.slice(-this.limit);
}
// this.FileList = [...fileList];
if (file.status == "success") {
if (file.response && file.response.code === -1) {
let msg = file.response.msg || "上传失败";
this.$message.error(msg);
fileList = fileList.filter((file) => file.response.code !== -1);
}
fileList = fileList.map((v) => {
if (v.response) {
v.url = v.response.url;
}
return v;
});
let value;
if (Array.isArray(this.value)) {
value = fileList.map((v) => v.url);
} else {
value = fileList.map((v) => v.url).join(",");
}
this.$emit("success", value);
this.$emit("change", { file, fileList });
}
},
// 删除文件
handleRemove(file, fileList) {
let value;
if (Array.isArray(this.value)) {
value = fileList.map((v) => v.url);
} else {
value = fileList.map((v) => v.url).join(",");
}
this.$emit("success", value);
this.$emit("change", { file, fileList });
},
// 上传之前
beforeUpload(file) {
let isType = true;
let isExceed = true;
return new Promise((resolve, reject) => {
if (this.accept) {
const fileType = this.accept.split(","); // 限制文件类型
let index = file.name.lastIndexOf(".");
let type = file.name.slice(index);
isType = fileType.includes(type);
}
if (!isType) {
let msg = this.accept.replaceAll(",", "或者");
this.$message.error(`请上传${msg}文件!`);
}
if (this.maxSize) {
isExceed = file.size / 1024 / 1024 <= this.maxSize;
}
if (!isExceed) {
this.$message.error(`文件大小不能超过${this.maxSize}MB!`);
}
if (isType && isExceed) {
resolve(file);
} else {
reject();
}
});
},
// 预览
handlePreview(file) {
let { url } = file;
if (!url) return;
let index = url.lastIndexOf(".");
let type = url.slice(index + 1);
if (this.imageType.includes(type)) {
this.filepaths = [url];
this.preview = true;
} else if (this.videoType.includes(type)) {
this.previewData.type = "video";
this.previewData.url = url;
this.show = true;
} else if (this.audioType.includes(type)) {
this.previewData.type = "audio";
this.previewData.url = url;
this.show = true;
} else {
let a = document.createElement("a");
a.href = url;
a.download = file.name;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
},
// 超出上传数量提示
handleExceed() {
this.$message.warning(
`文件数量超出限制,当前限制为 ${this.limit} 个文件`
);
},
closePreview() {
this.preview = false;
this.filepaths = [];
},
clearFiles() {
this.$refs.upload.clearFiles();
},
abort() {
this.$refs.upload.abort(...arguments);
},
submit() {
this.$refs.upload.submit();
},
},
beforeDestroy() {
this.$refs.upload.clearFiles();
},
};
</script>
<style lang="less" scoped>
.preview-box {
width: 100%;
height: 100%;
position: fixed;
left: 0px;
top: 0px;
z-index: 999;
background: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
gap: 15px;
.el-icon-circle-close {
font-size: 40px;
color: #fff;
cursor: pointer;
}
}
</style>
let customComponents = {
install: function (Vue) {
//在use的时候vue会自动调用此方法
const files = require.context("@/components/autoRegister", true, /\.vue$/); //返回的是一个函数
// require.context()的参数
// 参数一 {String}:读取文件的目录路径
// 参数二 {Boolean}:是否深入遍历,即是否遍历子目录(二级目录)
// 参数三 {RegExp}:匹配目录内文件的正则表达式/\.vue$/表示匹配所有.vue后缀名的文件
files.keys().forEach((item) => {
const componentConfig = files(item);
const name =
componentConfig.default.name ||
item
.split("/")
.pop()
.replace(/\.\w+$/, "");
const component = componentConfig.default || componentConfig;
Vue.component(name, component); //注册当前组件
});
},
};
export default customComponents;
export const pageSizeOptions = [10, 30, 50, 100, 200]; // 翻页-每页显示数量
export const systemName = "智慧数字化样表服务系统"; // 系统名称
// 服务器请求错误状态码
export const responseErr = {
400: "请求参数错误",
403: "禁止访问",
404: "请求错误,未找到该资源",
405: "请求方法未允许",
408: "请求超时",
500: "服务器内部错误",
501: "服务未实现",
502: "网关错误",
503: "服务不可用",
504: "网关超时",
505: "http版本不支持该请求",
};
// 登录失效状态码
export const loginErr = [401, 201, 9001, 9002];
...@@ -24,6 +24,10 @@ Vue.prototype.$message = message; ...@@ -24,6 +24,10 @@ Vue.prototype.$message = message;
import { resetForm } from "@/utils"; import { resetForm } from "@/utils";
Vue.prototype.resetForm = resetForm; Vue.prototype.resetForm = resetForm;
// 注册全局组件
import customComponents from "@/components";
Vue.use(customComponents);
// 表格生成 // 表格生成
import plugins from "./components/formDes/index"; import plugins from "./components/formDes/index";
Vue.use(plugins); Vue.use(plugins);
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<div slot="left"> <div slot="left">
<!-- <el-button size="small" type="primary" @click="handleAdd" <!-- <el-button size="small" type="primary" @click="handleAdd"
>新 增</el-button >新 增</el-button
> > -->
<el-dropdown class="ml15" @command="handleMore"> <!-- <el-dropdown class="ml15" @command="handleMore">
<el-button type="primary" size="small"> <el-button type="primary" size="small">
更多操作<i class="el-icon-arrow-down el-icon--right"></i> 更多操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
<el-dropdown-item command="1">模板下载</el-dropdown-item> <el-dropdown-item command="1">模板下载</el-dropdown-item>
<el-dropdown-item command="2">导入</el-dropdown-item> <el-dropdown-item command="2">导入</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown> -->
-->
</div> </div>
<div slot="right" class="flex"> <div slot="right" class="flex">
<el-select <el-select
...@@ -48,141 +47,99 @@ ...@@ -48,141 +47,99 @@
</TableHeader> </TableHeader>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<el-table <y-table
ref="multipleTable" :max-height="650"
v-loading="loading"
border
:data="tableData" :data="tableData"
:column="columns"
border
:loading="loading"
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%" ref="multipleTable"
:row-key="(row) => row.id"
> >
<el-table-column <template slot="center" slot-scope="scope">
type="index" <span
label="序号" v-if="
width="55" scope.row.deviceInBuilding ||
align="center" scope.row.deviceInFloor ||
:index="(index) => (current - 1) * size + index + 1" scope.row.lon ||
> scope.row.lati
</el-table-column> "
<el-table-column >{{
show-overflow-tooltip `${
label="设备名称" scope.row.deviceInBuilding ? scope.row.deviceInBuilding : "--"
align="center" }栋/${
prop="deviceName" scope.row.deviceInFloor ? scope.row.deviceInFloor : "--"
> }楼/${scope.row.lon ? scope.row.lon : "--"},${
</el-table-column> scope.row.lati ? scope.row.lati : "--"
<el-table-column align="center" prop="deviceMac" label="mac地址"> }`
</el-table-column> }}</span
<el-table-column align="center" prop="ip" label="IP地址"> >
</el-table-column> <span v-else>--</span>
<el-table-column align="center" label="设备位置"> </template>
<template slot-scope="scope">
<template slot="deviceStatus" slot-scope="scope">
<el-tag
size="small"
v-if="scope.row.deviceStatus == 2"
type="success"
>在线</el-tag
>
<el-tag
size="small"
v-else-if="scope.row.deviceStatus == 0"
type="danger"
>未激活</el-tag
>
<el-tag size="small" v-else type="danger">离线</el-tag>
</template>
<template slot="enabled" slot-scope="scope">
<el-switch
class="tableScopeSwitch"
:active-value="1"
:inactive-value="0"
v-model="scope.row.enabled"
@change="handleChange(scope.row)"
inactive-text="停用"
active-text="启用"
>
</el-switch>
</template>
<template slot="action" slot-scope="scope">
<div class="flex jca">
<span <span
v-if=" v-if="scope.row.deviceStatus == 0"
scope.row.deviceInBuilding || class="primary pointer"
scope.row.deviceInFloor || @click="handleActive(scope.row)"
scope.row.lon || >激活</span
scope.row.lati
"
>{{
`${
scope.row.deviceInBuilding
? scope.row.deviceInBuilding
: "--"
}栋/${
scope.row.deviceInFloor ? scope.row.deviceInFloor : "--"
}楼/${scope.row.lon ? scope.row.lon : "--"},${
scope.row.lati ? scope.row.lati : "--"
}`
}}</span
> >
<span v-else>--</span> <span
</template> v-if="scope.row.active != 0"
</el-table-column> style="opacity: 0"
<el-table-column align="center" prop="resolution" label="分辨率"> class="primary"
</el-table-column> >激活</span
<el-table-column align="center" prop="leadingOfficial" label="负责人">
</el-table-column>
<el-table-column
align="center"
prop="leadingOfficialTelephone"
label="联系电话"
>
</el-table-column>
<el-table-column align="center" prop="belong" label="所属机构">
</el-table-column>
<el-table-column align="center" label="状态">
<template slot-scope="scope">
<el-tag
size="small"
v-if="scope.row.deviceStatus == 2"
type="success"
>在线</el-tag
> >
<el-tag <span class="primary pointer" @click="handleBound(scope.row)"
size="small" >绑定表单</span
v-else-if="scope.row.deviceStatus == 0"
type="danger"
>未激活</el-tag
> >
<el-tag size="small" v-else type="danger">离线</el-tag> <span class="primary pointer" @click="handleEdit(scope.row)"
</template> >编辑</span
</el-table-column>
<el-table-column align="center" prop="enabled" label="启用/停用">
<template slot-scope="scope">
<el-switch
class="tableScopeSwitch"
:active-value="1"
:inactive-value="0"
v-model="scope.row.enabled"
@change="handleChange(scope.row)"
inactive-text="停用"
active-text="启用"
> >
</el-switch> <span class="delete pointer" @click="handleDel(scope.row.id)"
</template> >删除</span
</el-table-column> >
<el-table-column align="center" prop="deviceRemark" label="备注"> </div>
</el-table-column> </template>
<el-table-column align="center" label="操作" width="200"> </y-table>
<template slot-scope="scope">
<div class="flex jca">
<span
v-if="scope.row.deviceStatus == 0"
class="primary pointer"
@click="handleActive(scope.row)"
>激活</span
>
<span
v-if="scope.row.active != 0"
style="opacity: 0"
class="primary"
>激活</span
>
<span class="primary pointer" @click="handleBound(scope.row)"
>绑定表单</span
>
<span class="primary pointer" @click="handleEdit(scope.row)"
>编辑</span
>
<span class="delete pointer" @click="handleDel(scope.row.id)"
>删除</span
>
</div>
</template>
</el-table-column>
</el-table>
</div> </div>
<Pagination <y-pagination
:total="total" :total="total"
:current="current" :page.sync="page"
:size="size" :pageSize.sync="size"
@currentChange="changePagination" @change="getDeviceList"
@sizeChange="changeSize" ></y-pagination>
></Pagination>
</div> </div>
<!-- 新增设备 --> <!-- 新增设备 -->
<AddDevice <AddDevice
:dict="dict" :dict="dict"
...@@ -198,10 +155,8 @@ ...@@ -198,10 +155,8 @@
<script> <script>
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import Pagination from "@/components/Pagination.vue";
import AddMatter from "./modal/AddMatter.vue"; import AddMatter from "./modal/AddMatter.vue";
import AddDevice from "./modal/AddDevice.vue"; import AddDevice from "./modal/AddDevice.vue";
import TabHeader from "@/components/TabHeader.vue";
import { import {
getDeviceList, getDeviceList,
saveDeviceEnable, saveDeviceEnable,
...@@ -220,8 +175,6 @@ export default { ...@@ -220,8 +175,6 @@ export default {
TableHeader, TableHeader,
AddDevice, AddDevice,
AddMatter, AddMatter,
Pagination,
TabHeader,
}, },
data() { data() {
return { return {
...@@ -232,7 +185,7 @@ export default { ...@@ -232,7 +185,7 @@ export default {
: "", : "",
tableData: [], tableData: [],
total: 0, total: 0,
current: 1, page: 1,
size: 10, size: 10,
dialogVisible: false, dialogVisible: false,
title: "新增数字样表设备", title: "新增数字样表设备",
...@@ -240,6 +193,86 @@ export default { ...@@ -240,6 +193,86 @@ export default {
matterDrawer: false, matterDrawer: false,
dict: {}, // 字典 dict: {}, // 字典
type: "deviceName", type: "deviceName",
columns: [
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (this.page - 1) * this.size + index + 1;
},
},
{
label: "设备名称",
prop: "deviceName",
align: "center",
showOverflowTooltip: true,
},
{
label: "mac地址",
align: "center",
prop: "deviceMac",
},
{
label: "IP地址",
align: "center",
prop: "ip",
},
{
label: "设备位置",
slot: true,
prop: "center",
align: "center",
showOverflowTooltip: true,
},
{
label: "分辨率",
prop: "resolution",
align: "center",
},
{
label: "负责人",
prop: "leadingOfficial",
align: "center",
},
{
label: "联系电话",
prop: "leadingOfficialTelephone",
align: "center",
},
{
label: "所属机构",
prop: "belong",
align: "center",
},
{
label: "状态",
slot: true,
prop: "deviceStatus",
align: "center",
},
{
label: "启用/停用",
slot: true,
prop: "enabled",
align: "center",
},
{
label: "备注",
prop: "deviceRemark",
align: "center",
},
{
label: "操作",
slot: true,
prop: "action",
align: "center",
width: "200",
},
],
}; };
}, },
created() { created() {
...@@ -251,12 +284,11 @@ export default { ...@@ -251,12 +284,11 @@ export default {
this.loading = true; this.loading = true;
let obj = { let obj = {
siteId: this.siteId, siteId: this.siteId,
page: this.current, page: this.page,
size: this.size, size: this.size,
}; };
let value = `%${this.searchVal}%`; let value = `%${this.searchVal}%`;
obj[this.type] = value; obj[this.type] = value;
let res = await getDeviceList(obj); let res = await getDeviceList(obj);
this.loading = false; this.loading = false;
if (res.data.code == 1) { if (res.data.code == 1) {
...@@ -264,7 +296,6 @@ export default { ...@@ -264,7 +296,6 @@ export default {
this.total = total; this.total = total;
this.tableData = data; this.tableData = data;
this.dict = dict; this.dict = dict;
this.$refs.multipleTable.bodyWrapper.scrollTop = 0;
} }
}, },
// 新增 // 新增
...@@ -275,27 +306,17 @@ export default { ...@@ -275,27 +306,17 @@ export default {
}, },
// 搜索 // 搜索
handleSearch() { handleSearch() {
this.current = 1; this.page = 1;
this.getDeviceList(); this.getDeviceList();
}, },
// 重置 // 重置
searchReset() { searchReset() {
this.searchVal = ""; this.searchVal = "";
this.current = 1; this.page = 1;
this.type = "deviceName"; this.type = "deviceName";
this.getDeviceList(); this.getDeviceList();
}, },
// 翻页
changePagination(cur) {
this.current = cur;
this.getDeviceList();
},
// 改变每页显示数量
changeSize(size) {
this.size = size;
this.getDeviceList();
},
// 更多操作 // 更多操作
handleMore(item) { handleMore(item) {
console.log(item); console.log(item);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
> >
<el-form <el-form
ref="form" ref="form"
size="small" size="medium"
:model="form" :model="form"
:rules="rules" :rules="rules"
label-width="80px" label-width="80px"
...@@ -164,8 +164,8 @@ ...@@ -164,8 +164,8 @@
</el-row> </el-row>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleReset">重 置</el-button> <el-button size="medium" @click="handleReset">重 置</el-button>
<el-button size="small" type="primary" @click="handleOk" <el-button size="medium" type="primary" @click="handleOk"
>确 定</el-button >确 定</el-button
> >
</span> </span>
......
...@@ -106,9 +106,10 @@ ...@@ -106,9 +106,10 @@
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<div @click.stop> <div @click.stop>
<el-table <y-table
ref="curTable" ref="curTable"
v-loading="loading" :column="columns"
:loading="loading"
:data="tableData" :data="tableData"
size="small" size="small"
tooltip-effect="dark" tooltip-effect="dark"
...@@ -118,64 +119,27 @@ ...@@ -118,64 +119,27 @@
:row-key="(row) => row.id" :row-key="(row) => row.id"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column <template slot="matterName" slot-scope="scope">
type="selection" <p class="short">{{ scope.row.matterName }}</p>
reserve-selection <p class="full-name">
width="40" 事项全称:{{ scope.row.matterFullName }}
align="center" </p>
> </template>
</el-table-column>
<el-table-column <template slot="action" slot-scope="scope">
type="index" <span class="primary pointer" @click="handleJoin(scope.row)"
label="序号" >选择</span
width="50" >
align="center" </template>
:index="(index) => (current - 1) * size + index + 1" </y-table>
>
</el-table-column>
<el-table-column
prop="name"
show-overflow-tooltip
label="事项名称"
>
<template slot-scope="scope">
<p class="short">{{ scope.row.matterName }}</p>
<p class="full-name">
事项全称:{{ scope.row.matterFullName }}
</p>
</template>
</el-table-column>
<el-table-column
label="部门"
align="center"
width="180"
prop="deptName"
>
</el-table-column>
<el-table-column
prop="datumCount"
label="材料数量"
align="center"
width="80"
>
</el-table-column>
<el-table-column align="center" label="操作" width="80">
<template slot-scope="scope">
<span class="primary pointer" @click="handleJoin(scope.row)"
>选择</span
>
</template>
</el-table-column>
</el-table>
</div> </div>
</div> </div>
<Pagination <y-pagination
:total="total" :total="total"
:current="current" :page.sync="page"
:size="size" :pageSize.sync="size"
@currentChange="changePagination" @change="getSampleformMatterList"
@sizeChange="changeSize" ></y-pagination>
></Pagination>
</div> </div>
</div> </div>
<div class="footer"> <div class="footer">
...@@ -191,7 +155,6 @@ ...@@ -191,7 +155,6 @@
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import Pagination from "@/components/Pagination.vue";
import { getSampleformMatterList } from "@/api/matter"; import { getSampleformMatterList } from "@/api/matter";
import { import {
getDeviceMatterList, getDeviceMatterList,
...@@ -203,7 +166,6 @@ import local from "@/utils/local"; ...@@ -203,7 +166,6 @@ import local from "@/utils/local";
export default { export default {
components: { components: {
TableHeader, TableHeader,
Pagination,
}, },
props: { props: {
matterDrawer: { matterDrawer: {
...@@ -220,7 +182,7 @@ export default { ...@@ -220,7 +182,7 @@ export default {
: "", : "",
department: "", department: "",
searchVal: "", searchVal: "",
current: 1, page: 1,
size: 10, size: 10,
total: 0, total: 0,
tableData: [], tableData: [],
...@@ -228,6 +190,52 @@ export default { ...@@ -228,6 +190,52 @@ export default {
selectionKeys: [], selectionKeys: [],
devInfo: {}, devInfo: {},
devMatterIdList: [], devMatterIdList: [],
columns: [
{
label: "全选",
type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (this.page - 1) * this.size + index + 1;
},
},
{
label: "事项名称",
slot: true,
prop: "matterName",
showOverflowTooltip: true,
},
{
label: "所属部门",
prop: "deptName",
align: "center",
showOverflowTooltip: true,
width: "180",
},
{
label: "材料数量",
prop: "datumCount",
align: "center",
width: "80",
},
{
label: "操作",
slot: true,
prop: "action",
align: "center",
width: "80",
},
],
}; };
}, },
computed: { computed: {
...@@ -277,7 +285,7 @@ export default { ...@@ -277,7 +285,7 @@ export default {
async getSampleformMatterList() { async getSampleformMatterList() {
this.loading = true; this.loading = true;
let res = await getSampleformMatterList({ let res = await getSampleformMatterList({
page: this.current, page: this.page,
size: this.size, size: this.size,
matterFullName: `%${this.searchVal}%`, matterFullName: `%${this.searchVal}%`,
deptCode: this.department, deptCode: this.department,
...@@ -289,12 +297,11 @@ export default { ...@@ -289,12 +297,11 @@ export default {
let { data, total } = res.data.data; let { data, total } = res.data.data;
this.tableData = data; this.tableData = data;
this.total = total; this.total = total;
this.$refs.curTable.bodyWrapper.scrollTop = 0;
} }
}, },
// 搜索 // 搜索
handleSearch() { handleSearch() {
this.current = 1; this.page = 1;
this.$refs.curTable.clearSelection(); this.$refs.curTable.clearSelection();
this.getSampleformMatterList(); this.getSampleformMatterList();
}, },
...@@ -302,20 +309,11 @@ export default { ...@@ -302,20 +309,11 @@ export default {
handleReset() { handleReset() {
this.department = ""; this.department = "";
this.searchVal = ""; this.searchVal = "";
this.current = 1; this.page = 1;
this.$refs.curTable.clearSelection(); this.$refs.curTable.clearSelection();
this.getSampleformMatterList(); this.getSampleformMatterList();
}, },
// 翻页
changePagination(cur) {
this.current = cur;
this.getSampleformMatterList();
},
// 改变每页显示数量
changeSize(size) {
this.size = size;
this.getSampleformMatterList();
},
// 表格批量选中 // 表格批量选中
handleSelectionChange(select) { handleSelectionChange(select) {
this.selectionKeys = select; this.selectionKeys = select;
...@@ -396,7 +394,7 @@ export default { ...@@ -396,7 +394,7 @@ export default {
this.$refs.curTable.clearSelection(); this.$refs.curTable.clearSelection();
this.department = ""; this.department = "";
this.searchVal = ""; this.searchVal = "";
this.current = 1; this.page = 1;
this.size = 10; this.size = 10;
this.drawer = false; this.drawer = false;
}, },
......
...@@ -48,13 +48,14 @@ import { getdeptList } from "@/api/department"; ...@@ -48,13 +48,14 @@ import { getdeptList } from "@/api/department";
import { mapMutations, mapState } from "vuex"; import { mapMutations, mapState } from "vuex";
import local from "@/utils/local"; import local from "@/utils/local";
import { findBottomSubarrays } from "@/utils"; import { findBottomSubarrays } from "@/utils";
import { systemName } from "@/config";
export default { export default {
components: { components: {
Header, Header,
}, },
data() { data() {
return { return {
systemName: process.env.VUE_APP_sysName, systemName,
portalUrl: process.env.VUE_APP_API_portal_URL, portalUrl: process.env.VUE_APP_API_portal_URL,
breads: [], breads: [],
subMenus: [], subMenus: [],
...@@ -150,4 +151,4 @@ export default { ...@@ -150,4 +151,4 @@ export default {
overflow-y: auto; overflow-y: auto;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="left flex aic"> <div class="left flex aic">
<img <img
class="pointer mr10 logo" class="pointer mr10 logo"
:src="sysLogo ? api + sysLogo : require('@/assets/img/logo.png')" :src="sysLogo ? sysLogo : require('@/assets/img/logo.png')"
alt="LOGO" alt="LOGO"
@click="handleGoHome" @click="handleGoHome"
/> />
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<!-- 返回门户 --> <!-- 返回门户 -->
<div class="back-btn"> <div class="back-btn">
<el-tooltip effect="dark" content="返回门户" placement="bottom"> <el-tooltip effect="dark" content="返回门户" placement="bottom">
<a class="pointer" :href="portal + (path ? path : '')"> <a class="pointer" :href="portal + (path ? path : '/')">
<i class="el-icon-s-home"></i> 返回门户 <i class="el-icon-s-home"></i> 返回门户
</a> </a>
</el-tooltip> </el-tooltip>
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
<script> <script>
import HeaderSite from "./HeaderSite.vue"; import HeaderSite from "./HeaderSite.vue";
import { systemName } from "@/config";
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
components: { components: {
...@@ -71,8 +72,7 @@ export default { ...@@ -71,8 +72,7 @@ export default {
}, },
data() { data() {
return { return {
systemName: process.env.VUE_APP_sysName, systemName,
api: process.env.VUE_APP_API_IMG_URL,
portal: process.env.VUE_APP_API_portal_URL + "/#", portal: process.env.VUE_APP_API_portal_URL + "/#",
}; };
}, },
...@@ -186,4 +186,4 @@ export default { ...@@ -186,4 +186,4 @@ export default {
background-color: #1890ff !important; background-color: #1890ff !important;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
</el-button> </el-button>
</div> </div>
<div class="mt50"> <div class="mt50">
<el-button size="small" @click="handleReset"> </el-button> <el-button size="medium" @click="handleReset"> </el-button>
<el-button size="small" type="primary" @click="handleOk" <el-button size="medium" type="primary" @click="handleOk"
> >
</el-button> </el-button>
</div> </div>
......
...@@ -48,70 +48,40 @@ ...@@ -48,70 +48,40 @@
</TableHeader> </TableHeader>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<el-table <y-table
ref="multipleTable" :max-height="650"
v-loading="loading"
:data="tableData" :data="tableData"
:column="columns"
border border
:loading="loading"
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%"
:row-key="(row) => row.id"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
ref="multipleTable"
> >
<el-table-column type="selection" width="55" align="center"> <template slot="materialName" slot-scope="scope">
</el-table-column> <p class="short">{{ scope.row.materialName }}</p>
<el-table-column <p class="full-name">材料全称:{{ scope.row.materiaFullName }}</p>
type="index" </template>
label="序号"
width="55" <template slot="action" slot-scope="scope">
align="center" <div class="flex jca">
:index="(index) => (current - 1) * size + index + 1" <span class="primary pointer" @click="handlePreview(scope.row)"
> >预览</span
</el-table-column> >
<el-table-column <span class="delete pointer" @click="handleDel(scope.row.id)"
show-overflow-tooltip >移除</span
label="部门名称" >
align="center" </div>
prop="deptName" </template>
width="200" </y-table>
>
</el-table-column>
<el-table-column prop="name" show-overflow-tooltip label="材料名称">
<template slot-scope="scope">
<p class="short">{{ scope.row.materialName }}</p>
<p class="full-name">材料全称:{{ scope.row.materiaFullName }}</p>
</template>
</el-table-column>
<el-table-column
prop="createTime"
label="添加时间"
align="center"
width="150"
>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<div class="flex jca">
<span class="primary pointer" @click="handlePreview(scope.row)"
>预览</span
>
<span class="delete pointer" @click="handleDel(scope.row.id)"
>移除</span
>
</div>
</template>
</el-table-column>
</el-table>
</div> </div>
<Pagination <y-pagination
:total="total" :total="total"
:current="current" :page.sync="page"
:size="size" :pageSize.sync="size"
@currentChange="changePagination" @change="getPbuList"
@sizeChange="changeSize" ></y-pagination>
></Pagination>
</div> </div>
<!-- 添加材料 --> <!-- 添加材料 -->
<!-- <AddMaterals <!-- <AddMaterals
ref="AddMaterals" ref="AddMaterals"
...@@ -129,31 +99,75 @@ ...@@ -129,31 +99,75 @@
<script> <script>
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import PreviewMaterals from "./modal/PreviewMaterals.vue"; import PreviewMaterals from "./modal/PreviewMaterals.vue";
import Pagination from "@/components/Pagination.vue"; import local from "@/utils/local";
import TabHeader from "@/components/TabHeader.vue";
import { getPubdatumList, delPubdatum } from "@/api/libray"; import { getPubdatumList, delPubdatum } from "@/api/libray";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
export default { export default {
components: { components: {
TableHeader, TableHeader,
PreviewMaterals, PreviewMaterals,
Pagination,
TabHeader,
}, },
data() { data() {
return { return {
department: "", department: "",
searchVal: "", searchVal: "",
tableData: [], tableData: [],
current: 1, page: 1,
size: 10, size: 10,
total: 10, total: 10,
loading: false, loading: false,
selectKeys: [], selectKeys: [],
depList: [], depList: [],
columns: [
{
label: "全选",
type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (this.page - 1) * this.size + index + 1;
},
},
{
label: "部门名称",
prop: "deptName",
align: "center",
showOverflowTooltip: true,
width: "200",
},
{
label: "材料名称",
slot: true,
prop: "materialName",
showOverflowTooltip: true,
},
{
label: "添加时间",
prop: "createTime",
align: "center",
width: "150",
},
{
label: "操作",
slot: true,
prop: "action",
align: "center",
width: "100",
},
],
libVisible: false, libVisible: false,
materalsInfo: {}, materalsInfo: {},
previewVisible: false, previewVisible: false,
siteId: local.getLocal("writeSiteId"),
}; };
}, },
created() { created() {
...@@ -167,21 +181,21 @@ export default { ...@@ -167,21 +181,21 @@ export default {
async getPbuList() { async getPbuList() {
this.loading = true; this.loading = true;
let res = await getPubdatumList({ let res = await getPubdatumList({
page: this.current, page: this.page,
size: this.size, size: this.size,
materiaFullName: `%${this.searchVal}%`, materiaFullName: `%${this.searchVal}%`,
deptCode: this.department, deptCode: this.department,
siteId: this.siteId,
}); });
this.loading = false; this.loading = false;
if (res.data.code === 1) { if (res.data.code === 1) {
let { data, total } = res.data.data; let { data, total } = res.data.data;
if (!data.length && this.current > 1) { if (!data.length && this.page > 1) {
this.current -= 1; this.page -= 1;
this.getPbuList(); this.getPbuList();
} }
this.tableData = data; this.tableData = data;
this.total = total; this.total = total;
this.$refs.multipleTable.bodyWrapper.scrollTop = 0;
} }
}, },
...@@ -195,13 +209,12 @@ export default { ...@@ -195,13 +209,12 @@ export default {
this.$message.warning("请先勾选数据"); this.$message.warning("请先勾选数据");
return; return;
} }
let ids = this.selectKeys.map((v) => v.id).join(","); let ids = this.selectKeys.map((v) => v.id).join(",");
this.handleDel(ids); this.handleDel(ids);
}, },
// 搜索 // 搜索
handleSearch() { handleSearch() {
this.current = 1; this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getPbuList(); this.getPbuList();
}, },
...@@ -209,6 +222,7 @@ export default { ...@@ -209,6 +222,7 @@ export default {
handleReset() { handleReset() {
this.department = ""; this.department = "";
this.searchVal = ""; this.searchVal = "";
this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getPbuList(); this.getPbuList();
}, },
...@@ -216,17 +230,7 @@ export default { ...@@ -216,17 +230,7 @@ export default {
handleSelectionChange(select) { handleSelectionChange(select) {
this.selectKeys = select; this.selectKeys = select;
}, },
// 翻页
changePagination(cur) {
this.current = cur;
this.getPbuList();
},
// 改变没有显示数量
changeSize(size) {
this.size = size;
this.getPbuList();
},
// 预览 // 预览
handlePreview(row) { handlePreview(row) {
this.materalsInfo = row; this.materalsInfo = row;
...@@ -251,7 +255,6 @@ export default { ...@@ -251,7 +255,6 @@ export default {
this.$message.success(msg); this.$message.success(msg);
this.getPbuList(); this.getPbuList();
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.selectKeys = [];
} }
}) })
.catch(() => { .catch(() => {
...@@ -277,6 +280,7 @@ export default { ...@@ -277,6 +280,7 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
// .table-content { // .table-content {
// height: 550px; // height: 550px;
// } // }
......
<template> <template>
<div> <div>
<el-dialog title="材料预览" :visible.sync="Visible" width="50%" top="2vh"> <el-dialog
title="材料预览"
destroy-on-close
:visible.sync="Visible"
width="50%"
top="2vh"
>
<div class="main flex flexc aic"> <div class="main flex flexc aic">
<div class="header tac mb20"> <div class="header tac mb20">
<div class="materals-name mb10">{{ materialsInfo.materialName }}</div> <div class="materals-name mb10">{{ materialsInfo.materialName }}</div>
...@@ -9,7 +15,7 @@ ...@@ -9,7 +15,7 @@
</p> </p>
</div> </div>
<div class="preview-box"> <div class="preview-box">
<img class="sample-sheet-img" :src="api2 + materialsPreview" /> <img class="sample-sheet-img" :src="materialsPreview" />
</div> </div>
</div> </div>
<div slot="footer" class="tac"> <div slot="footer" class="tac">
...@@ -55,15 +61,13 @@ export default { ...@@ -55,15 +61,13 @@ export default {
}, },
data() { data() {
return { return {
api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL,
loading: false, loading: false,
}; };
}, },
methods: { methods: {
handlePrint(info) { handlePrint(info) {
const a = document.createElement("a"); const a = document.createElement("a");
a.href = this.api2 + info.samplePath; a.href = info.samplePath;
a.download = info.sampleName; a.download = info.sampleName;
a.click(); a.click();
}, },
...@@ -75,20 +79,6 @@ export default { ...@@ -75,20 +79,6 @@ export default {
:deep(.el-dialog__body) { :deep(.el-dialog__body) {
height: 78vh; height: 78vh;
overflow-y: auto; overflow-y: auto;
&::-webkit-scrollbar {
width: 6px;
overflow-y: auto;
}
&::-webkit-scrollbar-thumb {
border-radius: 6px;
background-color: rgba(144, 147, 153, 0.5);
}
&::-webkit-scrollbar-track {
border-radius: 6px;
background: #fff;
}
} }
.main { .main {
width: 100%; width: 100%;
...@@ -108,4 +98,4 @@ export default { ...@@ -108,4 +98,4 @@ export default {
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</div> </div>
<div slot="right" class="flex"> <div slot="right" class="flex">
<el-select <el-select
v-model="departmentLeft" v-model="sampleformMatterTable.searchForm.deptCode"
size="small" size="small"
style="width: 120px" style="width: 120px"
placeholder="选择部门" placeholder="选择部门"
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</el-select> </el-select>
<el-input <el-input
size="small" size="small"
v-model="leftSearch" v-model="sampleformMatterTable.searchForm.matterFullName"
style="width: 200px" style="width: 200px"
class="ml10 mr10" class="ml10 mr10"
placeholder="请输入事项全称搜索" placeholder="请输入事项全称搜索"
...@@ -49,63 +49,33 @@ ...@@ -49,63 +49,33 @@
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<div @click.stop> <div @click.stop>
<el-table <y-table
ref="leftTable" :data="sampleformMatterTable.data"
v-loading="loadingLeft" :max-height="650"
:data="LeftTableData" :column="sampleformMatterTable.columns"
highlight-current-row
size="small" size="small"
border border
:loading="sampleformMatterTable.loading"
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%"
highlight-current-row
reserve-selection
:row-key="(row) => row.id"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
ref="leftTable"
> >
<el-table-column <template slot="matterName" slot-scope="scope">
type="index" <p class="short">{{ scope.row.matterName }}</p>
label="序号" <p class="full-name">
width="55" 事项全称:{{ scope.row.matterFullName }}
align="center" </p>
:index="(index) => (leftCurrent - 1) * leftSize + index + 1" </template>
> </y-table>
</el-table-column>
<el-table-column
show-overflow-tooltip
label="部门名称"
align="center"
prop="deptName"
>
</el-table-column>
<el-table-column
prop="matterName"
show-overflow-tooltip
label="事项名称"
>
<template slot-scope="scope">
<p class="short">{{ scope.row.matterName }}</p>
<p class="full-name">
事项全称:{{ scope.row.matterFullName }}
</p>
</template>
</el-table-column>
<el-table-column
prop="datumCount"
label="材料数量"
align="center"
width="80"
>
</el-table-column>
</el-table>
</div> </div>
</div> </div>
<Pagination <y-pagination
:current="leftCurrent" :total="sampleformMatterTable.total"
:size="leftSize" :page.sync="sampleformMatterTable.page"
:total="leftTotal" :pageSize.sync="sampleformMatterTable.size"
@currentChange="leftChangePagination" @change="getSampleformMatterList"
@sizeChange="leftChangeSize" ></y-pagination>
></Pagination>
</div> </div>
</div> </div>
<div class="right h-full bgw flex flexc"> <div class="right h-full bgw flex flexc">
...@@ -136,7 +106,7 @@ ...@@ -136,7 +106,7 @@
</div> </div>
<div slot="right" class="flex"> <div slot="right" class="flex">
<el-select <el-select
v-model="departmentRight" v-model="materialsTable.searchForm.deptCode"
size="small" size="small"
style="width: 120px" style="width: 120px"
placeholder="选择部门" placeholder="选择部门"
...@@ -159,7 +129,7 @@ ...@@ -159,7 +129,7 @@
<el-input <el-input
size="small" size="small"
style="width: 200px" style="width: 200px"
v-model="rightSearch" v-model="materialsTable.searchForm.materiaFullName"
class="ml10 mr10" class="ml10 mr10"
placeholder="请输入材料全称搜索" placeholder="请输入材料全称搜索"
@keyup.native.enter="handleSearchRight" @keyup.native.enter="handleSearchRight"
...@@ -172,105 +142,61 @@ ...@@ -172,105 +142,61 @@
</TableHeader> </TableHeader>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<el-table <y-table
ref="rightTable" ref="rightTable"
size="small" size="small"
v-loading="loadingRight" :column="materialsTable.columns"
:data="rightTableData" :loading="materialsTable.loading"
reserve-selection :data="materialsTable.data"
border border
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%"
:row-key="(row) => row.id"
@selection-change="handleSelectionChangeRight" @selection-change="handleSelectionChangeRight"
> >
<el-table-column type="selection" width="55" align="center"> <template slot="materialName" slot-scope="scope">
</el-table-column> <p class="short">{{ scope.row.materialName }}</p>
<el-table-column <p class="full-name">材料全称:{{ scope.row.materiaFullName }}</p>
type="index" </template>
label="序号"
width="55" <template slot="action" slot-scope="scope">
align="center" <div class="flex jcb">
:index="(index) => (rightCurrent - 1) * rightSize + index + 1" <div style="width: 60px">
> <span
</el-table-column> @click="handleRecommend(scope.row.id)"
<el-table-column v-if="scope.row.isRecommend == 1"
show-overflow-tooltip class="green pointer"
label="部门名称" >取消推荐</span
align="center"
prop="deptName"
>
</el-table-column>
<el-table-column prop="name" show-overflow-tooltip label="材料名称">
<template slot-scope="scope">
<p class="short">{{ scope.row.materialName }}</p>
<p class="full-name">
材料全称:{{ scope.row.materiaFullName }}
</p>
</template>
</el-table-column>
<el-table-column
prop="categoryName"
show-overflow-tooltip
label="所属文件夹"
align="center"
width="100"
>
</el-table-column>
<el-table-column
prop="total"
label="查看次数"
align="center"
width="80"
>
</el-table-column>
<el-table-column prop="sort" label="排序" align="center" width="80">
</el-table-column>
<el-table-column label="操作" align="center" width="210">
<template slot-scope="scope">
<div class="flex jcb">
<div style="width: 60px">
<span
@click="handleRecommend(scope.row.id)"
v-if="scope.row.isRecommend == 1"
class="green pointer"
>取消推荐</span
>
<span
@click="handleRecommend(scope.row.id)"
v-else
class="pointer primary"
>推荐</span
>
</div>
<span class="primary pointer" @click="handleEdit(scope.row)"
>编辑</span
> >
<!-- <span <span
@click="handleRecommend(scope.row.id)"
v-else
class="pointer primary"
>推荐</span
>
</div>
<span class="primary pointer" @click="handleEdit(scope.row)"
>编辑</span
>
<!-- <span
class="primary pointer" class="primary pointer"
@click="addMaterialsToFolder(scope.row)" @click="addMaterialsToFolder(scope.row)"
>移动至</span >移动至</span
> --> > -->
<span <span class="primary pointer" @click="handlePreview(scope.row)"
class="primary pointer" >预览</span
@click="handlePreview(scope.row)" >
>预览</span <span class="delete pointer" @click="handleDel(scope.row.id)"
> >删除</span
<span class="delete pointer" @click="handleDel(scope.row.id)" >
>删除</span </div>
> </template>
</div> </y-table>
</template>
</el-table-column>
</el-table>
</div> </div>
<Pagination <y-pagination
:current="rightCurrent" :page.sync="materialsTable.page"
:size="rightSize" :pageSize.sync="materialsTable.size"
:total="rightTotal" :total="materialsTable.total"
@currentChange="rightChangePagination" @change="getMaterialsList"
@sizeChange="rightChangeSize" ></y-pagination>
></Pagination>
</div> </div>
<!-- 新增材料 --> <!-- 新增材料 -->
<AddMaterials <AddMaterials
...@@ -312,7 +238,6 @@ import TableHeader from "@/components/TableHeader.vue"; ...@@ -312,7 +238,6 @@ import TableHeader from "@/components/TableHeader.vue";
import AddMaterials from "./modal/AddMaterials.vue"; import AddMaterials from "./modal/AddMaterials.vue";
import PreviewMaterials from "./modal/PreviewMaterials.vue"; import PreviewMaterials from "./modal/PreviewMaterials.vue";
import CommonLib from "./modal/CommonLib.vue"; import CommonLib from "./modal/CommonLib.vue";
import Pagination from "@/components/Pagination.vue";
import AddFolders from "./modal/AddFolders.vue"; import AddFolders from "./modal/AddFolders.vue";
import FolderList from "./modal/FolderList.vue"; import FolderList from "./modal/FolderList.vue";
import TabHeader from "@/components/TabHeader.vue"; import TabHeader from "@/components/TabHeader.vue";
...@@ -330,7 +255,6 @@ export default { ...@@ -330,7 +255,6 @@ export default {
AddMaterials, AddMaterials,
PreviewMaterials, PreviewMaterials,
CommonLib, CommonLib,
Pagination,
AddFolders, AddFolders,
FolderList, FolderList,
TabHeader, TabHeader,
...@@ -340,6 +264,128 @@ export default { ...@@ -340,6 +264,128 @@ export default {
siteId: local.getLocal("sampleSiteId") siteId: local.getLocal("sampleSiteId")
? local.getLocal("sampleSiteId") ? local.getLocal("sampleSiteId")
: "", : "",
// 样表事项表格
sampleformMatterTable: {
loading: false,
page: 1,
size: 10,
total: 0,
data: [],
selectionKeys: [],
searchForm: {
matterFullName: "",
deptCode: "",
},
columns: [
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (
(this.sampleformMatterTable.page - 1) *
this.sampleformMatterTable.size +
index +
1
);
},
},
{
label: "部门名称",
prop: "deptName",
align: "center",
width: "180",
showOverflowTooltip: true,
},
{
label: "事项名称",
slot: true,
prop: "matterName",
showOverflowTooltip: true,
},
{
label: "材料数量",
prop: "datumCount",
align: "center",
width: "100",
},
],
},
// 表单表格
materialsTable: {
loading: false,
page: 1,
size: 10,
total: 0,
data: [],
selectionKeys: [],
searchForm: {
materiaFullName: "",
deptCode: "",
},
columns: [
{
label: "全选",
type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (
(this.materialsTable.page - 1) * this.materialsTable.size +
index +
1
);
},
},
{
label: "部门名称",
prop: "deptName",
align: "center",
width: "180",
showOverflowTooltip: true,
},
{
label: "材料名称",
slot: true,
prop: "materialName",
showOverflowTooltip: true,
},
{
label: "所属文件夹",
prop: "categoryName",
align: "center",
width: "100",
},
{
label: "查看次数",
prop: "total",
align: "center",
width: "80",
},
{
label: "排序",
prop: "sort",
align: "center",
width: "80",
},
{
label: "操作",
slot: true,
prop: "action",
align: "center",
width: "210",
},
],
},
departmentLeft: "", departmentLeft: "",
departmentRight: "", departmentRight: "",
leftSearch: "", leftSearch: "",
...@@ -378,55 +424,53 @@ export default { ...@@ -378,55 +424,53 @@ export default {
methods: { methods: {
// 系统事项列表 // 系统事项列表
async getSampleformMatterList() { async getSampleformMatterList() {
this.loadingLeft = true; this.sampleformMatterTable.loading = true;
let res = await getSampleformMatterList({ let res = await getSampleformMatterList({
page: this.leftCurrent, page: this.sampleformMatterTable.page,
size: this.leftSize, size: this.sampleformMatterTable.size,
matterFullName: `%${this.leftSearch}%`, matterFullName: `%${this.sampleformMatterTable.searchForm.matterFullName}%`,
deptCode: this.departmentLeft, deptCode: this.sampleformMatterTable.searchForm.deptCode,
siteId: this.siteId, siteId: this.siteId,
}); });
this.loadingLeft = false; this.sampleformMatterTable.loading = false;
if (res.data.code === 1) { if (res.data.code === 1) {
let { data, total } = res.data.data; let { data, total } = res.data.data;
this.LeftTableData = data; this.sampleformMatterTable.data = data;
this.leftTotal = total; this.sampleformMatterTable.total = total;
this.$refs.leftTable.bodyWrapper.scrollTop = 0;
} }
}, },
// 获取材料列表 // 获取材料列表
async getMaterialsList() { async getMaterialsList() {
this.loadingRight = true; this.materialsTable.loading = true;
let res = await getMaterialsList({ let res = await getMaterialsList({
page: this.rightCurrent, page: this.materialsTable.page,
size: this.rightSize, size: this.materialsTable.size,
materiaFullName: `%${this.rightSearch}%`, materiaFullName: `%${this.materialsTable.searchForm.materiaFullName}%`,
matterId: this.activeDep.id, matterId: this.activeDep.id,
deptCode: this.departmentRight, deptCode: this.materialsTable.searchForm.deptCode,
siteId: parseInt(this.siteId), siteId: parseInt(this.siteId),
}); });
this.loadingRight = false; this.materialsTable.loading = false;
let { data, total, recommendCount } = res.data.data; let { data, total, recommendCount } = res.data.data;
if (!data.length && this.rightCurrent > 1) { if (!data.length && this.materialsTable.page > 1) {
this.rightCurrent -= 1; this.materialsTable.page -= 1;
this.getMaterialsList(); this.getMaterialsList();
} }
this.rightTotal = total; this.materialsTable.total = total;
this.rightTableData = data; this.materialsTable.data = data;
this.recommendCount = recommendCount; this.recommendCount = recommendCount;
this.$refs.rightTable.bodyWrapper.scrollTop = 0;
}, },
// 左边搜索 // 左边搜索
handleSearchLeft() { handleSearchLeft() {
this.leftCurrent = 1; this.sampleformMatterTable.page = 1;
this.getSampleformMatterList(); this.getSampleformMatterList();
}, },
// 左边重置 // 左边重置
leftReset() { leftReset() {
this.departmentLeft = ""; this.sampleformMatterTable.searchForm.matterFullName = "";
this.leftSearch = ""; this.sampleformMatterTable.searchForm.deptCode = "";
this.leftCurrent = 1; this.sampleformMatterTable.page = 1;
this.getSampleformMatterList(); this.getSampleformMatterList();
}, },
...@@ -434,7 +478,8 @@ export default { ...@@ -434,7 +478,8 @@ export default {
handleCurrentChange(currentRow) { handleCurrentChange(currentRow) {
if (currentRow) { if (currentRow) {
this.activeDep = currentRow; this.activeDep = currentRow;
this.rightCurrent = 1; this.materialsTable.page = 1;
this.$refs.rightTable.clearSelection();
this.getMaterialsList(); this.getMaterialsList();
} }
}, },
...@@ -442,20 +487,11 @@ export default { ...@@ -442,20 +487,11 @@ export default {
setCurrent() { setCurrent() {
this.$refs.leftTable.setCurrentRow(); this.$refs.leftTable.setCurrentRow();
this.activeDep = {}; this.activeDep = {};
this.rightCurrent = 1; this.materialsTable.page = 1;
this.$refs.rightTable.clearSelection();
this.getMaterialsList(); this.getMaterialsList();
}, },
// 左边翻页
leftChangePagination(cur) {
this.leftCurrent = cur;
this.getSampleformMatterList();
},
// 左边改变每页显示数量
leftChangeSize(size) {
this.leftSize = size;
this.getSampleformMatterList();
},
// 新增材料 // 新增材料
handleAddMaterial() { handleAddMaterial() {
if (!this.activeDep.id) { if (!this.activeDep.id) {
...@@ -477,28 +513,28 @@ export default { ...@@ -477,28 +513,28 @@ export default {
}, },
// 右边勾选 // 右边勾选
handleSelectionChangeRight(select) { handleSelectionChangeRight(select) {
this.rightSelectedRowKeys = select; this.materialsTable.selectionKeys = select;
}, },
// 批量删除 // 批量删除
handleDelAll() { handleDelAll() {
if (!this.rightSelectedRowKeys.length) { if (!this.materialsTable.selectionKeys.length) {
this.$message.warning("请先勾选数据"); this.$message.warning("请先勾选数据");
return; return;
} }
let ids = this.rightSelectedRowKeys.map((v) => v.id).join(","); let ids = this.materialsTable.selectionKeys.map((v) => v.id).join(",");
this.handleDel(ids); this.handleDel(ids);
}, },
// 右边搜索 // 右边搜索
handleSearchRight() { handleSearchRight() {
this.rightCurrent = 1; this.materialsTable.page = 1;
this.$refs.rightTable.clearSelection(); this.$refs.rightTable.clearSelection();
this.getMaterialsList(); this.getMaterialsList();
}, },
// 右边重置 // 右边重置
rightReset() { rightReset() {
this.departmentRight = ""; this.materialsTable.page = 1;
this.rightSearch = ""; this.materialsTable.searchForm.materiaFullName = "";
this.rightCurrent = 1; this.materialsTable.searchForm.deptCode = "";
this.$refs.rightTable.clearSelection(); this.$refs.rightTable.clearSelection();
this.getMaterialsList(); this.getMaterialsList();
}, },
...@@ -538,23 +574,13 @@ export default { ...@@ -538,23 +574,13 @@ export default {
this.getMaterialsList(); this.getMaterialsList();
this.getSampleformMatterList(); this.getSampleformMatterList();
this.$refs.rightTable.clearSelection(); this.$refs.rightTable.clearSelection();
this.rightSelectedRowKeys = [];
} }
}) })
.catch(() => { .catch(() => {
console.log("取消成功!"); console.log("取消成功!");
}); });
}, },
// 右边翻页
rightChangePagination(cur) {
this.rightCurrent = cur;
this.getMaterialsList();
},
// 右边改变每页显示数量
rightChangeSize(size) {
this.rightSize = size;
this.getMaterialsList();
},
// 新增材料成功 // 新增材料成功
addSuccess() { addSuccess() {
this.getSampleformMatterList(); this.getSampleformMatterList();
...@@ -571,11 +597,14 @@ export default { ...@@ -571,11 +597,14 @@ export default {
}, },
// 移动材料进事项文件夹 // 移动材料进事项文件夹
addMaterialsToFolder() { addMaterialsToFolder() {
if (!this.rightSelectedRowKeys.length) { if (!this.materialsTable.selectionKeys.length) {
this.$message.warning("请先勾选材料"); this.$message.warning("请先勾选材料");
return; return;
} }
this.$refs.FolderList.onAdd(this.rightSelectedRowKeys, this.activeDep.id); this.$refs.FolderList.onAdd(
this.materialsTable.selectionKeys,
this.activeDep.id
);
this.folderListVisible = true; this.folderListVisible = true;
}, },
materialsToFolderOk() { materialsToFolderOk() {
......
...@@ -8,25 +8,23 @@ ...@@ -8,25 +8,23 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form <el-form
size="small" size="medium"
ref="form" ref="form"
:model="form" :model="form"
:rules="rules" :rules="rules"
label-width="100px" label-width="100px"
> >
<el-form-item label="所属事项"> <el-form-item label="所属事项">
<el-input size="small" disabled :value="form.matterName"></el-input> <el-input disabled :value="form.matterName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="文件夹名称" prop="categoryName"> <el-form-item label="文件夹名称" prop="categoryName">
<el-input <el-input
size="small"
v-model="form.categoryName" v-model="form.categoryName"
placeholder="请输入文件夹名称" placeholder="请输入文件夹名称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="文件夹编码" prop="categoryCode"> <el-form-item label="文件夹编码" prop="categoryCode">
<el-input <el-input
size="small"
v-model="form.categoryCode" v-model="form.categoryCode"
placeholder="请输入文件夹编码" placeholder="请输入文件夹编码"
></el-input> ></el-input>
...@@ -40,10 +38,10 @@ ...@@ -40,10 +38,10 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleRest">重 置</el-button> <el-button size="medium" @click="handleRest">重 置</el-button>
<el-button <el-button
:loading="loading" :loading="loading"
size="small" size="medium"
type="primary" type="primary"
@click="handleOk" @click="handleOk"
>确 定</el-button >确 定</el-button
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form <el-form
size="small" size="medium"
ref="form" ref="form"
:model="form" :model="form"
:rules="rules" :rules="rules"
...@@ -16,23 +16,21 @@ ...@@ -16,23 +16,21 @@
> >
<el-form-item label="材料简称" prop="materialName"> <el-form-item label="材料简称" prop="materialName">
<el-input <el-input
size="small"
v-model="form.materialName" v-model="form.materialName"
placeholder="请输入材料简称" placeholder="请输入材料简称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="材料全称" prop="materiaFullName"> <el-form-item label="材料全称" prop="materiaFullName">
<el-input <el-input
size="small"
v-model="form.materiaFullName" v-model="form.materiaFullName"
placeholder="请输入材料全称" placeholder="请输入材料全称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="所属事项"> <el-form-item label="所属事项">
<el-input disabled size="small" v-model="form.matterName"></el-input> <el-input disabled v-model="form.matterName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="事项编码"> <el-form-item label="事项编码">
<el-input disabled size="small" v-model="form.matterNo"></el-input> <el-input disabled v-model="form.matterNo"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-input-number <el-input-number
...@@ -54,27 +52,22 @@ ...@@ -54,27 +52,22 @@
</el-switch> </el-switch>
</el-form-item> </el-form-item>
<el-form-item label="上传样表" prop="samplePath"> <el-form-item label="上传样表" prop="samplePath">
<el-upload <YUpload
class="upload-demo" :fileList="samplePathFileList"
:action="api + 'sampleform/file/commonupload'" accept=".docx,.doc,.pdf,.png,.jpg,.jpeg"
:on-remove="handleRemoveSamplePath" :limit="1"
:file-list="samplePathFileList" v-model="form.samplePath"
:on-success="OnsuccessSamplePath" @change="handleFileName"
:headers="{
Authorization: token,
}"
> >
<!-- accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document" --> <el-button type="primary">上传文件</el-button>
<el-button size="small" type="primary">上传文件</el-button> </YUpload>
<!-- <span class="tips">提示:请上传.docx格式</span> -->
</el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleRest">重 置</el-button> <el-button size="medium" @click="handleRest">重 置</el-button>
<el-button <el-button
:loading="loading" :loading="loading"
size="small" size="medium"
type="primary" type="primary"
@click="handleOk" @click="handleOk"
>确 定</el-button >确 定</el-button
...@@ -103,7 +96,6 @@ export default { ...@@ -103,7 +96,6 @@ export default {
}, },
data() { data() {
return { return {
api: process.env.VUE_APP_API_BASE_URL + "/",
form: { form: {
materialName: "", // 材料名称 materialName: "", // 材料名称
materiaFullName: "", // 材料全名 materiaFullName: "", // 材料全名
...@@ -209,21 +201,11 @@ export default { ...@@ -209,21 +201,11 @@ export default {
this.loading = false; this.loading = false;
this.Visible = false; this.Visible = false;
}, },
// 上传样表
OnsuccessSamplePath(response, file, fileList) { handleFileName({ fileList }) {
if (response.code == 1) { let fileName = fileList.length ? fileList[0].name : "";
this.samplePathFileList = fileList.slice(-1); this.form.sampleName = fileName;
this.form.samplePath = response.url; this.samplePathFileList = fileList;
this.form.sampleName = response.fileName;
} else {
let msg = response.msg || "上传失败";
this.$message.error(msg);
}
},
// 删除样表
handleRemoveSamplePath() {
this.form.samplePath = "";
this.form.sampleName = "";
}, },
}, },
}; };
......
...@@ -4,11 +4,30 @@ ...@@ -4,11 +4,30 @@
:destroy-on-close="true" :destroy-on-close="true"
title="从公共库中选择" title="从公共库中选择"
:visible.sync="Visible" :visible.sync="Visible"
width="70%" width="50%"
:close-on-click-modal="false"
> >
<TableHeader> <TableHeader>
<div slot="right" class="flex"> <div slot="right" class="flex">
<el-select
v-model="department"
class="autoWidth"
size="small"
placeholder="选择部门"
filterable
>
<template slot="prefix">
{{
(deptList.find((s) => s.deptNumber === department) || {}).name
}}
</template>
<el-option
v-for="item in deptList"
:key="item.deptNumber"
:label="item.name"
:value="item.deptNumber"
>
</el-option>
</el-select>
<el-input <el-input
size="small" size="small"
style="width: 200px" style="width: 200px"
...@@ -18,69 +37,41 @@ ...@@ -18,69 +37,41 @@
@keyup.native.enter="handleSarch" @keyup.native.enter="handleSarch"
></el-input> ></el-input>
<el-button size="small" type="primary" @click="handleSarch" <el-button size="small" type="primary" @click="handleSarch"
> ></el-button
</el-button> >
<el-button size="small" @click="resetSearch"> </el-button> <el-button size="small" @click="resetSearch">重置</el-button>
</div> </div>
</TableHeader> </TableHeader>
<el-table <y-table
ref="multipleTable" ref="multipleTable"
v-loading="loading"
size="small" size="small"
:data="tableData" :data="tableData"
reserve-selection :column="columns"
:loading="loading"
border border
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%" style="width: 100%"
max-height="500px" max-height="460px"
:row-key="(row) => row.id" :row-key="(row) => row.id"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center"> <template slot="materialName" slot-scope="scope">
</el-table-column> <p class="short">{{ scope.row.materialName }}</p>
<el-table-column <p class="full-name">材料全称:{{ scope.row.materiaFullName }}</p>
type="index" </template>
label="序号" </y-table>
width="55" <y-pagination
align="center"
:index="(index) => (current - 1) * size + index + 1"
>
</el-table-column>
<el-table-column
show-overflow-tooltip
label="部门名称"
align="center"
prop="deptName"
width="300"
>
</el-table-column>
<el-table-column prop="name" show-overflow-tooltip label="材料名称">
<template slot-scope="scope">
<p class="short">{{ scope.row.materialName }}</p>
<p class="full-name">材料全称:{{ scope.row.materiaFullName }}</p>
</template>
</el-table-column>
<el-table-column
prop="createTime"
label="加入时间"
align="center"
width="140"
>
</el-table-column>
</el-table>
<Pagination
:total="total" :total="total"
:current="current" :page.sync="page"
:size="size" :pageSize.sync="size"
@currentChange="changePagination" @change="getPbuList"
@sizeChange="changeSize" ></y-pagination>
></Pagination>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="Visible = false">取 消</el-button> <el-button size="medium" @click="handleClose"> </el-button>
<el-button <el-button
:loading="loading" :loading="addLoading"
size="small" size="medium"
type="primary" type="primary"
@click="handleOk" @click="handleOk"
> </el-button > </el-button
...@@ -92,16 +83,13 @@ ...@@ -92,16 +83,13 @@
<script> <script>
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import Pagination from "@/components/Pagination.vue";
import { getPubdatumList } from "@/api/libray";
import { addPubdatum } from "@/api/materials"; import { addPubdatum } from "@/api/materials";
import local from "@/utils/local"; import { getPubdatumList } from "@/api/libray";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import local from "@/utils/local";
export default { export default {
components: { components: {
TableHeader, TableHeader,
Pagination,
}, },
props: { props: {
libVisible: { libVisible: {
...@@ -110,11 +98,10 @@ export default { ...@@ -110,11 +98,10 @@ export default {
default: false, default: false,
}, },
matterId: { matterId: {
required: false, required: true,
default: 0, default: "",
}, },
}, },
created() {},
data() { data() {
return { return {
siteId: local.getLocal("sampleSiteId") siteId: local.getLocal("sampleSiteId")
...@@ -123,12 +110,49 @@ export default { ...@@ -123,12 +110,49 @@ export default {
department: "", department: "",
searchVal: "", searchVal: "",
tableData: [], tableData: [],
current: 1,
total: 10,
size: 10,
selectedRowKeys: [],
loading: false, loading: false,
addLoading: false, addLoading: false,
page: 1,
total: 10,
size: 10,
columns: [
{
label: "全选",
type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (this.page - 1) * this.size + index + 1;
},
},
{
label: "部门名称",
prop: "deptName",
align: "center",
width: "300",
showOverflowTooltip: true,
},
{
label: "材料名称",
slot: true,
prop: "materialName",
showOverflowTooltip: true,
},
{
label: "加入时间",
prop: "createTime",
align: "center",
width: "140",
},
],
}; };
}, },
computed: { computed: {
...@@ -142,13 +166,15 @@ export default { ...@@ -142,13 +166,15 @@ export default {
}, },
...mapGetters(["deptList"]), ...mapGetters(["deptList"]),
}, },
created() {},
methods: { methods: {
// 公共库材料列表 // 公共库材料
async getPbuList() { async getPbuList() {
this.loading = true; this.loading = true;
let res = await getPubdatumList({ let res = await getPubdatumList({
page: this.current, page: this.page,
size: this.size, size: this.size,
deptCode: this.department,
materiaFullName: `%${this.searchVal}%`, materiaFullName: `%${this.searchVal}%`,
}); });
this.loading = false; this.loading = false;
...@@ -156,7 +182,6 @@ export default { ...@@ -156,7 +182,6 @@ export default {
let { data, total } = res.data.data; let { data, total } = res.data.data;
this.tableData = data; this.tableData = data;
this.total = total; this.total = total;
this.$refs.multipleTable.bodyWrapper.scrollTop = 0;
} }
}, },
async handleOk() { async handleOk() {
...@@ -170,34 +195,31 @@ export default { ...@@ -170,34 +195,31 @@ export default {
this.addLoading = false; this.addLoading = false;
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
this.$refs.multipleTable.clearSelection(); this.handleClose();
this.Visible = false;
this.$emit("ok"); this.$emit("ok");
} }
}, },
handleSarch() { handleSarch() {
this.current = 1; this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getPbuList(); this.getPbuList();
}, },
resetSearch() { resetSearch() {
this.current = 1;
this.searchVal = ""; this.searchVal = "";
this.department = "";
this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getPbuList(); this.getPbuList();
}, },
changePagination(cur) {
this.current = cur;
this.getPbuList();
},
changeSize(size) {
this.size = size;
this.getPbuList();
},
handleSelectionChange(select) { handleSelectionChange(select) {
this.selectedRowKeys = select.map((i) => i.id); this.selectedRowKeys = select.map((i) => i.id);
// console.log(select); },
// 关闭
handleClose() {
Object.assign(this.$data, this.$options.data());
this.$refs.multipleTable.clearSelection();
this.Visible = false;
}, },
}, },
}; };
...@@ -209,11 +231,10 @@ export default { ...@@ -209,11 +231,10 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.full-name { .full-name {
color: rgb(172, 170, 170); color: rgb(172, 170, 170);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
</style> </style>
\ No newline at end of file
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
</div> </div>
<el-empty v-else description="暂无文件夹"></el-empty> <el-empty v-else description="暂无文件夹"></el-empty>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleClose">关 闭</el-button> <el-button size="medium" @click="handleClose">关 闭</el-button>
<el-button <el-button
:loading="loading" :loading="loading"
size="small" size="medium"
type="primary" type="primary"
@click="handleOk" @click="handleOk"
>确 定</el-button >确 定</el-button
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</div> </div>
<!-- 样表 --> <!-- 样表 -->
<div class="sample-sheet flex1"> <div class="sample-sheet flex1">
<img class="sample-sheet-img" :src="api2 + materialsPreview" /> <img class="sample-sheet-img" :src="materialsPreview" />
</div> </div>
</div> </div>
<!-- <div class="right">--> <!-- <div class="right">-->
...@@ -57,8 +57,6 @@ export default { ...@@ -57,8 +57,6 @@ export default {
}, },
data() { data() {
return { return {
api: process.env.VUE_APP_API_BASE_URL + "/",
api2: process.env.VUE_APP_API_IMG_URL,
val: "", val: "",
}; };
}, },
...@@ -153,4 +151,4 @@ export default { ...@@ -153,4 +151,4 @@ export default {
padding-bottom: 20px; padding-bottom: 20px;
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
\ No newline at end of file
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
</div> </div>
<div slot="right" class="flex"> <div slot="right" class="flex">
<el-select <el-select
v-model="departmentLeft" v-model="sampleformMatterTable.searchForm.deptCode"
size="small" size="small"
style="width: 120px"
placeholder="选择部门" placeholder="选择部门"
style="width: 120px"
filterable filterable
> >
<!-- <template slot="prefix"> <!-- <template slot="prefix">
...@@ -38,10 +38,10 @@ ...@@ -38,10 +38,10 @@
<el-input <el-input
size="small" size="small"
style="width: 200px" style="width: 200px"
v-model="leftSearch" v-model="sampleformMatterTable.searchForm.matterFullName"
@keyup.native.enter="searchLeft"
class="ml10 mr10" class="ml10 mr10"
placeholder="请输入事项全称搜索" placeholder="请输入事项全称搜索"
@keyup.native.enter="searchLeft"
></el-input> ></el-input>
<el-button size="small" type="primary" @click="searchLeft" <el-button size="small" type="primary" @click="searchLeft"
> </el-button > </el-button
...@@ -51,108 +51,55 @@ ...@@ -51,108 +51,55 @@
</TableHeader> </TableHeader>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<el-table <y-table
:data="LeftTableData" :data="sampleformMatterTable.data"
:max-height="650"
:column="sampleformMatterTable.columns"
size="small" size="small"
border border
v-loading="loadingLeft" :loading="sampleformMatterTable.loading"
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%"
:row-key="(row) => row.id"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
ref="leftTable" ref="leftTable"
> >
<el-table-column type="selection" width="55" align="center"> <template slot="matterName" slot-scope="scope">
</el-table-column> <p class="short">{{ scope.row.matterName }}</p>
<el-table-column <p class="full-name">事项全称:{{ scope.row.matterFullName }}</p>
type="index" </template>
label="序号" <!-- 操作 -->
width="55" <template slot="action" slot-scope="scope">
align="center" <div class="flex jcb">
:index="(index) => (leftCurrent - 1) * leftSize + index + 1" <div style="width: 60px">
> <span
</el-table-column> @click="handleRecommend(scope.row.id)"
<el-table-column v-if="scope.row.isRecommend == 1"
show-overflow-tooltip class="green pointer"
label="部门名称" >取消推荐</span
align="center"
prop="deptName"
>
</el-table-column>
<el-table-column
prop="matterName"
show-overflow-tooltip
label="事项名称"
>
<template slot-scope="scope">
<p class="short">{{ scope.row.matterName }}</p>
<p class="full-name">
事项全称:{{ scope.row.matterFullName }}
</p>
</template>
</el-table-column>
<el-table-column
prop="tid"
label="事项来源"
align="center"
width="80"
>
<template slot-scope="scope">
<span v-if="scope.row.source === 1">手动添加</span>
<span v-else-if="scope.row.source === 0">站点事项</span>
</template>
</el-table-column>
<el-table-column
prop="total"
label="填单次数"
align="center"
width="80"
>
</el-table-column>
<el-table-column label="操作" align="center" width="160">
<template slot-scope="scope">
<div class="flex jcb">
<div style="width: 60px">
<span
@click="handleRecommend(scope.row.id)"
v-if="scope.row.isRecommend == 1"
class="green pointer"
>取消推荐</span
>
<span
@click="handleRecommend(scope.row.id)"
v-else
class="pointer primary"
>推荐</span
>
</div>
<span class="primary pointer" @click="handleEdit(scope.row)"
>编辑</span
> >
<span class="delete pointer" @click="handleDel(scope.row.id)" <span
>删除</span @click="handleRecommend(scope.row.id)"
v-else
class="pointer primary"
>推荐</span
> >
</div> </div>
</template> <span class="primary pointer" @click="handleEdit(scope.row)"
</el-table-column> >编辑</span
</el-table> >
<span class="delete pointer" @click="handleDel(scope.row.id)"
>删除</span
>
</div>
</template>
</y-table>
</div> </div>
<Pagination <y-pagination
:current="leftCurrent" :page.sync="sampleformMatterTable.page"
:size="leftSize" :pageSize.sync="sampleformMatterTable.size"
:total="leftTotal" :total="sampleformMatterTable.total"
@currentChange="leftChangePagination" @change="getSampleformMatterList"
@sizeChange="leftChangeSize" ></y-pagination>
></Pagination>
</div> </div>
<!-- 新增事项 -->
<AddMatter
ref="AddMatter"
:addMatterVisible.sync="addMatterVisible"
:departmentList="deptList"
:title="title"
@addMatter="getSampleformMatterList"
></AddMatter>
</div> </div>
<!-- --> <!-- -->
<div class="right h-full bgw flex flexc"> <div class="right h-full bgw flex flexc">
...@@ -167,10 +114,10 @@ ...@@ -167,10 +114,10 @@
</div> </div>
<div slot="right" class="flex"> <div slot="right" class="flex">
<el-select <el-select
v-model="departmentRight" v-model="siteMatterTable.searchForm.deptCode"
size="small" size="small"
style="width: 120px"
placeholder="选择部门" placeholder="选择部门"
style="width: 120px"
filterable filterable
> >
<!-- <template slot="prefix"> <!-- <template slot="prefix">
...@@ -190,7 +137,7 @@ ...@@ -190,7 +137,7 @@
<el-input <el-input
size="small" size="small"
style="width: 200px" style="width: 200px"
v-model="rightSearch" v-model="siteMatterTable.searchForm.matterName"
class="ml10 mr10" class="ml10 mr10"
placeholder="请输入事项名称搜索" placeholder="请输入事项名称搜索"
@keyup.native.enter="handleSearchRight" @keyup.native.enter="handleSearchRight"
...@@ -203,70 +150,45 @@ ...@@ -203,70 +150,45 @@
</TableHeader> </TableHeader>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<el-table <y-table
:max-height="650"
:data="siteMatterTable.data"
:column="siteMatterTable.columns"
size="small" size="small"
ref="rightTable"
:data="rightTableData"
border border
v-loading="loadingRight" :loading="siteMatterTable.loading"
tooltip-effect="dark" tooltip-effect="dark"
style="width: 100%"
:row-key="(row) => row.id"
@selection-change="handleSelectionChangeRight" @selection-change="handleSelectionChangeRight"
ref="rightTable"
> >
<el-table-column <template slot="source" slot-scope="scope">
type="selection" <el-tag size="small" type="success" v-if="scope.row.source == 0"
reserve-selection >一体化添加</el-tag
width="55" >
align="center" <el-tag size="small" v-else>自建事项</el-tag>
> </template>
</el-table-column> <template slot="action" slot-scope="scope">
<el-table-column <span class="primary pointer" @click="handleJoin(scope.row.id)"
type="index" >加入</span
label="序号" >
width="55" </template>
align="center" </y-table>
:index="(index) => (rightCurrent - 1) * rightSize + index + 1"
>
</el-table-column>
<el-table-column
show-overflow-tooltip
label="部门名称"
align="center"
prop="deptName"
>
</el-table-column>
<el-table-column
prop="matterName"
show-overflow-tooltip
label="事项名称"
>
</el-table-column>
<el-table-column width="100" align="center" label="事项来源">
<template slot-scope="scope">
<el-tag size="small" type="success" v-if="scope.row.source == 0"
>一体化添加</el-tag
>
<el-tag size="small" v-else>自建事项</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="160">
<template slot-scope="scope">
<span class="primary pointer" @click="handleJoin(scope.row.id)"
>加入</span
>
</template>
</el-table-column>
</el-table>
</div> </div>
<Pagination <y-pagination
:current="rightCurrent" :page.sync="siteMatterTable.page"
:size="rightSize" :pageSize.sync="siteMatterTable.size"
:total="rightTotal" :total="siteMatterTable.total"
@currentChange="rightChangePagination" @change="getMatterSubList"
@sizeChange="rightChangeSize" ></y-pagination>
></Pagination>
</div> </div>
<!-- 新增事项 -->
<AddMatter
ref="AddMatter"
:addMatterVisible.sync="addMatterVisible"
:departmentList="deptList"
:title="title"
@addMatter="getSampleformMatterList"
></AddMatter>
</div> </div>
</div> </div>
</template> </template>
...@@ -274,11 +196,8 @@ ...@@ -274,11 +196,8 @@
<script> <script>
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import AddMatter from "./modal/AddMatter.vue"; import AddMatter from "./modal/AddMatter.vue";
import Pagination from "@/components/Pagination.vue";
import TabHeader from "@/components/TabHeader.vue";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { import {
// getMatterList,
createMatter, createMatter,
getSampleformMatterList, getSampleformMatterList,
delMatter, delMatter,
...@@ -290,30 +209,145 @@ export default { ...@@ -290,30 +209,145 @@ export default {
components: { components: {
TableHeader, TableHeader,
AddMatter, AddMatter,
Pagination,
TabHeader,
}, },
data() { data() {
return { return {
siteId: local.getLocal("sampleSiteId") siteId: local.getLocal("sampleSiteId")
? local.getLocal("sampleSiteId") ? local.getLocal("sampleSiteId")
: "", : "",
departmentLeft: "", // 样表事项表格
departmentRight: "", sampleformMatterTable: {
loadingLeft: false, loading: false,
leftSearch: "", page: 1,
rightSearch: "", size: 10,
LeftTableData: [], total: 0,
leftSelectedRowKeys: [], data: [],
leftCurrent: 1, selectionKeys: [],
leftSize: 10, searchForm: {
leftTotal: 0, matterFullName: "",
loadingRight: false, deptCode: "",
rightCurrent: 1, },
rightSize: 10, columns: [
rightTotal: 0, {
rightTableData: [], label: "全选",
rightSelectedRowKeys: [], type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (
(this.sampleformMatterTable.page - 1) *
this.sampleformMatterTable.size +
index +
1
);
},
},
{
label: "部门名称",
prop: "deptName",
align: "center",
showOverflowTooltip: true,
},
{
label: "事项名称",
slot: true,
prop: "matterName",
showOverflowTooltip: true,
},
{
label: "事项来源",
prop: "source",
align: "center",
width: "100",
formatter: (row) => {
return row.source === 0 ? "站点事项" : "手动添加";
},
},
// {
// label: "填单次数",
// prop: "total",
// width: "100",
// align: "center",
// },
{
label: "操作",
slot: true,
prop: "action",
align: "center",
width: "160",
},
],
},
// 站点事项表格
siteMatterTable: {
loading: false,
page: 1,
size: 10,
total: 0,
data: [],
selectionKeys: [],
searchForm: {
matterName: "",
deptCode: "",
},
columns: [
{
label: "全选",
type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (
(this.siteMatterTable.page - 1) * this.siteMatterTable.size +
index +
1
);
},
},
{
label: "部门名称",
prop: "deptName",
align: "center",
showOverflowTooltip: true,
},
{
label: "事项名称",
prop: "matterName",
showOverflowTooltip: true,
},
{
label: "事项来源",
slot: true,
prop: "source",
align: "center",
},
{
label: "操作",
slot: true,
prop: "action",
align: "center",
width: "160",
},
],
},
addMatterVisible: false, addMatterVisible: false,
title: "新增事项", title: "新增事项",
recommendCount: "", // 推荐事项个数 recommendCount: "", // 推荐事项个数
...@@ -329,44 +363,42 @@ export default { ...@@ -329,44 +363,42 @@ export default {
methods: { methods: {
// 获取一体化事项列表 // 获取一体化事项列表
async getMatterSubList() { async getMatterSubList() {
this.loadingRight = true; this.siteMatterTable.loading = true;
let res = await getMatterSubList({ let res = await getMatterSubList({
page: this.rightCurrent, page: this.siteMatterTable.page,
size: this.rightSize, size: this.siteMatterTable.size,
matterName: `%${this.rightSearch}%`, matterName: `%${this.siteMatterTable.searchForm.matterName}%`,
deptCode: this.departmentRight, deptCode: this.siteMatterTable.searchForm.deptCode,
siteId: this.siteId, siteId: this.siteId,
}); });
this.loadingRight = false; this.siteMatterTable.loading = false;
if (res.data.code === 1) { if (res.data.code === 1) {
let { total, data } = res.data.data; let { total, data } = res.data.data;
this.rightTableData = data; this.siteMatterTable.data = data;
this.rightTotal = total; this.siteMatterTable.total = total;
this.$refs.rightTable.bodyWrapper.scrollTop = 0;
} }
}, },
// 获取样表系统事项列表 // 获取样表系统事项列表
async getSampleformMatterList() { async getSampleformMatterList() {
this.loadingLeft = true; this.sampleformMatterTable.loading = true;
let res = await getSampleformMatterList({ let res = await getSampleformMatterList({
page: this.leftCurrent, page: this.sampleformMatterTable.page,
size: this.leftSize, size: this.sampleformMatterTable.size,
matterFullName: `%${this.leftSearch}%`, matterFullName: `%${this.sampleformMatterTable.searchForm.matterFullName}%`,
deptCode: this.departmentLeft, deptCode: this.sampleformMatterTable.searchForm.deptCode,
siteId: this.siteId, siteId: this.siteId,
}); });
this.loadingLeft = false; this.sampleformMatterTable.loading = false;
if (res.data.code === 1) { if (res.data.code === 1) {
let { data, total, recommendCount } = res.data.data; let { data, total, recommendCount } = res.data.data;
if (!data.length && this.leftCurrent > 1) { if (!data.length && this.sampleformMatterTable.page > 1) {
this.leftCurrent -= 1; this.sampleformMatterTable.page -= 1;
this.getSampleformMatterList(); this.getSampleformMatterList();
} }
this.LeftTableData = data; this.sampleformMatterTable.data = data;
this.leftTotal = total; this.sampleformMatterTable.total = total;
this.recommendCount = recommendCount; this.recommendCount = recommendCount;
this.$refs.leftTable.bodyWrapper.scrollTop = 0;
} }
}, },
// 新增事项 // 新增事项
...@@ -396,41 +428,34 @@ export default { ...@@ -396,41 +428,34 @@ export default {
}, },
// 批量删除 // 批量删除
handleDelAll() { handleDelAll() {
if (!this.leftSelectedRowKeys.length) { if (!this.sampleformMatterTable.selectionKeys.length) {
this.$message.warning("请先勾选数据"); this.$message.warning("请先勾选数据");
return; return;
} }
let ids = this.leftSelectedRowKeys.map((v) => v.id).join(","); let ids = this.sampleformMatterTable.selectionKeys
.map((v) => v.id)
.join(",");
this.handleDel(ids); this.handleDel(ids);
}, },
// 左边搜索 // 左边搜索
searchLeft() { searchLeft() {
this.leftCurrent = 1; this.sampleformMatterTable.page = 1;
this.$refs.leftTable.clearSelection(); this.$refs.leftTable.clearSelection();
this.getSampleformMatterList(); this.getSampleformMatterList();
}, },
// 左边重置 // 左边重置
leftReset() { leftReset() {
this.departmentLeft = ""; this.sampleformMatterTable.searchForm.deptCode = "";
this.leftSearch = ""; this.sampleformMatterTable.searchForm.matterFullName = "";
this.leftCurrent = 1; this.sampleformMatterTable.page = 1;
this.$refs.leftTable.clearSelection(); this.$refs.leftTable.clearSelection();
this.getSampleformMatterList(); this.getSampleformMatterList();
}, },
// 左边勾选 // 左边勾选
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.leftSelectedRowKeys = selection; this.sampleformMatterTable.selectionKeys = selection;
},
// 左边翻页
leftChangePagination(cur) {
this.leftCurrent = cur;
this.getSampleformMatterList();
},
// 左边改变每页显示数量
leftChangeSize(size) {
this.leftSize = size;
this.getSampleformMatterList();
}, },
// 左边删除 // 左边删除
handleDel(id) { handleDel(id) {
this.$confirm( this.$confirm(
...@@ -449,7 +474,6 @@ export default { ...@@ -449,7 +474,6 @@ export default {
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
this.$refs.leftTable.clearSelection(); this.$refs.leftTable.clearSelection();
this.leftSelectedRowKeys = [];
this.getSampleformMatterList(); this.getSampleformMatterList();
this.getMatterSubList(); this.getMatterSubList();
} }
...@@ -460,21 +484,21 @@ export default { ...@@ -460,21 +484,21 @@ export default {
}, },
// 右边搜索 // 右边搜索
handleSearchRight() { handleSearchRight() {
this.rightCurrent = 1; this.siteMatterTable.page = 1;
this.$refs.rightTable.clearSelection(); this.$refs.rightTable.clearSelection();
this.getMatterSubList(); this.getMatterSubList();
}, },
// 右边重置 // 右边重置
rightReset() { rightReset() {
this.rightSearch = ""; this.siteMatterTable.searchForm.matterName = "";
this.departmentRight = ""; this.siteMatterTable.searchForm.deptCode = "";
this.rightCurrent = 1; this.siteMatterTable.page = 1;
this.$refs.rightTable.clearSelection(); this.$refs.rightTable.clearSelection();
this.getMatterSubList(); this.getMatterSubList();
}, },
// 右边勾选 // 右边勾选
handleSelectionChangeRight(select) { handleSelectionChangeRight(select) {
this.rightSelectedRowKeys = select; this.siteMatterTable.selectionKeys = select;
}, },
// 右边加入 // 右边加入
async handleJoin(id) { async handleJoin(id) {
...@@ -482,29 +506,19 @@ export default { ...@@ -482,29 +506,19 @@ export default {
let { code, msg } = res.data; let { code, msg } = res.data;
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
this.rightSelectedRowKeys = [];
this.$refs.rightTable.clearSelection(); this.$refs.rightTable.clearSelection();
this.getMatterSubList();
this.getSampleformMatterList(); this.getSampleformMatterList();
this.getMatterSubList();
} }
}, },
// 右边翻页
rightChangePagination(cur) {
this.rightCurrent = cur;
this.getMatterSubList();
},
// 右边改变每页显示数量
rightChangeSize(size) {
this.rightSize = size;
this.getMatterSubList();
},
// 批量加入 // 批量加入
handleAllJoin() { handleAllJoin() {
if (!this.rightSelectedRowKeys.length) { if (!this.siteMatterTable.selectionKeys.length) {
this.$message.warning("请先勾选数据"); this.$message.warning("请先勾选数据");
return; return;
} }
let ids = this.rightSelectedRowKeys.map((v) => v.id).join(","); let ids = this.siteMatterTable.selectionKeys.map((v) => v.id).join(",");
this.handleJoin(ids); this.handleJoin(ids);
}, },
}, },
...@@ -527,6 +541,7 @@ export default { ...@@ -527,6 +541,7 @@ export default {
white-space: nowrap; white-space: nowrap;
} }
} }
// .table-content { // .table-content {
// height: 550px; // height: 550px;
// } // }
......
...@@ -7,31 +7,33 @@ ...@@ -7,31 +7,33 @@
@close="handleClose" @close="handleClose"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form
ref="form"
size="medium"
:model="form"
:rules="rules"
label-width="80px"
>
<el-form-item label="事项简称" prop="matterName"> <el-form-item label="事项简称" prop="matterName">
<el-input <el-input
size="small"
v-model="form.matterName" v-model="form.matterName"
placeholder="请输入事项简称" placeholder="请输入事项简称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="事项全称" prop="matterFullName"> <el-form-item label="事项全称" prop="matterFullName">
<el-input <el-input
size="small"
v-model="form.matterFullName" v-model="form.matterFullName"
placeholder="请输入事项全称" placeholder="请输入事项全称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="事项编号" prop="matterNo"> <el-form-item label="事项编号" prop="matterNo">
<el-input <el-input
size="small"
v-model="form.matterNo" v-model="form.matterNo"
placeholder="请输入事项编号" placeholder="请输入事项编号"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="选择部门" prop="deptCode"> <el-form-item label="选择部门" prop="deptCode">
<el-select <el-select
size="small"
ref="myselected" ref="myselected"
v-model="form.deptCode" v-model="form.deptCode"
placeholder="请选择部门" placeholder="请选择部门"
...@@ -48,8 +50,8 @@ ...@@ -48,8 +50,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleRest">重 置</el-button> <el-button size="medium" @click="handleRest">重 置</el-button>
<el-button size="small" type="primary" @click="handleOk" <el-button size="medium" type="primary" @click="handleOk"
>确 定</el-button >确 定</el-button
> >
</span> </span>
......
...@@ -26,75 +26,40 @@ ...@@ -26,75 +26,40 @@
</TableHeader> </TableHeader>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<el-table <y-table
ref="multipleTable" :max-height="650"
v-loading="loading"
:data="tableData" :data="tableData"
:column="columns"
border border
tooltip-effect="dark" :loading="loading"
style="width: 100%"
:row-key="(row) => row.id"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
ref="multipleTable"
> >
<el-table-column <template slot="validStatus" slot-scope="scope">
reserve-selection <el-tag size="small" v-if="scope.row.validStatus == 1" type="success"
type="selection" >有效</el-tag
width="55" >
align="center" <el-tag size="small" v-else type="info">禁用</el-tag>
> </template>
</el-table-column>
<el-table-column <template slot="action" slot-scope="scope">
type="index" <div class="flex jca">
label="序号" <span class="primary pointer" @click="handleEdit(scope.row)"
width="55" >编辑</span
align="center" >
:index="(index) => (current - 1) * size + index + 1" <span class="delete pointer" @click="handleDel(scope.row.id)"
> >删除</span
</el-table-column>
<el-table-column label="参数名称" align="center" prop="name">
</el-table-column>
<el-table-column label="一级组织" align="center" prop="firstOrganize">
</el-table-column>
<el-table-column label="二级组织" align="center" prop="secondOrganize">
</el-table-column>
<el-table-column label="参数键" align="center" prop="paramKey">
</el-table-column>
<el-table-column label="参数值" align="center" prop="paramValue">
</el-table-column>
<el-table-column label="参数有效状态" align="center" prop="validStatus">
<template slot-scope="scope">
<el-tag
size="small"
v-if="scope.row.validStatus == 1"
type="success"
>有效</el-tag
> >
<el-tag size="small" v-else type="info">禁用</el-tag> </div>
</template> </template>
</el-table-column> </y-table>
<el-table-column label="备注" align="center" prop="remark">
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<div class="flex jca">
<span class="primary pointer" @click="handleEdit(scope.row)"
>编辑</span
>
<span class="delete pointer" @click="handleDel(scope.row.id)"
>删除</span
>
</div>
</template>
</el-table-column>
</el-table>
</div> </div>
<Pagination <y-pagination
:total="total" :total="total"
:current="current" :page.sync="page"
:size="size" :pageSize.sync="size"
@currentChange="changePagination" @change="getParamList"
@sizeChange="changeSize" ></y-pagination>
></Pagination>
<!-- 新增参数 --> <!-- 新增参数 -->
<AddParameter <AddParameter
ref="AddParameter" ref="AddParameter"
...@@ -108,20 +73,18 @@ ...@@ -108,20 +73,18 @@
<script> <script>
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import Pagination from "@/components/Pagination.vue";
import AddParameter from "./modal/AddParameter.vue"; import AddParameter from "./modal/AddParameter.vue";
import { getParamList, delParam } from "@/api/system"; import { getParamList, delParam } from "@/api/system";
export default { export default {
components: { components: {
TableHeader, TableHeader,
AddParameter, AddParameter,
Pagination,
}, },
data() { data() {
return { return {
searchVal: "", searchVal: "",
tableData: [], tableData: [],
current: 1, page: 1,
size: 10, size: 10,
total: 10, total: 10,
loading: false, loading: false,
...@@ -129,6 +92,69 @@ export default { ...@@ -129,6 +92,69 @@ export default {
addVisible: false, addVisible: false,
title: "新增参数", title: "新增参数",
dict: {}, // 字典 dict: {}, // 字典
columns: [
{
label: "全选",
type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (this.page - 1) * this.size + index + 1;
},
},
{
label: "参数名称",
prop: "name",
align: "center",
},
{
label: "一级组织",
prop: "firstOrganize",
align: "center",
},
{
label: "二级组织",
prop: "secondOrganize",
align: "center",
},
{
label: "参数键",
prop: "secondOrganize",
align: "center",
},
{
label: "参数值",
prop: "paramKey",
align: "center",
},
{
label: "参数有效状态",
slot: true,
prop: "validStatus",
align: "center",
},
{
label: "备注",
prop: "remark",
align: "center",
},
{
label: "操作",
slot: true,
prop: "action",
align: "center",
width: "100",
},
],
}; };
}, },
created() { created() {
...@@ -140,20 +166,19 @@ export default { ...@@ -140,20 +166,19 @@ export default {
async getParamList() { async getParamList() {
this.loading = true; this.loading = true;
let res = await getParamList({ let res = await getParamList({
page: this.current, page: this.page,
size: this.size, size: this.size,
name: `%${this.searchVal}%`, name: `%${this.searchVal}%`,
}); });
if (res.data.code == 1) { if (res.data.code == 1) {
let { data, total, dict } = res.data.data; let { data, total, dict } = res.data.data;
this.dict = dict; this.dict = dict;
if (!data.length && this.current > 1) { if (!data.length && this.page > 1) {
this.current -= 1; this.page -= 1;
this.getParamList(); this.getParamList();
} }
this.tableData = data; this.tableData = data;
this.total = total; this.total = total;
this.$refs.multipleTable.bodyWrapper.scrollTop = 0;
} }
this.loading = false; this.loading = false;
}, },
...@@ -169,14 +194,14 @@ export default { ...@@ -169,14 +194,14 @@ export default {
}, },
// 搜索 // 搜索
handleSearch() { handleSearch() {
this.current = 1; this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getParamList(); this.getParamList();
}, },
// 重置 // 重置
handleReset() { handleReset() {
this.searchVal = ""; this.searchVal = "";
this.current = 1; this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getParamList(); this.getParamList();
}, },
...@@ -184,16 +209,7 @@ export default { ...@@ -184,16 +209,7 @@ export default {
handleSelectionChange(select) { handleSelectionChange(select) {
this.selectKeys = select; this.selectKeys = select;
}, },
// 翻页
changePagination(cur) {
this.current = cur;
this.getParamList();
},
// 改变没有显示数量
changeSize(size) {
this.size = size;
this.getParamList();
},
// 新增 // 新增
handleAdd() { handleAdd() {
this.title = "新增参数"; this.title = "新增参数";
...@@ -221,7 +237,6 @@ export default { ...@@ -221,7 +237,6 @@ export default {
this.$message.success(msg); this.$message.success(msg);
this.getParamList(); this.getParamList();
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.selectKeys = [];
} }
}) })
.catch(() => { .catch(() => {
......
...@@ -2,44 +2,43 @@ ...@@ -2,44 +2,43 @@
<div> <div>
<el-dialog <el-dialog
:title="title" :title="title"
:destroy-on-close="true"
:visible.sync="Visible" :visible.sync="Visible"
width="30%" width="30%"
@close="handleClose" @close="handleClose"
:close-on-click-modal="false" :close-on-click-modal="false"
top="10vh" top="10vh"
> >
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form
ref="form"
:model="form"
:rules="rules"
size="medium"
label-width="100px"
>
<el-form-item label="参数名称" prop="name"> <el-form-item label="参数名称" prop="name">
<el-input <el-input v-model="form.name" placeholder="请输入参数名称"></el-input>
size="small"
v-model="form.name"
placeholder="请输入参数名称"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="一级组织" prop="firstOrganize"> <el-form-item label="一级组织" prop="firstOrganize">
<el-input <el-input
size="small"
v-model="form.firstOrganize" v-model="form.firstOrganize"
placeholder="请输入一级组织" placeholder="请输入一级组织"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="二级组织" prop="secondOrganize"> <el-form-item label="二级组织" prop="secondOrganize">
<el-input <el-input
size="small"
v-model="form.secondOrganize" v-model="form.secondOrganize"
placeholder="请输入二级组织" placeholder="请输入二级组织"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="参数键" prop="paramKey"> <el-form-item label="参数键" prop="paramKey">
<el-input <el-input
size="small"
v-model="form.paramKey" v-model="form.paramKey"
placeholder="请输入参数键" placeholder="请输入参数键"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="参数值" prop="paramValue"> <el-form-item label="参数值" prop="paramValue">
<el-input <el-input
size="small"
v-model="form.paramValue" v-model="form.paramValue"
placeholder="请输入参数值" placeholder="请输入参数值"
></el-input> ></el-input>
...@@ -88,8 +87,8 @@ ...@@ -88,8 +87,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleRest">重 置</el-button> <el-button size="medium" @click="handleRest">重 置</el-button>
<el-button size="small" type="primary" @click="handleOk" <el-button size="medium" type="primary" @click="handleOk"
>确 定</el-button >确 定</el-button
> >
</span> </span>
......
...@@ -18,74 +18,103 @@ ...@@ -18,74 +18,103 @@
</TableHeader> </TableHeader>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<el-table <y-table
ref="multipleTable" :max-height="650"
size="small"
v-loading="loading"
:data="tableData" :data="tableData"
:column="columns"
border border
tooltip-effect="dark" :loading="loading"
style="width: 100%" ref="multipleTable"
:row-key="(row) => row.id"
> >
<el-table-column <template slot="operType" slot-scope="scope">
type="index" <span v-if="scope.row.operType == 0">新增</span>
label="序号" <span v-else-if="scope.row.operType == 1">修改</span>
width="55" <span v-else-if="scope.row.operType == 2">删除</span>
align="center" </template>
:index="(index) => (current - 1) * size + index + 1" </y-table>
>
</el-table-column>
<el-table-column label="用户名称" align="center" prop="userName">
</el-table-column>
<el-table-column label="登录名称" align="center" prop="loginName">
</el-table-column>
<el-table-column label="请求地址" align="center" prop="requestUrl">
</el-table-column>
<el-table-column label="操作内容" align="center" prop="content">
</el-table-column>
<el-table-column label="操作IP地址" align="center" prop="ip">
</el-table-column>
<el-table-column label="操作类型" align="center" prop="operType">
<template slot-scope="scope">
<span v-if="scope.row.operType == 0">新增</span>
<span v-else-if="scope.row.operType == 1">修改</span>
<span v-else-if="scope.row.operType == 2">删除</span>
</template>
</el-table-column>
<el-table-column label="操作时间" align="center" prop="logDate">
</el-table-column>
</el-table>
</div> </div>
<Pagination <y-pagination
:total="total" :total="total"
:current="current" :page.sync="page"
:size="size" :pageSize.sync="size"
@currentChange="changePagination" @change="getlogsList"
@sizeChange="changeSize" ></y-pagination>
></Pagination>
</div> </div>
</template> </template>
<script> <script>
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import Pagination from "@/components/Pagination.vue";
import { getlogsList } from "@/api/system"; import { getlogsList } from "@/api/system";
export default { export default {
components: { components: {
TableHeader, TableHeader,
Pagination,
}, },
data() { data() {
return { return {
searchVal: "", searchVal: "",
tableData: [], tableData: [],
current: 1, page: 1,
size: 10, size: 10,
total: 10, total: 10,
loading: false, loading: false,
selectKeys: [], selectKeys: [],
dict: {}, // 字典 dict: {}, // 字典
columns: [
{
label: "全选",
type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (this.page - 1) * this.size + index + 1;
},
},
{
label: "用户名称",
prop: "userName",
align: "center",
},
{
label: "登录名称",
prop: "loginName",
align: "center",
},
{
label: "请求地址",
prop: "requestUrl",
align: "center",
},
{
label: "操作内容",
slot: true,
prop: "content",
align: "center",
},
{
label: "操作IP地址",
prop: "ip",
align: "center",
},
{
label: "操作类型",
slot: true,
prop: "operType",
align: "center",
},
{
label: "操作时间",
prop: "logDate",
align: "center",
},
],
}; };
}, },
created() { created() {
...@@ -97,48 +126,36 @@ export default { ...@@ -97,48 +126,36 @@ export default {
async getlogsList() { async getlogsList() {
this.loading = true; this.loading = true;
let res = await getlogsList({ let res = await getlogsList({
page: this.current, page: this.page,
size: this.size, size: this.size,
requestUrl: `%${this.searchVal}%`, requestUrl: `%${this.searchVal}%`,
}); });
if (res.data.code == 1) { if (res.data.code == 1) {
let { data, total, dict } = res.data.data; let { data, total, dict } = res.data.data;
this.dict = dict; this.dict = dict;
if (!data.length && this.current > 1) { if (!data.length && this.page > 1) {
this.current -= 1; this.page -= 1;
this.getlogsList(); this.getlogsList();
} }
this.tableData = data; this.tableData = data;
this.total = total; this.total = total;
this.$refs.multipleTable.bodyWrapper.scrollTop = 0;
} }
this.loading = false; this.loading = false;
}, },
// 搜索 // 搜索
handleSearch() { handleSearch() {
this.current = 1; this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getlogsList(); this.getlogsList();
}, },
// 重置 // 重置
handleReset() { handleReset() {
this.searchVal = ""; this.searchVal = "";
this.current = 1; this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getlogsList(); this.getlogsList();
}, },
// 翻页
changePagination(cur) {
this.current = cur;
this.getlogsList();
},
// 改变没有显示数量
changeSize(size) {
this.size = size;
this.getlogsList();
},
}, },
}; };
</script> </script>
......
...@@ -26,85 +26,45 @@ ...@@ -26,85 +26,45 @@
</TableHeader> </TableHeader>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<el-table <y-table
ref="multipleTable" :max-height="650"
v-loading="loading"
:data="tableData" :data="tableData"
:column="columns"
border border
tooltip-effect="dark" :loading="loading"
style="width: 100%"
:row-key="(row) => row.id"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
ref="multipleTable"
> >
<el-table-column <template slot="excuteStrategy" slot-scope="scope">
reserve-selection <el-tag size="small" type="info">{{
type="selection" dict.excuteStrategy[scope.row.excuteStrategy]
width="55" }}</el-tag>
align="center" </template>
>
</el-table-column> <template slot="status" slot-scope="scope">
<el-table-column <el-tag size="small" type="info">{{
type="index" dict.status[scope.row.status]
label="序号" }}</el-tag>
width="55" </template>
align="center"
:index="(index) => (current - 1) * size + index + 1" <template slot="action" slot-scope="scope">
> <div class="flex jca">
</el-table-column> <span class="primary pointer" @click="handleEdit(scope.row)"
<el-table-column label="任务名称" align="center" prop="name"> >编辑</span
</el-table-column> >
<el-table-column label="执行主机" align="center" prop="excuteHost"> <span class="delete pointer" @click="handleDel(scope.row.id)"
</el-table-column> >删除</span
<el-table-column label="执行关键字" align="center" prop="taskKey"> >
</el-table-column> </div>
<el-table-column label="执行策略" align="center" prop="excuteStrategy"> </template>
<template slot-scope="scope"> </y-table>
<el-tag type="info">{{
filterItems(scope.row.excuteStrategy, dict.excuteStrategy)
}}</el-tag>
</template>
</el-table-column>
<el-table-column
label="最后执行主机"
align="center"
prop="lastExcuteHost"
>
</el-table-column>
<el-table-column
label="最后执行时间"
align="center"
prop="lastExcuteTime"
>
</el-table-column>
<el-table-column label="任务状态" align="center" prop="status">
<template slot-scope="scope">
<!-- <el-tag v-if="scope.row.status == 1" type="success">执行中</el-tag> -->
<el-tag size="small" type="info">{{
filterItems(scope.row.status, dict.status)
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<div class="flex jca">
<span class="primary pointer" @click="handleEdit(scope.row)"
>编辑</span
>
<span class="delete pointer" @click="handleDel(scope.row.id)"
>删除</span
>
</div>
</template>
</el-table-column>
</el-table>
</div> </div>
<Pagination <y-pagination
:total="total" :total="total"
:current="current" :page="page"
:size="size" :pageSize="size"
@currentChange="changePagination" @change="getTaskList"
@sizeChange="changeSize" ></y-pagination>
></Pagination>
<!-- 新增参数 --> <!-- 新增参数 -->
<AddTask <AddTask
ref="AddTask" ref="AddTask"
...@@ -118,20 +78,18 @@ ...@@ -118,20 +78,18 @@
<script> <script>
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import Pagination from "@/components/Pagination.vue";
import AddTask from "./modal/AddTask.vue"; import AddTask from "./modal/AddTask.vue";
import { getTaskList, delTask } from "@/api/system"; import { getTaskList, delTask } from "@/api/system";
export default { export default {
components: { components: {
TableHeader, TableHeader,
AddTask, AddTask,
Pagination,
}, },
data() { data() {
return { return {
searchVal: "", searchVal: "",
tableData: [], tableData: [],
current: 1, page: 1,
size: 10, size: 10,
total: 10, total: 10,
loading: false, loading: false,
...@@ -139,6 +97,71 @@ export default { ...@@ -139,6 +97,71 @@ export default {
addVisible: false, addVisible: false,
title: "新增参数", title: "新增参数",
dict: {}, // 字典 dict: {}, // 字典
columns: [
{
label: "全选",
type: "selection",
width: "55",
align: "center",
reserveSelection: true,
},
{
label: "序号",
type: "index",
width: "55",
align: "center",
index: (index) => {
return (this.page - 1) * this.size + index + 1;
},
},
{
label: "任务名称",
prop: "name",
align: "center",
},
{
label: "执行主机",
prop: "excuteHost",
align: "center",
},
{
label: "执行关键字",
prop: "taskKey",
align: "center",
},
{
label: "执行策略",
slot: true,
prop: "excuteStrategy",
align: "center",
},
{
label: "最后执行主机",
prop: "lastExcuteHost",
align: "center",
},
{
label: "最后执行时间",
prop: "lastExcuteTime",
align: "center",
},
{
label: "任务状态",
slot: true,
prop: "status",
align: "center",
},
{
label: "操作",
slot: true,
prop: "action",
align: "center",
width: "100",
},
],
}; };
}, },
created() { created() {
...@@ -150,20 +173,19 @@ export default { ...@@ -150,20 +173,19 @@ export default {
async getTaskList() { async getTaskList() {
this.loading = true; this.loading = true;
let res = await getTaskList({ let res = await getTaskList({
page: this.current, page: this.page,
size: this.size, size: this.size,
name: `%${this.searchVal}%`, name: `%${this.searchVal}%`,
}); });
if (res.data.code == 1) { if (res.data.code == 1) {
let { data, total, dict } = res.data.data; let { data, total, dict } = res.data.data;
this.dict = dict; this.dict = dict;
if (!data.length && this.current > 1) { if (!data.length && this.page > 1) {
this.current -= 1; this.page -= 1;
this.getTaskList(); this.getTaskList();
} }
this.tableData = data; this.tableData = data;
this.total = total; this.total = total;
this.$refs.multipleTable.bodyWrapper.scrollTop = 0;
} }
this.loading = false; this.loading = false;
}, },
...@@ -179,14 +201,14 @@ export default { ...@@ -179,14 +201,14 @@ export default {
}, },
// 搜索 // 搜索
handleSearch() { handleSearch() {
this.current = 1; this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getTaskList(); this.getTaskList();
}, },
// 重置 // 重置
handleReset() { handleReset() {
this.searchVal = ""; this.searchVal = "";
this.current = 1; this.page = 1;
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.getTaskList(); this.getTaskList();
}, },
...@@ -194,16 +216,7 @@ export default { ...@@ -194,16 +216,7 @@ export default {
handleSelectionChange(select) { handleSelectionChange(select) {
this.selectKeys = select; this.selectKeys = select;
}, },
// 翻页
changePagination(cur) {
this.current = cur;
this.getTaskList();
},
// 改变没有显示数量
changeSize(size) {
this.size = size;
this.getTaskList();
},
// 新增 // 新增
handleAdd() { handleAdd() {
this.title = "新增任务"; this.title = "新增任务";
...@@ -231,23 +244,12 @@ export default { ...@@ -231,23 +244,12 @@ export default {
this.$message.success(msg); this.$message.success(msg);
this.getTaskList(); this.getTaskList();
this.$refs.multipleTable.clearSelection(); this.$refs.multipleTable.clearSelection();
this.selectKeys = [];
} }
}) })
.catch(() => { .catch(() => {
console.log("取消成功!"); console.log("取消成功!");
}); });
}, },
// 过滤表格数据
filterItems(key, dict = {}) {
let val = "";
Object.keys(dict).forEach((keys) => {
if (key == keys) {
val = dict[keys];
}
});
return val;
},
}, },
}; };
</script> </script>
......
...@@ -2,30 +2,31 @@ ...@@ -2,30 +2,31 @@
<div> <div>
<el-dialog <el-dialog
:title="title" :title="title"
:destroy-on-close="true"
:visible.sync="Visible" :visible.sync="Visible"
width="30%" width="30%"
@close="handleClose" @close="handleClose"
:close-on-click-modal="false" :close-on-click-modal="false"
top="10vh" top="10vh"
> >
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form
ref="form"
:model="form"
:rules="rules"
size="medium"
label-width="100px"
>
<el-form-item label="任务名称" prop="name"> <el-form-item label="任务名称" prop="name">
<el-input <el-input v-model="form.name" placeholder="请输入任务名称"></el-input>
size="small"
v-model="form.name"
placeholder="请输入任务名称"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="关键字" prop="taskKey"> <el-form-item label="关键字" prop="taskKey">
<el-input <el-input
size="small"
v-model="form.taskKey" v-model="form.taskKey"
placeholder="请输入关键字" placeholder="请输入关键字"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="执行服务" prop="excuteService"> <el-form-item label="执行服务" prop="excuteService">
<el-input <el-input
size="small"
v-model="form.excuteService" v-model="form.excuteService"
placeholder="请输入执行服务" placeholder="请输入执行服务"
></el-input> ></el-input>
...@@ -53,7 +54,6 @@ ...@@ -53,7 +54,6 @@
<el-input <el-input
disabled disabled
v-if="form.excuteStrategy == 1" v-if="form.excuteStrategy == 1"
size="small"
value="每日" value="每日"
placeholder="请输入参数值" placeholder="请输入参数值"
></el-input> ></el-input>
...@@ -100,14 +100,12 @@ ...@@ -100,14 +100,12 @@
</el-form-item> </el-form-item>
<el-form-item label="执行主机" prop="excuteHost"> <el-form-item label="执行主机" prop="excuteHost">
<el-input <el-input
size="small"
v-model="form.excuteHost" v-model="form.excuteHost"
placeholder="请输入执行主机" placeholder="请输入执行主机"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="执行参数" prop="excuteParam"> <el-form-item label="执行参数" prop="excuteParam">
<el-input <el-input
size="small"
v-model="form.excuteParam" v-model="form.excuteParam"
placeholder="请输入执行参数" placeholder="请输入执行参数"
></el-input> ></el-input>
...@@ -123,8 +121,8 @@ ...@@ -123,8 +121,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="handleRest">重 置</el-button> <el-button size="medium" @click="handleRest">重 置</el-button>
<el-button size="small" type="primary" @click="handleOk" <el-button size="medium" type="primary" @click="handleOk"
>确 定</el-button >确 定</el-button
> >
</span> </span>
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
* axios 工具函数层 * axios 工具函数层
*/ */
import axios from "axios"; import axios from "axios";
import { Message } from "element-ui"; import { responseErr, loginErr } from "@/config";
import { message } from "@/utils/resetMessage";
// import local from "@/utils/local"; // import local from "@/utils/local";
import store from "@/store"; import store from "@/store";
// import router from "@/router" // import router from "@/router";
// 请求超时时间 // 请求超时时间
// axios.defaults.timeout = 10 * 1000; axios.defaults.timeout = 60 * 1000;
// 设置统一服务器地址 // 设置统一服务器地址
axios.defaults.baseURL = process.env.VUE_APP_API_BASE_URL; axios.defaults.baseURL = process.env.VUE_APP_API_BASE_URL;
...@@ -33,14 +34,15 @@ axios.interceptors.response.use( ...@@ -33,14 +34,15 @@ axios.interceptors.response.use(
// 取出数据 // 取出数据
let { code, msg } = response.data; let { code, msg } = response.data;
if (code === -1) { if (code === -1) {
Message.error({ message.error({
message: msg, message: msg,
}); });
} else if (code === 401) { } else if (loginErr.includes(code)) {
Message.error({ message.error({
message: msg, message: msg,
}); });
setTimeout(() => { setTimeout(() => {
// router.push("/login");
store.commit("SET_token", ""); store.commit("SET_token", "");
location.href = process.env.VUE_APP_API_portal_URL; location.href = process.env.VUE_APP_API_portal_URL;
}, 2000); }, 2000);
...@@ -48,13 +50,22 @@ axios.interceptors.response.use( ...@@ -48,13 +50,22 @@ axios.interceptors.response.use(
} }
return response; return response;
}, },
(err) => { (error) => {
// if (err.message.includes("timeout")) { if (error && error.response) {
// Message.error({ let msg = responseErr[error.response.status];
// message: "请求超时,请稍后再试", error.message = msg || `连接错误${error.response.status}`;
// }); } else {
// } if (JSON.stringify(error).includes("timeout")) {
return Promise.reject(err); error.message = "服务器响应超时,请刷新当前页";
} else {
error.message = "连接服务器失败";
}
}
message.error({
message: error.message,
});
return Promise.resolve(error.response);
} }
); );
......
...@@ -9,4 +9,18 @@ module.exports = defineConfig({ ...@@ -9,4 +9,18 @@ module.exports = defineConfig({
// 打包输出目录 // 打包输出目录
outputDir: "dist", outputDir: "dist",
publicPath: "./", publicPath: "./",
devServer: {
proxy: {
"/sampleform": {
target: process.env.VUE_APP_API_BASE_URL,
changeOrigin: true,
secure: false,
cookieDomainRewrite: "localhost",
},
"/file": {
target: process.env.VUE_APP_API_BASE_URL,
changeOrigin: true,
},
},
},
}); });
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