detail.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394
  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(record, 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(record, 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(record, 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. fixed: 'left'
  712. },
  713. {
  714. title: '商品编码',
  715. dataIndex: 'productCode',
  716. width: 100,
  717. fixed: 'left'
  718. },
  719. {
  720. title: '商品名称',
  721. dataIndex: 'productName',
  722. width: 100,
  723. fixed: 'left'
  724. },
  725. {
  726. title: '规格型号',
  727. dataIndex: 'specModel',
  728. width: 100
  729. },
  730. {
  731. title: '备案数量',
  732. dataIndex: 'recordQuantity',
  733. width: 100
  734. },
  735. {
  736. title: '备案计量单位',
  737. dataIndex: 'recordUnit',
  738. width: 120
  739. },
  740. {
  741. title: '申报计量单位',
  742. dataIndex: 'declareUnit',
  743. width: 120
  744. },
  745. {
  746. title: '法定计量单位',
  747. dataIndex: 'legalUnit',
  748. width: 120
  749. },
  750. {
  751. title: '法定第二计量单位',
  752. dataIndex: 'legalSecondUnit',
  753. width: 160
  754. },
  755. {
  756. title: '原产国(地区)',
  757. dataIndex: 'originCountry',
  758. width: 140
  759. },
  760. {
  761. title: '备案单价',
  762. dataIndex: 'recordPrice',
  763. width: 100
  764. },
  765. {
  766. title: '备案总价',
  767. dataIndex: 'recordTotalPrice',
  768. width: 100
  769. },
  770. {
  771. title: '币制',
  772. dataIndex: 'currency',
  773. width: 100
  774. },
  775. {
  776. title: '法定数量',
  777. dataIndex: 'legalQuantity',
  778. width: 100
  779. },
  780. {
  781. title: '第二法定数量',
  782. dataIndex: 'secondLegalQuantity',
  783. width: 120
  784. },
  785. {
  786. title: '重量比例因子',
  787. dataIndex: 'weightRatioFactor',
  788. width: 120
  789. },
  790. {
  791. title: '第一比例因子',
  792. dataIndex: 'firstRatioFactor',
  793. width: 120
  794. },
  795. {
  796. title: '第二比例因子',
  797. dataIndex: 'secondRatioFactor',
  798. width: 120
  799. },
  800. {
  801. title: '毛重(KG)',
  802. dataIndex: 'grossWeight',
  803. width: 120
  804. },
  805. {
  806. title: '净重(KG)',
  807. dataIndex: 'netWeight',
  808. width: 120
  809. },
  810. {
  811. title: '剩余备案数量',
  812. dataIndex: 'remainingRecordAmount',
  813. width: 120
  814. },
  815. {
  816. title: '进账累计数量',
  817. dataIndex: 'inAccountCumulativeAmount',
  818. width: 120
  819. },
  820. {
  821. title: '出账累计数量',
  822. dataIndex: 'outAccountCumulativeAmount',
  823. width: 120
  824. },
  825. {
  826. title: '库存累计数量',
  827. dataIndex: 'inventoryCumulativeAmount',
  828. width: 120
  829. },
  830. {
  831. title: '一线进区累计数量',
  832. dataIndex: 'firstInAmount',
  833. width: 160
  834. },
  835. {
  836. title: '一线出区累计数量',
  837. dataIndex: 'firstOutAmount',
  838. width: 160
  839. },
  840. {
  841. title: '二线进区累计数量',
  842. dataIndex: 'secondInAmount',
  843. width: 160
  844. },
  845. {
  846. title: '二线出区累计数量',
  847. dataIndex: 'secondOutAmount',
  848. width: 160
  849. },
  850. {
  851. title: '区内转入累计数量',
  852. dataIndex: 'intraZoneTransferInAmount',
  853. width: 160
  854. },
  855. {
  856. title: '区内转出累计数量',
  857. dataIndex: 'intraZoneTransferOutAmount',
  858. width: 160
  859. },
  860. {
  861. title: '区外转入累计数量',
  862. dataIndex: 'extraZoneTransferInAmount',
  863. width: 160
  864. },
  865. {
  866. title: '转至区外累计数量',
  867. dataIndex: 'transferToExtraZoneAmount',
  868. width: 160
  869. },
  870. {
  871. title: '补税累计数量',
  872. dataIndex: 'compensationTaxAmount',
  873. width: 120
  874. },
  875. {
  876. title: '核销累计数量',
  877. dataIndex: 'writeOffAmount',
  878. width: 120
  879. },
  880. {
  881. title: '修改标志',
  882. dataIndex: 'modifyFlag',
  883. width: 100
  884. },
  885. {
  886. title: '操作',
  887. dataIndex: 'action',
  888. width: 160,
  889. fixed: 'right'
  890. },
  891. ]
  892. const productColumns = [
  893. {
  894. title: '商品序号',
  895. dataIndex: 'productNumber',
  896. width: 120
  897. },
  898. {
  899. title: '预录入编号',
  900. dataIndex: 'ylCode',
  901. width: 120
  902. },
  903. {
  904. title: '企业编号',
  905. dataIndex: 'companyApplyCode',
  906. width: 120
  907. },
  908. {
  909. title: '企业名称',
  910. dataIndex: 'companyName',
  911. width: 120
  912. },
  913. {
  914. title: '加工增值核算备案编号',
  915. dataIndex: 'recordNumber',
  916. width: 180
  917. },
  918. {
  919. title: '主管关区代码',
  920. dataIndex: 'regionCode',
  921. width: 160
  922. },
  923. {
  924. title: '商品编号',
  925. dataIndex: 'productCode',
  926. width: 120
  927. },
  928. {
  929. title: '商品名称',
  930. dataIndex: 'productName',
  931. width: 120
  932. },
  933. {
  934. title: '版本号',
  935. dataIndex: 'version',
  936. width: 120
  937. },
  938. {
  939. title: 'HS编码',
  940. dataIndex: 'hsCode',
  941. width: 120
  942. },
  943. {
  944. title: '人民币单价',
  945. dataIndex: 'unitPrice',
  946. width: 120
  947. },
  948. {
  949. title: '商品数量',
  950. dataIndex: 'quantity',
  951. width: 120
  952. },
  953. {
  954. title: '计量单位',
  955. dataIndex: 'measurementUnit',
  956. width: 120
  957. },
  958. {
  959. title: '成品内销人民币价格',
  960. dataIndex: 'domesticSalePrice',
  961. width: 180
  962. },
  963. {
  964. title: '境外进口料件总价(RMB)',
  965. dataIndex: 'importTotal',
  966. width: 200
  967. },
  968. {
  969. title: '国内采购料件总价(RMB)',
  970. dataIndex: 'domesticTotal',
  971. width: 200
  972. },
  973. {
  974. title: '自主核算产品收益占比',
  975. dataIndex: 'selfRatio',
  976. width: 200
  977. },
  978. {
  979. title: '企业自主核算加工增值率(%)',
  980. dataIndex: 'selfRate',
  981. width: 200
  982. },
  983. {
  984. title: '备注',
  985. dataIndex: 'remark',
  986. width: 120
  987. },
  988. {
  989. title: '操作',
  990. dataIndex: 'action',
  991. width: 160,
  992. fixed: 'right'
  993. },
  994. ]
  995. const fileColumns = [
  996. {
  997. title: '附件名称',
  998. dataIndex: 'attachmentName',
  999. },
  1000. {
  1001. title: '附件格式',
  1002. dataIndex: 'attachmentFormat',
  1003. },
  1004. {
  1005. title: '附件内容',
  1006. dataIndex: 'attachmentContent',
  1007. },
  1008. {
  1009. title: '上传时间',
  1010. dataIndex: 'uploadTime',
  1011. },
  1012. {
  1013. title: '操作',
  1014. dataIndex: 'action',
  1015. },
  1016. ]
  1017. // 验证并提交数据
  1018. const onSubmit = () => {
  1019. formRef.value
  1020. .validate()
  1021. .then(() => {
  1022. submitLoading.value = true
  1023. const formDataParam = cloneDeep(formData.value)
  1024. if (!formDataParam.id) {
  1025. formDataParam.qyRecardBodyAddParams = bodyList.value
  1026. formDataParam.qyRecordAttachmentAddParams = fileList.value
  1027. formDataParam.qyRecordProductAddParams = productList.value
  1028. } else {
  1029. formDataParam.qyRecardBodyEditParams = bodyList.value
  1030. formDataParam.qyRecordAttachmentEditParams = fileList.value
  1031. formDataParam.qyRecordProductAddParams = productList.value
  1032. delete formDataParam.qyRecardBodyAddParams
  1033. delete formDataParam.qyRecordAttachmentAddParams
  1034. }
  1035. formDataParam.status = '3'
  1036. qyRecordInfoApi
  1037. .qyRecordInfoSubmitForm(formDataParam, formDataParam.id)
  1038. .then(() => {
  1039. onClose()
  1040. emit('successful')
  1041. })
  1042. .finally(() => {
  1043. submitLoading.value = false
  1044. })
  1045. })
  1046. .catch(() => {
  1047. })
  1048. }
  1049. // 验证并提交数据
  1050. const onTemp = () => {
  1051. formRef.value
  1052. .validate()
  1053. .then(() => {
  1054. submitLoading.value = true
  1055. const formDataParam = cloneDeep(formData.value)
  1056. if (!formDataParam.id) {
  1057. formDataParam.qyRecardBodyAddParams = bodyList.value
  1058. formDataParam.qyRecordAttachmentAddParams = fileList.value
  1059. formDataParam.qyRecordProductAddParams = productList.value
  1060. } else {
  1061. formDataParam.qyRecardBodyEditParams = bodyList.value
  1062. formDataParam.qyRecordAttachmentEditParams = fileList.value
  1063. formDataParam.qyRecordProductAddParams = productList.value
  1064. delete formDataParam.qyRecardBodyAddParams
  1065. delete formDataParam.qyRecordAttachmentAddParams
  1066. }
  1067. formDataParam.status = '1'
  1068. qyRecordInfoApi
  1069. .qyRecordInfoSubmitForm(formDataParam, formDataParam.id)
  1070. .then(() => {
  1071. onClose()
  1072. emit('successful')
  1073. })
  1074. .finally(() => {
  1075. submitLoading.value = false
  1076. })
  1077. })
  1078. .catch(() => {
  1079. })
  1080. }
  1081. const onBodyReset = () => {
  1082. bodyFormRef.value?.resetFields()
  1083. bodyData.value = {}
  1084. }
  1085. const onBodyAdd = () => {
  1086. bodyFormRef.value
  1087. .validate()
  1088. .then(() => {
  1089. bodyList.value.push(Object.assign({id: new Date().getTime()}, bodyData.value))
  1090. onBodyReset()
  1091. message.success('插入料件信息成功!')
  1092. })
  1093. .catch(() => {
  1094. })
  1095. }
  1096. const onBodyEdit = () => {
  1097. bodyFormRef.value
  1098. .validate()
  1099. .then(() => {
  1100. let k = 'id'
  1101. if (k) {
  1102. bodyList.value.forEach(v => {
  1103. if (v[k] === bodyData.value[k]) {
  1104. Object.assign(v, bodyData.value)
  1105. }
  1106. })
  1107. }
  1108. onBodyReset()
  1109. message.success('编辑料件信息成功!')
  1110. })
  1111. .catch(() => {
  1112. })
  1113. }
  1114. const onBodyDel = (record, index) => {
  1115. Modal.confirm({
  1116. title: '提示',
  1117. icon: createVNode(ExclamationCircleOutlined),
  1118. content: createVNode('div', { style: 'color:red;' }, `是否要删除${record.productName}?`),
  1119. centered: true,
  1120. onOk() {
  1121. bodyList.value.splice(index, 1)
  1122. },
  1123. onCancel() {
  1124. },
  1125. });
  1126. }
  1127. const deleteBatchBody = () => {
  1128. bodyList.value = bodyList.value.filter(v => {
  1129. let flag = true
  1130. bodySelectedRowKeys.value.forEach(s => {
  1131. if ((v.id && (v.id === s.id))) {
  1132. flag = false
  1133. }
  1134. })
  1135. return flag
  1136. })
  1137. }
  1138. const onProductReset = () => {
  1139. productFormRef.value?.resetFields()
  1140. productData.value = {
  1141. companyApplyCode: userInfo.companyNumber,
  1142. companyName: userInfo.companyName
  1143. }
  1144. }
  1145. const onProductAdd = () => {
  1146. productFormRef.value
  1147. .validate()
  1148. .then(() => {
  1149. productList.value.push(Object.assign({id: new Date().getTime()}, productData.value))
  1150. onProductReset()
  1151. message.success('插入产品信息成功!')
  1152. })
  1153. .catch(() => {
  1154. })
  1155. }
  1156. const onProductEdit = () => {
  1157. productFormRef.value
  1158. .validate()
  1159. .then(() => {
  1160. let k = 'id'
  1161. if (k) {
  1162. productList.value.forEach(v => {
  1163. if (v[k] === productData.value[k]) {
  1164. Object.assign(v, productData.value)
  1165. }
  1166. })
  1167. }
  1168. onProductReset()
  1169. message.success('编辑产品信息成功!')
  1170. })
  1171. .catch(() => {
  1172. })
  1173. }
  1174. const onProductDel = (record, index) => {
  1175. Modal.confirm({
  1176. title: '提示',
  1177. icon: createVNode(ExclamationCircleOutlined),
  1178. content: createVNode('div', { style: 'color:red;' }, `是否要删除?`),
  1179. centered: true,
  1180. onOk() {
  1181. productList.value.splice(index, 1)
  1182. },
  1183. onCancel() {
  1184. },
  1185. });
  1186. }
  1187. const deleteBatchProduct = () => {
  1188. productList.value = productList.value.filter(v => {
  1189. let flag = true
  1190. productSelectedRowKeys.value.forEach(s => {
  1191. if ((v.id && (v.id === s.id))) {
  1192. flag = false
  1193. }
  1194. })
  1195. return flag
  1196. })
  1197. }
  1198. const getFileExtension = (filename) => {
  1199. // 使用lastIndexOf查找最后一个"."的位置
  1200. var dotIndex = filename.lastIndexOf(".");
  1201. // 如果找到了".",则提取从"."之后的子串作为后缀名
  1202. if (dotIndex !== -1 && dotIndex < filename.length - 1) { // 确保"."不是字符串的最后一个字符
  1203. return filename.slice(dotIndex + 1); // slice从dotIndex+1开始到字符串结束
  1204. } else {
  1205. // 如果没有找到".",返回空字符串表示没有后缀
  1206. return "";
  1207. }
  1208. }
  1209. const fileChange = (file) => {
  1210. if (file) {
  1211. const f = ref_upload.value.uploadFileList()[0]
  1212. fileList.value.push({
  1213. id: new Date().getTime(),
  1214. attachmentUrl: f.url,
  1215. attachmentName: f.name,
  1216. attachmentFormat: getFileExtension(f.name),
  1217. attachmentContent: '',
  1218. uploadTime: proxy.$util.YMDHms(new Date()),
  1219. })
  1220. fileData.value.fileUrl = ''
  1221. showFileUpload.value = false
  1222. setTimeout(() => {
  1223. showFileUpload.value = true
  1224. }, 0)
  1225. }
  1226. }
  1227. const onFileDel = (record, index) => {
  1228. Modal.confirm({
  1229. title: '提示',
  1230. icon: createVNode(ExclamationCircleOutlined),
  1231. content: createVNode('div', { style: 'color:red;' }, `是否要删除?`),
  1232. centered: true,
  1233. onOk() {
  1234. fileList.value.splice(index, 1)
  1235. },
  1236. onCancel() {
  1237. },
  1238. });
  1239. }
  1240. const deleteBatchFile = () => {
  1241. fileList.value = fileList.value.filter(v => {
  1242. let flag = true
  1243. fileSelectedRowKeys.value.forEach(s => {
  1244. if ((v.id && (v.id === s.id))) {
  1245. flag = false
  1246. }
  1247. })
  1248. return flag
  1249. })
  1250. }
  1251. const onChangeRecordQuantity = () => {
  1252. setTimeout(() => {
  1253. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.recordPrice)) {
  1254. bodyData.value.recordTotalPrice = proxy.$util.multiplication(bodyData.value.recordQuantity, bodyData.value.recordPrice)
  1255. } else {
  1256. bodyData.value.recordTotalPrice = ''
  1257. }
  1258. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.legalQuantity) && (Number(bodyData.value.legalQuantity) > 0)) {
  1259. bodyData.value.weightRatioFactor = (Number(bodyData.value.recordQuantity) / Number(bodyData.value.legalQuantity)).toFixed(2)
  1260. } else {
  1261. bodyData.value.weightRatioFactor = ''
  1262. }
  1263. bodyData.value.firstRatioFactor = bodyData.value.weightRatioFactor
  1264. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  1265. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  1266. } else {
  1267. bodyData.value.remainingRecordAmount = ''
  1268. }
  1269. }, 100)
  1270. }
  1271. const onChangeRecordPrice = () => {
  1272. setTimeout(() => {
  1273. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.recordPrice)) {
  1274. bodyData.value.recordTotalPrice = proxy.$util.multiplication(bodyData.value.recordQuantity, bodyData.value.recordPrice)
  1275. } else {
  1276. bodyData.value.recordTotalPrice = ''
  1277. }
  1278. }, 100)
  1279. }
  1280. const onChangeLegalQuantity = () => {
  1281. setTimeout(() => {
  1282. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.legalQuantity) && (Number(bodyData.value.legalQuantity) > 0)) {
  1283. bodyData.value.weightRatioFactor = (Number(bodyData.value.recordQuantity) / Number(bodyData.value.legalQuantity)).toFixed(2)
  1284. } else {
  1285. bodyData.value.weightRatioFactor = ''
  1286. }
  1287. bodyData.value.firstRatioFactor = bodyData.value.weightRatioFactor
  1288. }, 100)
  1289. }
  1290. const onChangeInAccountCumulativeAmount = () => {
  1291. setTimeout(() => {
  1292. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  1293. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  1294. } else {
  1295. bodyData.value.remainingRecordAmount = ''
  1296. }
  1297. }, 100)
  1298. }
  1299. const onChangeOutAccountCumulativeAmount = () => {
  1300. setTimeout(() => {
  1301. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  1302. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  1303. } else {
  1304. bodyData.value.remainingRecordAmount = ''
  1305. }
  1306. }, 100)
  1307. }
  1308. let lastFetchId = 0;
  1309. const fetchSp = debounce(value => {
  1310. lastFetchId += 1;
  1311. const fetchId = lastFetchId;
  1312. spOptions.value = [];
  1313. fetchingSp.value = true;
  1314. qyRecordProductDictApi.qyRecordProductDictPage({
  1315. current: 1,
  1316. size: 10000,
  1317. productCode: value
  1318. }).then((res) => {
  1319. if (fetchId !== lastFetchId) {
  1320. return;
  1321. }
  1322. const arr = res.records.map(v => {
  1323. v.label = v.productName
  1324. v.value = v.productCode
  1325. return v
  1326. });
  1327. spOptions.value = arr
  1328. fetchingSp.value = false
  1329. })
  1330. }, 300);
  1331. const onChangeSp = (val, obj) => {
  1332. productData.value.productName = obj.productName
  1333. productData.value.version = 1
  1334. productData.value.hsCode = val
  1335. productData.value.measurementUnit = (obj.firstUnitCode || obj.firstUnitName) ? (obj.firstUnitCode + '-' + obj.firstUnitName) : ''
  1336. }
  1337. const fetchLj = debounce(value => {
  1338. lastFetchId += 1;
  1339. const fetchId = lastFetchId;
  1340. ljOptions.value = [];
  1341. fetchingLj.value = true;
  1342. qyRecordProductDictApi.qyRecordProductDictPage({
  1343. current: 1,
  1344. size: 10000,
  1345. productCode: value
  1346. }).then((res) => {
  1347. if (fetchId !== lastFetchId) {
  1348. return;
  1349. }
  1350. const arr = res.records.map(v => {
  1351. v.label = v.productName
  1352. v.value = v.productCode
  1353. return v
  1354. });
  1355. ljOptions.value = arr
  1356. fetchingLj.value = false
  1357. })
  1358. }, 300);
  1359. const onChangeLj = (val, obj) => {
  1360. bodyData.value.productName = obj.productName
  1361. bodyData.value.legalUnit = (obj.firstUnitCode || obj.firstUnitName) ? (obj.firstUnitCode + '-' + obj.firstUnitName) : ''
  1362. bodyData.value.legalSecondUnit = (obj.secondUnitCode || obj.secondUnitName) ? (obj.secondUnitCode + '-' + obj.secondUnitName) : ''
  1363. }
  1364. const onChangeSelfRate = () => {
  1365. setTimeout(() => {
  1366. 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)) {
  1367. 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)
  1368. } else {
  1369. productData.value.selfRate = ''
  1370. }
  1371. }, 100)
  1372. }
  1373. // 抛出函数
  1374. defineExpose({
  1375. onOpen
  1376. })
  1377. </script>
  1378. <style lang="less" scoped>
  1379. .file-tips {
  1380. background-color: rgb(235, 245, 255);
  1381. border: 1px solid rgb(214, 235, 255);
  1382. border-radius: 5px;
  1383. color: rgb(153, 153, 153);
  1384. padding: 10px 20px;
  1385. margin-bottom: 10px;
  1386. }
  1387. </style>