Просмотр исходного кода

指数管理-详细信息:请求接口数据 渲染

vera_min 3 лет назад
Родитель
Сommit
b02c6455ae

+ 25 - 17
src/views/assess/totalIndex/component/detailItem.vue

@@ -24,8 +24,10 @@
 						<section>
 							<div class="inner-label">请求Body参数</div>
 							<div class="inner-value">
-								<div>itemcode:17216k2f0k0c5jee0vdn08g100u6rfhd</div>
-								<div>name:divice breed</div>
+								<div>itemcode:{{ruleForm.item_code}}</div>
+								<div>name:
+									<span v-for="(item, index) in ruleForm.targets" :key="index">{{`${item.name} `}} </span>
+								</div>
 								<div>value:当前值</div>
 								<div>form_info:平台数据</div>
 							</div>
@@ -46,7 +48,7 @@
 						<section>
 							<div class="inner-label">请求Query参数</div>
 							<div class="inner-value">
-								<div>itemcode:17216k2f0k0c5jee0vdn08g100u6rfhd</div>
+								<div>itemcode:{{ruleForm.item_code}}</div>
 							</div>
 						</section>
 					</div>
@@ -60,13 +62,15 @@
 import { reactive, toRefs, onMounted, defineComponent } from 'vue';
 import { ElMessage } from 'element-plus';
 
+import api from '/@/api/assess';
+
 // 定义接口来定义对象的类型
 interface RuleFormRow {
-	userName: string;
-	isUse: string;
-	dataType: string;
-	num: string;
-	description: any;
+	title: string;
+	explain: string;
+	config: string;
+	item_code: string;
+	targets: Array<any>
 }
 interface ItemState {
 	isShowDialog: boolean;
@@ -79,18 +83,22 @@ export default defineComponent({
 		const state = reactive<ItemState>({
 			isShowDialog: false,
 			ruleForm: {
-				userName: '', // 指标名称
-				isUse: "1", // 是否启用
-				dataType: '', // 数据项
-				num: '', // 权重(%)
-				description: '', // 取值范围
+				title: '', // 评价名称
+				explain: '', // 描述
+				config: '',
+				item_code: '',
+				targets: []
 			},
 		});
 		// 打开弹窗
-		const openDialog = (row: RuleFormRow) => {
-			state.ruleForm = row;
-			state.ruleForm.isUse = "1"
-			state.isShowDialog = true;
+		const openDialog = (row: any) => {
+			api.getList({itemcode: row.item_code}).then((res: any) => {
+				console.log(res)
+				state.ruleForm = res
+				console.log(state.ruleForm)
+				state.isShowDialog = true;
+
+			});
 		};
 		// 关闭弹窗
 		const closeDialog = () => {

+ 2 - 1
src/views/assess/totalIndex/component/editItem.vue

@@ -155,13 +155,14 @@ export default defineComponent({
 		})
 		// 打开弹窗
 		const openDialog = (row:any) => {
-			state.isShowDialog = true;
 			if(!row) return
 			console.log(row.item_code)
 			api.getList({itemcode: row.item_code}).then((res: any) => {
 				console.log(res)
 				state.ruleForm = res;
 				state.tableData.data = res.targets
+				state.isShowDialog = true;
+
 			});
 		};
 		// 关闭弹窗

+ 0 - 18
src/views/assess/totalIndex/index.vue

@@ -17,22 +17,8 @@
 				</el-button>
 			</div>
 			<el-table :data="tableData.data" style="width: 100%">
-				<!-- <el-table-column type="index" label="序号" width="60" /> -->
 				<el-table-column align="center" prop="title" label="名称" show-overflow-tooltip></el-table-column>
 				<el-table-column align="center" prop="explain" label="描述" show-overflow-tooltip></el-table-column>
-				<!-- <el-table-column prop="userNickname" label="用户昵称" show-overflow-tooltip></el-table-column>
-				<el-table-column prop="roleSign" label="关联角色" show-overflow-tooltip></el-table-column>
-				<el-table-column prop="department" label="部门" show-overflow-tooltip></el-table-column>
-				<el-table-column prop="phone" label="手机号" show-overflow-tooltip></el-table-column>
-				<el-table-column prop="email" label="邮箱" show-overflow-tooltip></el-table-column>
-				<el-table-column prop="status" label="用户状态" show-overflow-tooltip>
-					<template #default="scope">
-						<el-tag type="success" v-if="scope.row.status">启用</el-tag>
-						<el-tag type="info" v-else>禁用</el-tag>
-					</template>
-				</el-table-column>
-				<el-table-column prop="describe" label="用户描述" show-overflow-tooltip></el-table-column> -->
-				<!-- <el-table-column align="center" prop="createTime" label="创建时间" show-overflow-tooltip></el-table-column> -->
 				<el-table-column align="center" label="操作" width="180">
 					<template #default="scope">
 						<el-button size="small" type="text"  @click="onOpenEditItem(scope.row)">编辑</el-button>
@@ -55,11 +41,7 @@
 			>
 			</el-pagination> -->
 		</el-card>
-		<!-- <AddUer ref="addUserRef" /> -->
 		<EditOrAddItem ref="EditOrAddItem" @fetchList="fetchList" />
-
-		<!-- <AddItem ref="addItemRef" /> -->
-
 		<DetailItem ref="detailItemRef" />