• wangxl's avatar
    2222 · e344c087
    wangxl authored
    e344c087
index.vue 16.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
<template>
  <div class="app-content page-common-layout">
    <div class="page-layout">
      <div class="page-head">
        <a-tabs :activeKey="tabsActive" @tabClick="tabclick">
          <a-tab-pane key="1" tab="分配到专家"></a-tab-pane>
          <a-tab-pane key="2" tab="分配到专家组" force-render></a-tab-pane>
        </a-tabs>
        <div v-if="tabsActive=='1'">
          <a-form :form="expertForm" :model="expertSearchForm" layout="inline" class="search_form">
            <a-form-item>
              <a-input placeholder="姓名" v-model="expertSearchForm.personName" :maxLength="100" style="width: 150px" />
            </a-form-item>
            <a-form-item>
              <a-input placeholder="工作单位" v-model="expertSearchForm.workUnit" :maxLength="100" style="width: 150px" />
            </a-form-item>
            <a-form-item>
              <para-multi-select-tow v-model="expertSearchForm.spec" @parentChange="parChange" :title="'专业'" :objType="'expert'" :typeId="57" :width="150" />
            </a-form-item>
            <a-form-item>
              <a-button type="primary" icon="search" @click="expertSearch">搜索</a-button>
              <a-button icon="reload" style="margin-left: 10px" @click="expertReset" class="bt-normal">重置</a-button>
            </a-form-item>
          </a-form>
          <a-divider style="height: 1px; background-color: #e8e8e8;" />
          <a-table :dataSource="expertTableData" :scroll="{ y: 200 }" :row-selection="{ selectedRowKeys: expertSelectedRowKeys, onChange: onExpertSelectChange }" :columns="expertColumns" rowKey="id" :pagination="false" :loading="expertLoading">
            <template slot="expertName" slot-scope="record">
              <a @click="expertView(record.id)">{{record.personName}}</a>
              <!-- <a-tag :color="'green'">{{record.personName}}</a-tag> -->
              <!-- <span v-if="record">{{record.personName}}</span> -->
            </template>
            <template slot="assignInfo" slot-scope="record">
              <a-tag v-for="(obj, index) in record.assignInfo" :key="index" color="#87d068">
                <a>{{obj.year+'('+ obj.assignCount+')'}}</a>
              </a-tag>
              <a-tag v-if="!record.assignInfo||record.assignInfo.length==0" color="orange">未分配</a-tag>
            </template>
          </a-table>
        </div>
        <div v-else>
          <a-form :form="groupForm" :model="groupSearchForm" ref="formRef" layout="inline" class="search_form">
            <a-form-item>
              <base-select v-model="groupSearchForm.year" :type="4" :isAll="true" :width="150" :title="'年度'" />
            </a-form-item>
            <a-form-item>
              <base-select v-model="groupSearchForm.batch" :type="10" :isAll="true" :width="150" :title="'批次'" />
            </a-form-item>
            <a-form-item>
              <a-input placeholder="专家组名称" v-model="groupSearchForm.name" :maxLength="100" style="width:150px" />
            </a-form-item>
            <a-form-item>
              <a-button type="primary" icon="search" @click="groupSearch">搜索</a-button>
              <a-button icon="reload" style="margin-left: 10px" @click="groupReset" class="bt-normal">重置</a-button>
            </a-form-item>
          </a-form>
          <a-divider style="height: 1px; background-color: #e8e8e8;" />
          <a-table :dataSource="groupTableData" :scroll="{ y: 200 }" :row-selection="{ selectedRowKeys:groupSelectedRowKeys, onChange: onGroupSelectChange }" :columns="groupColumns" rowKey="id" :pagination="false" :loading="groupLoading">
            <template slot="name" slot-scope="record">
              <a>{{record.name}}</a>
            </template>
            <template slot="assignInfo" slot-scope="record">
              <a-tag v-for="(obj, index) in record.assignInfo" :key="index" color="#87d068">
                <a>{{obj.year+'('+ obj.assignCount+')'}}</a>
              </a-tag>
              <a-tag v-if="!record.assignInfo||record.assignInfo.length==0" color="orange">未分配</a-tag>
            </template>
          </a-table>
        </div>
      </div>
      <div class="page-center">
        <a-form :form="projForm" :model="projSearchForm" layout="inline" class="search_form">
          <a-form-item>
            <a-input placeholder="项目名称" v-model="projSearchForm.projName" :maxLength="100" style="width: 150px" />
          </a-form-item>
          <!-- <a-form-item>
            <a-input placeholder="项目编号" v-model="projSearchForm.projNo" :maxLength="100" style="width: 150px" />
          </a-form-item> -->
          <a-form-item>
            <a-input placeholder="申报单位" v-model="projSearchForm.appUnitName" :maxLength="100" style="width: 150px" />
          </a-form-item>
          <!-- <a-form-item>
            <a-input placeholder="申报人" v-model="projSearchForm.appPersonName" :maxLength="50" style="width: 150px" />
          </a-form-item> -->
          <a-form-item>
            <a-select default-value="" placeholder="分配状态" v-model="projSearchForm.assignState" style="width: 150px" @change="handleAssignChange">
              <a-select-option value="">--请选择状态--</a-select-option>
              <a-select-option value="1">已分配</a-select-option>
              <a-select-option value="0">未分配</a-select-option>
            </a-select>
          </a-form-item>
          <a-form-item>
            <para-multi-select-tow v-model="projSearchForm.knowledgeId" @parentChange="parChange" :title="'学科'" :objType="'project'" :typeId="57" :width="150" />
          </a-form-item>
          <a-form-item>
            <a-button type="primary" icon="search" @click="projSearch">搜索</a-button>
            <a-button icon="reload" style="margin-left: 10px" @click="projReset" class="bt-normal">重置</a-button>
          </a-form-item>
        </a-form>
        <a-divider style="height: 1px; background-color: #e8e8e8;" />
        <a-table :dataSource="projTableData" :scroll="{ y: 250 }" :row-selection="{ selectedRowKeys: projSelectedRowKeys, onChange: onProjSelectChange }" :columns="projColumns" rowKey="id" :pagination="false" :loading="projLoading">
          <template slot="projName" slot-scope="record">
            <a @click="projectView(record.id)">{{record.projName}}</a>
          </template>
          <!-- <template slot="expertEvaluation" slot-scope="record">
          <a-tag v-for="data in record.evaluationList" :key="data.id" :color="evaluationColor(data)" @click="evaluationView(data)">{{evaluationText(data)}}</a-tag>
        </template> -->
          <template slot="assignInfo" slot-scope="record">
            {{record.pageSize}}
            <!-- {{CalculateAvgScore(record)}} -->
          </template>
        </a-table>
      </div>
      <div class="page-bottom">
        <a-button icon="deployment-unit" type="primary" @click="onDistribute">分配</a-button>
      </div>
    </div>
    <a-modal v-model="expertVisibleView" title="查看专家" width="700px" :footer="null" destroyOnClose>
      <expert-view v-model="expertId"></expert-view>
    </a-modal>
    <s-modal title="项目详情" v-model="projectVisibleView" v-if="projectVisibleView">
      <div slot="content">
        <project-view v-model="projectId" @close="() => this.projectVisibleView = false"></project-view>
      </div>
    </s-modal>
    <a-modal v-model="evaluationVisibleView" title="查看专家评价" width="600px" :footer="null" destroyOnClose>
      <evaluation-view v-model="evaluationId" @close="closeWindow"></evaluation-view>
    </a-modal>
  </div>
