index.vue 18 KB

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