liujq %!s(int64=4) %!d(string=hai) anos
pai
achega
916714cac3

+ 16 - 1
src/api/house.js

@@ -167,6 +167,21 @@ export default {
     return getRequestNoSort('/adm/estate/lottery/price/del', params, 'loading')
   },
   admestatelotterypricelist: params => { // 一房一价 - 列表
-    return getRequestNoSort('/adm/estate/lottery/price/list', params, 'loading')
+    return getRequest('/adm/estate/lottery/price/list', params, 'loading')
+  },
+  admestatecompetelist: params => { // 竞品列表 - 列表
+    return getRequest('/adm/estate/compete/list', params, 'loading')
+  },
+  admestatecompeteedit: params => { // 竞品列表 - 编辑
+    return getRequestNoSort('/adm/estate/compete/edit', params, 'loading')
+  },
+  admestatecompeteadd: params => { // 竞品列表 - 添加
+    return getRequestNoSort('/adm/estate/compete/add', params, 'loading')
+  },
+  admestatecompetedetail: params => { // 竞品列表 - 详情
+    return getRequestNoSort('/adm/estate/compete/detail', params, 'loading')
+  },
+  admestatecompetedel: params => { // 竞品列表 - 删除
+    return getRequestNoSort('/adm/estate/compete/del', params, 'loading')
   },
 }

+ 33 - 3
src/components/Common/TableList.vue

@@ -196,18 +196,44 @@
           :prop="column.prop"
           :label="column.label"
           :align="column.align || 'center'"
-          :width="column.operations.length > operationsDefaultLength ? '60' : column.width"
+          :width="column.width"
           :min-width="column.minWidth"
         >
           <template slot-scope="scope">
             <template v-if="!scope.row.isHideHandle">
               <template v-if="column.operations.length > operationsDefaultLength">
+                <template v-for="(operate, indexBtn) in column.operations.slice(0, 2)">
+                  <template v-if="operate.hide && scope.row[operate.hide]" />
+                  <template v-else>
+                    <template v-if="operate.disabled && typeof operate.disabled === 'function'">
+                      <el-button
+                        v-if="operate.params ? operate.disabled(scope.row[operate.params[0]], scope.row[operate.params[1]]) : operate.disabled(scope.row)"
+                        :key="indexBtn"
+                        :type="`${operate.labelConfig && operate.labelConfig.btnTypes ? operate.labelConfig.btnTypes[scope.row[operate.labelFor]] : operate.btnType}`"
+                        size="mini"
+                        @click="operate.params ? operate.func(scope.row[operate.params[0]], scope.row[operate.params[1]]) : operate.func(scope.row)"
+                      >
+                        {{ noEmpty(scope.row[operate.labelFor]) ? operate.labelConfig.texts[scope.row[operate.labelFor]] : operate.label }}
+                      </el-button>
+                    </template>
+                    <template v-else>
+                      <el-button
+                        :key="indexBtn"
+                        :type="`${operate.labelConfig && operate.labelConfig.btnTypes ? operate.labelConfig.btnTypes[scope.row[operate.labelFor]] : operate.btnType}`"
+                        size="mini"
+                        @click="operate.params ? operate.func(scope.row[operate.params[0]], scope.row[operate.params[1]]) : operate.func(scope.row)"
+                      >
+                        {{ noEmpty(scope.row[operate.labelFor]) ? operate.labelConfig.texts[scope.row[operate.labelFor]] : operate.label }}
+                      </el-button>
+                    </template>
+                  </template>
+                </template>
                 <el-popover
                   placement="right"
                   :width="column.subWidth || 100"
                   trigger="click"
                 >
-                  <el-table :data="column.operations" class="noborderbottom-table">
+                  <el-table :data="column.operations.slice(2, column.operations.length)" class="noborderbottom-table">
                     <el-table-column :width="column.subWidth || 100" property="key" :label="column.label">
                       <template slot-scope="sub">
                         <template v-if="sub.row.hide && scope.row[sub.row.hide]" />
@@ -235,7 +261,7 @@
                       </template>
                     </el-table-column>
                   </el-table>
