|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
- <div style="margin-top:10px;">
|
|
|
- <a-card class="mt-10" :headStyle="{padding:'0 10px'}" :bodyStyle="{padding:'10px 16px'}" :bordered="false">
|
|
|
+ <div>
|
|
|
+
|
|
|
+ <a-card class="mt-10" :style="{borderRadius:'0 0 5px 5px'}" :headStyle="{padding:'0 10px'}" :bordered="false">
|
|
|
<template #title>
|
|
|
<div class="flex-between">
|
|
|
<a-space>
|
|
@@ -12,13 +13,13 @@
|
|
|
<div class="flex-align-center">
|
|
|
<a-space>
|
|
|
<slot name="operation"></slot>
|
|
|
- <a-button v-if="delParam" type="danger" :disabled="disable" @click="delData">删除</a-button>
|
|
|
- <a-button @click="base.previous">
|
|
|
+ <a-button v-if="delParam && utils.hasPermission('delete')" type="primary" :disabled="disable" @click="delData" danger>删除</a-button>
|
|
|
+ <a-button v-if="router.currentRoute.value.query.listqueryid" @click="previous">
|
|
|
<template #icon>
|
|
|
<left-outlined />
|
|
|
</template>
|
|
|
</a-button>
|
|
|
- <a-button @click="base.next">
|
|
|
+ <a-button v-if="router.currentRoute.value.query.listqueryid" @click="next">
|
|
|
<template #icon>
|
|
|
<right-outlined />
|
|
|
</template>
|
|
@@ -27,20 +28,25 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <a-descriptions :column="6" :labelStyle="{color:'#999999'}" :contentStyle="{marginRight:'20px',marginBottom:'5px'}" size="small">
|
|
|
+ <a-descriptions :column="6" :labelStyle="{color:'#666'}" :contentStyle="{marginRight:'20px',marginBottom:'5px'}" size="small">
|
|
|
<a-descriptions-item :span="item.span ? item.span : 1" v-for="item in props.headData" :key="item.index" :label="item.label"><span :style="item.style?item.style():''">{{item.value}}</span></a-descriptions-item>
|
|
|
</a-descriptions>
|
|
|
+ <slot name="customContent"></slot>
|
|
|
+ </a-card>
|
|
|
+ <slot name="customMid"></slot>
|
|
|
+
|
|
|
+ <a-card class="mt-10" :style="{borderRadius:'5px'}" :bodyStyle="{padding:'0 20px 20px 20px'}" :bordered="false">
|
|
|
+ <div v-if="!props.notabs">
|
|
|
+ <a-tabs v-model:activeKey="activeKey" @change="onTabChange" >
|
|
|
+ <a-tab-pane v-for="(item,index) in props.tabs" :key="index" :tab="item">
|
|
|
+ <slot :name="'tab' + index"></slot>
|
|
|
+ </a-tab-pane>
|
|
|
+ <a-tab-pane key="log" tab="操作记录">
|
|
|
+ <log-temp :ownertable="ownertable"></log-temp>
|
|
|
+ </a-tab-pane>
|
|
|
+ </a-tabs>
|
|
|
+ </div>
|
|
|
</a-card>
|
|
|
- <div class="y-container">
|
|
|
- <a-tabs v-model:activeKey="activeKey" @change="onTabChange" >
|
|
|
- <a-tab-pane v-for="(item,index) in props.tabs" :key="index" :tab="item">
|
|
|
- <slot :name="'tab' + index"></slot>
|
|
|
- </a-tab-pane>
|
|
|
- <a-tab-pane key="log" tab="操作记录">
|
|
|
- <log-temp :ownertable="ownertable"></log-temp>
|
|
|
- </a-tab-pane>
|
|
|
- </a-tabs>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -48,27 +54,27 @@
|
|
|
import logTemp from './modules/log.vue'
|
|
|
import Api from '@/api/api'
|
|
|
import utils from "@/utils/utils"
|
|
|
- import {defineProps,ref,createVNode} from 'vue'
|
|
|
+ import {defineProps,ref,createVNode,computed,defineEmits,onMounted,onActivated} from 'vue'
|
|
|
import { LeftOutlined,RightOutlined,ExclamationCircleOutlined,ArrowLeftOutlined} from '@ant-design/icons-vue'
|
|
|
import { useRouter } from "vue-router"
|
|
|
- import { Modal } from 'ant-design-vue'
|
|
|
- import { useBaseStore } from '../../stores/modules/base'
|
|
|
+ import { Modal,message } from 'ant-design-vue'
|
|
|
+ import { useRouteTabsStore } from '@/stores/modules/routeTabs'
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
+ const rotTabs = useRouteTabsStore()
|
|
|
const router = useRouter()
|
|
|
- const base = useBaseStore()
|
|
|
- let { pageChange } = storeToRefs(base)
|
|
|
-
|
|
|
const props = defineProps({
|
|
|
headData:Array,
|
|
|
tabs:Array,
|
|
|
ownertable:String,
|
|
|
title:String,
|
|
|
delParam:Object,
|
|
|
- disable:Boolean
|
|
|
+ disable:Boolean,
|
|
|
+ notabs:Boolean,
|
|
|
})
|
|
|
-
|
|
|
const activeKey = ref(0)
|
|
|
+
|
|
|
const goBack = ()=>{
|
|
|
+ rotTabs.delRoute(router.currentRoute.value.name,router.currentRoute.value.name)
|
|
|
router.replace({name:router.currentRoute.value.meta.name})
|
|
|
}
|
|
|
|
|
@@ -78,8 +84,10 @@
|
|
|
content: '确认删除当前数据吗',
|
|
|
icon: createVNode(ExclamationCircleOutlined),
|
|
|
async onOk() {
|
|
|
- const res = await Api.requested(props.delParam)
|
|
|
+ const res = await Api.post(props.delParam)
|
|
|
utils.message(res,'删除成功',()=>{
|
|
|
+ let currentRoute = router.currentRoute.value.name
|
|
|
+ rotTabs.delRoute(currentRoute,currentRoute)
|
|
|
goBack()
|
|
|
})
|
|
|
},
|
|
@@ -92,6 +100,56 @@
|
|
|
const onTabChange = (key)=>{
|
|
|
activeKey.value = key
|
|
|
}
|
|
|
+ const time = ref(null)
|
|
|
+ const previous = ()=>{
|
|
|
+ let rowindex = Number(router.currentRoute.value.query.rowindex) - 1
|
|
|
+ let listqueryid = router.currentRoute.value.query.listqueryid
|
|
|
+ if (rowindex >= 1) {
|
|
|
+ if (time.value !== null) {
|
|
|
+ clearTimeout(time.value)
|
|
|
+ }
|
|
|
+ time.value = setTimeout(() => {
|
|
|
+ upPageData(rowindex,listqueryid)
|
|
|
+ }, 0);
|
|
|
+ } else {
|
|
|
+ message.warn('已经是第一条了!')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const next = ()=>{
|
|
|
+ let rowindex = Number(router.currentRoute.value.query.rowindex) + 1
|
|
|
+ let listqueryid = router.currentRoute.value.query.listqueryid
|
|
|
+ if (time.value !== null) {
|
|
|
+ clearTimeout(time.value)
|
|
|
+ }
|
|
|
+ time.value = setTimeout(() => {
|
|
|
+ upPageData(rowindex,listqueryid)
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+ const upPageData = async (rowindex,listqueryid)=> {
|
|
|
+ const hide = message.loading({content:'正在查询数据,请稍等..',duration:0,key:1});
|
|
|
+ const res = await Api.requested({
|
|
|
+ "classname": "system.tools",
|
|
|
+ "method":"querylistdatabyrowindex",
|
|
|
+ "content": {
|
|
|
+ "rowindex": rowindex,
|
|
|
+ "listqueryid": listqueryid,
|
|
|
+ "fieldname":router.currentRoute.value.query.fieldName ? router.currentRoute.value.query.fieldName:''
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (res.data.data) {
|
|
|
+ hide()
|
|
|
+ router.replace({path:router.currentRoute.value.path,query:{id:res.data.data,rowindex:rowindex,listqueryid:listqueryid,fieldName:router.currentRoute.value.query.fieldName}})
|
|
|
+ } else {
|
|
|
+ message.warn('已经是最后一条了!')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ onActivated (()=>{
|
|
|
+ if(!props.tabs || props.tabs.length == 0) {
|
|
|
+ activeKey.value = 'log'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ onMounted (()=>{
|
|
|
+ })
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|