index.vue 17 KB

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