<template>
  <div>
    <base-right-dialog
      ref="baseRightDialog"
      :footerShow="true"
      :dialogVisible.sync="dialogVisible"
      :title="dialogTitle + ' 消息日志'"
      @handleClose="handleDialogClose"
      :type="dialogType"
      :submitShow="false"
    >
      <base-form
        ref="basicsForm"
        :formRow="formRow"
        :isFunBtn="false"
        class="dialog_form"
        :spanWidth="`120px`"
        :loading="vLoading"
      ></base-form>
    </base-right-dialog>
  </div>
</template>

<script>
import baseRightDialog from "@/components/base/baseRightDialog";
import baseForm from "@/components/base/baseNewForm";
import baseTable from "@/components/base/baseTable";
import { getApiModuleApi } from "@/api/apiChunks/index.js";

export default {
  components: {
    baseRightDialog,
    baseForm,
    baseTable,
  },
  data() {
    return {
      dialogVisible: false,
      dialogTitle: "",
      dialogType: "",
      formRow: [],
      basicsRules: [],
      vLoading: false,
      newMarryOptions: [],
      submitShow: true,
      loadingType: true,
      tableVersionData: [],
      tableVersionColumn: [],
      funData: [],
      isEdit: false,
      select_dist: {},
    };
  },
  mounted() {},
  methods: {
    openDialog(type, row) {
      // 查看
      if (type == "show") {
        this.funData = Object.assign([], []);
        this.submitShow = false;
        this.formRow = [
          {
            elCol: [
              {
                label: "消息类型",
                prop: "type",
                tag: "elRadio",
                disabled: true,
                options: [
                  {
                    label: "系统消息",
                    value: "1",
                  },
                  {
                    label: "单据消息",
                    value: "2",
                  },
                  {
                    label: "钉钉消息",
                    value: "3",
                  },
                  {
                    label: "微信消息",
                    value: "4",
                  },
                ],
                span: 24,
              },
            ],
          },
          {
            elCol: [
              {
                label: "接收人",
                prop: "recipientsPersonName",
                tag: "elInput",
                disabled: true,
              },
              {
                label: "发送时间",
                prop: "sendDatetime",
                tag: "elInput",
                disabled: true,
              },
            ],
          },

          {
            elCol: [
              {
                label: "消息内容",
                prop: "sendCount",
                tag: "elInput",
                type: "textarea",
                disabled: true,
                span: 24,
              },
            ],
          },
          {
            elCol: [
              {
                label: "发送人",
                prop: "sendPersonName",
                tag: "elInput",
                disabled: true,
              },
              {
                label: "创建时间",
                prop: "create_time",
                tag: "elInput",
                disabled: true,
              },
            ],
          },
          {
            elCol: [
              {
                label: "三方系统消息结果",
                prop: "resultMessage",
                tag: "elInput",
                type: "textarea",
                disabled: true,
                span: 24,
              },
            ],
          },
        ];
        this.dialogTitle = "查看";
        this.dialogType = "show";
        this.productGetById(row.id);
      }
      this.dialogVisible = true;
    },
    // 编辑详情
    async productGetById(id) {
      let params = {
        id: id,
      };
      const res = await getApiModuleApi(
        {
          tl: "sysSendMessageLogService",
          as: "",
          dj: "getEntity",
        },
        {
          ...params,
        }
      );
      if (res.status == "200") {
        this.$nextTick(() => {
          this.$refs.basicsForm.incomingParameters(res.attribute);
        });
      }
    },
    // 弹窗关闭
    handleDialogClose() {
      this.tableVersionData = Object.assign([], []);
      this.$refs.basicsForm.resetFields();
      this.dialogVisible = false;
    },
  },
};
</script>

<style scoped lang="scss">
.dialogList {
  padding: 16px 0;
  border-top: 1px solid #dcdfe6;
  display: flex;
  flex-direction: column;
}

.updateBtn {
  border: 1px solid #ebedf1;
  padding: 5px 0;
  border-radius: 3px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  width: 100px;
}

.updateBtn:hover {
  color: #1890ff;
  border-color: #badeff;
  background-color: #e8f4ff;
}

::v-deep .el-table__body-wrapper.is-scrolling-none {
  height: auto !important;
}

::v-deep .app-container {
  height: auto !important;
}
</style>
