|
|
- 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();
- }
-
- }
- },
- }
|