</template>

<script>
import { isEmptyParams } from '@/views/utils/common'
import paraMultiSelectTow from '@/views/components/common/paraMultiSelectTow'
import projectView from '@/views/report/project/components/projectView'
import expertView from '@/views/expert/components/expertView'
import moment from 'moment'

export default {
  name: "projectAssign",
  components: {
    projectView,
    paraMultiSelectTow,
    expertView,
    evaluationView, 
  },
  data () {
    return {
      tabsActive: '1',
      expertForm: this.$form.createForm(this, { name: "expertSearch" }),
      expertSearchForm: {
        personName: '',
        workUnit: null,
        specParentId: null,
        spec: null,
        expert: 1
      },
      expertTableData: [],
      expertColumns: [
        { title: '姓名', scopedSlots: { customRender: 'expertName' }, align: 'center' },
        { title: "工作单位", dataIndex: "workUnit", align: 'center' },
        { title: "专业", dataIndex: "specName", align: 'center' },
        { title: '分配项目数', scopedSlots: { customRender: 'assignInfo' }, align: 'center', fixed: 'right', width: 300, },
      ],
      expertLoading: false,
      expertSelectedRowKeys: [],
      expertId: null,
      expertVisibleView: false,
      evaluationId: null,
      evaluationVisibleView: false,
      //专家组
      groupForm: this.$form.createForm(this, { name: 'advanced_search' }),
      groupSearchForm: { year: null, batch: null, name: null },
      groupTableData: [],
      groupColumns: [
        { title: '专家组', scopedSlots: { customRender: 'name' }, align: 'center' },
        { title: "年度", dataIndex: "year", align: 'center' },
        { title: "批次", dataIndex: "batch", align: 'center' },
        { title: '分配项目数', scopedSlots: { customRender: 'assignInfo' }, align: 'center', fixed: 'right', width: 300, },
      ],
      groupLoading: false,
      groupSelectedRowKeys: [],
      groupId: null,
      // 项目
      projForm: this.$form.createForm(this, { name: "projSearch" }),
      projSearchForm: {
        auditType: 1,
        projName: null,
        projNo: null,
        appUnitName: null,
        appPersonName: null,
        projClass: null,
        knowledgeParentId: null,
        knowledgeId: null,
        assignState: '',
      },
      projTableData: [],
      projColumns: [
        { title: "项目名称", scopedSlots: { customRender: 'projName' } },
        { title: "申报学科", dataIndex: "knowledgeName", align: 'center' },
        { title: "申报单位", dataIndex: "appUnitName", align: 'center' },
        { title: '分配信息', scopedSlots: { customRender: 'assignInfo' }, align: 'center', fixed: 'right', width: 300, },
      ],
      projLoading: false,
      projSelectedRowKeys: [],
      projectId: null,
      projectVisibleView: false,
    };
  },
  created () {
    this.getAssignExpertList()
    this.getAssignProjectList()
    this.getAssignExpertGroupList()
  },
  methods: {
    moment,
    tabclick (key) {
      this.tabsActive = key
    },
    getAssignExpertList () {
      this.expertLoading = true
      let pars = isEmptyParams(this.expertSearchForm)
      let par = { ...pars, pageIndex: -1, pageSize: 10000 }
      this.$api.expert.getAssignExpertList(par).then(({ data = {} }) => {
        if (data) {
          this.expertTableData = data.dataList
          this.expertLoading = false
          this.expertSelectedRowKeys = []
        }
      }).catch(() => {
        this.expertLoading = false
      })
    },
    expertSearch () {
      this.getAssignExpertList()
    },
    expertReset () {
      this.expertSearchForm = {
        personName: '',
        unitId: null,
        specParentId: null,
        spec: null,
      }
    },
    getAssignExpertGroupList () {
      this.groupLoading = true
      let pars = isEmptyParams(this.groupSearchForm)
      let par = { ...pars, pageIndex: -1, pageSize: 10000 }
      this.$api.expertGroup.getAssignExpertGroupList(par).then(({ data = {} }) => {
        if (data) {
          this.groupTableData = data.dataList
          this.groupLoading = false
          this.groupSelectedRowKeys = []
        }
      }).catch(() => {
        this.groupLoading = false
      })
    },
    groupSearch () {
      this.getAssignExpertGroupList()
    },
    groupReset () {
      this.groupSearchForm = { year: null, batch: null, name: null }
    },
    getAssignProjectList () {
      this.projLoading = true
      let pars = isEmptyParams(this.projSearchForm)
      let par = { ...pars, pageIndex: -1, pageSize: 10000 }
      this.$api.projectAssign.getProjectListByPage(par).then(({ data = {} }) => {
        if (data) {
          this.projTableData = data
          this.projLoading = false
          this.projSelectedRowKeys = []
        }
      }).catch(() => {
        this.projLoading = false
      })
    },
    projSearch () {
      this.getAssignProjectList()
    },
    projReset () {
      this.projSearchForm = {
        projName: null,
        projNo: null,
        appUnitName: null,
        appPersonName: null,
        projClass: null,
        knowledgeParentId: null,
        knowledgeId: null,
        assignState: '',
      }
    },
    parChange (value) {
      if (value.type == 'project') {
        this.projSearchForm.knowledgeParentId = value.value
      } else {
        this.expertSearchForm.specParentId = value.value
      }
    },
    handleAssignChange (value) {
      this.projSearchForm.assignState = value
    },
    onExpertSelectChange (selectedRowKeys) {
      this.expertSelectedRowKeys = selectedRowKeys
    },
    onGroupSelectChange (selectedRowKeys) {
      this.groupSelectedRowKeys = selectedRowKeys
    },
    onProjSelectChange (selectedRowKeys) {
      this.projSelectedRowKeys = selectedRowKeys
    },
    onDistribute () {
      let expertsId = []
      if (this.tabsActive == '1') {
        if (this.expertSelectedRowKeys.length == 0) {
          this.$message.warning('请选择专家!')
          return
        } else {
          expertsId = this.expertSelectedRowKeys
        }
      } else {
        if (this.groupSelectedRowKeys.length == 0) {
          this.$message.warning('请选择专家组!')
          return
        }
        else {
          if (this.groupSelectedRowKeys.length > 1) {
            this.$message.warning('每次只能选择一个专家组!')
            return
          }
          expertsId = this.groupSelectedRowKeys
        }
      }
      if (this.projSelectedRowKeys.length == 0) {
        this.$message.warning('请选择项目!')
        return
      }
      let pars = { type: this.tabsActive, projects: this.projSelectedRowKeys, experts: expertsId }
      this.$api.projectAssign.assignProject(pars).then(({ data = {} }) => {
        if (data) {
          this.$message.success('分配成功!')
          this.getAssignProjectList()
          if (this.tabsActive == '1')
            this.getAssignExpertList()
          else
            this.getAssignExpertGroupList()
        } else
          this.$message.error('分配失败,请稍后再试!')
      }).catch(() => {
        this.$message.error('分配失败,请稍后再试!')
      })
    },
    expertView (value) {
      this.expertVisibleView = true
      this.expertId = value
    },
    projectView (value) {
      this.projectVisibleView = true
      this.projectId = value
    },
    closeWindow () {
      this.evaluationVisibleView = false
      this.getExpertList()
      this.getAssignProjectList()
    },
    evaluationColor (record) {
      if (record.gradeScore != null)
        return '#87d068'
      else
        return '#f50'
    },
    evaluationText (record) {
      if (record.gradeScore != null)
        return record.expertName + ":" + record.gradeScore
      else
        return record.expertName + ":" + '未评分'
    },
    evaluationView (record) {
      this.evaluationId = record.id
      this.evaluationVisibleView = true
    },
    CalculateAvgScore (record) {
      let totalSocre = 0
      record.evaluationList.forEach(e => {
        if (e.gradeScore != null)
          totalSocre += e.gradeScore
        else
          totalSocre += 0
      })
      return parseFloat(totalSocre / record.evaluationList.length).toFixed(2)
    },

  },
};
</script>

<style scoped lang="less">
.page-common-layout {
  width: 100%;
  height: 100%;
  overflow: hidden;

  ::v-deep .ant-table-thead > tr > th {
    padding: 9px 8px !important;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  ::v-deep .ant-table-tbody > tr > td {
    padding: 8px 8px !important;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
.page-layout {
  width: 100%;
  height: 100%;
  overflow: auto;
  border-style: solid;
  border-width: 1px;
  border-color: #e8e8e8;
  border-radius: 4px;
}
.page-head {
  width: 100%;
  height: calc(50% - 25px);
  padding: 5px 5px 0px 5px;
  overflow: auto;
}
.page-center {
  border-style: solid;
  border-width: 1px 0px 0px 0px;
  border-color: #e8e8e8;
  width: 100%;
  height: calc(50% - 20px);
  padding: 0px 5px 0px 5px;
  overflow: auto;
}
.page-bottom {
  border-style: solid;
  border-width: 1px 0px 0px 0px;
  border-color: #e8e8e8;
  width: 100%;
  height: 45px;
  padding: 5px;
  text-align: center;
}
</style>