InvoiceTaxDeduction.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="form">
  3. <testForm v-model="formData.data" :formOption="formOption" :formConfig="formConfig" :rules="rules" ref="formDom">
  4. <template #detail>
  5. <div style="width:100%">
  6. <div style="width:100%;overflow-x:auto;">
  7. <table border class="table">
  8. <thead>
  9. <tr>
  10. <th style="min-width:130px;">发票附件(电子发票需上传PDF或OFD格式)</th>
  11. <th style="min-width:50px">金额</th>
  12. </tr>
  13. </thead>
  14. <tbody v-if="formData.data.invoiceTaxDeductionDetailsList && formData.data.invoiceTaxDeductionDetailsList.length>0">
  15. <tr v-for="(item,index) in formData.data.invoiceTaxDeductionDetailsList" :key="index">
  16. <td>
  17. <div v-for="file in item.fileList" :key="file.id" style="color: #409eff;cursor: pointer;"
  18. @click="onPreviewFile(file.fileName,file.fileUrl)">
  19. {{file.fileName}}
  20. </div>
  21. </td>
  22. <td>{{item.amount}}</td>
  23. </tr>
  24. </tbody>
  25. </table>
  26. </div>
  27. </div>
  28. </template>
  29. </testForm>
  30. </div>
  31. </template>
  32. <script setup>
  33. import {
  34. ref,
  35. getCurrentInstance,
  36. onMounted,
  37. defineProps,
  38. defineExpose,
  39. watch,
  40. reactive,
  41. toRefs,
  42. } from "vue";
  43. import { useRoute } from "vue-router";
  44. import testForm from "@/components/testForm/index.vue";
  45. import { getUserInfo } from "@/utils/auth";
  46. import { showFailToast } from "vant";
  47. // 接收父组件的传值
  48. const props = defineProps({
  49. queryData: Object,
  50. });
  51. const refProps = toRefs(props);
  52. const proxy = getCurrentInstance().proxy;
  53. const route = useRoute();
  54. const active = ref(0);
  55. const tabsChange = () => {
  56. active.value++;
  57. };
  58. const selectData = ref([]);
  59. const formData = reactive({
  60. data: {},
  61. });
  62. const formDom = ref(null);
  63. const formOption = reactive({
  64. readonly: false,
  65. disabled: false,
  66. labelAlign: "top",
  67. scroll: true,
  68. labelWidth: "62pk",
  69. hiddenSubmitBtn: true,
  70. });
  71. const formConfig = reactive([
  72. {
  73. type: "title",
  74. title: "基本信息",
  75. },
  76. {
  77. type: "input",
  78. label: "流水号",
  79. prop: "code",
  80. itemType: "text",
  81. readonly: true,
  82. },
  83. {
  84. type: "input",
  85. label: "提交日期",
  86. prop: "applyTime",
  87. itemType: "text",
  88. readonly: true,
  89. },
  90. {
  91. type: "input",
  92. label: "提交人",
  93. prop: "createUserName",
  94. itemType: "text",
  95. readonly: true,
  96. },
  97. {
  98. type: "input",
  99. label: "抵扣金额汇总",
  100. prop: "amount",
  101. itemType: "text",
  102. readonly: true,
  103. },
  104. {
  105. type: "input",
  106. label: "抵扣工资月份",
  107. prop: "deductionSalaryMonth",
  108. itemType: "text",
  109. readonly: true,
  110. },
  111. {
  112. type: "slot",
  113. label: "抵扣明细",
  114. slotName: "detail",
  115. },
  116. ]);
  117. const rules = {};
  118. const getDict = () => {
  119. proxy
  120. .post("/educationConfig/page", {
  121. pageNum: 1,
  122. pageSize: 999,
  123. })
  124. .then((res) => {
  125. selectData.value = res.data.rows.map((x) => ({
  126. ...x,
  127. label: x.name,
  128. value: x.id,
  129. }));
  130. });
  131. };
  132. // getDict();
  133. const status = ref(true);
  134. const handleSubmit = async () => {
  135. if (status.value) {
  136. return formData.data;
  137. }
  138. };
  139. onMounted(() => {
  140. if (route.query && route.query.businessId) {
  141. formOption.readonly = true;
  142. formOption.hiddenSubmitBtn = true;
  143. let businessId = route.query.businessId;
  144. proxy
  145. .post("/invoiceTaxDeduction/detail", { id: businessId })
  146. .then((res) => {
  147. formData.data = res.data;
  148. let ids = formData.data.invoiceTaxDeductionDetailsList.map((x) => x.id);
  149. proxy.post("/fileInfo/getList", { businessIdList: ids }).then((res) => {
  150. let fileObj = res.data;
  151. if (Object.keys(fileObj).length > 0) {
  152. for (
  153. let i = 0;
  154. i < formData.data.invoiceTaxDeductionDetailsList.length;
  155. i++
  156. ) {
  157. const row = formData.data.invoiceTaxDeductionDetailsList[i];
  158. for (const key in fileObj) {
  159. if (row.id == key) {
  160. row.fileList = fileObj[key].map((item) => {
  161. return {
  162. ...item,
  163. name: item.fileName,
  164. url: item.fileUrl,
  165. };
  166. });
  167. break;
  168. }
  169. }
  170. }
  171. }
  172. });
  173. });
  174. }
  175. });
  176. defineExpose({
  177. handleSubmit,
  178. tabsChange,
  179. });
  180. onMounted(() => {});
  181. </script>
  182. <style lang="scss" scoped>
  183. ._title {
  184. display: flex;
  185. align-items: center;
  186. font-size: 14px;
  187. font-weight: 700;
  188. margin-left: -10px;
  189. .line {
  190. width: 4px;
  191. background-color: #0084ff;
  192. height: 15px;
  193. margin-right: 8px;
  194. }
  195. }
  196. .table {
  197. border-collapse: collapse;
  198. border-spacing: 0;
  199. width: 100%;
  200. border-color: #ebeef5;
  201. color: #606266;
  202. thead tr th {
  203. padding: 6px;
  204. text-align: left;
  205. }
  206. td {
  207. text-align: left;
  208. padding: 6px;
  209. }
  210. }
  211. </style>