<template>
  <div :class="$style.card">
    <a-card>
      <sd-data-table-sys
        ref="commonwordsTable"
        :actions="actions"
        form-id="oaPublicOpinion"
        page-id="base/publicopinion/oaPublicOpinion"
        data-url="api/framework/v1/opinion-manager/opinion/list"
        show-selection
        :columns="columns"
        :row-key="'id'"
        :search-fields="['opinionContent']"
        :filter-expressions="filterExpressions"
      >
        <!-- 详情表单 -->
        <template v-slot:form>
          <sd-form-item name="opinionContent"></sd-form-item>
          <sd-form-item name="sortNum"></sd-form-item>
          <sd-form-item
            name="opinionType"
            :hidden="true"
            :input-props="{ defaultValue: 1 }"
          ></sd-form-item>
        </template>
      </sd-data-table-sys>
    </a-card>
  </div>
</template>

<script>
import TableColumnTypes from '../common/services/table-column-types'
import TableActionTypes from '../common/services/table-action-types'
import components from './_import-components/sd-common-usage-import'
export default {
  name: 'SdCommonUsage',
  metaInfo: {
    title: '公共常用语管理',
  },
  components,
  data() {
    return {
      filterExpressions: [
        {
          dataType: 'int',
          name: 'opinionType',
          op: 'eq',
          intValue: 1,
        },
      ],
      columns: [
        {
          title: '意见',
          dataIndex: 'opinionContent',
          sdClickable: true, // 列内容是否可点击
        },
        {
          title: '排序号',
          dataIndex: 'sortNum',
          defaultSortOrder: 'asc', // 默认的排序列
        },
        {
          title: '最后一次修改时间',
          dataIndex: 'lastModifiedTime',
          defaultSortOrder: 'descend', // 默认排序列，排序号相同时，按照最后一次修改时间降序排列
          sdRender: TableColumnTypes.dateTime,
        },
      ],
      actions: [
        {
          label: '新建',
          id: 'new',
          type: TableActionTypes.ex.create,
        },
        {
          label: '删除',
          id: 'delete',
          type: TableActionTypes.ex.delete,
        },
      ],
    }
  },
  created() {},
  methods: {},
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
.card {
  height: 100%;
}
</style>
