main
王文龙 2023-12-29 17:18:50 +08:00
parent 9abadc86d8
commit 14fec77952
10 changed files with 856 additions and 464 deletions

33
11.txt
View File

@ -48,6 +48,39 @@ urfhsdkjdwerwnvsojj
},
]
{
cateId:1,
uploadIds:[1,2,3],
reviewIds:[4,5,6]
}
{
id:1,
cateId:1,
cateName:'xxxx',
... 更新时间,修改时间等..
uploadIds:[
{ //上传者信息
id:1,
name:'xxxx',
... 用户信息
}
{
id:2,
name:'xxxx',
... 用户信息
},
...
],
reviewIds:[
{ //审核者信息
id:1,
name:'xxxx',
...审核者用户信息
}
...
]
}
审批流按钮权限对应显示

View File

@ -1,18 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="src/assets/images/favicon.svg">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>大金中国调达本部网站</title>
<style>
.n-modal-container {
z-index: 999!important;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" href="src/assets/images/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>大金中国调达本部网站</title>
<style>
.n-modal-container {
z-index: 999;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@ -21,6 +21,7 @@
"@vueuse/core": "^9.13.0",
"animate.css": "^4.1.1",
"axios": "^1.4.0",
"dayjs": "^1.11.10",
"echarts": "^5.4.3",
"echarts-liquidfill": "^3.1.0",
"element-plus": "^2.3.7",

View File

@ -1304,12 +1304,18 @@ export async function fetchGetViewScope(params?: any) {
export async function fetchdbAuthAdd(data?: any) {
return http.post(`/dbAuth/add`, data)
}
/**
* DB/ https://console-docs.apipost.cn/preview/9ac14c51f96ce4d8/75274687248efb1c?target_id=a11153dc-ab84-41ca-aa1c-45fda68c4156
*/
export async function fetchdbAuthDel(id?: any) {
return http.get(`/dbAuth/del?id=${id}`)
}
/**
* DB/ https://console-docs.apipost.cn/preview/9ac14c51f96ce4d8/75274687248efb1c?target_id=a11153dc-ab84-41ca-aa1c-45fda68c4156
*/
export async function fetchdbAuthGetInfo(params?: any) {
return http.get(`/dbAuth/getInfo`, { params })
return http.get(`/dbAuth/getPerUserList`, { params })
}
/**
* DB https://console-docs.apipost.cn/preview/9ac14c51f96ce4d8/75274687248efb1c?target_id=a11153dc-ab84-41ca-aa1c-45fda68c4156

View File

@ -1,170 +1,171 @@
<script setup lang="ts">
import { NDropdown, NPopover } from "naive-ui";
import { getAllNoticeList } from "@/api/daikin/base";
import { NDropdown, NPopover } from 'naive-ui'
import { getAllNoticeList } from '@/api/daikin/base'
import { useUserStore } from '@/stores/modules/user'
//
const { toggle } = inject<any>("fullscreen");
const { push } = useRouter();
const store = useUserStore();
const route = useRoute();
const noticeData = ref();
const flgs = ref(false);
const { toggle } = inject<any>('fullscreen')
const { push } = useRouter()
const store = useUserStore()
const route = useRoute()
const noticeData = ref()
const flgs = ref(false)
const userCode = ref(false)
async function getNoticeList() {
const { data } = await getAllNoticeList();
noticeData.value = data;
const { data } = await getAllNoticeList()
noticeData.value = data
console.log('🚀 ~ file: AppHeadUserInfo.vue:18 ~ data:', data)
}
onMounted(() => {
getNoticeList();
getNoticeList()
// console.log( flgs.value,flg)
});
// console.log( flgs.value,flg)
})
watchEffect(() => {
// console.log( flgs.value,store.user.type)
flgs.value = [1, 2, 3, 4].includes(store.user.type);
userCode.value = ['admin','tech_service'].includes(store.user.roleCode)
});
// console.log( flgs.value,store.user.type)
flgs.value = [1, 2, 3, 4].includes(store.user.type)
userCode.value = ['admin', 'tech_service'].includes(store.user.roleCode)
})
const options = [
{ label: "个人中心", key: "ucenter" },
,
{
label: "修改密码",
key: "ChangePWD",
props: {
onclick: () => {
console.log(route.path);
const pth = route.path === "/external" ? "modify" : "modifys";
push({ name: pth });
},
},
},
{
key: "logout",
label: "退出登录",
props: {
style: { width: "150px" },
onClick: () => {
store.LogOut();
},
},
},
];
const noticeShow = ref(false);
let showIs = false;
{ label: '个人中心', key: 'ucenter' },
,
{
label: '修改密码',
key: 'ChangePWD',
props: {
onclick: () => {
console.log(route.path)
const pth = route.path === '/external' ? 'modify' : 'modifys'
push({ name: pth })
}
}
},
{
key: 'logout',
label: '退出登录',
props: {
style: { width: '150px' },
onClick: () => {
store.LogOut()
}
}
}
]
const noticeShow = ref(false)
let showIs = false
//id1- 2- 3- 4-BCP 5- 6- 7-LAB
const goModeuls = (obj) => {
const { moduleId } = obj;
if (!moduleId) return;
switch (moduleId) {
case 1:
if (store.user.isReview === 1 || store.user.isPublish === 1) {
push("/Home/Process");
} else {
push("/Home/intelligence");
}
break;
case 2:
push({ name: "Market" });
break;
case 3:
push({ name: "CD" });
break;
case 4:
push({ name: "BCP" });
break;
case 5:
push({ name: "CSR" });
break;
case 6:
push({ name: "Quality" });
break;
case 7:
push({ name: "Diffspace" });
break;
case 9:
push({ name: "DataBaseReview" });
break;
default:
push("/Home/intelligence");
break;
}
};
const { moduleId } = obj
if (!moduleId) return
switch (moduleId) {
case 1:
if (store.user.isReview === 1 || store.user.isPublish === 1) {
push('/Home/Process')
} else {
push('/Home/intelligence')
}
break
case 2:
push({ name: 'Market' })
break
case 3:
push({ name: 'CD' })
break
case 4:
push({ name: 'BCP' })
break
case 5:
push({ name: 'CSR' })
break
case 6:
push({ name: 'Quality' })
break
case 7:
push({ name: 'Diffspace' })
break
case 9:
push({ name: 'DataBaseReview' })
break
default:
push('/Home/intelligence')
break
}
}
const noticeShows = () => {
if (noticeData.value && noticeData.value.length > 0) {
// console.log(noticeData.value)
noticeShow.value = !noticeShow.value;
}
};
if (noticeData.value && noticeData.value.length > 0) {
// console.log(noticeData.value)
noticeShow.value = !noticeShow.value
}
}
const toFootPrint = () => {
console.log(111)
push('/Home/footprint')
console.log(111)
push('/Home/footprint')
}
</script>
<template>
<div class="inline-flex items-center relative">
<!-- 足迹 -->
<!-- <div class="cursor-pointer w-40px h-40px z-200"> -->
<el-icon size="35" v-if="userCode" @click="toFootPrint" ><Platform /></el-icon>
<!-- </div> -->
<div class="inline-flex items-center relative">
<!-- 足迹 -->
<!-- <div class="cursor-pointer w-40px h-40px z-200"> -->
<el-icon size="35" v-if="userCode" @click="toFootPrint"
><Platform
/></el-icon>
<!-- </div> -->
<!-- 全屏小图标 -->
<div
size="40"
color="#ccc"
style="font-size: 20px; width: 30px; margin: 10px"
@click="toggle"
class="cursor-pointer"
>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 20 20"
<!-- 全屏小图标 -->
<div
size="40"
color="#ccc"
style="font-size: 20px; width: 30px; margin: 10px"
@click="toggle"
class="cursor-pointer"
>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 20 20"
>
<g fill="none">
<path
d="M3.75 3a.75.75 0 0 0-.75.75v3.5a.75.75 0 0 0 1.5 0V5.56l2.22 2.22a.75.75 0 0 0 1.06-1.06L5.56 4.5h1.69a.75.75 0 0 0 0-1.5h-3.5zm0 14a.75.75 0 0 1-.75-.75v-3.5a.75.75 0 0 1 1.5 0v1.69l2.22-2.22a.75.75 0 0 1 1.06 1.06L5.56 15.5h1.69a.75.75 0 0 1 0 1.5h-3.5zM17 3.75a.75.75 0 0 0-.75-.75h-3.5a.75.75 0 0 0 0 1.5h1.69l-2.22 2.22a.75.75 0 0 0 1.06 1.06l2.22-2.22v1.69a.75.75 0 0 0 1.5 0v-3.5zM16.25 17a.75.75 0 0 0 .75-.75v-3.5a.75.75 0 0 0-1.5 0v1.69l-2.22-2.22a.75.75 0 1 0-1.06 1.06l2.22 2.22h-1.69a.75.75 0 0 0 0 1.5h3.5z"
fill="currentColor"
></path>
</g>
</svg>
</div>
<div
v-if="flgs"
class="bg-#fff/20 b-1px b-solid b-#fff rd-12px flex items-center h-52px px12px cursor-pointer"
>
<div size="small" @click="noticeShows">
<img
src="../assets/images/tongzhi@2x.png"
class="w20px mr5px mt--5px"
/><span class="ml8px pl5px pr5px rounded-20px bg-#002FA7">{{
store.user.reviewCount ?? 0
}}</span>
</div>
<!-- 跳转到碳中和页面的 -->
<div class="notice" v-if="noticeShow">
<div
v-for="ite in noticeData"
class="p10px box flex justify-between"
v-if="noticeData"
@click="goModeuls(ite)"
>
<div>{{ ite.moduleName }}</div>
<span class="">{{ ite.moduleCount }}</span>
</div>
</div>
>
<g fill="none">
<path
d="M3.75 3a.75.75 0 0 0-.75.75v3.5a.75.75 0 0 0 1.5 0V5.56l2.22 2.22a.75.75 0 0 0 1.06-1.06L5.56 4.5h1.69a.75.75 0 0 0 0-1.5h-3.5zm0 14a.75.75 0 0 1-.75-.75v-3.5a.75.75 0 0 1 1.5 0v1.69l2.22-2.22a.75.75 0 0 1 1.06 1.06L5.56 15.5h1.69a.75.75 0 0 1 0 1.5h-3.5zM17 3.75a.75.75 0 0 0-.75-.75h-3.5a.75.75 0 0 0 0 1.5h1.69l-2.22 2.22a.75.75 0 0 0 1.06 1.06l2.22-2.22v1.69a.75.75 0 0 0 1.5 0v-3.5zM16.25 17a.75.75 0 0 0 .75-.75v-3.5a.75.75 0 0 0-1.5 0v1.69l-2.22-2.22a.75.75 0 1 0-1.06 1.06l2.22 2.22h-1.69a.75.75 0 0 0 0 1.5h3.5z"
fill="currentColor"
></path>
</g>
</svg>
</div>
<div
v-if="flgs"
class="bg-#fff/20 b-1px b-solid b-#fff rd-12px flex items-center h-52px px12px cursor-pointer"
>
<div size="small" @click="noticeShows">
<img
src="../assets/images/tongzhi@2x.png"
class="w20px mr5px mt--5px"
/><span class="ml8px pl5px pr5px rounded-20px bg-#002FA7">{{
store.user.reviewCount ?? 0
}}</span>
</div>
<!-- 跳转到碳中和页面的 -->
<div class="notice" v-if="noticeShow">
<div
v-for="ite in noticeData"
class="p10px box flex justify-between"
v-if="noticeData"
@click="goModeuls(ite)"
>
<div>{{ ite.moduleName }}</div>
<span class="">{{ ite.moduleCount }}</span>
</div>
</div>
<!-- 跳转到审批页面 -->
<!-- <div size="small">
<!-- 跳转到审批页面 -->
<!-- <div size="small">
新着通知
<span class="ml8px pl5px pr5px rounded-20px bg-#002FA7">{{
store.user.reviewCount ?? 0
}}</span>
</div> -->
<!-- <n-popover :overlap="false" placement="bottom-start" trigger="click">
<!-- <n-popover :overlap="false" placement="bottom-start" trigger="click">
<template #trigger>
<div size="small">
新着通知
@ -173,7 +174,7 @@ const toFootPrint = () => {
}}</span>
</div>
</template> -->
<!-- <div
<!-- <div
class="inline-flex items-center p10px cursor-pointer"
v-if="store.user.isReview === 1"
>
@ -205,60 +206,60 @@ const toFootPrint = () => {
>去查看</n-button
>
</div> -->
<!-- </n-popover> -->
</div>
<!-- 当前登录用户信息 -->
<NDropdown show-arrow placement="bottom-end" size="huge" :options="options">
<div class="cursor-pointer inline-flex items-center">
<img
src="@/assets/images/icon-user.svg"
class="ml40px mr16px w60px h60px"
/>
<!-- @click="toggle" -->
<span>{{ store.user.nikeName ?? "游客" }}</span>
<img src="@/assets/images/icon-more.svg" class="ml30px w13px" />
</div>
</NDropdown>
</div>
<!-- </n-popover> -->
</div>
<!-- 当前登录用户信息 -->
<NDropdown show-arrow placement="bottom-end" size="huge" :options="options">
<div class="cursor-pointer inline-flex items-center">
<img
src="@/assets/images/icon-user.svg"
class="ml40px mr16px w60px h60px"
/>
<!-- @click="toggle" -->
<span>{{ store.user.nikeName ?? '游客' }}</span>
<img src="@/assets/images/icon-more.svg" class="ml30px w13px" />
</div>
</NDropdown>
</div>
</template>
<style scoped lang="less">
.notice {
position: absolute;
top: 52px;
left: -3px;
width: 200px;
background: rgb(255, 255, 255);
max-height: 520px;
z-index: 500;
font-size: 18px;
border-radius: 15px;
padding: 10px;
color: rgb(26, 25, 25);
box-shadow: 1px 1px 5px 1px #d9d5d5;
.box:hover {
background: #e5e5e5;
border-radius: 5px;
color: #1836c3;
position: absolute;
top: 52px;
left: -3px;
width: 200px;
background: rgb(255, 255, 255);
max-height: 520px;
z-index: 500;
font-size: 18px;
border-radius: 15px;
padding: 10px;
color: rgb(26, 25, 25);
box-shadow: 1px 1px 5px 1px #d9d5d5;
.box:hover {
background: #e5e5e5;
border-radius: 5px;
color: #1836c3;
span {
color: #ffffff;
background: red;
}
}
span {
color: #ffffff;
background: red;
}
}
span {
color: #1836c3;
padding: 2px 7px;
border-radius: 50px;
}
span {
color: #1836c3;
padding: 2px 7px;
border-radius: 50px;
}
}
.popover-grid {
display: grid;
grid-template-columns: auto auto auto auto auto;
grid-gap: 12px;
justify-content: center;
align-items: center;
display: grid;
grid-template-columns: auto auto auto auto auto;
grid-gap: 12px;
justify-content: center;
align-items: center;
}
</style>

View File

@ -1,17 +1,14 @@
import { defineStore } from 'pinia'
export const databaseld = defineStore('database', () => {
const database = ref({
id:'',
})
function setDataId(data: { id: string }){
database.value = data
}
return { database,setDataId }
const database = ref({
id: '',
name: ''
})
})
function setDataId(data: { id: string }) {
database.value.id = data.id
}
return { database, setDataId }
})

View File

@ -180,7 +180,7 @@ function findItemById(
<div v-if="ite.childList && idx == index" class="pl10px">
<div
class="my30px pl10px text-#000"
class="my20px py-10px pl10px text-#000"
v-for="(it, ind) in ite.childList"
:key="item.id"
@click.stop="goChild(it)"

View File

@ -1,19 +1,21 @@
<template>
<div>
<DataBaseHead />
<div class="w-full h-1px bg-#507FFD mt50px rd-b-20px"></div>
<div class="relative w-full h-1px bg-#507FFD mt50px rd-b-20px">
<el-button
class="absolute z-200 right-30px top-[30px]"
v-if="isDbUpload || isDbReview"
type="warning"
@click="handleClick"
>
审批流程
</el-button>
</div>
<div class="bg-#fff rd-15px px30px pt30px w-full h920px">
<el-tabs v-model="activeName" class="demo-tabs">
<div class="absolute z-200 right-0 flex items-center">
<el-button
v-if="isDbUpload || isDbReview"
type="warning"
@click="handleClick"
>
审批流程
</el-button>
<div
class="rounded-md ml-50px px20px py10px z-200 bg-#f5f5f5 flex items-center justify-center w-100px"
class="cursor-pointer rounded-md ml-50px px20px py10px z-200 bg-#f5f5f5 flex items-center justify-center w-100px"
@click="goBacks"
>
<el-icon class="text-red"><ArrowLeftBold size="18" /></el-icon>
@ -57,7 +59,7 @@
<el-button
type="primary"
@click="editClickA('edit', scope.row)"
class="mb-20px"
class="my-10px"
>
编辑</el-button
>
@ -69,7 +71,7 @@
scope.row.level === 3
"
@click="editClickA('add', scope.row)"
class="mb-20px"
class="my-10px"
>
新增{{
scope.row.level === 1
@ -82,7 +84,7 @@
<el-button
type="danger"
@click="deleteClickA(scope.row)"
class="mb-20px"
class="my-10px"
>
删除</el-button
>
@ -109,24 +111,26 @@
>
查看所有</el-button
>
<el-button
v-if="userCode"
:type="setUpload ? 'success' : 'warning'"
:icon="setUpload ? 'Check' : ''"
@click="getUser({ type: 1 })"
class="mb-20px !ml-50px"
>
{{ setUpload ? '已设置上传人员' : '设置上传人员' }}</el-button
>
<el-button
v-if="userCode"
:type="setReview ? 'success' : 'warning'"
:icon="setReview ? 'Check' : ''"
@click="getUser({ type: 2 })"
class="mb-20px"
>
{{ setReview ? '已设置审批人员' : '设置审批人员' }}</el-button
>
<template v-if="false">
<el-button
v-if="userCode"
:type="setUpload ? 'success' : 'warning'"
:icon="setUpload ? 'Check' : ''"
@click="getUser({ type: 1 })"
class="mb-20px !ml-50px"
>
{{ setUpload ? '已设置上传人员' : '设置上传人员' }}</el-button
>
<el-button
v-if="userCode"
:type="setReview ? 'success' : 'warning'"
:icon="setReview ? 'Check' : ''"
@click="getUser({ type: 2 })"
class="mb-20px"
>
{{ setReview ? '已设置审批人员' : '设置审批人员' }}</el-button
>
</template>
</div>
<div class="w100% h750px overflow-auto">
<el-table
@ -136,6 +140,7 @@
row-key="id"
border
default-expand-all
height="710px"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
@ -201,7 +206,7 @@
</div>
</el-tooltip>
</p>
<span v-else>''</span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column
@ -214,19 +219,19 @@
<el-button
type="primary"
@click="editClickB('edit', scope.row)"
class="mb-20px w45px"
class="w45px my-10px"
>
编辑</el-button
>
<el-button
type="danger"
@click="deleteClickB(scope.row)"
class="mb-20px w45px"
class="w45px my-10px"
>
删除</el-button
>
<div
style="float: right"
style="float: right; margin: 10px 0"
v-if="
scope.$index !== 0 &&
scope.$index !== infoData.length - 1
@ -251,6 +256,178 @@
</el-table>
</div>
<div
class="float-right absolute bottom-0px right-30px z-2000 bg-#fff"
>
<el-pagination
v-model:current-page="pageInfo.currentPage"
v-model:page-size="pageInfo.pageSize"
layout="prev, pager, next, jumper"
:total="pageInfo.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</el-tab-pane>
<el-tab-pane label="权限管理" name="three" v-if="userCode">
<div class="h-52px">
<el-button
v-if="isDbReview || isDbUpload"
type="primary"
@click="handleAuthClick('add')"
class="mb-20px"
>
新增审批关系</el-button
>
</div>
<div class="w100% h750px overflow-auto">
<el-table
class="tableClass"
:data="authData"
style="width: 100%; margin-bottom: 20px"
row-key="id"
border
default-expand-all
height="710px"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
lineHeight: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center', 'overflow-y': 'auto' }"
>
<el-table-column
prop="cateName"
label="所属分类"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
label="上传人员"
prop="userIdList"
show-overflow-tooltip
>
<template #default="scope">
<p
v-if="scope.row.uploadList.length"
class="truncate text-ellipsis"
>
{{
scope.row.uploadList
.map((item: any) => item.nickName)
.join('、')
}}
<el-tooltip
v-if="false"
:content="handTooltip(scope.row.uploadList)"
placement="top"
>
<div class="!h-50px descStyle">
<div class="descStyle max-w-60vw !h-46px">
<p
v-for="(it, e) in scope.row.uploadList"
:key="e"
:class="
scope.row.uploadList.length < 2
? '!leading-46px'
: 'xx'
"
>
{{ it.nickName || undefined }}
<span
v-if="e == 1 && scope.row.uploadList.length > 2"
>...{{ scope.row.uploadList.length }}</span
>
</p>
</div>
</div>
</el-tooltip>
</p>
<span v-else></span>
</template>
</el-table-column>
<el-table-column
label="审批人员"
prop="userIdList"
show-overflow-tooltip
>
<template #default="scope">
<p
v-if="scope.row.reviewList.length"
class="truncate text-ellipsis"
>
{{
scope.row.reviewList
.map((item: any) => item.nickName)
.join('、')
}}
<el-tooltip
v-if="false"
:content="handTooltip(scope.row.reviewList)"
placement="top"
>
<div class="!h-50px descStyle">
<div class="descStyle max-w-60vw !h-46px">
<p
v-for="(it, e) in scope.row.reviewList"
:key="e"
:class="
scope.row.reviewList.length < 2
? '!leading-46px'
: 'xx'
"
>
{{ it.nickName || undefined }}
<span
v-if="e == 1 && scope.row.reviewList.length > 2"
>...{{ scope.row.reviewList.length }}</span
>
</p>
</div>
</div>
</el-tooltip>
</p>
<span v-else></span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作"
show-overflow-tooltip
width="180px"
>
<template #default="scope">
<div v-if="userCode">
<el-button
type="primary"
@click="handleAuthClick('edit', scope.row)"
class="w45px my-10px"
>
编辑</el-button
>
<el-popconfirm
title="确认删除此条数据?"
@confirm="handleAuthClick('del', scope.row)"
>
<template #reference>
<el-button
type="danger"
@click=""
class="w45px my-10px"
>
删除</el-button
>
</template>
</el-popconfirm>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div
class="float-right absolute bottom-0px right-30px z-2000 bg-#fff"
>
@ -338,6 +515,47 @@
</el-form>
</div>
</NModal>
<NModal v-model:show="showAuthModal">
<div class="bg-#FFF p30px">
<el-form :model="authModel" label-width="120px" :inline="true">
<el-form-item v-if="false" label="所属类别">
<el-cascader
:modelValue="authModel.cateIds"
:options="tableData"
@change="handleChange"
:props="{ children: 'childList', label: 'name', value: 'id' }"
/>
</el-form-item>
<br />
<el-form-item label="上传人员" class="w-300px">
<el-button
class="button"
@click="getUser({ userList: uploadIds, key: 'uploadIds' })"
:type="authModel.uploadIds?.length ? 'success' : ''"
:icon="authModel.uploadIds?.length ? 'Check' : ''"
>{{ authModel.uploadIds?.length ? '已设置' : '设置' }}</el-button
>
</el-form-item>
<br />
<el-form-item label="审核人员" class="w-300px">
<el-button
class="button"
@click="getUser({ userList: reviewIds, key: 'reviewIds' })"
:type="authModel.reviewIds?.length ? 'success' : ''"
:icon="authModel.reviewIds?.length ? 'Check' : ''"
>{{ authModel.reviewIds?.length ? '已设置' : '设置' }}</el-button
>
</el-form-item>
<br />
<br />
<div class="text-center">
<el-button type="primary" @click="handleSetAuth" class="mb-20px">
确认</el-button
>
</div>
</el-form>
</div>
</NModal>
<n-modal v-model:show="showModal" :z-index="99999">
<UserList
:userDataList="setUserList"
@ -360,7 +578,7 @@ import {
cateFileUpdate,
cateFileDel,
cateFileList,
download,
fetchdbAuthDel,
dragFile,
fetchdbAuthAdd,
fetchdbAuthGetInfo,
@ -374,14 +592,21 @@ const { push } = useRouter()
const database = databaseld()
const store: any = useUserStore()
const message = useMessage()
const userCode = ['admin', 'database_dandang'].includes(store.user.roleCode)
const userCode = computed(() =>
['admin', 'database_dandang', 'tech_service'].includes(store.user.roleCode)
)
// 'tech_service'
const isDbReview = store.user?.isDbReview === 1
const isDbUpload = store.user?.isDbUpload === 1
const tableData = ref([])
const tableDataAuth = ref([])
const infoData = ref()
const authData = ref()
const showAuthModal = ref(false)
const authModel = ref<any>({})
const cateIds = ref()
const shomkA = ref(false)
const editA = ref()
const shomkB = ref(false)
@ -392,17 +617,60 @@ const pageInfo = reactive({
pageSize: 10,
total: 10
})
const uploadIds = ref([])
const reviewIds = ref([])
const handleAuthClick = (type = '', data: any = {}) => {
if (type === 'add' || type === 'edit') {
delete authModel.value.id
const { cateId, uploadList = [], reviewList = [], id } = data
authModel.value.cateId = cateId
uploadIds.value = uploadList
reviewIds.value = reviewList
authModel.value.uploadIds = uploadList.map((item: any) => item.userId)
authModel.value.reviewIds = reviewList.map((item: any) => item.userId)
if (type === 'edit') authModel.value.id = id
showAuthModal.value = true
}
if (type === 'del') {
const { id } = data
if (!id) return
fetchdbAuthDel(id).then((res: any) => {
if (res.code === 200) {
getAuth()
message.success('操作成功')
}
})
}
}
const handleSetAuth = async () => {
const req = { ...unref(authModel), cateId: cateIds.value }
if (!req.uploadIds?.length) {
message.warning('最少选择1名上传人员')
return
}
if (!req.reviewIds?.length) {
message.warning('最少选择1名审核人员!')
return
}
const { code }: any = await fetchdbAuthAdd(req)
if (code === 200) {
getAuth()
showAuthModal.value = false
message.success('操作成功')
}
}
async function getTree() {
const { data } = await treeDbList({})
tableData.value = data
const { data: auth = [] } = await fetchReviewAuthCateList()
tableDataAuth.value = auth
}
let cateIds = ref()
watchEffect(() => {
activeName.value = userCode ? 'first' : 'second'
activeName.value = userCode.value ? unref(activeName) : 'second'
cateIds.value = database.database.id
// console.log(database.database.id)
console.log(database.database)
if (database.database.id) {
getInfo(database.database.id)
getAuth()
@ -479,7 +747,6 @@ async function addClickA(row: any) {
getTree()
}
const editClickB = (edit: any, obj: any = {}) => {
console.log(obj)
if (edit === 'add' && obj && obj.id) {
editB.value = {
title: '',
@ -616,7 +883,7 @@ const handOnExceed: UploadProps['onExceed'] = (
}
const header = { token: store.user.token }
const goBacks = (e) => {
const goBacks = () => {
// console.log(444)
history.back()
}
@ -624,17 +891,27 @@ const showModal = ref(false)
const flg = ref()
const setUserList = ref()
const dbAuthType = ref()
async function getUser(row: { id?: any; userList?: any; type?: number }) {
const selSetAuthKey = ref('')
async function getUser(row: {
id?: any
userList?: any
type?: number
key?: string
}) {
showModal.value = !showModal.value
flg.value = row
if (showAuthModal.value) {
setUserList.value = row.userList || []
selSetAuthKey.value = row.key || ''
}
if (row.id && row.userList) {
setUserList.value = row.userList
}
if (typeof row.type === 'number') {
dbAuthType.value = row.type
const { data: userArr } = await fetchdbAuthGetInfo({
cateId: cateIds.value,
type: row.type
cateId: cateIds.value
// type: row.type
})
setUserList.value = userArr
}
@ -649,6 +926,10 @@ const handleChild = async (data: any) => {
multipleSelection.value.forEach((i: { userId: any }) => {
userIdList.push(i.userId)
})
if (authModel.value && selSetAuthKey.value) {
authModel.value[selSetAuthKey.value] = userIdList
return
}
if (dbAuthType.value) {
const { code }: any = await fetchdbAuthAdd({
cateId: cateIds.value,
@ -745,20 +1026,12 @@ const setReview = ref(false)
const hasReview = ref(false)
async function getAuth() {
if (!cateIds.value) return
const { data: uploadUser = [] } = await fetchdbAuthGetInfo({
cateId: cateIds.value,
type: 1
const { rows: data = [] }: any = await fetchdbAuthGetInfo({
cateId: cateIds.value
// type: 1
})
setUpload.value = uploadUser.length > 0
hasUpload.value =
uploadUser.findIndex((x: any) => x.userId === store.user?.id) > -1
const { data: reviewUser = [] } = await fetchdbAuthGetInfo({
cateId: cateIds.value,
type: 2
})
setReview.value = reviewUser.length > 0
hasReview.value =
reviewUser.findIndex((x: any) => x.userId === store.user?.id) > -1
//
authData.value = data || []
}
const handleClick = () => {

View File

@ -52,11 +52,12 @@ onMounted(async ()=>{
const {data} =await getCurrencyList()
const {data:dat} =await getMetalList()
if(dat&&dat!='null'&&dat.length>0){
metal.value = dat.filter((item:any) => {
if(["Fe","lengmei"].includes(item.value)){
return false
}else return item
})
metal.value = dat
// .filter((item:any) => {
// if(["Fe","lengmei"].includes(item.value)){
// return false
// }else return item
// })
from.value.label.radio = dat[0].value
state4.number = dat[0].value
console.log("🚀 ~ file: Market.vue:56 ~ metal:", metal)
@ -294,7 +295,7 @@ async function getUser(moduleId: any) {
<span @click="tabShow(0)" class="title bg-#FF603A p5px pl10px pr20px">{{names}}<el-icon><CaretBottom /></el-icon></span>
<div v-if="tab" class="tab absolute bg-#fff w100px top-50px z-50 text-#112144 text-center leading-28px text-18px ">
<div v-if="metal" v-for="im in metal" class="py5px !rounded-none" :data-id="im.value" @click="tabClick" >{{im.title}}</div>
<div v-if="metal" v-for="im in metal.filter((item:any) => !['Fe','lengmei'].includes(item.value))" class="py5px !rounded-none" :data-id="im.value" @click="tabClick" >{{im.title}}</div>
<!-- <div class="py5px !rounded-none" data-id="Fe" @click="tabClick">Fe</div>
<div class="py5px !rounded-none" data-id="Cu" @click="tabClick">Cu</div>

View File

@ -5,238 +5,305 @@ import HomeHead from '@/views/home/components/HomeHead.vue'
import { useMessage, NModal } from 'naive-ui'
import { useUserStore } from '@/stores/modules/user'
import UserList from '@/views/home/intelligence/process/UserPages.vue'
import dayjs from 'dayjs'
import { fetchDelHis,marketPreADD,getMetalList,fetchGetHisPage,fetchUpdateHis,fetchSaveHis } from '@/api/daikin/base'
import {
fetchDelHis,
marketPreADD,
getMetalList,
fetchGetHisPage,
fetchUpdateHis,
fetchSaveHis
} from '@/api/daikin/base'
const message = useMessage()
const store = useUserStore()
const header = { 'token': store.user.token }
const header = { token: store.user.token }
const dataA = ref<any>([])
const editA = ref()
const editA = ref<any>({ stDateList: [] })
const metaList = ref<any>([])
const metaObj = ref<any>({})
const stDateList = ref<any>([])
const shomkA = ref(false)
const type =ref(2)
const type = ref(2)
async function getDataA() {
const {data} = await fetchGetHisPage({})
dataA.value = Object.entries(data).map(([key, value]:any) => {
const { data } = await fetchGetHisPage({})
dataA.value = Object.entries(data).map(([key, value]: any) => {
return {
stDate: key,
yearId: key,
children: value.map((item: any) => {
return {
...item,
numbers:metaObj.value[item.number]
}
})
children: value.map((item: any) => {
return {
...item,
numbers: metaObj.value[item.number]
}
})
}
})
// setDataFiles(dataArr);
// setDataFiles(dataArr);
}
onMounted(async () => {
const {data = []} = await getMetalList()
metaList.value = data
data.forEach((item: any) => {
metaObj.value[item.value] = item.title
})
getDataA();
const { data = [] } = await getMetalList()
metaList.value = data
data.forEach((item: any) => {
metaObj.value[item.value] = item.title
})
getDataA()
})
async function onSubmitA(row: { id: any; fileList?: any; title?: any }) {
console.log(row, 555)
const { id, title } = row
// let moduleId = 1;
let sendData= {}
if(!row.id){
sendData = { title,type:type.value,userIdList:userData.value };
if (row.fileList && row.fileList.length > 0) {
row.fileList.map(item => {
if(item.response) {
sendData.filePath = item.response.url;
// obj.title = title || computedName(item.response.originalFilename);
}
else {
sendData.filePath = item.url;
// obj.title = title || computedName(item.originalFilename);
}
})
}
console.log(row, 555)
const { id, title } = row
// let moduleId = 1;
let sendData = {}
if (!row.id) {
sendData = { title, type: type.value, userIdList: userData.value }
if (row.fileList && row.fileList.length > 0) {
row.fileList.map((item) => {
if (item.response) {
sendData.filePath = item.response.url
// obj.title = title || computedName(item.response.originalFilename);
} else {
sendData.filePath = item.url
// obj.title = title || computedName(item.originalFilename);
}
})
}
} else {
sendData = { id, title, type: type.value, userIdList: userData.value }
}
const { code, msg } = await marketPreADD(sendData)
if (code === 200) {
message.success('修改成功!')
} else {
message.error(msg)
}
shomkA.value = false
getDataA()
}
else{
sendData = {id, title,type:type.value,userIdList:userData.value };
}
const {code,msg} = await marketPreADD(sendData)
if (code === 200) { message.success("修改成功!") }
else { message.error(msg) }
shomkA.value = false
getDataA();
}
const handleEditA = (type: string, row: any = {}) => {
if (!row) return
editA.value = {...row}
// setUserList.value =[]
shomkA.value = true
if (!row) return
editA.value = { ...row }
editA.value.stDateList = [row.stDate, row.stDate]
stDateList.value = [row.stDate, row.stDate]
// setUserList.value =[]
shomkA.value = true
// editA.value.fileList = [{
// name: row.title,
// originalFilename: row.title,
// url: row.filePath,
// }]
// setUserList.value =row.userIdList
// editA.value.fileList = [{
// name: row.title,
// originalFilename: row.title,
// url: row.filePath,
// }]
// setUserList.value =row.userIdList
}
async function handleDeleteA(index: number, row: any) {
const { id } = row
if (!id) return
const { code, msg } = await fetchDelHis({ id,type:type.value })
if (code === 200) { message.success("删除成功!") }
else { message.error(msg) }
getDataA();
const { id } = row
if (!id) return
const { code, msg } = await fetchDelHis({ id, type: type.value })
if (code === 200) {
message.success('删除成功!')
} else {
message.error(msg)
}
getDataA()
}
const showModal = ref(false)
const flg = ref()
const setUserList =ref()
const setUserList = ref()
async function getUser(row) {
console.log(row)
showModal.value = !showModal.value
flg.value = row
if(row.id&&row.userIdList){
setUserList.value = row.userIdList
}
// const {data: userArr} = await getBPCUser({moduleId})
// setUserList.value = userArr
console.log(row)
showModal.value = !showModal.value
flg.value = row
if (row.id && row.userIdList) {
setUserList.value = row.userIdList
}
// const {data: userArr} = await getBPCUser({moduleId})
// setUserList.value = userArr
}
//
const userData = ref()
const handleChild = (data: any) => {
console.log(data, 444);
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
let userIdList: any[] =[]
multipleSelection.value.forEach((i: { userId: any })=>{
userIdList.push(i.userId)
})
if(flg.value.id){
flg.value.userIdList = userIdList
marketPreADD(flg.value)
getDataA();
console.log(flg.value)
}
userData.value = userIdList
}
const CloseThiss = (data: boolean)=>{
showModal.value = data
}
const goBacks = () => {
//
const userData = ref()
const handleChild = (data: any) => {
const { showModal: show, multipleSelection } = data
showModal.value = unref(show)
let userIdList: any[] = []
multipleSelection.value.forEach((i: { userId: any }) => {
userIdList.push(i.userId)
})
if (flg.value.id) {
flg.value.userIdList = userIdList
marketPreADD(flg.value)
getDataA()
console.log(flg.value)
}
userData.value = userIdList
}
const CloseThiss = (data: boolean) => {
showModal.value = data
}
const goBacks = () => {
history.back()
}
const editForm = ref(null)
const channelList = ref([{
label:'LME',
value:'LME'
},
{
label:'SMM',
value:'SMM'
}])
const channelList = ref([
{
label: 'LME',
value: 'LME'
},
{
label: 'SMM',
value: 'SMM'
}
])
const handleClickA = async () => {
let res:any = {}
if(editA.value.id){
res = await fetchUpdateHis(editA.value)
}else{
res = await fetchSaveHis(editA.value)
}
if(res.code == 200){
shomkA.value = false
message.success("操作成功!")
getDataA();
}else{
message.error(res.msg)
}
if (stDateList.length == 0) {
message.error('请选择日期!')
return
}
const req = { ...editA.value }
req.stDateList = generateDateRange()
console.log('🚀 ~ file: dataModify.vue:173 ~ req:', req)
let res: any = await fetchSaveHis(req)
if (res.code == 200) {
shomkA.value = false
message.success('操作成功!')
getDataA()
} else {
message.error(res.msg)
}
}
function generateDateRange() {
const [startDate, endDate] = stDateList.value || []
if (!startDate || !endDate) return []
const dateFormat = 'YYYY-MM-DD'
const dates = []
const start = dayjs(startDate, dateFormat)
const end = dayjs(endDate, dateFormat)
//
dates.push(start.format(dateFormat))
//
let currentDate = start
while (currentDate.isSameOrBefore(end)) {
currentDate = currentDate.add(1, 'day')
dates.push(currentDate.format(dateFormat))
}
return dates
}
</script>
<template>
<HomeHead class="top">
<template #content>
<!-- <HomeHeadSearch /> -->
</template>
</HomeHead>
<AppBlock class="w-full h950px p30px text-#000">
<div class="font-600 flex items-center">
<!-- <img src="./images/logo.svg" class="h56px mr21px" /> -->
<div class="text-36px text-#000">市况数据管理</div>
</div>
<div class=" cont relative w100% h800px overflow-y-auto">
<el-button type="primary" @click="handleEditA" class="my20px">市况数据新增</el-button>
<div
class="rounded-md float-right mr-80px mt-20px px20px py10px z-200 bg-#f5f5f5 flex items-center justify-center w-100px"
@click="goBacks"
>
<el-icon><ArrowLeftBold size="18" /></el-icon>
</div>
<el-table :data="dataA" style="width: 95%" row-key="id"
:header-cell-style="{ background: '#2A7BF7', color: '#fff', height: '60px', textAlign: 'center', 'font-size': '24px' }"
:cell-style="{ 'text-align': 'center' }">
<el-table-column label="日期" prop="stDate" />
<el-table-column label="渠道" prop="channel" />
<el-table-column label="编号" prop="numbers" />
<el-table-column label="金额" prop="negAmount" />
<HomeHead class="top">
<template #content>
<!-- <HomeHeadSearch /> -->
</template>
</HomeHead>
<AppBlock class="w-full h950px p30px text-#000">
<div class="font-600 flex items-center">
<!-- <img src="./images/logo.svg" class="h56px mr21px" /> -->
<div class="text-36px text-#000">市况数据管理</div>
</div>
<div class="cont relative w100% h800px overflow-y-auto">
<el-button type="primary" @click="handleEditA" class="my20px"
>市况数据新增</el-button
>
<div
class="rounded-md float-right mr-80px mt-20px px20px py10px z-200 bg-#f5f5f5 flex items-center justify-center w-100px"
@click="goBacks"
>
<el-icon><ArrowLeftBold size="18" /></el-icon>
</div>
<el-table
:data="dataA"
style="width: 95%"
row-key="yearId"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
textAlign: 'center',
'font-size': '24px'
}"
:cell-style="{ 'text-align': 'center' }"
height="700px"
>
<el-table-column label="日期" prop="stDate" />
<el-table-column label="渠道" prop="channel" />
<el-table-column label="编号" prop="numbers" />
<el-table-column label="金额" prop="negAmount" />
<!-- <el-table-column label="查看范围" prop="userIdList">
<!-- <el-table-column label="查看范围" prop="userIdList">
<template #default="scope">
<span v-if="scope.row.userIdList" v-for="it in scope.row.userIdList"> &nbsp;&nbsp; {{it.nickName}}</span>
</template>
</el-table-column> -->
<el-table-column label="操作" width="180px">
<template #default="scope">
<template v-if="!scope.row.children?.length">
<el-button size="small" @click="handleEditA('edit', scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDeleteA(scope.$index, scope.row)">删除</el-button>
</template>
</template>
</el-table-column>
</el-table>
</div>
</AppBlock>
<el-table-column label="操作" width="180px">
<template #default="scope">
<template v-if="!scope.row.children?.length">
<el-button size="small" @click="handleEditA('edit', scope.row)"
>编辑</el-button
>
<el-button
size="small"
type="danger"
@click="handleDeleteA(scope.$index, scope.row)"
>删除</el-button
>
</template>
</template>
</el-table-column>
</el-table>
</div>
</AppBlock>
<el-dialog
<el-dialog
:z-index="200"
v-model="shomkA"
title=" "
width="30%"
title=" "
width="30%"
:modal="false"
top="30vh"
@close="editForm?.resetFields()"
>
>
<div class="bg-#FFF">
<el-form ref="editForm" :model="editA" label-width="100px" size="large">
<el-form-item label="日期" prop="stDate">
<el-date-picker
<!-- <el-date-picker
class="!w-90%"
v-model="editA.stDate"
type="date"
placeholder="选择日期"
value-format="YYYY-MM-DD"
/> -->
<el-date-picker
v-model="stDateList"
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="YYYY-MM-DD"
class="!w-90%"
/>
</el-form-item>
<br />
<el-form-item label="渠道" prop="channel">
<el-select :disabled="editA.id" v-model="editA.channel" placeholder="选择渠道" class="!w-90%">
<el-select
:disabled="editA.id"
v-model="editA.channel"
placeholder="选择渠道"
class="!w-100%"
>
<el-option
v-for="item in channelList"
:key="item.value"
@ -247,7 +314,12 @@ const handleClickA = async () => {
</el-form-item>
<br />
<el-form-item label="编号" prop="number">
<el-select :disabled="editA.id" v-model="editA.number" placeholder="选择类型" class="!w-90%">
<el-select
:disabled="editA.id"
v-model="editA.number"
placeholder="选择类型"
class="!w-100%"
>
<el-option
v-for="item in metaList"
:key="item.value"
@ -261,12 +333,16 @@ const handleClickA = async () => {
<el-input-number
v-model="editA.negAmount"
:controls="false"
class="!w-90%"
class="!w-100%"
/>
</el-form-item>
<br />
<div class="text-center">
<el-button type="primary" @click="handleClickA(editA)" class="mb-20px">
<el-button
type="primary"
@click="handleClickA(editA)"
class="mb-20px"
>
确认</el-button
>
</div>
@ -274,34 +350,38 @@ const handleClickA = async () => {
</div>
</el-dialog>
<n-modal v-model:show="showModal">
<UserList :userDataList="setUserList" @clickChild="handleChild" @CloseThis="CloseThiss"/>
</n-modal>
<n-modal v-model:show="showModal">
<UserList
:userDataList="setUserList"
@clickChild="handleChild"
@CloseThis="CloseThiss"
/>
</n-modal>
</template>
<style lang="less" scoped>
.demo-tabs > .el-tabs__content {
color: #6b778c;
font-size: 32px;
font-weight: 600;
color: #6b778c;
font-size: 32px;
font-weight: 600;
}
.top {
position: absolute;
right: 30px;
top: -92px;
position: absolute;
right: 30px;
top: -92px;
}
.flex-center {
display: flex;
justify-content: center;
margin: 0 auto;
display: flex;
justify-content: center;
margin: 0 auto;
}
:deep(.el-input-number .el-input__inner){
:deep(.el-input-number .el-input__inner) {
text-align: left !important;
}
:deep{
.el-dialog__body{
:deep {
.el-dialog__body {
margin-top: 18px;
padding-top: 10px;
}
}
</style>
</style>