MrShi
4 天以前 05aec1e9986fbe3e907259bb1a1396f129bd0fa1
admin/src/views/business/member.vue
@@ -2,38 +2,40 @@
  <TableLayout :permissions="['business:member:query']">
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="名称" prop="name">
        <el-input v-model="searchForm.name"  style="width: 150px" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
      <el-form-item label="姓名" prop="name">
        <el-input v-model="searchForm.name"  style="width: 180px" placeholder="请输入姓名" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="工号" prop="code">
        <el-input v-model="searchForm.code" style="width: 150px" placeholder="请输入工号" @keypress.enter.native="search"></el-input>
        <el-input v-model="searchForm.code" style="width: 180px" placeholder="请输入工号" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="战区" prop="zhanquIds">
        <el-select
            v-model="searchForm.zhanquIds"
            style="width: 150px"
            style="width: 180px"
            placeholder="战区"
            clearable
            @change="search"
        >
          <el-option
              v-for="item in cateList"
              v-for="item in cateList.filter(item=>{return item.type==0})"
              :key="item.id"
              :value="item.id"
              :label="item.name"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="商业化类型" prop="bustypeIds">
      <el-form-item label="商业化类型" prop="bustypeIdList">
        <el-select
            v-model="searchForm.bustypeIds"
            style="width: 150px"
            v-model="searchForm.bustypeIdList"
            style="width: 180px"
            placeholder="商业化类型"
            clearable
            multiple
            collapse-tags
            @change="search"
        >
          <el-option
              v-for="item in cateList1"
              v-for="item in cateList.filter(item=>{return item.type==1})"
              :key="item.id"
              :value="item.id"
              :label="item.name"
@@ -43,14 +45,15 @@
      <el-form-item label="擅长领域" prop="fieldIdList">
        <el-select
            v-model="searchForm.fieldIdList"
            style="width: 150px"
            style="width: 300px"
            placeholder="擅长领域"
            clearable
            collapse-tags
            multiple
            @change="search"
        >
          <el-option
              v-for="item in cateList2"
              v-for="item in cateList.filter(item=>{return item.type==2})"
              :key="item.id"
              :value="item.id"
              :label="item.name"
@@ -60,31 +63,31 @@
      <el-form-item label="老师等级" prop="levelId">
        <el-select
            v-model="searchForm.levelId"
            style="width: 150px"
            style="width: 180px"
            placeholder="老师等级"
            clearable
            @change="search"
        >
          <el-option
              v-for="item in cateList3"
              v-for="item in cateList.filter(item=>{return item.type==3})"
              :key="item.id"
              :value="item.id"
              :label="item.name"
          ></el-option>
        </el-select>
      </el-form-item>
        <el-form-item label="状态" prop="status">
          <el-select
              v-model="searchForm.status"
              placeholder="状态"
              clearable
              style="width: 150px"
              style="width: 180px"
              @change="search"
          >
            <el-option :key="0" :value="0" label="启用"></el-option>
            <el-option :key="1" :value="1" label="禁用"></el-option>
          </el-select>
        </el-form-item>
      </el-form-item>
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
@@ -107,8 +110,8 @@
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column  prop="imgurl" label="图片" min-width="100px">
          <template slot-scope="{row}">
            <el-image v-if="row.fullImgurl" style="width: 50px; height: 50px; margin-right: 10px" :src="row.fullImgurl"
                      :preview-src-list="[row.fullImgurl]">
            <el-image v-if="row.fullImgurl" style="width: 50px; margin-right: 10px" :src="row.fullImgurl"
              :preview-src-list="[row.fullImgurl]">
            </el-image>
          </template>
        </el-table-column>
@@ -122,7 +125,11 @@
        </el-table-column>
        <el-table-column prop="positon" label="岗位" min-width="120px"></el-table-column>
        <el-table-column prop="levelName" label="等级" min-width="100px"></el-table-column>
        <el-table-column prop="jobYear" label="从业年份" min-width="100px"></el-table-column>
        <el-table-column prop="workYears" label="从业年份" min-width="100px">
          <template slot-scope="{row}">
            {{row.workYears}}年
          </template>
        </el-table-column>
        <el-table-column prop="serveNum" label="服务商场" min-width="100px">
          <template slot-scope="{row}">
            <span v-if="row.serveNum">{{row.serveNum}}个</span>