-                  <div slot="reference" class="link-text">操作</div>
+                  <div slot="reference" class="link-text t2">更多操作</div>
                 </el-popover>
               </template>
               <template v-else>
@@ -532,6 +558,10 @@ export default {
       text-decoration: underline;
       cursor: pointer;
       user-select: none;
+      display: inline-block;
+      &.t2 {
+        padding-left: 10px;
+      }
     }
     .scoped-text {
       text-overflow: ellipsis;

+ 123 - 0
src/views/house/compete.vue

@@ -0,0 +1,123 @@
+<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/Compete'
+import PopupEdit from './components/popup/CompeteEdit'
+import baseTable from '_m/baseTable.js'
+export default {
+  name: 'price',
+  components: {
+    SearchForm,
+    PopupEdit,
+  },
+  provide() {
+    return {
+      parentData: this
+    }
+  },
+  mixins: [baseTable],
+  data() {
+    return {
+      apiStr: 'house.admestatecompetelist',
+      searchForm: {},
+      isDtlShow: false,
+      // noCreated: true,
+      curObj: {},
+    }
+  },
+  computed: {
+    tableData2() {
+      const arr = [...this.tableData]
+      arr.map(item => {
+        const product_type = item.product_type ? item.product_type.split(',') : []
+        const productTypeName = product_type.map(v => {
+          return arrToObj(this.$dictData.product_type)[v]
+        })
+        item.productTypeName = productTypeName.join(',')
+      })
+      return arr
+    }
+  },
+  created() {
+    const query = this.$route.query
+    this.searchForm.estate_id = query.id || ''
+  },
+  mounted() {
+    this.listConfig = {
+      rows: [
+        { label: '排序', prop: 'sort', type: 'input', width: 80},
+        { label: '竞品', prop: 'estate_name'},
+        { label: '所属区域', prop: 'area_type', type: 'flag', flags: arrToObj(this.$dictData.area_type) },
+        { label: '产品类型', prop: 'productTypeName'},
+        { label: '更新人', prop: 'update_by' },
+        { label: '更新时间', prop: 'update_at' },
+        { label: '操作', width: 200, type: 'handle2', operations:
+          [
+            // { label: '编辑', func: this.openPopup, btnType: 'primary' },
+            { label: '保存排序', func: this.saveHandle, btnType: 'primary' },
+            { label: '删除', func: this.delHandle, btnType: 'danger' },
+          ]
+        }
+      ]
+    }
+  },
+  methods: {
+    saveHandle (row) {
+      this.$api.house.admestatecompeteedit({
+        id: row.id,
+        compete_id: row.estate_id,
+        sort: row.sort,
+      }).then(data => {
+        this.$msgs('更新成功')
+      })
+    },
+    delHandle(row) {
+      this.$msg(`您确定要删除该竞品吗?`, 'confirm', () => {
+        this.$api.house.admestatecompetedel({
+          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>

+ 94 - 0
src/views/house/components/popup/CompeteEdit.vue

@@ -0,0 +1,94 @@
+<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">
+      </base-form>
+      <div class="xl-form">
+        <div class="xl-form-footer">
+          <el-button class="xl-form-btn t2" @click="close">关 闭</el-button>
+          <el-button class="xl-form-btn t1" @click="close('confirm')">确定</el-button>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { arrToObj } from '@/utils'
+export default {
+  components: { },
+  mixins,
+  props: {
+    isShow: Boolean,
+    curObj: Object
+  },
+  inject: ['parentData'],
+  data() {
+    return {
+      loading: false,
+      formData: [],
+    }
+  },
+  watch: {
+    isShow: function(val) {
+      if (val) {
+        this.getDef()
+      }
+    },
+  },
+  methods: {
+    getDef (str) {
+      let params = { ...this.curObj }
+      this.formData = [
+        { label: '竞品楼盘', key: 'compete_id', rules: 1, type: 'selectRemote',
+          remoteParams: { skey: 'estate_name', api: `house.admestatelist`, opKey: 'estate_name', opVal: 'id' },
+        },
+        { label: '排序', key: 'sort' },
+      ]
+      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.compete_id = this.curObj.id
+            newForm.estate_id = this.parentData.searchForm.estate_id
+            let apiStr = 'admestatecompeteadd'
+            if (this.curObj.id) apiStr = 'admestatecompeteedit'
+            this.$api.house[apiStr](newForm).then(data => {
+              this.$msgs(newForm.estate_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-date-editor.el-input {
+    width: 100%;
+  }
+  ::v-deep .el-textarea__inner {
+    height: 300px;
+  }
+}
+</style>

+ 1 - 1
src/views/house/components/popup/OldEdit.vue

@@ -154,7 +154,7 @@ export default {
       } else {
         this.formData = [
           { label: '所属楼盘', key: 'estate_id', rules: 1, type: 'selectRemote', changeHandle: this.estateChange,
-            remoteParams: { skey: 'estate_name', api: `house.admestatelist`, opKey: 'estate_name', opVal: 'id' },
+            remoteParams: { skey: 'estate_name', api: `house.admestatelist?estate_tag=二手`, opKey: 'estate_name', opVal: 'id' },
           },
         ]
       }

+ 50 - 0
src/views/house/components/searchForm/Compete.vue

@@ -0,0 +1,50 @@
+<template>
+  <base-form slot="content" ref="ruleForm" :data="searchData">
+    <div slot="footer">
+      <el-button :loading="listLoading" class="xl-form-btn bgc1">{{name}}的竞品楼盘</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>
+</template>
+<script>
+export default {
+  props: {
+    listLoading: Boolean
+  },
+  inject: ['parentData'],
+  mixins,
+  data() {
+    return {
+      searchData: []
+    }
+  },
+  computed: {
+    name () {
+      return this.parentData.$route.query.name || ''
+    }
+  },
+  mounted () {
+    this.getDef()
+  },
+  methods: {
+    getDef (str) {
+      let params = { ...this.$refs.ruleForm.baseForm }
+      this.searchData = [
+        // { label: '签约中介', key: 'company' },
+        // { label: '签约日期', label2: '开始时间', label3: '结束时间', key: 'startEndTime', type: 'datePicker', rules: 1},
+      ]
+      this.setDefaultValue(params, 'searchData')
+    },
+    searchHandle() {
+      const oldform = this.$refs.ruleForm.baseForm
+      const newForm = { ...oldform }
+      if (newForm.startEndTime) {
+        newForm.start_at = newForm.startEndTime[0]
+        newForm.end_at = newForm.startEndTime[1]
+        delete newForm.startEndTime
+      }
+      this.$emit('change', newForm)
+    }
+  }
+}
+</script>

+ 6 - 2
src/views/house/index.vue

@@ -14,7 +14,7 @@
       @currentChange="pageHandle"
       :isAdd="true"
       @add="openPopup"
-      :operationsDefaultLength="9"
+      :operationsDefaultLength="3"
     />
     <popup-edit
       :isShow="isDtlShow"
@@ -117,7 +117,7 @@ export default {
         { label: '创建时间', prop: 'create_at' },
         { label: '更新人', prop: 'update_by' },
         { label: '更新时间', prop: 'update_at' },
-        { label: '操作', width: 610, type: 'handle2', operations:
+        { label: '操作', width: 220, type: 'handle2', operations:
           [
             { label: '保存排序', func: this.saveHandle, btnType: 'success' },
             { label: '编辑信息', func: this.openPopup, btnType: 'primary' },
@@ -125,6 +125,7 @@ export default {
             { label: '楼盘动态', func: this.openNews, btnType: 'info' },
             { label: '历史成交价', func: this.openPrice, btnType: 'info' },
             { label: '模块主题', func: this.openTHEPopup, btnType: 'info' },
+            { label: '竞品管理', func: this.openCompetePopup, btnType: 'info' },
             { label: '助力规则', func: this.openHRPopup, btnType: 'warning' },
             { label: '删除', func: this.delHandle, btnType: 'danger' },
           ]
@@ -153,6 +154,9 @@ export default {
         })
       }, null, true)
     },
+    openCompetePopup (item) {
+      this.$router.push('/house/compete?id=' + item.id + '&name=' + item.estate_name)
+    },
     openNews (item) {
       this.$router.push('/house/news?id=' + item.id)
     },