xy 2 years ago
parent b13b8616d6
commit 077627b8f9

@ -23,6 +23,7 @@
"echarts": "^4.2.1",
"element-ui": "2.15.13",
"file-saver": "^2.0.5",
"html2canvas": "^1.4.1",
"js-cookie": "2.2.0",
"less-loader": "^5.0.0",
"moment": "^2.29.2",

@ -1,26 +1,33 @@
import request from '@/utils/request'
export function getCounts() {
return request({
url: '/api/admin/get-counts',
method: 'get'
})
}
export function getChartsData(params) {
return request({
url: '/api/admin/get-charts-data',
method: 'get',
params: params
})
import request from '@/utils/request'
export function getCounts() {
return request({
url: '/api/admin/get-counts',
method: 'get'
})
}
export function getChartsHome(params) {
return request({
url: '/api/admin/chart/home',
method: 'get',
params: params
})
export function getChartsData(params) {
return request({
url: '/api/admin/get-charts-data',
method: 'get',
params: params
})
}
export function getChartsHome(params) {
return request({
url: '/api/admin/chart/home',
method: 'get',
params: params
})
}
export function getNotice () {
return request({
method: 'get',
url: '/api/admin/other/notice',
isLoading: false
})
}

@ -123,7 +123,7 @@ export class CreateDialog {
class: "el-upload__tip",
slot: "tip",
},
"文件不超过500kb"
"文件不超过50Mb"
),
];
}

