MrShi
6 天以前 97158794d69fd2beee1bf27577aa7cadea8d847d
admin/src/views/business/cases.vue
@@ -18,7 +18,7 @@
              v-for="item in memberList"
              :key="item.id"
              :value="item.id"
              :label="item.name"
              :label="item.name+' 【'+item.code+'】'"
          ></el-option>
        </el-select>
      </el-form-item>
@@ -54,7 +54,7 @@
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="name" label="案例标题" min-width="100px"></el-table-column>
        <el-table-column prop="name" label="案例标题" min-width="200px"></el-table-column>
        <el-table-column  prop="icon" label="排行榜图集" min-width="220px">
          <template slot-scope="{row}">
            <div style="display: flex; flex-wrap: wrap;width: 200px;"  v-if="row.fileList && row.fileList.length">
@@ -66,10 +66,14 @@
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="memberName" label="老师" min-width="120px"></el-table-column>
        <el-table-column prop="memberName" label="老师" min-width="220px">
          <template slot-scope="{row}">
            <span class="orange" style="margin-right: 10px"> {{row.memberCode}}</span> <span>{{row.memberName||''}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="startDate" label="开始日期" min-width="140px"></el-table-column>
        <el-table-column prop="endDate" label="结束日期" min-width="140px"></el-table-column>
        <el-table-column prop="detail" label="案例描述" min-width="230px" show-overflow-tooltip></el-table-column>
        <el-table-column prop="detail" label="案例描述" min-width="230px" ></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">
@@ -140,6 +144,68 @@
    })
  },
  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 })