cost-allocation-table.vue 51 KB

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