detail.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393
  1. <template>
  2. <a-card :bordered="false">
  3. <a-page-header
  4. :title="formData.id ? '企业台账' : '新增企业台账'"
  5. @back="onClose"
  6. >
  7. <template #extra>
  8. <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
  9. <a-popconfirm title="请确认是否保存?" @confirm="onTemp" v-if="!isView">
  10. <a-button style="margin-right: 8px" :loading="submitLoading">保存</a-button>
  11. </a-popconfirm>
  12. <a-popconfirm title="请确认是否申报?" @confirm="onSubmit" v-if="!isView">
  13. <a-button type="primary" :loading="submitLoading">申报</a-button>
  14. </a-popconfirm>
  15. </template>
  16. </a-page-header>
  17. <a-collapse v-model:activeKey="activeKey" expand-icon-position="end">
  18. <a-collapse-panel key="1" header="基本信息">
  19. <a-form ref="formRef" :model="formData" :rules="formRules">
  20. <a-row :gutter="16">
  21. <a-col :span="8">
  22. <a-form-item label="预录入台账编号:" name="ylTzCode">
  23. <a-input v-model:value="formData.ylTzCode" :disabled="true" placeholder="请输入预录入台账编号"
  24. allow-clear/>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :span="8">
  28. <a-form-item label="台账编号:" name="tzCode">
  29. <a-input v-model:value="formData.tzCode" :disabled="true" placeholder="请输入台账编号"
  30. allow-clear/>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :span="8">
  34. <a-form-item label="台账性质:" name="tzType">
  35. <a-select v-model:value="formData.tzType" :disabled="isView" placeholder="请选择台账性质"
  36. :options="tzTypeOptions" show-search allow-clear option-filter-prop="label"/>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :span="8">
  40. <a-form-item label="海关注册编码:" name="companyMainHgCode">
  41. <a-input v-model:value="formData.companyMainHgCode" :disabled="true"
  42. placeholder="请输入海关注册编码" allow-clear/>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :span="8">
  46. <a-form-item label="统一社会信用代码:" name="companyCode">
  47. <a-input v-model:value="formData.companyCode" :disabled="true"
  48. placeholder="请输入统一社会信用代码" allow-clear/>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :span="8">
  52. <a-form-item label="企业名称:" name="companyName">
  53. <a-input v-model:value="formData.companyName" :disabled="true" placeholder="请输入企业名称"
  54. allow-clear/>
  55. </a-form-item>
  56. </a-col>
  57. <a-col :span="8">
  58. <a-form-item label="申报类型:" name="applyType">
  59. <a-select v-model:value="formData.applyType" :disabled="true" placeholder="请选择申报类型"
  60. :options="applyTypeOptions" show-search allow-clear option-filter-prop="label"/>
  61. </a-form-item>
  62. </a-col>
  63. <a-col :span="8">
  64. <a-form-item label="企业类型:" name="companyType">
  65. <a-select v-model:value="formData.companyType" :disabled="true" placeholder="请选择企业类型"
  66. :options="companyTypeOptions" show-search allow-clear option-filter-prop="label"/>
  67. </a-form-item>
  68. </a-col>
  69. <a-col :span="8">
  70. <a-form-item label="企业地址:" name="companyAddress">
  71. <a-input v-model:value="formData.companyAddress" :disabled="true" placeholder="请输入企业地址"
  72. allow-clear/>
  73. </a-form-item>
  74. </a-col>
  75. <a-col :span="8">
  76. <a-form-item label="联系人:" name="companyLinkMan">
  77. <a-input v-model:value="formData.companyLinkMan" :disabled="true" placeholder="请输入联系人"
  78. allow-clear/>
  79. </a-form-item>
  80. </a-col>
  81. <a-col :span="8">
  82. <a-form-item label="联系电话:" name="companyLegalPhone">
  83. <a-input v-model:value="formData.companyLegalPhone" :disabled="true"
  84. placeholder="请输入联系电话" allow-clear/>
  85. </a-form-item>
  86. </a-col>
  87. <a-col :span="8">
  88. <a-form-item label="经营范围:" name="companyJyFw">
  89. <a-input v-model:value="formData.companyJyFw" :disabled="true" placeholder="请输入经营范围"
  90. allow-clear/>
  91. </a-form-item>
  92. </a-col>
  93. </a-row>
  94. </a-form>
  95. </a-collapse-panel>
  96. <a-collapse-panel key="2" header="料件信息">
  97. <a-button type="primary" @click="onBodyReset" v-if="!isView" style="margin-bottom: 20px;">重置</a-button>
  98. <a-form ref="bodyFormRef" :model="bodyData" :rules="bodyRules" style="margin-bottom: 20px;">
  99. <a-row :gutter="16">
  100. <a-col :span="8">
  101. <a-form-item label="商品序号:" name="productNum">
  102. <a-input v-model:value="bodyData.productNum" :disabled="true" placeholder="" allow-clear />
  103. </a-form-item>
  104. </a-col>
  105. <a-col :span="8">
  106. <a-form-item label="料件编码:" name="productCode">
  107. <a-select
  108. v-model:value="bodyData.productCode"
  109. placeholder="请选择料件编码"
  110. style="width: 100%"
  111. :filter-option="false"
  112. :not-found-content="fetchingLj ? undefined : null"
  113. :options="ljOptions"
  114. :show-search="true"
  115. @search="fetchLj"
  116. @change="onChangeLj"
  117. option-label-prop="value"
  118. :disabled="isView"
  119. >
  120. <template v-if="fetchingLj" #notFoundContent>
  121. <a-spin size="small" />
  122. </template>
  123. </a-select>
  124. </a-form-item>
  125. </a-col>
  126. <a-col :span="8">
  127. <a-form-item label="料件名称:" name="productName">
  128. <a-input v-model:value="bodyData.productName" :disabled="true" placeholder="请选择料件编码" allow-clear />
  129. </a-form-item>
  130. </a-col>
  131. <a-col :span="8">
  132. <a-form-item label="规格型号:" name="specModel">
  133. <a-input v-model:value="bodyData.specModel" :disabled="isView" placeholder="请输入规格型号" allow-clear />
  134. </a-form-item>
  135. </a-col>
  136. <a-col :span="8">
  137. <a-form-item label="备案数量:" name="recordQuantity">
  138. <a-input-number v-model:value="bodyData.recordQuantity" :disabled="isView" placeholder="请输入备案数量" :precision="0" :min="0" style="width: 100%;" @change="onChangeRecordQuantity"/>
  139. </a-form-item>
  140. </a-col>
  141. <a-col :span="8">
  142. <a-form-item label="备案计量单位:" name="recordUnit">
  143. <a-select v-model:value="bodyData.recordUnit" :disabled="isView" placeholder="请输入备案计量单位" :options="legalUnitOptions" show-search allow-clear option-filter-prop="label"/>
  144. </a-form-item>
  145. </a-col>
  146. <a-col :span="8">
  147. <a-form-item label="申报计量单位:" name="declareUnit">
  148. <a-select v-model:value="bodyData.declareUnit" :disabled="isView" placeholder="请输入申报计量单位" :options="legalUnitOptions" show-search allow-clear option-filter-prop="label"/>
  149. </a-form-item>
  150. </a-col>
  151. <a-col :span="8">
  152. <a-form-item label="法定计量单位:" name="legalUnit">
  153. <a-input v-model:value="bodyData.legalUnit" :disabled="true" placeholder="请选择料件编码" allow-clear/>
  154. </a-form-item>
  155. </a-col>
  156. <a-col :span="8">
  157. <a-form-item label="法定第二计量单位:" name="legalSecondUnit">
  158. <a-input v-model:value="bodyData.legalSecondUnit" :disabled="true" placeholder="请选择料件编码" allow-clear/>
  159. </a-form-item>
  160. </a-col>
  161. <a-col :span="8">
  162. <a-form-item label="原产国(地区):" name="originCountry">
  163. <a-select v-model:value="bodyData.originCountry" :disabled="isView" placeholder="请输入原产国(地区)" :options="originCountryOptions" show-search allow-clear option-filter-prop="label" />
  164. </a-form-item>
  165. </a-col>
  166. <a-col :span="8">
  167. <a-form-item label="备案单价:" name="recordPrice">
  168. <a-input-number v-model:value="bodyData.recordPrice" :disabled="isView" placeholder="请输入备案单价" style="width: 100%" @change="onChangeRecordPrice"/>
  169. </a-form-item>
  170. </a-col>
  171. <a-col :span="8">
  172. <a-form-item label="备案总价:" name="recordTotalPrice">
  173. <a-input v-model:value="bodyData.recordTotalPrice" :disabled="true" placeholder="备案数量 * 备案单价" allow-clear />
  174. </a-form-item>
  175. </a-col>
  176. <a-col :span="8">
  177. <a-form-item label="币制:" name="currency">
  178. <a-select v-model:value="bodyData.currency" :disabled="isView" placeholder="请选择币制" :options="currencyOptions" show-search allow-clear option-filter-prop="label" />
  179. </a-form-item>
  180. </a-col>
  181. <a-col :span="8">
  182. <a-form-item label="法定数量:" name="legalQuantity">
  183. <a-input-number v-model:value="bodyData.legalQuantity" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入法定数量" @change="onChangeLegalQuantity"/>
  184. </a-form-item>
  185. </a-col>
  186. <a-col :span="8">
  187. <a-form-item label="第二法定数量:" name="secondLegalQuantity">
  188. <a-input-number v-model:value="bodyData.secondLegalQuantity" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入第二法定数量" />
  189. </a-form-item>
  190. </a-col>
  191. <a-col :span="8">
  192. <a-form-item label="重量比例因子:" name="weightRatioFactor">
  193. <a-input v-model:value="bodyData.weightRatioFactor" :disabled="true" placeholder="备案数量 / 法定数量"/>
  194. </a-form-item>
  195. </a-col>
  196. <a-col :span="8">
  197. <a-form-item label="第一比例因子:" name="firstRatioFactor">
  198. <a-input v-model:value="bodyData.firstRatioFactor" :disabled="true" placeholder="请输入第一比例因子" allow-clear />
  199. </a-form-item>
  200. </a-col>
  201. <a-col :span="8">
  202. <a-form-item label="第二比例因子:" name="secondRatioFactor">
  203. <a-input v-model:value="bodyData.secondRatioFactor" :disabled="true" placeholder="请输入第二比例因子" allow-clear />
  204. </a-form-item>
  205. </a-col>
  206. <a-col :span="8">
  207. <a-form-item label="毛重(KG):" name="grossWeight">
  208. <a-input-number v-model:value="bodyData.grossWeight" :disabled="isView" :min="0" style="width: 100%;" placeholder="请输入毛重(KG)" />
  209. </a-form-item>
  210. </a-col>
  211. <a-col :span="8">
  212. <a-form-item label="净重(KG):" name="netWeight">
  213. <a-input v-model:value="bodyData.netWeight" :disabled="isView" :min="0" style="width: 100%;" placeholder="请输入净重(KG)" />
  214. </a-form-item>
  215. </a-col>
  216. <a-col :span="8">
  217. <a-form-item label="剩余备案数量:" name="remainingRecordAmount">
  218. <a-input v-model:value="bodyData.remainingRecordAmount" :disabled="true" placeholder="请输入剩余备案数量" allow-clear />
  219. </a-form-item>
  220. </a-col>
  221. <a-col :span="8">
  222. <a-form-item label="进账累计数量:" name="inAccountCumulativeAmount">
  223. <a-input-number v-model:value="bodyData.inAccountCumulativeAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入进账累计数量" @change="onChangeInAccountCumulativeAmount"/>
  224. </a-form-item>
  225. </a-col>
  226. <a-col :span="8">
  227. <a-form-item label="出账累计数量:" name="outAccountCumulativeAmount">
  228. <a-input-number v-model:value="bodyData.outAccountCumulativeAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入出账累计数量" @change="onChangeOutAccountCumulativeAmount"/>
  229. </a-form-item>
  230. </a-col>
  231. <a-col :span="8">
  232. <a-form-item label="库存累计数量:" name="inventoryCumulativeAmount">
  233. <a-input-number v-model:value="bodyData.inventoryCumulativeAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入库存累计数量" />
  234. </a-form-item>
  235. </a-col>
  236. <a-col :span="8">
  237. <a-form-item label="一线进区累计数量:" name="firstInAmount">
  238. <a-input-number v-model:value="bodyData.firstInAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入一线进区累计数量" />
  239. </a-form-item>
  240. </a-col>
  241. <a-col :span="8">
  242. <a-form-item label="一线出区累计数量:" name="firstOutAmount">
  243. <a-input-number v-model:value="bodyData.firstOutAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入一线出区累计数量" />
  244. </a-form-item>
  245. </a-col>
  246. <a-col :span="8">
  247. <a-form-item label="二线进区累计数量:" name="secondInAmount">
  248. <a-input-number v-model:value="bodyData.secondInAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入二线进区累计数量" />
  249. </a-form-item>
  250. </a-col>
  251. <a-col :span="8">
  252. <a-form-item label="二线出区累计数量:" name="secondOutAmount">
  253. <a-input-number v-model:value="bodyData.secondOutAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入二线出区累计数量" />
  254. </a-form-item>
  255. </a-col>
  256. <a-col :span="8">
  257. <a-form-item label="区内转入累计数量:" name="intraZoneTransferInAmount">
  258. <a-input-number v-model:value="bodyData.intraZoneTransferInAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入区内转入累计数量" />
  259. </a-form-item>
  260. </a-col>
  261. <a-col :span="8">
  262. <a-form-item label="区内转出累计数量:" name="intraZoneTransferOutAmount">
  263. <a-input-number v-model:value="bodyData.intraZoneTransferOutAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入区内转出累计数量" />
  264. </a-form-item>
  265. </a-col>
  266. <a-col :span="8">
  267. <a-form-item label="区外转入累计数量:" name="extraZoneTransferInAmount">
  268. <a-input-number v-model:value="bodyData.extraZoneTransferInAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入区外转入累计数量" />
  269. </a-form-item>
  270. </a-col>
  271. <a-col :span="8">
  272. <a-form-item label="转至区外累计数量:" name="transferToExtraZoneAmount">
  273. <a-input-number v-model:value="bodyData.transferToExtraZoneAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入转至区外累计数量" />
  274. </a-form-item>
  275. </a-col>
  276. <a-col :span="8">
  277. <a-form-item label="补税累计数量:" name="compensationTaxAmount">
  278. <a-input-number v-model:value="bodyData.compensationTaxAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入补税累计数量" />
  279. </a-form-item>
  280. </a-col>
  281. <a-col :span="8">
  282. <a-form-item label="核销累计数量:" name="writeOffAmount">
  283. <a-input-number v-model:value="bodyData.writeOffAmount" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入核销累计数量" />
  284. </a-form-item>
  285. </a-col>
  286. <a-col :span="8">
  287. <a-form-item label="修改标志:" name="modifyFlag">
  288. <a-input v-model:value="bodyData.modifyFlag" :disabled="isView" placeholder="请输入修改标志" allow-clear />
  289. </a-form-item>
  290. </a-col>
  291. </a-row>
  292. </a-form>
  293. <template v-if="!isView">
  294. <a-button type="primary" style="margin-right: 8px;" v-if="!(bodyData.id)" @click="onBodyAdd">插入</a-button>
  295. <a-button type="primary" style="margin-right: 8px;" v-else @click="onBodyEdit">保存</a-button>
  296. <xn-batch-delete
  297. :selectedRowKeys="bodySelectedRowKeys"
  298. @batchDelete="deleteBatchBody"
  299. />
  300. </template>
  301. <a-table
  302. style="margin-top: 10px"
  303. bordered
  304. :dataSource="bodyList"
  305. :columns="bodyColumns"
  306. :pagination="false"
  307. :scroll="{ x: 2000 }"
  308. :row-selection="bodyOptions.rowSelection"
  309. rowKey="id"
  310. >
  311. <template #bodyCell="{ column, record, index }">
  312. <template v-if="column.dataIndex === 'recordUnit'">
  313. {{ $TOOL.dictTypeData('measurement unit', record.recordUnit) }}
  314. </template>
  315. <template v-if="column.dataIndex === 'declareUnit'">
  316. {{ $TOOL.dictTypeData('measurement unit', record.declareUnit) }}
  317. </template>
  318. <!-- <template v-if="column.dataIndex === 'legalUnit'">-->
  319. <!-- {{ $TOOL.dictTypeData('measurement unit', record.legalUnit) }}-->
  320. <!-- </template>-->
  321. <!-- <template v-if="column.dataIndex === 'legalSecondUnit'">-->
  322. <!-- {{ $TOOL.dictTypeData('measurement unit', record.legalSecondUnit) }}-->
  323. <!-- </template>-->
  324. <template v-if="column.dataIndex === 'originCountry'">
  325. {{ $TOOL.dictTypeData('address', record.originCountry) }}
  326. </template>
  327. <template v-if="column.dataIndex === 'currency'">
  328. {{ $TOOL.dictTypeData('hbdm', record.currency) }}
  329. </template>
  330. <template v-if="column.dataIndex === 'action'">
  331. <template v-if="isView">
  332. <a-button type="link" primary size="small" @click="onBodyReset(), bodyData = cloneDeep(record)">查看</a-button>
  333. </template>
  334. <template v-else>
  335. <a-button type="link" primary size="small" @click="onBodyReset(), bodyData = cloneDeep(record)">编辑</a-button>
  336. <a-button type="link" danger size="small" @click="onBodyDel(index)">删除</a-button>
  337. </template>
  338. </template>
  339. </template>
  340. </a-table>
  341. </a-collapse-panel>
  342. <a-collapse-panel key="4" header="产品信息">
  343. <a-button type="primary" @click="onProductReset" v-if="!isView" style="margin-bottom: 20px;">重置</a-button>
  344. <a-form ref="productFormRef" :model="productData" :rules="productRules" style="margin-bottom: 20px;">
  345. <a-row :gutter="16">
  346. <a-col :span="8">
  347. <a-form-item label="商品序号:" name="productNumber">
  348. <a-input v-model:value="productData.productNumber" :disabled="true" placeholder="" allow-clear />
  349. </a-form-item>
  350. </a-col>
  351. <a-col :span="8">
  352. <a-form-item label="预录入编号:" name="ylCode">
  353. <a-input v-model:value="productData.ylCode" :disabled="true" placeholder="" allow-clear />
  354. </a-form-item>
  355. </a-col>
  356. <a-col :span="8">
  357. <a-form-item label="企业编号:" name="companyApplyCode">
  358. <a-input v-model:value="productData.companyApplyCode" :disabled="true" placeholder="" allow-clear />
  359. </a-form-item>
  360. </a-col>
  361. <a-col :span="8">
  362. <a-form-item label="企业名称:" name="companyName">
  363. <a-input v-model:value="productData.companyName" :disabled="true" placeholder="" allow-clear />
  364. </a-form-item>
  365. </a-col>
  366. <a-col :span="8">
  367. <a-form-item label="加工增值核算备案编号:" name="recordNumber">
  368. <a-input v-model:value="productData.recordNumber" :disabled="true" placeholder="" allow-clear />
  369. </a-form-item>
  370. </a-col>
  371. <a-col :span="8">
  372. <a-form-item label="主管关区代码:" name="regionCode">
  373. <a-select v-model:value="productData.regionCode" :disabled="isView" placeholder="请选择主管关区代码" :options="regionCodeOptions" show-search allow-clear option-filter-prop="label"/>
  374. </a-form-item>
  375. </a-col>
  376. <a-col :span="8">
  377. <a-form-item label="商品编号:" name="productCode">
  378. <a-select
  379. v-model:value="productData.productCode"
  380. placeholder="请选择商品编号"
  381. style="width: 100%"
  382. :filter-option="false"
  383. :not-found-content="fetchingSp ? undefined : null"
  384. :options="spOptions"
  385. :show-search="true"
  386. @search="fetchSp"
  387. @change="onChangeSp"
  388. option-label-prop="value"
  389. :disabled="isView"
  390. >
  391. <template v-if="fetchingSp" #notFoundContent>
  392. <a-spin size="small" />
  393. </template>
  394. </a-select>
  395. </a-form-item>
  396. </a-col>
  397. <a-col :span="8">
  398. <a-form-item label="商品名称:" name="productName">
  399. <a-input v-model:value="productData.productName" :disabled="true" placeholder="请选择商品编号" allow-clear />
  400. </a-form-item>
  401. </a-col>
  402. <a-col :span="8">
  403. <a-form-item label="版本号:" name="version">
  404. <a-input v-model:value="productData.version" :disabled="true" placeholder="请选择商品编号" allow-clear />
  405. </a-form-item>
  406. </a-col>
  407. <a-col :span="8">
  408. <a-form-item label="HS编码:" name="hsCode">
  409. <a-input v-model:value="productData.hsCode" :disabled="true" placeholder="请选择商品编号" allow-clear />
  410. </a-form-item>
  411. </a-col>
  412. <a-col :span="8">
  413. <a-form-item label="人民币单价:" name="unitPrice">
  414. <a-input v-model:value="productData.unitPrice" :disabled="isView" placeholder="请输入人民币单价" allow-clear />
  415. </a-form-item>
  416. </a-col>
  417. <a-col :span="8">
  418. <a-form-item label="商品数量:" name="quantity">
  419. <a-input-number v-model:value="productData.quantity" :disabled="isView" :precision="0" :min="0" style="width: 100%;" placeholder="请输入商品数量" />
  420. </a-form-item>
  421. </a-col>
  422. <a-col :span="8">
  423. <a-form-item label="计量单位:" name="measurementUnit">
  424. <a-input v-model:value="productData.measurementUnit" :disabled="true" placeholder="请选择商品编号" allow-clear/>
  425. </a-form-item>
  426. </a-col>
  427. <a-col :span="8">
  428. <a-form-item label="成品内销人民币价格:" name="domesticSalePrice">
  429. <a-input v-model:value="productData.domesticSalePrice" :disabled="isView" :min="0" style="width: 100%;" placeholder="请输入成品内销人民币价格" @change="onChangeSelfRate"/>
  430. </a-form-item>
  431. </a-col>
  432. <a-col :span="8">
  433. <a-form-item label="境外进口料件总价(RMB):" name="importTotal">
  434. <a-input v-model:value="productData.importTotal" :disabled="isView" :min="0" style="width: 100%;" placeholder="请输入境外进口料件总价(RMB)" @change="onChangeSelfRate"/>
  435. </a-form-item>
  436. </a-col>
  437. <a-col :span="8">
  438. <a-form-item label="国内采购料件总价(RMB):" name="domesticTotal">
  439. <a-input v-model:value="productData.domesticTotal" :disabled="isView" :min="0" style="width: 100%;" placeholder="请输入国内采购料件总价(RMB)" @change="onChangeSelfRate"/>
  440. </a-form-item>
  441. </a-col>
  442. <a-col :span="8">
  443. <a-form-item label="自主核算产品收益占比:" name="selfRatio">
  444. <a-input v-model:value="productData.selfRatio" :disabled="isView" placeholder="请输入自主核算产品收益占比" allow-clear />
  445. </a-form-item>
  446. </a-col>
  447. <a-col :span="8">
  448. <a-form-item label="企业自主核算加工增值率(%):" name="selfRate">
  449. <a-input v-model:value="productData.selfRate" :disabled="true" placeholder="请输入企业自主核算加工增值率(%)" allow-clear>
  450. <template #suffix>
  451. <a-tooltip title="(成品内销人民币价格 - 境外进口料件总价(RMB) - 国内采购料件总价(RMB))/ (境外进口料件总价(RMB) + 国内采购料件总价(RMB))">
  452. <info-circle-outlined style="color: rgba(0, 0, 0, 0.45)" />
  453. </a-tooltip>
  454. </template>
  455. </a-input>
  456. </a-form-item>
  457. </a-col>
  458. <a-col :span="8">
  459. <a-form-item label="备注:" name="remark">
  460. <a-input v-model:value="productData.remark" :disabled="isView" placeholder="请输入备注" allow-clear />
  461. </a-form-item>
  462. </a-col>
  463. </a-row>
  464. </a-form>
  465. <template v-if="!isView">
  466. <a-button type="primary" style="margin-right: 8px;" v-if="!(productData.id)" @click="onProductAdd">插入</a-button>
  467. <a-button type="primary" style="margin-right: 8px;" v-else @click="onProductEdit">保存</a-button>
  468. <xn-batch-delete
  469. :selectedRowKeys="productSelectedRowKeys"
  470. @batchDelete="deleteBatchProduct"
  471. />
  472. </template>
  473. <a-table
  474. style="margin-top: 10px"
  475. bordered
  476. :dataSource="productList"
  477. :columns="productColumns"
  478. :pagination="false"
  479. :scroll="{ x: 2000 }"
  480. :row-selection="productOptions.rowSelection"
  481. rowKey="id"
  482. >
  483. <template #bodyCell="{ column, record, index }">
  484. <template v-if="column.dataIndex === 'regionCode'">
  485. {{ $TOOL.dictTypeData('zgqdm', record.regionCode) }}
  486. </template>
  487. <template v-if="column.dataIndex === 'action'">
  488. <template v-if="isView">
  489. <a-button type="link" primary size="small" @click="onProductReset(), productData = cloneDeep(record)">查看</a-button>
  490. </template>
  491. <template v-else>
  492. <a-button type="link" primary size="small" @click="onProductReset(), productData = cloneDeep(record)">编辑</a-button>
  493. <a-button type="link" danger size="small" @click="onProductDel(index)">删除</a-button>
  494. </template>
  495. </template>
  496. </template>
  497. </a-table>
  498. </a-collapse-panel>
  499. <a-collapse-panel key="3" header="附件信息">
  500. <template v-if="!isView">
  501. <div class="file-tips">
  502. <InfoCircleFilled style="margin-right: 4px;"/>友情提示<br/>
  503. 1、附件大小要求不超过4M,如果文件过大,建议拆分多个上传;<br/>
  504. 2、附件格式要求:PDF文件;<br/>
  505. 3、同一附件类型可以上传多个附件;<br/>
  506. 4、附件传输过程中会出现传输失败的情况,请随时关注附件传输状态;<br/>
  507. 5、要求上传复印件的可上传原件的扫描件。
  508. </div>
  509. <xn-upload ref="ref_upload" v-model:value="fileData.fileUrl" @onChange="fileChange" accept=".pdf" v-if="showFileUpload"/>
  510. <div style="margin-top: 10px;">
  511. <xn-batch-delete
  512. :selectedRowKeys="fileSelectedRowKeys"
  513. @batchDelete="deleteBatchFile"
  514. />
  515. </div>
  516. </template>
  517. <a-table
  518. style="margin-top: 10px"
  519. bordered
  520. :dataSource="fileList"
  521. :columns="fileColumns"
  522. :pagination="false"
  523. :row-selection="fileOptions.rowSelection"
  524. rowKey="id"
  525. >
  526. <template #bodyCell="{ column, record, index, text }">
  527. <template v-if="['attachmentName', 'attachmentFormat', 'attachmentContent'].includes(column.dataIndex)">
  528. <div>
  529. <a-input
  530. v-if="!isView"
  531. v-model:value="record[column.dataIndex]"
  532. style="margin: -5px 0"
  533. />
  534. <template v-else>
  535. {{ text }}
  536. </template>
  537. </div>
  538. </template>
  539. <template v-if="column.dataIndex === 'action'">
  540. <template v-if="isView">
  541. </template>
  542. <template v-else>
  543. <a-button type="link" danger size="small" @click="onFileDel(index)" v-if="!isView">删除</a-button>
  544. </template>
  545. </template>
  546. </template>
  547. </a-table>
  548. </a-collapse-panel>
  549. </a-collapse>
  550. </a-card>
  551. </template>
  552. <script setup name="qyRecordInfoDetail">
  553. import tool from '@/utils/tool'
  554. import {cloneDeep, debounce} from 'lodash-es'
  555. import {required} from '@/utils/formRules'
  556. import qyRecordInfoApi from '@/api/yqyc/qyRecordInfoApi'
  557. import qyRecordProductDictApi from '@/api/yqyc/qyRecordProductDictApi'
  558. import {message, Modal} from "ant-design-vue";
  559. import {createVNode} from "vue";
  560. import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
  561. // 抽屉状态
  562. const { proxy } = getCurrentInstance()
  563. const emit = defineEmits({successful: null, onClose: null})
  564. const formRef = ref()
  565. const bodyFormRef = ref()
  566. const productFormRef = ref()
  567. const ref_upload = ref()
  568. // 表单数据
  569. const formData = ref({})
  570. const bodyData = ref({})
  571. const productData = ref({})
  572. const fileData = ref({})
  573. const submitLoading = ref(false)
  574. const isView = ref(false)
  575. const showFileUpload = ref(true)
  576. const tzTypeOptions = ref([])
  577. const applyTypeOptions = ref([])
  578. const companyTypeOptions = ref([])
  579. const activeKey = ref('1')
  580. const bodySelectedRowKeys = ref([])
  581. const bodyList = ref([])
  582. const productSelectedRowKeys = ref([])
  583. const productList = ref([])
  584. const userInfo = tool.data.get('USER_INFO')
  585. const legalUnitOptions = ref([])
  586. const originCountryOptions = ref([])
  587. const currencyOptions = ref([])
  588. const regionCodeOptions = ref([])
  589. const spOptions = ref([])
  590. const fetchingSp = ref(false)
  591. const ljOptions = ref([])
  592. const fetchingLj = ref(false)
  593. // 列表选择配置
  594. const bodyOptions = {
  595. rowSelection: {
  596. onChange: (selectedRowKey, selectedRows) => {
  597. bodySelectedRowKeys.value = selectedRows
  598. }
  599. }
  600. }
  601. // 列表选择配置
  602. const productOptions = {
  603. rowSelection: {
  604. onChange: (selectedRowKey, selectedRows) => {
  605. productSelectedRowKeys.value = selectedRows
  606. }
  607. }
  608. }
  609. const fileSelectedRowKeys = ref([])
  610. const fileList = ref([])
  611. // 列表选择配置
  612. const fileOptions = {
  613. rowSelection: {
  614. onChange: (selectedRowKey, selectedRows) => {
  615. fileSelectedRowKeys.value = selectedRows
  616. }
  617. }
  618. }
  619. // 打开抽屉
  620. const onOpen = (record, view = false, type) => {
  621. isView.value = view
  622. if (record) {
  623. qyRecordInfoApi.qyRecordInfoDetail({id: record.id}).then(res => {
  624. formData.value = res
  625. bodyList.value = res.qyRecardBodyAddParams
  626. fileList.value = res.qyRecordAttachmentAddParams
  627. productList.value = res.qyRecordProductAddParams
  628. if (type) {
  629. formData.value.applyType = type
  630. }
  631. formData.value.companyMainHgCode = '9305869382'
  632. })
  633. } else {
  634. formData.value.companyCode = userInfo.companyNumber
  635. formData.value.companyName = userInfo.companyName
  636. formData.value.companyType = userInfo.companyType
  637. formData.value.companyAddress = userInfo.companyAddress
  638. formData.value.companyLinkMan = userInfo.contactName
  639. formData.value.companyLegalPhone = userInfo.contactPhone
  640. formData.value.companyJyFw = userInfo.businessScope
  641. formData.value.applyType = 'basq'
  642. formData.value.companyMainHgCode = '9305869382'
  643. }
  644. onProductReset()
  645. tzTypeOptions.value = tool.dictList('tzlx')
  646. applyTypeOptions.value = tool.dictList('qybalx')
  647. companyTypeOptions.value = tool.dictList('qylx')
  648. legalUnitOptions.value = tool.dictList('measurement unit')
  649. originCountryOptions.value = tool.dictList('address')
  650. currencyOptions.value = tool.dictList('hbdm')
  651. regionCodeOptions.value = tool.dictList('zgqdm')
  652. }
  653. // 关闭抽屉
  654. const onClose = () => {
  655. formRef.value?.resetFields()
  656. formData.value = {}
  657. isView.value = true
  658. emit('onClose')
  659. }
  660. // 默认要校验的
  661. const formRules = {
  662. companyMainHgCode: [required('请输入海关注册编码')],
  663. companyCode: [required('请输入统一社会信用代码')],
  664. companyName: [required('请输入企业名称')],
  665. applyType: [required('请输入申报类型')],
  666. companyType: [required('请输入企业类型')],
  667. companyAddress: [required('请输入企业地址')],
  668. companyLinkMan: [required('请输入联系人')],
  669. companyLegalPhone: [required('请输入联系电话')],
  670. companyJyFw: [required('请输入经营范围')],
  671. }
  672. // 默认要校验的
  673. const bodyRules = {
  674. productCode: [required('请输入料件编码')],
  675. productName: [required('请输入料件名称')],
  676. specModel: [required('请输入规格型号')],
  677. recordQuantity: [required('请输入备案数量')],
  678. recordUnit: [required('请输入备案计量单位')],
  679. legalUnit: [required('请输入法定计量单位')],
  680. originCountry: [required('请输入原产国(地区)')],
  681. recordPrice: [required('请输入备案单价')],
  682. recordTotalPrice: [required('请输入备案总价')],
  683. currency: [required('请输入币制')],
  684. legalQuantity: [required('请输入法定数量')],
  685. recordAmount: [required('请输入备案数量')],
  686. weightRatioFactor: [required('请输入重量比例因子')],
  687. remainingRecordAmount: [required('请输入剩余备案数量')],
  688. inAccountCumulativeAmount: [required('请输入进账累计数量')],
  689. outAccountCumulativeAmount: [required('请输入出账累计数量')],
  690. declareUnit: [required('请选择申报计量单位')],
  691. }
  692. // 默认要校验的
  693. const productRules = {
  694. regionCode: [required('请输入主管关区代码')],
  695. productCode: [required('请输入商品编号')],
  696. productName: [required('请输入商品名称')],
  697. version: [required('请输入版本号')],
  698. hsCode: [required('请输入HS编码')],
  699. unitPrice: [required('请输入人民币单价')],
  700. quantity: [required('请输入商品数量')],
  701. measurementUnit: [required('请输入计量单位')],
  702. domesticSalePrice: [required('请输入成品内销人民币价格')],
  703. importTotal: [required('请输入境外进口料件总价(RMB)')],
  704. domesticTotal: [required('请输入国内采购料件总价(RMB)')],
  705. }
  706. const bodyColumns = [
  707. {
  708. title: '商品序号',
  709. dataIndex: 'productNum',
  710. width: 120
  711. },
  712. {
  713. title: '商品编码',
  714. dataIndex: 'productCode',
  715. width: 100,
  716. fixed: 'left'
  717. },
  718. {
  719. title: '商品名称',
  720. dataIndex: 'productName',
  721. width: 100,
  722. fixed: 'left'
  723. },
  724. {
  725. title: '规格型号',
  726. dataIndex: 'specModel',
  727. width: 100
  728. },
  729. {
  730. title: '备案数量',
  731. dataIndex: 'recordQuantity',
  732. width: 100
  733. },
  734. {
  735. title: '备案计量单位',
  736. dataIndex: 'recordUnit',
  737. width: 120
  738. },
  739. {
  740. title: '申报计量单位',
  741. dataIndex: 'declareUnit',
  742. width: 120
  743. },
  744. {
  745. title: '法定计量单位',
  746. dataIndex: 'legalUnit',
  747. width: 120
  748. },
  749. {
  750. title: '法定第二计量单位',
  751. dataIndex: 'legalSecondUnit',
  752. width: 160
  753. },
  754. {
  755. title: '原产国(地区)',
  756. dataIndex: 'originCountry',
  757. width: 140
  758. },
  759. {
  760. title: '备案单价',
  761. dataIndex: 'recordPrice',
  762. width: 100
  763. },
  764. {
  765. title: '备案总价',
  766. dataIndex: 'recordTotalPrice',
  767. width: 100
  768. },
  769. {
  770. title: '币制',
  771. dataIndex: 'currency',
  772. width: 100
  773. },
  774. {
  775. title: '法定数量',
  776. dataIndex: 'legalQuantity',
  777. width: 100
  778. },
  779. {
  780. title: '第二法定数量',
  781. dataIndex: 'secondLegalQuantity',
  782. width: 120
  783. },
  784. {
  785. title: '重量比例因子',
  786. dataIndex: 'weightRatioFactor',
  787. width: 120
  788. },
  789. {
  790. title: '第一比例因子',
  791. dataIndex: 'firstRatioFactor',
  792. width: 120
  793. },
  794. {
  795. title: '第二比例因子',
  796. dataIndex: 'secondRatioFactor',
  797. width: 120
  798. },
  799. {
  800. title: '毛重(KG)',
  801. dataIndex: 'grossWeight',
  802. width: 120
  803. },
  804. {
  805. title: '净重(KG)',
  806. dataIndex: 'netWeight',
  807. width: 120
  808. },
  809. {
  810. title: '剩余备案数量',
  811. dataIndex: 'remainingRecordAmount',
  812. width: 120
  813. },
  814. {
  815. title: '进账累计数量',
  816. dataIndex: 'inAccountCumulativeAmount',
  817. width: 120
  818. },
  819. {
  820. title: '出账累计数量',
  821. dataIndex: 'outAccountCumulativeAmount',
  822. width: 120
  823. },
  824. {
  825. title: '库存累计数量',
  826. dataIndex: 'inventoryCumulativeAmount',
  827. width: 120
  828. },
  829. {
  830. title: '一线进区累计数量',
  831. dataIndex: 'firstInAmount',
  832. width: 160
  833. },
  834. {
  835. title: '一线出区累计数量',
  836. dataIndex: 'firstOutAmount',
  837. width: 160
  838. },
  839. {
  840. title: '二线进区累计数量',
  841. dataIndex: 'secondInAmount',
  842. width: 160
  843. },
  844. {
  845. title: '二线出区累计数量',
  846. dataIndex: 'secondOutAmount',
  847. width: 160
  848. },
  849. {
  850. title: '区内转入累计数量',
  851. dataIndex: 'intraZoneTransferInAmount',
  852. width: 160
  853. },
  854. {
  855. title: '区内转出累计数量',
  856. dataIndex: 'intraZoneTransferOutAmount',
  857. width: 160
  858. },
  859. {
  860. title: '区外转入累计数量',
  861. dataIndex: 'extraZoneTransferInAmount',
  862. width: 160
  863. },
  864. {
  865. title: '转至区外累计数量',
  866. dataIndex: 'transferToExtraZoneAmount',
  867. width: 160
  868. },
  869. {
  870. title: '补税累计数量',
  871. dataIndex: 'compensationTaxAmount',
  872. width: 120
  873. },
  874. {
  875. title: '核销累计数量',
  876. dataIndex: 'writeOffAmount',
  877. width: 120
  878. },
  879. {
  880. title: '修改标志',
  881. dataIndex: 'modifyFlag',
  882. width: 100
  883. },
  884. {
  885. title: '操作',
  886. dataIndex: 'action',
  887. width: 160,
  888. fixed: 'right'
  889. },
  890. ]
  891. const productColumns = [
  892. {
  893. title: '商品序号',
  894. dataIndex: 'productNumber',
  895. width: 120
  896. },
  897. {
  898. title: '预录入编号',
  899. dataIndex: 'ylCode',
  900. width: 120
  901. },
  902. {
  903. title: '企业编号',
  904. dataIndex: 'companyApplyCode',
  905. width: 120
  906. },
  907. {
  908. title: '企业名称',
  909. dataIndex: 'companyName',
  910. width: 120
  911. },
  912. {
  913. title: '加工增值核算备案编号',
  914. dataIndex: 'recordNumber',
  915. width: 180
  916. },
  917. {
  918. title: '主管关区代码',
  919. dataIndex: 'regionCode',
  920. width: 160
  921. },
  922. {
  923. title: '商品编号',
  924. dataIndex: 'productCode',
  925. width: 120
  926. },
  927. {
  928. title: '商品名称',
  929. dataIndex: 'productName',
  930. width: 120
  931. },
  932. {
  933. title: '版本号',
  934. dataIndex: 'version',
  935. width: 120
  936. },
  937. {
  938. title: 'HS编码',
  939. dataIndex: 'hsCode',
  940. width: 120
  941. },
  942. {
  943. title: '人民币单价',
  944. dataIndex: 'unitPrice',
  945. width: 120
  946. },
  947. {
  948. title: '商品数量',
  949. dataIndex: 'quantity',
  950. width: 120
  951. },
  952. {
  953. title: '计量单位',
  954. dataIndex: 'measurementUnit',
  955. width: 120
  956. },
  957. {
  958. title: '成品内销人民币价格',
  959. dataIndex: 'domesticSalePrice',
  960. width: 180
  961. },
  962. {
  963. title: '境外进口料件总价(RMB)',
  964. dataIndex: 'importTotal',
  965. width: 200
  966. },
  967. {
  968. title: '国内采购料件总价(RMB)',
  969. dataIndex: 'domesticTotal',
  970. width: 200
  971. },
  972. {
  973. title: '自主核算产品收益占比',
  974. dataIndex: 'selfRatio',
  975. width: 200
  976. },
  977. {
  978. title: '企业自主核算加工增值率(%)',
  979. dataIndex: 'selfRate',
  980. width: 200
  981. },
  982. {
  983. title: '备注',
  984. dataIndex: 'remark',
  985. width: 120
  986. },
  987. {
  988. title: '操作',
  989. dataIndex: 'action',
  990. width: 160,
  991. fixed: 'right'
  992. },
  993. ]
  994. const fileColumns = [
  995. {
  996. title: '附件名称',
  997. dataIndex: 'attachmentName',
  998. },
  999. {
  1000. title: '附件格式',
  1001. dataIndex: 'attachmentFormat',
  1002. },
  1003. {
  1004. title: '附件内容',
  1005. dataIndex: 'attachmentContent',
  1006. },
  1007. {
  1008. title: '上传时间',
  1009. dataIndex: 'uploadTime',
  1010. },
  1011. {
  1012. title: '操作',
  1013. dataIndex: 'action',
  1014. },
  1015. ]
  1016. // 验证并提交数据
  1017. const onSubmit = () => {
  1018. formRef.value
  1019. .validate()
  1020. .then(() => {
  1021. submitLoading.value = true
  1022. const formDataParam = cloneDeep(formData.value)
  1023. if (!formDataParam.id) {
  1024. formDataParam.qyRecardBodyAddParams = bodyList.value
  1025. formDataParam.qyRecordAttachmentAddParams = fileList.value
  1026. formDataParam.qyRecordProductAddParams = productList.value
  1027. } else {
  1028. formDataParam.qyRecardBodyEditParams = bodyList.value
  1029. formDataParam.qyRecordAttachmentEditParams = fileList.value
  1030. formDataParam.qyRecordProductAddParams = productList.value
  1031. delete formDataParam.qyRecardBodyAddParams
  1032. delete formDataParam.qyRecordAttachmentAddParams
  1033. }
  1034. formDataParam.status = '3'
  1035. qyRecordInfoApi
  1036. .qyRecordInfoSubmitForm(formDataParam, formDataParam.id)
  1037. .then(() => {
  1038. onClose()
  1039. emit('successful')
  1040. })
  1041. .finally(() => {
  1042. submitLoading.value = false
  1043. })
  1044. })
  1045. .catch(() => {
  1046. })
  1047. }
  1048. // 验证并提交数据
  1049. const onTemp = () => {
  1050. formRef.value
  1051. .validate()
  1052. .then(() => {
  1053. submitLoading.value = true
  1054. const formDataParam = cloneDeep(formData.value)
  1055. if (!formDataParam.id) {
  1056. formDataParam.qyRecardBodyAddParams = bodyList.value
  1057. formDataParam.qyRecordAttachmentAddParams = fileList.value
  1058. formDataParam.qyRecordProductAddParams = productList.value
  1059. } else {
  1060. formDataParam.qyRecardBodyEditParams = bodyList.value
  1061. formDataParam.qyRecordAttachmentEditParams = fileList.value
  1062. formDataParam.qyRecordProductAddParams = productList.value
  1063. delete formDataParam.qyRecardBodyAddParams
  1064. delete formDataParam.qyRecordAttachmentAddParams
  1065. }
  1066. formDataParam.status = '1'
  1067. qyRecordInfoApi
  1068. .qyRecordInfoSubmitForm(formDataParam, formDataParam.id)
  1069. .then(() => {
  1070. onClose()
  1071. emit('successful')
  1072. })
  1073. .finally(() => {
  1074. submitLoading.value = false
  1075. })
  1076. })
  1077. .catch(() => {
  1078. })
  1079. }
  1080. const onBodyReset = () => {
  1081. bodyFormRef.value?.resetFields()
  1082. bodyData.value = {}
  1083. }
  1084. const onBodyAdd = () => {
  1085. bodyFormRef.value
  1086. .validate()
  1087. .then(() => {
  1088. bodyList.value.push(Object.assign({id: new Date().getTime()}, bodyData.value))
  1089. onBodyReset()
  1090. message.success('插入料件信息成功!')
  1091. })
  1092. .catch(() => {
  1093. })
  1094. }
  1095. const onBodyEdit = () => {
  1096. bodyFormRef.value
  1097. .validate()
  1098. .then(() => {
  1099. let k = 'id'
  1100. if (k) {
  1101. bodyList.value.forEach(v => {
  1102. if (v[k] === bodyData.value[k]) {
  1103. Object.assign(v, bodyData.value)
  1104. }
  1105. })
  1106. }
  1107. onBodyReset()
  1108. message.success('编辑料件信息成功!')
  1109. })
  1110. .catch(() => {
  1111. })
  1112. }
  1113. const onBodyDel = (recode, index) => {
  1114. Modal.confirm({
  1115. title: '提示',
  1116. icon: createVNode(ExclamationCircleOutlined),
  1117. content: createVNode('div', { style: 'color:red;' }, `是否要删除${record.productName}?`),
  1118. centered: true,
  1119. onOk() {
  1120. bodyList.value.splice(index, 1)
  1121. },
  1122. onCancel() {
  1123. },
  1124. });
  1125. }
  1126. const deleteBatchBody = () => {
  1127. bodyList.value = bodyList.value.filter(v => {
  1128. let flag = true
  1129. bodySelectedRowKeys.value.forEach(s => {
  1130. if ((v.id && (v.id === s.id))) {
  1131. flag = false
  1132. }
  1133. })
  1134. return flag
  1135. })
  1136. }
  1137. const onProductReset = () => {
  1138. productFormRef.value?.resetFields()
  1139. productData.value = {
  1140. companyApplyCode: userInfo.companyNumber,
  1141. companyName: userInfo.companyName
  1142. }
  1143. }
  1144. const onProductAdd = () => {
  1145. productFormRef.value
  1146. .validate()
  1147. .then(() => {
  1148. productList.value.push(Object.assign({id: new Date().getTime()}, productData.value))
  1149. onProductReset()
  1150. message.success('插入产品信息成功!')
  1151. })
  1152. .catch(() => {
  1153. })
  1154. }
  1155. const onProductEdit = () => {
  1156. productFormRef.value
  1157. .validate()
  1158. .then(() => {
  1159. let k = 'id'
  1160. if (k) {
  1161. productList.value.forEach(v => {
  1162. if (v[k] === productData.value[k]) {
  1163. Object.assign(v, productData.value)
  1164. }
  1165. })
  1166. }
  1167. onProductReset()
  1168. message.success('编辑产品信息成功!')
  1169. })
  1170. .catch(() => {
  1171. })
  1172. }
  1173. const onProductDel = (recode, index) => {
  1174. Modal.confirm({
  1175. title: '提示',
  1176. icon: createVNode(ExclamationCircleOutlined),
  1177. content: createVNode('div', { style: 'color:red;' }, `是否要删除${record.productName}?`),
  1178. centered: true,
  1179. onOk() {
  1180. productList.value.splice(index, 1)
  1181. },
  1182. onCancel() {
  1183. },
  1184. });
  1185. }
  1186. const deleteBatchProduct = () => {
  1187. productList.value = productList.value.filter(v => {
  1188. let flag = true
  1189. productSelectedRowKeys.value.forEach(s => {
  1190. if ((v.id && (v.id === s.id))) {
  1191. flag = false
  1192. }
  1193. })
  1194. return flag
  1195. })
  1196. }
  1197. const getFileExtension = (filename) => {
  1198. // 使用lastIndexOf查找最后一个"."的位置
  1199. var dotIndex = filename.lastIndexOf(".");
  1200. // 如果找到了".",则提取从"."之后的子串作为后缀名
  1201. if (dotIndex !== -1 && dotIndex < filename.length - 1) { // 确保"."不是字符串的最后一个字符
  1202. return filename.slice(dotIndex + 1); // slice从dotIndex+1开始到字符串结束
  1203. } else {
  1204. // 如果没有找到".",返回空字符串表示没有后缀
  1205. return "";
  1206. }
  1207. }
  1208. const fileChange = (file) => {
  1209. if (file) {
  1210. const f = ref_upload.value.uploadFileList()[0]
  1211. fileList.value.push({
  1212. id: new Date().getTime(),
  1213. attachmentUrl: f.url,
  1214. attachmentName: f.name,
  1215. attachmentFormat: getFileExtension(f.name),
  1216. attachmentContent: '',
  1217. uploadTime: proxy.$util.YMDHms(new Date()),
  1218. })
  1219. fileData.value.fileUrl = ''
  1220. showFileUpload.value = false
  1221. setTimeout(() => {
  1222. showFileUpload.value = true
  1223. }, 0)
  1224. }
  1225. }
  1226. const onFileDel = (recode, index) => {
  1227. Modal.confirm({
  1228. title: '提示',
  1229. icon: createVNode(ExclamationCircleOutlined),
  1230. content: createVNode('div', { style: 'color:red;' }, `是否要删除?`),
  1231. centered: true,
  1232. onOk() {
  1233. fileList.value.splice(index, 1)
  1234. },
  1235. onCancel() {
  1236. },
  1237. });
  1238. }
  1239. const deleteBatchFile = () => {
  1240. fileList.value = fileList.value.filter(v => {
  1241. let flag = true
  1242. fileSelectedRowKeys.value.forEach(s => {
  1243. if ((v.id && (v.id === s.id))) {
  1244. flag = false
  1245. }
  1246. })
  1247. return flag
  1248. })
  1249. }
  1250. const onChangeRecordQuantity = () => {
  1251. setTimeout(() => {
  1252. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.recordPrice)) {
  1253. bodyData.value.recordTotalPrice = proxy.$util.multiplication(bodyData.value.recordQuantity, bodyData.value.recordPrice)
  1254. } else {
  1255. bodyData.value.recordTotalPrice = ''
  1256. }
  1257. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.legalQuantity) && (Number(bodyData.value.legalQuantity) > 0)) {
  1258. bodyData.value.weightRatioFactor = (Number(bodyData.value.recordQuantity) / Number(bodyData.value.legalQuantity)).toFixed(2)
  1259. } else {
  1260. bodyData.value.weightRatioFactor = ''
  1261. }
  1262. bodyData.value.firstRatioFactor = bodyData.value.weightRatioFactor
  1263. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  1264. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  1265. } else {
  1266. bodyData.value.remainingRecordAmount = ''
  1267. }
  1268. }, 100)
  1269. }
  1270. const onChangeRecordPrice = () => {
  1271. setTimeout(() => {
  1272. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.recordPrice)) {
  1273. bodyData.value.recordTotalPrice = proxy.$util.multiplication(bodyData.value.recordQuantity, bodyData.value.recordPrice)
  1274. } else {
  1275. bodyData.value.recordTotalPrice = ''
  1276. }
  1277. }, 100)
  1278. }
  1279. const onChangeLegalQuantity = () => {
  1280. setTimeout(() => {
  1281. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.legalQuantity) && (Number(bodyData.value.legalQuantity) > 0)) {
  1282. bodyData.value.weightRatioFactor = (Number(bodyData.value.recordQuantity) / Number(bodyData.value.legalQuantity)).toFixed(2)
  1283. } else {
  1284. bodyData.value.weightRatioFactor = ''
  1285. }
  1286. bodyData.value.firstRatioFactor = bodyData.value.weightRatioFactor
  1287. }, 100)
  1288. }
  1289. const onChangeInAccountCumulativeAmount = () => {
  1290. setTimeout(() => {
  1291. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  1292. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  1293. } else {
  1294. bodyData.value.remainingRecordAmount = ''
  1295. }
  1296. }, 100)
  1297. }
  1298. const onChangeOutAccountCumulativeAmount = () => {
  1299. setTimeout(() => {
  1300. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  1301. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  1302. } else {
  1303. bodyData.value.remainingRecordAmount = ''
  1304. }
  1305. }, 100)
  1306. }
  1307. let lastFetchId = 0;
  1308. const fetchSp = debounce(value => {
  1309. lastFetchId += 1;
  1310. const fetchId = lastFetchId;
  1311. spOptions.value = [];
  1312. fetchingSp.value = true;
  1313. qyRecordProductDictApi.qyRecordProductDictPage({
  1314. current: 1,
  1315. size: 10000,
  1316. productCode: value
  1317. }).then((res) => {
  1318. if (fetchId !== lastFetchId) {
  1319. return;
  1320. }
  1321. const arr = res.records.map(v => {
  1322. v.label = v.productName
  1323. v.value = v.productCode
  1324. return v
  1325. });
  1326. spOptions.value = arr
  1327. fetchingSp.value = false
  1328. })
  1329. }, 300);
  1330. const onChangeSp = (val, obj) => {
  1331. productData.value.productName = obj.productName
  1332. productData.value.version = 1
  1333. productData.value.hsCode = val
  1334. productData.value.measurementUnit = (obj.firstUnitCode || obj.firstUnitName) ? (obj.firstUnitCode + '-' + obj.firstUnitName) : ''
  1335. }
  1336. const fetchLj = debounce(value => {
  1337. lastFetchId += 1;
  1338. const fetchId = lastFetchId;
  1339. ljOptions.value = [];
  1340. fetchingLj.value = true;
  1341. qyRecordProductDictApi.qyRecordProductDictPage({
  1342. current: 1,
  1343. size: 10000,
  1344. productCode: value
  1345. }).then((res) => {
  1346. if (fetchId !== lastFetchId) {
  1347. return;
  1348. }
  1349. const arr = res.records.map(v => {
  1350. v.label = v.productName
  1351. v.value = v.productCode
  1352. return v
  1353. });
  1354. ljOptions.value = arr
  1355. fetchingLj.value = false
  1356. })
  1357. }, 300);
  1358. const onChangeLj = (val, obj) => {
  1359. bodyData.value.productName = obj.productName
  1360. bodyData.value.legalUnit = (obj.firstUnitCode || obj.firstUnitName) ? (obj.firstUnitCode + '-' + obj.firstUnitName) : ''
  1361. bodyData.value.legalSecondUnit = (obj.secondUnitCode || obj.secondUnitName) ? (obj.secondUnitCode + '-' + obj.secondUnitName) : ''
  1362. }
  1363. const onChangeSelfRate = () => {
  1364. setTimeout(() => {
  1365. if (proxy.$util.isValue(productData.value.domesticSalePrice) && proxy.$util.isValue(productData.value.importTotal) && proxy.$util.isValue(productData.value.domesticTotal) && (Number(productData.value.importTotal) + Number(productData.value.domesticTotal) > 0)) {
  1366. productData.value.selfRate = ((Number(productData.value.domesticSalePrice) - Number(productData.value.importTotal) - Number(productData.value.domesticTotal)) / (Number(productData.value.importTotal) + Number(productData.value.domesticTotal)) * 100).toFixed(2)
  1367. } else {
  1368. productData.value.selfRate = ''
  1369. }
  1370. }, 100)
  1371. }
  1372. // 抛出函数
  1373. defineExpose({
  1374. onOpen
  1375. })
  1376. </script>
  1377. <style lang="less" scoped>
  1378. .file-tips {
  1379. background-color: rgb(235, 245, 255);
  1380. border: 1px solid rgb(214, 235, 255);
  1381. border-radius: 5px;
  1382. color: rgb(153, 153, 153);
  1383. padding: 10px 20px;
  1384. margin-bottom: 10px;
  1385. }
  1386. </style>