小说后台管理系统
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

325 řádky
8.1 KiB

  1. <template>
  2. <el-container>
  3. <el-main>
  4. <el-form
  5. v-if="isSearchVisible"
  6. ref="formData"
  7. label-width="auto"
  8. :model="formData"
  9. inline
  10. >
  11. <div class="div-main">
  12. <el-form-item
  13. label="书源"
  14. prop="name"
  15. >
  16. <el-input
  17. v-model="formData.name"
  18. placeholder="书源"
  19. size="mini"
  20. />
  21. </el-form-item>
  22. <el-form-item
  23. label="备注"
  24. prop="name"
  25. >
  26. <el-input
  27. v-model="formData.name"
  28. placeholder="备注"
  29. size="mini"
  30. />
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button
  34. type="primary"
  35. size="mini"
  36. @click="onSubmit"
  37. >
  38. 搜索
  39. </el-button>
  40. <el-button
  41. type="info"
  42. plain
  43. size="mini"
  44. @click="resetForm('formData')"
  45. >
  46. 重置
  47. </el-button>
  48. </el-form-item>
  49. <el-form-item style="width: 350px" />
  50. </div>
  51. </el-form>
  52. <!-- 操作按钮 -->
  53. <div class="div-btn">
  54. <div>
  55. <el-button
  56. type="primary"
  57. icon="el-icon-refresh-right"
  58. size="mini"
  59. @click="_baseRequest(true)"
  60. />
  61. <el-button
  62. type="primary"
  63. icon=""
  64. size="mini"
  65. @click="openGatherDialog(null)"
  66. >
  67. <svg-icon icon-class="keyboard" />
  68. 一键采集书籍
  69. </el-button>
  70. <el-button
  71. type="warning"
  72. icon="el-icon-alarm-clock"
  73. size="mini"
  74. @click="openGatherStateDialog()"
  75. >
  76. 定时采集书籍
  77. </el-button>
  78. <span class="btn-text">
  79. 上次采集时间: 2021-08-09 13:52:42
  80. </span>
  81. </div>
  82. <el-button
  83. type="primary"
  84. icon="el-icon-search"
  85. size="mini"
  86. @click="isSearchVisible = !isSearchVisible"
  87. />
  88. </div>
  89. <!-- 数据 -->
  90. <div class="table-container">
  91. <el-table
  92. :data="tableData"
  93. border
  94. fit
  95. tooltip-effect="dark"
  96. >
  97. <el-table-column
  98. type="index"
  99. label="序号"
  100. align="center"
  101. width="55"
  102. />
  103. <el-table-column
  104. label="书源"
  105. align="center"
  106. prop="name"
  107. min-width="100"
  108. />
  109. <el-table-column
  110. label="采集书籍数量"
  111. align="center"
  112. prop="name"
  113. />
  114. <el-table-column
  115. label="备注"
  116. align="center"
  117. prop="filterKeyNum"
  118. >
  119. <template slot-scope="">
  120. <!-- <span style="color: #1890FF;cursor:pointer;" @click="openNumDialog(scope.row)">{{ scope.row.filterKeyNum }}</span>-->
  121. </template>
  122. </el-table-column>
  123. <el-table-column
  124. label="操作"
  125. align="center"
  126. >
  127. <template slot-scope="scope">
  128. <CustomButton
  129. tip-text="采集"
  130. icon="el-icon-folder-add"
  131. @onClick="openGatherDialog(scope.row)"
  132. />
  133. <CustomButton
  134. tip-text="禁用"
  135. is-svg
  136. type="danger"
  137. icon="disabled"
  138. @onClick="openDeleteDialog(scope.row)"
  139. />
  140. </template>
  141. </el-table-column>
  142. </el-table>
  143. </div>
  144. <!-- 底部分页组件 -->
  145. <div class="pagination-container">
  146. <el-pagination
  147. :current-page="formData.currentPage"
  148. :page-sizes="[10, 20, 30, 40]"
  149. :page-size="formData.limit"
  150. layout="total, prev, pager, next, sizes,jumper"
  151. :total="formData.total"
  152. @size-change="handleSizeChange"
  153. @current-change="handleCurrentChange"
  154. />
  155. </div>
  156. </el-main>
  157. <!-- 文章编辑页面-->
  158. <TimingGatherBooks
  159. :is-dialog="isGatherDialog"
  160. :dialog-title="gatherTitleDialog"
  161. @handle-close="isGatherDialog = false"
  162. />
  163. <!-- 采集状态-->
  164. <GatherStateDialog
  165. :is-dialog="isStateDialog"
  166. @handle-close="isStateDialog = false"
  167. />
  168. </el-container>
  169. </template>
  170. <script>
  171. /**
  172. *书源管理页面
  173. * */
  174. import CustomButton from '@/components/CustomButton/index'
  175. import TimingGatherBooks from './components/timing-gather-books'
  176. import GatherStateDialog from './components/gather-state-dialog'
  177. // 编辑弹窗组件
  178. export default {
  179. components: { CustomButton, TimingGatherBooks, GatherStateDialog },
  180. data() {
  181. return {
  182. // 活动添加弹窗开关
  183. isStateDialog: false,
  184. isGatherDialog: false,
  185. gatherTitleDialog: '',
  186. // UI控制参数
  187. isSearchVisible: true,
  188. // 选择的操作的数据
  189. selectItem: {},
  190. // 多选列表数据
  191. multipleSelection: [],
  192. // 表格数据
  193. tableData: [
  194. {
  195. name: '11'
  196. }
  197. ],
  198. // 表单参数
  199. formData: {
  200. name: '',
  201. // 默认显示页
  202. currentPage: 1,
  203. // 每页页数
  204. limit: 10,
  205. // 总页数
  206. total: 10
  207. }
  208. }
  209. },
  210. created() {
  211. this._baseRequest()
  212. },
  213. methods: {
  214. // 基础请求
  215. _baseRequest(refres = false) {
  216. // const params = {
  217. // name: this.formData.name,
  218. // p: this.formData.currentPage,
  219. // limit: this.formData.limit
  220. // }
  221. // filterWordList(params).then(resp => {
  222. // if (parseInt(resp.code) === 0) {
  223. if (refres) {
  224. this.$message.success('刷新成功~')
  225. }
  226. // // console.log(JSON.stringify(resp.data))
  227. // this.tableData = resp.data.list
  228. // this.formData.total = resp.data.total
  229. // }
  230. // })
  231. },
  232. // 更新操作
  233. refreshData() {
  234. this._baseRequest(true)
  235. },
  236. // 提交操作
  237. onSubmit() {
  238. this._baseRequest()
  239. },
  240. // 重置操作
  241. resetForm(val) {
  242. this.$refs[val].resetFields()
  243. this._baseRequest()
  244. },
  245. openGatherStateDialog() {
  246. this.isStateDialog = true
  247. },
  248. // 打开编辑弹窗操作
  249. openGatherDialog(row) {
  250. this.isGatherDialog = true
  251. if (row) {
  252. this.gatherTitleDialog = '定时采集书籍'
  253. } else {
  254. this.gatherTitleDialog = '一键采集'
  255. }
  256. },
  257. // 删除操作弹窗
  258. openDeleteDialog(scope) {
  259. this.$confirm('是否确认禁用该书籍?禁用后该书源信息将停止使用, 请谨慎操作!', '禁用提示', {
  260. confirmButtonText: '确定',
  261. cancelButtonText: '取消',
  262. type: 'warning'
  263. }).then(() => {
  264. this.selectItem = scope.row
  265. }).catch(() => {})
  266. },
  267. // 每页数据
  268. handleSizeChange(val) {
  269. console.log(`每页 ${val} 条`)
  270. this.formData.limit = val
  271. this._baseRequest()
  272. },
  273. // 当前页
  274. handleCurrentChange(val) {
  275. console.log(`当前页: ${val}`)
  276. this.formData.currentPage = val
  277. this._baseRequest()
  278. }
  279. }
  280. }
  281. </script>
  282. <style lang="scss" scoped>
  283. .el-container{
  284. width: 100%;
  285. height: 100%;
  286. .el-main{
  287. .div-main{
  288. display: flex;
  289. flex-flow: row wrap;
  290. justify-content: space-between;
  291. padding: 0 3%;
  292. .el-input{
  293. width: 220px;
  294. }
  295. }
  296. .div-btn{
  297. display: flex;
  298. justify-content: space-between;
  299. margin: 15px 0;
  300. .drop-down{
  301. margin: 0 10px;
  302. }
  303. .btn-text{
  304. color: #A97402;
  305. font-size: 14px;
  306. padding: 6px 10px 6px 3px;
  307. margin-left: 8px;
  308. background: rgba(255, 193, 61, 0.2);
  309. border-radius: 2px;
  310. border: 1px solid rgba(255, 193, 61, 0.5);
  311. box-sizing: border-box;
  312. }
  313. }
  314. .pagination-container{
  315. display: flex;
  316. justify-content: center;
  317. align-items: center;
  318. }
  319. }
  320. }
  321. </style>