index.vue 18 KB

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