diff --git a/src/components/Template/BaseInfoFormPackage.vue b/src/components/Template/BaseInfoFormPackage.vue
index ff6e02e..5773b94 100644
--- a/src/components/Template/BaseInfoFormPackage.vue
+++ b/src/components/Template/BaseInfoFormPackage.vue
@@ -60,8 +60,8 @@
{{ $t( sItem.label) }}
- onSelectChange(key, e,type)"
+ onAttachmentChange(key, e)"
:error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue
index fb7d504..77447e3 100644
--- a/src/components/Template/CustomTable.vue
+++ b/src/components/Template/CustomTable.vue
@@ -308,6 +308,7 @@ export default {
if (this.templateFillType !== 'actFill') {
return
}
+ this.updateDataSourceByRowIndex(rowIndex,{[col.prop]:data.selectedId})
this.$emit("onRegentSubmit", {selectInfo:data,key:col.prop, col, rowIndex, colIndex, rowData:row})
},
isShowAddRos() {
@@ -630,7 +631,7 @@ export default {
this.checkCompareToOnDataLoad();
},
// 根据行索引更新数据 autoUpdateRecord 是否自动更新记录
- updateDataSourceByRowIndex(rowIndex, data, type) {
+ updateDataSourceByRowIndex(rowIndex, data) {
this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource));
// if (type === "clickable") {//如果是custom内部的clickable需要判断是否弹窗
// this.showEditSignDialog(rowIndex,data);
diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue
index 33834c0..0d23842 100644
--- a/src/components/Template/HandleFormItem.vue
+++ b/src/components/Template/HandleFormItem.vue
@@ -55,9 +55,10 @@
点击上传
- 只能上传jpg/png文件,且不超过500kb
+ 支持扩展名:.rar .zip .doc .docx .pdf .jpg
@@ -213,12 +214,6 @@ export default {
watch: {
value(newVal) {
this.inputValue = newVal;
- // 当type为clickable时,值变化时调用保存记录方法
- // if (this.item.type === 'clickable') {
- // this.$nextTick(() => {
- // this.onCommonHandleSaveRecord(newVal);
- // });
- // }
}
},
filters: {
@@ -226,6 +221,13 @@ export default {
},
mounted() {
+ if(this.item.type === 'attachment'){
+ try{
+ this.fileList = JSON.parse(this.value);
+ }catch(e){
+ this.fileList = [];
+ }
+ }
EventBus.$on('onExternalFieldUpdate', this.handleExternalFieldUpdate);
EventBus.$on('onEditSignCancel', this.handleEditSignCancel);
EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
@@ -245,11 +247,65 @@ export default {
EventBus.$off("onMixReagentSubmit", this.onMixReagentSubmit)
},
methods: {
+ handleSuccess(res, file, fileList) {
+ if(res.code == 200){
+ this.fileList = fileList;
+ // 更新inputValue为文件路径列表,方便后续保存
+ this.inputValue = JSON.stringify(this.getFileList(fileList));
+ this.$emit("change",this.inputValue)
+ this.onCommonHandleSaveRecord();
+ this.$message.success('文件上传成功');
+ } else {
+ this.$message.error(res.message || '文件上传失败');
+ }
+ },
+ getFileList(fileList) {
+ const list = [];
+ fileList.forEach(item => {
+ const o = {name:item.name};
+ if(item.url){//回填的数据
+ o.url = item.url
+ }else{//新上传的
+ o.url = item.response.data.url
+ }
+ list.push(o)
+ })
+ return list;
+ },
handleRemove(file, fileList) {
- console.log(file, fileList);
+ // 从列表中移除文件
+ const index = fileList.indexOf(file);
+ if (index > -1) {
+ fileList.splice(index, 1);
+ }
+
+ // 更新inputValue为剩余文件路径列表
+ this.inputValue = JSON.stringify(this.getFileList(fileList));
+ this.$emit("change",this.inputValue)
+
+ // 触发保存记录
+ this.onCommonHandleSaveRecord();
+
+ this.$message.info(`文件 ${file.name} 已移除`);
},
handlePreview(file) {
- console.log(file);
+ // 预览文件,如果是图片则直接打开,否则下载
+ if (file.url) {
+ const fileType = file.type || file.name.split('.').pop().toLowerCase();
+ const imageTypes = ['jpg', 'jpeg', 'png', 'gif', 'bmp'];
+
+ if (imageTypes.includes(fileType)) {
+ // 图片类型,新建窗口预览
+ window.open(process.env.VUE_APP_FILE_DOMAIN + file.url, '_blank');
+ } else {
+ // 非图片类型,下载文件
+ const link = document.createElement('a');
+ link.href = file.url;
+ link.download = file.name;
+ link.target = '_blank';
+ link.click();
+ }
+ }
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
@@ -262,7 +318,7 @@ export default {
if (data.uuid !== this.uuid) return;
this.inputValue = data.selectedId;
this.selectRegentInfo = data;
- this.onCommonHandleSaveRecord();
+ this.onCommonHandleSaveRecord(this.inputValue);
// this.inputValue = this.item.label;
},
//统一处理试剂/供试品等弹窗
@@ -566,12 +622,12 @@ export default {
if (this.templateFillType === "actFill") {//只有实际填报的时候才记录修改记录
this.updateZdxgjl(record);
}
- setTimeout(() => {
+ this.$nextTick(()=>{
EventBus.$emit('onModifyRecord', params,)
if (this.regentType.includes(this.item.type)) {
this.$emit("onRegentSubmit", this.selectRegentInfo);
}
- }, 10);
+ })
},
//判断两个值是否相等
diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js
index 9fe812c..a6bcc3a 100644
--- a/src/components/Template/mixins/formPackageMixins.js
+++ b/src/components/Template/mixins/formPackageMixins.js
@@ -48,6 +48,7 @@ export default {
methods: {
//试剂/仪器等弹窗提交
onRegentSubmit(data,key,item){
+ this.updateFormData(key,data.selectedId);
this.$emit("onRegentSubmit", {selectInfo:data,key,config:item});
},
getRegentItem(item,fieldCode="type"){
@@ -218,6 +219,7 @@ export default {
selectInfoKeys.forEach(key => {
result[key] = formData[key];
})
+ console.log(result,"result")
// 更新表单字段
this.formFields = result;
this.allFieldsConfig = config;
@@ -255,7 +257,7 @@ export default {
const errors = [];
// 清空之前的错误状态
this.errors = {};
- console.log(allFieldsConfig,"allFieldsConfig")
+ console.log(allFieldsConfig,formFields,"allFieldsConfig")
for (const key in allFieldsConfig) {
const o = allFieldsConfig[key];
if (o.otherCode) {//
@@ -366,15 +368,8 @@ export default {
this.compareFieldsIsEqual(val, compareToValue, key);
}
},
- onSelectChange(key, val, type) {
- // 获取对应的配置
- const currentConfig = this.allFieldsConfig[key];
- if (currentConfig.selectTo) {
- this.formFields[currentConfig.selectTo] = val;
- }
- this.onValueChangeCompareTo(key, val);
+ onAttachmentChange(key, val) {
this.formFields[key] = val;
- this.$emit("select", { key, value: val, type });
// 清除该表单项的错误状态
if (this.errors[key]) {
this.$set(this.errors, key, false);
diff --git a/src/views/business/comps/template/comps/sp/SP007.vue b/src/views/business/comps/template/comps/sp/SP007.vue
index 024b3cd..f8d454c 100644
--- a/src/views/business/comps/template/comps/sp/SP007.vue
+++ b/src/views/business/comps/template/comps/sp/SP007.vue
@@ -26,7 +26,7 @@
-
+