<template>
  <div class="index-container height-100">
    <fl-table :config="state.tableConfig"
              :refreshCount="state.tableConfig.refreshCount"
              @triggerRowActions="handleRowActions"
              @triggerTableBatchActions="handleTableBatchActions">
      <template #pictures="scoped">
        <div v-if="
            scoped.text.pictures.includes('[') &&
            scoped.text.pictures.includes(']')
          "
             class="overflow-auto row"
             style="flex-flow: nowrap">
          <a-popover placement="left"
                     v-for="(img, imgIdx) in JSON.parse(scoped.text.pictures)"
                     :key="imgIdx">
            <template #content>
              <img :src="img"
                   style="width: 500px; height: auto"
                   alt="file"
                   fallback="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEggh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jZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==" />
            </template>
            <div style="padding: 4px">
              <a-image height="50px"
                       width="50px"
                       style="object-fit: none"
                       :src="img"
                       :preview="{
                  src: img,
                }"
                       fallback="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQK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IRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==">
              </a-image>
            </div>
          </a-popover>
        </div>
      </template>
    </fl-table>
  </div>

  <a-modal v-if="state.modalVisible"
           v-model:visible="state.modalVisible"
           :title="state.dialogData.ID ? '编辑展讯' : '新增展讯'"
           width="800px"
           centered
           destroyOnClose
           :maskClosable="false">
    <div class="row">
      <div class="col-3 fl-my-sm">标题</div>
      <div class="col-9 fl-my-sm">
        <fl-form-item type="text"
                      field="title"
                      :val="state.dialogData.title"
                      :disable="state.pageDisable"
                      @triggerValChange="handleValChange" />
      </div>
      <div class="col-3 fl-my-sm">展讯内容</div>
      <div class="col-9 fl-my-sm">
        <div style="width: 330px">
          <fl-form-item type="markdown"
                        field="content"
                        :config="{
              style: 'height:none',
            }"
                        :disable="state.pageDisable"
                        :val="state.dialogData.content"
                        @triggerValChange="handleValChange" />
        </div>
      </div>
      <div class="col-3 fl-my-sm">展讯图片</div>
      <div class="col-9 fl-my-sm">
        <fl-form-item type="mulupload"
                      field="pictures"
                      height="200px"
                      :otherParams="{
            source: 'exhibitions',
            mask: '',
            type: 'image',
          }"
                      :disable="state.pageDisable"
                      :val="state.dialogData.pictures"
                      @triggerValChange="handleValChange" />
      </div>
    </div>

    <template #footer>
      <div class="row justify-between">
        <div>
          <a-button v-if="state.dialogData.ID && !state.pageDisable"
                    @click="handleSyncByOne"
                    :loading="state.btnLoading"
                    type="primary">同步数据</a-button>
        </div>
        <div>
          <a-button @click="handleCloseModal"
                    class="cancel-btn">取消</a-button>
          <a-button @click="handleDialogConfirm"
                    :disabled="state.pageDisable"
                    :loading="state.btnLoading"
                    type="primary">提交</a-button>
        </div>
      </div>
    </template>
  </a-modal>
</template>
<script setup>
import {
  ref,
  reactive,
  onBeforeMount,
  onMounted,
  getCurrentInstance,
  watch,
  nextTick,
} from "vue";
import flFormItem from "@/components/layout/form/formItem.vue";
import flTable from "@/components/layout/table/commonTable.vue";
import { processError, processSuccess } from "@/utils/helper/message";
const currentInstance = getCurrentInstance();
const { $request } = currentInstance.appContext.config.globalProperties;
const state = reactive({
  tableConfig: {
    rowKey: "ID",
    refreshCount: 0,
    listUrl: {
      url: "api/inCircleArticle/InCircleArticle/query",
      params: [],
    },
    searchConfig: [
      {
        type: "text",
        label: "标题",
        field: "title",
      },
    ],
    columns: [
      {
        width: 60,
        type: "select",
        label: "状态",
        field: "publishStatus",
        options: [
          {
            label: "草稿",
            value: 1,
            class: "status-draft",
          },
          {
            label: "已发布",
            value: 2,
            class: "status-primary",
          },
          {
            label: "归档",
            value: 3,
            class: "status-danger",
          },
        ],
      },
      {
        width: 120,
        label: "标题",
        field: "title",
      },
      {
        width: 120,
        label: "展讯内容",
        field: "content",
        type: "markdown",
      },
      {
        type: "slot",
        width: 100,
        label: "图片",
        field: "pictures",
        slotName: "pictures",
      },
      {
        label: "发布时间",
        field: "updatedAt",
      },
      {
        label: "发布地点",
        field: "location",
      },
      {
        label: "操作",
        actions: [
          {
            actionType: "linkView",
            label: "详情",
            type: "370D9B",
            class: "fl-ma-xs",
            shape: "round",
          },
          {
            show: "[%=publishStatus%]===1||[%=publishStatus%]===3",
            tooltip: true,
            label: "发布",
            type: "primary",
            shape: "round",
            class: "fl-ma-xs",
            actionUrl: {
              url: "api/inCircleArticle/InCircleArticle/update",
              params: [
                {
                  label: "publishStatus",
                  value: 2,
                },
                { label: "ID", field: "ID" },
              ],
            },
          },
          {
            show: "[%=publishStatus%]===2",
            tooltip: true,
            label: "归档",
            type: "danger",
            shape: "round",
            class: "fl-ma-xs",
            actionUrl: {
              url: "api/inCircleArticle/InCircleArticle/update",
              params: [
                {
                  label: "publishStatus",
                  value: 3,
                },
                { label: "ID", field: "ID" },
              ],
            },
          },
          {
            show: "[%=publishStatus%]===1||[%=publishStatus%]===3",
            tooltip: true,
            type: "delete",
            label: "删除",
            shape: "round",
            class: "fl-ma-xs",
            actionUrl: {
              url: "api/inCircleArticle/InCircleArticle/delete",
              params: [{ label: "id", field: "ID" }],
            },
          },
        ],
      },
    ],
    slotRightClass: "col-12 row",
    tableBatchActionsClass: "col-12 row justify-end",
    tableBatchActions: [
      {
        notLimitSelect: true,
        actionType: "createData",
        type: "primary",
        label: "创建",
      },
      {
        notLimitSelect: true,
        actionType: "allsync",
        type: "primary",
        label: "一键同步",
        actionUrl: {
          url: "api/inCircleArticle/InCircleArticle/sync",
        },
      },
    ],
    expandConfig: {
      rowKey: "artworkUid",
      refreshCount: 0,
      listUrl: {
        url: "api/inCircleArticle/Comment/query",
        params: [
          {
            label: "ownerID",
            field: "ID",
          },
          {
            label: "ownerType",
            value: "in_circle_article",
          },
        ],
      },
      tableMaxHeight: 400,
      searchConfig: [
        {
          type: "text",
          label: "评论人",
          field: "name",
        },
        {
          type: "text",
          label: "评论内容",
          field: "content",
        },
      ],
      columns: [
        {
          type: "assignField",
          assignField: "inCircleUserInfo",
          label: "评论人",
          field: "name",
        },
        {
          label: "评论时间",
          field: "createdAt",
        },
        {
          label: "评论地点",
          field: "location",
        },
        {
          label: "评论内容",
          field: "content",
          type: "tooltip",
        },
      ],
    },
  },
  modalVisible: false,
  btnLoading: false,
  dialogData: {
    title: null,
    content: null,
    pictures: [],
    inCirclePublisherId: 1,
  },
  pageDisable: false,
});
onBeforeMount(() => { });
onMounted(() => { });

