<template>
|
<div class="image_data_list_main">
|
<SearchCondition
|
:info="info"
|
ref="condRef"
|
:conForm="conForm"
|
:buttonsList="[1, 2, 3]"
|
:isShowDetail="isShowDetail"
|
:screenWidth="screenWidth"
|
@handleOnSeach="handleOnSeach"
|
@handleOnRest="handleOnRest"
|
@handleClick="isShowDetail = !isShowDetail"
|
/>
|
<div />
|
<el-row class="add-button">
|
<el-col :span="24">
|
<el-button
|
type="primary"
|
size="small"
|
icon="el-icon-circle-plus-outline"
|
@click="handleAddPage"
|
class="add-btn"
|
>新增</el-button
|
>
|
</el-col>
|
</el-row>
|
<ProTable
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
:isAutoIndex="true"
|
:list="records"
|
:header="tableHeader"
|
:loading="loading"
|
/>
|
<el-dialog
|
title="上传图片"
|
:visible.sync="dialogVisible"
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
:destroy-on-close="true"
|
:show-close="false"
|
width="450"
|
center
|
custom-class="upload_dialog"
|
>
|
<template slot="footer" class="dialog-footer">
|
<el-button @click="handleDialogCancel">取 消</el-button>
|
<el-button type="primary" @click="saveImageData">确 定</el-button>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {
|
IMAGEDATATYPEMANAGECOND,
|
IMAGEDATATYPEMANAGEDEF
|
} from "../config/condtion.config";
|
import { IMAGEDATATYPEMANAGECOLUMN } from "../config/column.config";
|
import ProTable from "../../components/ProTable";
|
import SearchCondition from "../../components/SearchCondition";
|
import {
|
qryDropDownOption,
|
addOrUpdateImageConfig,
|
delImageConfig,
|
qryImageConfigInfo,
|
qryImageConfigList
|
} from "@/http/api";
|
export default {
|
data() {
|
return {
|
info: [...IMAGEDATATYPEMANAGECOND],
|
restFormItems: [...IMAGEDATATYPEMANAGECOND],
|
tableHeader: [...IMAGEDATATYPEMANAGECOLUMN],
|
conForm: { ...IMAGEDATATYPEMANAGEDEF },
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0
|
},
|
fileInfo: {
|
required: false,
|
description: "",
|
count: 0,
|
images: [],
|
key: "signetInfo"
|
},
|
records: [],
|
newTypeno: "",
|
itemNo: "", //列表对应的签章编号
|
screenWidth: document.body.offsetWidth,
|
condtionValue: {}, // 表单value集合
|
isShowBorder: true,
|
isShowDetail: false, // 是否显示所有表单项
|
isView: false,
|
loading: false,
|
btnLoading: false,
|
dialogVisible: false
|
};
|
},
|
components: {
|
SearchCondition,
|
ProTable
|
},
|
async created() {
|
await this.getDictionaryList("isinuse", "IsInUse");
|
},
|
async mounted() {
|
window.addEventListener("resize", this.getScreenWidth);
|
await this.getImageConfigList();
|
},
|
destroyed() {
|
window.removeEventListener("resize", this.getScreenWidth);
|
},
|
methods: {
|
/**
|
* 获取下拉选择项
|
*/
|
async getDictionaryList(name, conditionName) {
|
const params = { conditionName };
|
const re = await qryDropDownOption(params);
|
if (re.code && re.code === "00") {
|
this.setFormInfo(name, { options: re.result });
|
}
|
},
|
// 更新表单数据
|
setFormInfo(nameKey, newInfo) {
|
const { info } = this;
|
const index = info.findIndex(({ name }) => name === nameKey);
|
this.$set(this.info, index, { ...info[index], ...newInfo });
|
},
|
getScreenWidth() {
|
this.$set(this, "screenWidth", document.body.offsetWidth);
|
},
|
// 获取列表
|
async getImageConfigList() {
|
const { currentPage, pageSize } = this.pageInfo;
|
const { docname, docno, isinuse } = this.condtionValue;
|
const loading = this.$loading({
|
lock: true,
|
text: "",
|
background: "hsla(0,0%,100%,.9)"
|
});
|
setTimeout(() => {
|
loading.close();
|
}, 1500);
|
const params = {
|
currentPage,
|
docname,
|
docno,
|
isinuse,
|
pageSize
|
};
|
const listRes = await qryImageConfigList(params);
|
loading.close();
|
if (listRes.code && listRes.code === "00") {
|
const newList =
|
listRes.result &&
|
listRes.result.records.map(item => {
|
const newItem = { ...item };
|
newItem.operationOption = [
|
{ label: "修改", type: "EDIT", value: true },
|
{ label: "详情", type: "DETAIL", value: true },
|
{ label: "删除", type: "DELETE", value: true }
|
];
|
return newItem;
|
});
|
this.$set(this, "records", newList);
|
this.$set(
|
this.pageInfo,
|
"total",
|
listRes.result && listRes.result.total
|
);
|
}
|
},
|
// 获取信息
|
async getImageConfigInfo() {
|
const params = {
|
itemno: this.itemNo
|
};
|
const imageSataInfoRes = await qryImageConfigInfo(params);
|
if (!imageSataInfoRes || imageSataInfoRes.code !== "00") {
|
return false;
|
}
|
},
|
// 搜索列表
|
handleOnSeach() {
|
const conRef = this.$refs.condRef;
|
this.$set(this, "condtionValue", conRef.$refs["conform"].model);
|
this.$set(this, "pageInfo", { currentPage: 1, pageSize: 10, total: 0 });
|
this.getImageConfigList();
|
},
|
|
// 获取筛选条件value
|
setValueInfo(condtions) {
|
this.$set(this, "condtionValue", condtions);
|
},
|
|
// 重置
|
handleOnRest() {
|
this.$set(this, "condtionValue", {});
|
// this.$set(this, 'pageInfo', { currentPage: 1, pageSize: 10, total: 0 })
|
},
|
// 表单事件回调
|
async doAction(name, item, { type }) {
|
if (type === "upload") {
|
this.itemNo = item.itemno;
|
await this.SignatureImageInfo();
|
this.dialogVisible = true;
|
}
|
},
|
handleDialogCancel() {
|
this.fileInfo.images = [];
|
this.getImageConfigList();
|
this.dialogVisible = false;
|
},
|
saveImageData() {},
|
// 删除文件
|
async handleDelete() {
|
this.fileInfo.images = [];
|
},
|
// 新增
|
handleAddPage() {},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.getImageConfigList();
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.getImageConfigList();
|
}
|
}
|
};
|
</script>
|
|
<style lang="less">
|
.image_data_list_main {
|
padding: 16px 0px 0 20px;
|
& .upload_dialog {
|
width: 350px;
|
& .is-always-shadow {
|
box-shadow: none;
|
}
|
& .images {
|
text-align: center;
|
& .imagesList {
|
position: relative;
|
& .el-icon-error {
|
position: absolute;
|
right: 0;
|
top: -2px;
|
}
|
}
|
& img {
|
max-height: 151px;
|
width: 242px;
|
}
|
}
|
& .el-button--default {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
border-radius: 4px;
|
border: 1px solid rgba(204, 204, 204, 1);
|
}
|
& .el-button--primary {
|
width: 120px;
|
height: 30px;
|
line-height: 7px;
|
background: #0081f0;
|
border-color: #0081f0;
|
border-radius: 4px;
|
margin-left: 40px;
|
}
|
}
|
& .add-button {
|
padding: 2px 0 30px 0;
|
}
|
}
|
</style>
|