detail.vue 45 KB

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