| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <template>
- <div>
- <!-- 选择项目 -->
- <el-dialog
- title="选择项目"
- :visible.sync="showProjectItem"
- width="800px"
- append-to-body
- >
- <!-- 查询表单区域 -->
- <el-form :model="projectQueryParams" ref="queryForm" inline>
- <el-form-item label="项目名称" prop="projectName">
- <el-input
- v-model.trim="projectQueryParams.projectName"
- placeholder="请输入项目名称"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <!-- 可继续扩展其他查询表单项目,比如项目编号、负责人等 -->
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-table
- class="tableWrapper"
- @row-click="clickRow"
- ref="dataTable"
- :data="poolList"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="55" align="center" />
- <!-- <el-table-column label="主键id" align="center" prop="id" /> -->
- <el-table-column label="项目名称" width="150" align="center" prop="projectName">
- <template slot-scope="scope">
- <div :title="scope.row.projectName">
- {{ scope.row.projectName }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="渠道"
- align="center"
- prop="tProjectChannel.channelName"
- >
- <template slot-scope="scope">
- <div :title="scope.row.tProjectChannel.channelName" v-if="scope.row.tProjectChannel && scope.row.tProjectChannel.channelName">
- {{ scope.row.tProjectChannel.channelName }}
- </div>
- <div v-else>无</div>
- </template>
- </el-table-column>
- <el-table-column
- label="所属组别"
- align="center"
- prop="tProjectChannel.channelGroup"
- >
- <template slot-scope="scope">
- <dict-tag
- v-if="scope.row.tProjectChannel && scope.row.tProjectChannel.channelGroup"
- :options="dict.type.project_group"
- :value="scope.row.tProjectChannel.channelGroup"
- />
- </template>
- </el-table-column>
- <!-- <el-table-column label="项目编号" align="center" prop="projectCode" /> -->
- <el-table-column label="项目负责人" align="center" prop="investHead" />
- <el-table-column label="项目阶段" align="center" prop="projectStage">
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.project_stage"
- :value="scope.row.projectStage"
- />
- </template>
- </el-table-column>
- <!-- <el-table-column label="项目状态" align="center" prop="projectState">
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.project_state"
- :value="scope.row.projectState"
- />
- </template>
- </el-table-column>-->
- <el-table-column label="项目机会状态" align="center" prop="projectStatus">
- <template slot-scope="scope">
- <!-- 定义状态文本映射对象 -->
- <el-tag
- :type="{
- 0: 'success',
- 1: 'danger',
- 2: 'warning'
- }[scope.row.projectStatus] || 'info'"
- >
- {{ {
- 0: '正常',
- 1: '终止',
- 2: '观望'
- }[scope.row.projectStatus] || '未知状态' }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column
- label="已发起投决申请"
- align="center"
- prop="decisionFlag"
- >
- <template slot-scope="scope">
- <div>
- {{ scope.row.decisionFlag === "1" ? "是" : "否" }}
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="projectItemTotal > 0"
- :total="projectItemTotal"
- :page.sync="projectQueryParams.pageNum"
- :limit.sync="projectQueryParams.pageSize"
- @pagination="getList"
- />
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submit" v-preventReClick
- >确 定</el-button
- >
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { applicableListDecision } from "@/api/project/decision/pool";
- import { mapGetters } from "vuex";
- export default {
- props: {
- // showProjectItem: {
- // type: Boolean,
- // default: false,
- // },
- },
- dicts: ["project_group", "project_stage", "project_state"],
- data() {
- return {
- showProjectItem: false,
- // 总条数
- projectItemTotal: 0,
- poolList: [],
- projectQueryParams: {
- pageNum: 1,
- pageSize: 10,
- orderByColumn: "createTime",
- isAsc: "desc",
- projectStatus:null,
- projectName:null
- },
- // 选中数组
- ids: [],
- idsName: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- isWatch:false,
- };
- },
- computed: {
- ...mapGetters(["user"]),
- },
- mounted() {
- this.getList();
- },
- methods: {
- // 刷新项目列表的方法
- refreshProjectList(isWatch) {
- // 清空现有列表
- this.poolList = [];
- this.projectItemTotal=0;
- // 重新请求接口获取最新数据
- this.getList(isWatch);
- this.isWatch=isWatch;
- },
- clickRow(row) {
- this.$refs.dataTable.toggleRowSelection(row);
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- if (selection.length > 1) {
- //移除上一次选中行数据
- selection.shift();
- //修改选中图标为未选中状态
- this.$refs.dataTable.clearSelection();
- //将当前选中行改为选中状态
- this.$refs.dataTable.toggleRowSelection(selection[0]);
- }
- this.ids = selection;
- },
- /** 查询项目池列表 */
- getList(isWatch) {
- if(isWatch){
- this.projectQueryParams.projectStatus=2;
- }else {
- this.projectQueryParams.projectStatus=0;
- }
- applicableListDecision(this.projectQueryParams).then((response) => {
- this.poolList = response.rows;
- this.projectItemTotal = response.total;
- });
- },
- submit() {
- // console.log("确定", this.ids);
- const row = this.ids[0];
- if (row.delFlag == "1") {
- this.$message({
- message: "项目已终止",
- duration: 1500,
- type: "error",
- });
- }
- if (row.investHead === this.user.nickName){
- if (row.decisionFlag == "0") {
- this.$emit("getProjectInfo", this.ids);
- this.showProjectItem = false;
- } else {
- this.$message({
- message: "您已发起投决申请,无需重复操作",
- duration: 1500,
- type: "warning",
- });
- }
- }else {
- this.$message({
- message: "无权限",
- duration: 1500,
- type: "error",
- });
- }
- },
- cancel() {
- this.showProjectItem = false;
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.projectQueryParams.pageNum = 1;
- this.getList(this.isWatch);
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- },
- };
- </script>
|