@ -93,7 +93,7 @@ export default {
res[i._relations.link_with_name] instanceof Array
? res[i._relations.link_with_name].map((i) => {
return {
name: i?.name,
name: i?.original_name,
url: i?.url,
response: i,
};
@ -134,6 +134,7 @@ export default {
});
}
let promiseAll = []
let copyForm = deepCopy(this.form);
this.formInfo.forEach((info) => {
if (
info._relations?.link_relation === "newHasMany" ||
@ -151,31 +152,87 @@ export default {
}
}
if (copyForm[info._relations?.link_with_name]?.length > 0) {
delete copyForm[info.field];
}
if (
info._relations?.link_relation === "newHasMany" ||
info._relations?.link_relation === "hasMany"
) {
if (info.edit_input === "files") {
this.form[info._relations.link_with_name] = this.file[
copyForm[info._relations.link_with_name] = this.file[
info.field
]?.map((i) => {
let copyRelation = i?.response ? deepCopy(i?.response) : "";
//TODO:
if (/:\/\/:\/\//g.test(copyRelation?.url)) {
copyRelation.url.replace(/:\/\/:\/\//g,'://')
}
delete copyRelation.id;
return {
file_id: i?.response?.id,
upload_id: i?.response?.id,
...copyRelation,
};
});
} else {
copyForm[info._relations.link_with_name] = copyForm[
info.field
]?.map((i) => {
let copyRelation = info._params.find(
(param) => param[info._relations?.foreign_key] === i
)
? deepCopy(
info._params.find(
(param) => param[info._relations?.foreign_key] === i
)
)
: "";
delete copyRelation.id;
return {
[info._relations.foreign_key]: i,
...copyRelation,
};
});
}
delete copyForm[info.field];
}
})
if (
info._relations?.link_relation === "newHasOne" ||
info._relations?.link_relation === "hasOne"
) {
if (info.edit_input === "file") {
copyForm[info._relations.link_with_name] = [
{
upload_id: this.file[info.field]?.response?.id,
...this.file[info.field],
},
];
} else {
let copyRelation = deepCopy(
info._params.find(
(param) => param.id == this.form[info.field]
)
);
if (copyRelation) {
delete copyRelation.id;
copyForm[info._relations.link_with_name] = [
{
id: this.form[info._relations?.link_with_name]?.id,
[info.field === "shenhebumen"
? "dept_id"
: info._relations.foreign_key]: this.form[info.field],
...copyRelation,
},
];
}
}
delete copyForm[info.field];
}
if (!copyForm[info._relations?.link_with_name]) {
delete copyForm[info._relations?.link_with_name];
}
});
delete this.form['tupian']
save(Object.assign(this.form, { table_name: 'leases' })).then(res => {
save(Object.assign(copyForm, { table_name: 'leases' })).then(res => {
this.$Message.success({
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
});

@ -1,45 +1,66 @@
<template>
<div>
<Modal
<Drawer
ref="dialog"
width="600px"
placement="right"
v-model="isShow"
title="附件"
:footer-hide="true"
>
<el-upload
style="width: 400px"
ref="upload"
multiple
:on-success="successHandle"
:before-upload="uploadBefore"
:before-remove="beforeRemove"
accept=".jpg,.jpeg,.png,.gif,.PDF,.pdf, .doc, .docx, .xls, .xlsx"
:action="action"
:file-list="fileList"
:on-remove="removeHande"
:limit="100"
:headers="{
Authorization: `Bearer ${getToken()}`,
}"
>
<template #file="{ file }">
<div style="display: flex;align-items: center;">
<i :style="{ 'color': file.status === 'success' ? 'green' : '' }" :class="{ 'el-icon-circle-check': file.status === 'success','el-icon-loading': file.status === 'uploading' }"></i>
<a href="javascript:" style="flex: 1;margin-left: 6px;" @click="openDownload(file)">{{ file.name }}</a>
<i class="el-icon-close" @click="deleteFile(file)"></i>
</div>
</template>
<el-button slot="trigger" size="small" type="primary"
>选取文件
</el-button
>
<div slot="tip" class="el-upload__tip">
<br/>单个文件不能超过50M
</div>
</el-upload>
<div style="display: flex;align-items: center;">
<el-select size="small" collapse-tags style="width: 200px;" filterable allow-create clearable v-model="filterTag" placeholder="标签" multiple>
<el-option v-for="item in ['工程类','资产类']" :value="item" :label="item">
</el-option>
</el-select>
<Button type="primary" style="margin-left: 10px;" @click="isShowModal = true">新增</Button>
</div>
<Table :data="fileList" :columns="table">
<Table stripe style="margin-top: 20px;" size="small" :data="fileData" :columns="table">
</Table>
</Drawer>
<Modal title="新增附件" width="580px" v-model="isShowModal" @on-ok="submit">
<el-form size="small" label-width="100px">
<el-form-item label="年份选择">
<el-date-picker v-model="form.year" value-format="yyyy" style="width: 300px;" placeholder="年份选择" type="year"></el-date-picker>
</el-form-item>
<el-form-item label="年限信息">
<el-input v-model="form.nianxian" style="width: 300px;" placeholder="年限信息"></el-input>
</el-form-item>
<el-form-item label="标签">
<el-select style="width: 300px;" filterable allow-create clearable v-model="form.tag" placeholder="标签">
<el-option v-for="item in ['工程类','资产类']" :value="item" :label="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="附件">
<el-upload
style="width: 400px"
ref="upload"
multiple
:on-success="successHandle"
:before-upload="uploadBefore"
:before-remove="beforeRemove"
accept=".jpg,.jpeg,.png,.gif,.PDF,.pdf, .doc, .docx, .xls, .xlsx"
:action="action"
:file-list="fileList"
:on-remove="removeHande"
:limit="100"
:headers="{
Authorization: `Bearer ${getToken()}`,
}"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件
</el-button
>
<div slot="tip" class="el-upload__tip">
<br/>单个文件不能超过50M
</div>
</el-upload>
</el-form-item>
</el-form>
</Modal>
</div>
</template>
@ -52,25 +73,45 @@ export default {
props: {},
data() {
return {
filterTag: [],
isShowModal: false,
table: [
{
key: 'original_name',
title: '文件名称',
render: (h, { row }) => (h('span',row.response?.original_name))
width: 180,
render: (h, { row }) => (h('div',[
h('a',{ class: 'original-name-a', on: { click: () => this.openDownload(row) } },row.response?.original_name)
]))
},
{
key: 'tag',
title: "标签"
title: "标签",
align: 'center',
render: (h, { row }) => (h('Tag',{
props: {
color: 'primary'
}
},row.response?.tag))
},
{
key: 'year',
title: '年份',
align: 'center',
render: (h, { row }) => (h('span',row.response?.year))
},
{
key: 'year',
key: 'nianxian',
title: '年限',
align: 'center',
render: (h, { row }) => (h('span',row.response?.nianxian))
},
{
key: 'btns',
title: '操作',
render: (h,{ row }) => (h('div',[
h('Button',{ props: { type: 'error',size: 'small' },on: { click: ()=>this.deleteFile(row) } },'删除')
]))
}
],
isShow: false,
@ -78,9 +119,12 @@ export default {
type: '',
action: process.env.VUE_APP_UPLOAD_API,
fileList: [],
lists: [],
form: {
file: []
year: '',
tag: '',
nianxian: '',
},
rules: {
name: [
@ -114,7 +158,9 @@ export default {
},
init() {
this.form = {
file: []
year: '',
tag: '',
nianxian: '',
}
},
setId(id) {
@ -152,8 +198,6 @@ export default {
//
successHandle(response, file, fileList) {
this.fileList = fileList
this.submit(response)
},
removeHande(file, fileList) {
this.fileList = fileList
@ -190,47 +234,49 @@ export default {
}
]
})
this.fileList = res.data.map((item) => {
this.lists = res.data.map((item) => {
return {
name: item.original_name,
url: item.url,
response: item
}
})
this.$integrateData(this.form, res)
console.log(this.fileList)
},
submit(response) {
submit() {
save({
table_name: 'asset_file_files',
file_id: response.id,
file_id: this.fileList[0]?.response?.id,
[/\/land/g.test(this.$route.path) ? 'land_id' : 'house_id']: this.id,
name: response.name,
original_name: response.original_name,
name: this.fileList[0]?.response?.name,
original_name: this.fileList[0]?.response?.original_name,
//TODO:
url: response.url.replace(/:\/\/:\/\//g, '://')
url: this.fileList[0]?.response?.url.replace(/:\/\/:\/\//g, '://'),
...this.form
}).then(res => {
this.$message({
type: 'success',
message: '附件上传成功'
})
this.getDetail()
this.isShowModal = false
this.init()
})
},
openDownload (file) {
window.open(file.url)
openDownload (row) {
window.open(row.url)
},
deleteFile (file) {
deleteFile (row) {
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(res => {
if (file.response?.id) {
if (row.response?.id) {
destroy({
table_name: "asset_file_files",
id: file.response.id
id: row.response.id
}).then(res => {
this.$message({
type: 'success',
@ -242,6 +288,12 @@ export default {
})
}
},
computed: {
fileData () {
if (this.filterTag.length === 0) return this.lists;
return this.lists.filter(i => (this.filterTag.find(j => j === i.response?.tag)))
}
},
watch: {
isShow(val) {
if (val) {
@ -308,4 +360,17 @@ export default {
::v-deep .el-input__inner {
text-align: left;
}
</style>
<style>
.original-name-a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
.original-name-a:hover {
color: red;
text-decoration: underline;
}
</style>

@ -89,6 +89,20 @@ export default {
label: '用途',
prop: 'yongtu',
width: 160
},
{
label: "附件",
prop: 'file',
minWidth: 180,
customFn:row => {
return (
<div>
{
row.id_lease_file_files_lease_id_relation.map(i => (<a class="original-name-a" on={{click:()=>(window.open(i.url))}}>{i.original_name}</a>))
}
</div>
)
}
}
],
};

@ -15,7 +15,7 @@
</el-page-header>
<el-row :gutter="24">
<el-col :span="21">
<el-col :span="21" class="print-content">
<el-card
id="detail-pictures"
v-if="
@ -255,10 +255,16 @@
></iframe>
</template>
</Modal>
<div style="position:fixed;right: 40px;bottom: 80px;background: #fff;border-radius: 100%;width: 40px;height: 40px;display: flex;align-items: center;justify-content: center;font-size: 20px;cursor: pointer;" @click="print">
<Icon type="md-print" />
</div>
</div>
</template>
<script>
import html2canvas from "html2canvas";
import { show, index } from "@/api/system/baseForm";
import { show as formShow } from "@/api/system/customForm";
import { getparameter } from "@/api/system/dictionary";
@ -507,6 +513,32 @@ export default {
]
})
this.histories = res.data;
},
print () {
const iframeEL=document.querySelector('.print-iframe');
if(iframeEL){
iframeEL.remove();
}
const dom = document.querySelector('.print-content')
html2canvas(dom,{
useCORS: true
}).then(canvas => {
const img = new Image();
img.src = canvas.toDataURL('image/png');
img.style.width='100%'
// iframe
const iframe = document.createElement('iframe');
iframe.style.width='100%'
iframe.classList.add('print-iframe')
document.body.appendChild(iframe)
const doc = iframe.contentWindow.document
doc.body.appendChild(img);
//
setTimeout(()=>{
iframe.contentWindow.print();
},100)
})
}
},

@ -44,6 +44,17 @@ export default {
created_at: '发布时间',
'system_catalogue_id_system_catalogues_id_relation.name': '目录',
'id_system_file_files_system_id_relation': '附件'
},
t3: {
dikuaimingcheng: "地块名称",
chengzufang: "承租方",
chuzufang: "出租方",
hetongjiaozukaishishijian: "合同交租开始时间",
hetongjiaozujieshushijian: "合同交租结束时间",
zulinkaishiqixian: "租赁开始期限",
zulinjieshuqixian: "租赁结束期限",
zupingmianji: "租赁面积",
yingshouzujin: "应收租金"
}
}
},
@ -68,7 +79,9 @@ export default {
},
computed: {
showRow () {
return this.type === 1 ? this.t1 : this.t2;
if (this.type === 1) return this.t1;
if (this.type === 2) return this.t2;
if (this.type === 3) return this.t3;
},
descriptionItem () {
return function (key) {

@ -14,12 +14,12 @@
</div>
<div class="list">
<div class="list-item" v-for="item in notices" @click="$refs['drawer'].setType(1),$refs['drawer'].setRow(item),$refs['drawer'].show()">
<span>{{ item.name }}</span>
<span>{{ item.shijian }}</span>
<div class="list-item" v-for="item in notices.slice((noticeSelect.page-1)*noticeSelect.page_size,(noticeSelect.page-1)*noticeSelect.page_size+noticeSelect.page_size)" @click="item.name ? ($refs['drawer'].setType(1),$refs['drawer'].setRow(item),$refs['drawer'].show()) : ($refs['drawer'].setType(3),$refs['drawer'].setRow(item),$refs['drawer'].show())">
<span>{{ item.name || item.dikuaimingcheng }}</span>
<span>{{ item.shijian || item.zulinkaishiqixian }}</span>
</div>
<Page class="list-page" :page-size="noticeSelect.page_size" :total="noticeTotal" size="small" />
<Page class="list-page" :page-size="noticeSelect.page_size" :total="noticeTotal" size="small" @on-change="e => (noticeSelect.page = e)"/>
</div>
<!-- <xy-table :height="400" :table-item="table1" style="margin-top: 20px" size="mini" stripe ref="table1" :auths="[]" :action="index" :req-opt="select"></xy-table>-->
</el-col>
@ -90,7 +90,7 @@
import drawer from "./components/drawer.vue"
import {
getChartsHome
getChartsHome, getNotice
} from '@/api/dashboard';
import { index } from "@/api/system/baseForm"
@ -430,9 +430,9 @@
},
async getNotices () {
const res = await index(this.noticeSelect,false);
this.notices = res.data;
this.noticeTotal = res.total;
const res = await getNotice();
this.notices = res;
this.noticeTotal = res.length;
},
async getSystems () {
const res = await index(this.systemSelect,false);

Loading…
Cancel
Save