cost-allocation-table.vue 41 KB

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