123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- <template>
- <div :class="[$style.wrapHeight, $style.modelMarket]">
- <div :class="$style.rowHeight">
- <a-card :class="$style.aCard">
- <audit-advanced-query
- :expand="expand"
- :search-data="formData"
- :ref-name="searchform"
- :search-style="{ height: '200px', left: '20px', top: '57px' }"
- :search-fun="handleSearch"
- @searchedClick="searchedClick"
- >
- <template>
- <a-col :span="12">
- <a-form-model-item :label="'模型名称'" prop="modelName">
- <a-input v-model="formData.modelName" allow-clear />
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="模型类型:" prop="modelType">
- <a-select
- v-model="formData.modelType"
- :class="$style.selectClass"
- placeholder="请选择模型类型"
- >
- <a-select-option
- v-for="(item, index) in tableOptions"
- :key="index"
- :value="item.id"
- >
- {{ item.name }}
- </a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="创建人:" prop="creatorAccount">
- <a-input v-model="formData.creatorAccount" placeholder="请输入创建人" />
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-item label="发布时间:">
- <a-range-picker :key="pickerKey" :format="'YYYY-MM-DD'" @change="onTimeChange" />
- </a-form-item>
- </a-col>
- </template>
- </audit-advanced-query>
- <div :class="$style.modeList">
- <sd-data-table
- ref="table"
- :data-url="dataUrl"
- :columns="columns"
- :filter-expressions="expressions"
- show-advance-query
- :search-fields="['modelName']"
- @searchbtnClick="searchbtnClick"
- >
- <template slot="likeCount" slot-scope="text, record">
- <a-tooltip :title="text" @click="onLike(record)">
- <a-icon type="like" :theme="record.likeFlag === 1 ? 'twoTone' : 'outlined'" />
- </a-tooltip>
- </template>
- <template slot="islink" slot-scope="text, record">
- <a-tooltip :title="text" @click="openModelDetail(record.id)">
- <a>{{ text }}</a>
- </a-tooltip>
- </template>
- </sd-data-table>
- </div>
- </a-card>
- </div>
- </div>
- </template>
- <script>
- import components from './_import-components/audit-model-market-import'
- import auditModelService from './audit-model-service'
- import TableColumnTypes from '@/common/services/table-column-types'
- // 引入moment
- import moment from 'moment'
- import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
- import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
- const modelTypeList = [
- {
- id: 0,
- name: '分析型',
- },
- {
- id: 1,
- name: '定位型-整改类',
- },
- {
- id: 2,
- name: '定位型-关注类',
- },
- ]
- export default {
- name: 'AuditModelMarket',
- metaInfo: {
- title: '模型市场',
- },
- components: {
- ...components,
- auditAdvancedQuery,
- },
- mixins: [auditAdvancedQueryMixins],
- data() {
- return {
- expressions: [],
- expand: false,
- searchform: 'searchform',
- pickerKey: 0,
- formData: {
- // modelName modelType creatorAccount publishDateSt publishDateEd
- modelName: '',
- modelType: '',
- creatorAccount: '',
- publishDateSt: '',
- publishDateEd: '',
- },
- tableOptions: modelTypeList,
- // 模型市场列表
- modelMarketList: [],
- // 分页器
- current: 1,
- total: 1,
- pageSize: 10,
- ifLike: false,
- dataUrl: 'api/xcoa-mobile/v1/iammodelmaintain/modelMarketQueryList',
- columns: [
- {
- dataIndex: 'modelName',
- title: '模型名称',
- scopedSlots: { customRender: 'islink' },
- },
- {
- dataIndex: 'creatorAccount',
- title: '创建人',
- },
- {
- dataIndex: 'modelCode',
- title: '模型编号',
- },
- {
- dataIndex: 'modelTypeName',
- title: '模型类型',
- },
- {
- dataIndex: 'publishDate',
- title: '发布时间',
- sdRender: TableColumnTypes.date,
- },
- {
- dataIndex: 'likeCount',
- title: '点赞',
- scopedSlots: { customRender: 'likeCount' },
- },
- ],
- }
- },
- methods: {
- handleSearch() {
- this.expressions = []
- Object.keys(this.formData).map((key) => {
- this.formData[key] !== '' &&
- this.expressions.push({
- dataType: 'str',
- name: key,
- op: 'eq',
- stringValue: this.formData[key],
- })
- })
- this.expressions.forEach((item) => {
- if (item.name === 'modelName') {
- item.op = 'like'
- item.stringValue = '%' + item.stringValue + '%'
- }
- })
- },
- // 时间变化
- onTimeChange(data, dataString) {
- const timeList = data.map((item) => {
- // 转化成时间戳 并忽略时分秒
- return moment(item._d)
- .startOf('day')
- .valueOf()
- })
- // 结束时间加一天的时间戳
- this.formData.publishDateSt = timeList[0]
- this.formData.publishDateEd = timeList[1] + 60 * 60 * 24 * 1000
- },
- // 点击点赞按钮
- onLike(item) {
- const data = {
- modelId: item.id,
- }
- if (this.ifLike) {
- return
- }
- this.ifLike = true
- if (item.likeFlag === 0) {
- auditModelService.likeModel(data).then((res) => {
- this.$refs.table.refresh()
- this.ifLike = false
- })
- } else {
- auditModelService.unlikeModel(data).then((res) => {
- this.$refs.table.refresh()
- this.ifLike = false
- })
- }
- },
- openModelDetail(id) {
- window.open('#/audit-model-view?record=' + id)
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- .wrap-height {
- position: relative;
- min-height: 100%;
- .row-height {
- display: flex;
- flex: auto;
- gap: 10px;
- width: 100%;
- height: 100%;
- .a-card {
- width: 100%;
- .select-class {
- width: 200px;
- }
- .mode-list {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- padding: 0 30px;
- .card {
- width: 430px;
- margin: 30px;
- overflow: hidden;
- cursor: pointer;
- border: 1px solid #ccc;
- border-radius: 10px;
- .title {
- display: flex;
- justify-content: space-between;
- padding: 20px;
- color: #fff;
- background: $alert-info-icon-color;
- }
- .card-body {
- padding: 20px;
- border-bottom: 1px solid #ccc;
- .row {
- margin-top: 20px;
- }
- }
- .footer {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- padding: 20px;
- }
- }
- }
- .pagination {
- display: flex;
- justify-content: flex-end;
- padding: 20px;
- }
- }
- }
- }
- .model-market {
- :global(.projectlist .ant-table-empty .ant-table-body) {
- overflow-x: hidden !important;
- }
- :global(span > .ant-btn:nth-child(2)) {
- color: #fff;
- background-color: #1890ff;
- border-color: #1890ff;
- }
- }
- </style>
|