stjdydayou пре 4 година
родитељ
комит
932c4bf5cc

+ 9 - 0
src/api/bz/base/baseInfo.js

@@ -0,0 +1,9 @@
+import request from '@/utils/request'
+
+export function findSelectByKeyword(keyword, dataType) {
+  return request({
+    url: '/bz/base/findSelectByKeyword',
+    method: 'post',
+    params: { keyword, dataType }
+  })
+}

+ 34 - 0
src/api/bz/equipment.js

@@ -0,0 +1,34 @@
+import request from '@/utils/request'
+
+export function findPage(data) {
+  return request({
+    url: '/bz/passenger/equipment/findPage',
+    method: 'post',
+    data
+  })
+}
+
+export function save(data) {
+  return request({
+    url: '/bz/passenger/equipment/save',
+    method: 'post',
+    data
+  })
+}
+
+export function updateById(id, data) {
+  return request({
+    url: '/bz/passenger/equipment/updateById',
+    method: 'post',
+    params: { id },
+    data
+  })
+}
+
+export function deleteByIds(ids) {
+  return request({
+    url: '/bz/passenger/equipment/deleteByIds',
+    method: 'post',
+    data: ids
+  })
+}

+ 59 - 0
src/components/SelectBaseBzData.vue

@@ -0,0 +1,59 @@
+<template>
+  <el-select
+    v-model="value"
+    :multiple="multiple"
+    filterable
+    remote
+    reserve-keyword
+    clearable
+    placeholder="请输入关键词搜索"
+    :remote-method="remoteMethod"
+    :loading="loading"
+    :disabled="disabled"
+    @change="onChange"
+  >
+    <el-option v-for="item in options" :key="item.id" :label="item.name+'['+item.id+']'" :value="item.id" />
+  </el-select>
+</template>
+
+<script>
+import { findSelectByKeyword } from '@/api/bz/base/baseInfo'
+
+export default {
+  name: 'SelectRemoteUser',
+  props: {
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+    multiple: {
+      type: Boolean,
+      default: false
+    },
+    dataType: {
+      type: String,
+      default: ''
+    },
+    value: {
+      type: [String, Number, Array],
+      default: ''
+    }
+  },
+  data: function() {
+    return {
+      options: [],
+      loading: false
+    }
+  },
+  methods: {
+    onChange(v) {
+      this.$emit('input', v)
+    },
+    remoteMethod(searchKey) {
+      findSelectByKeyword(searchKey).then(options => {
+        this.options = options
+      })
+    }
+  }
+}
+</script>

+ 14 - 0
src/router/index.js

