detail.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946
  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="3" header="附件信息">
  321. <template v-if="!isView">
  322. <div class="file-tips">
  323. <InfoCircleFilled style="margin-right: 4px;"/>友情提示<br/>
  324. 1、附件大小要求不超过4M,如果文件过大,建议拆分多个上传;<br/>
  325. 2、附件格式要求:PDF文件;<br/>
  326. 3、同一附件类型可以上传多个附件;<br/>
  327. 4、附件传输过程中会出现传输失败的情况,请随时关注附件传输状态;<br/>
  328. 5、要求上传复印件的可上传原件的扫描件。
  329. </div>
  330. <xn-upload ref="ref_upload" v-model:value="fileData.fileUrl" @onChange="fileChange" accept=".pdf" v-if="showFileUpload"/>
  331. <div style="margin-top: 10px;">
  332. <xn-batch-delete
  333. :selectedRowKeys="fileSelectedRowKeys"
  334. @batchDelete="deleteBatchFile"
  335. />
  336. </div>
  337. </template>
  338. <a-table
  339. style="margin-top: 10px"
  340. bordered
  341. :dataSource="fileList"
  342. :columns="fileColumns"
  343. :pagination="false"
  344. :row-selection="fileOptions.rowSelection"
  345. >
  346. <template #bodyCell="{ column, record, index, text }">
  347. <template v-if="['attachmentName', 'attachmentFormat', 'attachmentContent'].includes(column.dataIndex)">
  348. <div>
  349. <a-input
  350. v-if="!isView"
  351. v-model:value="record[column.dataIndex]"
  352. style="margin: -5px 0"
  353. />
  354. <template v-else>
  355. {{ text }}
  356. </template>
  357. </div>
  358. </template>
  359. <template v-if="column.dataIndex === 'action'">
  360. <template v-if="isView">
  361. </template>
  362. <template v-else>
  363. <a-button type="link" danger size="small" @click="onFileDel(index)" v-if="!isView">删除</a-button>
  364. </template>
  365. </template>
  366. </template>
  367. </a-table>
  368. </a-collapse-panel>
  369. </a-collapse>
  370. </a-card>
  371. </template>
  372. <script setup name="qyRecordInfoDetail">
  373. import tool from '@/utils/tool'
  374. import {cloneDeep} from 'lodash-es'
  375. import {required} from '@/utils/formRules'
  376. import qyRecordInfoApi from '@/api/yqyc/qyRecordInfoApi'
  377. import {message, Modal} from "ant-design-vue";
  378. import {createVNode} from "vue";
  379. import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
  380. // 抽屉状态
  381. const { proxy } = getCurrentInstance()
  382. const emit = defineEmits({successful: null, onClose: null})
  383. const formRef = ref()
  384. const bodyFormRef = ref()
  385. const ref_upload = ref()
  386. // 表单数据
  387. const formData = ref({})
  388. const bodyData = ref({})
  389. const fileData = ref({})
  390. const submitLoading = ref(false)
  391. const isView = ref(false)
  392. const showFileUpload = ref(true)
  393. const tzTypeOptions = ref([])
  394. const applyTypeOptions = ref([])
  395. const companyTypeOptions = ref([])
  396. const activeKey = ref('1')
  397. const bodySelectedRowKeys = ref([])
  398. const bodyList = ref([])
  399. const userInfo = tool.data.get('USER_INFO')
  400. const legalUnitOptions = ref([])
  401. const originCountryOptions = ref([])
  402. const currencyOptions = ref([])
  403. // 列表选择配置
  404. const bodyOptions = {
  405. rowSelection: {
  406. onChange: (selectedRowKey, selectedRows) => {
  407. bodySelectedRowKeys.value = selectedRows
  408. }
  409. }
  410. }
  411. const fileSelectedRowKeys = ref([])
  412. const fileList = ref([])
  413. // 列表选择配置
  414. const fileOptions = {
  415. rowSelection: {
  416. onChange: (selectedRowKey, selectedRows) => {
  417. fileSelectedRowKeys.value = selectedRows
  418. }
  419. }
  420. }
  421. // 打开抽屉
  422. const onOpen = (record, view = false, type) => {
  423. isView.value = view
  424. if (record) {
  425. qyRecordInfoApi.qyRecordInfoDetail({id: record.id}).then(res => {
  426. formData.value = res
  427. bodyList.value = res.qyRecardBodyAddParams
  428. fileList.value = res.qyRecordAttachmentAddParams
  429. if (type) {
  430. formData.value.applyType = type
  431. }
  432. })
  433. } else {
  434. formData.value.companyCode = userInfo.companyNumber
  435. formData.value.companyName = userInfo.companyName
  436. formData.value.companyType = userInfo.companyType
  437. formData.value.companyAddress = userInfo.companyAddress
  438. formData.value.companyLinkMan = userInfo.contactName
  439. formData.value.companyLegalPhone = userInfo.contactPhone
  440. formData.value.companyJyFw = userInfo.businessScope
  441. formData.value.applyType = 'basq'
  442. }
  443. tzTypeOptions.value = tool.dictList('tzlx')
  444. applyTypeOptions.value = tool.dictList('qybalx')
  445. companyTypeOptions.value = tool.dictList('qylx')
  446. legalUnitOptions.value = tool.dictList('measurement unit')
  447. originCountryOptions.value = tool.dictList('address')
  448. currencyOptions.value = tool.dictList('hbdm')
  449. }
  450. // 关闭抽屉
  451. const onClose = () => {
  452. formRef.value.resetFields()
  453. formData.value = {}
  454. isView.value = true
  455. emit('onClose')
  456. }
  457. // 默认要校验的
  458. const formRules = {
  459. companyMainHgCode: [required('请输入海关注册编码')],
  460. companyCode: [required('请输入统一社会信用代码')],
  461. companyName: [required('请输入企业名称')],
  462. applyType: [required('请输入申报类型')],
  463. companyType: [required('请输入企业类型')],
  464. companyAddress: [required('请输入企业地址')],
  465. companyLinkMan: [required('请输入联系人')],
  466. companyLegalPhone: [required('请输入联系电话')],
  467. companyJyFw: [required('请输入经营范围')],
  468. }
  469. // 默认要校验的
  470. const bodyRules = {
  471. productCode: [required('请输入商品编码')],
  472. productName: [required('请输入商品名称')],
  473. specModel: [required('请输入规格型号')],
  474. recordQuantity: [required('请输入备案数量')],
  475. recordUnit: [required('请输入备案计量单位')],
  476. legalUnit: [required('请输入法定计量单位')],
  477. originCountry: [required('请输入原产国(地区)')],
  478. recordPrice: [required('请输入备案单价')],
  479. recordTotalPrice: [required('请输入备案总价')],
  480. currency: [required('请输入币制')],
  481. legalQuantity: [required('请输入法定数量')],
  482. recordAmount: [required('请输入备案数量')],
  483. weightRatioFactor: [required('请输入重量比例因子')],
  484. remainingRecordAmount: [required('请输入剩余备案数量')],
  485. inAccountCumulativeAmount: [required('请输入进账累计数量')],
  486. outAccountCumulativeAmount: [required('请输入出账累计数量')],
  487. }
  488. const bodyColumns = [
  489. {
  490. title: '商品编码',
  491. dataIndex: 'productCode',
  492. width: 100,
  493. fixed: 'left'
  494. },
  495. {
  496. title: '商品名称',
  497. dataIndex: 'productName',
  498. width: 100,
  499. fixed: 'left'
  500. },
  501. {
  502. title: '规格型号',
  503. dataIndex: 'specModel',
  504. width: 100
  505. },
  506. {
  507. title: '备案数量',
  508. dataIndex: 'recordQuantity',
  509. width: 100
  510. },
  511. {
  512. title: '备案计量单位',
  513. dataIndex: 'recordUnit',
  514. width: 120
  515. },
  516. {
  517. title: '申报计量单位',
  518. dataIndex: 'declareUnit',
  519. width: 120
  520. },
  521. {
  522. title: '法定计量单位',
  523. dataIndex: 'legalUnit',
  524. width: 120
  525. },
  526. {
  527. title: '法定第二计量单位',
  528. dataIndex: 'legalSecondUnit',
  529. width: 160
  530. },
  531. {
  532. title: '原产国(地区)',
  533. dataIndex: 'originCountry',
  534. width: 140
  535. },
  536. {
  537. title: '备案单价',
  538. dataIndex: 'recordPrice',
  539. width: 100
  540. },
  541. {
  542. title: '备案总价',
  543. dataIndex: 'recordTotalPrice',
  544. width: 100
  545. },
  546. {
  547. title: '币制',
  548. dataIndex: 'currency',
  549. width: 100
  550. },
  551. {
  552. title: '法定数量',
  553. dataIndex: 'legalQuantity',
  554. width: 100
  555. },
  556. {
  557. title: '第二法定数量',
  558. dataIndex: 'secondLegalQuantity',
  559. width: 120
  560. },
  561. {
  562. title: '重量比例因子',
  563. dataIndex: 'weightRatioFactor',
  564. width: 120
  565. },
  566. {
  567. title: '第一比例因子',
  568. dataIndex: 'firstRatioFactor',
  569. width: 120
  570. },
  571. {
  572. title: '第二比例因子',
  573. dataIndex: 'secondRatioFactor',
  574. width: 120
  575. },
  576. {
  577. title: '毛重(KG)',
  578. dataIndex: 'grossWeight',
  579. width: 120
  580. },
  581. {
  582. title: '净重(KG)',
  583. dataIndex: 'netWeight',
  584. width: 120
  585. },
  586. {
  587. title: '剩余备案数量',
  588. dataIndex: 'remainingRecordAmount',
  589. width: 120
  590. },
  591. {
  592. title: '进账累计数量',
  593. dataIndex: 'inAccountCumulativeAmount',
  594. width: 120
  595. },
  596. {
  597. title: '出账累计数量',
  598. dataIndex: 'outAccountCumulativeAmount',
  599. width: 120
  600. },
  601. {
  602. title: '库存累计数量',
  603. dataIndex: 'inventoryCumulativeAmount',
  604. width: 120
  605. },
  606. {
  607. title: '一线进区累计数量',
  608. dataIndex: 'firstInAmount',
  609. width: 160
  610. },
  611. {
  612. title: '一线出区累计数量',
  613. dataIndex: 'firstOutAmount',
  614. width: 160
  615. },
  616. {
  617. title: '二线进区累计数量',
  618. dataIndex: 'secondInAmount',
  619. width: 160
  620. },
  621. {
  622. title: '二线出区累计数量',
  623. dataIndex: 'secondOutAmount',
  624. width: 160
  625. },
  626. {
  627. title: '区内转入累计数量',
  628. dataIndex: 'intraZoneTransferInAmount',
  629. width: 160
  630. },
  631. {
  632. title: '区内转出累计数量',
  633. dataIndex: 'intraZoneTransferOutAmount',
  634. width: 160
  635. },
  636. {
  637. title: '区外转入累计数量',
  638. dataIndex: 'extraZoneTransferInAmount',
  639. width: 160
  640. },
  641. {
  642. title: '转至区外累计数量',
  643. dataIndex: 'transferToExtraZoneAmount',
  644. width: 160
  645. },
  646. {
  647. title: '补税累计数量',
  648. dataIndex: 'compensationTaxAmount',
  649. width: 120
  650. },
  651. {
  652. title: '核销累计数量',
  653. dataIndex: 'writeOffAmount',
  654. width: 120
  655. },
  656. {
  657. title: '修改标志',
  658. dataIndex: 'modifyFlag',
  659. width: 100
  660. },
  661. {
  662. title: '操作',
  663. dataIndex: 'action',
  664. width: 160,
  665. fixed: 'right'
  666. },
  667. ]
  668. const fileColumns = [
  669. {
  670. title: '附件名称',
  671. dataIndex: 'attachmentName',
  672. },
  673. {
  674. title: '附件格式',
  675. dataIndex: 'attachmentFormat',
  676. },
  677. {
  678. title: '附件内容',
  679. dataIndex: 'attachmentContent',
  680. },
  681. {
  682. title: '上传时间',
  683. dataIndex: 'uploadTime',
  684. },
  685. {
  686. title: '操作',
  687. dataIndex: 'action',
  688. },
  689. ]
  690. // 验证并提交数据
  691. const onSubmit = () => {
  692. formRef.value
  693. .validate()
  694. .then(() => {
  695. submitLoading.value = true
  696. const formDataParam = cloneDeep(formData.value)
  697. if (!formDataParam.id) {
  698. formDataParam.qyRecardBodyAddParams = bodyList.value
  699. formDataParam.qyRecordAttachmentAddParams = fileList.value
  700. } else {
  701. formDataParam.qyRecardBodyEditParams = bodyList.value
  702. formDataParam.qyRecordAttachmentEditParams = fileList.value
  703. delete formDataParam.qyRecardBodyAddParams
  704. delete formDataParam.qyRecordAttachmentAddParams
  705. }
  706. formDataParam.status = '3'
  707. qyRecordInfoApi
  708. .qyRecordInfoSubmitForm(formDataParam, formDataParam.id)
  709. .then(() => {
  710. onClose()
  711. emit('successful')
  712. })
  713. .finally(() => {
  714. submitLoading.value = false
  715. })
  716. })
  717. .catch(() => {
  718. })
  719. }
  720. // 验证并提交数据
  721. const onTemp = () => {
  722. formRef.value
  723. .validate()
  724. .then(() => {
  725. submitLoading.value = true
  726. const formDataParam = cloneDeep(formData.value)
  727. if (!formDataParam.id) {
  728. formDataParam.qyRecardBodyAddParams = bodyList.value
  729. formDataParam.qyRecordAttachmentAddParams = fileList.value
  730. } else {
  731. formDataParam.qyRecardBodyEditParams = bodyList.value
  732. formDataParam.qyRecordAttachmentEditParams = fileList.value
  733. delete formDataParam.qyRecardBodyAddParams
  734. delete formDataParam.qyRecordAttachmentAddParams
  735. }
  736. formDataParam.status = '1'
  737. qyRecordInfoApi
  738. .qyRecordInfoSubmitForm(formDataParam, formDataParam.id)
  739. .then(() => {
  740. onClose()
  741. emit('successful')
  742. })
  743. .finally(() => {
  744. submitLoading.value = false
  745. })
  746. })
  747. .catch(() => {
  748. })
  749. }
  750. const onBodyReset = () => {
  751. bodyFormRef.value.resetFields()
  752. bodyData.value = {}
  753. }
  754. const onBodyAdd = () => {
  755. bodyFormRef.value
  756. .validate()
  757. .then(() => {
  758. bodyList.value.push(Object.assign({__index: new Date().getTime()}, bodyData.value))
  759. onBodyReset()
  760. message.success('插入表体信息成功!')
  761. })
  762. .catch(() => {
  763. })
  764. }
  765. const onBodyEdit = () => {
  766. bodyFormRef.value
  767. .validate()
  768. .then(() => {
  769. let k = ''
  770. if (bodyData.value.id) {
  771. k = 'id'
  772. } else if (bodyData.value.__index) {
  773. k = '__index'
  774. }
  775. if (k) {
  776. bodyList.value.forEach(v => {
  777. if (v[k] === bodyData.value[k]) {
  778. Object.assign(v, bodyData.value)
  779. }
  780. })
  781. }
  782. onBodyReset()
  783. message.success('编辑表体信息成功!')
  784. })
  785. .catch(() => {
  786. })
  787. }
  788. const onBodyDel = (recode, index) => {
  789. Modal.confirm({
  790. title: '提示',
  791. icon: createVNode(ExclamationCircleOutlined),
  792. content: createVNode('div', { style: 'color:red;' }, `是否要删除${record.productName}?`),
  793. centered: true,
  794. onOk() {
  795. bodyList.value.splice(index, 1)
  796. },
  797. onCancel() {
  798. },
  799. });
  800. }
  801. const deleteBatchBody = () => {
  802. bodyList.value = bodyList.value.filter(v => {
  803. let flag = true
  804. bodySelectedRowKeys.value.forEach(s => {
  805. if ((v.id && (v.id === s.id)) || (v.__index && (v.__index === s.__index))) {
  806. flag = false
  807. }
  808. })
  809. return flag
  810. })
  811. }
  812. const getFileExtension = (filename) => {
  813. // 使用lastIndexOf查找最后一个"."的位置
  814. var dotIndex = filename.lastIndexOf(".");
  815. // 如果找到了".",则提取从"."之后的子串作为后缀名
  816. if (dotIndex !== -1 && dotIndex < filename.length - 1) { // 确保"."不是字符串的最后一个字符
  817. return filename.slice(dotIndex + 1); // slice从dotIndex+1开始到字符串结束
  818. } else {
  819. // 如果没有找到".",返回空字符串表示没有后缀
  820. return "";
  821. }
  822. }
  823. const fileChange = (file) => {
  824. if (file) {
  825. const f = ref_upload.value.uploadFileList()[0]
  826. fileList.value.push({
  827. __index: new Date().getTime(),
  828. attachmentUrl: f.url,
  829. attachmentName: f.name,
  830. attachmentFormat: getFileExtension(f.name),
  831. attachmentContent: '',
  832. uploadTime: proxy.$util.YMDHms(new Date()),
  833. })
  834. fileData.value.fileUrl = ''
  835. showFileUpload.value = false
  836. setTimeout(() => {
  837. showFileUpload.value = true
  838. }, 0)
  839. }
  840. }
  841. const onFileDel = (recode, index) => {
  842. Modal.confirm({
  843. title: '提示',
  844. icon: createVNode(ExclamationCircleOutlined),
  845. content: createVNode('div', { style: 'color:red;' }, `是否要删除?`),
  846. centered: true,
  847. onOk() {
  848. fileList.value.splice(index, 1)
  849. },
  850. onCancel() {
  851. },
  852. });
  853. }
  854. const deleteBatchFile = () => {
  855. fileList.value = fileList.value.filter(v => {
  856. let flag = true
  857. fileSelectedRowKeys.value.forEach(s => {
  858. if ((v.id && (v.id === s.id)) || (v.__index && (v.__index === s.__index))) {
  859. flag = false
  860. }
  861. })
  862. return flag
  863. })
  864. }
  865. const onChangeRecordQuantity = () => {
  866. setTimeout(() => {
  867. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.recordPrice)) {
  868. bodyData.value.recordTotalPrice = Number(bodyData.value.recordQuantity) * Number(bodyData.value.recordPrice)
  869. } else {
  870. bodyData.value.recordTotalPrice = ''
  871. }
  872. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.legalQuantity) && (Number(bodyData.value.legalQuantity) > 0)) {
  873. bodyData.value.weightRatioFactor = Number(bodyData.value.recordQuantity) / Number(bodyData.value.legalQuantity)
  874. } else {
  875. bodyData.value.weightRatioFactor = ''
  876. }
  877. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  878. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  879. } else {
  880. bodyData.value.remainingRecordAmount = ''
  881. }
  882. }, 100)
  883. }
  884. const onChangeRecordPrice = () => {
  885. setTimeout(() => {
  886. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.recordPrice)) {
  887. bodyData.value.recordTotalPrice = Number(bodyData.value.recordQuantity) * Number(bodyData.value.recordPrice)
  888. } else {
  889. bodyData.value.recordTotalPrice = ''
  890. }
  891. }, 100)
  892. }
  893. const onChangeLegalQuantity = () => {
  894. setTimeout(() => {
  895. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.legalQuantity) && (Number(bodyData.value.legalQuantity) > 0)) {
  896. bodyData.value.weightRatioFactor = Number(bodyData.value.recordQuantity) / Number(bodyData.value.legalQuantity)
  897. } else {
  898. bodyData.value.weightRatioFactor = ''
  899. }
  900. }, 100)
  901. }
  902. const onChangeWeightRatioFactor = () => {
  903. setTimeout(() => {
  904. bodyData.value.firstRatioFactor = bodyData.value.weightRatioFactor
  905. }, 100)
  906. }
  907. const onChangeInAccountCumulativeAmount = () => {
  908. setTimeout(() => {
  909. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  910. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  911. } else {
  912. bodyData.value.remainingRecordAmount = ''
  913. }
  914. }, 100)
  915. }
  916. const onChangeOutAccountCumulativeAmount = () => {
  917. setTimeout(() => {
  918. if (proxy.$util.isValue(bodyData.value.recordQuantity) && proxy.$util.isValue(bodyData.value.inAccountCumulativeAmount) && proxy.$util.isValue(bodyData.value.outAccountCumulativeAmount)) {
  919. bodyData.value.remainingRecordAmount = Number(bodyData.value.inAccountCumulativeAmount) - Number(bodyData.value.outAccountCumulativeAmount) - Number(bodyData.value.recordQuantity)
  920. } else {
  921. bodyData.value.remainingRecordAmount = ''
  922. }
  923. }, 100)
  924. }
  925. // 抛出函数
  926. defineExpose({
  927. onOpen
  928. })
  929. </script>
  930. <style lang="less" scoped>
  931. .file-tips {
  932. background-color: rgb(235, 245, 255);
  933. border: 1px solid rgb(214, 235, 255);
  934. border-radius: 5px;
  935. color: rgb(153, 153, 153);
  936. padding: 10px 20px;
  937. margin-bottom: 10px;
  938. }
  939. </style>