templateList.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <div class="mainBox">
  3. <!--搜索功能 start------------------------------------------------------------>
  4. <div class="layerBox_search">
  5. <div class="layerBoxLine">
  6. <el-row>
  7. <el-col :span="8">
  8. <div class="searchBox">
  9. <div class="searchTitle">网站名称:</div>
  10. <el-input v-model="getApiData.website_name" placeholder="请输入网站名称"></el-input>
  11. </div>
  12. </el-col>
  13. <el-col :span="8">
  14. <div class="searchBox">
  15. <div class="searchTitle">应用状态:</div>
  16. <el-select v-model="getApiData.website_status" placeholder="请选择应用状态..">
  17. <el-option label="全部" value="2"></el-option>
  18. <el-option label="已应用" value="1"></el-option>
  19. <el-option label="未应用" value="0"></el-option>
  20. </el-select>
  21. </div>
  22. </el-col>
  23. <el-col :span="8">
  24. <div class="searchBtnBox">
  25. <el-button>重置</el-button>
  26. <el-button type="primary" @click="getData('search')">搜索</el-button>
  27. </div>
  28. </el-col>
  29. </el-row>
  30. </div>
  31. </div>
  32. <!--搜索功能 end------------------------------------------------------------>
  33. <!--表格内容 start------------------------------------------------------------>
  34. <div class="layerBox">
  35. <tableTitle :name="tableDivTitle"/>
  36. <el-row>
  37. <template>
  38. <el-table :data="tableData" style="width: 100%">
  39. <el-table-column fixed prop="id" label="编号" width="50"></el-table-column>
  40. <el-table-column prop="website_name" label="网站名称"></el-table-column>
  41. <el-table-column prop="template_name" label="风格名称" width="100">
  42. <template slot-scope="scope">
  43. <div v-if="scope.row.template_name==''">无</div>
  44. <div v-else>{{scope.row.template_name}}</div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="template_page" label="模板页面"></el-table-column>
  48. <el-table-column prop="created_at" label="创建时间"></el-table-column>
  49. <el-table-column prop="updated_at" label="更新时间"></el-table-column>
  50. <el-table-column prop="status" label="状态" width="100">
  51. <template slot-scope="scope">
  52. <div v-if="scope.row.status==0">未应用</div>
  53. <div v-if="scope.row.status==1">已应用</div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column fixed="right" label="操作" header-align="center">
  57. <template slot-scope="scope">
  58. <div class="listBtnBox">
  59. <div class="listEditBtn" @click="getDataMain(scope.row.id, tableData)" v-if="scope.row.status==1"><i class="el-icon-edit-outline"></i>编辑</div>
  60. <div class="listMainBtn" @click="creatWebsite(scope.row.id)" v-if="scope.row.status==0"><i class="el-icon-brush"></i>构建</div>
  61. </div>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. </template>
  66. </el-row>
  67. </div>
  68. <div class="alignBox">
  69. <el-row>
  70. <el-col :span="24">
  71. <el-pagination :current-page="getApiData.page" @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper" :total="allCount"></el-pagination>
  72. </el-col>
  73. </el-row>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. //表格标题
  79. import tableTitle from './components/tableTitle';
  80. //引入公用样式
  81. import '@/styles/global.less';
  82. //步骤条
  83. import step from './components/step';
  84. export default {
  85. components: {
  86. tableTitle,//表格标题
  87. step//步骤条
  88. },
  89. data() {
  90. return {
  91. //1.列表和分页相关 start ------------------------------------------------------------>
  92. templateStepTitle:"仅需四步,即可完成模板创建",
  93. tableDivTitle:"模板列表",
  94. useTemplateName:"已选择风格",
  95. windowStatus:false,//弹出框
  96. tableData:[
  97. {id:1,website_name:"中国三农市场网",template_name:"",template_page:"首页,分类页,列表页,详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:0},
  98. {id:2,website_name:"中农兴业网",template_name:"怒火蔓延",template_page:"首页,分类页,列表页,详情页,自定义列表页,自定义详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:1},
  99. {id:3,website_name:"中农兴业市场网",template_name:"毒舌律师",template_page:"首页,分类页,列表页,详情页,自定义详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:1},
  100. {id:4,website_name:"中农兴业网",template_name:"",template_page:"首页,分类页,列表页,详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:0},
  101. {id:5,website_name:"金政网",template_name:"存亡之战",template_page:"首页,分类页,列表页,详情页,自定义列表页,自定义详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:1},
  102. {id:6,website_name:"三农资讯网",template_name:"老无所依",template_page:"首页,分类页,列表页,详情页,自定义列表页,自定义详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:1},
  103. {id:7,website_name:"农民网",template_name:"金刚川",template_page:"首页,分类页,列表页,详情页,自定义列表页,自定义详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:1},
  104. {id:8,website_name:"中国三农市场网",template_name:"八佰",template_page:"首页,分类页,列表页,详情页,自定义列表页,自定义详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:1},
  105. {id:9,website_name:"中农兴业网",template_name:"破地狱",template_page:"首页,分类页,列表页,详情页,自定义列表页,自定义详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:1},
  106. {id:10,website_name:"中国金政网",template_name:"慕然回首",template_page:"首页,分类页,列表页,详情页,自定义列表页,自定义详情页",created_at:"2024-12-16 10:00:00",updated_at:"2024-12-16 10:00:00",status:1}
  107. ],//内容
  108. getApiData:{
  109. page:1,//当前是第几页
  110. pageSize:10,//一共多少条
  111. },
  112. allCount:20,//总条数
  113. //分页相关 end ------------------------------------------------------------>
  114. }
  115. },
  116. methods: {
  117. //0.全局操作 start ------------------------------------------------------------>
  118. //上一步
  119. goBase(){
  120. this.$router.push({
  121. path: '/templateBase',
  122. query: {
  123. id: this.editId
  124. }
  125. });
  126. },
  127. //下一步
  128. goCreat(id){
  129. let data = {
  130. id:id
  131. }
  132. this.$router.push({
  133. path: '/templateCreat',
  134. query: {
  135. id: this.editId
  136. }
  137. });
  138. },
  139. //0.全局操作 end ------------------------------------------------------------>
  140. //1.请求数据 start ------------------------------------------------------------>
  141. //1.1 开始请求列表信息方法
  142. getData(){
  143. this.$store.dispatch('pool/getWebList',this.getApiData).then(res=> {
  144. let newData = [];
  145. for(let item of res.data.rows){
  146. if(item.city_name==null){item.city_name="--"}
  147. newData.push(item)
  148. }
  149. this.tableData = newData; //给与内容
  150. this.allCount = res.data.count; //给与总条数
  151. }).catch(() => {
  152. this.$message({
  153. type: 'warning',
  154. message: '网络错误,请重试!'
  155. });
  156. })
  157. },
  158. //选择风格
  159. useIt(id){
  160. console.log(id)
  161. this.tableData.forEach(item=>{
  162. item.status = 0;
  163. })
  164. this.tableData.find(item=>item.id==id).status = 1;
  165. },
  166. //1.4 列表内容分页
  167. //直接跳转
  168. handleSizeChange(val) {
  169. this.getApiData.page = val;
  170. this.getData();
  171. },
  172. //1.5 点击分页
  173. handleCurrentChange(val) {
  174. this.getApiData.page = val;
  175. this.getData();
  176. },
  177. //列表和分页相关 end ------------------------------------------------------------>
  178. },
  179. mounted(){
  180. //this.getData();
  181. }
  182. }
  183. </script>
  184. <style scoped lang="less">
  185. .searchBtnBox {
  186. padding-top: 26px;
  187. text-align: right;
  188. }
  189. .paginationBox {
  190. padding: 20px 0 0 0;
  191. text-align: center;
  192. }
  193. .btnBox {
  194. padding:0 0 40px 0;
  195. text-align: center;
  196. }
  197. </style>