liujq 1 هفته پیش
والد
کامیت
ffb5f95896

+ 1 - 1
package.json

@@ -22,7 +22,7 @@
     "normalize.css": "7.0.0",
     "nprogress": "0.2.0",
     "path-to-regexp": "2.4.0",
-    "qiniu-js": "^2.5.4",
+    "qiniu-js": "^2.5.5",
     "vue": "2.6.10",
     "vue-amap": "^0.5.10",
     "vue-cropper": "^0.5.6",

+ 24 - 0
src/api/facility.js

@@ -49,4 +49,28 @@ export default {
   admbigdataquantitydel: params => { // 大数据管理 删除
     return getRequestNoSort('/adm/bigdata/quantity/del', params, 'loading')
   },
+  admbigdataquantityweeklist: params => { // 大数据管理 周 列表接口
+    return getRequest('/adm/bigdata/quantity/week/list', params)
+  },
+  admbigdataquantityweekadd: params => { // 大数据管理 周 添加
+    return getRequestNoSort('/adm/bigdata/quantity/week/add', params, 'loading')
+  },
+  admbigdataquantityweekedit: params => { // 大数据管理 周 编辑
+    return getRequestNoSort('/adm/bigdata/quantity/week/edit', params, 'loading')
+  },
+  admbigdataquantityweekdel: params => { // 大数据管理 周 删除
+    return getRequestNoSort('/adm/bigdata/quantity/week/del', params, 'loading')
+  },
+  admbigdataquantitymonthlist: params => { // 大数据管理 月 列表接口
+    return getRequest('/adm/bigdata/quantity/month/list', params)
+  },
+  admbigdataquantitymonthadd: params => { // 大数据管理 月 添加
+    return getRequestNoSort('/adm/bigdata/quantity/month/add', params, 'loading')
+  },
+  admbigdataquantitymonthedit: params => { // 大数据管理 月 编辑
+    return getRequestNoSort('/adm/bigdata/quantity/month/edit', params, 'loading')
+  },
+  admbigdataquantitymonthdel: params => { // 大数据管理 月 删除
+    return getRequestNoSort('/adm/bigdata/quantity/month/del', params, 'loading')
+  },
 }

+ 1 - 0
src/components/Common/BaseForm.vue

@@ -96,6 +96,7 @@
           :type="`${item.type2 ? item.type2 : 'daterange'}`"
           :align="'right'"
           :value-format="`${item.valueFormat ? item.valueFormat : 'yyyy-MM-dd'}`"
+          :format="`${item.format ? item.format : 'yyyy-MM-dd'}`"
           range-separator="至"
           :disabled="item.disabled || false"
           :placeholder="`请选择${item.label}`"

+ 118 - 0
src/views/bigdata/components/popup/MonthdataEdit.vue

