数通智联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

184 lines
5.0 KiB

<!--
@ 作者: 鲁智强
@ 时间: 2023-09-19 09:13:14
@ 备注:
-->
<script lang='ts' setup>
import {ref,reactive,onMounted} from 'vue'
import Diolog from './diolog.vue'
import { addPostCont,tarlist } from '@/api/opk/api'
import { postinfo } from '@/api/hr/post/type';
import { TableV2SortOrder } from 'element-plus';
const { addShow, rowInfo, title } = defineProps(['addShow', 'rowInfo', 'title'])
const data = reactive({
formInline:{
region:'',
},
title:"",
addPostBox: false,
})
const count =ref(0)
const load = () => {
count.value += 1
}
const orgTreeProps ={
label: 'name',
}
const defaultProps ={
label: 'title',
}
const orgTreeLoading = ref(false); //加载行政组织树
const postIds = ref<number[]>([])
const tableData = ref<any>([]);
// 获取侧栏数据
function jjjs(){
addPostCont("/api/group/getgroupdepartmap","post")
.then(data => {
tableData.value = data.data[0].children[15].children;
})
.catch(error => {
console.error('Error fetching data:', error);
});
}
const table = ref<any>([])
const tables = ref<any>([])
// 获取数据
function newtarlist(){
tarlist()
.then(data=>{
table.value = data.data.list
console.log(table.value)
})
}
newtarlist()
// 新增数据
const addtableData = ()=>{
data.addPostBox = true;
}
// 添加行
const addRow = (val:any)=> {
tableData.value.push(val);
}
// 编辑行
const editRow = (val:any)=> {
let index =tableData.value.findIndex(
(item:any) => item.id === val.id
);
tableData.value.splice(index, 1, val);
}
// 关闭弹窗
const closeDetail = ()=>{
data.addPostBox = false;
}
// 删除数据
const handleDel = (val: any) => {
const dictTypeIds = [val?.id || postIds.value].join(",");
let dictTypeIdAry = dictTypeIds.split(",");
ElMessageBox.confirm("你确定删除这条信息吗?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
// 用户点击确认后执行删除操作
handleSure(val)
ElMessage.success("删除成功");
jjjs()
})
.catch(() => {
// 用户点击取消时的处理
alert('用户取消了删除操作');
});
};
const handleSure = (val:any)=> {
const index = tableData.value.findIndex((item:any) => item.id === val.id);
if(index!=-1){
tableData.value.splice(index, 1);
}
}
onMounted(()=>{
jjjs()
})
</script>
<template>
<div>
<el-row style="width: 100%">
<el-tree
ref="orgTreeRef"
v-loading="orgTreeLoading"
node-key="id"
class="orgTree"
:data="tableData"
:props="orgTreeProps"
:expand-on-click-node="false"
:check-on-click-node="true"
:check-strictly="true"
:default-expand-all="false"
/>
<el-col :span="22">
<div class="horizontal-controls">
<el-form-item label="指标名称">
<el-select
v-model="data.formInline.region"
placeholder="请输入名称"
clearable
>
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item><el-form-item label="指标名称">
<el-select
v-model="data.formInline.region"
placeholder="请输入名称"
clearable
>
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-button @click="jjjs">查询</el-button>
<el-button class="new_btn" type="success" size="large" @click="addtableData">新增</el-button>
</div>
<el-table v-infinite-scroll="load" :data="table" border style="width: 100%">
<el-table-column prop="title" label="考核指标"/>
<el-table-column prop="dimensiontitle" label="考核维度"/>
<el-table-column prop="" label="指标性质"/>
<el-table-column prop="unites" label="计量单位" />
<el-table-column prop="" label="考核周期"/>
<el-table-column prop="" label="计分方式"/>
<el-table-column prop="relevantdepartmentsmap[0].title" label="关联部门">
</el-table-column>
<el-table-column prop="reportmap[0].title" label="数据提交"/>
<el-table-column prop="state" label="辅助计数"/>
<el-table-column prop="" label="状态" width="70">
<template #default="scope">
<el-switch v-model="scope.row.status" />
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="200">
<template #default="{ row }">
<el-button type="success" >修改</el-button>
<el-button type="danger" @click="handleDel(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-pagination :total= "1000" :page-sizes="[100, 200, 300, 400]"/>
<Diolog v-if="data.addPostBox" v-model="data.addPostBox" :row-info="rowInfo" :title="title" :array-num="tableData.length" @add-Row="addRow" @edit-Row="editRow"></Diolog>
</div>
</template>
<style lang='scss' scoped>
*{
font-weight: bolder;
}
.horizontal-controls {
display: flex;
float: left;
}
/* 可以根据需要调整样式 */
</style>