index.vue 18 KB

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