detail.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923
  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="hfdrCode">
  23. <a-input v-model:value="formData.hfdrCode" :disabled="true" placeholder="请输入核放单预录入号" allow-clear />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :span="8">
  27. <a-form-item label="核放单号:" name="hfdCode">
  28. <a-input v-model:value="formData.hfdCode" :disabled="true" placeholder="请输入核放单号" allow-clear />
  29. </a-form-item>
  30. </a-col>
  31. <a-col :span="8">
  32. <a-form-item label="核放单类型:" name="hfdLx">
  33. <a-select v-model:value="formData.hfdLx" :disabled="isView" placeholder="请选择核放单类型" :options="hfdLxOptions" show-search allow-clear option-filter-prop="label"/>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :span="8">
  37. <a-form-item label="绑定类型:" name="bdlx">
  38. <a-select v-model:value="formData.bdlx" :disabled="isView" placeholder="请选择绑定类型" :options="bdlxOptions" show-search allow-clear option-filter-prop="label" @change="onChangeBdlx"/>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :span="8">
  42. <a-form-item label="关联核注清单编号:" name="glhzqdbh">
  43. <a-select v-model:value="formData.glhzqdbh" :disabled="isView || !formData.bdlx || formData.bdlx == 2" placeholder="请选择关联核注清单编号" :options="hzqdOptions" show-search allow-clear option-filter-prop="label" @change="onChangHzqd"/>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :span="8">
  47. <a-form-item label="台账编号:" name="ledgerCode">
  48. <a-input v-model:value="formData.ledgerCode" :disabled="true" placeholder="请选择关联核注清单编号" allow-clear/>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :span="8">
  52. <a-form-item label="进出标志:" name="jcbz">
  53. <a-select v-model:value="formData.jcbz" :disabled="isView" placeholder="请选择进出标志" :options="jcbzOptions" show-search allow-clear option-filter-prop="label"/>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :span="8">
  57. <a-form-item label="申报类型:" name="sblx">
  58. <a-select v-model:value="formData.sblx" :disabled="true" placeholder="请选择申报类型" :options="sblxOptions" show-search allow-clear option-filter-prop="label"/>
  59. </a-form-item>
  60. </a-col>
  61. <a-col :span="8">
  62. <a-form-item label="报关单号:" name="hfdBgCode">
  63. <a-select v-model:value="formData.hfdBgCode" :disabled="isView" placeholder="请选择报关单号" :options="bgdhOptions" show-search allow-clear option-filter-prop="label" @change="onChangBgdh"/>
  64. </a-form-item>
  65. </a-col>
  66. <a-col :span="8">
  67. <a-form-item label="承运车车牌号:" name="cyccph">
  68. <a-input v-model:value="formData.cyccph" :disabled="true" placeholder="请选择报关单号" allow-clear />
  69. </a-form-item>
  70. </a-col>
  71. <a-col :span="8">
  72. <a-form-item label="IC卡号(电子车牌):" name="ickh">
  73. <a-input v-model:value="formData.ickh" :disabled="true" placeholder="请选择报关单号" allow-clear />
  74. </a-form-item>
  75. </a-col>
  76. <a-col :span="8">
  77. <a-form-item label="车架号:" name="cjh">
  78. <a-input v-model:value="formData.cjh" :disabled="true" placeholder="请选择报关单号" allow-clear />
  79. </a-form-item>
  80. </a-col>
  81. <a-col :span="8">
  82. <a-form-item label="车架重(kg):" name="cjz">
  83. <a-input v-model:value="formData.cjz" :disabled="true" placeholder="请选择报关单号" allow-clear />
  84. </a-form-item>
  85. </a-col>
  86. <a-col :span="8">
  87. <a-form-item label="车自重(kg):" name="czz">
  88. <a-input v-model:value="formData.czz" :disabled="true" placeholder="请选择报关单号" allow-clear />
  89. </a-form-item>
  90. </a-col>
  91. <a-col :span="8">
  92. <a-form-item label="集装箱号:" name="jzxh">
  93. <a-select v-model:value="formData.jzxh" :disabled="isView || !formData.hfdBgCode" placeholder="请选择报关单号" :options="jzxhOptions" show-search allow-clear option-filter-prop="label" @change="onChangJzxh"/>
  94. </a-form-item>
  95. </a-col>
  96. <a-col :span="8">
  97. <a-form-item label="集装箱类型:" name="jzxlx">
  98. <a-input v-model:value="formData.jzxlx" :disabled="true" placeholder="请选择集装箱号" allow-clear />
  99. </a-form-item>
  100. </a-col>
  101. <a-col :span="8">
  102. <a-form-item label="总重量(kg):" name="zzl">
  103. <a-input v-model:value="formData.zzl" :disabled="true" placeholder="请选择集装箱号" allow-clear />
  104. </a-form-item>
  105. </a-col>
  106. <a-col :span="8">
  107. <a-form-item label="货物毛重量(kg):" name="hwmzl">
  108. <a-input v-model:value="formData.hwmzl" :disabled="true" placeholder="请选择集装箱号" allow-clear />
  109. </a-form-item>
  110. </a-col>
  111. <a-col :span="8">
  112. <a-form-item label="货物总净重(kg):" name="hwjzl">
  113. <a-input v-model:value="formData.hwjzl" :disabled="true" placeholder="请选择集装箱号" allow-clear />
  114. </a-form-item>
  115. </a-col>
  116. <a-col :span="8">
  117. <a-form-item label="申报企业名称:" name="sbqymc">
  118. <a-input v-model:value="formData.sbqymc" :disabled="true" placeholder="请输入申报企业名称" allow-clear />
  119. </a-form-item>
  120. </a-col>
  121. <a-col :span="8">
  122. <a-form-item label="申报企业编号:" name="sbqybh">
  123. <a-input v-model:value="formData.sbqybh" :disabled="true" placeholder="请输入申报企业编号" allow-clear />
  124. </a-form-item>
  125. </a-col>
  126. <a-col :span="8">
  127. <a-form-item label="申报企业社会信用代码:" name="sbqyshxydm">
  128. <a-input v-model:value="formData.sbqyshxydm" :disabled="true" placeholder="请输入申报企业社会信用代码" allow-clear />
  129. </a-form-item>
  130. </a-col>
  131. <a-col :span="8">
  132. <a-form-item label="录入单位代码:" name="lrdwdm">
  133. <a-input v-model:value="formData.lrdwdm" :disabled="isView" placeholder="请输入录入单位代码" allow-clear />
  134. </a-form-item>
  135. </a-col>
  136. <a-col :span="8">
  137. <a-form-item label="录入单位社会信用代码:" name="lrdwshxydm">
  138. <a-input v-model:value="formData.lrdwshxydm" :disabled="isView" placeholder="请输入录入单位社会信用代码" allow-clear />
  139. </a-form-item>
  140. </a-col>
  141. <a-col :span="8">
  142. <a-form-item label="录入单位名称:" name="lrdwmc">
  143. <a-input v-model:value="formData.lrdwmc" :disabled="isView" placeholder="请输入录入单位名称" allow-clear />
  144. </a-form-item>
  145. </a-col>
  146. <a-col :span="8">
  147. <a-form-item label="企业单位内部编号:" name="qydwnbbh">
  148. <a-input v-model:value="formData.qydwnbbh" :disabled="isView" placeholder="请输入企业单位内部编号" allow-clear />
  149. </a-form-item>
  150. </a-col>
  151. <a-col :span="8">
  152. <a-form-item label="过卡1时间:" name="gkonesj">
  153. <a-date-picker v-model:value="formData.gkonesj" :disabled="isView" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择过卡1时间" style="width: 100%" allow-clear/>
  154. </a-form-item>
  155. </a-col>
  156. <a-col :span="8">
  157. <a-form-item label="过卡2时间:" name="gktwosj">
  158. <a-date-picker v-model:value="formData.gktwosj" :disabled="isView" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择过卡2时间" style="width: 100%" allow-clear/>
  159. </a-form-item>
  160. </a-col>
  161. <a-col :span="8">
  162. <a-form-item label="申请人:" name="sqr">
  163. <a-input v-model:value="formData.sqr" :disabled="isView" placeholder="请输入申请人" allow-clear />
  164. </a-form-item>
  165. </a-col>
  166. <a-col :span="8">
  167. <a-form-item label="申请人联系方式:" name="sqrlxfs">
  168. <a-input v-model:value="formData.sqrlxfs" :disabled="isView" placeholder="请输入申请人联系方式" allow-clear />
  169. </a-form-item>
  170. </a-col>
  171. </a-row>
  172. </a-form>
  173. </a-collapse-panel>
  174. <a-collapse-panel key="2" header="核放单表体" v-if="showHfdbt">
  175. <!-- <a-button type="primary" @click="onBodyReset" v-if="!isView" style="margin-bottom: 20px;">重置</a-button>-->
  176. <a-form ref="bodyFormRef" :model="bodyData" style="margin-bottom: 20px;">
  177. <a-row :gutter="16">
  178. <a-col :span="8">
  179. <a-form-item label="关联商品序号:" name="productOrderCode">
  180. <a-input v-model:value="bodyData.productOrderCode" :disabled="true" placeholder="请输入关联商品序号" allow-clear />
  181. </a-form-item>
  182. </a-col>
  183. <a-col :span="8">
  184. <a-form-item label="商品编号:" name="productCode">
  185. <a-input v-model:value="bodyData.productCode" :disabled="true" placeholder="请输入商品编号" allow-clear />
  186. </a-form-item>
  187. </a-col>
  188. <a-col :span="8">
  189. <a-form-item label="商品名称:" name="productName">
  190. <a-input v-model:value="bodyData.productName" :disabled="true" placeholder="请输入商品名称" allow-clear />
  191. </a-form-item>
  192. </a-col>
  193. <a-col :span="8">
  194. <a-form-item label="申报计量单位:" name="declareUnit">
  195. <a-input v-model:value="bodyData.declareUnit" :disabled="true" placeholder="请输入申报计量单位" allow-clear />
  196. </a-form-item>
  197. </a-col>
  198. <a-col :span="8">
  199. <a-form-item label="申报数量:" name="sbNum">
  200. <a-input v-model:value="bodyData.sbNum" :disabled="true" placeholder="请输入申报数量" allow-clear />
  201. </a-form-item>
  202. </a-col>
  203. <a-col :span="8">
  204. <a-form-item label="货物毛重:" name="grossWeight">
  205. <a-input v-model:value="bodyData.grossWeight" :disabled="true" placeholder="请输入货物毛重" allow-clear />
  206. </a-form-item>
  207. </a-col>
  208. <a-col :span="8">
  209. <a-form-item label="货物净重:" name="netWeight">
  210. <a-input v-model:value="bodyData.netWeight" :disabled="true" placeholder="请输入货物净重" allow-clear />
  211. </a-form-item>
  212. </a-col>
  213. <a-col :span="8">
  214. <a-form-item label="备注:" name="remark">
  215. <a-input v-model:value="bodyData.remark" :disabled="true" placeholder="请输入备注" allow-clear />
  216. </a-form-item>
  217. </a-col>
  218. </a-row>
  219. </a-form>
  220. <!-- <template v-if="!isView">-->
  221. <!-- <a-button type="primary" style="margin-right: 8px;" v-if="!(bodyData.id || bodyData.__index)" @click="onBodyAdd">插入</a-button>-->
  222. <!-- <a-button type="primary" style="margin-right: 8px;" v-else @click="onBodyEdit">保存</a-button>-->
  223. <!-- <xn-batch-delete-->
  224. <!-- :selectedRowKeys="bodySelectedRowKeys"-->
  225. <!-- @batchDelete="deleteBatchBody"-->
  226. <!-- />-->
  227. <!-- </template>-->
  228. <a-table
  229. style="margin-top: 10px"
  230. bordered
  231. :dataSource="bodyList"
  232. :columns="bodyColumns"
  233. :pagination="false"
  234. :scroll="{ x: 2000 }"
  235. :row-selection="bodyOptions.rowSelection"
  236. >
  237. <template #bodyCell="{ column, record, index }">
  238. <template v-if="column.dataIndex === 'action'">
  239. <a-button type="link" primary size="small" @click="onBodyReset(), bodyData = cloneDeep(record)">查看</a-button>
  240. <!-- <template v-if="isView">-->
  241. <!-- <a-button type="link" primary size="small" @click="onBodyReset(), bodyData = cloneDeep(record)">查看</a-button>-->
  242. <!-- </template>-->
  243. <!-- <template v-else>-->
  244. <!-- <a-button type="link" primary size="small" @click="onBodyReset(), bodyData = cloneDeep(record)">编辑</a-button>-->
  245. <!-- <a-button type="link" danger size="small" @click="onBodyDel(index)">删除</a-button>-->
  246. <!-- </template>-->
  247. </template>
  248. </template>
  249. </a-table>
  250. </a-collapse-panel>
  251. <a-collapse-panel key="4" header="关联单证" v-if="showGldz">
  252. <a-button type="primary" @click="onRelationReset" v-if="!isView" style="margin-bottom: 20px;">重置</a-button>
  253. <a-form ref="relationFormRef" :model="relationData" :rules="relationRules" style="margin-bottom: 20px;">
  254. <a-row :gutter="16">
  255. <a-col :span="8">
  256. <a-form-item label="核放清单编号:" name="hfdCode">
  257. <a-input v-model:value="relationData.hfdCode" :disabled="true" placeholder="请输入核放清单编号" allow-clear />
  258. </a-form-item>
  259. </a-col>
  260. <a-col :span="8">
  261. <a-form-item label="关联单证类型:" name="dzType">
  262. <a-select v-model:value="relationData.dzType" :disabled="isView" placeholder="请选择关联单证类型" :options="dzTypeOptions" show-search allow-clear option-filter-prop="label"/>
  263. </a-form-item>
  264. </a-col>
  265. <a-col :span="8">
  266. <a-form-item label="关联单证编号:" name="dzCode">
  267. <a-input v-model:value="relationData.dzCode" :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="!(relationData.id || relationData.__index)" @click="onRelationAdd">插入</a-button>
  274. <a-button type="primary" style="margin-right: 8px;" v-else @click="onRelationEdit">保存</a-button>
  275. <xn-batch-delete
  276. :selectedRowKeys="relationSelectedRowKeys"
  277. @batchDelete="deleteBatchRelation"
  278. />
  279. </template>
  280. <a-table
  281. style="margin-top: 10px"
  282. bordered
  283. :dataSource="relationList"
  284. :columns="relationColumns"
  285. :pagination="false"
  286. :scroll="{ x: 2000 }"
  287. :row-selection="relationOptions.rowSelection"
  288. >
  289. <template #bodyCell="{ column, record, index }">
  290. <template v-if="column.dataIndex === 'dzType'">
  291. {{ $TOOL.dictTypeData('gldzlx', record.dzType) }}
  292. </template>
  293. <template v-if="column.dataIndex === 'action'">
  294. <template v-if="isView">
  295. <a-button type="link" primary size="small" @click="onRelationReset(), relationData = cloneDeep(record)">查看</a-button>
  296. </template>
  297. <template v-else>
  298. <a-button type="link" primary size="small" @click="onRelationReset(), relationData = cloneDeep(record)">编辑</a-button>
  299. <a-button type="link" danger size="small" @click="onRelationDel(index)">删除</a-button>
  300. </template>
  301. </template>
  302. </template>
  303. </a-table>
  304. </a-collapse-panel>
  305. <a-collapse-panel key="3" header="附件信息">
  306. <template v-if="!isView">
  307. <div class="file-tips">
  308. <InfoCircleFilled style="margin-right: 4px;"/>友情提示<br/>
  309. 1、附件大小要求不超过4M,如果文件过大,建议拆分多个上传;<br/>
  310. 2、附件格式要求:PDF文件;<br/>
  311. 3、同一附件类型可以上传多个附件;<br/>
  312. 4、附件传输过程中会出现传输失败的情况,请随时关注附件传输状态;<br/>
  313. 5、要求上传复印件的可上传原件的扫描件。
  314. </div>
  315. <xn-upload ref="ref_upload" v-model:value="fileData.fileUrl" @onChange="fileChange" accept=".pdf" v-if="showFileUpload"/>
  316. <div style="margin-top: 10px;">
  317. <xn-batch-delete
  318. :selectedRowKeys="fileSelectedRowKeys"
  319. @batchDelete="deleteBatchFile"
  320. />
  321. </div>
  322. </template>
  323. <a-table
  324. style="margin-top: 10px"
  325. bordered
  326. :dataSource="fileList"
  327. :columns="fileColumns"
  328. :pagination="false"
  329. :row-selection="fileOptions.rowSelection"
  330. >
  331. <template #bodyCell="{ column, record, index, text }">
  332. <template v-if="['attachmentName', 'attachmentFormat', 'attachmentContent'].includes(column.dataIndex)">
  333. <div>
  334. <a-input
  335. v-if="!isView"
  336. v-model:value="record[column.dataIndex]"
  337. style="margin: -5px 0"
  338. />
  339. <template v-else>
  340. {{ text }}
  341. </template>
  342. </div>
  343. </template>
  344. <template v-if="column.dataIndex === 'action'">
  345. <template v-if="isView">
  346. </template>
  347. <template v-else>
  348. <a-button type="link" danger size="small" @click="onFileDel(index)" v-if="!isView">删除</a-button>
  349. </template>
  350. </template>
  351. </template>
  352. </a-table>
  353. </a-collapse-panel>
  354. </a-collapse>
  355. </a-card>
  356. </template>
  357. <script setup name="qySecondlineHfdDetail">
  358. import tool from '@/utils/tool'
  359. import { cloneDeep } from 'lodash-es'
  360. import { required } from '@/utils/formRules'
  361. import qySecondlineHfdApi from '@/api/yqyc/qySecondlineHfdApi'
  362. import {message, Modal} from "ant-design-vue";
  363. import {createVNode} from "vue";
  364. import {ExclamationCircleOutlined} from "@ant-design/icons-vue";
  365. import qySecondlineHzdTzApi from "@/api/yqyc/qySecondLineHzdTzApi";
  366. const { proxy } = getCurrentInstance()
  367. // 抽屉状态
  368. const emit = defineEmits({ successful: null, onClose: null })
  369. const formRef = ref()
  370. const bodyFormRef = ref()
  371. const relationFormRef = ref()
  372. const ref_upload = ref()
  373. const activeKey = ref('1')
  374. // 表单数据
  375. const formData = ref({})
  376. const bodyData = ref({})
  377. const fileData = ref({})
  378. const relationData = ref({})
  379. const submitLoading = ref(false)
  380. const isView = ref(false)
  381. const hfdLxOptions = ref([])
  382. const jcbzOptions = ref([])
  383. const sblxOptions = ref([])
  384. const bdlxOptions = ref([])
  385. const dzTypeOptions = ref([])
  386. const hzqdOptions = ref([])
  387. const bgdhOptions = ref([])
  388. const jzxhOptions = ref([])
  389. const statusOptions = ref([])
  390. const userInfo = tool.data.get('USER_INFO')
  391. const showFileUpload = ref(true)
  392. const showGldz = ref(false)
  393. const showHfdbt = ref(false)
  394. const bodySelectedRowKeys = ref([])
  395. const bodyList = ref([])
  396. // 列表选择配置
  397. const bodyOptions = {
  398. rowSelection: {
  399. onChange: (selectedRowKey, selectedRows) => {
  400. bodySelectedRowKeys.value = selectedRows
  401. }
  402. }
  403. }
  404. const relationSelectedRowKeys = ref([])
  405. const relationList = ref([])
  406. // 列表选择配置
  407. const relationOptions = {
  408. rowSelection: {
  409. onChange: (selectedRowKey, selectedRows) => {
  410. relationSelectedRowKeys.value = selectedRows
  411. }
  412. }
  413. }
  414. const fileSelectedRowKeys = ref([])
  415. const fileList = ref([])
  416. // 列表选择配置
  417. const fileOptions = {
  418. rowSelection: {
  419. onChange: (selectedRowKey, selectedRows) => {
  420. fileSelectedRowKeys.value = selectedRows
  421. }
  422. }
  423. }
  424. const bodyColumns = [
  425. {
  426. title: '关联商品序号',
  427. dataIndex: 'productOrderCode',
  428. },
  429. {
  430. title: '商品编号',
  431. dataIndex: 'productCode',
  432. },
  433. {
  434. title: '商品名称',
  435. dataIndex: 'productName',
  436. },
  437. {
  438. title: '申报计量单位',
  439. dataIndex: 'declareUnit',
  440. },
  441. {
  442. title: '申报数量',
  443. dataIndex: 'sbNum',
  444. },
  445. {
  446. title: '货物毛重',
  447. dataIndex: 'grossWeight',
  448. },
  449. {
  450. title: '货物净重',
  451. dataIndex: 'netWeight',
  452. },
  453. {
  454. title: '备注',
  455. dataIndex: 'remark',
  456. },
  457. {
  458. title: '操作',
  459. dataIndex: 'action',
  460. width: 200,
  461. fixed: 'right'
  462. },
  463. ]
  464. const relationColumns = [
  465. {
  466. title: '核放清单编号',
  467. dataIndex: 'hfdCode',
  468. },
  469. {
  470. title: '关联单证编号',
  471. dataIndex: 'dzCode',
  472. },
  473. {
  474. title: '关联单证类型',
  475. dataIndex: 'dzType',
  476. },
  477. {
  478. title: '操作',
  479. dataIndex: 'action',
  480. },
  481. ]
  482. const fileColumns = [
  483. {
  484. title: '附件名称',
  485. dataIndex: 'attachmentName',
  486. },
  487. {
  488. title: '附件格式',
  489. dataIndex: 'attachmentFormat',
  490. },
  491. {
  492. title: '附件内容',
  493. dataIndex: 'attachmentContent',
  494. },
  495. {
  496. title: '上传时间',
  497. dataIndex: 'uploadTime',
  498. },
  499. {
  500. title: '操作',
  501. dataIndex: 'action',
  502. },
  503. ]
  504. // 打开抽屉
  505. const onOpen = (record, view = false, type, copy) => {
  506. isView.value = view
  507. showGldz.value = false
  508. showHfdbt.value = false
  509. if (record) {
  510. qySecondlineHfdApi.qySecondlineHfdDetail({id: record.id}).then(res => {
  511. formData.value = res.baseInfo
  512. bodyList.value = res.productList
  513. relationList.value = res.dzList
  514. fileList.value = res.attachmentList
  515. if (formData.value.bdlx == 1 || formData.value.bdlx == 3) {
  516. showGldz.value = false
  517. showHfdbt.value = true
  518. } else if (formData.value.bdlx == 2) {
  519. showGldz.value = true
  520. showHfdbt.value = false
  521. }
  522. if (type) {
  523. formData.value.sblx = type
  524. }
  525. if (formData.value.hfdBgCode) {
  526. qySecondlineHfdApi.qysecondlinehfdlistGetHfdBgInfoByBgCode({hfdBgCode: formData.value.hfdBgCode}).then(res => {
  527. jzxhOptions.value = res.jzxList.map(v => {
  528. v.value = v.jzxh
  529. v.label = v.jzxh
  530. return v
  531. })
  532. })
  533. }
  534. if (copy) {
  535. delete formData.value.id
  536. }
  537. })
  538. } else {
  539. formData.value.sbqymc = userInfo.companyName
  540. formData.value.sbqybh = userInfo.companyNumber
  541. formData.value.sbqyshxydm = userInfo.companyNumber
  542. formData.value.sblx = type
  543. }
  544. qySecondlineHfdApi.qySecondlineHfdGetHzListByCondition().then(res => {
  545. hzqdOptions.value = res.map(v => Object.assign(v, {label: v.hgHzdCode, value: v.hgHzdCode}))
  546. })
  547. qySecondlineHfdApi.qysecondlinehfdlistGetBgCodeList().then(res => {
  548. bgdhOptions.value = res.map(v => ({label: v, value: v}))
  549. })
  550. hfdLxOptions.value = tool.dictList('hfdlx')
  551. jcbzOptions.value = tool.dictList('jcbz')
  552. sblxOptions.value = tool.dictList('lgs_sblx')
  553. bdlxOptions.value = tool.dictList('bdlx')
  554. statusOptions.value = tool.dictList('djzt')
  555. dzTypeOptions.value = tool.dictList('gldzlx')
  556. }
  557. // 关闭抽屉
  558. const onClose = () => {
  559. formRef.value?.resetFields()
  560. formData.value = {}
  561. isView.value = true
  562. emit('onClose')
  563. }
  564. // 默认要校验的
  565. const formRules = ref({
  566. hfdLx: [required('请选择核放单类型')],
  567. jcbz: [required('请选择进出口标志')],
  568. bdlx: [required('请选择绑定类型')],
  569. sblx: [required('请选择申报类型')],
  570. cyccph: [required('请输入承运车车牌号')],
  571. ickh: [required('请输入IC卡号(电子车牌)')],
  572. cjh: [required('请输入车架号')],
  573. cjz: [required('请输入车架重')],
  574. czz: [required('请输入车自重')],
  575. zzl: [required('请输入总重量(kg)')],
  576. hwmzl: [required('请输入货物毛净重(kg)')],
  577. hwjzl: [required('请输入货物总净重(kg)')],
  578. hfdBgCode: [required('请选择报关单号')],
  579. jzxh: [required('请选择集装箱号')],
  580. })
  581. watch(() => formData.value.bdlx, (n) => {
  582. if (n == 2) {
  583. delete formRules.value.glhzqdbh
  584. formRef.value.clearValidate('glhzqdbh')
  585. } else {
  586. formRules.value.glhzqdbh = [required('请输入关联核注单编号')]
  587. }
  588. })
  589. // 默认要校验的
  590. const bodyRules = {
  591. productOrderCode: [required('请输入关联商品序号')],
  592. productCode: [required('请输入商品编号')],
  593. productName: [required('请输入商品名称')],
  594. declareUnit: [required('请输入申报计量单位')],
  595. sbNum: [required('请输入申报数量')],
  596. grossWeight: [required('请输入货物毛重')],
  597. netWeight: [required('请输入货物净重')],
  598. }
  599. // 默认要校验的
  600. const relationRules = {
  601. dzType: [required('请输入关联单证类型')],
  602. dzCode: [required('请输入关联单证编号')],
  603. }
  604. // 验证并提交数据
  605. const onSubmit = () => {
  606. formRef.value
  607. .validate()
  608. .then(() => {
  609. submitLoading.value = true
  610. const params = {
  611. baseInfo: Object.assign(formData.value, {status: '3'}),
  612. productList: bodyList.value,
  613. dzList: relationList.value,
  614. attachmentList: fileList.value,
  615. }
  616. qySecondlineHfdApi
  617. .qySecondlineHfdSubmitForm(params, formData.value.id)
  618. .then(() => {
  619. onClose()
  620. emit('successful')
  621. })
  622. .finally(() => {
  623. submitLoading.value = false
  624. })
  625. })
  626. .catch(() => {})
  627. }
  628. const onTemp = () => {
  629. formRef.value
  630. .validate()
  631. .then(() => {
  632. submitLoading.value = true
  633. const params = {
  634. baseInfo: Object.assign(formData.value, {status: '1'}),
  635. productList: bodyList.value,
  636. dzList: relationList.value,
  637. attachmentList: fileList.value,
  638. }
  639. qySecondlineHfdApi
  640. .qySecondlineHfdSubmitForm(params, formData.value.id)
  641. .then(() => {
  642. onClose()
  643. emit('successful')
  644. })
  645. .finally(() => {
  646. submitLoading.value = false
  647. })
  648. })
  649. .catch(() => {
  650. })
  651. }
  652. const onBodyReset = () => {
  653. bodyFormRef.value?.resetFields()
  654. bodyData.value = {}
  655. }
  656. const onBodyAdd = () => {
  657. bodyFormRef.value
  658. .validate()
  659. .then(() => {
  660. bodyList.value.push(Object.assign({__index: new Date().getTime()}, bodyData.value))
  661. onBodyReset()
  662. message.success('插入表体信息成功!')
  663. })
  664. .catch(() => {
  665. })
  666. }
  667. const onBodyEdit = () => {
  668. bodyFormRef.value
  669. .validate()
  670. .then(() => {
  671. let k = ''
  672. if (bodyData.value.id) {
  673. k = 'id'
  674. } else if (bodyData.value.__index) {
  675. k = '__index'
  676. }
  677. if (k) {
  678. bodyList.value.forEach(v => {
  679. if (v[k] === bodyData.value[k]) {
  680. Object.assign(v, bodyData.value)
  681. }
  682. })
  683. }
  684. onBodyReset()
  685. message.success('编辑表体信息成功!')
  686. })
  687. .catch(() => {
  688. })
  689. }
  690. const onBodyDel = (recode, index) => {
  691. Modal.confirm({
  692. title: '提示',
  693. icon: createVNode(ExclamationCircleOutlined),
  694. content: createVNode('div', { style: 'color:red;' }, `是否要删除${record.productName}?`),
  695. centered: true,
  696. onOk() {
  697. bodyList.value.splice(index, 1)
  698. },
  699. onCancel() {
  700. },
  701. });
  702. }
  703. const deleteBatchBody = () => {
  704. bodyList.value = bodyList.value.filter(v => {
  705. let flag = true
  706. bodySelectedRowKeys.value.forEach(s => {
  707. if ((v.id && (v.id === s.id)) || (v.__index && (v.__index === s.__index))) {
  708. flag = false
  709. }
  710. })
  711. return flag
  712. })
  713. }
  714. const onRelationReset = () => {
  715. relationFormRef.value?.resetFields()
  716. relationData.value = {}
  717. }
  718. const onRelationAdd = () => {
  719. relationFormRef.value
  720. .validate()
  721. .then(() => {
  722. relationList.value.push(Object.assign({__index: new Date().getTime()}, relationData.value))
  723. onRelationReset()
  724. message.success('插入表体信息成功!')
  725. })
  726. .catch(() => {
  727. })
  728. }
  729. const onRelationEdit = () => {
  730. relationFormRef.value
  731. .validate()
  732. .then(() => {
  733. let k = ''
  734. if (relationData.value.id) {
  735. k = 'id'
  736. } else if (relationData.value.__index) {
  737. k = '__index'
  738. }
  739. if (k) {
  740. relationList.value.forEach(v => {
  741. if (v[k] === relationData.value[k]) {
  742. Object.assign(v, relationData.value)
  743. }
  744. })
  745. }
  746. onRelationReset()
  747. message.success('编辑表体信息成功!')
  748. })
  749. .catch(() => {
  750. })
  751. }
  752. const onRelationDel = (recode, index) => {
  753. Modal.confirm({
  754. title: '提示',
  755. icon: createVNode(ExclamationCircleOutlined),
  756. content: createVNode('div', { style: 'color:red;' }, `是否要删除${record.productName}?`),
  757. centered: true,
  758. onOk() {
  759. relationList.value.splice(index, 1)
  760. },
  761. onCancel() {
  762. },
  763. });
  764. }
  765. const deleteBatchRelation = () => {
  766. relationList.value = relationList.value.filter(v => {
  767. let flag = true
  768. relationSelectedRowKeys.value.forEach(s => {
  769. if ((v.id && (v.id === s.id)) || (v.__index && (v.__index === s.__index))) {
  770. flag = false
  771. }
  772. })
  773. return flag
  774. })
  775. }
  776. const getFileExtension = (filename) => {
  777. // 使用lastIndexOf查找最后一个"."的位置
  778. var dotIndex = filename.lastIndexOf(".");
  779. // 如果找到了".",则提取从"."之后的子串作为后缀名
  780. if (dotIndex !== -1 && dotIndex < filename.length - 1) { // 确保"."不是字符串的最后一个字符
  781. return filename.slice(dotIndex + 1); // slice从dotIndex+1开始到字符串结束
  782. } else {
  783. // 如果没有找到".",返回空字符串表示没有后缀
  784. return "";
  785. }
  786. }
  787. const fileChange = (file) => {
  788. if (file) {
  789. const f = ref_upload.value.uploadFileList()[0]
  790. fileList.value.push({
  791. __index: new Date().getTime(),
  792. attachmentUrl: f.url,
  793. attachmentName: f.name,
  794. attachmentFormat: getFileExtension(f.name),
  795. attachmentContent: '',
  796. uploadTime: proxy.$util.YMDHms(new Date()),
  797. })
  798. fileData.value.fileUrl = ''
  799. showFileUpload.value = false
  800. setTimeout(() => {
  801. showFileUpload.value = true
  802. }, 0)
  803. }
  804. }
  805. const onFileDel = (recode, index) => {
  806. Modal.confirm({
  807. title: '提示',
  808. icon: createVNode(ExclamationCircleOutlined),
  809. content: createVNode('div', { style: 'color:red;' }, `是否要删除?`),
  810. centered: true,
  811. onOk() {
  812. fileList.value.splice(index, 1)
  813. },
  814. onCancel() {
  815. },
  816. });
  817. }
  818. const deleteBatchFile = () => {
  819. fileList.value = fileList.value.filter(v => {
  820. let flag = true
  821. fileSelectedRowKeys.value.forEach(s => {
  822. if ((v.id && (v.id === s.id)) || (v.__index && (v.__index === s.__index))) {
  823. flag = false
  824. }
  825. })
  826. return flag
  827. })
  828. }
  829. const onChangHzqd = (val, obj) => {
  830. if (val) {
  831. formData.value.ledgerCode = obj.tzCode
  832. qySecondlineHzdTzApi.qySecondlineHzdTzGetProductByHgHzdCode({hgHzCode: val}).then(res => {
  833. bodyList.value = res
  834. onBodyReset()
  835. })
  836. } else {
  837. formData.value.ledgerCode = ''
  838. bodyList.value = []
  839. onBodyReset()
  840. }
  841. }
  842. const onChangeBdlx = (val) => {
  843. bodyList.value = []
  844. onBodyReset()
  845. relationList.value = []
  846. onRelationReset()
  847. if (val == 1 || val == 3) {
  848. showGldz.value = false
  849. showHfdbt.value = true
  850. } else if (val == 2) {
  851. showGldz.value = true
  852. showHfdbt.value = false
  853. formData.value.glhzqdbh = ''
  854. formData.value.ledgerCode = ''
  855. } else {
  856. showGldz.value = false
  857. showHfdbt.value = false
  858. }
  859. }
  860. const onChangBgdh = (val) => {
  861. if (val) {
  862. qySecondlineHfdApi.qysecondlinehfdlistGetHfdBgInfoByBgCode({hfdBgCode: val}).then(res => {
  863. formData.value.czz = res.cyc.czz
  864. formData.value.cjz = res.cyc.cjz
  865. formData.value.cjh = res.cyc.cjh
  866. formData.value.ickh = res.cyc.ickh
  867. formData.value.cyccph = res.cyc.cyccph
  868. jzxhOptions.value = res.jzxList.map(v => {
  869. v.value = v.jzxh
  870. v.label = v.jzxh
  871. return v
  872. })
  873. })
  874. } else {
  875. formData.value.hwjzl = ''
  876. formData.value.hwmzl = ''
  877. formData.value.zzl = ''
  878. formData.value.jzxlx = ''
  879. formData.value.jzxh = ''
  880. formData.value.czz = ''
  881. formData.value.cjz = ''
  882. formData.value.cjh = ''
  883. formData.value.ickh = ''
  884. formData.value.cyccph = ''
  885. jzxhOptions.value = []
  886. }
  887. }
  888. const onChangJzxh = (val) => {
  889. if (val) {
  890. const obj = jzxhOptions.value.filter(v => v.value === val)[0]
  891. formData.value.hwjzl = obj.hwjzl
  892. formData.value.hwmzl = obj.hwmzl
  893. formData.value.zzl = obj.zzl
  894. formData.value.jzxlx = obj.jzxlx
  895. } else {
  896. formData.value.hwjzl = ''
  897. formData.value.hwmzl = ''
  898. formData.value.zzl = ''
  899. formData.value.jzxlx = ''
  900. }
  901. }
  902. // 抛出函数
  903. defineExpose({
  904. onOpen
  905. })
  906. </script>
  907. <style lang="less" scoped>
  908. .file-tips {
  909. background-color: rgb(235, 245, 255);
  910. border: 1px solid rgb(214, 235, 255);
  911. border-radius: 5px;
  912. color: rgb(153, 153, 153);
  913. padding: 10px 20px;
  914. margin-bottom: 10px;
  915. }
  916. </style>