const handleRowActions = (btnConfig, rowData) => {
  if (btnConfig.actionType === "linkView") {
    state.pageDisable = false;
    if (rowData.publishStatus === 2) {
      state.pageDisable = true;
    }
    state.dialogData = JSON.parse(JSON.stringify(rowData));
    state.dialogData.pictures = JSON.parse(state.dialogData.pictures);
    state.modalVisible = true;
  }
};
const handleTableBatchActions = (selectedRows, config, rowData) => {
  if (config.actionType === "createData") {
    state.pageDisable = false;
    state.dialogData = {
      title: null,
      content: null,
      pictures: [],
      inCirclePublisherId: 1,
    };
    state.modalVisible = true;
  }
  if (config.actionType === "allsync") {
    let url = "api/inCircleArticle/InCircleArticle/sync";
    config.loading = true;
    $request.HTTP.components.postDataByParams(url, {}).then(
      (res) => {
        if (res.status === 0) {
          state.tableConfig.refreshCount++;
        } else {
          processError(res.msg);
        }
        config.loading = false;
      },
      (err) => {
        config.loading = false;
        processError(err.response.data.msg);
      }
    );
  }
};
// 详情同步展讯
const handleSyncByOne = () => {
  // getExhibitionsViewData();
  let url = "api/inCircleArticle/InCircleArticle/sync";
  let params = { syncArticleId: state.dialogData.syncArticleId };
  state.btnLoading = true;
  $request.HTTP.components.postDataByParams(url, params).then(
    (res) => {
      if (res.status === 0) {
        if (res.data) {
          state.dialogData = res.data;
        }
        state.tableConfig.refreshCount++;
      } else {
        processError(res.msg);
      }
      state.btnLoading = false;
    },
    (err) => {
      state.btnLoading = false;
      processError(err.response.data.msg);
    }
  );
};
// 获取展讯详情数据
const getExhibitionsViewData = () => {
  let url = "api/inCircleArticle/InCircleArticle/detail";
  let params = { id: state.dialogData.ID };
  $request.HTTP.components.postDataByParams(url, params).then(
    (res) => {
      if (res.status === 0) {
        state.dialogData = res.data;
        state.dialogData.pictures = JSON.parse(state.dialogData.pictures);
      } else {
        processError(res.msg);
      }
    },
    (err) => {
      processError(err.response.data.msg);
    }
  );
};
const handleCloseModal = () => {
  state.modalVisible = false;
};

const handleDialogConfirm = () => {
  let url = state.dialogData.ID
    ? "api/inCircleArticle/InCircleArticle/update"
    : "api/inCircleArticle/InCircleArticle/create";
  let params = JSON.parse(JSON.stringify(state.dialogData));
  params.pictures = JSON.stringify(params.pictures.filter((item) => item));
  state.btnLoading = true;
  $request.HTTP.components.postDataByParams(url, params).then(
    (res) => {
      if (res.status === 0) {
        state.modalVisible = false;
        state.tableConfig.refreshCount++;
      } else {
        processError(res.msg);
      }
      state.btnLoading = false;
    },
    (err) => {
      state.btnLoading = false;
      processError(err.response.data.msg);
    }
  );
};
const handleValChange = (val, field) => {
  state.dialogData[field] = val;
};
const calcImageVal = (field, rowData) => {
  let url = rowData[field] || "";
  if (Array.isArray(field)) {
    for (let fid in field) {
      if (rowData[field[fid]]) {
        url = rowData[field[fid]];
        break;
      }
    }
  }
  return url;
};
</script>
<style scoped></style>
