liujq 4 anos atrás
pai
commit
6f058a38c5

+ 15 - 0
src/api/house.js

@@ -34,6 +34,21 @@ export default {
   admoldhousedel: params => { // 二手房删除
     return getRequestNoSort('/adm/oldhouse/del', params, 'loading')
   },
+  admestatemodulelist: params => { // 模块主题列表接口
+    return getRequest('/adm/estate/module/list', params)
+  },
+  admestatemoduleadd: params => { // 模块主题添加
+    return getRequestNoSort('/adm/estate/module/add', params, 'loading')
+  },
+  admestatemoduleedit: params => { // 模块主题编辑
+    return getRequestNoSort('/adm/estate/module/edit', params, 'loading')
+  },
+  admestatemoduledetail: params => { // 模块主题详情
+    return getRequestNoSort('/adm/estate/module/detail', params, 'loading')
+  },
+  admestatemoduledel: params => { // 模块主题删除
+    return getRequestNoSort('/adm/estate/module/del', params, 'loading')
+  },
   admschoollist: params => { // 学校列表接口
     return getRequest('/adm/school/list', params)
   },

+ 6 - 0
src/router/index.js

@@ -74,6 +74,12 @@ export const moreRoutes = [
         component: () => import('@/views/house/old'),
         meta: { title: '二手房管理', affix: true }
       },
+      {
+        path: 'theme',
+        name: 'HouseTheme',
+        component: () => import('@/views/house/theme'),
+        meta: { title: '模板主题', affix: true }
+      },
     ]
   },
   {

+ 107 - 0
src/views/house/components/popup/ThemeEdit.vue

@@ -0,0 +1,107 @@
+<template>
+  <div>
+    <el-dialog
+      v-loading="loading"
+      :show-close="false"
+      :close-on-click-modal="false"
+      :visible.sync="isShow"
+      :title="curObj.id ? '编辑模块主题' : '新增模块主题'"
+      :fullscreen="false"
+      width="700px"
+      custom-class="xl-dialog"
+      center
+    >
+      <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="110px">
+        <div slot="footer" style="padding-top: 20px;">
+          <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
+          <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
+        </div>
+      </base-form>
+    </el-dialog>
+  </div>
+</template>
+<script>
+export default {
+  components: { },
+  mixins,
+  props: {
+    isShow: Boolean,
+    curObj: Object
+  },
+  inject: ['parentData'],
+  data() {
+    return {
+      formData: [],
+      loading: true,
+      cObj: {},
+      isShowMap: false
+    }
+  },
+  watch: {
+    isShow: function(val) {
+      if (val) {
+        if (val) {
+          if (this.curObj.id) {
+            this.$api.house.admestatemoduledetail({id: this.curObj.id}).then(res => {
+              let curData = res || {}
+              this.cObj = curData || {}
+              this.getDef()
+            })
+          } else {
+            this.cObj = this.curObj
+            this.getDef()
+          }
+        }
+      }
+    },
+  },
+  methods: {
+    getDef() {
+      const params = { ...this.cObj }
+      this.formData = [
+        { label: '所属模块', key: 'module_type', rules: 1, type: 'select', options: this.$dictData.module_type },
+        { label: '排序', key: 'sort', rules: 1 },
+        { label: '所属楼盘', key: 'estate_id', rules: 1, type: 'selectRemote', changeHandle: this.deviceChange,
+          remoteParams: { skey: 'estate_name', api: `house.admestatelist`, opKey: 'estate_name', opVal: 'id' },
+          remoteOptions: [{ keyRO: params.estate_name, valRO: params.estate_id }]
+        }
+      ]
+      this.setDefaultValue(params)
+    },
+    close(str) {
+      if (str === 'confirm') {
+        this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
+          if (valid) {
+            const oldform = this.$refs.ruleForm.baseForm
+            const newForm = { ...oldform }
+            if (this.curObj.id) {
+              newForm.id = this.curObj.id
+            }
+            let apiStr = 'admestatemoduleadd'
+            if (newForm.id) apiStr = 'admestatemoduleedit'
+            this.$api.house[apiStr](newForm).then(data => {
+              this.$msgs(newForm.id ? '编辑成功' : '新增成功')
+              this.$emit('close', newForm)
+            })
+          }
+        })
+      } else {
+        this.$emit('close')
+        this.setDefaultValue()
+      }
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+@import '../../../../styles/libEdit.scss';
+.lib-edit {
+  padding-top: 0;
+  ::v-deep .el-form-item {
+    margin-bottom: 10px;
+  }
+  ::v-deep .el-date-editor.el-input {
+    width: 100%;
+  }
+}
+</style>

+ 45 - 0
src/views/house/components/searchForm/Theme.vue

@@ -0,0 +1,45 @@
+<template>
+  <header-collapse>
+    <base-form slot="content" ref="ruleForm" :data="searchData">
+      <div slot="footer">
+        <el-button :loading="listLoading" icon="el-icon-search" class="xl-form-btn bgc1" @click="searchHandle">查询</el-button>
+        <!-- <el-button :loading="listLoading" icon="el-icon-document" class="xl-form-btn bgc2" @click="toExportExcel">导出{{ this.$route.meta.title }}信息</el-button> -->
+      </div>
+    </base-form>
+  </header-collapse>
+</template>
+<script>
+export default {
+  props: {
+    listLoading: Boolean
+  },
+  inject: ['parentData'],
+  mixins,
+  data() {
+    return {
+      searchData: []
+    }
+  },
+  mounted () {
+    this.getDef()
+  },
+  methods: {
+    getDef (str) {
+      let params = { ...this.$refs.ruleForm.baseForm }
+      if (this.parentData.searchForm || this.parentData.searchForm.module_type) params.module_type = this.parentData.searchForm.module_type
+      this.searchData = [
+        { label: '所属楼盘', key: 'estate_id', type: 'selectRemote',
+          remoteParams: { skey: 'estate_name', api: `house.admestatelist`, opKey: 'estate_name', opVal: 'id' }
+        },
+        { label: '所属模块', key: 'module_type', type: 'select', options: this.$dictData.module_type},
+      ]
+      this.setDefaultValue(params, 'searchData')
+    },
+    searchHandle() {
+      const oldform = this.$refs.ruleForm.baseForm
+      const newForm = { ...oldform }
+      this.$emit('change', newForm)
+    }
+  }
+}
+</script>

+ 111 - 0
src/views/house/theme.vue

@@ -0,0 +1,111 @@
+<template>
+  <div class="app-container">
+    <search-form
+      :list-loading="listLoading"
+      @change="searchHandle"
+    />
+    <table-list
+      :list-loading="listLoading"
+      :data="tableData2"
+      :columns="listConfig"
+      :current-page="currentPage"
+      :page-size="pageSize"
+      :total-records="totalRecords"
+      @currentChange="pageHandle"
+      :isAdd="true"
+      @add="openPopup"
+    />
+    <popup-edit
+      :isShow="isDtlShow"
+      :curObj="curObj"
+      @close="closePopup"
+    />
+  </div>
+</template>
+<script>
+import { arrToObj } from '@/utils'
+import SearchForm from './components/searchForm/Theme'
+import PopupEdit from './components/popup/ThemeEdit'
+import baseTable from '_m/baseTable.js'
+import xData from './mixin'
+export default {
+  name: 'old',
+  components: {
+    SearchForm,
+    PopupEdit,
+  },
+  provide() {
+    return {
+      parentData: this
+    }
+  },
+  mixins: [baseTable],
+  data() {
+    return {
+      apiStr: 'house.admestatemodulelist',
+      searchForm: {},
+      isDtlShow: false,
+      // noCreated: true,
+      curObj: {},
+      ...xData
+    }
+  },
+  computed: {
+    tableData2() {
+      const arr = [...this.tableData]
+      arr.map(item => {
+      })
+      return arr
+    }
+  },
+  created() {
+    const mtArr = this.$dictData.module_type || []
+    this.searchForm = {
+      module_type: mtArr[0].val
+    }
+  },
+  mounted() {
+    this.listConfig = {
+      rows: [
+        { label: '楼盘名称', prop: 'estate_name' },
+        { label: '模块主题', prop: 'module_type', type: 'flag', flags: arrToObj(this.$dictData.module_type) },
+        { label: '排序', prop: 'sort' },
+        { label: '更新人', prop: 'update_by' },
+        { label: '更新时间', prop: 'update_at' },
+        { label: '操作', width: 120, type: 'handle2', operations:
+          [
+            { label: '编辑', func: this.openPopup, btnType: 'primary' },
+            { label: '删除', func: this.delHandle, btnType: 'danger' },
+          ]
+        }
+      ]
+    }
+  },
+  methods: {
+    delHandle(row) {
+      this.$msg(`您确定要删除该模块主题吗?`, 'confirm', () => {
+        this.$api.house.admestatemoduledel({
+          id: row.id,
+        }).then(data => {
+          this.$msgs(`已删除!`)
+          this.fetchData()
+        })
+      }, null, true)
+    },
+    openPopup(row) {
+      if (row && row.id) {
+        this.curObj = row
+      } else {
+        this.curObj = {}
+      }
+      this.isDtlShow = true
+    },
+    closePopup(obj) {
+      this.isDtlShow = false
+      if (obj) {
+        this.fetchData()
+      }
+    }
+  }
+}
+</script>