华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

76 lines
2.7 KiB

import { EventBus } from "@/utils/eventBus";
import { getuuid } from "@/utils/index";
import moment from "moment";
export default {
inject: ["templateFillType"],
data() {
return {
uuid: getuuid(),
deleteIndex: 0,
}
},
mounted() {
EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
},
unmounted() {
EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
},
methods: {
handleEditSignCallback(data) {
if (data.uuid === this.uuid) {
console.log(this.columns, this.templateFillType, data, "this.columns")
const { qmrMc, qmrMcEn, remark } = data.data;
const { fieldItemLabel, columnsData } = this.columns;
const { row } = this;
const desArr = columnsData.map((item) => {
const label = this.$t(item.label), otherValue = "", subValue = "", mainValue = row[item.prop];
if (item.bodySubKey && (item.bodySubType !== "button")) {
subValue = row[item.bodySubKey];
}
if (item.otherCode) {
otherValue = row[item.otherCode];
}
const desStr = `${label}:${mainValue}${subValue ? `[${subValue}]` : ''}${otherValue ? `[${otherValue}]` : ''}`;
return desStr;
});
const record = [
{
"userNameCn": qmrMc,
"userNameEn": qmrMcEn,
"fieldCn": this.$t(fieldItemLabel, 'zh_CN'),
"fieldEn": this.$t(fieldItemLabel, 'en_US'),
"oldValue": desArr.join(";"),
"value": "",
"title": "修改",
"time": moment().format("YYYY-MM-DD HH:mm:ss"),
"reason": remark
}
]
this.sureDelete(record);
}
},
sureDelete(record) {
this.$emit("deleteRow", this.deleteIndex);
setTimeout(() => {
const params = {
type: "fieldChanged",
newRecord: record || null,
resourceList: null,
}
EventBus.$emit('onModifyRecord', params,)
}, 30);
},
// 删除行
deleteRow(index) {
this.deleteIndex = index;
if (this.templateFillType === "actFill") {
EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
} else {
this.sureDelete();
}
}
},
}