|
@@ -1,149 +0,0 @@
|
|
-<template>
|
|
|
|
- <el-dialog
|
|
|
|
- v-model="dialogVisible"
|
|
|
|
- :title="title"
|
|
|
|
- width="40%"
|
|
|
|
- :before-close="handleClose"
|
|
|
|
- >
|
|
|
|
- <el-form
|
|
|
|
- ref="formRef"
|
|
|
|
- label-width="auto"
|
|
|
|
- label-position="right"
|
|
|
|
- :model="form"
|
|
|
|
- :rules="rules"
|
|
|
|
- >
|
|
|
|
- <el-form-item label="目录编码" prop="assetDirectoryCode">
|
|
|
|
- <el-input v-model="form.assetDirectoryCode"/>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="目录名称" prop="assetDirectoryName">
|
|
|
|
- <el-input v-model="form.assetDirectoryName"/>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="父级目录" prop="parentId" v-if="form.parentId !== 0">
|
|
|
|
- <el-tree-select
|
|
|
|
- v-model="form.parentId"
|
|
|
|
- :data="dataOption"
|
|
|
|
- :default-expanded-keys="[form.parentId]"
|
|
|
|
- :default-checked-keys="[form.parentId]"
|
|
|
|
- :props="{ label: 'assetDirectory', children: 'childList' }"
|
|
|
|
- :render-after-expand="false"
|
|
|
|
- check-strictly
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="父级目录" prop="parentId" v-else/>
|
|
|
|
- <el-form-item label="是否启用" prop="enable">
|
|
|
|
- <el-switch
|
|
|
|
- v-model="form.enable"
|
|
|
|
- active-value="0"
|
|
|
|
- inactive-value="1"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="是否必填" prop="required">
|
|
|
|
- <el-switch
|
|
|
|
- v-model="form.required"
|
|
|
|
- active-value="1"
|
|
|
|
- inactive-value="0"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="是否应用到资产目录" prop="applied">
|
|
|
|
- <el-switch
|
|
|
|
- v-model="form.applied"
|
|
|
|
- active-value="1"
|
|
|
|
- inactive-value="0"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="备注" prop="remark">
|
|
|
|
- <el-input
|
|
|
|
- v-model="form.remark"
|
|
|
|
- type="textarea"
|
|
|
|
- :autosize="{ minRows: 2 }"
|
|
|
|
- />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
-
|
|
|
|
- <template #footer>
|
|
|
|
- <span slot-scope="scope">
|
|
|
|
- <el-button @click="handleClose">取消</el-button>
|
|
|
|
- <el-button type="primary" @click="confirmHandle(formRef)">确认</el-button>
|
|
|
|
- </span>
|
|
|
|
- </template>
|
|
|
|
- </el-dialog>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script setup>
|
|
|
|
-import { ref, watchEffect, computed } from 'vue';
|
|
|
|
-import { FormRules, FormInstance, ElMessage } from 'element-plus';
|
|
|
|
-import { menuClass, Tree } from '@api/dataGovernance/dataAssets/types';
|
|
|
|
-import { addAssetDirectoryList, editAssetDirectoryList } from '@api/dataGovernance/dataAssets/index';
|
|
|
|
-
|
|
|
|
-const props = defineProps({
|
|
|
|
- title: String,
|
|
|
|
- dialogVisible: Boolean,
|
|
|
|
- isAdd: Boolean,
|
|
|
|
- formData: {
|
|
|
|
- type: Object,
|
|
|
|
- default: () => ({
|
|
|
|
- enable: '0',
|
|
|
|
- required: '0',
|
|
|
|
- applied: '0'
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- option: {
|
|
|
|
- type: Array,
|
|
|
|
- default: () => []
|
|
|
|
- }
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const dataOption = ref(props.option);
|
|
|
|
-
|
|
|
|
-const rules = reactive<FormRules>({
|
|
|
|
- assetDirectoryCode: [[{ required: true, message: '请输入', trigger: 'blur' }]],
|
|
|
|
- assetDirectoryName: [[{ required: true, message: '请输入', trigger: 'blur' }]]
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-const formRef = ref<FormInstance>({})
|
|
|
|
-
|
|
|
|
-const form = ref<MenuClass>(props.formData);
|
|
|
|
-
|
|
|
|
-const emit = defineEmits(['closeDialog', 'update:dialogVisible']);
|
|
|
|
-
|
|
|
|
-const handleClose = () => {
|
|
|
|
- form.value = { ...props.formData };
|
|
|
|
- emit('closeDialog');
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-const confirmHandle = async () => {
|
|
|
|
- if (!formRef.value.validate()) return;
|
|
|
|
- formRef.value.validate().then(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- if (props.isAdd) {
|
|
|
|
- addAssetDirectoryList(form.value).then(res => {
|
|
|
|
- if (res.success) {
|
|
|
|
- ElMessage({ type: 'success', message: '操作成功' });
|
|
|
|
- emit('closeDialog');
|
|
|
|
- } else {
|
|
|
|
- ElMessage.error(res.message);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- editAssetDirectoryList(form.value).then(res => {
|
|
|
|
- if (res.success) {
|
|
|
|
- ElMessage({ type: 'success', message: '操作成功' });
|
|
|
|
- emit('closeDialog');
|
|
|
|
- } else {
|
|
|
|
- ElMessage.error(res.message);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-watchEffect(() => {
|
|
|
|
- if (props.dialogVisible) {
|
|
|
|
- dataOption.value = props.option;
|
|
|
|
- form.value = props.formData;
|
|
|
|
- }
|
|
|
|
-});
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-</script>
|
|
|