labelMaterial.vue 9.5 KB

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