|
@@ -12,6 +12,7 @@
|
|
<!-- </el-form-item>-->
|
|
<!-- </el-form-item>-->
|
|
<el-form-item label="文件目录" prop="classId">
|
|
<el-form-item label="文件目录" prop="classId">
|
|
<el-tree-select
|
|
<el-tree-select
|
|
|
|
+ :disabled="formType==='detail'"
|
|
v-model="formData.classId"
|
|
v-model="formData.classId"
|
|
:data="fileList"
|
|
:data="fileList"
|
|
:props="defaultProps"
|
|
:props="defaultProps"
|
|
@@ -23,13 +24,14 @@
|
|
<el-form-item label="附件" prop="filePath" style="">
|
|
<el-form-item label="附件" prop="filePath" style="">
|
|
<UploadFileAll style="vertical-align: middle"
|
|
<UploadFileAll style="vertical-align: middle"
|
|
:is-show-tip="false"
|
|
:is-show-tip="false"
|
|
|
|
+ :disabled="formType==='detail'"
|
|
v-model="formData.filePath"
|
|
v-model="formData.filePath"
|
|
:multiple="formType === 'create'"
|
|
:multiple="formType === 'create'"
|
|
:limit="formType === 'create' ? 5 : 1"
|
|
:limit="formType === 'create' ? 5 : 1"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="文件类型" prop="fileType">
|
|
<el-form-item label="文件类型" prop="fileType">
|
|
- <el-select v-model="formData.fileType" placeholder="请选择">
|
|
|
|
|
|
+ <el-select v-model="formData.fileType" placeholder="请选择" :disabled="formType==='detail'">
|
|
<el-option
|
|
<el-option
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.PMS_FILE_TYPE)"
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.PMS_FILE_TYPE)"
|
|
:key="dict.label"
|
|
:key="dict.label"
|
|
@@ -39,11 +41,11 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-form-item label="备注" prop="remark">
|
|
- <el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
|
|
|
|
|
|
+ <el-input v-model="formData.remark" :disabled="formType==='detail'" type="textarea" placeholder="请输入备注" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<template #footer>
|
|
<template #footer>
|
|
- <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
|
|
|
|
|
+ <el-button @click="submitForm" type="primary" v-if="formType!=='detail'" :disabled="formLoading">确 定</el-button>
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
</template>
|
|
</template>
|
|
</Dialog>
|
|
</Dialog>
|
|
@@ -53,6 +55,7 @@ import { IotInfoApi, IotInfoVO } from '@/api/pms/iotinfo'
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
import {defaultProps, handleTree} from "@/utils/tree";
|
|
import {defaultProps, handleTree} from "@/utils/tree";
|
|
import * as FileClassifyApi from "@/api/pms/info";
|
|
import * as FileClassifyApi from "@/api/pms/info";
|
|
|
|
+import {IotTreeApi} from "@/api/system/tree";
|
|
|
|
|
|
/** 资料 表单 */
|
|
/** 资料 表单 */
|
|
defineOptions({ name: 'IotInfoForm' })
|
|
defineOptions({ name: 'IotInfoForm' })
|
|
@@ -68,6 +71,7 @@ const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
const formData = ref({
|
|
const formData = ref({
|
|
id: undefined,
|
|
id: undefined,
|
|
deviceId: undefined,
|
|
deviceId: undefined,
|
|
|
|
+ classId: undefined,
|
|
deptId: undefined,
|
|
deptId: undefined,
|
|
filename: undefined,
|
|
filename: undefined,
|
|
fileType: undefined,
|
|
fileType: undefined,
|
|
@@ -76,21 +80,28 @@ const formData = ref({
|
|
fileList: []
|
|
fileList: []
|
|
})
|
|
})
|
|
const formRules = reactive({
|
|
const formRules = reactive({
|
|
- classId: [{ required: true, message: '文件不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+ // classId: [{ required: true, message: '文件不能为空', trigger: 'blur' }],
|
|
filePath: [{ required: true, message: '文件不能为空', trigger: 'blur' }]
|
|
filePath: [{ required: true, message: '文件不能为空', trigger: 'blur' }]
|
|
})
|
|
})
|
|
const formRef = ref() // 表单 Ref
|
|
const formRef = ref() // 表单 Ref
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
deviceId: string
|
|
deviceId: string
|
|
classId: string
|
|
classId: string
|
|
|
|
+ type: string
|
|
}>()
|
|
}>()
|
|
/** 打开弹窗 */
|
|
/** 打开弹窗 */
|
|
const open = async (type: string, id?: number) => {
|
|
const open = async (type: string, id?: number) => {
|
|
|
|
+ // if (props.type==='file') {
|
|
|
|
+ // await getTreeInfo()
|
|
|
|
+ // } else {
|
|
|
|
+ await getTree();
|
|
|
|
+ // }
|
|
dialogVisible.value = true
|
|
dialogVisible.value = true
|
|
dialogTitle.value = t('action.' + type)
|
|
dialogTitle.value = t('action.' + type)
|
|
formType.value = type
|
|
formType.value = type
|
|
resetForm()
|
|
resetForm()
|
|
// 修改时,设置数据
|
|
// 修改时,设置数据
|
|
|
|
+ debugger
|
|
if (id) {
|
|
if (id) {
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
try {
|
|
try {
|
|
@@ -98,12 +109,19 @@ const open = async (type: string, id?: number) => {
|
|
} finally {
|
|
} finally {
|
|
formLoading.value = false
|
|
formLoading.value = false
|
|
}
|
|
}
|
|
|
|
+ }else {
|
|
|
|
+ formData.value.fileType = 'file'
|
|
}
|
|
}
|
|
formData.value.classId = props.classId
|
|
formData.value.classId = props.classId
|
|
- await getTree();
|
|
|
|
}
|
|
}
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
-
|
|
|
|
|
|
+const getTreeInfo = async () => {
|
|
|
|
+ const res = await IotTreeApi.getSimpleTreeList()
|
|
|
|
+ fileList.value = []
|
|
|
|
+ fileList.value.push(...handleTree(res))
|
|
|
|
+ // firstLevelKeys.value = treeList.value.map(node => node.id);
|
|
|
|
+ // emits('success', treeList.value[0].id)
|
|
|
|
+}
|
|
/** 获得分类树 */
|
|
/** 获得分类树 */
|
|
const getTree = async () => {
|
|
const getTree = async () => {
|
|
const res = await FileClassifyApi.IotInfoClassifyApi.getSimpleInfotClassifyList(props.deviceId)
|
|
const res = await FileClassifyApi.IotInfoClassifyApi.getSimpleInfotClassifyList(props.deviceId)
|
|
@@ -121,7 +139,7 @@ const submitForm = async () => {
|
|
formData.value.fileList = formData.value.filePath
|
|
formData.value.fileList = formData.value.filePath
|
|
formData.value.filePath = ''
|
|
formData.value.filePath = ''
|
|
const data = formData.value as unknown as IotInfoVO
|
|
const data = formData.value as unknown as IotInfoVO
|
|
-
|
|
|
|
|
|
+ debugger
|
|
if (formType.value === 'create') {
|
|
if (formType.value === 'create') {
|
|
data.deviceId = props.deviceId
|
|
data.deviceId = props.deviceId
|
|
// data.filePath = data.filePath.join(',')
|
|
// data.filePath = data.filePath.join(',')
|