@@ -150,27 +157,31 @@
        <el-table-column prop="fieldNames" label="擅长领域" min-width="200px">
          <template slot-scope="{row}">
            <div v-if="row.fieldList && row.fieldList.length">
              <div style="display:inline-block;" v-for="(item,index) in row.fieldList">{{item.name||''}} <span v-if="index < row.fieldList.length-1" style="display:inline-block;padding: 0px 3px;">/</span></div>
              <div style="width: 190px; display: -webkit-box; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;">
                <template v-for="(item,index) in row.fieldList">{{item.name||''}} <template v-if="index < row.fieldList.length-1">/</template></template>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="状态">
        <el-table-column prop="fee" label="费用标准(元/周)" min-width="130px"></el-table-column>
        <el-table-column prop="updateUserName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="updateTime" label="最近操作时间" min-width="150px"></el-table-column>
        <el-table-column label="状态" fixed="right">
          <template slot-scope="{row}">
            <el-switch @change="changeStatus($event, row)" v-model="row.status" active-color="#13ce66"
            inactive-color="#ff4949" :active-value="0" :inactive-value="1">
                       inactive-color="#ff4949" :active-value="0" :inactive-value="1">
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column prop="updateUserName" label="操作人" min-width="100px"></el-table-column>
        <el-table-column prop="updateTime" label="最近操作时间" min-width="150px"></el-table-column>
        <el-table-column
          v-if="containPermissions(['business:member:update', 'business:member:delete'])"
          label="操作"
          min-width="120"
          min-width="180"
          fixed="right"
        >
          <template slot-scope="{row}">
            <el-button type="text" @click="$refs.operaMemberWindow.open('编辑老师', row,searchForm.type)" icon="el-icon-edit" v-permissions="['business:member:update']">编辑</el-button>
            <el-button type="text"   @click="$refs.OperaCasesListWindow.open('查看老师案例【'+row.name+'】', row.id)" icon="el-icon-picture-outline">案例</el-button>
            <el-button type="text" style="color: red" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:member:delete']">删除</el-button>
          </template>
        </el-table-column>
@@ -185,6 +196,7 @@
    <!-- 新建/修改 -->
    <OperaMemberWindow ref="operaMemberWindow" @success="handlePageChange"/>
    <OperaMemberImportWindow ref="OperaMemberImportWindow" @success="handlePageChange" />
    <OperaCasesListWindow ref="OperaCasesListWindow" @success="handlePageChange" />
  </TableLayout>
</template>
@@ -194,11 +206,12 @@
import Pagination from '@/components/common/Pagination'
import OperaMemberWindow from '@/components/business/OperaMemberWindow'
import OperaMemberImportWindow from '@/components/business/OperaMemberImportWindow'
import OperaCasesListWindow from '@/components/business/OperaCasesListWindow'
import { findAll as cateList } from '@/api/business/category'
export default {
  name: 'Category',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaMemberWindow ,OperaMemberImportWindow},
  components: { TableLayout, Pagination, OperaMemberWindow ,OperaMemberImportWindow,OperaCasesListWindow},
  data () {
    return {
      // 搜索
@@ -210,13 +223,10 @@
        levelId:null,
        fieldIdList: [],
        zhanquIds:null,
        bustypeIds:null,
        bustypeIdList:[],
        type: 0
      },
      cateList:[],
      cateList1:[],
      cateList2:[],
      cateList3:[],
      cateList:[]
    }
  },
  created () {
@@ -228,33 +238,80 @@
    })
    this.search()
    cateList({
      type: 0 , //战区
    }).then(res => {
      this.cateList = res
    })
    cateList({
      type: 1 , //商业化
    }).then(res => {
      this.cateList1 = res
    })
    cateList({
      type: 2 , //擅长领用
    }).then(res => {
      this.cateList2 = res
    })
    cateList({
      type: 3 , //等级
    }).then(res => {
      this.cateList3 = res
    })
  },
  methods: {
    deleteById (row, childConfirm = true, call) {
      this.__checkApi()
      let message = `确认删除老师数据吗?`
      if (childConfirm && row.children != null && row.children.length > 0) {
        message = `确认删除老师数据吗?`
      }
      this.$dialog.deleteConfirm(message)
              .then(() => {
                this.isWorking.delete = true
                this.api.deleteById(row[this.configData['field.id']])
                        .then(() => {
                          this.__afterDelete()
                          if (call) {
                            call()
                          }
                        })
                        .catch(e => {
                          this.$tip.apiFailed(e)
                        })
                        .finally(() => {
                          this.isWorking.delete = false
                        })
              })
              .catch(() => {})
    },
    deleteByIdInBatch (childConfirm = true, call) {
      this.__checkApi()
      if (this.tableData.selectedRows.length === 0) {
        this.$tip.warning('请至少选择一条数据')
        return
      }
      let message = `确认删除老师数据吗?`
      if (childConfirm) {
        const containChildrenRows = []
        for (const row of this.tableData.selectedRows) {
          if (row.children != null && row.children.length > 0) {
            containChildrenRows.push(row[this.configData['field.main']])
          }
        }
        if (containChildrenRows.length > 0) {
          message = `确认删除老师数据吗?`
        }
      }
      this.$dialog.deleteConfirm(message)
              .then(() => {
                this.isWorking.delete = true
                this.api.deleteByIdInBatch(this.tableData.selectedRows.map(row => row[this.configData['field.id']]).join(','))
                        .then(() => {
                          this.__afterDelete(this.tableData.selectedRows.length)
                          if (call) {
                            call()
                          }
                        })
                        .catch(e => {
                          this.$tip.apiFailed(e)
                        })
                        .finally(() => {
                          this.isWorking.delete = false
                        })
              })
              .catch(() => {})
    },
    changeStatus (e, row) {
      this.working = true
      this.api.updateStatus({ id: row.id, status: e })
        .then(res => {
          this.$tip.apiSuccess(res || '操作成功')
          this.search()
          this.handlePageChange()
        })
        .catch(e => {
          this.$tip.apiFailed(e)