master
xy 2 years ago
parent 22b62fdd03
commit 18152dce3c

@ -1,7 +1,9 @@
<template> <template>
<section class="app-main"> <section class="app-main">
<transition name="fade-transform" mode="out-in"> <transition name="fade-transform" mode="out-in">
<keep-alive :include="['tableList','mapList']">
<router-view :key="key" /> <router-view :key="key" />
</keep-alive>
</transition> </transition>
</section> </section>
</template> </template>

@ -53,7 +53,7 @@
</template> </template>
<script> <script>
import { save } from "@/api/system/baseForm"; import { save, show } from "@/api/system/baseForm";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
export default { export default {
@ -62,6 +62,8 @@ export default {
action: process.env.VUE_APP_UPLOAD_API, action: process.env.VUE_APP_UPLOAD_API,
dialogVisible: false, dialogVisible: false,
asset_id: "", asset_id: "",
id: "",
type: 'add',
form: { form: {
riqi: "", riqi: "",
@ -97,6 +99,17 @@ export default {
hide() { hide() {
this.dialogVisible = false; this.dialogVisible = false;
}, },
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setId (id) {
this.id = id
},
setAssetId(id) { setAssetId(id) {
this.asset_id = id; this.asset_id = id;
}, },
@ -111,12 +124,41 @@ export default {
this.$refs["elForm"].clearValidate(); this.$refs["elForm"].clearValidate();
}, },
async getDetail () {
const res = await show({
table_name: 'asset_histories',
id: this.id
})
this.$integrateData(this.form,res)
this.fileList = res.id_his_tupian_files_asset_history_id_relation.map(i => {
return {
response: i,
name: i.original_name,
url: i.url
}
})
},
submit () { submit () {
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
}
this.form.id_his_tupian_files_asset_history_id_relation = this.fileList.map(i => { this.form.id_his_tupian_files_asset_history_id_relation = this.fileList.map(i => {
return { return {
original_name: i.response.original_name, original_name: i.response.original_name,
name: i.response.name, name: i.response.name,
url: i.response.url, url: /:\/\/:\/\//g.test(i.response.url) ? i.response.url.replace(/:\/\/:\/\//g,"://") : i.response.url,
file_id: i.response.id file_id: i.response.id
} }
}) })
@ -131,10 +173,24 @@ export default {
}) })
this.hide() this.hide()
this.init() this.init()
this.$emit('refresh')
}) })
} }
}, },
computed: {}, computed: {},
watch: {
dialogVisible (newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = '';
this.asset_id = '';
this.fileList = [];
}
}
}
}; };
</script> </script>

@ -0,0 +1,115 @@
<template>
<div>
<Modal title="资产历史" footer-hide :width="64" v-model="isShow">
<Button type="primary" style="margin-bottom: 10px;" @click="$refs['assetsHistory'].setAssetId(id),$refs['assetsHistory'].show()"></Button>
<xy-table :btn-width="120"
style="width: 100%;"
:auths="['delete','edit']"
:height="360"
ref="xyTable"
delay-req
:table-item="table"
:action="index"
:req-opt="select"
:destroy-req-opt="{ table_name: 'asset_histories' }"
:destroy-action="destroy"
@editor="row => {
$refs['assetsHistory'].setType('editor'),
$refs['assetsHistory'].setId(row.id),
$refs['assetsHistory'].setAssetId(id),
$refs['assetsHistory'].show()
}"></xy-table>
</Modal>
<assetsHistory ref="assetsHistory" @refresh="$refs['xyTable'].getTableData()"></assetsHistory>
</div>
</template>
<script>
import { index, destroy } from "@/api/system/baseForm";
import assetsHistory from '@/views/assets/assetsHistory.vue'
export default {
components: { assetsHistory },
data() {
return {
id: '',
isShow: false,
select: {
table_name: 'asset_histories',
filter: [
{
key: 'asset_id',
op: 'eq',
value: ''
}
]
},
table: [
{
prop: 'riqi',
label: '日期',
width: 200
},
{
prop: 'neirong',
label: '内容',
minWidth: 220,
align: 'left',
customFn:row => {
return (
<div domPropsInnerHTML={ row.neirong }></div>
)
}
},
{
prop: 'picture',
label: '图片',
showOverflowTooltip: false,
minWidth: 360,
align: 'left',
customFn:row => {
return (
<div style="display: grid;grid-template-columns: repeat(4, 1fr);grid-gap: 4px;">
{
row.id_his_tupian_files_asset_history_id_relation.map(i => {
return (
<el-image style="width: 80px;height: 60px;" fit="cover" src={i.url}></el-image>
)
})
}
</div>
)
}
}
]
}
},
methods: {
index,destroy,
show () {
this.isShow = true
},
hide () {
this.isShow = false
},
setId (id) {
if (typeof id === 'number') {
this.id = id
this.select.filter[0].value = id
}
}
},
computed: {},
watch: {
isShow (newVal) {
if (newVal) {
this.$refs['xyTable'].getTableData(true)
}
}
}
}
</script>
<style scoped lang="scss">
</style>

