cost-allocation-table.vue 40 KB

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