From 1be21989c76f0eb9a43b9ebcab322d7171dbccd6 Mon Sep 17 00:00:00 2001
From: zhaojiale <631455805@qq.com>
Date: 星期四, 08 九月 2022 17:08:57 +0800
Subject: [PATCH] json转换取消

---
 src/views/goalManagement/TargetBook/component/DailogSearch.vue |   62 ++++++++++++++++++++++--------
 1 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/src/views/goalManagement/TargetBook/component/DailogSearch.vue b/src/views/goalManagement/TargetBook/component/DailogSearch.vue
index 6404fd8..54a6871 100644
--- a/src/views/goalManagement/TargetBook/component/DailogSearch.vue
+++ b/src/views/goalManagement/TargetBook/component/DailogSearch.vue
@@ -6,7 +6,7 @@
 				<el-form ref="ruleFormRef" :model="ruleForm" status-icon>
 					<el-row>
 						<el-col :span="12">
-							<el-form-item>
+							<el-form-item size="default">
 								<el-input v-model="ruleForm.pass" placeholder="岗位名称" />
 							</el-form-item>
 						</el-col>
@@ -17,15 +17,21 @@
 				</el-col> -->
 						<el-col :span="11" :offset="1">
 							<el-form-item>
-								<el-button type="primary" @click="submitForm(ruleFormRef)">查询</el-button>
-								<el-button @click="resetForm(ruleFormRef)">重置</el-button>
+								<el-button size="default" type="primary" @click="submitForm(ruleFormRef)">查询</el-button>
+								<el-button size="default" @click="resetForm(ruleFormRef)">重置</el-button>
 							</el-form-item>
 						</el-col>
 					</el-row>
 				</el-form>
 				<el-button size="default" :icon="Delete">清除选择</el-button>
-				<el-table :data="tableData" style="width: 100%; margin-top: 20px">
-					<el-table-column align="center" type="selection" />
+				<el-table :data="tableData" style="width: 100%; margin-top: 20px"  >
+					<el-table-column align="center" width="70px">
+						<template #default="scope">
+							<el-radio-group v-model="radio1">
+								<el-radio :label="scope.row.id" @click="radio(scope.row)" size="large">{{ null }}</el-radio>
+							</el-radio-group>
+						</template>
+					</el-table-column>
 					<el-table-column align="center" prop="date" label="岗位名称" />
 				</el-table>
 				<el-pagination
@@ -37,12 +43,13 @@
 					:disabled="disabled"
 					:background="background"
 					layout="total, sizes, prev, pager, next, jumper"
-					:total="400"
+					:total="1"
 					@size-change="handleSizeChange"
 					@current-change="handleCurrentChange"
 				/>
 			</el-col>
 			<el-col :span="7">
+			<div v-if="dynamicTags[0]==''?false:true">
 				<el-tag
 					v-for="tag in dynamicTags"
 					:key="tag"
@@ -52,14 +59,15 @@
 					:disable-transitions="false"
 					@close="handleClose(tag)"
 				>
-					{{ tag }}
+					{{ tag.date }}
 				</el-tag>
+				</div>
 			</el-col>
 		</el-row>
 		<template #footer>
 			<span class="dialog-footer">
 				<el-button @click="dialogVisible = false" size="default">关闭</el-button>
-				<el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button>
+				<el-button type="primary" @click="submitForm" size="default">确定</el-button>
 			</span>
 		</template>
 	</el-dialog>
@@ -68,7 +76,7 @@
 import { defineComponent, reactive, ref } from 'vue';
 import { Delete, FullScreen } from '@element-plus/icons-vue';
 export default defineComponent({
-	setup() {
+	setup(props,{emit}) {
 		const dialogVisible = ref<boolean>(false);
 		const openDailog = () => {
 			dialogVisible.value = true;
@@ -80,23 +88,25 @@
 		});
 		// 表格
 		const tableData = [
-			{
-				date: '2016-05-03',
+			{   id:1,
+				date: '岗位1',
 				name: 'Tom',
 				address: 'No. 189, Grove St, Los Angeles',
 			},
 			{
-				date: '2016-05-02',
+				id:2,
+				date: '岗位2',
 				name: 'Tom',
 				address: 'No. 189, Grove St, Los Angeles',
 			},
-			{
-				date: '2016-05-04',
+			{	
+				id:3,	
+				date: '岗位3',
 				name: 'Tom',
 				address: 'No. 189, Grove St, Los Angeles',
 			},
-			{
-				date: '2016-05-01',
+			{	id:4,
+				date: '岗位4',
 				name: 'Tom',
 				address: 'No. 189, Grove St, Los Angeles',
 			},
@@ -109,10 +119,24 @@
 			console.log(`current page: ${val}`);
 		};
 		// 右方点击添加后显示标签
-		const dynamicTags = ref(['Tag 1', 'Tag 2', 'Tag 3']);
+		const dynamicTags = ref(['']);
 		const handleClose = (tag: string) => {
 			dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
+			radio1.value = '';
 		};
+		const radio1 = ref('');
+		const radio = (event: any) => {
+			dynamicTags.value[0] = event;
+		};
+		const clear=()=>{
+			dynamicTags.value=['']
+			radio1.value=""
+		}
+			const submitForm=()=>{
+			let obj=JSON.parse(JSON.stringify(dynamicTags.value))
+			emit("backNum",obj[0])
+			dialogVisible.value = false
+		}
 		//全屏
 		const full = ref(false);
 		const toggleFullscreen = () => {
@@ -123,6 +147,9 @@
 			}
 		};
 		return {
+			radio1,
+			radio,
+			clear,
 			dialogVisible,
 			openDailog,
 			ruleForm,
@@ -132,6 +159,7 @@
 			handleCurrentChange,
 			dynamicTags,
 			handleClose,
+			submitForm,
 			Delete,
 			full,
 			toggleFullscreen,

--
Gitblit v1.9.2