Jelajahi Sumber

feat: 表单管理弹窗

luoyali 10 bulan lalu
induk
melakukan
8b495b412c
1 mengubah file dengan 18 tambahan dan 2 penghapusan
  1. 18 2
      src/views/flow/form/index.vue

+ 18 - 2
src/views/flow/form/index.vue

@@ -66,8 +66,8 @@
 					<el-avatar :src="scope.row.avatar" size="small"></el-avatar>
 				</template>
 
-				<template #statusSlot="{ row }">
-					<status-indicator pulse :type="row.status === 0 ? 'danger' : 'success'"></status-indicator>
+				<template #statusSlot="scope">
+					<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" @change="() => handleStatusChange(scope.row)"></el-switch>
 				</template>
 
 				<template #actionSlot="{ row }">
@@ -132,6 +132,7 @@ import { useTablePage } from '@/hooks/useTablePage'
 import StatusIndicator from '@/components/StatusIndicator/index.vue'
 import DesignForm from './designForm.vue'
 import { statusOptions, templateForms, typeOptions, typeOptions_config } from './data.tsx'
+import post from '@/api/system/post'
 const treeParentName = '所有'
 const visible = ref(false) // 弹窗显示隐藏
 const visibleTemplate = ref(false) // 弹窗显示隐藏
@@ -500,6 +501,21 @@ const dicEdit = data => {
 	table_edit(data)
 }
 
+const handleStatusChange = (row: any) => {
+	// 状态 0、禁用 1、正常
+	const status = row.status
+	let text = Number(row.status) === 0 ? '禁用' : '启用'
+	ElMessageBox.confirm('请确认是否' + text + '当前数据?', '提示', { type: 'warning' })
+		.then(async () => {
+			ElMessage.success(`${text}成功`)
+		})
+		.catch(status => {
+			if (status == 'cancel') {
+				row.status = Number(row.status) === 0 ? 1 : 0
+			}
+		})
+}
+
 nextTick(() => {
 	getGroup()
 	queryList()