jtoms 4 лет назад
Родитель
Сommit
d7bdf5baa8

+ 34 - 0
src/api/base/category.js

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

+ 34 - 0
src/api/base/category_extend_column.js

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

+ 15 - 3
src/router/index.js

@@ -87,13 +87,25 @@ export const asyncRoutes = [
     component: Layout,
     name: 'bz',
     meta: {
-      title: '业务资源管理',
+      title: '基础数据资源管理',
       icon: 'el-icon-receiving',
-      authorities: ['bz.base.venue.find']
+      authorities: ['category.base.find']
     },
-    redirect: '/bz/base/venue',
+    redirect: '/base',
     children: [
       {
+        path: 'category',
+        name: 'BaseCategory',
+        component: () => import('@/views/base/category'),
+        meta: { title: '分类管理', authorities: ['category.base.find'] }
+      },
+      {
+        path: 'info',
+        name: 'BzBaseInfo',
+        component: () => import('@/views/bz/base/venue/index'),
+        meta: { title: '基础数据管理', authorities: ['bz.base.venue.find'] }
+      },
+      {
         path: 'venue',
         name: 'BzBaseVenue',
         component: () => import('@/views/bz/base/venue/index'),

+ 108 - 0
src/views/base/category/DialogForm.vue

@@ -0,0 +1,108 @@
+<template>
+  <el-dialog
+    v-if="visible"
+    :title="form.id?'编辑基础数据分类':'新建基础数据分类'"
+    :visible.sync="visible"
+    width="600px"
+  >
+    <el-form v-loading="isLoading" :model="form" label-width="100px" label-position="top">
+      <el-row :gutter="16">
+        <el-col :span="12">
+          <el-form-item label="物务类型名称">
+            <el-input v-model="form.name"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="排序">
+            <el-input-number v-model="form.sortNumber" :min="0"/>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-form-item label="备注说明">
+        <el-input v-model="form.remark" type="textarea" rows="5"/>
+      </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>
+<style type="text/css">
+.image {
+  width: 100%;
+  height: 100%;
+  border-radius: 6px;
+}
+</style>
+
+<script>
+
+import { save, updateById } from '@/api/base/category'
+
+export default {
+  data() {
+    return {
+      visible: false,
+      isLoading: false,
+      form: {},
+      businessLicense: null,
+      legalPersonIdCardA: null,
+      legalPersonIdCardB: null,
+      lng: null,
+      lat: null
+    }
+  },
+  mounted() {
+  },
+  methods: {
+    open(data) {
+      this.visible = true
+      this.isLoading = false
+      this.form = {}
+      console.log(data)
+      if (data && data.id) {
+        this.lat = data.lat
+        this.lng = data.lng
+        this.businessLicense = data.businessLicense
+        this.legalPersonIdCardB = data.legalPersonIdCardB
+        this.legalPersonIdCardA = data.legalPersonIdCardA
+      }
+      this.form = Object.assign({}, data)
+    },
+    mapClick(e) {
+      console.log(e)
+      this.lng = e.latLng.lng
+      this.lat = e.latLng.lat
+    },
+    handleSubmit() {
+      this.isLoading = true
+      const param = {
+        ...this.form,
+        'lng': this.lng,
+        'lat': this.lat,
+        'businessLicense': this.businessLicense,
+        'legalPersonIdCardB': this.legalPersonIdCardB,
+        'legalPersonIdCardA': this.legalPersonIdCardA
+      }
+      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>

+ 109 - 0
src/views/base/category/ExtendColumnDialogForm.vue

@@ -0,0 +1,109 @@
+<template>
+  <el-dialog
+    v-if="visible"
+    :title="form.id?'编辑物务资源目录':'新建物务资源目录'"
+    :visible.sync="visible"
+    width="600px"
+    append-to-body
+  >
+    <el-form v-loading="isLoading" :model="form" label-width="100px" label-position="top">
+      <el-row :gutter="16">
+        <el-col :span="8">
+          <el-form-item label="字段编码">
+            <el-input v-model="form.fieldKey"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="字段名称">
+            <el-input v-model="form.fieldLabel"/>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="排序">
+            <el-input-number v-model="form.sortNumber" :min="0"/>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
+      <el-form-item label="默认值">
+        <el-radio v-model="form.fieldType" label="string">文本</el-radio>
+        <el-radio v-model="form.fieldType" label="number">数字</el-radio>
+        <el-radio v-model="form.fieldType" label="bool">布尔</el-radio>
+        <el-radio v-model="form.fieldType" label="bstring">多行文本</el-radio>
+        <el-radio v-model="form.fieldType" label="radio">单选框</el-radio>
+        <el-radio v-model="form.fieldType" label="checkbox">多选框</el-radio>
+        <el-radio v-model="form.fieldType" label="select">下拉选择</el-radio>
+      </el-form-item>
+      <el-form-item label="默认值">
+        <el-input v-model="form.defaultValue" type="textarea"/>
+      </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 { save, updateById } from '@/api/base/category_extend_column'
+import { Message } from 'element-ui'
+
+export default {
+  data() {
+    return {
+      visible: false,
+      isLoading: false,
+      form: {},
+      categoryId: null
+    }
+  },
+  mounted() {
+  },
+  methods: {
+    open(data, categoryId) {
+      this.visible = true
+      this.isLoading = false
+      this.form = {}
+      console.log(data, categoryId)
+      this.form = Object.assign({}, data)
+      if (this.form.fieldType) {
+        this.form.fieldType = this.form.fieldType.name
+      }
+      this.categoryId = categoryId
+    },
+    handleSubmit() {
+      const param = {
+        ...this.form,
+        'categoryId': this.categoryId
+      }
+      if ((!param.defaultValue || param.defaultValue === '') && (param.fieldType === 'radio' || param.fieldType === 'checkbox' || param.fieldType === 'select')) {
+        Message({
+          message: '单选框、多选框、下拉选择的数据类型必需填写默认值,多个值请用英文逗号(“,”)分隔',
+          type: 'error',
+          duration: 5 * 1000
+        })
+        return
+      }
+      this.isLoading = true
+      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>

+ 122 - 0
src/views/base/category/ExtendColumnIndex.vue

@@ -0,0 +1,122 @@
+<template>
+  <el-dialog
+    v-if="visible"
+    :title="baseInfo.name+'-扩展字段管理'"
+    :visible.sync="visible"
+    width="1200px"
+  >
+
+    <el-form :model="queryForm" inline size="small">
+      <el-form-item label="字段编码">
+        <el-input v-model="queryForm.fieldKey" placeholder="字段编码"/>
+      </el-form-item>
+      <el-form-item label="字段名称">
+        <el-input v-model="queryForm.fieldLabel" placeholder="字段名称"/>
+      </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="['category.base.extend.column']" size="small" @click.native="$refs.extendColumnDialogForm.open({},baseInfo.id)">
+          新建
+        </el-button>
+        <el-button v-permission="['category.base.extend.column']" size="small" @click.native="deleteByIds(multipleSelection)">
+          删除
+        </el-button>
+      </el-button-group>
+    </el-row>
+    <el-table
+      v-loading="isLoading"
+      :data="pageData.records"
+      border
+      fit
+      highlight-current-row
+      @selection-change="selectionChange"
+    >
+      <el-table-column type="selection" width="55"/>
+      <el-table-column label="字段编码" prop="fieldKey" width="200"/>
+      <el-table-column label="字段名称" prop="fieldLabel" width="200"/>
+      <el-table-column label="字段类型" prop="fieldType" width="100"/>
+      <el-table-column label="默认值" prop="defaultValue" min-width="300"/>
+      <el-table-column label="操作" width="80" fixed="right">
+        <template slot-scope="scope">
+          <el-button v-permission="['category.base.extend.column']" type="text" @click.native="$refs.extendColumnDialogForm.open(scope.row)">编辑</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      class="pagination-container"
+      background
+      layout="prev, pager, next"
+      :total="pageData.total"
+      :page-size="pageData.pageSize"
+      @current-change="paginationChange"
+    />
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="visible = false">关闭</el-button>
+    </div>
+    <extend-column-dialog-form ref="extendColumnDialogForm" @ok="fetchData"/>
+
+  </el-dialog>
+</template>
+
+<script>
+
+import { findPage, deleteByIds } from '@/api/base/category_extend_column'
+import ExtendColumnDialogForm from './ExtendColumnDialogForm'
+
+export default {
+  components: { ExtendColumnDialogForm },
+  data() {
+    return {
+      visible: false,
+      isLoading: false,
+      baseInfo: {},
+      queryForm: {},
+      pageData: {},
+      currentPage: 1,
+      multipleSelection: []
+    }
+  },
+  mounted() {
+  },
+  methods: {
+    open(data) {
+      this.visible = true
+      this.isLoading = false
+      this.baseInfo = Object.assign({}, data)
+      this.fetchData()
+    },
+    selectionChange(val) {
+      const temp = []
+      val.forEach(o => {
+        temp.push(o.id)
+      })
+      this.multipleSelection = temp
+    },
+    paginationChange(val) {
+      this.currentPage = val
+      this.fetchData()
+    },
+    deleteByIds(ids) {
+      this.$confirm('确认要删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        deleteByIds(ids).then(() => {
+          this.fetchData()
+        })
+      })
+    },
+    fetchData() {
+      this.isLoading = true
+      findPage({ ...this.queryForm, current: this.currentPage })
+        .then((response) => {
+          this.pageData = response
+        })
+        .finally(() => (this.isLoading = false))
+    }
+  }
+}
+</script>

+ 111 - 0
src/views/base/category/index.vue

@@ -0,0 +1,111 @@
+<template>
+  <div class="app-container">
+
+    <el-form :model="queryForm" inline size="small">
+      <el-form-item label="分类名称">
+        <el-input v-model="queryForm.name" placeholder="分类名称"/>
+      </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="['category.base.add']" size="small" @click.native="$refs.dialogForm.open({})">
+          新建
+        </el-button>
+        <el-button v-permission="['category.base.delete']" size="small" @click.native="deleteByIds(multipleSelection)">
+          删除
+        </el-button>
+      </el-button-group>
+    </el-row>
+    <el-table
+      v-loading="isLoading"
+      :data="pageData.records"
+      border
+      fit
+      highlight-current-row
+      @selection-change="selectionChange"
+    >
+      <el-table-column type="selection" width="55"/>
+      <el-table-column label="ID" prop="id" width="150"/>
+      <el-table-column label="分类名称" prop="name" width="200"/>
+      <el-table-column label="排序" prop="sortNumber" width="100"/>
+      <el-table-column label="备注说明" prop="remark" min-width="300"/>
+      <el-table-column label="创建时间" prop="createdTime" :formatter="dateTimeFormatter" width="180"/>
+      <el-table-column label="操作" width="150" fixed="right">
+        <template slot-scope="scope">
+          <el-button v-permission="['category.base.edit']" type="text" @click.native="$refs.dialogForm.open(scope.row)">编辑</el-button>
+          <el-button v-permission="['category.base.extend.column']" type="text" @click.native="$refs.extendColumnIndex.open(scope.row)">扩展字段</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <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"/>
+    <extend-column-index ref="extendColumnIndex"/>
+  </div>
+</template>
+
+<script>
+import { deleteByIds, findPage } from '@/api/base/category'
+import { dateTimeFormatter } from '@/utils/formater'
+import DialogForm from './DialogForm'
+import ExtendColumnIndex from './ExtendColumnIndex'
+
+export default {
+  components: { DialogForm, ExtendColumnIndex },
+  data() {
+    return {
+      queryForm: {},
+      isLoading: true,
+      pageData: {},
+      currentPage: 1,
+      multipleSelection: []
+    }
+  },
+  computed: {},
+  created() {
+  },
+  mounted() {
+    this.fetchData()
+  },
+  methods: {
+    dateTimeFormatter,
+    selectionChange(val) {
+      const temp = []
+      val.forEach(o => {
+        temp.push(o.id)
+      })
+      this.multipleSelection = temp
+    },
+    paginationChange(val) {
+      this.currentPage = val
+      this.fetchData()
+    },
+    deleteByIds(ids) {
+      this.$confirm('确认要删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        deleteByIds(ids).then(() => {
+          this.fetchData()
+        })
+      })
+    },
+    fetchData() {
+      this.isLoading = true
+      findPage({ ...this.queryForm, current: this.currentPage })
+        .then((response) => {
+          this.pageData = response
+        })
+        .finally(() => (this.isLoading = false))
+    }
+  }
+}
+</script>