# frontend/src/views/home/components/table.vue

#	frontend/src/views/home/tabs/dashboard.vue
#	frontend/src/views/system/dictionary/dictTree/index.vue
This commit is contained in:
sjl
2024-11-14 18:30:53 +08:00
8 changed files with 157 additions and 41 deletions

View File

@@ -184,7 +184,7 @@ const planData = ref<Plan.PlanAndSourceBO[]>([
'id': '2', 'id': '2',
'name': '检测计划2', 'name': '检测计划2',
'pattern':'1', 'pattern':'1',
"testSourceName":'高精度设备-PQV520-1,高精度设备-PQV520-2', "testSourceName":'高精度设备-PQV520-1',
'father_Plan_Id':'1', 'father_Plan_Id':'1',
'dataSource_Id':'2', 'dataSource_Id':'2',
'script_Id':'2', 'script_Id':'2',
@@ -193,7 +193,7 @@ const planData = ref<Plan.PlanAndSourceBO[]>([
'report_State':'2', 'report_State':'2',
'result':'0', 'result':'0',
"testSourceList":[ "testSourceList":[
'高精度设备-PQV520-1','高精度设备-PQV520-2', '高精度设备-PQV520-2','高精度设备-PQV520-3','高精度设备-PQV520-3'
] ]
}, },
{ {

View File

@@ -1,4 +1,4 @@
import { isArray } from '@/utils/is' import { isArray, isNumber } from '@/utils/is'
import { FieldNamesProps } from '@/components/ProTable/interface' import { FieldNamesProps } from '@/components/ProTable/interface'
const mode = import.meta.env.VITE_ROUTER_MODE const mode = import.meta.env.VITE_ROUTER_MODE
@@ -239,7 +239,8 @@ export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNa
export function formatTableColumn(row: number, col: number, callValue: any) { export function formatTableColumn(row: number, col: number, callValue: any) {
// 如果当前值为数组,使用 / 拼接(根据需求自定义) // 如果当前值为数组,使用 / 拼接(根据需求自定义)
if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/' if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/'
return (callValue && callValue.length > 0) ? callValue : '/' if (isNumber(callValue)) return callValue
return callValue ?? "/";
} }
/** /**
@@ -250,7 +251,8 @@ export function formatTableColumn(row: number, col: number, callValue: any) {
export function formatValue(callValue: any) { export function formatValue(callValue: any) {
// 如果当前值为数组,使用 / 拼接(根据需求自定义) // 如果当前值为数组,使用 / 拼接(根据需求自定义)
if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/' if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/'
return (callValue && callValue.length > 0) ? callValue : '/' if (isNumber(callValue)) return callValue
return callValue ?? "/";
} }
/** /**

View File

@@ -71,11 +71,11 @@
> >
<el-button type="primary" v-if="form.activeTabs === 3" <el-button type="primary" v-if="form.activeTabs === 3"
>报告批量生成</el-button >批量生成</el-button
> >
<el-button type="primary" v-if="form.activeTabs === 4" <el-button type="primary" v-if="form.activeTabs === 4"
>设备批量归档</el-button >批量归档</el-button
> >
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -86,9 +86,40 @@
type="primary" type="primary"
link link
:icon="View" :icon="View"
@click="openDrawer('报告查看', scope.row)" @click="openDrawer('查看', scope.row)"
v-if="form.activeTabs === 3 && form.activeChildTabs === 0"
>查看</el-button
>
<div class='cn-render-buttons' v-if="form.activeTabs === 3 && form.activeChildTabs === 1">
<el-dropdown trigger='click'>
<el-button link type='primary' :icon="View" class='table-operate'>
<div class='table-operate-text'>查看...</div>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>Q/GDW 10650.2-2021 报告</el-dropdown-item>
<el-dropdown-item>Q/GDW 1650.2-2016 报告</el-dropdown-item>
<el-dropdown-item>GBT 19862-2016 报告</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<el-button
type="primary"
link
:icon="EditPen"
@click="openDrawer('生成', scope.row)"
v-if="form.activeTabs === 3" v-if="form.activeTabs === 3"
>报告查看</el-button >生成</el-button
>
<el-button
type="primary"
link
:icon="EditPen"
@click="openDrawer('归档', scope.row)"
v-if="form.activeTabs === 4"
>归档</el-button
> >
<el-button <el-button
type="primary" type="primary"
@@ -114,7 +145,7 @@
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import type { Device } from '@/api/device/interface' import type { Device } from '@/api/device/interface'
import { useHandleData } from "@/hooks/useHandleData"; import { useHandleData } from "@/hooks/useHandleData";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox, ElLoading} from "element-plus";
import ProTable from "@/components/ProTable/index.vue"; import ProTable from "@/components/ProTable/index.vue";
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface' import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
import { import {
@@ -245,6 +276,7 @@ let checkResultList = reactive([
//查询条件 //查询条件
const form: any = ref({ const form: any = ref({
activeTabs: 0, //功能选择 activeTabs: 0, //功能选择
activeChildTabs: 0,//子功能选择
checkStatus: 0, //检测状态 checkStatus: 0, //检测状态
checkReportStatus: 0, //检测报告状态 checkReportStatus: 0, //检测报告状态
checkResult: 0, //检测结果 checkResult: 0, //检测结果
@@ -552,10 +584,15 @@ const changeStatus = async (row: User.ResUserList) => {
proTable.value?.getTableList(); proTable.value?.getTableList();
}; };
//顶部功能切换时修改activeTabs //顶部功能切换时修改activeTabs
const changeActiveTabs = (val: number) => { const changeActiveTabs = (val: number,val2: number) => {
form.value.activeTabs = val; form.value.activeTabs = val;
form.value.activeChildTabs= val2;
tableHeaderInit(val) tableHeaderInit(val)
<<<<<<< HEAD
//console.log(form,val,666) //console.log(form,val,666)
=======
console.log(form,val,val2,666)
>>>>>>> 12201e065fe575761995440a3bf1e9876321c6e6
}; };
//根据当前功能,初始化表头下拉框中的默认值和禁用值 //根据当前功能,初始化表头下拉框中的默认值和禁用值
@@ -600,7 +637,7 @@ function tableHeaderInit(val: number) {
disableCheckStatus("归档") disableCheckStatus("归档")
disableCheckReportStatus("未生成报告") disableCheckReportStatus("未生成报告")
disablecheckResultList("未出结果") disablecheckResultList("未出结果")
operationShow.value = false; operationShow.value = true;
break; break;
case 5://设备浏览 case 5://设备浏览
operationShow.value = true; operationShow.value = true;
@@ -663,14 +700,35 @@ const handleTest = () => {
} }
}; };
// 打开 drawer(新增、查看、编辑) // 打开 drawer(新增、查看、编辑)
const openDrawer = (title: string, row: any) => { const openDrawer = (title: string, row: any) => {
if (title === '报告查看') if (title === '查看')
console.log(title); {
console.log(title);
const link = document.createElement('a');
const fileUrl = 'G:/南网数研院非结构化数据生成程序MMS_JSON修改记录.docx'; // 文件路径
link.href = fileUrl;
link.target = '_blank'; // 在新标签页中打开
link.download = 'file.docx'; // 设置下载文件的名称
link.click();
}
else if (title === '误差体系编辑') else if (title === '误差体系编辑')
console.log(title); console.log(title);
if (title === '归档')
{
const loading = ElLoading.service({
lock: true,
text: '归档中...',
background: 'rgba(0, 0, 0, 0.7)',
})
setTimeout(() => {
loading.close()
ElMessage.success("归档成功");
}, 2000)
}
} }
onMounted(() => { onMounted(() => {

View File

@@ -112,7 +112,8 @@ import Table from "../components/table.vue";
import { data } from "@/api/plan/static.json"; import { data } from "@/api/plan/static.json";
const treeRef = ref(); const treeRef = ref();
const form: any = ref({ const form: any = ref({
activeTabs: 0, //功能选择 activeTabs: 0, //功能选择,例如报告生成
activeChildTabs: 0,//子功能选择,例如未检设备报告生成,或已检设备更换误差体系生成
checkStatus: 0, //检测状态 checkStatus: 0, //检测状态
checkReportStatus: 0, //检测报告状态 checkReportStatus: 0, //检测报告状态
checkResult: 0, //检测结果 checkResult: 0, //检测结果
@@ -132,7 +133,12 @@ const handleChange = (val: string[]) => {
const handleTabsChange = (val) => { const handleTabsChange = (val) => {
form.value.activeTabs = 0; form.value.activeTabs = 0;
form.value.activeTabs = 3; form.value.activeTabs = 3;
<<<<<<< HEAD
// console.log(val) // console.log(val)
=======
form.value.activeChildTabs = Number(val);
console.log(val)
>>>>>>> 12201e065fe575761995440a3bf1e9876321c6e6
} }
localStorage.setItem("color", "red"); localStorage.setItem("color", "red");
//功能选择数据 //功能选择数据
@@ -207,7 +213,7 @@ watch(
() => form.value, () => form.value,
(val, oldVal) => { (val, oldVal) => {
if (val) { if (val) {
tableRef1.value && tableRef1.value.changeActiveTabs(form.value.activeTabs); tableRef1.value && tableRef1.value.changeActiveTabs(form.value.activeTabs,form.value.activeChildTabs);
} }
}, },
{ {
@@ -219,7 +225,8 @@ watch(
() => form.value, () => form.value,
(val, oldVal) => { (val, oldVal) => {
if (val) { if (val) {
tableRef2.value && tableRef2.value.changeActiveTabs(form.value.activeTabs); tableRef2.value && tableRef2.value.changeActiveTabs(form.value.activeTabs,form.value.activeChildTabs);
console.log(form.value.activeTabs,form.value.activeChildTabs);
} }
}, },
{ {
@@ -281,6 +288,7 @@ const planDetail = () => {
const handleCheckFunction = (val: any) => { const handleCheckFunction = (val: any) => {
// console.log("test",val); // console.log("test",val);
editableTabsValue.value = '0'; editableTabsValue.value = '0';
form.value.activeChildTabs = 0;
tabsList.value.map((item: any, index: any) => { tabsList.value.map((item: any, index: any) => {
if (val == item.value) { if (val == item.value) {
item.checked = true; item.checked = true;
@@ -293,7 +301,7 @@ const handleCheckFunction = (val: any) => {
switch (val) { switch (val) {
case 0://自动检测 case 0://自动检测
tabLabel1.value = "自动检测"; tabLabel1.value = "设备检测";
break; break;
case 1://手动检测 case 1://手动检测
tabLabel1.value = "手动检测"; tabLabel1.value = "手动检测";
@@ -398,6 +406,7 @@ onMounted(() => {
.item_text { .item_text {
p { p {
width: 40px;
margin: 0; margin: 0;
font-weight: 800; font-weight: 800;
color: var(--el-color-primary); color: var(--el-color-primary);

View File

@@ -1,24 +1,55 @@
<template> <template>
<el-dropdown @command="handleCommand"> <div class="device-list-container">
<span class="el-dropdown-link"> <!-- :model-value="visible" -->
<el-dropdown @command="handleCommand" >
<el-button link type='primary' class='table-operate'>
<div class='table-operate-text'>更多...</div>
</el-button>
<!-- <span class="el-dropdown-link">
更多<el-icon class="el-icon--right"><arrow-down /></el-icon> 更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
</span> </span> -->
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item command="a">高精度设备-PQV520-2</el-dropdown-item> <el-dropdown-item command="高精度设备-PQV520-2">高精度设备-PQV520-2</el-dropdown-item>
<el-dropdown-item command="b">高精度设备-PQV520-3</el-dropdown-item> <el-dropdown-item command="高精度设备-PQV520-3">高精度设备-PQV520-3</el-dropdown-item>
<el-dropdown-item command="c">高精度设备-PQV520-4</el-dropdown-item> <el-dropdown-item command="高精度设备-PQV520-4">高精度设备-PQV520-4</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
</template>
<!-- 查看误差体系详细信息 -->
<ErrorStandardDialog
:visible='detail_dialogFormVisible'
:formData='detail_dialogForm'
:dialogTitle='detail_dialogTitle'
@update:visible='detail_dialogFormVisible = $event'
/>
</div>
</template>
<script lang="ts" setup> <script lang="ts" setup>
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { ArrowDown } from '@element-plus/icons-vue' import { ArrowDown } from '@element-plus/icons-vue'
import ErrorStandardDialog from '@/views/machine/errorSystem/components/ErrorStandardDialog.vue' // 导入子组件
import type { ErrorSystem } from '@/api/error/interface'
const detail_dialogFormVisible = ref(false)
const detail_dialogTitle = ref('Q/GDW 10650.2-2021 误差体系')
const detail_dialogForm = ref<ErrorSystem.Error_detail>({
measured: '',//被测量
deviceLevel: '',//检测装置级别
measurementType: '',
condition: '',//测量条件
maxErrorValue: '',//最大误差
})
// const props = defineProps<{
// visible: boolean;
// }>();
const handleCommand = (command: string | number | object) => { const handleCommand = (command: string | number | object) => {
ElMessage(`click on item ${command}`) detail_dialogTitle.value = command as string;
detail_dialogFormVisible.value = true // 显示对话框
} }
</script> </script>
<style scoped> <style scoped>

View File

@@ -45,8 +45,14 @@
</template> </template>
</ProTable> </ProTable>
@update:visible="dialogFormVisible = $event"/> <!-- 向计划导入/导出设备对话框 -->
<planPopup
:visible="dialogFormVisible"
:formData="dialogForm"
:dialogTitle="dialogTitle"
:is-read-only="isReadOnly"
@update:visible="dialogFormVisible = $event"
/>
<!-- 查看误差体系详细信息 --> <!-- 查看误差体系详细信息 -->
<ErrorStandardDialog <ErrorStandardDialog
:visible='detail_dialogFormVisible' :visible='detail_dialogFormVisible'
@@ -89,7 +95,7 @@ import type { Plan } from '@/api/plan/interface'
import planPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件 import planPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue' import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
import SourceOpen from '@/views/plan/planList/components/sourcePopup.vue' import SourceOpen from '@/views/plan/planList/components/sourcePopup.vue'
import temp from './components/temp.vue' import Temp from './components/Temp.vue'
import devTransfer from './components/devTransfer.vue' import devTransfer from './components/devTransfer.vue'
import sourceTransfer from './components/sourceTransfer.vue' import sourceTransfer from './components/sourceTransfer.vue'
import { useViewSize } from '@/hooks/useViewSize' import { useViewSize } from '@/hooks/useViewSize'
@@ -142,6 +148,14 @@ const detail_dialogForm = ref<ErrorSystem.Error_detail>({
maxErrorValue: '',//最大误差 maxErrorValue: '',//最大误差
}) })
// <el-button
// v-for="(button, index) in scope.row.testSourceList"
// :key="index"
// @click="handleClick(button)"
// >
// {{ button.text }}
// </el-button>
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([ const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
{ type: 'selection', fixed: 'left', width: 70 }, { type: 'selection', fixed: 'left', width: 70 },
@@ -158,19 +172,15 @@ const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
width: 300, width: 300,
render: scope => { render: scope => {
return ( return (
// <el-button
// v-for="(button, index) in scope.row.testSourceList"
// :key="index"
// @click="handleClick(button)"
// >
// {{ button.text }}
// </el-button>
<div class='flx-flex-start'> <div class='flx-flex-start'>
<el-button type='primary' link onClick={() => showData(scope.row.testSourceName)}> <el-button type='primary' link onClick={() => showData(scope.row.testSourceName)}>
{scope.row.testSourceName} {scope.row.testSourceName}
</el-button> </el-button>
<temp></temp> <Temp></Temp>
</div> </div>
// <Temp { visible: scope.row.testSourceList.length > 1 }></Temp>
// <Temp :visible='{scope.row.testSourceList.length > 1}'></Temp>
// <Temp :visible="scope.row.testSourceList.length > 1"></Temp>
) )
}, },

View File

@@ -32,9 +32,7 @@
import { ElMessage, type FormItemRule } from 'element-plus' import { ElMessage, type FormItemRule } from 'element-plus'
import { addDictTree, updateDictTree } from '@/api/system/dictionary/dictTree' import { addDictTree, updateDictTree } from '@/api/system/dictionary/dictTree'
import { computed, type Ref, ref } from 'vue'; import { computed, type Ref, ref } from 'vue';
import { useDictStore } from '@/stores/modules/dict'
import { type ResultData } from '@/api/interface'; import { type ResultData } from '@/api/interface';
const dictStore = useDictStore()
// 定义弹出组件元信息 // 定义弹出组件元信息
const dialogFormRef = ref() const dialogFormRef = ref()
function useMetaInfo() { function useMetaInfo() {

View File

@@ -21,7 +21,7 @@
</template> </template>
<script setup lang='tsx' name='dict'> <script setup lang='tsx' name='dict'>
import {CirclePlus, Delete, EditPen, Download, View} from '@element-plus/icons-vue' import {CirclePlus, Delete, EditPen} from '@element-plus/icons-vue'
import {type Dict} from '@/api/system/dictionary/interface' import {type Dict} from '@/api/system/dictionary/interface'
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface' import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
import TreePopup from '@/views/system/dictionary/dictTree/components/treePopup.vue' import TreePopup from '@/views/system/dictionary/dictTree/components/treePopup.vue'
@@ -80,7 +80,11 @@
prop: 'operation', prop: 'operation',
label: '操作', label: '操作',
fixed: 'right', fixed: 'right',
<<<<<<< HEAD
width:250, width:250,
=======
width: 250,
>>>>>>> 12201e065fe575761995440a3bf1e9876321c6e6
}, },
]) ])
@@ -92,6 +96,10 @@
// 删除字典类型 // 删除字典类型
const handleDelete = async (params: Dict.ResDictTree) => { const handleDelete = async (params: Dict.ResDictTree) => {
<<<<<<< HEAD
=======
console.log(params)
>>>>>>> 12201e065fe575761995440a3bf1e9876321c6e6
await useHandleData(deleteDictTree, params, `删除【${params.name}】树形字典类型`) await useHandleData(deleteDictTree, params, `删除【${params.name}】树形字典类型`)
proTable.value?.getTableList() proTable.value?.getTableList()
} }