view.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <el-dialog
  3. title="记账信息"
  4. v-model="visible"
  5. :width="width"
  6. append-to-body
  7. draggable
  8. :close-on-click-modal = "false"
  9. @close="close"
  10. >
  11. <!-- 功能按钮 -->
  12. <div style="padding: 8px 24px 16px 24px">
  13. <el-form size="small" label-width="140px" v-model="form">
  14. <el-row :gutter="30">
  15. <el-col :span="12">
  16. <el-form-item label="客户名称">
  17. <div>{{ form.companyName }}</div>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="12">
  21. <el-form-item label="所属月份">
  22. <div>{{ form.year }}-{{ form.month }}</div>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="24">
  26. <el-divider />
  27. </el-col>
  28. <el-col :span="12">
  29. <el-form-item label="本期收入">
  30. <!-- <el-input-number v-model="form.inputInvoice" size="small" placeholder="进项发票联" :step="1" step-strictly :controls="false" style="width: 100%;" /> -->
  31. <div>{{ rowNum(form.currentIncome) }}</div>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="12">
  35. <el-form-item label="本年收入">
  36. <!-- <el-input-number v-model="form.inputInvoice" size="small" placeholder="进项发票联" :step="1" step-strictly :controls="false" style="width: 100%;" /> -->
  37. <div>{{ rowNum(form.currentYearIncome) }}</div>
  38. </el-form-item>
  39. </el-col>
  40. <el-col v-if="form.isProvisionalEstimate === 1" :span="12">
  41. <el-form-item label="暂估金额">
  42. <!-- <el-input-number v-model="form.inputInvoice" size="small" placeholder="进项发票联" :step="1" step-strictly :controls="false" style="width: 100%;" /> -->
  43. <div>{{ rowNum(form.provisionalEstimateAmount) }}</div>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="12">
  47. <el-form-item label="本年利润总额">
  48. <!-- <el-input-number v-model="form.inputInvoice" size="small" placeholder="进项发票联" :step="1" step-strictly :controls="false" style="width: 100%;" /> -->
  49. <div>{{ rowNum(form.currentYearProfit) }}</div>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="12">
  53. <el-form-item label="可弥补以前年度亏损">
  54. <!-- <el-input-number v-model="form.inputInvoice" size="small" placeholder="进项发票联" :step="1" step-strictly :controls="false" style="width: 100%;" /> -->
  55. <div>{{ rowNum(previousAnnualLosses) }}</div>
  56. </el-form-item>
  57. </el-col>
  58. <el-col :span="24">
  59. <el-form-item label="备注">
  60. <el-input
  61. v-if="form.status === 2"
  62. v-model.trim="form.verifyContent"
  63. type="textarea"
  64. rows="2"
  65. />
  66. <div v-else>{{ form.verifyContent }}</div>
  67. </el-form-item>
  68. </el-col>
  69. </el-row>
  70. </el-form>
  71. </div>
  72. <div class="form-btns-container" style="height: 40px">
  73. <el-button
  74. v-if="verifiable() && form.status === 3"
  75. type="warning"
  76. icon="back"
  77. size="small"
  78. style="float: right; margin-left: 12px"
  79. @click="returnStatus()"
  80. >
  81. 退回</el-button
  82. >
  83. </div>
  84. <feedback-dialog ref="feedbackDialogView" :verify="verify" />
  85. <!-- <print-dialog ref="printDialog" /> -->
  86. </el-dialog>
  87. </template>
  88. <script setup>
  89. import {
  90. getDetail,
  91. verifyDetail,
  92. turnBackDetail,
  93. } from "@/api/business/production/keepAccount";
  94. import feedbackDialog from "../feedbackDialog.vue";
  95. import { rowNum } from "@/utils/index";
  96. import { salaryStatusTypes } from "@/utils/default";
  97. import useUserStore from "@/store/modules/user";
  98. import { ref } from "vue";
  99. const { proxy } = getCurrentInstance();
  100. const visible = ref(false);
  101. const width = ref(800);
  102. const selections = ref([]);
  103. const currentSource = ref(null);
  104. const permissions = useUserStore().permissions;
  105. const all_permission = "*:*:*";
  106. const feedbackDialogView = ref(null);
  107. const props = defineProps({
  108. getList: {
  109. type: Function,
  110. default: () => {},
  111. },
  112. });
  113. const { getList } = toRefs(props);
  114. const total = ref(0);
  115. const data = reactive({
  116. confirmChoices: [
  117. {
  118. label: "有",
  119. value: 1,
  120. },
  121. {
  122. label: "无",
  123. value: 0,
  124. },
  125. ],
  126. salaryDetail: null,
  127. selectStatus: [
  128. {
  129. label: "未开始",
  130. value: 0,
  131. color: "#fff",
  132. },
  133. {
  134. label: "待确认",
  135. value: 1,
  136. color: "#fcd080",
  137. },
  138. {
  139. label: "待审核",
  140. value: 2,
  141. color: "#80a7fc",
  142. },
  143. {
  144. label: "已完成",
  145. value: 3,
  146. color: "#57e63e",
  147. },
  148. {
  149. label: "驳回待处理",
  150. value: 4,
  151. color: "#e63e3e",
  152. },
  153. ],
  154. });
  155. const { confirmChoices, salaryDetail, selectStatus } = toRefs(data);
  156. const employeeEmptyData = {
  157. id: null,
  158. title: "",
  159. remark: "",
  160. employeeName: "",
  161. departmentName: "",
  162. idCode: "",
  163. salaryAmount: "",
  164. bonusAmount: "",
  165. allowanceAmount: "",
  166. subsidyAmount: "",
  167. absenceCut: "",
  168. planSalary: 0,
  169. actuallySalary: 0,
  170. endowmentInsurance: 0,
  171. medicalInsurance: 0,
  172. unemploymentBenefit: 0,
  173. seriousIllnessInsurance: 0,
  174. housingFund: 0,
  175. otherCut: 0,
  176. cumulativeIncome: 0,
  177. cumulativeSpecialCut: 0,
  178. cumulativeChildEduCut: 0,
  179. cumulativeHouseLoanInterestCut: 0,
  180. cumulativeHouseRentCut: 0,
  181. cumulativeSupportElderCut: 0,
  182. cumulativeContinuingEduCut: 0,
  183. cumulativeBabyCareCut: 0,
  184. sumSpecialCumulativeCut: 0,
  185. cumulativeOtherCut: 0,
  186. cumulativeIndividualIncomeTax: 0,
  187. cumulativeHasPaidIit: 0,
  188. currentIndividualIncomeTax: 0,
  189. idiograph: "",
  190. details: [],
  191. editStatus: true,
  192. };
  193. const form = ref({
  194. amount: null,
  195. details: [],
  196. });
  197. const emptyForm = {
  198. details: [],
  199. };
  200. function open(detail) {
  201. console.log(detail);
  202. visible.value = true;
  203. form.value = detail;
  204. loadData();
  205. }
  206. function loadData() {
  207. Promise.all([getDetail(form.value)]).then((res) => {
  208. form.value = { ...proxy.deepClone(emptyForm), ...res[0].data };
  209. });
  210. }
  211. function close() {
  212. visible.value = false;
  213. reset();
  214. }
  215. function reset() {
  216. form.value = proxy.deepClone(emptyForm);
  217. total.value = 0;
  218. }
  219. function printSalary() {}
  220. function exportSalary() {}
  221. function showVerify() {
  222. if (salaryDetail.value == null || salaryDetail.value.status !== 3) {
  223. return false;
  224. }
  225. if (
  226. form.value.id == null ||
  227. form.value.status === 0 ||
  228. form.value.status === 1 ||
  229. form.value.status === 3 ||
  230. form.value.status === 4
  231. ) {
  232. return false;
  233. } else if (verifiable()) {
  234. return true;
  235. } else {
  236. return false;
  237. }
  238. }
  239. function verifiable() {
  240. return (
  241. permissions.includes(all_permission) ||
  242. permissions.includes("business:keepAccount:verify")
  243. );
  244. }
  245. function handleCurrentChange(row) {
  246. currentSource.value = row;
  247. }
  248. function handleCheckChange(selection) {
  249. selections.value = selection.map((item) => item);
  250. }
  251. function handleVerify(status, feedbackStatus) {
  252. if (status === 4) {
  253. const saveValue = proxy.deepClone(form.value);
  254. saveValue.status = status;
  255. saveValue.feedbackStatus = 1;
  256. feedbackDialogView.value.open(saveValue);
  257. } else if (status === 3 && feedbackStatus === 1) {
  258. const saveValue = proxy.deepClone(form.value);
  259. saveValue.status = status;
  260. saveValue.feedbackStatus = feedbackStatus;
  261. feedbackDialogView.value.open(saveValue);
  262. } else {
  263. proxy.$modal
  264. .confirm("确认审核么?")
  265. .then((_) => {
  266. const saveValue = proxy.deepClone(form.value);
  267. saveValue.status = status;
  268. verify(saveValue);
  269. })
  270. .catch((_) => {
  271. proxy.$modal.msg("已取消审核");
  272. });
  273. }
  274. }
  275. function verify(data) {
  276. verifyDetail(data).then((res) => {
  277. reset();
  278. getList.value();
  279. close();
  280. });
  281. }
  282. function computeTotal() {
  283. let totalSalay = 0;
  284. form.value.details.forEach((l) => {
  285. totalSalay += l.actuallySalary == null ? 0 : l.actuallySalary;
  286. });
  287. form.value.amount = totalSalay.toFixed(2);
  288. }
  289. function returnStatus(status) {
  290. proxy.$modal
  291. .confirm("确认退回么?")
  292. .then((_) => {
  293. const saveValue = form.value;
  294. saveValue.status = 1;
  295. turnBackDetail(saveValue).then((res) => {
  296. reset();
  297. getList.value();
  298. close();
  299. });
  300. })
  301. .catch((_) => {
  302. proxy.$modal.msg("已取消退回");
  303. });
  304. }
  305. function getStatusLabel(status) {
  306. const index = selectStatus.value.findIndex((v) => v.value === status);
  307. return index < 0 ? "未开始" : selectStatus.value[index].label;
  308. }
  309. function ticketNumberChange() {
  310. let amount = 0;
  311. amount += form.value.incomeTicket;
  312. amount += form.value.costTicket;
  313. amount += form.value.feeTicketNumber;
  314. amount += form.value.ssafTicket;
  315. amount += form.value.salaryTicket;
  316. amount += form.value.bankSlipsNumber;
  317. amount += form.value.bankCopyNumber;
  318. amount += form.value.bankCopy;
  319. amount += form.value.otherTicket;
  320. form.value.sumNumber = amount;
  321. }
  322. function getStatusOfSalary(arg) {
  323. const index = salaryStatusTypes.findIndex((v) => v.value === arg.status);
  324. return index <= 0 ? "未开始" : salaryStatusTypes[index].label;
  325. }
  326. // 暴露给父组件的方法
  327. defineExpose({
  328. open,
  329. });
  330. </script>