@ -175,7 +175,8 @@ export default {
asset_id: this.id, asset_id: this.id,
name: response.name, name: response.name,
original_name: response.original_name, original_name: response.original_name,
url: response.url //TODO:
url: response.url.replace(/:\/\/:\/\//g,'://')
}).then(res => { }).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
@ -192,7 +193,6 @@ export default {
this.id = ""; this.id = "";
this.type = ""; this.type = "";
this.fileList = []; this.fileList = [];
this.$refs["dialog"]?.clearValidate();
} }
}, },
}, },

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<el-page-header <el-page-header
:content="$route.meta.title + (detail.dikuaimingcheng ? ' - ' : '') + detail.dikuaimingcheng" :content="$route.meta.title + (detail.dikuaimingcheng ? ' - ' + detail.dikuaimingcheng : '')"
style=" style="
padding: 1em; padding: 1em;
font-size: 1em; font-size: 1em;
@ -24,7 +24,7 @@
style="width: 100%; height: 100%;" style="width: 100%; height: 100%;"
:src="item.url" :src="item.url"
:preview-src-list="picList" :preview-src-list="picList"
fit="contain"></el-image> fit="cover"></el-image>
</el-carousel-item> </el-carousel-item>
</el-carousel> </el-carousel>
</el-card> </el-card>
@ -104,13 +104,13 @@ import { show as formShow } from "@/api/system/customForm";
import { getparameter } from '@/api/system/dictionary' import { getparameter } from '@/api/system/dictionary'
import { listdept } from '@/api/system/department' import { listdept } from '@/api/system/department'
export default { export default {
name: 'detail',
data() { data() {
return { return {
center: [120.283692, 31.614211], center: [120.283692, 31.614211],
marker: {}, marker: {},
histories: [], histories: [],
picList: [],
detail: {}, detail: {},
fields: [], fields: [],
relation: [], relation: [],
@ -250,8 +250,6 @@ export default {
}) })
this.detail = detail this.detail = detail
this.init(); this.init();
this.picList = detail?.id_assets_picture_files_file_id_relation?.map(i => i.url)
}, },
async getHistory () { async getHistory () {
@ -271,6 +269,9 @@ export default {
} }
}, },
computed: { computed: {
picList () {
return this.detail?.id_assets_atlas_files_asset_id_relation?.map(i => i.url) || []
},
contentFormat() { contentFormat() {
return function (i) { return function (i) {
let { _relations } = i; let { _relations } = i;

@ -456,6 +456,11 @@ export default {
info.field info.field
]?.map((i) => { ]?.map((i) => {
let copyRelation = i?.response ? deepCopy(i?.response) : ""; let copyRelation = i?.response ? deepCopy(i?.response) : "";
console.log(333,copyRelation)
//TODO:
if (/:\/\/:\/\//g.test(copyRelation?.url)) {
copyRelation.url.replace(/:\/\/:\/\//g,'://')
}
delete copyRelation.id; delete copyRelation.id;
return { return {
upload_id: i?.response?.id, upload_id: i?.response?.id,

@ -100,6 +100,7 @@ import { show } from "@/api/system/customForm";
import { listdept } from "@/api/system/department"; import { listdept } from "@/api/system/department";
import { getparameter } from "@/api/system/dictionary"; import { getparameter } from "@/api/system/dictionary";
export default { export default {
name: 'mapList',
data() { data() {
return { return {
dragging: false, dragging: false,

@ -269,7 +269,7 @@
<Button <Button
size="small" size="small"
type="primary" type="primary"
@click="$refs['assetsHistory'].setAssetId(row.id),$refs['assetsHistory'].show()" @click="$refs['assetsHistoryList'].setId(row.id),$refs['assetsHistoryList'].show()"
>历史</Button >历史</Button
> >
</template> </template>
@ -302,8 +302,8 @@
ref="imports" ref="imports"
@refresh="$refs['xyTable'].getTableData()" @refresh="$refs['xyTable'].getTableData()"
></imports> ></imports>
<assetsHistory ref="assetsHistory"></assetsHistory>
<atlas ref="atlas"></atlas> <atlas ref="atlas"></atlas>
<assetsHistoryList ref="assetsHistoryList"></assetsHistoryList>
</div> </div>
</template> </template>
@ -324,9 +324,10 @@ import LxHeader from "@/components/LxHeader/index.vue";
import headerContent from "@/components/LxHeader/XyContent.vue"; import headerContent from "@/components/LxHeader/XyContent.vue";
import drawer from "@/views/component/drawer.vue"; import drawer from "@/views/component/drawer.vue";
import imports from "./imports.vue"; import imports from "./imports.vue";
import assetsHistory from "@/views/assets/assetsHistory.vue";
import atlas from "@/views/assets/atlas.vue"; import atlas from "@/views/assets/atlas.vue";
import assetsHistoryList from '@/views/assets/assetsHistoryList.vue'
export default { export default {
name: 'tableList',
components: { components: {
LxHeader, LxHeader,
dialoger, dialoger,
@ -334,8 +335,8 @@ export default {
drawer, drawer,
imports, imports,
assetsHistory, atlas,
atlas assetsHistoryList
}, },
mixins: [authMixin], mixins: [authMixin],
provide: { provide: {

Loading…
Cancel
Save