projectItem.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <div>
  3. <!-- 选择项目 -->
  4. <el-dialog
  5. title="选择项目"
  6. :visible.sync="showProjectItem"
  7. width="800px"
  8. append-to-body
  9. >
  10. <!-- 查询表单区域 -->
  11. <el-form :model="projectQueryParams" ref="queryForm" inline>
  12. <el-form-item label="项目名称" prop="projectName">
  13. <el-input
  14. v-model.trim="projectQueryParams.projectName"
  15. placeholder="请输入项目名称"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <!-- 可继续扩展其他查询表单项目,比如项目编号、负责人等 -->
  21. <el-form-item>
  22. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  23. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  24. </el-form-item>
  25. </el-form>
  26. <el-table
  27. class="tableWrapper"
  28. @row-click="clickRow"
  29. ref="dataTable"
  30. :data="poolList"
  31. @selection-change="handleSelectionChange"
  32. >
  33. <el-table-column type="selection" width="55" align="center" />
  34. <!-- <el-table-column label="主键id" align="center" prop="id" /> -->
  35. <el-table-column label="项目名称" width="150" align="center" prop="projectName">
  36. <template slot-scope="scope">
  37. <div :title="scope.row.projectName">
  38. {{ scope.row.projectName }}
  39. </div>
  40. </template>
  41. </el-table-column>
  42. <el-table-column
  43. label="渠道"
  44. align="center"
  45. prop="tProjectChannel.channelName"
  46. >
  47. <template slot-scope="scope">
  48. <div :title="scope.row.tProjectChannel.channelName" v-if="scope.row.tProjectChannel && scope.row.tProjectChannel.channelName">
  49. {{ scope.row.tProjectChannel.channelName }}
  50. </div>
  51. <div v-else-if="scope.row.channel=='1'" >
  52. 直接触达
  53. </div>
  54. <div v-else="scope.row.channel=='2'" >
  55. 内部推荐
  56. </div>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. label="所属组别"
  61. align="center"
  62. prop="tProjectChannel.channelGroup"
  63. >
  64. <template slot-scope="scope">
  65. <dict-tag
  66. v-if="scope.row.tProjectChannel && scope.row.tProjectChannel.channelGroup"
  67. :options="dict.type.project_group"
  68. :value="scope.row.tProjectChannel.channelGroup"
  69. />
  70. </template>
  71. </el-table-column>
  72. <!-- <el-table-column label="项目编号" align="center" prop="projectCode" /> -->
  73. <el-table-column label="项目负责人" align="center" prop="investHead" />
  74. <el-table-column label="项目阶段" align="center" prop="projectStage">
  75. <template slot-scope="scope">
  76. <dict-tag
  77. :options="dict.type.project_stage"
  78. :value="scope.row.projectStage"
  79. />
  80. </template>
  81. </el-table-column>
  82. <!-- <el-table-column label="项目状态" align="center" prop="projectState">
  83. <template slot-scope="scope">
  84. <dict-tag
  85. :options="dict.type.project_state"
  86. :value="scope.row.projectState"
  87. />
  88. </template>
  89. </el-table-column>-->
  90. <el-table-column label="项目机会状态" align="center" prop="projectStatus">
  91. <template slot-scope="scope">
  92. <!-- 定义状态文本映射对象 -->
  93. <el-tag
  94. :type="{
  95. 0: 'success',
  96. 1: 'danger',
  97. 2: 'warning'
  98. }[scope.row.projectStatus] || 'info'"
  99. >
  100. {{ {
  101. 0: '正常',
  102. 1: '终止',
  103. 2: '观望'
  104. }[scope.row.projectStatus] || '未知状态' }}
  105. </el-tag>
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. label="已发起立项申请"
  110. align="center"
  111. prop="approvalFlag"
  112. >
  113. <template slot-scope="scope">
  114. <div>
  115. {{ scope.row.approvalFlag === "1" ? "是" : "否" }}
  116. </div>
  117. </template>
  118. </el-table-column>
  119. <el-table-column
  120. label="已发起投决申请"
  121. align="center"
  122. prop="decisionFlag"
  123. >
  124. <template slot-scope="scope">
  125. <div>
  126. {{ scope.row.decisionFlag === "1" ? "是" : "否" }}
  127. </div>
  128. </template>
  129. </el-table-column>
  130. <el-table-column
  131. label="已发起尽调申请"
  132. align="center"
  133. prop="investigateFlag"
  134. >
  135. <template slot-scope="scope">
  136. <div>
  137. {{ scope.row.investigateFlag === "1" ? "是" : "否" }}
  138. </div>
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. <pagination
  143. v-show="projectItemTotal > 0"
  144. :total="projectItemTotal"
  145. :page.sync="projectQueryParams.pageNum"
  146. :limit.sync="projectQueryParams.pageSize"
  147. @pagination="getList"
  148. />
  149. <div slot="footer" class="dialog-footer">
  150. <el-button type="primary" @click="submit" v-preventReClick
  151. >确 定</el-button
  152. >
  153. <el-button @click="cancel">取 消</el-button>
  154. </div>
  155. </el-dialog>
  156. </div>
  157. </template>
  158. <script>
  159. import {
  160. applicableListTermination,
  161. } from "@/api/project/termination/pool";
  162. import { mapGetters } from "vuex";
  163. export default {
  164. props: {
  165. // showProjectItem: {
  166. // type: Boolean,
  167. // default: false,
  168. // },
  169. },
  170. dicts: ["project_group", "project_stage", "project_state"],
  171. data() {
  172. return {
  173. showProjectItem: false,
  174. // 总条数
  175. projectItemTotal: 0,
  176. poolList: [],
  177. projectQueryParams: {
  178. pageNum: 1,
  179. pageSize: 10,
  180. orderByColumn: "createTime",
  181. isAsc: "desc",
  182. projectStatus:null,
  183. projectName:null
  184. },
  185. // 选中数组
  186. ids: [],
  187. idsName: [],
  188. // 非单个禁用
  189. single: true,
  190. // 非多个禁用
  191. multiple: true,
  192. isWatch:false,
  193. };
  194. },
  195. computed: {
  196. ...mapGetters(["user"]),
  197. },
  198. mounted() {
  199. this.getList();
  200. },
  201. methods: {
  202. // 刷新项目列表的方法
  203. refreshProjectList(isWatch) {
  204. // 清空现有列表
  205. this.poolList = [];
  206. this.projectItemTotal=0;
  207. // 重新请求接口获取最新数据
  208. this.getList(isWatch);
  209. this.isWatch=isWatch;
  210. },
  211. clickRow(row) {
  212. this.$refs.dataTable.toggleRowSelection(row);
  213. },
  214. // 多选框选中数据
  215. handleSelectionChange(selection) {
  216. if (selection.length > 1) {
  217. //移除上一次选中行数据
  218. selection.shift();
  219. //修改选中图标为未选中状态
  220. this.$refs.dataTable.clearSelection();
  221. //将当前选中行改为选中状态
  222. this.$refs.dataTable.toggleRowSelection(selection[0]);
  223. }
  224. this.ids = selection;
  225. },
  226. /** 查询项目池列表 */
  227. getList(isWatch) {
  228. if(isWatch){
  229. this.projectQueryParams.projectStatus=2;
  230. }else {
  231. this.projectQueryParams.projectStatus=0;
  232. }
  233. applicableListTermination(this.projectQueryParams).then((response) => {
  234. this.poolList = response.rows;
  235. this.projectItemTotal = response.total;
  236. });
  237. },
  238. submit() {
  239. // console.log("确定", this.ids);
  240. const row = this.ids[0];
  241. if (row.delFlag == "1") {
  242. this.$message({
  243. message: "项目已终止",
  244. duration: 1500,
  245. type: "error",
  246. });
  247. }
  248. if (row.investHead === this.user.nickName){
  249. if (row.delFlag == "0") {
  250. this.$emit("getProjectInfo", this.ids);
  251. this.showProjectItem = false;
  252. } else {
  253. this.$message({
  254. message: "您已发起终止申请,无需重复操作",
  255. duration: 1500,
  256. type: "warning",
  257. });
  258. }
  259. }else {
  260. this.$message({
  261. message: "无权限",
  262. duration: 1500,
  263. type: "error",
  264. });
  265. }
  266. },
  267. cancel() {
  268. this.showProjectItem = false;
  269. },
  270. /** 搜索按钮操作 */
  271. handleQuery() {
  272. this.projectQueryParams.pageNum = 1;
  273. this.getList(this.isWatch);
  274. },
  275. /** 重置按钮操作 */
  276. resetQuery() {
  277. this.resetForm("queryForm");
  278. this.handleQuery();
  279. },
  280. },
  281. };
  282. </script>