123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <div class="subPage">
- <div class="system-table-search">
- <div class="flex-h">
- <div class="flex-item flex-h">
- <el-button size="mini" type="success" @click='addMajorProjects'>新增售楼处项目专题</el-button>
- </div>
- <ul>
- <li>
-
- <el-select v-model="tableSearch.caseId" placeholder="请选择">
- <el-option
- key="all"
- label="所有案场"
- value="all">
- </el-option>
- <el-option
- v-for="item in caseList"
- :key="item.CaseId"
- :label="item.CaseName"
- :value="item.CaseId">
- </el-option>
- </el-select>
- </li>
- </ul>
- <tableSearch value="请输入项目专题名称" @exportSearchKey="searchList"></tableSearch>
- </div>
- <div class="moreFilter"></div>
- </div>
- <div class="system-table-box">
- <el-table
- :data="tableData"
- stripe
- style="width: 100%">
- <el-table-column
- prop="Name"
- label="名称">
- </el-table-column>
- <el-table-column
- prop="Title"
- label="标题">
- </el-table-column>
- <el-table-column
- prop="CaseName"
- label="对应案场">
- </el-table-column>
- <el-table-column
- prop="CreateDate"
- label="创建时间">
- </el-table-column>
- <el-table-column label="操作" width="450">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="primary"
- @click="showItem(scope.$index, scope.row)"><span v-if="scope.row.Status === 1">取消前台展示</span><span v-if="scope.row.Status === 0">前台展示</span></el-button>
- <el-button
- size="mini"
- type="warning"
- v-if="scope.row.Status === 0"
- @click="editItem(scope.$index, scope.row)">编辑</el-button>
- <el-button
- size="mini"
- type="success"
- v-clipboard:copy="returnUrl(scope.row.CmsCaseId)"
- v-clipboard:success="onCopy"
- v-clipboard:error="onError"
- >点击复制链接</el-button>
- <el-button
- size="mini"
- type="danger"
- v-if="scope.row.Status === 0"
- @click="deleteItem(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page.sync="postData.currentPage"
- :page-size="postData.pageSize"
- layout="prev, pager, next, jumper"
- :total="postData.total">
- </el-pagination>
- </div>
- </template>
-
- <script>
- import tableSearch from '@/components/tableSearch/index'
- import { mapState, mapActions } from 'vuex'
-
- export default {
- name: '',
- data () {
- return {
- postData: {
- currentPage: 1,
- pageSize: 10,
- total: 0,
- },
- tableSearch: {
- key: '',
- caseId: '',
- },
- tableData: []
- }
- },
- computed: {
- ...mapState({
- OrgId: x => x.app.user.OrgId,
- caseList: x => x.app.cases.list,
- defaultCaseId: x => x.app.cases.default
- })
- },
- components: {
- tableSearch,
- },
- created () {
- this.updateSystemInfo().then(() => {
-
- this.getList()
- })
- },
- methods: {
- ...mapActions(['updateSystemInfo']),
- handleCurrentChange (val) {
- this.postData.currentPage = val
- this.getList()
- },
- showItem (index, data) {
- let api = data.Status === 1 ? this.$api.cms.caseHide : this.$api.cms.caseShow
- this.$ajax(api.url, {
- method: api.method,
- urlData: {
- id: data.CmsCaseId
- }
- }).then(res => {
- this.$message({
- message: '编辑成功',
- type: 'success',
- duration: 1000
- })
- this.getList()
- }).catch(msg => {
-
- })
- },
- editItem (index, row) {
- this.$router.push({ name: 'editIndexCase', query: { id: row.CmsCaseId } })
- },
- returnUrl (id) {
- return window.location.origin + window.location.pathname + 'user.html#/majorProjects?id=' + id
- },
- deleteItem (index, row) {
- this.$confirm('确认删除此项目专题?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.deleteInfo(row.CmsCaseId)
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- })
- })
- },
- searchList (key) {
- this.tableSearch.key = key
- this.getList()
- },
- addMajorProjects () {
- this.$router.push({ name: 'editIndexCase' })
- },
- getList () {
- this.tableData = []
- this.$ajax(this.$api.cms.case.url, {
- method: this.$api.cms.case.method,
- queryData: {
- page: this.postData.currentPage,
- pagesize: this.postData.pageSize,
- caseid: this.tableSearch.caseId === 'all' ? '' : this.tableSearch.caseId,
- name: this.tableSearch.key
- }
- }).then(res => {
- for (let i = 0; i < res.list.length; i++) {
- res.list[i].CreateDate = this.toolClass.dateFormat(res.list[i].CreateDate)
- }
- this.tableData = res.list
- this.postData.total = res.pagenum
- this.postData.currentPage = res.page
- }).catch(msg => {
-
- })
- },
- deleteInfo (id) {
- this.$ajax(this.$api.cms.deleteCase.url, {
- method: this.$api.cms.deleteCase.method,
- urlData: {
- id: id
- }
- }).then(res => {
- this.$message({
- type: 'success',
- message: '删除成功!'
- })
- this.getList()
- }).catch(msg => {
-
- })
- },
- onCopy () {
- this.$message({
- type: 'success',
- message: '复制成功!'
- })
- },
- onError () {
- this.$message({
- type: 'error',
- message: '复制失败!'
- })
- },
- }
- }
- </script>
-
-
- <style lang="scss" scoped>
- </style>
|