@@ -0,0 +1,118 @@
+<template>
+  <div>
+    <el-dialog
+      v-loading="loading"
+      :show-close="false"
+      :close-on-click-modal="false"
+      :visible.sync="isShow"
+      :title="this.curObj && this.curObj.id ? `编辑数据${this.curObj.year}-${this.curObj.month}` : '添加数据'"
+      :fullscreen="false"
+      width="900px"
+      custom-class="xl-dialog"
+      center
+    >
+      <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="160px">
+        <div slot="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>
+      </base-form>
+    </el-dialog>
+  </div>
+</template>
+<script>
+export default {
+  components: {},
+  mixins: [...mixins],
+  props: {
+    isShow: Boolean,
+    curObj: Object
+  },
+  inject: ['parentData'],
+  data() {
+    return {
+      formData: [],
+      loading: true,
+      cObj: {},
+      isShowMap: false
+    }
+  },
+  watch: {
+    isShow: function(val) {
+      if (val) {
+        this.getDef()
+      }
+    },
+  },
+  methods: {
+    getDef() {
+      const params = { ...this.curObj }
+      // if (params[params.big_data_zone+'_quantity']) {
+      //   params.quantity = params[params.big_data_zone+'_quantity']
+      //   delete params[params.big_data_zone+'_quantity']
+      // }
+      // if (params[params.big_data_zone+'_area']) {
+      //   params.area = params[params.big_data_zone+'_area']
+      //   delete params[params.big_data_zone+'_area']
+      // }
+      this.formData = [
+        { label: '类型', key: 'big_data_type', class: 'c-2', rules: 1, type: 'select', options: this.$dictData.big_data_type },
+      ]
+  
+      // 只有当不存在curObj.id时才添加成交时间字段
+      if (!this.curObj || !this.curObj.id) {
+        this.formData.unshift({ label: '成交时间', key: 'data_time', class: 'c-2', type: 'datePicker', rules: 1, type2: 'month', valueFormat:'yyyy-MM', format: 'yyyy-MM' })
+      }
+      const zone = this.$dictData.big_data_zone || []
+      zone.forEach(item => {
+        this.formData.push({ label: item.key+'销售数量', key: item.val+'_quantity', class: 'c-2', rules: 1, type: 'input' })
+        this.formData.push({ label: item.key+'销售面积', key: item.val+'_area', class: 'c-2', rules: 1, type: 'input' })
+      })
+      this.setDefaultValue(params)
+    },
+    close(str) {
+      if (str === 'confirm') {
+        this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
+          if (valid) {
+            const oldform = this.$refs.ruleForm.baseForm
+            let newForm = { ...oldform }
+            if (newForm.data_time) {
+              const dateArr = newForm.data_time.split('-')
+              newForm.year = dateArr[0]
+              newForm.month = dateArr[1]
+              delete newForm.data_time
+            }
+            let apiStr = 'admbigdataquantitymonthadd'
+            if (this.curObj.id) {
+              apiStr = 'admbigdataquantitymonthedit'
+              newForm.id = this.curObj.id
+              newForm.year = this.curObj.year
+              newForm.month = this.curObj.month
+            }
+            this.$api.facility[apiStr](newForm).then(data => {
+              this.$msgs(this.curObj.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;
+  width:100%;
+  ::v-deep .el-form-item {
+    margin-bottom: 10px;
+  }
+  ::v-deep .el-date-editor.el-input {
+    width: 100%;
+  }
+}
+</style>

+ 137 - 0
src/views/bigdata/components/popup/WeekdataEdit.vue

@@ -0,0 +1,137 @@
+<template>
+  <div>
+    <el-dialog
+      v-loading="loading"
+      :show-close="false"
+      :close-on-click-modal="false"
+      :visible.sync="isShow"
+      :title="this.curObj && this.curObj.id ? `编辑数据${this.curObj.year}-第${this.curObj.week}周` : '添加数据'"
+      :fullscreen="false"
+      width="900px"
+      custom-class="xl-dialog"
+      center
+    >
+      <base-form ref="ruleForm" class="lib-edit" :data="formData" :is-inline="false" label-width="160px">
+        <div slot="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>
+      </base-form>
+    </el-dialog>
+  </div>
+</template>
+<script>
+export default {
+  components: {},
+  mixins: [...mixins],
+  props: {
+    isShow: Boolean,
+    curObj: Object
+  },
+  inject: ['parentData'],
+  data() {
+    return {
+      formData: [],
+      loading: true,
+      cObj: {},
+      isShowMap: false
+    }
+  },
+  watch: {
+    isShow: function(val) {
+      if (val) {
+        this.getDef()
+      }
+    },
+  },
+  methods: {
+    getISOWeekNumber(date) {
+      const target = new Date(date.valueOf());
+      const dayNumber = (date.getDay() + 6) % 7;
+      target.setDate(target.getDate() - dayNumber + 3);
+      const firstThursday = target.valueOf();
+      target.setMonth(0, 1);
+      if (target.getDay() !== 4) {
+        target.setMonth(0, 1 + ((4 - target.getDay()) + 7) % 7);
+      }
+      const weekNumber = 1 + Math.ceil((firstThursday - target) / 604800000);
+      return weekNumber;
+    },
+    getDef() {
+      const params = { ...this.curObj }
+      // params.data_time = params.year+'-W'+params.week
+      // if (params[params.big_data_zone+'_quantity']) {
+      //   params.quantity = params[params.big_data_zone+'_quantity']
+      //   delete params[params.big_data_zone+'_quantity']
+      // }
+      // if (params[params.big_data_zone+'_area']) {
+      //   params.area = params[params.big_data_zone+'_area']
+      //   delete params[params.big_data_zone+'_area']
+      // }
+      this.formData = [
+        { label: '类型', key: 'big_data_type', class: 'c-2', rules: 1, type: 'select', options: this.$dictData.big_data_type },
+      ]
+  
+      // 只有当不存在curObj.id时才添加成交时间字段
+      if (!this.curObj || !this.curObj.id) {
+        this.formData.unshift({ label: '成交时间', key: 'data_time', class: 'c-2', type: 'datePicker', rules: 1, type2: 'week', format:"yyyy 第 WW 周"})
+      }
+      const zone = this.$dictData.big_data_zone || []
+      console.log(zone)
+      zone.forEach(item => {
+        this.formData.push({ label: item.key+'销售数量', key: item.val+'_quantity', class: 'c-2', rules: 1, type: 'input' })
+        this.formData.push({ label: item.key+'销售面积', key: item.val+'_area', class: 'c-2', rules: 1, type: 'input' })
+      })
+      this.setDefaultValue(params)
+    },
+    close(str) {
+      const that = this
+      if (str === 'confirm') {
+        this.$refs['ruleForm'].$refs['baseForm'].validate((valid) => {
+          if (valid) {
+            const oldform = this.$refs.ruleForm.baseForm
+            let newForm = { ...oldform }
+            // if (newForm.quantity) {
+            //   newForm[newForm.big_data_zone+'_quantity'] = newForm.quantity
+            //   delete newForm.quantity
+            // }
+            if (newForm.data_time) {
+              const date = new Date(newForm.data_time);
+              newForm.year = date.getFullYear();
+              newForm.week = that.getISOWeekNumber(date); 
+              delete newForm.data_time
+            }
+            let apiStr = 'admbigdataquantityweekadd'
+            if (this.curObj.id) {
+              apiStr = 'admbigdataquantityweekedit'
+              newForm.id = this.curObj.id
+              newForm.year = this.curObj.year
+              newForm.week = this.curObj.week
+            }
+            this.$api.facility[apiStr](newForm).then(data => {
+              this.$msgs(this.curObj.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;
+  width:100%;
+  ::v-deep .el-form-item {
+    margin-bottom: 10px;
+  }
+  ::v-deep .el-date-editor.el-input {
+    width: 100%;
+  }
+}
+</style>

+ 1 - 1
src/views/bigdata/list.vue

@@ -69,7 +69,7 @@ export default {
     this.listConfig = {
       rows: [
         { label: '数据日期', prop: 'data_time' },
-        { label: '数据日期', prop: 'big_data_type', type: 'flag', flags: arrToObj(this.$dictData.big_data_type	) },
+        { label: '数据类型', prop: 'big_data_type', type: 'flag', flags: arrToObj(this.$dictData.big_data_type	) },
         { label: '更新人', prop: 'update_by' },
         
         { label: '操作', width: 80, type: 'handle2', operations:

+ 118 - 0
src/views/bigdata/month.vue

@@ -0,0 +1,118 @@
+<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"
+      @sizeChange="sizeChange"
+      :isAdd="true"
+      @add="openPopup"
+    />
+    <bigdata-edit
+      :isShow="isDtlShow"
+      :curObj="curObj"
+      @close="closePopup"
+    />
+  </div>
+</template>
+<script>
+import { arrToObj } from '@/utils'
+import SearchForm from './components/searchForm/Bigdata'
+import BigdataEdit from './components/popup/MonthdataEdit'
+import baseTable from '_m/baseTable.js'
+export default {
+  name: 'list',
+  components: {
+    SearchForm,
+    BigdataEdit
+  },
+  provide() {
+    return {
+      parentData: this
+    }
+  },
+  mixins: [baseTable],
+  data() {
+    return {
+      apiStr: 'facility.admbigdataquantitymonthlist',
+      searchForm: null,
+      isDtlShow: false,
+      curObj: {},
+      noCreated: true,
+      monthNum: 1,
+    }
+  },
+  created() {
+    this.searchForm = {
+      big_data_type: 'xf',
+    }
+    this.fetchData()
+  },
+  computed: {
+    tableData2() {
+      const arr = [...this.tableData, { year: '2025', month: '12', id: 123, big_data_type: 'xf' }]
+      arr.map(item => {
+        item.dataTime = `${item.year}-${item.month}`
+      })
+      return arr
+    }
+  },
+  mounted() {
+    this.listConfig = {
+      rows: [
+        { label: '数据时间', prop: 'dataTime' },
+        { label: '数据类型', prop: 'big_data_type', type: 'flag', flags: arrToObj(this.$dictData.big_data_type	) },
+        { label: '更新人', prop: 'update_by' },
+        
+        { label: '操作', width: 80, type: 'handle2', operations:
+          [
+            { label: '编辑', func: this.openPopup, btnType: 'primary' },
+          ]
+        }
+      ]
+    }
+    const zone = this.$dictData.big_data_zone || []
+    zone.forEach(item => {
+      this.listConfig.rows.push({ label: item.key+'销售数量', prop: item.val+'_quantity' })
+      this.listConfig.rows.push({ label: item.key+'销售面积', prop: item.val+'_area' })
+    })
+  },
+  methods: {
+    getMoreData (res) {
+      this.monthNum = res.month_num || 1
+    },
+    delHandle(row) {
+      this.$msg(`您确定要删除该规则吗?`, 'confirm', () => {
+        this.$api.user.admsaleuserdel({
+          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>

+ 118 - 0
src/views/bigdata/week.vue

@@ -0,0 +1,118 @@
+<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"
+      @sizeChange="sizeChange"
+      :isAdd="true"
+      @add="openPopup"
+    />
+    <bigdata-edit
+      :isShow="isDtlShow"
+      :curObj="curObj"
+      @close="closePopup"
+    />
+  </div>
+</template>
+<script>
+import { arrToObj } from '@/utils'
+import SearchForm from './components/searchForm/Bigdata'
+import BigdataEdit from './components/popup/WeekdataEdit'
+import baseTable from '_m/baseTable.js'
+export default {
+  name: 'list',
+  components: {
+    SearchForm,
+    BigdataEdit
+  },
+  provide() {
+    return {
+      parentData: this
+    }
+  },
+  mixins: [baseTable],
+  data() {
+    return {
+      apiStr: 'facility.admbigdataquantityweeklist',
+      searchForm: null,
+      isDtlShow: false,
+      curObj: {},
+      noCreated: true,
+      monthNum: 1,
+    }
+  },
+  created() {
+    this.searchForm = {
+      big_data_type: 'xf',
+    }
+    this.fetchData()
+  },
+  computed: {
+    tableData2() {
+      const arr = [...this.tableData]
+      arr.map(item => {
+        item.dataTime = `${item.year}-第${item.week}周`
+      })
+      return arr
+    }
+  },
+  mounted() {
+    this.listConfig = {
+      rows: [
+        { label: '数据时间', prop: 'dataTime' },
+        { label: '数据类型', prop: 'big_data_type', type: 'flag', flags: arrToObj(this.$dictData.big_data_type	) },
+        { label: '更新人', prop: 'update_by' },
+        
+        { label: '操作', width: 80, type: 'handle2', operations:
+          [
+            { label: '编辑', func: this.openPopup, btnType: 'primary' },
+          ]
+        }
+      ]
+    }
+    const zone = this.$dictData.big_data_zone || []
+    zone.forEach(item => {
+      this.listConfig.rows.push({ label: item.key+'销售数量', prop: item.val+'_quantity' })
+      this.listConfig.rows.push({ label: item.key+'销售面积', prop: item.val+'_area' })
+    })
+  },
+  methods: {
+    getMoreData (res) {
+      this.monthNum = res.month_num || 1
+    },
+    delHandle(row) {
+      this.$msg(`您确定要删除该规则吗?`, 'confirm', () => {
+        this.$api.user.admsaleuserdel({
+          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>