|
@@ -362,7 +362,7 @@
|
|
|
<el-date-picker
|
|
|
style="width: 100%;"
|
|
|
format="yyyy 年 MM 月 dd 日"
|
|
|
- value-format="yyyy 年 MM 月 dd 日"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
v-model="fileForm.issueDate"
|
|
|
type="date"
|
|
|
placeholder="选择日期">
|
|
@@ -371,7 +371,7 @@
|
|
|
<el-form-item label="实施日期" >
|
|
|
<el-date-picker
|
|
|
format="yyyy 年 MM 月 dd 日"
|
|
|
- value-format="yyyy 年 MM 月 dd 日"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
style="width: 100%;"
|
|
|
v-model="fileForm.actualizeDate"
|
|
|
type="date"
|
|
@@ -478,7 +478,10 @@ import { getStore, setStore } from "@/util/store";
|
|
|
manageLoad: false,
|
|
|
addFileDialogVisible:false,
|
|
|
addFileRuleLoad:false,
|
|
|
- fileForm:{},
|
|
|
+ fileForm:{
|
|
|
+ standardFileUrl: [], // 用于展示的文件列表
|
|
|
+ files: [] // 存储实际的文件对象
|
|
|
+ },
|
|
|
fileRuleForm:{
|
|
|
name: [
|
|
|
{ required: true, message: '请输入规范名称', trigger: 'blur' }
|
|
@@ -733,31 +736,58 @@ import { getStore, setStore } from "@/util/store";
|
|
|
this.addFileDialogVisible = true;
|
|
|
},
|
|
|
|
|
|
- uploadImportData(file){
|
|
|
- let formData = new FormData()
|
|
|
- formData.append('file', file.raw);
|
|
|
- let pictureList =[]
|
|
|
- pictureList.push(file.name)
|
|
|
- this.fileForm.standardFileUrl=pictureList.map(item=>{
|
|
|
- return {
|
|
|
- name: item,
|
|
|
- url: item,
|
|
|
- raw:file.raw
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ uploadImportData(file) {
|
|
|
+ // 验证文件类型
|
|
|
+
|
|
|
+
|
|
|
+ // 将文件对象存入 files 数组
|
|
|
+ if (!this.fileForm.files) {
|
|
|
+ this.fileForm.files = [];
|
|
|
+ }
|
|
|
+ this.fileForm.files.push(file.raw);
|
|
|
+
|
|
|
+ // 更新显示的文件列表
|
|
|
+ this.fileForm.standardFileUrl = this.fileForm.files.map(file => ({
|
|
|
+ name: file.name,
|
|
|
+ }));
|
|
|
+ },
|
|
|
async addFileRoleForm(){
|
|
|
const isValid = await this.$refs.fileFormRef.validate()
|
|
|
if (!isValid) {
|
|
|
this.$message.error('请填写完整的规范信息');
|
|
|
return;
|
|
|
}
|
|
|
- add({
|
|
|
- ...this.fileForm,
|
|
|
+ const formData = new FormData();
|
|
|
+ // 添加基本信息
|
|
|
+ let objData={
|
|
|
+ name: this.fileForm.name,
|
|
|
+ issueDate: this.fileForm.issueDate,
|
|
|
+ actualizeDate: this.fileForm.actualizeDate,
|
|
|
type: 2,
|
|
|
privateId: this.treeId,
|
|
|
parentId: this.ruleItem.id,
|
|
|
- }).then((res) => {
|
|
|
+ }
|
|
|
+ let data = JSON.stringify(objData);
|
|
|
+ formData.append('data', new Blob([JSON.stringify(objData)], {
|
|
|
+ type: 'application/json'
|
|
|
+ }));
|
|
|
+
|
|
|
+ // 添加文件
|
|
|
+ if (this.fileForm.files && this.fileForm.files.length > 0) {
|
|
|
+ this.fileForm.files.forEach(file => {
|
|
|
+ formData.append('files', file);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // add({
|
|
|
+ // ...this.fileForm,
|
|
|
+ // type: 2,
|
|
|
+ // privateId: this.treeId,
|
|
|
+ // parentId: this.ruleItem.id,
|
|
|
+ // })
|
|
|
+ console.log(formData,'formData');
|
|
|
+
|
|
|
+ add(formData)
|
|
|
+ .then((res) => {
|
|
|
if(res.data.code==200){
|
|
|
this.$message.success(res.data.msg)
|
|
|
|