|
@@ -0,0 +1,192 @@
|
|
|
+<template>
|
|
|
+ <a-card :bordered="false">
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline">
|
|
|
+ <a-row :gutter="48">
|
|
|
+ <a-col :md="8" :sm="24">
|
|
|
+ <a-form-item label="关键字">
|
|
|
+ <a-input v-model.trim="queryParam.title" placeholder="请输入名称"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="8 || 24" :sm="24">
|
|
|
+ <span class="table-page-search-submitButtons">
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
|
|
+ <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
|
|
|
+ </span>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="table-operator" style="margin-bottom: 8px;">
|
|
|
+ <a-button v-if="$auth('operate-articles-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <s-table
|
|
|
+ ref="table"
|
|
|
+ size="default"
|
|
|
+ rowKey="id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :alert="options.alert"
|
|
|
+ :rowSelection="options.rowSelection"
|
|
|
+ showPagination="auto"
|
|
|
+ >
|
|
|
+ <span slot="action" slot-scope="record">
|
|
|
+ <template>
|
|
|
+ <a @click="handleView(record)">查看</a>
|
|
|
+ <a-divider type="vertical" />
|
|
|
+ <a @click="handleEdit(record)">修改</a>
|
|
|
+ </template>
|
|
|
+ </span>
|
|
|
+ </s-table>
|
|
|
+ <base-form ref="baseModal" @ok="handleOk"/>
|
|
|
+ <detail ref="detailModal" />
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { STable, Ellipsis } from '@/components'
|
|
|
+import BaseForm from './modules/BaseForm'
|
|
|
+import Detail from './modules/Detail'
|
|
|
+import {
|
|
|
+ getProductPage,
|
|
|
+ fetchProduct
|
|
|
+} from '@/api/qykh/product'
|
|
|
+import DictCache from '@/utils/dict'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'PlanDetailList',
|
|
|
+ components: {
|
|
|
+ STable,
|
|
|
+ Ellipsis,
|
|
|
+ BaseForm,
|
|
|
+ Detail
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ // 查询参数
|
|
|
+ queryParam: {
|
|
|
+ },
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ title: '序号',
|
|
|
+ dataIndex: 'index',
|
|
|
+ customRender: (text, record, index) => {
|
|
|
+ return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '标题',
|
|
|
+ dataIndex: 'pname'
|
|
|
+ },
|
|
|
+ /* {
|
|
|
+ title: '摘要',
|
|
|
+ dataIndex: 'shortdesc'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'purl',
|
|
|
+ dataIndex: 'purl'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'bannerurl',
|
|
|
+ dataIndex: 'bannerurl'
|
|
|
+ }, */
|
|
|
+ {
|
|
|
+ title: '关键字',
|
|
|
+ dataIndex: 'keywords'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '排序',
|
|
|
+ dataIndex: 'ord'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ key: 'action',
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: { customRender: 'action' }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ parameter = {
|
|
|
+ ...parameter,
|
|
|
+ keyword: this.queryParam.keyword,
|
|
|
+ dataScope: {
|
|
|
+ sortBy: 'desc',
|
|
|
+ sortName: 'update_time'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getProductPage(Object.assign(parameter, this.queryParam))
|
|
|
+ .then(res => {
|
|
|
+ return res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ selectedRowKeys: [],
|
|
|
+ selectedRows: [],
|
|
|
+
|
|
|
+ options: {
|
|
|
+ alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
|
|
|
+ rowSelection: {
|
|
|
+ selectedRowKeys: this.selectedRowKeys,
|
|
|
+ onChange: this.onSelectChange
|
|
|
+ }
|
|
|
+ },
|
|
|
+ optionAlertShow: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ tableOption () {
|
|
|
+ if (!this.optionAlertShow) {
|
|
|
+ this.options = {
|
|
|
+ alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
|
|
|
+ rowSelection: {
|
|
|
+ selectedRowKeys: this.selectedRowKeys,
|
|
|
+ onChange: this.onSelectChange,
|
|
|
+ getCheckboxProps: record => ({
|
|
|
+ props: {
|
|
|
+ disabled: false,
|
|
|
+ name: record.id + ''
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.optionAlertShow = true
|
|
|
+ } else {
|
|
|
+ this.options = {
|
|
|
+ alert: false,
|
|
|
+ rowSelection: null
|
|
|
+ }
|
|
|
+ this.optionAlertShow = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleEdit (record) {
|
|
|
+ fetchProduct({ id: record.id }).then(res => {
|
|
|
+ const modal = this.$refs.baseModal
|
|
|
+ modal.base(res.data)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleView (record) {
|
|
|
+ fetchProduct({ id: record.id }).then(res => {
|
|
|
+ const modal = this.$refs.detailModal
|
|
|
+ modal.base(res.data)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleOk () {
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ },
|
|
|
+ onSelectChange (selectedRowKeys, selectedRows) {
|
|
|
+ this.selectedRowKeys = selectedRowKeys
|
|
|
+ this.selectedRows = selectedRows
|
|
|
+ },
|
|
|
+ resetSearchForm () {
|
|
|
+ this.queryParam = {
|
|
|
+ }
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|