123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <template>
- <a-card :bordered="false">
- <div class="table-page-search-wrapper">
- <a-form layout="inline">
- <a-row :gutter="24">
- <a-col :md="6" :sm="6">
- <a-form-item label="标签名称">
- <a-input placeholder="请输入标签名称" v-model="queryParam.tagName"></a-input>
- </a-form-item>
- </a-col>
- <!-- -->
- <a-col :md="6" :sm="6">
- <a-form-item label="标签分类">
- <a-select v-model="queryParam.tagCategoryId" placeholder="请选择">
- <a-select-option value="1">形式</a-select-option>
- <a-select-option value="2">基调</a-select-option>
- <a-select-option value="3">内容</a-select-option>
- <a-select-option value="4">场景</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="6">
- <a-form-item label="标签等级">
- <a-select v-model="queryParam.level" placeholder="请选择">
- <a-select-option value="1">一级标签</a-select-option>
- <a-select-option value="2">二级标签</a-select-option>
- <a-select-option value="3">三级标签</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="6">
- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
- <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
- <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮区域 -->
- <div class="table-operator">
- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
- <!-- <a-button @click="batchDel" v-if="selectedRowKeys.length > 0" ghost type="primary" icon="delete">批量删除
- </a-button> -->
- </div>
- <!-- table区域-begin -->
- <div>
- <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="dataSource"
- :pagination="ipagination" :loading="loading" @change="handleTableChange">
- <span slot="tagName" slot-scope="text,record">
- <span v-if="record.status == 1">
- {{text}}
- </span>
- <span v-else-if="record.status == 0" style="color:red">
- {{text}}(未审核)
- </span>
- <span v-else>
- {{text}}(已驳回)
- </span>
- </span>
- <span slot="action" slot-scope="text, record">
- <a href="javascript:;" @click="handleAddSub(record)" :disabled="record.level==3">添加下级</a>
- <a-divider type="vertical" />
- <a @click="handleDeleteModel(record)" :disabled="!IsURL(record.model)">查看示例</a>
- <a-divider type="vertical" />
- <a-dropdown>
- <a class="ant-dropdown-link" @click="e => e.preventDefault()">
- 更多
- </a>
- <a-menu slot="overlay">
- <!-- <a-menu-item key="4" :disabled="!IsURL(record.model)">
- <a style="margin-right:20px" @click="handleDeleteModel(record)">查看示例</a>
- </a-menu-item> -->
- <a-menu-item key="0">
- <a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteElse(record.id)">
- <a>删除</a>
- </a-popconfirm>
- </a-menu-item>
- <a-menu-item key="1" :disabled="record.status==1">
- <a href="javascript:;" @click="handleDeleteStatus(record.id,'1')" :disabled="record.status==1">
- 通过</a>
- </a-menu-item>
- <a-menu-item key="3" :disabled="record.status==1">
- <a style="margin-right:20px" @click="handleDeleteStatus(record.id,'2')"
- :disabled="record.status==1">驳回</a>
- </a-menu-item>
- </a-menu>
- </a-dropdown>
- </span>
- <!-- 字符串超长截取省略号显示-->
- <span slot="model" slot-scope="text">
- <!-- <j-ellipsis :value="text" /> -->
- <video :src="text" v-if="text" style="width: 100%" controls="controls">您的浏览器不支持 video 标签。</video>
- <span v-else>-</span>
- </span>
- </a-table>
- </div>
- <!-- table区域-end -->
- <permission-modal ref="modalForm" @ok="modalFormOk"></permission-modal>
- </a-card>
- </template>
- <script>
- import PermissionModal from './modules/DepartModal'
- import {
- getPermissionList
- } from '@/api/api'
- import {
- httpAction,
- deleteAction,
- getAction
- } from '@/api/manage'
- import {
- JeecgListMixin
- } from '@/mixins/JeecgListMixin'
- // import PermissionDataRuleList from './PermissionDataRuleList'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import selectPagination from '@/views/modules/Statistics/components/selectPagination.vue'
- const columns = [{
- title: "标签分类",
- dataIndex: "tagCategoryId_dictText",
- key: 'tagCategoryId_dictText',
- align: 'center'
- },
- {
- title: '标签名称',
- dataIndex: 'tagName',
- key: 'tagName',
- align: 'center',
- scopedSlots: {
- customRender: 'tagName'
- },
- },
- /*{
- title: '菜单类型',
- dataIndex: 'menuType',
- key: 'menuType',
- customRender: function(text) {
- if (text == 0) {
- return '菜单'
- } else if (text == 1) {
- return '菜单'
- } else if (text == 2) {
- return '按钮/权限'
- } else {
- return text
- }
- }
- },*/
- {
- title: '标签层级',
- dataIndex: 'level',
- key: 'level',
- customRender: function (text) {
- if (text == 1) {
- return '一级标签'
- } else if (text == 2) {
- return '二级标签'
- } else if (text == 3) {
- return '三级标签'
- }
- },
- align: 'center'
- }, {
- title: '所属一级标签',
- dataIndex: 'firstTagId_dictText',
- key: 'firstTagId_dictText',
- customRender: function (text) {
- if (text == null) {
- return '-'
- } else {
- return text
- }
- },
- align: 'center'
- },
- {
- title: '所属二级标签',
- dataIndex: 'secendTagId_dictText',
- key: 'secendTagId_dictText',
- customRender: function (text) {
- if (text == null) {
- return '-'
- } else {
- return text
- }
- },
- align: 'center'
- },
- {
- title: '描述',
- dataIndex: 'description',
- key: 'description',
- customRender: function (text) {
- if (text == null) {
- return '-'
- } else {
- return text
- }
- },
- align: 'center',
- width: 400
- },
- // {
- // title: '标签示例',
- // dataIndex: 'model',
- // key: 'model',
- // scopedSlots: {
- // customRender: 'model'
- // },
- // // customRender: function (text) {
- // // if (text == null) {
- // // return '-'
- // // } else {
- // // return text
- // // }
- // // },
- // align: 'center',
- // width: 200
- // },
- {
- title: '操作',
- dataIndex: 'action',
- scopedSlots: {
- customRender: 'action'
- },
- align: 'center',
- width: 250
- }
- ]
- export default {
- name: 'label-material',
- mixins: [JeecgListMixin],
- components: {
- PermissionModal,
- JEllipsis,
- },
- data() {
- return {
- description: '标签管理',
- // 表头
- columns: columns,
- loading: false,
- // 展开的行,受控属性
- expandedRowKeys: [],
- url: {
- list: '/ctop/tagInfo/list',
- delete: '/ctop/tagInfo/edit',
- deleteBatch: '/sys/permission/deleteBatch'
- }
- }
- },
- methods: {
- IsURL(res) {
- // var strRegex = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|www\.)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/
- var strRegex =
- /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+(.+[A-Za-z0-9-~\/])+$/
- var re = new RegExp(strRegex)
- // console.log(re.test(res))
- if (re.test(res)) {
- return true
- } else {
- return false
- }
- },
- handleDeleteModel(record) {
- if (record.model) {
- if (this.IsURL(record.model)) {
- window.open(record.model, '_blank')
- }
- }
- },
- handleDeleteStatus(id, status) {
- httpAction('/ctop/tagInfo/edit', {
- id: id,
- status: status
- }, 'post').then(res => {
- if (res.success) {
- //删除成功后,去除已选中中的数据
- this.loadData(1)
- } else {
- this.$message.warning(res.message)
- }
- })
- },
- handleDeleteElse(id) {
- httpAction('/ctop/tagInfo/edit', {
- id: id,
- delFlag: 1
- }, 'post').then(res => {
- if (res.success) {
- //删除成功后,去除已选中中的数据
- this.loadData(1)
- } else {
- this.$message.warning('删除失败!')
- }
- })
- },
- handleAddSub(record) {
- this.$refs.modalForm.title = "添加子标签";
- this.$refs.modalForm.edit({
- status: '1',
- 'parentId': record.id,
- tagCategoryId: record.tagCategoryId
- });
- },
- handleExpandedRowsChange(expandedRows) {
- this.expandedRowKeys = expandedRows
- },
- }
- }
- </script>
- <style scoped>
- @import '~@assets/less/common.less';
- </style>
|