微调
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:request-api="getPqScriptList"
|
||||
:request-api="getTableList"
|
||||
>
|
||||
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
@@ -23,33 +23,40 @@
|
||||
|
||||
</ProTable>
|
||||
</div>
|
||||
<ComparisonPopup :refresh-table='proTable?.getTableList' ref='comparisonPopup' />
|
||||
<TestScriptPopup :refresh-table='proTable?.getTableList' ref='testScriptPopup' />
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='useRole'>
|
||||
import { type TestScript } from '@/api/device/interface/testScript'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import type{ ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||
import { CirclePlus, Delete, EditPen, Share } from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import ComparisonPopup from './components/comparisonPopup.vue'
|
||||
import TestScriptPopup from './components/testScriptPopup.vue'
|
||||
import {
|
||||
getPqScriptList,updatePqScript,deletePqScript,
|
||||
} from '@/api/device/testScript/index'
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||
const comparisonPopup = ref()
|
||||
const testScriptPopup = ref()
|
||||
const modeStore = useModeStore();
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const getTableList = (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
newParams.pattern = patternId
|
||||
return getPqScriptList(newParams)
|
||||
}
|
||||
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
|
||||
const templateTypes = reactive([
|
||||
{ id: 0, name: '脚本' },
|
||||
{ id: 1, name: '模版' }
|
||||
]);
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
@@ -58,6 +65,7 @@ const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
minWidth: 350,
|
||||
search: {el:'input'}
|
||||
},
|
||||
{
|
||||
prop: 'standardName',
|
||||
@@ -94,7 +102,13 @@ const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||
|
||||
// 打开 drawer(新增、编辑)
|
||||
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
if(modeStore.currentMode == '比对式'){
|
||||
comparisonPopup.value?.open(titleType, row)
|
||||
}else{
|
||||
testScriptPopup.value?.open(titleType, row)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user