cost-allocation-table.vue 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. <template>
  2. <!--报表 成本分配表 (保存后数据到单证的成本分配汇总内)-->
  3. <div id="costAllocationTable">
  4. <h1 class="title">成本分配表</h1>
  5. <a-spin :spinning="loading">
  6. <a-card :bordered="false">
  7. <!-- 主表信息 点击搜索后 回显--->
  8. <a-row :gutter="24">
  9. <div class="table-page-search-wrapper">
  10. <!-- ref="form" :model="costAllocationTable" -->
  11. <a-form-model layout="inline" class="kk">
  12. <a-col :md="6" :sm="8">
  13. <a-form-model-item label="计划单号" prop="plannum">
  14. <a-input-search
  15. placeholder="请输入计划单号"
  16. enter-button
  17. v-model="detailsPlanNum.planNum"
  18. @search="onSearch('query')"
  19. :loading="this.loading"
  20. v-show='showSelect==0'
  21. />
  22. <a-input-search
  23. placeholder="请输入计划单号"
  24. v-text="detailsPlanNum.planNum"
  25. enter-button
  26. @search="onSearch('query')"
  27. v-show='showSelect==1'
  28. />
  29. <a-button type="primary" :disabled="edit == '0'" @click="onSearch('queryNew')" class="noprint">更新</a-button>
  30. </a-form-model-item>
  31. </a-col>
  32. <!-- 回显以下【备注】需要输入,后进行保存 disabled -->
  33. <a-col :md="6" :sm="8">
  34. <a-form-model-item label="产品款号" prop="poStyleNum">
  35. <span :title="detailsPlanNum.poStyleNum">{{ detailsPlanNum.poStyleNum | ellipsis}}</span>
  36. <!-- {{ detailsPlanNum.poStyleNum }} -->
  37. </a-form-model-item>
  38. </a-col>
  39. <a-col :md="6" :sm="8">
  40. <a-form-model-item label="外销员" prop="exportSales">
  41. {{ detailsPlanNum.exportSales }}
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :md="6" :sm="8">
  45. <a-form-model-item label="成衣合同号" prop="garmentContractno">
  46. {{ detailsPlanNum.garmentContractno }}
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :md="6" :sm="8">
  50. <a-form-model-item label="部门" prop="department">
  51. {{ detailsPlanNum.department }}
  52. </a-form-model-item>
  53. </a-col>
  54. <a-col :md="6" :sm="8">
  55. <a-form-model-item label="客户简称" prop="customerShortame">
  56. {{ detailsPlanNum.customerShortame }}
  57. </a-form-model-item>
  58. </a-col>
  59. <a-col :md="6" :sm="8">
  60. <a-form-model-item label="加工单位" prop="processUnit">
  61. <span :title=" detailsPlanNum.processUnit">{{ detailsPlanNum.processUnit | ellipsis}}</span>
  62. <!-- {{ detailsPlanNum.processUnit }} -->
  63. </a-form-model-item>
  64. </a-col>
  65. <a-col :md="6" :sm="8">
  66. <a-form-model-item label="出运日期" prop="outdata">
  67. {{ detailsPlanNum.outdata }}
  68. </a-form-model-item>
  69. </a-col>
  70. <a-col :md="6" :sm="8">
  71. <a-form-model-item label="面料不含税成本(¥)" prop="fabriccostNotincludestax" >
  72. {{ detailsPlanNum.fabriccostNotincludestax }}
  73. </a-form-model-item>
  74. </a-col>
  75. <a-col :md="6" :sm="8">
  76. <a-form-model-item label="辅料不含税成本(¥)" prop="excipiencostNotincludestax">
  77. {{ detailsPlanNum.excipiencostNotincludestax }}
  78. </a-form-model-item>
  79. </a-col>
  80. <a-col :md="6" :sm="8">
  81. <a-form-model-item label="外销总价($)" prop="usdTotalexportprice">
  82. {{ detailsPlanNum.usdTotalexportprice }}
  83. </a-form-model-item>
  84. </a-col>
  85. <a-col :md="6" :sm="8">
  86. <a-form-model-item label="外销金额(¥)" prop="rmbExportamount">
  87. {{ detailsPlanNum.rmbExportamount }}
  88. </a-form-model-item>
  89. </a-col>
  90. <a-col :md="6" :sm="8">
  91. <a-form-model-item label="实际出货数量" prop="actualShipquantity">
  92. {{ detailsPlanNum.actualShipquantity }}
  93. </a-form-model-item>
  94. </a-col>
  95. <a-col :md="6" :sm="8">
  96. <a-form-model-item label="不含税加工费(¥)" prop="rmbProcesscost">
  97. {{ detailsPlanNum.rmbProcesscost }}
  98. </a-form-model-item>
  99. </a-col>
  100. <a-col :md="6" :sm="8">
  101. <a-form-model-item label="加工费($)" prop="usdProcesscost">
  102. {{ detailsPlanNum.usdProcesscost }}
  103. </a-form-model-item>
  104. </a-col>
  105. <a-col :md="6" :sm="8">
  106. <a-form-model-item label="运杂费($)" prop="usdExpense" >
  107. <a href="javascript:void(0)" @click="mainTableExpenseUSD()" >{{ detailsPlanNum.usdExpense }}</a>
  108. </a-form-model-item>
  109. </a-col>
  110. <a-col :md="6" :sm="8">
  111. <a-form-model-item label="不含税运杂费(¥)" prop="rmbNorTaxExpense" >
  112. {{detailsPlanNum.rmbNorTaxExpense }}
  113. </a-form-model-item>
  114. </a-col>
  115. <a-col :md="6" :sm="8">
  116. <a-form-model-item label="事故金额($)" prop="accidentUsdamount" >
  117. {{ detailsPlanNum.accidentUsdamount }}
  118. </a-form-model-item>
  119. </a-col>
  120. <a-col :md="6" :sm="8">
  121. <a-form-model-item label="事故金额(¥)" prop="accidentcnyAmount" >
  122. {{ detailsPlanNum.accidentcnyAmount }}
  123. </a-form-model-item>
  124. </a-col>
  125. <a-col :md="6" :sm="8">
  126. <a-form-model-item label="计划数量" prop="planQuantity">
  127. {{ detailsPlanNum.planQuantity }}
  128. </a-form-model-item>
  129. </a-col>
  130. <a-col :md="6" :sm="8">
  131. <a-form-model-item label="短出数" prop="shortseveral" >
  132. {{ detailsPlanNum.shortseveral }}
  133. </a-form-model-item>
  134. </a-col>
  135. <a-col :md="6" :sm="8">
  136. <a-form-model-item label="短出货值" prop="shortvalue" >
  137. {{ detailsPlanNum.shortvalue }}
  138. </a-form-model-item>
  139. </a-col>
  140. <a-col :md="6" :sm="8">
  141. <a-form-model-item label="面料成本($)" prop="fabriccostIncludestaxUsd" >
  142. {{ detailsPlanNum.fabriccostIncludestaxUsd }}
  143. </a-form-model-item>
  144. </a-col>
  145. <a-col :md="6" :sm="8">
  146. <a-form-model-item label="面料成本(¥)" prop="fabriccostIncludestax" >
  147. {{ detailsPlanNum.fabriccostIncludestax }}
  148. </a-form-model-item>
  149. </a-col>
  150. <a-col :md="6" :sm="8">
  151. <a-form-model-item label="辅料成本($)" prop="excipiencostIncludestaxUsd">
  152. {{ detailsPlanNum.excipiencostIncludestaxUsd}}
  153. <!-- {{ detailsPlanNum.excipiencostIncludestaxUsd }} -->
  154. </a-form-model-item>
  155. </a-col>
  156. <a-col :md="6" :sm="8">
  157. <a-form-model-item label="辅料成本(¥)" prop="excipiencostIncludestax">
  158. {{ detailsPlanNum.excipiencostIncludestax }}
  159. </a-form-model-item>
  160. </a-col>
  161. <a-col :md="6" :sm="8">
  162. <a-form-model-item label="销售订单总额(¥)" prop="salesordersLocaltotal">
  163. {{ detailsPlanNum.salesordersLocaltotal }}
  164. </a-form-model-item>
  165. </a-col>
  166. <a-col :md="6" :sm="8">
  167. <a-form-model-item label="销售订单总额($)" prop="salesrrdersOriginaltotal">
  168. {{ detailsPlanNum.salesrrdersOriginaltotal }}
  169. </a-form-model-item>
  170. </a-col>
  171. <a-col :md="6" :sm="8">
  172. <a-form-model-item label="运杂费(¥)" prop="rmbExpense">
  173. <a href="javascript:void(0)" @click="mainTableExpenseCNY()">{{ detailsPlanNum.rmbExpense }}</a>
  174. </a-form-model-item>
  175. </a-col>
  176. <a-col :md="6" :sm="8">
  177. <a-form-model-item label="运费税额" prop="shuiemoney">
  178. {{detailsPlanNum.shuiemoney}}
  179. </a-form-model-item>
  180. </a-col>
  181. <a-col :md="6" :sm="8">
  182. <a-form-model-item label="税率%" prop="taxrate" >
  183. <a-input placeholder="请输入" v-model="detailsPlanNum.taxrate" @blur="changeTaxrate" class="taxrate" v-show='showSelect==0'/>
  184. <span v-show='showSelect==1'>{{ detailsPlanNum.taxrate }}</span>
  185. </a-form-model-item>
  186. </a-col>
  187. <a-col :md="6" :sm="8">
  188. <a-form-model-item label="备注" prop="memo" >
  189. <a-input style="width:100%" type="text" v-model="detailsPlanNum.memo" @blur="changeContainerNumber" v-show='showSelect==0'/>
  190. <span v-show='showSelect==1'>{{ detailsPlanNum.memo }}</span>
  191. </a-form-model-item>
  192. </a-col>
  193. <a-col :md="6" :sm="8">
  194. <a-form-model-item label="制单人" prop="preparedBy">
  195. {{ detailsPlanNum.preparedBy }}
  196. </a-form-model-item>
  197. </a-col>
  198. <a-col :md="6" :sm="8">
  199. <a-form-model-item label="查询时间" prop="queryTime">
  200. {{ detailsPlanNum.queryTime }}
  201. </a-form-model-item>
  202. </a-col>
  203. <a-col :md="6" :sm="8">
  204. <a-form-model-item label="订单汇率" prop="queryTime">
  205. {{ detailsPlanNum.exchangeRate }}
  206. </a-form-model-item>
  207. </a-col>
  208. <a-col :md="6" :sm="8" class="noprint">
  209. <a-form-model-item label="" prop="" >
  210. <h4 style="color:red;" v-if="color1<0">
  211. 标记(A)
  212. <!-- <span>(计算结果是负值时,该标记是红色)</span> -->
  213. </h4>
  214. <h4 style="color:black;" v-else>
  215. 标记(A)
  216. <!-- <span>(计算结果是负值时,该标记是红色)</span> -->
  217. </h4>
  218. </a-form-model-item>
  219. </a-col>
  220. <a-col :md="6" :sm="8" class="noprint">
  221. <a-form-model-item label="" prop="" >
  222. <h4 style="color:blue;" v-if="color2<0.8">
  223. 标记(B)
  224. <!-- <span>(计算结果小于O.8 时,该标记是蓝色)</span> -->
  225. </h4>
  226. <h4 style="color:black;" v-else>
  227. 标记(B)
  228. <!-- <span>(计算结果小于O.8 时,该标记是蓝色)</span> -->
  229. </h4>
  230. </a-form-model-item>
  231. </a-col>
  232. <a-col :md="6" :sm="8" class="noprint">
  233. <a-upload productName="file" :showUploadList="true" :file-list="fileList" :headers="tokenHeader" :multiple="false" :action="importExcelUrl" @change="handleImportExcel" :data="{code:this.detailsPlanNum.planNum,name:this.fileName}" :beforeUpload="uploadFlie" :remove="removeFile">
  234. <a-button type="primary" >附件上传</a-button>
  235. </a-upload>
  236. </a-col>
  237. <a-col :md="6" :sm="8" class="noprint">
  238. <a-button type="primary" @click="openEnclosure">附件</a-button>
  239. </a-col>
  240. </a-form-model>
  241. </div>
  242. </a-row>
  243. </a-card>
  244. <!--tabs 组件引入 -->
  245. <a-card :bordered="false" style=" marginTop:10px;">
  246. <div><tabs ref="unitTabs" :showSelect='showSelect' @number="number" :planNum="this.detailsPlanNum.planNum" @FabInQua="FabInQua"/></div>
  247. </a-card>
  248. <!-- 事故单 -->
  249. <a-card :bordered="true" style="margin:10px 0">
  250. <div style="margin:60px 0 40px 0" :class="[(accidentListData.length==0?'noprint': '')]">
  251. <h6 class="table-title">事故单</h6>
  252. <a-table
  253. rowKey="id"
  254. :columns="accidentListColumns"
  255. :data-source="accidentListData"
  256. bordered
  257. :pagination="false"
  258. :scroll="{ }"
  259. >
  260. <!-- 事故单 -->
  261. <span slot="accidentNum" slot-scope="text,record">
  262. <a :href="'http://www.myfitt.cn:18086/#/IncidentTicketModalDetail?id='+record.id" target="_blank">{{ text }}</a>
  263. </span>
  264. </a-table>
  265. </div>
  266. <!-- 费用支出 -->
  267. <div :class="[(costPayData.length==0?'noprint': '')]">
  268. <h6 class="table-title" >费用支出</h6>
  269. <a-table
  270. rowKey="id"
  271. :columns="costPayColumns"
  272. :data-source="costPayData"
  273. bordered
  274. :pagination="false"
  275. >
  276. </a-table>
  277. </div>
  278. <!-- 备注信息 根据角色权限控制【填写】、【查看】-->
  279. <div class="note-one" style="marginTop:40px;">
  280. <h6 class="table-title">备注</h6>
  281. <div class="noteDetail">
  282. <a-form-model ref="form" :model="detailsPlanNum">
  283. <a-form-model-item prop="remarks">
  284. <a-input type="textarea" v-model="detailsPlanNum.remarks" placeholder="请输入备注" style="minHeight:100px;" v-show='showSelect==0' />
  285. <a-input type="textarea" v-text="detailsPlanNum.remarks" style="minHeight:100px;" v-show='showSelect==1'/>
  286. </a-form-model-item>
  287. </a-form-model>
  288. </div>
  289. </div>
  290. <!-- 页面底部保存 -->
  291. <a-row :gutter="24" style="marginTop:40px;float:right" class="noprint">
  292. <a-col :md="12" :sm="12" style="display:flex">
  293. <a-button type="primary" @click="daYin" style="margin-right:6px" :disabled ="PrintButton">
  294. 打印
  295. </a-button>
  296. <a-button type="primary" @click="save" :disabled="isDisabled">
  297. 保存
  298. </a-button>
  299. </a-col>
  300. </a-row>
  301. </a-card>
  302. <!-- 弹框 -->
  303. <div>
  304. <!-- 主表 人民币费用支出 弹框 -->
  305. <mainTableExpenseCNY-modal ref="mainTableExpenseCNYModal" :father="aa"></mainTableExpenseCNY-modal>
  306. <!-- 主表 美元费用支出 弹框 -->
  307. <mainTableExpenseUSD-modal ref="mainTableExpenseUSDModal" :father="bb"></mainTableExpenseUSD-modal>
  308. <!-- 事故单 -->
  309. <accidentList-modal ref="accidentListModal" :father="cc"></accidentList-modal>
  310. <!-- 附件 -->
  311. <attachment-display ref="attachmentDisplay"></attachment-display>
  312. </div>
  313. </a-spin>
  314. </div>
  315. </template>
  316. <script>
  317. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  318. import JEllipsis from '@/components/jeecg/JEllipsis'
  319. import moment from 'moment'
  320. import tabs from '@views/reportForms/cost-allocation-table/tabs.vue' // tabs组件
  321. import mainTableExpenseCNYModal from '@views/cost-allocation-total/modal/mainTableExpenseCNYModal.vue'
  322. import mainTableExpenseUSDModal from '@views/cost-allocation-total/modal/mainTableExpenseUSDModal.vue'
  323. import accidentListModal from '@views/cost-allocation-total/modal/accidentListModal.vue' // 事故单
  324. import { seachPlanNum, addHalfInfo,deleteFileDetail } from '@api/document/cost-allocation-total.js'
  325. import AttachmentDisplay from '@views/reportForms/fabric-loss-table/attachment-display.vue'
  326. export default {
  327. name: 'CostAllocationTable', // 成本分配 (新增)
  328. mixins: [JeecgListMixin],
  329. components: { JEllipsis, moment, tabs, mainTableExpenseCNYModal, mainTableExpenseUSDModal, accidentListModal,AttachmentDisplay },
  330. data() {
  331. return {
  332. key: '', //客户输入的订单号
  333. PrintButton:true,//打印按钮
  334. showSelect:0,//计划号是否是输入框
  335. loading: false, // 表格加载
  336. detailsPlanNum: {
  337. planNum: ''
  338. }, // 详情所有数据
  339. remarks: '', // 备注
  340. // 事故单 表头
  341. accidentListColumns: [
  342. {
  343. title: '单号',
  344. width: 120,
  345. dataIndex: 'accidentNumber',
  346. className: 'replacecolor',
  347. customCell: this.accidentListCustomCell,
  348. scopedSlots: { customRender: 'accidentNum' }
  349. },
  350. { title: '事故承担方', width: 120, dataIndex: 'accidentUndertaker', className: 'replacecolor' },
  351. {
  352. title: '美元金额',
  353. width: 120,
  354. dataIndex: 'amount',
  355. className: 'replacecolor' ,
  356. customRender: (text, record, index) => {
  357. if(text!==''&&text){
  358. return Number(text).toFixed(2)
  359. }
  360. },
  361. },
  362. {
  363. title: '人民币金额',
  364. width: 120,
  365. dataIndex: 'amountrmb',
  366. className: 'replacecolor' ,
  367. customRender: (text, record, index) => {
  368. if(text!==''&&text){
  369. return Number(text).toFixed(2)
  370. }
  371. },
  372. },
  373. { title: '事故单主题', width: 120, dataIndex: 'accidentTheme', className: 'replacecolor' },
  374. { title: '责任人', width: 100, dataIndex: 'responsibilityPerson1', className: 'replacecolor' },
  375. ],
  376. accidentListData: [],
  377. // 费用支出 表头
  378. costPayColumns: [
  379. { title: '账套号', width: '10%', dataIndex: 'setNo', className: 'replacecolor' },
  380. { title: '支出单号', width: '10%', dataIndex: 'disbursementSlipNo', className: 'replacecolor' },
  381. { title: '费用项目', dataIndex: 'expenseItem', width: '10%', className: 'replacecolor' },
  382. {
  383. title: '美元',
  384. dataIndex: 'disbursedOriginalmoney',
  385. width: '10%',
  386. className: 'replacecolor' ,
  387. customRender: (text, record, index) => {
  388. if(text!==''&&text){
  389. return Number(text).toFixed(2)
  390. }
  391. },
  392. },
  393. {
  394. title: '人民币(不含税)',
  395. dataIndex: 'disbursedLocalmoney',
  396. width: '10%', className: 'replacecolor',
  397. customRender: (text, record, index) => {
  398. if(text!==''&&text){
  399. return Number(text).toFixed(2)
  400. }
  401. },
  402. },
  403. {
  404. title: '人民币(税额)',
  405. dataIndex: 'shuiemoney',
  406. width: '10%',
  407. className: 'replacecolor',
  408. customRender: (text, record, index) => {
  409. if(text!==''&&text){
  410. return Number(text).toFixed(2)
  411. }
  412. },
  413. },
  414. {
  415. title: '人民币(价税合计)',
  416. dataIndex: 'iNatMoney',
  417. width: '10%',
  418. className: 'replacecolor',
  419. customRender: (text, record, index) => {
  420. if(text!==''&&text){
  421. return Number(text).toFixed(2)
  422. }
  423. }, },
  424. { title: '发票号', dataIndex: 'invoicenum', width: '10%', className: 'replacecolor' },
  425. { title: '制单人', dataIndex: 'preparedBy', width: '10%', className: 'replacecolor' }
  426. ],
  427. costPayData: [],
  428. isDisabled: false, //按钮禁止
  429. billstatus: '', // 单据状态
  430. color1:0,
  431. fabricCost:'',//保存表头面料成本(¥)
  432. color2:0,
  433. fileList:[],
  434. url: {
  435. list: '/sys/user/list',
  436. importExcelUrl: 'cost/syCostAllocation/addFile' ,// 导入
  437. }
  438. // dateFormat: 'YYYY-MM-DD',
  439. }
  440. },
  441. created() {
  442. document.title = '成本分配表'+ ' · ' + '马菲羊'
  443. },
  444. filters: {
  445. //文字数超出时,超出部分使用...
  446. ellipsis(value) {
  447. if (!value) return ''
  448. if (value.length > 20) {
  449. return value.slice(0, 20) + '...'
  450. }
  451. return value
  452. }
  453. },
  454. methods: {
  455. // 【计划单号】 搜索
  456. onSearch(data) {
  457. this.$nextTick(() => {
  458. // TODO:接口完善后,type 应改为 add(暂时为了回显数据)
  459. this.fabricCost = ''
  460. this.loading = true
  461. this.$refs.unitTabs.mList = []
  462. this.$refs.unitTabs.fList = []
  463. this.StagingList = [] //更新时重新计算面料成本(¥)使用
  464. var Staging = '',
  465. StagingLast = '',
  466. file = ''
  467. //更新前保存字段
  468. if(data=='queryNew'){
  469. Staging =this.detailsPlanNum.memo
  470. StagingLast = this.detailsPlanNum.remarks
  471. file = this.fileList
  472. this.$refs.unitTabs.mList =this.$refs.unitTabs.tabsAllData.length!==0? this.$refs.unitTabs.tabsAllData[0].syCostAllocationFabricList:[]
  473. this.$refs.unitTabs.fList = this.$refs.unitTabs.tabsAllData.length!==0?this.$refs.unitTabs.tabsAllData[0].syCostAllocationIngredientList:[]
  474. this.StagingList = this.$refs.unitTabs.fabData
  475. }
  476. seachPlanNum({ plannum: this.detailsPlanNum.planNum, type: data }).then(res => {
  477. if (res.success) {
  478. this.PrintButton = false
  479. this.loading = false
  480. this.detailsPlanNum = res.result //所有详情
  481. if(Number(this.detailsPlanNum.shortseveral)<0){
  482. this.detailsPlanNum.shortseveral = 0
  483. this.detailsPlanNum.shortvalue = 0
  484. }
  485. //表头-附件列表
  486. var fileList = (this.detailsPlanNum.attachs!==''&&this.detailsPlanNum.attachs)?this.detailsPlanNum.attachs.split(","):[]
  487. this.fileList = []
  488. if(fileList.length!==0){
  489. fileList.map(item=>{
  490. this.fileList.push({
  491. uid: '-1',
  492. name: item,
  493. status: 'done',
  494. url:'http://www.myfitt.cn:18001/jeecg-boot/sys/common/static' +'/'+item
  495. })
  496. })
  497. }
  498. this.accidentListData = res.result.syCostAllocationAccidentList //事故单
  499. this.accidentCalculation(this.accidentListData) //计算事故单美元金额和事故单人民币金额
  500. this.costPayData = res.result.syCostAllocationCostpayList //支出费用
  501. var num = 0
  502. this.costPayData.map(item =>{
  503. item.id = num + 1
  504. num += 1
  505. })
  506. // tabs 名称集合
  507. this.$refs.unitTabs.tabNameList = res.result.processUnit.split(',')
  508. //所有tabs数据
  509. this.$refs.unitTabs.tabsAllData = res.result.processUnitList
  510. // 页面打开加载的数据
  511. var oneData = this.$refs.unitTabs.tabsAllData[0]
  512. this.$refs.unitTabs.fabData = oneData.syCostAllocationFabricList
  513. var all = 0,//面料sheet-转入成本总计
  514. allYu = 0//面料sheet-余下数量成本总计
  515. this.$refs.unitTabs.fabData.map(item=>{
  516. if(item.remainingQuantitycost!=='' && item.remainingQuantitycost){
  517. item.remainingQuantitycost = item.remainingQuantitycost.toFixed(2)
  518. allYu +=Number(item.remainingQuantitycost)
  519. }
  520. if(item.transferCost&&item.transferCost!==''){
  521. all+=Number(item.transferCost)
  522. }
  523. })
  524. this.fabricCost = this.detailsPlanNum.fabriccostIncludestax
  525. // this.detailsPlanNum.fabriccostIncludestax = (all+Number(this.detailsPlanNum.fabriccostIncludestax)-allYu).toFixed(2) // 表头面料成本(¥)
  526. this.detailsPlanNum.fabriccostIncludestax = (Number(this.detailsPlanNum.fabriccostIncludestax)-allYu).toFixed(2) // 表头面料成本(¥)
  527. this.detailsPlanNum.fabriccostIncludestaxUsd = (Number(this.detailsPlanNum.fabriccostIncludestax)/1.13/this.detailsPlanNum.exchangeRate).toFixed(2)//表头面料成本($)
  528. this.detailsPlanNum.fabriccostNotincludestax = (Number(this.detailsPlanNum.fabriccostIncludestax)/(1+(Number(this.detailsPlanNum.taxrate)/100))).toFixed(2)//表头-面料不含税成本(¥)
  529. this.$refs.unitTabs.ingData = oneData.syCostAllocationIngredientList //辅料sheet数据源
  530. this.$refs.unitTabs.shipData = oneData.syCostAllocationShipdetail //发运明细sheet数据源
  531. this.detailsPlanNum.outdata = oneData.syCostAllocationShipdetail.length!==0?oneData.syCostAllocationShipdetail[0].outdata:'' //表头-出运日期
  532. this.addAmountIng(oneData.syCostAllocationIngredientList) //辅料sheet合计行
  533. this.addAmountCostPay(this.costPayData) //费用支出合计行
  534. this.addAccident(this.accidentListData)//事故单合计行
  535. this.calculation(oneData.syCostAllocationShipdetail) //出运明细合计行
  536. //合计中面料相关金额
  537. var s=0
  538. oneData.syCostAllocationFabricList.map(item=>{
  539. s+=Number(item.transferCost)
  540. })
  541. this.$refs.unitTabs.sumInfo.fabricAmount = (this.detailsPlanNum.fabriccostIncludestax!==''&&this.detailsPlanNum.fabriccostIncludestax)?(Number(this.detailsPlanNum.fabriccostIncludestax)).toFixed(2):'' //合计中的面料总额
  542. this.$refs.unitTabs.sumInfo.fabricExcludTax =(this.detailsPlanNum.fabriccostNotincludestax!==''&&this.detailsPlanNum.fabriccostNotincludestax)?(Number(this.detailsPlanNum.fabriccostNotincludestax)).toFixed(2):''//合计中的不含税面料总额
  543. //合计中辅料相关金额
  544. var s = 0,
  545. v =0,
  546. t=0
  547. oneData.syCostAllocationIngredientList.map(item=>{
  548. s+=item.priceExcludingtax?Number(item.priceExcludingtax):0,
  549. v+=item.rmbAmount?Number(item.rmbAmount):0
  550. t+=item.transferCost?Number(item.transferCost):0
  551. })
  552. this.$refs.unitTabs.sumInfo.ingAmount =((v/2)+(t/2)).toFixed(2)//辅料金额合计
  553. this.$refs.unitTabs.sumInfo.ingExcludAmount = (((s/2)+(t/2)/(1+(Number(this.detailsPlanNum.taxrate)/100)))).toFixed(2)//合计sheet辅料不含税金额合计
  554. this.detailsPlanNum.excipiencostNotincludestax = ( this.$refs.unitTabs.sumInfo.ingExcludAmount==''|| !this.$refs.unitTabs.sumInfo.ingExcludAmount)?0:Number(this.$refs.unitTabs.sumInfo.ingExcludAmount).toFixed(2)//表头辅料料不含税成本
  555. this.detailsPlanNum.excipiencostIncludestax = ( this.$refs.unitTabs.sumInfo.ingAmount ==''|| ! this.$refs.unitTabs.sumInfo.ingAmount )?0:Number( this.$refs.unitTabs.sumInfo.ingAmount ).toFixed(2)//表头辅料成本(¥)
  556. //合计中出运明细相关金额
  557. var s =0,
  558. v = 0,
  559. d = 0,
  560. b = 0,
  561. f=0,
  562. e=0
  563. oneData.syCostAllocationShipdetail.map(item=>{
  564. s+=Number(item.exportPrice)
  565. v+=Number(item.shipQuantity)
  566. d+=Number(item.processCost)
  567. b+=Number(item.rmbAmount)
  568. if(item.outdata!=='合计'){
  569. e+=Number(item.processCostUsd)
  570. }
  571. })
  572. this.$refs.unitTabs.sumInfo.exportPriceUSD = (s/2).toFixed(2)//出运美元外销总价
  573. this.detailsPlanNum.usdTotalexportprice = this.$refs.unitTabs.sumInfo.exportPriceUSD //表头-外销总价($)
  574. this.$refs.unitTabs.sumInfo.shipQua =(v/2).toFixed(4)//出货数量合计
  575. this.$refs.unitTabs.sumInfo.shipProcesFees =(d/2).toFixed(2)//出运加工费
  576. this.$refs.unitTabs.sumInfo.exportedAmountRMB =(b/2).toFixed(2)//出运人民币外销金额 f
  577. this.detailsPlanNum.rmbExportamount = this.$refs.unitTabs.sumInfo.exportedAmountRMB //表头-外销总价(¥)
  578. //调整表头格式
  579. this.adjustingHeader()
  580. if(Number(oneData.syCostAllocationShipdetail[0].procesUnitPriceusd)>0){
  581. this.$refs.unitTabs.sumInfo.excludingTaxProcessing =this.$refs.unitTabs.sumInfo.shipProcesFees//出运不含税加工费-合计信息
  582. }else{
  583. this.$refs.unitTabs.sumInfo.excludingTaxProcessing =( this.$refs.unitTabs.sumInfo.shipProcesFees/(1+(Number(this.detailsPlanNum.taxrate)/100))).toFixed(2)//出运不含税加工费
  584. }
  585. this.detailsPlanNum.rmbProcesscost = this.$refs.unitTabs.sumInfo.excludingTaxProcessing //表头-加工费人民币
  586. f= Number(this.$refs.unitTabs.sumInfo.excludingTaxProcessing)/Number(this.detailsPlanNum.exchangeRate)
  587. this.detailsPlanNum.usdProcesscost =e==0?(Number(this.detailsPlanNum.rmbProcesscost)/Number(this.detailsPlanNum.exchangeRate)).toFixed(2):e.toFixed(2)//表头-加工费美元
  588. f=Number(this.$refs.unitTabs.sumInfo.ingAmount)+Number(this.$refs.unitTabs.sumInfo.shipProcesFees)
  589. this.$refs.unitTabs.sumInfo.amountTotal = (Number(this.$refs.unitTabs.sumInfo.fabricAmount)+Number(this.$refs.unitTabs.sumInfo.ingAmount)+Number( this.$refs.unitTabs.sumInfo.shipProcesFees)).toFixed(2)//合计金额
  590. this.pagination = {
  591. total: res.result.total,
  592. current: res.result.current,
  593. pageSize: res.result.size
  594. }
  595. //更新时-面料sheet/辅料sheet-弹窗数据处理
  596. if(data=='queryNew'){
  597. this.detailsPlanNum.memo = Staging
  598. this.detailsPlanNum.remarks = StagingLast
  599. this.fileList = file
  600. var all = 0,
  601. allYu = 0
  602. oneData.syCostAllocationFabricList.map(item=>{
  603. this.$refs.unitTabs.mList.map(event=>{
  604. if(item.goodsName==event.goodsName){
  605. item.transferCost = event.transferCost
  606. item.remainingQuantitycost = event.remainingQuantitycost
  607. }
  608. })
  609. if(item.transferCost&&item.transferCost!==''){
  610. all+=Number(item.transferCost)
  611. }
  612. if(item.remainingQuantitycost&&item.remainingQuantitycost!==''){
  613. allYu+=Number(item.remainingQuantitycost)
  614. }
  615. })
  616. // this.detailsPlanNum.fabriccostIncludestax = (all+Number(this.fabricCost)-allYu).toFixed(2) // 表头面料成本(¥)
  617. this.detailsPlanNum.fabriccostIncludestax = (Number(this.fabricCost)-allYu).toFixed(2) // 表头面料成本(¥)
  618. this.detailsPlanNum.fabriccostIncludestaxUsd = (Number(this.detailsPlanNum.fabriccostIncludestax)/1.13/this.detailsPlanNum.exchangeRate).toFixed(2)//表头面料成本($)
  619. this.detailsPlanNum.fabriccostNotincludestax = (Number(this.detailsPlanNum.fabriccostIncludestax)/(1+(Number(this.detailsPlanNum.taxrate)/100))).toFixed(2)//表头-面料不含税成本(¥)
  620. this.$refs.unitTabs.sumInfo.fabricAmount=this.detailsPlanNum.fabriccostIncludestax
  621. this.$refs.unitTabs.sumInfo.fabricExcludTax =(this.detailsPlanNum.fabriccostNotincludestax!==''&&this.detailsPlanNum.fabriccostNotincludestax)?(Number(this.detailsPlanNum.fabriccostNotincludestax)).toFixed(2):''//合计中的不含税面料总额
  622. this.$refs.unitTabs.sumInfo.amountTotal = (Number(this.$refs.unitTabs.sumInfo.fabricAmount)+Number(this.$refs.unitTabs.sumInfo.ingAmount)+Number( this.$refs.unitTabs.sumInfo.shipProcesFees)).toFixed(2)//合计金额
  623. oneData.syCostAllocationIngredientList.map(item=>{
  624. this.$refs.unitTabs.fList.map(event=>{
  625. if(item.goodsName==event.goodsName){
  626. item.transferCost = event.transferCost
  627. }
  628. })
  629. })
  630. //重新计算辅料相关数值
  631. var s = 0,
  632. v=0,
  633. t=0
  634. oneData.syCostAllocationIngredientList.map(item=>{
  635. s+=Number(item.priceExcludingtax),
  636. v+=item.rmbAmount?Number(item.rmbAmount):0
  637. t+=item.transferCost?Number(item.transferCost):0
  638. })
  639. this.$refs.unitTabs.sumInfo.ingExcludAmount = (((s/2)+(t/2)/(1+(Number(this.detailsPlanNum.taxrate)/100)))).toFixed(2)//合计sheet辅料不含税金额合计
  640. this.detailsPlanNum.excipiencostNotincludestax = ( this.$refs.unitTabs.sumInfo.ingExcludAmount==''|| !this.$refs.unitTabs.sumInfo.ingExcludAmount)?0:Number(this.$refs.unitTabs.sumInfo.ingExcludAmount).toFixed(2)//表头辅料料不含税成本
  641. this.$refs.unitTabs.sumInfo.ingAmount =((v/2)+(t/2)).toFixed(2)//辅料金额合计
  642. this.detailsPlanNum.excipiencostIncludestax = ( this.$refs.unitTabs.sumInfo.ingAmount ==''|| ! this.$refs.unitTabs.sumInfo.ingAmount )?0:Number( this.$refs.unitTabs.sumInfo.ingAmount ).toFixed(2)//表头辅料成本(¥)
  643. }
  644. }else {
  645. this.loading = false
  646. this.$message.error(res.message);
  647. }
  648. })
  649. })
  650. },
  651. uploadFlie(file) {
  652. this.fileName = file.name
  653. },
  654. handleImportExcel(data){
  655. if(data.fileList.length>this.fileList.length&&data.file.status=='uploading'){
  656. var that =this
  657. setTimeout(()=>{
  658. that.getFileLIst()
  659. },1000)
  660. }
  661. },
  662. getFileLIst(){
  663. seachPlanNum({ plannum: this.detailsPlanNum.planNum, type: 'query' }).then(res => {
  664. if (res.success) {
  665. var fileList = (res.result.attachs!==''&&res.result.attachs)?res.result.attachs.split(","):[]
  666. this.fileList = []
  667. if(fileList.length!==0){
  668. fileList.map(item=>{
  669. this.fileList.push({
  670. uid: '-1',
  671. name: item,
  672. status: 'done',
  673. url:'http://www.myfitt.cn:18001/jeecg-boot/sys/common/static' +'/'+item
  674. })
  675. })
  676. }
  677. }
  678. })
  679. },
  680. removeFile(data){
  681. deleteFileDetail({code:this.detailsPlanNum.planNum,name:data.name}).then(res => {
  682. if (res.success) {
  683. var cc=[]
  684. this.fileList.map(item=>{
  685. if(item.name !== data.name){
  686. cc.push(item)
  687. }
  688. })
  689. this.fileList = cc
  690. this.loading =false
  691. this.$message.success('删除成功');
  692. }else{
  693. this.$message.error(res.message);
  694. }
  695. })
  696. },
  697. //调整表头格式
  698. adjustingHeader(){
  699. this.detailsPlanNum.planQuantity=( this.detailsPlanNum.planQuantity==''|| !this.detailsPlanNum.planQuantity)?0:Number( this.detailsPlanNum.planQuantity).toFixed(0)//计划数量
  700. this.detailsPlanNum.usdTotalexportprice=( this.detailsPlanNum.usdTotalexportprice==''|| !this.detailsPlanNum.usdTotalexportprice)?0:Number( this.detailsPlanNum.usdTotalexportprice).toFixed(2)//美元外销总价
  701. this.detailsPlanNum.actualShipquantity=( this.detailsPlanNum.actualShipquantity==''|| !this.detailsPlanNum.actualShipquantity)?0:Number( this.detailsPlanNum.actualShipquantity).toFixed(0)//实际出库数量
  702. this.detailsPlanNum.rmbExportamount=( this.detailsPlanNum.rmbExportamount==''|| !this.detailsPlanNum.rmbExportamount)?0:Number( this.detailsPlanNum.rmbExportamount).toFixed(2)//人民币外销金额
  703. this.detailsPlanNum.usdExpense=( this.detailsPlanNum.usdExpense==''|| !this.detailsPlanNum.usdExpense)?0:Number( this.detailsPlanNum.usdExpense).toFixed(2)//美元费用支出
  704. this.detailsPlanNum.usdProcesscost=( this.detailsPlanNum.usdProcesscost==''|| !this.detailsPlanNum.usdProcesscost)?'':Number( this.detailsPlanNum.usdProcesscost).toFixed(2)//加工费(人民币)
  705. this.detailsPlanNum.accidentUsdamount=( this.detailsPlanNum.accidentUsdamount==''|| !this.detailsPlanNum.accidentUsdamount)?0:Number( this.detailsPlanNum.accidentUsdamount).toFixed(2)//事故单美元金额
  706. this.detailsPlanNum.salesordersLocaltotal=( this.detailsPlanNum.salesordersLocaltotal==''|| !this.detailsPlanNum.salesordersLocaltotal)?0:Number( this.detailsPlanNum.salesordersLocaltotal).toFixed(2)//销售本币金额
  707. this.detailsPlanNum.accidentcnyAmount=( this.detailsPlanNum.accidentcnyAmount==''|| !this.detailsPlanNum.accidentcnyAmount)?0:Number( this.detailsPlanNum.accidentcnyAmount).toFixed(2)//事故单人民币金额
  708. this.detailsPlanNum.salesrrdersOriginaltotal=( this.detailsPlanNum.salesrrdersOriginaltotal==''|| !this.detailsPlanNum.salesrrdersOriginaltotal)?0:Number( this.detailsPlanNum.salesrrdersOriginaltotal).toFixed(2)//销售订单原币金额
  709. this.detailsPlanNum.excipiencostIncludestaxUsd=( this.detailsPlanNum.excipiencostIncludestaxUsd==''|| !this.detailsPlanNum.excipiencostIncludestaxUsd)?0: this.detailsPlanNum.excipiencostIncludestaxUsd//辅料成本($)
  710. this.detailsPlanNum.shuiemoney=( this.detailsPlanNum.shuiemoney==''|| !this.detailsPlanNum.shuiemoney)?0: this.detailsPlanNum.shuiemoney//运费税额
  711. this.color1 = Number(this.detailsPlanNum.rmbExportamount)-Number(this.detailsPlanNum.fabriccostNotincludestax)-Number(this.detailsPlanNum.excipiencostNotincludestax)-Number(this.detailsPlanNum.rmbProcesscost)-Number(this.detailsPlanNum.rmbExpense)
  712. this.color2 = this.color1/Number(this.detailsPlanNum.usdTotalexportprice)
  713. this.color2 = this.color2>0?this.color2:-this.color2
  714. },
  715. //计算出运明细合计行
  716. calculation(val){
  717. var shipQuantityAll =0,
  718. exportPriceAll =0,
  719. rmbAmountAll = 0,
  720. processCostAll = 0
  721. val.map(item=>{
  722. if(item.outdata !=='合计'){
  723. shipQuantityAll+=Number(item.shipQuantity)
  724. exportPriceAll+=Number(item.exportPrice)
  725. rmbAmountAll+=Number(item.rmbAmount)
  726. processCostAll+=Number(item.processCost)
  727. }
  728. })
  729. var allObj ={
  730. outdata:'合计',
  731. shipQuantity:shipQuantityAll.toFixed(3),
  732. exportPrice:exportPriceAll.toFixed(3),
  733. rmbAmount:rmbAmountAll.toFixed(3),
  734. processCost:processCostAll.toFixed(3)
  735. }
  736. //发运明细-合计行
  737. if(this.$refs.unitTabs.shipData.length!==0 ){
  738. if(this.$refs.unitTabs.shipData[this.$refs.unitTabs.shipData.length-1].outdata=='合计'){
  739. this.$refs.unitTabs.shipData.pop()
  740. }
  741. this.$refs.unitTabs.shipData.push(allObj)
  742. }
  743. this.$refs.unitTabs.shipData.map(item=>{
  744. item.shipQuantity = Number(item.shipQuantity)
  745. item.exportUnitPrice = Number(item.exportUnitPrice)
  746. item.exportPrice = Number(item.exportPrice)
  747. item.rmbAmount = Number(item.rmbAmount)
  748. item.procesUnitPricermb = Number(item.procesUnitPricermb)
  749. item.procesUnitPriceusd = Number(item.procesUnitPriceusd)
  750. item.processCost = Number(item.processCost)
  751. })
  752. },
  753. //辅料中的合计行
  754. addAmountIng(val){
  755. var
  756. transferCostAll =0,
  757. rmbAmountAll = 0,
  758. usdAmountAll = 0,
  759. priceExcludingtaxAll = 0
  760. this.$refs.unitTabs.ingData.map(item=>{
  761. if(item.goodsName!=='合计'){
  762. if((!item.usdAmount|| item.usdAmount=='')||item.rmbAmount == item.usdAmount){
  763. item.usdAmount = ((item.priceExcludingtax?Number(item.priceExcludingtax):0)/Number(this.detailsPlanNum.exchangeRate)).toFixed(2)
  764. }
  765. if(item.rmbAmount !== item.usdAmount){ usdAmountAll+=item.usdAmount?Number(item.usdAmount):0 }
  766. transferCostAll+=item.transferCostAll?Number(item.transferCost):0
  767. rmbAmountAll+=item.rmbAmount?Number(item.rmbAmount):0
  768. priceExcludingtaxAll+=item.priceExcludingtax?Number(item.priceExcludingtax):0
  769. }
  770. })
  771. var allObj ={
  772. goodsName:'合计',
  773. transferCost:transferCostAll,
  774. rmbAmount:rmbAmountAll,
  775. usdAmount:usdAmountAll,
  776. priceExcludingtax:priceExcludingtaxAll,
  777. ingredientsTransferQuantity:'',
  778. ingredientsRemainingQuantity:''
  779. }
  780. if(this.$refs.unitTabs.ingData.length!==0 ){
  781. if(this.$refs.unitTabs.ingData[this.$refs.unitTabs.ingData.length-1].goodsName=='合计'){this.$refs.unitTabs.ingData.pop()}
  782. this.$refs.unitTabs.ingData.push(allObj)
  783. }
  784. if(rmbAmountAll == usdAmountAll){
  785. this.detailsPlanNum.excipiencostIncludestaxUsd = 0
  786. }else{
  787. this.detailsPlanNum.excipiencostIncludestaxUsd = usdAmountAll.toFixed(2)
  788. }
  789. },
  790. //事故单合计行
  791. addAccident(val){
  792. var amountAll=0,
  793. amountrmbAll=0,
  794. pkorgAmountAll = 0,
  795. pkorgAmountrmbAll = 0
  796. val.map(item=>{
  797. if(item.accidentUndertaker!=='合计'){
  798. amountAll+=Number(item.amount)
  799. amountrmbAll+=Number(item.amountrmb)
  800. pkorgAmountAll+=item.pkorgAmount?Number(item.pkorgAmount):0
  801. pkorgAmountrmbAll+=item.pkorgAmountrmb?Number(item.pkorgAmountrmb):0
  802. }
  803. })
  804. this.detailsPlanNum.pkorgAmount = pkorgAmountAll
  805. this.detailsPlanNum.pkorgAmountrmb = pkorgAmountrmbAll
  806. var allObj={
  807. accidentUndertaker:'合计',
  808. amount:amountAll,
  809. amountrmb:amountrmbAll
  810. }
  811. if(this.accidentListData.length!==0 ){
  812. if(this.accidentListData[this.accidentListData.length-1].accidentUndertaker=='合计'){this.accidentListData.pop()}
  813. this.accidentListData.push(allObj)
  814. }
  815. },
  816. //费用支出合计行
  817. addAmountCostPay(val){
  818. var disbursedLocalmoneyALL=0,
  819. disbursedOriginalmoneyALL=0,
  820. shuiemoneyAll = 0
  821. val.map(item=>{
  822. if(item.setNo!=='合计'){
  823. disbursedLocalmoneyALL+=item.disbursedLocalmoney?Number(item.disbursedLocalmoney):0
  824. disbursedOriginalmoneyALL+=Number(item.disbursedOriginalmoney)
  825. shuiemoneyAll+=Number(item.shuiemoney)
  826. }
  827. })
  828. var obj={
  829. setNo:'合计',
  830. disbursedLocalmoney:disbursedLocalmoneyALL,
  831. disbursedOriginalmoney:disbursedOriginalmoneyALL,
  832. shuiemoney:shuiemoneyAll.toFixed(3),
  833. iNatMoney:(disbursedLocalmoneyALL+shuiemoneyAll)
  834. }
  835. if(this.costPayData.length!==0){
  836. if(this.costPayData[this.costPayData.length-1].setNo=='合计'){this.costPayData.pop()}
  837. this.costPayData.push(obj)
  838. }
  839. this.detailsPlanNum.shuiemoney = shuiemoneyAll.toFixed(3)
  840. this.detailsPlanNum.rmbNorTaxExpense = Number(obj.disbursedLocalmoney).toFixed(2)
  841. this.detailsPlanNum.rmbExpense = Number(obj.iNatMoney).toFixed(2)
  842. this.detailsPlanNum.usdExpense = (Number(this.detailsPlanNum.rmbNorTaxExpense)/Number(this.detailsPlanNum.exchangeRate)).toFixed(2)
  843. },
  844. // 附件
  845. openEnclosure(){
  846. this.$refs.attachmentDisplay.AttachmentModVis = true
  847. var attachList = [];
  848. if (this.detailsPlanNum != null && this.detailsPlanNum.accessorItemList != null){
  849. this.detailsPlanNum.accessorItemList.forEach(e=>{
  850. var attach = {};
  851. attach.name = e.filename;
  852. attach.src=e.fileurl;
  853. attachList.push(attach);
  854. });
  855. }
  856. this.$refs.attachmentDisplay.attachmentData = attachList;
  857. },
  858. //打印
  859. daYin(){
  860. this.showSelect = 1
  861. this.$nextTick(() => {
  862. const html = window.document.getElementById('costAllocationTable').innerHTML
  863. const win = window.open();
  864. const style = '<style>\n'
  865. +'.noprint{display:none}'
  866. // +'.ant-table-body-inner{overflow-x: hidden !important;overflow-y: hidden !important }' //去除滚动条
  867. +'.ant-table-body{overflow-x: hidden !important ;overflow-y: hidden !important}'
  868. +'.ant-table-header {overflow-x: hidden !important ;overflow-y: hidden !important}'
  869. +'.ant-table-fixed-left{display: none !important}'
  870. +'.ant-tabs-nav-container{display: none !important}'
  871. +'.kk{display:flex;flex-wrap: wrap}' //主要信息并排
  872. +'.ant-col-sm-8{width:40%;margin-bottom: 6px;}'
  873. +'.ant-form-item-label{width:55%;font-size: 12px;}'
  874. +'.ant-form-item-children{font-size: 12px}'
  875. +'.ant-card-head-title{font-weight: bold;font-size: 0.67em;margin-bottom: 9px;}'
  876. +'.ant-form-item-control-wrapper{width:100%}'
  877. +'.ant-input{width:100%}'
  878. +'.ant-form-item{display:flex}'
  879. + 'table{width: 100% !important;border-collapse: collapse;border-spacing: 0;overflow-x:hidden;}\n'
  880. + 'th,td{width:2%;height: 18px;border: 1px solid #999;font-size: 12px;color: #666;max-width:2000px;text-align: center;word-wrap: break-word;}\n'
  881. +'.ant-table-row-cell-break-word{width:5% !important}'
  882. + 'th{color: #333}\n'
  883. + 'a{color: #666; text-decoration:none;}\n'
  884. +'.title{text-align: center;}'
  885. + '</style>';
  886. win.document.write(style+html);
  887. win.focus();
  888. setTimeout(function(){
  889. let textArea = win.document.getElementsByTagName('textarea')
  890. for (let i = 0; i < textArea.length; i++) {
  891. textArea[i].style.height = 'auto' // 先设置成auto,再设置高度,删除文字的时候高度才会改变
  892. textArea[i].style.height = textArea[i].scrollHeight+100 + 'px'
  893. }
  894. win.print();
  895. win.close();
  896. },500)
  897. // win.print();
  898. // win.close();
  899. this.showSelect = 0
  900. })
  901. },
  902. //该表税率
  903. changeTaxrate(){
  904. this.$refs.unitTabs.changeTaxrate(this.detailsPlanNum.taxrate)
  905. },
  906. //计算事故单美元金额和事故单人民币金额
  907. accidentCalculation(val){
  908. var usaMoney = 0,
  909. rmbMoney = 0
  910. val.map(item=>{
  911. if(item.accidentType=='应补' && item.amount!==''&&item.amount&&item.amount!=='0'&&Number(item.amount)>0){
  912. item.amount=Number(item.amount)*(-1)
  913. }else if(item.accidentType=='应补' && item.amountrmb!==''&&item.amountrmb&&item.amountrmb!=='0'&&Number(item.amount)>0){
  914. item.amountrmb = Number(item.amountrmb)*(-1)
  915. }
  916. if(item.accidentUndertaker!=='合计'){
  917. usaMoney += Number(item.amount),
  918. rmbMoney+=Number(item.amountrmb)
  919. }
  920. })
  921. this.detailsPlanNum.accidentUsdamount = usaMoney.toFixed(2)
  922. this.detailsPlanNum.accidentcnyAmount = rmbMoney.toFixed(2)
  923. },
  924. // 页面 保存
  925. save() {
  926. this.isDisabled = true
  927. setTimeout(() => {
  928. let that = this
  929. that.isDisabled = false
  930. }, 3000)
  931. var halfInfo = {}
  932. var json = this.detailsPlanNum
  933. json.outdata=moment(json.outdata).format('YYYY-MM-DD hh:mm:ss')
  934. this.loading=true
  935. addHalfInfo(json).then(res => {
  936. this.isDisabled = false
  937. this.loading=false
  938. if (res.success) {
  939. console.log('保存的部分信息', halfInfo)
  940. this.$message.success('保存成功')
  941. halfInfo = {}
  942. }else{
  943. this.$message.error(res.message);
  944. }
  945. })
  946. },
  947. // 主表:人民币费用支出 弹框
  948. mainTableExpenseCNY() {
  949. console.log('点击:主表人民币费用支出')
  950. this.$refs.mainTableExpenseCNYModal.mainTableExpenseCNYModVis = true
  951. this.$refs.mainTableExpenseCNYModal.mainTableExpenseCNYData = this.costPayData
  952. this.$refs.mainTableExpenseCNYModal.fixedData = this.costPayData
  953. },
  954. // 主表:美元费用支出 弹框
  955. mainTableExpenseUSD() {
  956. console.log('点击:主表美元费用支出')
  957. this.$refs.mainTableExpenseUSDModal.mainTableExpenseUSDModVis = true
  958. this.$refs.mainTableExpenseUSDModal.mainTableExpenseUSDData = this.costPayData
  959. this.$refs.mainTableExpenseUSDModal.fixedData = this.costPayData
  960. },
  961. orderDataChange(data){
  962. this.detailsPlanNum.queryTime = moment(data).format('yyyy-MM-DD')
  963. },
  964. // 事故单 单号 弹框
  965. accidentListCustomCell(record) {
  966. return {
  967. on: {
  968. click: event => {
  969. // this.$router.push({path:'http://localhost:3000/#/IncidentTicketModalDetail'})
  970. // console.log('this:', this)
  971. // // 调用【面料损耗表】中的【事故单】弹框
  972. // this.$refs.accidentListModal.accidentListModVis = true
  973. // this.$refs.accidentListModal.accidentList = record
  974. }
  975. }
  976. }
  977. },
  978. number(data1,data2){
  979. this.detailsPlanNum.fabriccostNotincludestax = data1
  980. // this.detailsPlanNum.excipiencostNotincludestax = data2
  981. },
  982. FabInQua(data,allYu){
  983. // this.detailsPlanNum.fabriccostIncludestax=(Number(data)+Number(this.fabricCost)-Number(allYu)).toFixed(2)//面料含税成本
  984. this.detailsPlanNum.fabriccostIncludestax=(Number(this.fabricCost)-Number(allYu)).toFixed(2)//面料含税成本
  985. this.detailsPlanNum.fabriccostIncludestaxUsd = (Number(this.detailsPlanNum.fabriccostIncludestax)/1.13/this.detailsPlanNum.exchangeRate).toFixed(2)//表头面料成本($)
  986. this.detailsPlanNum.fabriccostNotincludestax = (Number(this.detailsPlanNum.fabriccostIncludestax)/(1+(Number(this.detailsPlanNum.taxrate)/100))).toFixed(2)
  987. this.$refs.unitTabs.sumInfo.fabricAmount=this.detailsPlanNum.fabriccostIncludestax
  988. this.$refs.unitTabs.sumInfo.fabricExcludTax =(this.detailsPlanNum.fabriccostNotincludestax!==''&&this.detailsPlanNum.fabriccostNotincludestax)?(Number(this.detailsPlanNum.fabriccostNotincludestax)).toFixed(2):''//合计中的不含税面料总额
  989. this.$refs.unitTabs.sumInfo.amountTotal = (Number(this.$refs.unitTabs.sumInfo.fabricAmount)+Number(this.$refs.unitTabs.sumInfo.ingAmount)+Number( this.$refs.unitTabs.sumInfo.shipProcesFees)).toFixed(2)//合计金额
  990. },
  991. // father 方法
  992. aa() {},
  993. bb() {},
  994. cc() {}
  995. },
  996. computed: {
  997. importExcelUrl: function() {
  998. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  999. },
  1000. },
  1001. mounted() {}
  1002. }
  1003. </script>
  1004. <style lang="less" scoped>
  1005. @import '~@assets/less/common.less';
  1006. @import '~@assets/less/overwriter.less';
  1007. /deep/ .ant-table-thead > tr > th {
  1008. text-align: center;
  1009. // font-weight: 700;
  1010. }
  1011. /deep/ .ant-table-tbody {
  1012. text-align: center;
  1013. }
  1014. /deep/ .fontColor .ant-form-item-label > label{
  1015. color: red !important;
  1016. }
  1017. // /deep/ th.replacecolor {
  1018. // background-color: #ccc;
  1019. // }
  1020. // 抽屉里的card样式
  1021. // /deep/ .ant-drawer-content {
  1022. // background-color: #f0f2f5;
  1023. // }
  1024. // /deep/ .ant-drawer-body {
  1025. // padding: 10px;
  1026. // }
  1027. /deep/ form :not(.ant-input-group-wrapper) > .ant-input-group, form .ant-input-group-wrapper{
  1028. width: 65% !important;
  1029. }
  1030. /deep/ .ant-input-group{
  1031. padding-right: 6px !important;
  1032. }
  1033. .taxrate{
  1034. width: 40%;
  1035. }
  1036. .title{
  1037. display: none;
  1038. }
  1039. </style>