labelMaterial.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <a-card :bordered="false">
  3. <div class="table-page-search-wrapper">
  4. <a-form layout="inline">
  5. <a-row :gutter="24">
  6. <a-col :md="6" :sm="6">
  7. <a-form-item label="标签名称">
  8. <a-input placeholder="请输入标签名称" v-model="queryParam.tagName"></a-input>
  9. </a-form-item>
  10. </a-col>
  11. <!-- -->
  12. <a-col :md="6" :sm="6">
  13. <a-form-item label="标签分类">
  14. <a-select v-model="queryParam.tagCategoryId" placeholder="请选择">
  15. <a-select-option value="1">形式</a-select-option>
  16. <a-select-option value="2">基调</a-select-option>
  17. <a-select-option value="3">内容</a-select-option>
  18. <a-select-option value="4">场景</a-select-option>
  19. </a-select>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="6" :sm="6">
  23. <a-form-item label="标签等级">
  24. <a-select v-model="queryParam.level" placeholder="请选择">
  25. <a-select-option value="1">一级标签</a-select-option>
  26. <a-select-option value="2">二级标签</a-select-option>
  27. <a-select-option value="3">三级标签</a-select-option>
  28. </a-select>
  29. </a-form-item>
  30. </a-col>
  31. <a-col :md="6" :sm="6">
  32. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  33. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  34. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  35. </span>
  36. </a-col>
  37. </a-row>
  38. </a-form>
  39. </div>
  40. <!-- 操作按钮区域 -->
  41. <div class="table-operator">
  42. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  43. <!-- <a-button @click="batchDel" v-if="selectedRowKeys.length > 0" ghost type="primary" icon="delete">批量删除
  44. </a-button> -->
  45. </div>
  46. <!-- table区域-begin -->
  47. <div>
  48. <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="dataSource"
  49. :pagination="ipagination" :loading="loading" @change="handleTableChange">
  50. <span slot="tagName" slot-scope="text,record">
  51. <span v-if="record.status == 1">
  52. {{text}}
  53. </span>
  54. <span v-else-if="record.status == 0" style="color:red">
  55. {{text}}(未审核)
  56. </span>
  57. <span v-else>
  58. {{text}}(已驳回)
  59. </span>
  60. </span>
  61. <span slot="action" slot-scope="text, record">
  62. <a href="javascript:;" @click="handleAddSub(record)" :disabled="record.level==3">添加下级</a>
  63. <a-divider type="vertical" />
  64. <a @click="handleDeleteModel(record)" :disabled="!IsURL(record.model)">查看示例</a>
  65. <a-divider type="vertical" />
  66. <a-dropdown>
  67. <a class="ant-dropdown-link" @click="e => e.preventDefault()">
  68. 更多
  69. </a>
  70. <a-menu slot="overlay">
  71. <!-- <a-menu-item key="4" :disabled="!IsURL(record.model)">
  72. <a style="margin-right:20px" @click="handleDeleteModel(record)">查看示例</a>
  73. </a-menu-item> -->
  74. <a-menu-item key="0">
  75. <a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteElse(record.id)">
  76. <a>删除</a>
  77. </a-popconfirm>
  78. </a-menu-item>
  79. <a-menu-item key="1" :disabled="record.status==1">
  80. <a href="javascript:;" @click="handleDeleteStatus(record.id,'1')" :disabled="record.status==1">
  81. 通过</a>
  82. </a-menu-item>
  83. <a-menu-item key="3" :disabled="record.status==1">
  84. <a style="margin-right:20px" @click="handleDeleteStatus(record.id,'2')"
  85. :disabled="record.status==1">驳回</a>
  86. </a-menu-item>
  87. </a-menu>
  88. </a-dropdown>
  89. </span>
  90. <!-- 字符串超长截取省略号显示-->
  91. <span slot="model" slot-scope="text">
  92. <!-- <j-ellipsis :value="text" /> -->
  93. <video :src="text" v-if="text" style="width: 100%" controls="controls">您的浏览器不支持 video 标签。</video>
  94. <span v-else>-</span>
  95. </span>
  96. </a-table>
  97. </div>
  98. <!-- table区域-end -->
  99. <permission-modal ref="modalForm" @ok="modalFormOk"></permission-modal>
  100. </a-card>
  101. </template>
  102. <script>
  103. import PermissionModal from './modules/DepartModal'
  104. import {
  105. getPermissionList
  106. } from '@/api/api'
  107. import {
  108. httpAction,
  109. deleteAction,
  110. getAction
  111. } from '@/api/manage'
  112. import {
  113. JeecgListMixin
  114. } from '@/mixins/JeecgListMixin'
  115. // import PermissionDataRuleList from './PermissionDataRuleList'
  116. import JEllipsis from '@/components/jeecg/JEllipsis'
  117. import selectPagination from '@/views/modules/Statistics/components/selectPagination.vue'
  118. const columns = [{
  119. title: "标签分类",
  120. dataIndex: "tagCategoryId_dictText",
  121. key: 'tagCategoryId_dictText',
  122. align: 'center'
  123. },
  124. {
  125. title: '标签名称',
  126. dataIndex: 'tagName',
  127. key: 'tagName',
  128. align: 'center',
  129. scopedSlots: {
  130. customRender: 'tagName'
  131. },
  132. },
  133. /*{
  134. title: '菜单类型',
  135. dataIndex: 'menuType',
  136. key: 'menuType',
  137. customRender: function(text) {
  138. if (text == 0) {
  139. return '菜单'
  140. } else if (text == 1) {
  141. return '菜单'
  142. } else if (text == 2) {
  143. return '按钮/权限'
  144. } else {
  145. return text
  146. }
  147. }
  148. },*/
  149. {
  150. title: '标签层级',
  151. dataIndex: 'level',
  152. key: 'level',
  153. customRender: function (text) {
  154. if (text == 1) {
  155. return '一级标签'
  156. } else if (text == 2) {
  157. return '二级标签'
  158. } else if (text == 3) {
  159. return '三级标签'
  160. }
  161. },
  162. align: 'center'
  163. }, {
  164. title: '所属一级标签',
  165. dataIndex: 'firstTagId_dictText',
  166. key: 'firstTagId_dictText',
  167. customRender: function (text) {
  168. if (text == null) {
  169. return '-'
  170. } else {
  171. return text
  172. }
  173. },
  174. align: 'center'
  175. },
  176. {
  177. title: '所属二级标签',
  178. dataIndex: 'secendTagId_dictText',
  179. key: 'secendTagId_dictText',
  180. customRender: function (text) {
  181. if (text == null) {
  182. return '-'
  183. } else {
  184. return text
  185. }
  186. },
  187. align: 'center'
  188. },
  189. {
  190. title: '描述',
  191. dataIndex: 'description',
  192. key: 'description',
  193. customRender: function (text) {
  194. if (text == null) {
  195. return '-'
  196. } else {
  197. return text
  198. }
  199. },
  200. align: 'center',
  201. width: 400
  202. },
  203. // {
  204. // title: '标签示例',
  205. // dataIndex: 'model',
  206. // key: 'model',
  207. // scopedSlots: {
  208. // customRender: 'model'
  209. // },
  210. // // customRender: function (text) {
  211. // // if (text == null) {
  212. // // return '-'
  213. // // } else {
  214. // // return text
  215. // // }
  216. // // },
  217. // align: 'center',
  218. // width: 200
  219. // },
  220. {
  221. title: '操作',
  222. dataIndex: 'action',
  223. scopedSlots: {
  224. customRender: 'action'
  225. },
  226. align: 'center',
  227. width: 250
  228. }
  229. ]
  230. export default {
  231. name: 'label-material',
  232. mixins: [JeecgListMixin],
  233. components: {
  234. PermissionModal,
  235. JEllipsis,
  236. },
  237. data() {
  238. return {
  239. description: '标签管理',
  240. // 表头
  241. columns: columns,
  242. loading: false,
  243. // 展开的行,受控属性
  244. expandedRowKeys: [],
  245. url: {
  246. list: '/ctop/tagInfo/list',
  247. delete: '/ctop/tagInfo/edit',
  248. deleteBatch: '/sys/permission/deleteBatch'
  249. }
  250. }
  251. },
  252. methods: {
  253. IsURL(res) {
  254. // var strRegex = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|www\.)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/
  255. var strRegex =
  256. /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+(.+[A-Za-z0-9-~\/])+$/
  257. var re = new RegExp(strRegex)
  258. // console.log(re.test(res))
  259. if (re.test(res)) {
  260. return true
  261. } else {
  262. return false
  263. }
  264. },
  265. handleDeleteModel(record) {
  266. if (record.model) {
  267. if (this.IsURL(record.model)) {
  268. window.open(record.model, '_blank')
  269. }
  270. }
  271. },
  272. handleDeleteStatus(id, status) {
  273. httpAction('/ctop/tagInfo/edit', {
  274. id: id,
  275. status: status
  276. }, 'post').then(res => {
  277. if (res.success) {
  278. //删除成功后,去除已选中中的数据
  279. this.loadData(1)
  280. } else {
  281. this.$message.warning(res.message)
  282. }
  283. })
  284. },
  285. handleDeleteElse(id) {
  286. httpAction('/ctop/tagInfo/edit', {
  287. id: id,
  288. delFlag: 1
  289. }, 'post').then(res => {
  290. if (res.success) {
  291. //删除成功后,去除已选中中的数据
  292. this.loadData(1)
  293. } else {
  294. this.$message.warning('删除失败!')
  295. }
  296. })
  297. },
  298. handleAddSub(record) {
  299. this.$refs.modalForm.title = "添加子标签";
  300. this.$refs.modalForm.edit({
  301. status: '1',
  302. 'parentId': record.id,
  303. tagCategoryId: record.tagCategoryId
  304. });
  305. },
  306. handleExpandedRowsChange(expandedRows) {
  307. this.expandedRowKeys = expandedRows
  308. },
  309. }
  310. }
  311. </script>
  312. <style scoped>
  313. @import '~@assets/less/common.less';
  314. </style>