index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. <template>
  2. <div class="page-container list-container">
  3. <!-- 功能按钮区 -->
  4. <div class="list-btns-container">
  5. <el-dropdown trigger="click">
  6. <el-button type="primary" size="small">
  7. 其它<el-icon class="el-icon--right"><arrow-down /></el-icon>
  8. </el-button>
  9. <template #dropdown>
  10. <el-dropdown-menu>
  11. <el-dropdown-item
  12. icon="Download"
  13. @click="handleExport"
  14. v-hasPermi="['business:housingFundDeclare:export']"
  15. >
  16. 导出</el-dropdown-item
  17. >
  18. <!-- <el-dropdown-item type="warning" size="small" icon="Download" @click="handleArea"
  19. v-hasPermi="['business:deposit:export']"> area</el-dropdown-item> -->
  20. </el-dropdown-menu>
  21. </template>
  22. </el-dropdown>
  23. </div>
  24. <!-- 搜索区 -->
  25. <el-form
  26. class="list-search-container"
  27. size="small"
  28. :model="queryParams"
  29. ref="queryRef"
  30. :inline="true"
  31. label-width="78px"
  32. >
  33. <el-form-item label="客户名称:" prop="companyName">
  34. <el-input
  35. v-model="queryParams.companyName"
  36. placeholder="请输入客户名称"
  37. clearable
  38. style="width: 150px"
  39. @keyup.enter="handleQuery"
  40. />
  41. </el-form-item>
  42. <el-form-item label="所属月:">
  43. <el-date-picker
  44. v-model="currentMonth"
  45. type="month"
  46. format="YYYY年MM月"
  47. :clearable="false"
  48. value-format="YYYY-MM-01"
  49. @change="currentMonthChange"
  50. :disabled-date="disabledDateHandler"
  51. />
  52. </el-form-item>
  53. <el-form-item label="状态:">
  54. <el-select
  55. v-model.trim="queryParams.status"
  56. prop="status"
  57. size="small"
  58. type="text"
  59. placeholder="状态"
  60. :clearable="true"
  61. style="width: 130px"
  62. @clear="clearStatus"
  63. >
  64. <el-option
  65. v-for="item in selectStatus"
  66. :key="item.value"
  67. :label="item.label"
  68. :value="item.value"
  69. />
  70. </el-select>
  71. </el-form-item>
  72. <!-- <el-form-item v-if="tenant.versionId !== '4'" label="是否自己负责:" v-hasPermi="['business:funddeclare:person']">
  73. <el-switch v-model="oneself" @change="handleOneself" />
  74. </el-form-item> -->
  75. <el-form-item>
  76. <el-button type="primary" icon="Search" @click="handleQuery"
  77. >搜索</el-button
  78. >
  79. <el-button icon="operation" @click="moreSearch = true">更多</el-button>
  80. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  81. </el-form-item>
  82. </el-form>
  83. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick" v-if="flag">
  84. <el-tab-pane label="全部" name="first">
  85. </el-tab-pane>
  86. <el-tab-pane label="我的" name="second">
  87. </el-tab-pane>
  88. </el-tabs>
  89. <!-- 列表区 -->
  90. <el-table
  91. v-loading="loading"
  92. :data="orderList"
  93. size="small"
  94. border
  95. height="100%"
  96. @selection-change="handleSelectionChange"
  97. >
  98. <el-table-column type="selection" width="55" align="center" />
  99. <el-table-column
  100. label="客户名称"
  101. min-width="250"
  102. align="center"
  103. prop="companyName"
  104. />
  105. <el-table-column
  106. label="来源"
  107. min-width="100"
  108. align="center"
  109. prop="fromCompanyName"
  110. />
  111. <el-table-column
  112. label="纳税性质"
  113. width="100"
  114. align="center"
  115. prop="taxType"
  116. />
  117. <el-table-column label="人员信息" width="100" align="center" prop="">
  118. <template #default="scope">
  119. <el-button
  120. v-if="scope.row.detail != null"
  121. link
  122. type="primary"
  123. size="small"
  124. @click="showMember(scope.row)"
  125. >查看</el-button
  126. >
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="申报填写" width="100" align="center" prop="">
  130. <template #default="scope">
  131. <el-button
  132. link
  133. type="primary"
  134. size="small"
  135. v-hasPermi="['business:housingFundDeclare:edit']"
  136. @click="fillIn(scope.row)"
  137. >{{
  138. scope.row.detail == null
  139. ? "填写"
  140. : scope.row.detail.status === 1
  141. ? "进行中"
  142. : "已填写"
  143. }}</el-button
  144. >
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="申报附件" width="100" align="center" prop="">
  148. <template #default="scope">
  149. <el-button
  150. size="small"
  151. type="primary"
  152. link
  153. :disabled="scope.row.detail == null || scope.row.detail.status <= 1"
  154. @click="showFiles(scope.row)"
  155. >查看文件</el-button
  156. >
  157. </template>
  158. </el-table-column>
  159. <el-table-column label="状态" width="110" align="center" prop="">
  160. <template #default="scope">
  161. <div :style="getStatusStyle(scope.row)">
  162. {{ getStatusLabel(scope.row) }}
  163. <el-popover placement="top-start" width="250" trigger="hover">
  164. <div style="display: flex; flex-direction: row">
  165. <div
  166. v-for="item in selectStatus"
  167. :key="item.value"
  168. style="display: flex; flex-direction: row; margin-right: 10px"
  169. >
  170. <div
  171. :style="{
  172. backgroundColor: item.color,
  173. width: '14px',
  174. height: '14px',
  175. margin: 'auto',
  176. borderRadius: '50%',
  177. border: item.color === '#fff' ? '1px solid #ddd' : 'none',
  178. }"
  179. />
  180. <div
  181. style="
  182. display: inline-block;
  183. margin-left: 10px;
  184. line-height: 36px;
  185. font-size: 10px;
  186. "
  187. >
  188. {{ item.label }}
  189. </div>
  190. </div>
  191. </div>
  192. <template #reference>
  193. <span
  194. style="
  195. color: #fff;
  196. font-size: 12px;
  197. text-align: center;
  198. display: inline-block;
  199. line-height: 14px;
  200. width: 14px;
  201. height: 14px;
  202. background-color: #ccc;
  203. border-radius: 50%;
  204. "
  205. >?</span
  206. >
  207. </template>
  208. </el-popover>
  209. </div>
  210. </template>
  211. </el-table-column>
  212. <el-table-column
  213. label="执行人"
  214. width="80"
  215. align="center"
  216. prop="serviceName"
  217. />
  218. <el-table-column label="操作" width="80" align="center" prop="">
  219. <template #default="scope">
  220. <el-button
  221. size="small"
  222. type="primary"
  223. link
  224. :disabled="
  225. scope.row.detail == null || scope.row.detail.status !== 3
  226. "
  227. v-hasPermi="['business:housingFundDeclare:verify']"
  228. @click="turnBack(scope.row.detail)"
  229. >退回</el-button
  230. >
  231. </template>
  232. </el-table-column>
  233. </el-table>
  234. <!-- 分页 -->
  235. <pagination
  236. v-show="total > 0"
  237. :total="total"
  238. v-model:page="queryParams.pageNum"
  239. v-model:limit="queryParams.pageSize"
  240. @pagination="getList"
  241. />
  242. <form-dialog ref="formDialogRef" :get-list="getList" />
  243. <view-dialog ref="viewDialogRef" :get-list="getList" />
  244. <member-dialog ref="memeberDialogRef" :get-list="getList" />
  245. <FileListDialog ref="fileListDialogRef" :get-list="getList" />
  246. <!-- 更多搜索弹窗 -->
  247. <el-dialog
  248. title="更多搜索"
  249. v-model="moreSearch"
  250. width="620px"
  251. append-to-body
  252. size="small"
  253. draggable
  254. :close-on-click-modal = "false"
  255. >
  256. <el-form
  257. :model="queryParams"
  258. ref="queryRef"
  259. size="small"
  260. label-width="100"
  261. >
  262. <el-row :gutter="20">
  263. <el-col :span="12">
  264. <el-form-item label="客户名称:" prop="companyName">
  265. <el-input
  266. v-model="queryParams.companyName"
  267. placeholder="请输入客户名称"
  268. clearable
  269. @keyup.enter="handleQuery"
  270. />
  271. </el-form-item>
  272. <el-form-item label="纳税性质:" prop="taxType">
  273. <el-select
  274. size="small"
  275. v-model="queryParams.taxType"
  276. placeholder="请选择纳税性质"
  277. :clearable="true"
  278. @change="taxTypeChange"
  279. >
  280. <el-option
  281. v-for="item in taxTypes"
  282. :key="item.label"
  283. :label="item.label"
  284. :value="item.value"
  285. />
  286. </el-select>
  287. </el-form-item>
  288. <el-form-item
  289. v-if="tenant.versionId === '4'"
  290. label="来源:"
  291. prop="fromCompanyName"
  292. >
  293. <el-input
  294. size="small"
  295. v-model="queryParams.fromCompanyName"
  296. type="text"
  297. placeholder="客户来源"
  298. :clearable="true"
  299. />
  300. </el-form-item>
  301. </el-col>
  302. <el-col :span="12">
  303. <el-form-item label="所属月:">
  304. <el-date-picker
  305. v-model="currentMonth"
  306. type="month"
  307. format="YYYY年MM月"
  308. :clearable="false"
  309. value-format="YYYY-MM-01"
  310. @change="currentMonthChange"
  311. :disabled-date="disabledDateHandler"
  312. />
  313. </el-form-item>
  314. <el-form-item label="状态:">
  315. <el-select
  316. v-model.trim="queryParams.status"
  317. prop="status"
  318. size="small"
  319. type="text"
  320. placeholder="状态"
  321. :clearable="true"
  322. @clear="clearStatus"
  323. >
  324. <el-option
  325. v-for="item in selectStatus"
  326. :key="item.value"
  327. :label="item.label"
  328. :value="item.value"
  329. />
  330. </el-select>
  331. </el-form-item>
  332. </el-col>
  333. </el-row>
  334. </el-form>
  335. <template #footer>
  336. <div class="dialog-footer">
  337. <el-button
  338. type="primary"
  339. icon="Finished"
  340. size="small"
  341. @click="handleQuery"
  342. >确 定</el-button
  343. >
  344. <el-button icon="close" size="small" @click="moreSearch = false"
  345. >取 消</el-button
  346. >
  347. </div>
  348. </template>
  349. </el-dialog>
  350. </div>
  351. </template>
  352. <script setup>
  353. import useUserStore from "@/store/modules/user";
  354. import {
  355. listHousingFundDeclare,
  356. turnBackDetail,
  357. exportHoisngFundDeclare,
  358. } from "@/api/business/production/housingFundDeclare";
  359. import { uploadFile } from "@/api/tool/file";
  360. import { listCompany } from "@/api/business/crm/company";
  361. import { ref } from "vue";
  362. import formDialog from "./form";
  363. import { taxTypes } from "@/utils/default";
  364. import viewDialog from "./view";
  365. import memberDialog from "../memberDialog";
  366. import FileListDialog from "../fileListDialog.vue";
  367. const { proxy } = getCurrentInstance();
  368. /** 字典数组区 */
  369. /** 查询 对象 */
  370. const tenant = useUserStore().tenant;
  371. const orderList = ref([]);
  372. const loading = ref(true);
  373. const ids = ref([]);
  374. const single = ref(true);
  375. const multiple = ref(true);
  376. const oneself = ref(false);
  377. const total = ref(0);
  378. const prev = ref([]);
  379. const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
  380. const showViewer = ref(false);
  381. const currentFileList = ref([]);
  382. const moreSearch = ref(false);
  383. const showIndex = ref(0);
  384. const formDialogRef = ref(null);
  385. const viewDialogRef = ref(null);
  386. const memeberDialogRef = ref(null);
  387. const fileListDialogRef = ref(null);
  388. const formOpen = ref(false);
  389. const currentMonth = ref(proxy.moment().format("YYYY-MM-01"));
  390. const form = ref({
  391. id: null,
  392. companyName: "",
  393. companyId: null,
  394. remark: "",
  395. type: 1,
  396. files: [],
  397. });
  398. const emptyForm = {
  399. id: null,
  400. companyName: "",
  401. companyId: null,
  402. type: 1,
  403. remark: "",
  404. files: [],
  405. };
  406. const permissions = useUserStore().permissions;
  407. const all_permission = "*:*:*";
  408. const flag = ref(checkPermission(['business:funddeclare:person']))
  409. const activeName = flag.value ? ref('first') : ref('second');
  410. const data = reactive({
  411. selectStatus: [
  412. {
  413. label: "未开始",
  414. value: 0,
  415. color: "#888",
  416. },
  417. {
  418. label: "进行中",
  419. value: 1,
  420. color: "#FFB836",
  421. },
  422. {
  423. label: "已完成",
  424. value: 3,
  425. color: "#2FCB81",
  426. },
  427. ],
  428. });
  429. const { selectStatus, selectMonths } = toRefs(data);
  430. const { verify_status } = proxy.useDict("verify_status");
  431. /** 查询对象 */
  432. const queryParams = ref({
  433. pageNum: 1,
  434. pageSize: 20,
  435. companyName: "",
  436. orderByColumn: "create_time",
  437. year: proxy.moment().format("YYYY"),
  438. month: proxy.moment().format("MM"),
  439. principal: tenant.versionId !== '4' && !flag.value ? useUserStore().user.userId : null,
  440. });
  441. /*********************** 方法区 ****************************/
  442. /** 查询company列表 */
  443. function getList() {
  444. loading.value = true;
  445. listHousingFundDeclare(queryParams.value).then((response) => {
  446. orderList.value = response.rows.map((l) => ({ ...l }));
  447. prev.value = proxy.deepClone(response.rows);
  448. total.value = response.total;
  449. loading.value = false;
  450. });
  451. }
  452. /** 是否为自己负责 */
  453. function handleOneself() {
  454. if (oneself.value) {
  455. queryParams.value.principal = useUserStore().user.userId;
  456. } else {
  457. queryParams.value.principal = null;
  458. }
  459. getList();
  460. }
  461. /** 搜索按钮操作 */
  462. function handleQuery() {
  463. queryParams.value.pageNum = 1;
  464. moreSearch.value = false;
  465. getList();
  466. }
  467. /** 重置按钮操作 */
  468. function resetQuery() {
  469. queryParams.value = {
  470. pageNum: 1,
  471. pageSize: 20,
  472. companyName: "",
  473. year: proxy.moment().format("YYYY"),
  474. month: proxy.moment().format("MM"),
  475. };
  476. currentMonth.value = proxy.moment().format("YYYY-MM-01");
  477. if (activeName.value != null && activeName.value === 'second') {
  478. queryParams.value.principal = useUserStore().user.userId;
  479. }
  480. handleQuery();
  481. }
  482. // 多选框选中数据
  483. function handleSelectionChange(selection) {
  484. ids.value = selection.map((item) => item.id);
  485. single.value = selection.length != 1;
  486. multiple.value = !selection.length;
  487. }
  488. /** 导出按钮操作 */
  489. function handleExport() {
  490. exportHoisngFundDeclare(queryParams.value);
  491. }
  492. function openFollowFile(arg) {
  493. // console.log(arg)
  494. const attach = arg;
  495. window.open(`${arg.url}`, arg.fileName);
  496. }
  497. function showFileList(row) {
  498. currentFileList.value = row.files.map((l) => `${baseUrl.value}${l.fileUrl}`);
  499. showViewer.value = true;
  500. }
  501. function closeImages() {
  502. showViewer.value = false;
  503. }
  504. function showMember(row) {
  505. memeberDialogRef.value.open({
  506. companyId: row.companyId,
  507. year: queryParams.value.year,
  508. month: queryParams.value.month,
  509. });
  510. }
  511. function fillIn(row) {
  512. // 判断选中行的状态
  513. if (row.detail != null) {
  514. const detail = row.detail;
  515. directDialog(detail);
  516. } else {
  517. const detail = {
  518. housingFundDeclareId: row.id,
  519. companyId: row.companyId,
  520. companyName: row.companyName,
  521. month: queryParams.value.month,
  522. year: queryParams.value.year,
  523. };
  524. directDialog(detail);
  525. }
  526. }
  527. function directDialog(detail) {
  528. if (detail.status === 0 || detail.status == null) {
  529. if (editable()) {
  530. formDialogRef.value.open(detail);
  531. } else {
  532. proxy.$modal.msgError("没有权限");
  533. }
  534. } else if (detail.status === 1 || detail.status === 4) {
  535. if (editable()) {
  536. formDialogRef.value.open(detail);
  537. } else if (viewable() || verifiable()) {
  538. viewDialogRef.value.open(detail);
  539. } else {
  540. proxy.$modal.msgError("没有权限");
  541. }
  542. } else if (detail.status === 2 || detail.status === 3) {
  543. if (editable() || viewable() || verifiable()) {
  544. viewDialogRef.value.open(detail);
  545. } else {
  546. proxy.$modal.msgError("没有权限");
  547. }
  548. }
  549. }
  550. function viewable() {
  551. return (
  552. permissions.includes(all_permission) ||
  553. permissions.includes("business:housingFundDeclare:view")
  554. );
  555. }
  556. function editable() {
  557. return (
  558. permissions.includes(all_permission) ||
  559. permissions.includes("business:housingFundDeclare:edit")
  560. );
  561. }
  562. function verifiable() {
  563. return (
  564. permissions.includes(all_permission) ||
  565. permissions.includes("business:housingFundDeclare:verify")
  566. );
  567. }
  568. function showFiles(row) {
  569. fileListDialogRef.value.open(row.detail);
  570. }
  571. function getStatusStyle(row) {
  572. if (row.detail == null) {
  573. return { color: getStatusColor(0), verticalAlign: "middle" };
  574. } else {
  575. return {
  576. color: getStatusColor(row.detail.status),
  577. verticalAlign: "middle",
  578. };
  579. }
  580. }
  581. function getStatusColor(status) {
  582. const index = selectStatus.value.findIndex((v) => v.value === status);
  583. return index >= 0 ? selectStatus.value[index].color : "#fff";
  584. }
  585. function getStatusLabel(row) {
  586. const index = selectStatus.value.findIndex(
  587. (v) => v.value === (row.detail == null ? 0 : row.detail.status)
  588. );
  589. return index >= 0 ? selectStatus.value[index].label : "";
  590. }
  591. function turnBack(detail) {
  592. turnBackDetail(detail)
  593. .then((res) => {
  594. getList();
  595. })
  596. .catch((err) => {
  597. proxy.$modal.msgError(err.message);
  598. });
  599. }
  600. function checkPermission(templatePermission) {
  601. const all_permission = "*:*:*";
  602. const permissions = useUserStore().permissions;
  603. const hasPermissions = permissions.some((permission) => {
  604. return (
  605. all_permission === permission || templatePermission.includes(permission)
  606. );
  607. });
  608. return hasPermissions;
  609. }
  610. function handleClick(tab) {
  611. console.log(tab.props.name)
  612. if (tab.props.name === "second") {
  613. oneself.value = true
  614. handleOneself()
  615. } else {
  616. oneself.value = false
  617. handleOneself()
  618. }
  619. }
  620. function currentMonthChange(arg) {
  621. const year = proxy.moment(arg).format("YYYY");
  622. const month = proxy.moment(arg).format("MM");
  623. queryParams.value.year = year;
  624. queryParams.value.month = month;
  625. handleQuery();
  626. }
  627. function clearStatus() {
  628. queryParams.value.status = null;
  629. }
  630. function disabledDateHandler(date) {
  631. if (date <= proxy.moment()) {
  632. return false;
  633. } else {
  634. return true;
  635. }
  636. }
  637. getList();
  638. </script>