@@ -33,6 +33,20 @@ import Layout from '@/layout'
 
 export const asyncRoutes = [
   {
+    path: '/passenger',
+    component: Layout,
+    name: 'Passenger',
+    meta: { icon: 'el-icon-pie-chart', authorities: ['system.config.find'] },
+    children: [
+      {
+        path: 'equipment',
+        name: 'PassengerEquipment',
+        component: () => import('@/views/passenger/equipment'),
+        meta: { title: '客流数据采集', authorities: ['system.config.find'] }
+      }
+    ]
+  },
+  {
     path: '/bz/base',
     component: Layout,
     name: 'bz',

+ 126 - 0
src/views/passenger/equipment/DialogForm.vue

@@ -0,0 +1,126 @@
+<template>
+  <el-dialog
+    v-if="visible"
+    :title="form.id?'编辑采集设备':'新建采集设备'"
+    :visible.sync="visible"
+  >
+    <el-form v-loading="isLoading" :model="form" label-width="100px" label-position="top">
+      <el-row :gutter="24">
+        <el-col :span="8">
+          <el-form-item label="点位类型">
+            <el-select v-model="form.dataType" placeholder="请选择" clearable @change="onDataTypeChange">
+              <el-option label="场馆" value="VENUE"/>
+              <el-option label="景区" value="SCENERY"/>
+              <el-option label="度假村" value="HOLIDAY_VILLAGE"/>
+              <el-option label="酒店" value="HOTEL"/>
+              <el-option label="民宿" value="HOME_STAY"/>
+              <el-option label="旅行社" value="TOURIST"/>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="16">
+          <el-form-item label="点位分布">
+            <select-base-bz-data v-model="form.bzId" :multiple="false" :data-type="form.dataType" :disabled="disabledSelectBz"/>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-form-item label="说明">
+        <el-input v-model="form.brief"/>
+      </el-form-item>
+      <el-form-item label="图片">
+        <el-upload
+          :file-list="fileList"
+          action="#"
+          list-type="picture-card"
+          name="fileData"
+          :http-request="uploaderHandle"
+          :on-success="uploadSuccess"
+          :auto-upload="true"
+        >
+          <i slot="default" class="el-icon-plus"/>
+        </el-upload>
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="visible = false">取 消</el-button>
+      <el-button type="primary" @click="handleSubmit">确 定</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+
+import { uploaderHandle } from '@/api/upload'
+import SelectBaseBzData from '@/components/SelectBaseBzData'
+import { save, updateById } from '@/api/bz/equipment'
+
+export default {
+  components: { SelectBaseBzData },
+  data() {
+    return {
+      visible: false,
+      isLoading: false,
+      listAllAuthorities: [],
+      form: {},
+      fileList: []
+    }
+  },
+  computed: {
+    disabledSelectBz: function() {
+      return !this.form || !this.form.dataType || this.form.dataType === ''
+    }
+  },
+  mounted() {
+  },
+  methods: {
+    uploaderHandle,
+    onDataTypeChange() {
+      this.form.bzId = ''
+    },
+    uploadSuccess(res, file, fileList) {
+      file.url = res.url
+      this.fileList = fileList
+    },
+    open(data) {
+      this.visible = true
+      this.isLoading = false
+      this.fileList = []
+      this.form = {
+        baseDataInfo: {}
+      }
+      if (data) {
+        if (data.litpics) {
+          data.litpics.forEach(o => {
+            this.fileList.push({ url: o })
+          })
+        }
+        this.form = Object.assign({}, data)
+      }
+    },
+    handleSubmit() {
+      const litpics = []
+      this.fileList.forEach(o => {
+        litpics.push(o.url)
+      })
+      this.isLoading = true
+      const param = { ...this.form, litpics }
+      console.log(param)
+      if (this.form.id) {
+        updateById(this.form.id, param).then(() => {
+          this.visible = false
+          this.$emit('ok')
+        }).finally(() => {
+          this.isLoading = false
+        })
+      } else {
+        save(param).then(res => {
+          this.visible = false
+          this.$emit('ok')
+        }).finally(() => {
+          this.isLoading = false
+        })
+      }
+    }
+  }
+}
+</script>

+ 110 - 0
src/views/passenger/equipment/index.vue

@@ -0,0 +1,110 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryForm" inline size="small">
+      <el-form-item label="点位类型">
+        <el-input v-model="queryForm.keyword" placeholder="关键词"/>
+      </el-form-item>
+      <el-form-item label="点位分布">
+        <el-input v-model="queryForm.keyword" placeholder="关键词"/>
+      </el-form-item>
+      <el-form-item label="时间维度">
+        <el-date-picker
+          v-model="queryForm.serviceBeginTime"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          value-format="yyyy-MM-dd"
+        />
+      </el-form-item>
+    </el-form>
+    <el-row class="action-bar-container" type="flex" justify="end">
+      <el-button type="primary" size="small" @click.native="fetchData">查询</el-button>
+      <el-button-group>
+        <el-button v-permission="['bz.base.venue.add']" size="small" @click.native="$refs.dialogForm.open({})">
+          新建
+        </el-button>
+        <el-button v-permission="['bz.base.venue.delete']" size="small" @click.native="deleteByIds(multipleSelection)">
+          删除
+        </el-button>
+      </el-button-group>
+    </el-row>
+    <el-card :style="{ padding: '0px',float:'left' }" shadow="hover" v-for="item in pageData.records">
+      <img :src="item.litpic" class="image" style="width: 200px;max-height: 200px;">
+      <div style="padding: 14px;">
+        <span>{{ item.brief }}</span>
+        <div class="bottom clearfix">
+          <time class="time">currentDate</time>
+          <el-button type="text" class="button">操作按钮</el-button>
+        </div>
+      </div>
+    </el-card>
+    <div style="clear: both"></div>
+    <el-pagination
+      class="pagination-container"
+      background
+      layout="prev, pager, next"
+      :total="pageData.total"
+      :page-size="pageData.pageSize"
+      @current-change="paginationChange"
+    />
+    <dialog-form ref="dialogForm" @ok="fetchData"/>
+  </div>
+</template>
+
+<script>
+import { deleteByIds, findPage } from '@/api/bz/equipment'
+import { dateTimeFormatter } from '@/utils/formater'
+import DialogForm from './DialogForm'
+
+export default {
+  components: { DialogForm },
+  data() {
+    return {
+      queryForm: {},
+      isLoading: true,
+      pageData: {
+        records: []
+      },
+      currentPage: 1,
+      multipleSelection: []
+    }
+  },
+  created() {
+    this.fetchData()
+  },
+  methods: {
+    dateTimeFormatter,
+    selectionChange(val) {
+      const temp = []
+      val.forEach(o => {
+        temp.push(o.id)
+      })
+      this.multipleSelection = temp
+    },
+    deleteByIds(ids) {
+      this.$confirm('确认要删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        deleteByIds(ids).then(() => {
+          this.fetchData()
+        })
+      })
+    },
+    paginationChange(val) {
+      this.currentPage = val
+      this.fetchData()
+    },
+    fetchData() {
+      this.isLoading = true
+      findPage({ ...this.queryForm, current: this.currentPage })
+        .then((response) => {
+          this.pageData = response
+        })
+        .finally(() => (this.isLoading = false))
+    }
+  }
+}
+</script>