Ver Fonte

岗位目录管理

stjdydayou há 4 anos atrás
pai
commit
d76fa5c590

+ 34 - 0
src/api/occupation.js

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

+ 5 - 5
src/router/index.js

@@ -59,7 +59,7 @@ export const asyncRoutes = [
     meta: {
       title: '文旅资源管理',
       icon: 'el-icon-goods',
-      authorities: ['cultural.tourism.organization.find']
+      authorities: ['cultural.tourism.organization.find', 'cultural.tourism.occupation.find']
     },
     children: [
       {
@@ -69,10 +69,10 @@ export const asyncRoutes = [
         meta: { title: '机构管理', authorities: ['cultural.tourism.organization.find'] }
       },
       {
-        path: 'job',
-        name: 'CulturalTourismJob',
-        component: () => import('@/views/passenger/equipment/Detail'),
-        meta: { title: '岗位管理' }
+        path: 'occupation',
+        name: 'CulturalTourismOccupation',
+        component: () => import('@/views/cultural/tourism/occupation'),
+        meta: { title: '岗位目录管理', authorities: ['cultural.tourism.occupation.find'] }
       },
       {
         path: 'material',

+ 100 - 0
src/views/cultural/tourism/occupation/DialogForm.vue

@@ -0,0 +1,100 @@
+<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-form-item label="职业名称">
+        <el-input v-model="form.name"/>
+      </el-form-item>
+
+      <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/occupation'
+
+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>

+ 107 - 0
src/views/cultural/tourism/occupation/index.vue

@@ -0,0 +1,107 @@
+<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="['cultural.tourism.occupation.add']" size="small" @click.native="$refs.dialogForm.open({})">
+          添加
+        </el-button>
+        <el-button v-permission="['cultural.tourism.occupation.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="remark" min-width="300"/>
+      <el-table-column label="创建时间" prop="createdTime" :formatter="dateTimeFormatter" width="180"/>
+      <el-table-column label="操作" width="70" fixed="right">
+        <template slot-scope="scope">
+          <el-button v-permission="['cultural.tourism.occupation.edit']" type="text" @click.native="$refs.dialogForm.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"/>
+  </div>
+</template>
+
+<script>
+import { deleteByIds, findPage } from '@/api/occupation'
+import { dateTimeFormatter } from '@/utils/formater'
+import DialogForm from './DialogForm'
+
+export default {
+  components: { DialogForm },
+  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>