ce9f82c7 by xukangle

fix

1 parent 9707d299
......@@ -46,24 +46,24 @@ watch(
}
}
// isExist.length == 0 && list.push(newRouter);
list.map(item => {
if (combPath == 'app-scenes') {
item.visible = item.fullPath == '/'
} else {
if (item.fullPath.split('/')?.[1] != combPath) {
item.visible = false
} else {
item.visible = true
}
}
})
// list.map(item => {
// if (combPath == 'app-scenes') {
// item.visible = item.fullPath == '/'
// } else {
// if (item.fullPath.split('/')?.[1] != combPath) {
// item.visible = false
// } else {
// item.visible = true
// }
// }
// })
tabbarList.value = list;
tabbarActive.value = newRouter.fullPath;
userStore.setTabbar(tabbarList.value);
userStore.setActiveTabbar(combPath, newRouter.fullPath);
nextTick(() => {
setTabVisible()
})
// nextTick(() => {
// setTabVisible()
// })
},
{ immediate: true }
);
......@@ -78,7 +78,9 @@ const changeTab = (pane: any, ev: any) => {
userStore.setActiveTabbar(combPath, paneData.fullPath);
};
const removeTab = (targetName) => {
const tabs = tabbarList.value.filter(item => item.visible ?? true);
// const tabs = tabbarList.value.filter(item => item.visible ?? true);
const tabs = tabbarList.value;
let activeName = tabbarActive.value, nextTab: any = {};
const setTabs = (activeTab) => {
tabbarActive.value = activeName;
tabbarList.value = tabbarList.value.filter((tab) => tab.fullPath !== targetName);
......@@ -94,12 +96,12 @@ const removeTab = (targetName) => {
}
nextTick(() => {
nextTab.name && router.push({ name: nextTab.name, query: nextTab.query });
setTabVisible()
// setTabVisible()
});
}
let activeName = tabbarActive.value;
let nextTab: any = {};
// let activeName = tabbarActive.value;
// let nextTab: any = {};
if (tabbarActive.value === targetName) {
tabs.forEach((tab, index) => {
if (tab.fullPath === targetName) {
......@@ -112,7 +114,7 @@ const removeTab = (targetName) => {
}
let activeTab: any = tabs.find(t => t.fullPath === targetName);
if (activeTab.meta.editPage) {
if (activeTab && activeTab.meta.editPage) {
ElMessageBox.confirm(
"当前页面尚未保存,确定关闭吗?",
"提示",
......@@ -140,13 +142,14 @@ const setTabVisible = () => {
const tabpanes: any = document.querySelectorAll('.tabbar-container .el-tabs__item')
let list: any = []
tabpanes.forEach((tab, i) => {
const visible = tabbarList.value[i].visible ?? true
if (!visible) {
tab.style.display = 'none'
} else {
tab.style.display = 'inherit'
list.push(tabbarList.value[i].fullPath)
}
// const visible = tabbarList.value[i].visible ?? true
// if (!visible) {
// tab.style.display = 'none'
// } else {
// tab.style.display = 'inherit'
// list.push(tabbarList.value[i].fullPath)
// }
list.push(tabbarList.value[i].fullPath)
})
visibleTabs.value = list
}
......@@ -159,7 +162,7 @@ onMounted(() => {
<div class="tabbar-container">
<el-tabs v-model="tabbarActive" type="card" @tab-click="changeTab" @tab-remove="removeTab">
<el-tab-pane v-for="(item, index) in tabbarList" :key="item.fullPath + '_' + index" :name="item.fullPath"
:closable="visibleTabs.length > 1">
:closable="tabbarList.length > 1">
<template #label v-if="item.isHomePage">
<span class="custom-tabs-label">
<el-icon>
......
<script lang="ts" setup name="entryManagement" >
import { ref,onBeforeMount } from 'vue';
<script lang="ts" setup name="entryManagement">
import { ref, onBeforeMount } from 'vue';
import { useRoute } from "vue-router"
import { ElMessage, ElMessageBox } from "element-plus"
import dayjs from 'dayjs';
......@@ -15,6 +13,7 @@ import {
intableUpdate,
getDocumentList
} from "@/api/modules/dataTransaction";
import { getDamCatalogTable } from '@/api/modules/dataAsset';
const route = useRoute()
const userStore = useUserStore();
const searchItemList = ref([
......@@ -29,7 +28,7 @@ const searchItemList = ref([
]);
const page = ref({
limit: 50,
rows:0,
rows: 0,
curr: 1,
sizes: [
{ label: "10", value: 10 },
......@@ -45,123 +44,130 @@ const { proxy } = getCurrentInstance() as any;
const tableRef = ref()
const tableInfo = ref({
id: 'entry-asset-table',
loading:false,
isEdit:false,
currentId:"0",
flag:"create",
data:[] as any,
loading: false,
isEdit: false,
currentId: "0",
flag: "create",
data: [] as any,
})
const tableSelectInfo = ref({
selectValue:"",
daName:"",
companyGuid:""
selectValue: "",
daName: "",
companyGuid: ""
})
const columnInfo = ref({
guid:"",
companyName:"",
daName:"",
registerTime:"",
daCode:"",
effectiveDate:"",
intableTime:"",
intableMoney:0,
issuingEntityName:"",
issuingEntityGuid:"",
companyGuid:"",
registerGuid:""
guid: "",
companyName: "",
daName: "",
registerTime: "",
daCode: "",
effectiveDate: "",
intableTime: "",
intableMoney: 0,
issuingEntityName: "",
issuingEntityGuid: "",
companyGuid: "",
registerGuid: ""
})
const companyOption = ref<any>([])
const companyOption = ref<any>([
{
tenantGuid: JSON.parse(userStore.userData).tenantGuid,
tenantName: JSON.parse(userStore.userData).tenantName
}
])
const assetsOption = ref<any>([])
const colums = [
{
type:"index",
label:"序号",
align:"center",
width:"56"
type: "index",
label: "序号",
align: "center",
width: "56"
},
{
prop:"companyName",
label:"公司名称",
width:"220",
componentType:"select",
// editDisabled:()=> tableInfo.value.flag==="edit" ? true :false,
selectKey:"tenantName",
selectOption:() => companyOption.value
prop: "companyName",
label: "公司名称",
width: "220",
componentType: "select",
// editDisabled:()=> tableInfo.value.flag==="edit" ? true :false,
selectKey: "tenantName",
selectOption: () => companyOption.value
},
{
prop:"daName",
label:"资产名称",
width:"180",
componentType:"select",
componentDisabled:false,
//editDisabled:()=> tableInfo.value.flag==="edit" ? true :false,
selectOption:() => assetsOption.value ,
selectKey:"daName",
prop: "intableTime",
label: "入表时间",
width: "130",
componentType: "dateTime",
componentDisabled: false
},
{
prop:"daCode",
label:"资产编号",
width:"180"
prop: "intableMoney",
label: "入表金额(万元)",
width: "200",
componentType: "number",
toFixed: true,
placeholder: "0.00",
align: "right",
config: {
controls: false,
precision: 0
},
componentDisabled: false,
input: (value, key, info) => {
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(/[^\d.]/g, "")
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(/\.{2,}/g, ".")
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(".", "$#$").replace(/\./g, "").replace("$#$", ".")
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(/^(\-)*(\d+)\.(\d\d\d\d\d\d).*$/, "$1$2.$3")
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(/^\D*(\d{0,12}(?:\.\d{0,6})?).*$/g, "$1")
},
change: (value, key, info) => {
let strArr = value.split(".")
if (strArr.length > 1) {
let right = strArr[1]
if (right === '' || right.length < 2) {
tableRef.value.columnInfo[key] = parseFloat(tableRef.value.columnInfo[key] || 0).toFixed(2)
}
} else {
tableRef.value.columnInfo[key] = parseFloat(tableRef.value.columnInfo[key] || 0).toFixed(2)
}
}
},
{
prop:"registerTime",
label:"登记时间",
width:"130",
componentType:"dateTime",
prop: "daName",
label: "资产名称",
width: "180",
componentType: "select",
componentDisabled: false,
//editDisabled:()=> tableInfo.value.flag==="edit" ? true :false,
selectOption: () => assetsOption.value,
selectKey: "damName",
},
{
prop:"effectiveDate",
label:"有效期",
width:"130",
componentType:"dateTime",
prop: "daCode",
label: "资产编号",
width: "180"
},
{
prop:"issuingEntityName",
label:"发证主体",
width:"250"
prop: "registerTime",
label: "登记时间",
width: "130",
componentType: "dateTime",
},
{
prop:"intableTime",
label:"入表时间",
width:"130",
componentType:"dateTime",
componentDisabled:false
prop: "effectiveDate",
label: "有效期",
width: "130",
componentType: "dateTime",
},
{
prop:"intableMoney",
label:"入表金额(万元)",
width:"200",
componentType:"number",
toFixed:true,
placeholder:"0.00",
align:"right",
config:{
controls:false,
precision:0
},
componentDisabled:false,
input:(value,key,info)=>{
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(/[^\d.]/g,"")
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(/\.{2,}/g,".")
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(".","$#$").replace(/\./g,"").replace("$#$",".")
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(/^(\-)*(\d+)\.(\d\d\d\d\d\d).*$/,"$1$2.$3")
tableRef.value.columnInfo[key] = tableRef.value.columnInfo[key].toString().replace(/^\D*(\d{0,12}(?:\.\d{0,6})?).*$/g,"$1")
},
change:(value,key,info) => {
let strArr = value.split(".")
if(strArr.length>1) {
let right = strArr[1]
if(right==='' || right.length<2) {
tableRef.value.columnInfo[key] = parseFloat(tableRef.value.columnInfo[key]||0).toFixed(2)
}
} else {
tableRef.value.columnInfo[key] = parseFloat(tableRef.value.columnInfo[key]||0).toFixed(2)
}
}
prop: "issuingEntityName",
label: "发证主体",
width: "250"
},
]
const toSearch = (val: any, clear: boolean = false) => {
page.value.curr = 1;
......@@ -175,24 +181,26 @@ const toSearch = (val: any, clear: boolean = false) => {
};
// 查公司
const documentList = async () => {
const res = await getDocumentList({
daName:tableSelectInfo.value.selectValue,
const res = await getDocumentList({
daName: tableSelectInfo.value.selectValue,
isCompany: true,
type:1})
companyOption.value =res.data || []
type: 1
})
companyOption.value = res.data || []
return Promise.resolve()
return Promise.resolve()
}
// 查资产
const getAssetsList = async () => {
const res = await getDocumentList({
daName:tableSelectInfo.value.selectValue,
companyGuid:tableSelectInfo.value.companyGuid,
type:1})
assetsOption.value =res.data || []
return Promise.resolve()
const getAssetsList = async () => {
const res = await getDamCatalogTable({
pageSize: -1,
pageIndex: 1,
})
assetsOption.value = res.data.records || []
console.log(assetsOption.value, '---')
return Promise.resolve()
}
//
// getDamCatalogTable
const getTableData = () => {
tableInfo.value.loading = true;
getEntryList({
......@@ -206,42 +214,43 @@ const getTableData = () => {
tableInfo.value.data = data.records || [];
page.value.curr = data.pageIndex;
page.value.rows = data.totalRows || 0;
}
}
})
}
const createOneData = () => {
if(companyOption.value.length>0) {
if (companyOption.value.length > 0) {
findTab(true)
assetsOption.value = []
const currentDate = dayjs().format('YYYY-MM-DD');
tableInfo.value.flag = "create"
//const arr:any = []
tableInfo.value.data.unshift({
guid:BASE_ID,
companyName:"",
daName:"",
registerTime:"",
daCode:"",
effectiveDate:"",
intableTime:currentDate,
intableMoney:0,
issuingEntityName:"",
companyGuid:"",
registerGuid:""
guid: BASE_ID,
companyName: "",
daName: "",
registerTime: "",
daCode: "",
effectiveDate: "",
intableTime: currentDate,
intableMoney: 0,
issuingEntityName: "",
companyGuid: "",
registerGuid: ""
})
//tableInfo.value.data = arr
tableInfo.value.currentId = BASE_ID
tableInfo.value.isEdit = true
tableRef.value.columnInfo.intableTime = currentDate
// tableRef.value.columnInfo.companyName = JSON.parse(userStore.userData).tenantName
} else {
ElMessage.warning("没有可添加的数据!")
}
}
const columnDel =(row) => {
const columnDel = (row) => {
ElMessageBox.confirm(
'是否确定删除所选数据?',
'提示',
......@@ -252,8 +261,8 @@ const columnDel =(row) => {
}
)
.then(() => {
deleteEntryAll(row.guid).then((res:any)=>{
if(res?.code===proxy.$passCode){
deleteEntryAll(row.guid).then((res: any) => {
if (res?.code === proxy.$passCode) {
ElMessage.success("删除成功")
getTableData()
documentList()
......@@ -263,80 +272,80 @@ const columnDel =(row) => {
} else {
ElMessage.error(res?.msg)
}
})
}).catch(()=>{
}).catch(() => {
tableRef.value.columnInfo = {}
})
}
const columnSave = async (row) => {
if(!row.companyName) {
if (!row.companyName) {
ElMessage.warning("公司名称不能为空")
return
} else if(!row.daName) {
} else if (!row.daName) {
ElMessage.warning("资产名称不能为空")
return
} else if(!row.intableTime) {
} else if (!row.intableTime) {
ElMessage.warning("入表时间不能为空")
return
} else if(!row.intableMoney || row.intableMoney<=0) {
} else if (!row.intableMoney || row.intableMoney <= 0) {
ElMessage.warning("入表金额必须大于0")
return
}
let res:any
switch(tableInfo.value.flag) {
case "create":res = await createEntry(row);break
case "edit":res = await intableUpdate(row);break
let res: any
switch (tableInfo.value.flag) {
case "create": res = await createEntry(row); break
case "edit": res = await intableUpdate(row); break
}
if(res?.code===proxy.$passCode) {
ElMessage.success(`${tableInfo.value.flag==='create' ? '新增' : '修改'}成功`);
if (res?.code === proxy.$passCode) {
ElMessage.success(`${tableInfo.value.flag === 'create' ? '新增' : '修改'}成功`);
getTableData()
columnInfoReset()
documentList()
findTab(false)
tableRef.value.columnInfo = {}
}else {
} else {
ElMessage.error(res.msg);
//columnCancel()
}
//columnInfoReset()
}
//columnInfoReset()
}
const columnInfoReset = () => {
tableInfo.value.currentId = "0"
tableInfo.value.isEdit = false
columnInfo.value = {
guid:"",
companyName:"",
daName:"",
registerTime:"",
daCode:"",
effectiveDate:"",
intableTime:"",
intableMoney:0,
issuingEntityName:"",
issuingEntityGuid:"",
companyGuid:"",
registerGuid:""
guid: "",
companyName: "",
daName: "",
registerTime: "",
daCode: "",
effectiveDate: "",
intableTime: "",
intableMoney: 0,
issuingEntityName: "",
issuingEntityGuid: "",
companyGuid: "",
registerGuid: ""
}
}
const columnEdit = (row) => {
const columnEdit = (row) => {
tableInfo.value.flag = "edit"
findTab(true)
tableSelectInfo.value.companyGuid = row.companyGuid
assetsOption.value = []
addAssetsOption(null,row,true)
addAssetsOption(null, row, true)
addCompanyOption(row)
//getAssetsList()
const info = {...row}
const info = { ...row }
tableInfo.value.currentId = info.guid
tableInfo.value.isEdit = true
tableRef.value.columnInfo.intableMoney = tableRef.value.columnInfo.intableMoney.toFixed(2)
columnInfo.value = {...info}
columnInfo.value = { ...info }
}
const columnCancel = () => {
tableInfo.value.isEdit = false
if(tableInfo.value.flag==="edit") {
if (tableInfo.value.flag === "edit") {
tableInfo.value.currentId = "0"
} else {
tableInfo.value.data.shift()
......@@ -351,13 +360,13 @@ const pageChange = (info) => {
getTableData()
}
// 选择后赋值
const handelSelect = (row,key,row1) => {
if(key==="companyName") {
tableSelectInfo.value.companyGuid = row.tenantGuid
addAssetsOption(row,row1)
columnInfo.value.companyName = row.tenantName
tableRef.value.columnInfo.companyName = row.tenantName
tableRef.value.columnInfo.companyGuid = row.tenantGuid
const handelSelect = (row, key, row1) => {
if (key === "companyName") {
tableSelectInfo.value.companyGuid = row.tenantGuid
addAssetsOption(row, row1)
columnInfo.value.companyName = row.tenantName
tableRef.value.columnInfo.companyName = row.tenantName
tableRef.value.columnInfo.companyGuid = row.tenantGuid
tableRef.value.columnInfo.daName = ""
tableRef.value.columnInfo.daCode = ""
tableRef.value.columnInfo.issuingEntityName = ""
......@@ -366,23 +375,24 @@ const handelSelect = (row,key,row1) => {
tableRef.value.columnInfo.registerTime = ""
tableRef.value.columnInfo.effectiveDate = ""
} else {
if(tableInfo.value.flag==="create") {
if (tableInfo.value.flag === "create") {
console.log(row, '-----')
const currentDate = dayjs().format('YYYY-MM-DD');
columnInfo.value = {
guid:row.guid,
companyName:row.tenantName,
daName:row.daName,
registerTime:row.registerTime,
daCode:row.daCode,
effectiveDate:row.effectiveDate,
intableTime:currentDate,
intableMoney:0,
issuingEntityName:row.issuingEntityName,
issuingEntityGuid:row.issuingEntityGuid,
companyGuid:row.tenantGuid,
registerGuid:row.registerGuid
guid: row.guid,
companyName: row.rightMainName,
daName: row.damName,
registerTime: row.registerTime,
daCode: row.daCode,
effectiveDate: row.effectiveDate,
intableTime: currentDate,
intableMoney: 0,
issuingEntityName: row.issuingEntityName,
issuingEntityGuid: row.issuingEntityGuid,
companyGuid: row.tenantGuid,
registerGuid: row.registerGuid
}
const {guid,...obj} = columnInfo.value
const { guid, ...obj } = columnInfo.value
tableRef.value.columnInfo = obj
} else {
columnInfo.value.daName = row.daName
......@@ -391,71 +401,72 @@ const handelSelect = (row,key,row1) => {
columnInfo.value.effectiveDate = row.effectiveDate
columnInfo.value.issuingEntityName = row.issuingEntityName
columnInfo.value.registerGuid = row.registerGuid;
tableRef.value.columnInfo = {...columnInfo.value}
tableRef.value.columnInfo = { ...columnInfo.value }
}
// 新增不用传guid 所以删掉,但是往输入框添加数据 通过guid判断
//console.log(columnInfo.value)
// 新增不用传guid 所以删掉,但是往输入框添加数据 通过guid判断
//console.log(columnInfo.value)
}
}
const findTab = (flag) => {
const tab:any = userStore.tabbar.find((tab:any)=>tab.fullPath===route.path)
tab.meta.editPage = flag
const tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === route.path)
tab.meta.editPage = flag
}
const addAssetsOption = (values,row,flag=false) => {
getAssetsList().then(()=>{
const addAssetsOption = (values, row, flag = false) => {
getAssetsList().then(() => {
const obj = {
costAccessmentGuid:null,
daCode:row.daCode,
daName: row.daName,
documentFile: null,
documentType: 1,
effectiveDate: row.effectiveDate,
guid:row.guid,
issuingEntityGuid:row.issuingEntityGuid ,
issuingEntityName:row.issuingEntityName,
qualityEvaluationGuid: null,
registerGuid:row.registerGuid,
registerTime:row.registerTime,
state: row.state,
tenantGuid: row.companyGuid,
tenantName:row.companyName,
}
const arr = assetsOption.value
if(values&&values.tenantGuid===row.companyGuid) {
arr.unshift(obj)
assetsOption.value = arr
}else if(flag) {
arr.unshift(obj)
assetsOption.value = arr
}
costAccessmentGuid: null,
daCode: row.daCode,
daName: row.daName,
documentFile: null,
documentType: 1,
effectiveDate: row.effectiveDate,
guid: row.guid,
issuingEntityGuid: row.issuingEntityGuid,
issuingEntityName: row.issuingEntityName,
qualityEvaluationGuid: null,
registerGuid: row.registerGuid,
registerTime: row.registerTime,
state: row.state,
tenantGuid: row.companyGuid,
tenantName: row.companyName,
}
const arr = assetsOption.value
if (values && values.tenantGuid === row.companyGuid) {
arr.unshift(obj)
assetsOption.value = arr
} else if (flag) {
arr.unshift(obj)
assetsOption.value = arr
}
})
}
const addCompanyOption = (row) => {
let flag = true
documentList().then(()=>{
documentList().then(() => {
const obj = {
tenantName:row.companyName,
tenantGuid:row.companyGuid
}
const arr = companyOption.value
arr.forEach((item)=>{
if(item.tenantGuid===row.companyGuid){
flag = false
}
})
if(flag) {
arr.unshift(obj)
companyOption.value = arr
}
tenantName: row.companyName,
tenantGuid: row.companyGuid
}
const arr = companyOption.value
arr.forEach((item) => {
if (item.tenantGuid === row.companyGuid) {
flag = false
}
})
if (flag) {
arr.unshift(obj)
companyOption.value = arr
}
})
}
onBeforeMount(()=> {
onBeforeMount(() => {
//getTableData()
documentList()
// getAssetsList()
// documentList()
})
</script>
......@@ -468,19 +479,9 @@ onBeforeMount(()=> {
</div>
</div>
<div class="table_panel_wrap">
<Table
ref="tableRef"
:tableInfo="tableInfo"
:page="page"
:colums="colums"
v-model="columnInfo"
@pageChange="pageChange"
@columnSave="columnSave"
@columnDel="columnDel"
@columnEdit="columnEdit"
@columnCancel="columnCancel"
@handelSelect="handelSelect"
></Table>
<Table ref="tableRef" :tableInfo="tableInfo" :page="page" :colums="colums" v-model="columnInfo"
@pageChange="pageChange" @columnSave="columnSave" @columnDel="columnDel" @columnEdit="columnEdit"
@columnCancel="columnCancel" @handelSelect="handelSelect"></Table>
</div>
</div>
</template>
......@@ -490,5 +491,4 @@ onBeforeMount(()=> {
.container_wrap {
padding: 0 16px;
}
</style>
\ No newline at end of file
</style>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!