index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <div>
  3. <el-card class="content">
  4. <!-- 标题区域 -->
  5. <el-row class="card_title">项目管理</el-row>
  6. <!-- 筛选区域 -->
  7. <el-row :gutter="25" class="card_search">
  8. <el-col :span="4">
  9. 姓名:
  10. <el-input
  11. style="width: 180px"
  12. placeholder="请输入姓名"
  13. clearable
  14. v-model="searchName"
  15. ></el-input>
  16. </el-col>
  17. <el-col :span="4">
  18. 单位名称:
  19. <el-input
  20. style="width: 150px"
  21. placeholder="请输入单位名称"
  22. clearable
  23. v-model="searchAddress"
  24. ></el-input>
  25. </el-col>
  26. <el-col :span="4">
  27. 所属行业:
  28. <el-select
  29. style="width: 150px"
  30. clearable
  31. v-model="searchIndustry"
  32. placeholder="请选择所属行业"
  33. >
  34. <el-option
  35. v-for="(item, index) in industryOptions"
  36. :key="index"
  37. :label="item"
  38. :value="item"
  39. />
  40. </el-select>
  41. </el-col>
  42. <el-col :span="4">
  43. 状态:
  44. <el-select
  45. style="width: 150px"
  46. clearable
  47. v-model="searchType"
  48. placeholder="请选择状态"
  49. >
  50. <el-option
  51. v-for="(item, index) in typeOptions"
  52. :key="index"
  53. :label="item.label"
  54. :value="item.value"
  55. />
  56. </el-select>
  57. </el-col>
  58. <el-col :span="4">
  59. 提交时间:
  60. <el-date-picker
  61. style="width: 150px"
  62. type="date"
  63. placeholder="请选择提交时间"
  64. value-format="YYYY-MM-DD"
  65. v-model="searchTime"
  66. />
  67. </el-col>
  68. <el-col :span="4">
  69. <el-button type="primary" @click="getData">
  70. <el-icon><Search /></el-icon>
  71. <span> 查询</span>
  72. </el-button>
  73. <el-button type="success" @click="handleReset">
  74. <el-icon><Refresh /></el-icon>
  75. <span> 重置</span>
  76. </el-button>
  77. </el-col>
  78. </el-row>
  79. <!-- 导出表单按钮区域 -->
  80. <el-row class="card_button">
  81. <el-button type="primary" @click="hanleExportForm">
  82. <el-icon><Download /></el-icon>
  83. <span> 导出表单</span>
  84. </el-button>
  85. </el-row>
  86. <!-- 表格区域 -->
  87. <el-table
  88. stripe
  89. height="481"
  90. ref="multipleTable"
  91. :data="tableData"
  92. style="width: 100%"
  93. :header-cell-style="{ backgroundColor: '#F0F3F7' }"
  94. @select="handleChooseList"
  95. @select-all="handleChooseList"
  96. >
  97. <el-table-column type="selection" width="55" />
  98. <el-table-column width="100" align="center" prop="name" label="姓名" />
  99. <el-table-column
  100. width="150"
  101. align="center"
  102. prop="phone"
  103. label="手机号码"
  104. />
  105. <el-table-column
  106. width="200"
  107. align="center"
  108. show-overflow-tooltip
  109. prop="company"
  110. label="单位名称"
  111. />
  112. <el-table-column
  113. width="200"
  114. align="center"
  115. show-overflow-tooltip
  116. prop="customerName"
  117. label="客户名称"
  118. />
  119. <el-table-column
  120. width="150"
  121. align="center"
  122. show-overflow-tooltip
  123. prop="entryName"
  124. label="项目名称"
  125. />
  126. <el-table-column
  127. width="120"
  128. align="center"
  129. show-overflow-tooltip
  130. prop="projectAmount"
  131. label="项目金额"
  132. />
  133. <el-table-column
  134. width="110"
  135. align="center"
  136. prop="tenderTime"
  137. label="预计投标时间"
  138. />
  139. <el-table-column
  140. width="100"
  141. align="center"
  142. prop="trade"
  143. label="所属行业"
  144. />
  145. <el-table-column width="200" align="center" label="产品类型">
  146. <template #default="{ row }">
  147. <el-tag
  148. style="margin: 0 5px 5px 0"
  149. v-for="(item, index) in row.product.split(',')"
  150. :key="index"
  151. >
  152. {{ item }}
  153. </el-tag>
  154. </template>
  155. </el-table-column>
  156. <el-table-column width="80" align="center" label="状态">
  157. <template #default="{ row }">
  158. <div class="blue" v-if="row.status == 1">进行中</div>
  159. <div class="red" v-else>已关闭</div>
  160. </template>
  161. </el-table-column>
  162. <el-table-column
  163. width="200"
  164. align="center"
  165. show-overflow-tooltip
  166. prop="content"
  167. label="项目基本情况"
  168. />
  169. <el-table-column
  170. width="200"
  171. align="center"
  172. prop="reportingTime"
  173. label="提交时间"
  174. />
  175. <el-table-column fixed="right" width="250" align="center" label="操作">
  176. <template #default="{ row }">
  177. <el-button type="success" plain @click="handleCheckDetail(row)">
  178. 详情
  179. </el-button>
  180. <el-button
  181. :disabled="row.status == 0"
  182. type="warning"
  183. plain
  184. @click="handleClose(row)"
  185. >
  186. 关闭
  187. </el-button>
  188. <el-button
  189. v-if="store.getters.userInfo.adminType == 1"
  190. type="danger"
  191. plain
  192. @click="handleDelete(row)"
  193. >
  194. 删除
  195. </el-button>
  196. </template>
  197. </el-table-column>
  198. </el-table>
  199. <!-- 分页器区域 -->
  200. <el-row class="card_pagination">
  201. <el-pagination
  202. v-model:current-page="currentPage"
  203. v-model:page-size="pageSize"
  204. :page-sizes="[8, 20, 50, 100]"
  205. layout="total, sizes, prev, pager, next, jumper"
  206. :total="total"
  207. @size-change="handleSizeChange"
  208. @current-change="handleCurrentChange"
  209. />
  210. </el-row>
  211. </el-card>
  212. <!-- 详情弹窗区域 -->
  213. <el-dialog
  214. v-model="dialogVisible"
  215. title="详情"
  216. width="40%"
  217. top="5vh"
  218. :close-on-click-modal="false"
  219. >
  220. <div class="dialog_box">
  221. <div class="dialog_item">
  222. <span>姓名:</span>
  223. {{ dialogInfo.name }}
  224. </div>
  225. <div class="dialog_item">
  226. <span>手机号码:</span>
  227. {{ dialogInfo.phone }}
  228. </div>
  229. <div class="dialog_item">
  230. <span>单位名称:</span>
  231. {{ dialogInfo.company }}
  232. </div>
  233. <div class="dialog_item">
  234. <span>客户名称:</span>
  235. {{ dialogInfo.customerName }}
  236. </div>
  237. <div class="dialog_item">
  238. <span>项目名称:</span>
  239. {{ dialogInfo.entryName }}
  240. </div>
  241. <div class="dialog_item">
  242. <span>预计投标时间:</span>
  243. {{ dialogInfo.tenderTime }}
  244. </div>
  245. <div class="dialog_item">
  246. <span>所属行业:</span>
  247. {{ dialogInfo.trade }}
  248. </div>
  249. <div class="dialog_item">
  250. <span>产品类型:</span>
  251. <el-tag
  252. style="margin: 0 5px 5px 0"
  253. v-for="(item, index) in dialogInfo.product.split(',')"
  254. :key="index"
  255. >
  256. {{ item }}
  257. </el-tag>
  258. </div>
  259. <div class="dialog_item">
  260. <span>状态:</span>
  261. <span class="blue" v-if="dialogInfo.status == 1">进行中</span>
  262. <span class="red" v-else>已关闭</span>
  263. </div>
  264. <div class="dialog_item">
  265. <span>提交时间:</span>
  266. {{ dialogInfo.reportingTime }}
  267. </div>
  268. <div class="dialog_item">
  269. <span>项目基本情况:</span>
  270. <div>
  271. {{ dialogInfo.content }}
  272. </div>
  273. </div>
  274. </div>
  275. </el-dialog>
  276. </div>
  277. </template>
  278. <script setup>
  279. import { onMounted, ref } from 'vue'
  280. import { useStore } from 'vuex'
  281. import { ElMessage, ElMessageBox } from 'element-plus'
  282. import {
  283. getProjectList,
  284. deleteProjectList,
  285. closeProjectList
  286. } from '@/api/project'
  287. onMounted(() => {
  288. getData()
  289. })
  290. // 所属行业选择框数组
  291. const industryOptions = [
  292. '政府',
  293. '教育',
  294. '医疗',
  295. '企业',
  296. '公检法',
  297. '交通',
  298. '分销&SMB',
  299. '其他'
  300. ]
  301. // 状态选择框数组
  302. const typeOptions = [
  303. {
  304. label: '进行中',
  305. value: 1
  306. },
  307. {
  308. label: '已关闭',
  309. value: 0
  310. }
  311. ]
  312. // 获取项目管理列表
  313. const getData = async () => {
  314. const res = await getProjectList({
  315. name: searchName.value,
  316. company: searchAddress.value,
  317. trade: searchIndustry.value,
  318. status: searchType.value,
  319. reportingTime: searchTime.value,
  320. currPage: currentPage.value,
  321. pageSize: pageSize.value
  322. })
  323. // console.log(res)
  324. tableData.value = res.list
  325. total.value = res.totalCount
  326. currentPage.value = res.currPage
  327. }
  328. // 筛选区域绑定数据
  329. const searchName = ref('')
  330. const searchAddress = ref('')
  331. const searchIndustry = ref('')
  332. const searchType = ref('')
  333. const searchTime = ref('')
  334. // 表单元素DOM标识
  335. const multipleTable = ref(null)
  336. // 仓库
  337. const store = useStore()
  338. // 勾选的数据id
  339. const downIds = ref([])
  340. // 控制详情弹窗显示隐藏
  341. const dialogVisible = ref(false)
  342. // 控制详情弹窗数据
  343. const dialogInfo = ref({})
  344. // 一共多少条
  345. const total = ref(0)
  346. // 分页器当前页
  347. const currentPage = ref(1)
  348. // 每页条数
  349. const pageSize = ref(8)
  350. // 表格数据
  351. const tableData = ref([])
  352. // 点击勾选框回调
  353. const handleChooseList = (list) => {
  354. downIds.value = []
  355. if (list.length !== 0) {
  356. list.forEach((item) => {
  357. downIds.value.push(item.id)
  358. })
  359. }
  360. }
  361. // 导出表单按钮回调
  362. const hanleExportForm = () => {
  363. const id = downIds.value.join(',')
  364. ElMessageBox.confirm('确定导出表单吗?', '提示', {
  365. confirmButtonText: '确定',
  366. cancelButtonText: '取消',
  367. type: 'warning'
  368. })
  369. .then(() => {
  370. window.location.href = `/reporting/informationReporting/download?name=${searchName.value}&trade=${searchIndustry.value}&company=${searchAddress.value}&reportingTime=${searchTime.value}&status=${searchType.value}&ids=${id}`
  371. multipleTable.value.clearSelection()
  372. })
  373. .catch(() => {
  374. ElMessage.info('取消')
  375. multipleTable.value.clearSelection()
  376. })
  377. downIds.value = []
  378. }
  379. // 点击详情按钮回调
  380. const handleCheckDetail = (row) => {
  381. dialogInfo.value = {}
  382. dialogVisible.value = true
  383. dialogInfo.value = row
  384. }
  385. // 点击关闭按钮回调
  386. const handleClose = (row) => {
  387. ElMessageBox.confirm(`确定关闭 ${row.entryName} 吗?`, '提示', {
  388. confirmButtonText: '确定',
  389. cancelButtonText: '取消',
  390. type: 'warning'
  391. })
  392. .then(async () => {
  393. const res = await closeProjectList({
  394. name: store.getters.userInfo.name,
  395. id: store.getters.userInfo.id,
  396. itemId: row.id
  397. })
  398. // console.log(res)
  399. if (res == null) {
  400. ElMessage.success('关闭成功')
  401. getData()
  402. }
  403. })
  404. .catch(() => {
  405. ElMessage.info('已取消')
  406. })
  407. }
  408. // 点击删除按钮回调
  409. const handleDelete = (row) => {
  410. ElMessageBox.confirm(`确定删除 ${row.entryName} 吗?`, '提示', {
  411. confirmButtonText: '确定',
  412. cancelButtonText: '取消',
  413. type: 'warning'
  414. })
  415. .then(async () => {
  416. const res = await deleteProjectList({
  417. name: store.getters.userInfo.name,
  418. id: store.getters.userInfo.id,
  419. ids: [row.id]
  420. })
  421. // console.log(res)
  422. if (res == null) {
  423. ElMessage.success('删除成功')
  424. getData()
  425. }
  426. })
  427. .catch(() => {
  428. ElMessage.info('已取消')
  429. })
  430. }
  431. // 改变每页条数回调
  432. const handleSizeChange = (val) => {
  433. pageSize.value = val
  434. getData()
  435. }
  436. // 改变当前页回调
  437. const handleCurrentChange = (val) => {
  438. currentPage.value = val
  439. getData()
  440. }
  441. // 重置按钮回调
  442. const handleReset = () => {
  443. searchName.value = ''
  444. searchAddress.value = ''
  445. searchIndustry.value = ''
  446. searchType.value = ''
  447. searchTime.value = ''
  448. getData()
  449. }
  450. </script>
  451. <style lang="scss" scoped>
  452. .content {
  453. width: 1650px;
  454. height: 782px;
  455. ::v-deep .el-card__body {
  456. padding: 0 27px;
  457. }
  458. .card_title {
  459. line-height: 58px;
  460. font-size: 17px;
  461. font-weight: bold;
  462. border-bottom: 2px solid #d9d9d9;
  463. }
  464. .card_search {
  465. line-height: 85px;
  466. font-size: 13px;
  467. font-weight: bold;
  468. }
  469. .card_button {
  470. height: 53px;
  471. }
  472. .blue {
  473. color: #1e7dfb;
  474. }
  475. .red {
  476. color: #f56c6c;
  477. }
  478. .card_pagination {
  479. float: right;
  480. line-height: 96px;
  481. }
  482. }
  483. .dialog_box {
  484. height: 630px;
  485. .dialog_item {
  486. margin-bottom: 10px;
  487. height: 35px;
  488. color: #4d4d4d;
  489. font-size: 15px;
  490. .blue {
  491. color: #1e7dfb;
  492. }
  493. .red {
  494. color: #f56c6c;
  495. }
  496. span {
  497. font-weight: bold;
  498. }
  499. div {
  500. height: 160px;
  501. margin-top: 10px;
  502. overflow-y: auto;
  503. }
  504. }
  505. }
  506. ::v-deep .el-button--primary {
  507. background-color: #0061ff;
  508. }
  509. ::v-deep .el-dialog__header {
  510. margin: 0;
  511. font-weight: bold;
  512. background-color: #edf1f5;
  513. }
  514. ::v-deep
  515. .el-table--striped
  516. .el-table__body
  517. tr.el-table__row--striped.el-table__row--striped.el-table__row--striped
  518. td {
  519. background-color: #f0f3f7;
  520. }
  521. </style>