|
@ -0,0 +1,233 @@
|
|
|
<template>
|
|
|
<a-card :bordered="false">
|
|
|
<div class="table-page-search-wrapper" v-if="hasPerm('companyCaseIndex:page')">
|
|
|
<a-form layout="inline">
|
|
|
<a-row :gutter="48">
|
|
|
<a-col :md="8" :sm="24">
|
|
|
<a-form-item label="名称">
|
|
|
<a-input v-model="queryParam.name" allow-clear placeholder="请输入名称搜索"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="16" :sm="24">
|
|
|
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
|
|
<a-button type="primary" style="margin-left: 8px" v-if="hasPerm('companyCaseIndex:add')" icon="plus" @click="$refs.addForm.add()">新增</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-form>
|
|
|
</div>
|
|
|
<s-table
|
|
|
ref="table"
|
|
|
size="default"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
:alert="true"
|
|
|
:rowKey="(record) => record.id"
|
|
|
>
|
|
|
<span slot="companyName" slot-scope="text">
|
|
|
<ellipsis :length="10" tooltip>{{ text }}</ellipsis>
|
|
|
</span>
|
|
|
<span slot="companyDescribe" slot-scope="text">
|
|
|
<ellipsis :length="10" tooltip>{{ text }}</ellipsis>
|
|
|
</span>
|
|
|
<span slot="companyDefaultImg" slot-scope="src">
|
|
|
<img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)"/>
|
|
|
</span>
|
|
|
<span slot="companyExchangeImg" slot-scope="src">
|
|
|
<img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)"/>
|
|
|
</span>
|
|
|
<span slot="companyAssociatedCase" slot-scope="text">
|
|
|
<ellipsis :length="10" tooltip>{{ text }}</ellipsis>
|
|
|
</span>
|
|
|
<span slot="companyJumpUrl" slot-scope="text">
|
|
|
<ellipsis :length="10" tooltip>{{ text }}</ellipsis>
|
|
|
</span>
|
|
|
<span slot="action" slot-scope="text, record">
|
|
|
<a-popconfirm placement="top" :title="record.companyIsLine===1? '是否确认下线该条目?':'是否确认上线该条目?'" @confirm="() => editjobStatusStatus(record.companyIsLine,record)">
|
|
|
<a>{{ statusFilter(record.companyIsLine) }}</a>
|
|
|
</a-popconfirm>
|
|
|
<a v-if="hasPerm('companyCaseIndex:edit')" @click="$refs.editForm.edit(record)">编辑</a>
|
|
|
<a-divider type="vertical" v-if="hasPerm('companyCaseIndex:edit') && hasPerm('companyCaseIndex:delete')"/>
|
|
|
<a-popconfirm v-if="hasPerm('companyCaseIndex:delete')" placement="topRight" title="是否确认删除该条目?" @confirm="() => companyCaseIndexDelete(record)">
|
|
|
<a>删除</a>
|
|
|
</a-popconfirm>
|
|
|
</span>
|
|
|
</s-table>
|
|
|
<add-form ref="addForm" @ok="handleOk" />
|
|
|
<edit-form ref="editForm" @ok="handleOk" />
|
|
|
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
|
|
|
<img alt="example" style="width: 100%" :src="previewImage" />
|
|
|
</a-modal>
|
|
|
</a-card>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { STable, Ellipsis } from '@/components'
|
|
|
import homeApi from '@/api/homeApi'
|
|
|
import { setImgUrl } from '@/utils/img'
|
|
|
import addForm from './addCompanyCaseForm'
|
|
|
import editForm from './editBannerForm'
|
|
|
// import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
|
|
|
export default {
|
|
|
name: 'CompanyCaseIndex',
|
|
|
components: {
|
|
|
STable,
|
|
|
Ellipsis,
|
|
|
addForm,
|
|
|
editForm
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
// 查询参数
|
|
|
queryParam: { id: '' },
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{
|
|
|
title: '序号',
|
|
|
dataIndex: 'dataIndex',
|
|
|
customRender: (text, row, index) => {
|
|
|
return index + 1
|
|
|
},
|
|
|
align: 'center',
|
|
|
width: '90px'
|
|
|
},
|
|
|
{
|
|
|
title: '名称',
|
|
|
dataIndex: 'companyName',
|
|
|
scopedSlots: { customRender: 'companyName' }
|
|
|
},
|
|
|
{
|
|
|
title: '描述',
|
|
|
dataIndex: 'companyDescribe',
|
|
|
scopedSlots: { customRender: 'companyDescribe' }
|
|
|
},
|
|
|
{
|
|
|
title: '默认图片',
|
|
|
dataIndex: 'companyDefaultImg',
|
|
|
scopedSlots: { customRender: 'companyDefaultImg' },
|
|
|
align: 'center',
|
|
|
width: '150px'
|
|
|
},
|
|
|
{
|
|
|
title: '交互图片',
|
|
|
dataIndex: 'companyExchangeImg',
|
|
|
scopedSlots: { customRender: 'companyExchangeImg' },
|
|
|
align: 'center',
|
|
|
width: '150px'
|
|
|
},
|
|
|
{
|
|
|
title: '关联案例',
|
|
|
dataIndex: 'companyAssociatedCase',
|
|
|
scopedSlots: { customRender: 'companyAssociatedCase' }
|
|
|
},
|
|
|
{
|
|
|
title: '跳转链接',
|
|
|
dataIndex: 'companyJumpUrl',
|
|
|
scopedSlots: { customRender: 'companyJumpUrl' }
|
|
|
},
|
|
|
{
|
|
|
title: '排序',
|
|
|
dataIndex: 'companySort',
|
|
|
align: 'center',
|
|
|
width: '90px'
|
|
|
}
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
return homeApi.findCompanyCaseById(Object.assign(parameter, this.queryParam)).then((res) => {
|
|
|
return res.data
|
|
|
})
|
|
|
},
|
|
|
selectedRowKeys: [],
|
|
|
selectedRows: [],
|
|
|
statusDictTypeDropDown: [{ code: 0, name: '下线' }, { code: 1, name: '上线' }],
|
|
|
previewVisible: false,
|
|
|
previewImage: ''
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
if (this.hasPerm('companyCaseIndex:edit') || this.hasPerm('companyCaseIndex:delete') || hasPerm('companyCaseIndex:start') || hasPerm('companyCaseIndex:stop')) {
|
|
|
this.columns.push({
|
|
|
title: '操作',
|
|
|
width: '150px',
|
|
|
dataIndex: 'action',
|
|
|
scopedSlots: { customRender: 'action' }
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
filters: {
|
|
|
getImgUrl (v) {
|
|
|
return setImgUrl(v)
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
statusFilter (status) {
|
|
|
const values = this.statusDictTypeDropDown.filter(item => item.code === status)
|
|
|
if (values.length > 0) {
|
|
|
return values[0].value
|
|
|
} else {
|
|
|
return 'ddd'
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
* 启动停止
|
|
|
*/
|
|
|
editjobStatusStatus (code, record) {
|
|
|
if (code === 1) {
|
|
|
homeApi.updateIsLineCompanyCase({ id: record.id, isLine: false }).then(res => {
|
|
|
if (res.success) {
|
|
|
this.$message.success('下线成功')
|
|
|
this.$refs.table.refresh()
|
|
|
} else {
|
|
|
this.$message.error('下线失败:' + res.message)
|
|
|
}
|
|
|
})
|
|
|
} else if (code === 2) {
|
|
|
homeApi.updateIsLineCompanyCase({ id: record.id, isLine: true }).then(res => {
|
|
|
if (res.success) {
|
|
|
this.$message.success('上线成功')
|
|
|
this.$refs.table.refresh()
|
|
|
} else {
|
|
|
this.$message.error('上线失败:' + res.message)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
companyCaseIndexDelete (record) {
|
|
|
homeApi.deleteCompanyCase({ id: record.id }).then((res) => {
|
|
|
if (res.success) {
|
|
|
this.$message.success('删除成功')
|
|
|
this.$refs.table.refresh()
|
|
|
} else {
|
|
|
this.$message.error('删除失败:' + res.message)
|
|
|
}
|
|
|
}).catch((err) => {
|
|
|
this.$message.error('删除错误:' + err.message)
|
|
|
})
|
|
|
},
|
|
|
toggleAdvanced () {
|
|
|
this.advanced = !this.advanced
|
|
|
},
|
|
|
handleOk () {
|
|
|
this.$refs.table.refresh()
|
|
|
},
|
|
|
onSelectChange (selectedRowKeys, selectedRows) {
|
|
|
this.selectedRowKeys = selectedRowKeys
|
|
|
this.selectedRows = selectedRows
|
|
|
},
|
|
|
showPreviewImg (src) {
|
|
|
this.previewImage = setImgUrl(src)
|
|
|
this.previewVisible = true
|
|
|
},
|
|
|
handleCancel () {
|
|
|
this.previewVisible = false
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less">
|
|
|
.table-operator {
|
|
|
margin-bottom: 18px;
|
|
|
}
|
|
|
button {
|
|
|
margin-right: 8px;
|
|
|
}
|
|
|
</style>
|