张诺
11 小时以前 7c86b549b27bd54f6bd5de81c13f8242f91c87ff
src/views/archiveManagement/mould/archiveDialog.vue
@@ -1,5 +1,5 @@
<template>
  <el-dialog v-model="centerDialogVisible" title="Warning" width="500" center>
  <el-dialog v-model="centerDialogVisible" title="文档管理" width="500" center>
    <el-form
      ref="ruleFormRef"
      style="max-width: 600px"
@@ -18,24 +18,36 @@
      </el-form-item>
      <el-form-item label="请输入文档状态" prop="status">
        <el-select v-model="ruleForm.status" placeholder="请输入文档状态">
          <el-option v-for="option in options" :key="option.value" :label="option.label" :value="option.value" />
          <el-option
            v-for="option in options"
            :key="option.value"
            :label="option.label"
            :value="option.value"
          />
        </el-select>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="centerDialogVisible = false">Cancel</el-button>
        <el-button type="primary" @click="submit">
          Confirm
        </el-button>
      </div>
      <el-row>
        <el-col :span="24" style="text-align: right">
          <el-button @click="centerDialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="submit"> 确 定 </el-button>
        </el-col>
      </el-row>
    </template>
    <fileUpload
    v-model="ruleForm.file"
    :fileSize="1024"
    :fileType="['pdf', 'docx', 'txt', 'xlsx', 'pptx....']"
    :limit="10"
    />
  </el-dialog>
</template>
<script setup>
import { ref, watch } from "vue";
import { addOrEditArchive } from "@/api/archiveManagement"
import { addOrEditArchive } from "@/api/archiveManagement";
import fileUpload from "@/components/FileUpload/index.vue";
const centerDialogVisible = defineModel("centerDialogVisible", {
  type: Boolean,
@@ -66,22 +78,20 @@
// 初始化表单数据
const ruleFormRef = ref(null);
const ruleForm = ref(initFormData(props.row));
const copyForm = ref()
const copyForm = ref();
// 监听 row 的变化,更新 ruleForm
watch(() => props.row, (newRow) => {
watch(
  () => props.row,
  (newRow) => {
  copyForm.value = initFormData(newRow);
  ruleForm.value = JSON.parse(JSON.stringify(copyForm.value));
}, { deep: true });
  },
  { deep: true }
);
const rules = {
  name: [
    { required: true, message: "Please input activity name", trigger: "blur" },
  ],
  type: [
    { required: true, message: "Please select activity zone", trigger: "change" },
  ],
  status: [
    { required: true, message: "Please select activity count", trigger: "change" },
  ],
  name: [{ required: true, message: "请输入文档名称", trigger: "blur" }],
  type: [{ required: true, message: "请选择文档类型", trigger: "blur" }],
  status: [{ required: true, message: "请选择文档状态", trigger: "blur" }],
};
const options = [
@@ -113,7 +123,7 @@
  } catch (error) {
    console.error("表单验证失败或API调用失败:", error);
  }
}
};
</script>
<style lang="less" scoped></style>