fabric-loss-table.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541
  1. <template>
  2. <!-- 面料损耗表 -->
  3. <div id="fabricLossTable" >
  4. <div >
  5. <!-- 主要信息 点击搜索后 全部回显-->
  6. <h1 class="title">面料损耗表</h1>
  7. <a-card title="主要信息" >
  8. <a-row :gutter="24" >
  9. <div class="table-page-search-wrapper" >
  10. <a-form-model layout="inline" ref="form" :model="fabricLoss" :rules="validatorRules" class="kk">
  11. <a-col :md="6" :sm="8">
  12. <a-form-model-item label="计划单号">
  13. <a-input-search
  14. placeholder="请输入计划单号"
  15. v-model="planNO"
  16. enter-button
  17. @search="onSearch($event,'0')"
  18. v-show='showSelect==0&&!isView'
  19. />
  20. <a-input-search
  21. placeholder="请输入计划单号"
  22. v-text="planNO"
  23. enter-button
  24. @search="onSearch($event,'0')"
  25. v-show='showSelect==1&&!isView'
  26. />
  27. <a-input-search
  28. placeholder="请输入计划单号"
  29. v-text="planNO"
  30. enter-button
  31. @search="onSearch($event,'0')"
  32. v-show='showSelect==0&&isView'
  33. />
  34. <a-button type="primary" :disabled="edit == '0'" @click="onSearch(planNO,'1')" class="noprint" v-if="!isView">更新</a-button>
  35. </a-form-model-item>
  36. </a-col>
  37. <a-col :md="6" :sm="8">
  38. <a-form-model-item label="款号" has-feedback>
  39. {{fabricLoss.cdefine22}}
  40. <!-- <a-input v-model="fabricLoss.styleNum"></a-input> -->
  41. </a-form-model-item>
  42. </a-col>
  43. <a-col :md="6" :sm="8">
  44. <a-form-model-item label="计划员">
  45. {{fabricLoss.planner}}
  46. <!-- <a-input v-model="fabricLoss.planner"></a-input> -->
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :md="6" :sm="8">
  50. <a-form-model-item label="成衣合同号">
  51. {{fabricLoss.contractNo}}
  52. <!-- <a-input v-model="fabricLoss.garmentContractNo"></a-input> -->
  53. </a-form-model-item>
  54. </a-col>
  55. <a-col :md="6" :sm="8">
  56. <a-form-model-item label="排单数量">
  57. {{fabricLoss.number}}
  58. <!-- <a-input v-model="fabricLoss.singleRowNum"></a-input> -->
  59. </a-form-model-item>
  60. </a-col>
  61. <a-col :md="6" :sm="8">
  62. <a-form-model-item label="业务员">
  63. {{fabricLoss.cpersonName}}
  64. <!-- <a-input v-model="fabricLoss.salesman"></a-input> -->
  65. </a-form-model-item>
  66. </a-col>
  67. <a-col :md="6" :sm="8">
  68. <a-form-model-item label="总成本">
  69. {{fabricLoss.actualMoney}}
  70. <!-- <a-input v-model="fabricLoss.actualUnitCost"></a-input> -->
  71. </a-form-model-item>
  72. </a-col>
  73. <a-col :md="6" :sm="8">
  74. <a-form-model-item label="实际出库数量">
  75. {{fabricLoss.outboundNumber}}
  76. <!-- <a-input v-model="fabricLoss.actualOutQuantity"></a-input> -->
  77. </a-form-model-item>
  78. </a-col>
  79. <a-col :md="6" :sm="8">
  80. <a-form-model-item label="制单人">
  81. {{fabricLoss.makingPeople}}
  82. <!-- <a-input v-model="fabricLoss.preparedBy"></a-input> -->
  83. </a-form-model-item>
  84. </a-col>
  85. <a-col :md="6" :sm="8">
  86. <a-form-model-item label="查询日期">
  87. {{fabricLoss.dateTime}}
  88. <!-- <a-date-picker style="width: 100%" v-model="fabricLoss.queryDate"></a-date-picker> -->
  89. </a-form-model-item>
  90. </a-col>
  91. <a-col :md="6" :sm="8" class="noprint">
  92. <a-button type="primary" @click="openEnclosure">附件</a-button>
  93. </a-col>
  94. <a-col :md="6" :sm="8" class="noprint">
  95. <a-upload name="file" :showUploadList="true" :file-list="fileList" :multiple="true" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel" :data="{code:this.planNO,name:this.fileName}" :beforeUpload="uploadFlie" :remove="removeFile">
  96. <a-button type="primary" >附件上传</a-button>
  97. </a-upload>
  98. <!-- <j-upload v-model="fabricLoss.attachs" ></j-upload> -->
  99. <!-- <a-upload name="file" action="https://www.mocky.io/v2/5cc8019d300000980a055e76" :multiple="true" :default-file-list="fileList">
  100. <a-button type="primary" >附件上传</a-button>
  101. </a-upload> -->
  102. <!-- <a-button type="primary" @click="openEnclosure">附件</a-button> -->
  103. </a-col>
  104. </a-form-model>
  105. </div>
  106. </a-row>
  107. <a-row :gutter="24" >
  108. <!-- <a-col :md="24" :sm="8" class="noprint">
  109. <a-upload name="file" action="https://www.mocky.io/v2/5cc8019d300000980a055e76" :multiple="true" :default-file-list="fileList">
  110. <a-button type="primary" >附件上传</a-button>
  111. </a-upload>
  112. </a-col> -->
  113. </a-row>
  114. </a-card>
  115. </div>
  116. <div >
  117. <!-- 子表 -->
  118. <a-card style="margin:10px 0;">
  119. <!-- 采购订单 -->
  120. <div :class="[purchase-order-table,(fabricLoss.fabricPoOrderList.length==0?'noprint': '')]">
  121. <h6 class="table-title">采购订单</h6>
  122. <a-table
  123. :row-key="record => record.id"
  124. :loading="loading"
  125. :columns="purchaseOrderColumns"
  126. :data-source="fabricLoss.fabricPoOrderList"
  127. bordered
  128. :pagination="false"
  129. :rowClassName="setRowClassName"
  130. >
  131. <template slot="omcVenAbbName" slot-scope="text, record, index">
  132. <div v-for="(item,index) in record.omcVenAbbNameArray" :key="index">
  133. {{item}}
  134. </div>
  135. </template>
  136. <!-- 采购数量 弹框-->
  137. <span slot="purchaseQuantity" slot-scope="text">
  138. <a>{{ text }}</a>
  139. </span>
  140. <!-- 余纱 -->
  141. <span slot="surplusYarn" slot-scope="text">
  142. <a>{{ text }}</a>
  143. </span>
  144. <!-- 来源余纱 -->
  145. <span slot="fromSurplusYarn" slot-scope="text">
  146. <a>{{ text }}</a>
  147. </span>
  148. <!-- 其他入库的纱 -->
  149. <span slot="surplusYarn" slot-scope="text">
  150. <a>{{ text }}</a>
  151. </span>
  152. <!-- 分配数量 -->
  153. <span slot="slotIquantityOut" slot-scope="text">
  154. <a>{{ text }}</a>
  155. </span>
  156. </a-table>
  157. </div>
  158. <!-- 委外订单国内 -->
  159. <div style="margin:40px 0" id="mm" :class="[outsource-orders-table,fabricLoss.fabricOMOrderList1.length==0?'noprint': '']">
  160. <h6 class="table-title">委外订单国内</h6>
  161. <a-table
  162. id="print1"
  163. ref="form"
  164. :row-key="record => record.id"
  165. :columns="outsourceOrderColumns"
  166. :data-source="fabricLoss.fabricOMOrderList1"
  167. bordered
  168. :pagination="false"
  169. :scroll="{ x: 1500 }"
  170. :loading="loading">
  171. <!-- 材料出库数量 -->
  172. <span slot="materialsOutQuantity" slot-scope="text">
  173. <a>{{ text }}</a>
  174. </span>
  175. <!-- 采购入库数量 -->
  176. <span slot="purchaseInQuantity" slot-scope="text">
  177. <a>{{ text }}</a>
  178. </span>
  179. <!-- 多发少发 -->
  180. <span slot="iquantityMoreLess" slot-scope="text">
  181. <a>{{ text }}</a>
  182. </span>
  183. <!-- 附件 -->
  184. <span slot="enclosure" slot-scope="text, record">
  185. <a-button type="primary" @click="openItemOnclosure(record)" :disabled="record.buttonStatus">附件</a-button>
  186. </span>
  187. </a-table>
  188. </div>
  189. <!-- 委外订单国外 -->
  190. <div id="cb" :class="[outsourceOrder-abroad-table,fabricLoss.fabricOMOrderList2.length==0?'noprint': '']">
  191. <h6 class="table-title">委外订单国外</h6>
  192. <a-table
  193. :row-key="record => record.id"
  194. :loading="loading"
  195. :columns="outsourceOrderColumns"
  196. :data-source="fabricLoss.fabricOMOrderList2"
  197. :scroll="{ x: 1500 }"
  198. bordered
  199. :pagination="false"
  200. >
  201. <!-- 材料出库数量 -->
  202. <span slot="materialsOutQuantity" slot-scope="text">
  203. <a>{{ text }}</a>
  204. </span>
  205. <!-- 采购入库数量 -->
  206. <span slot="purchaseInQuantity" slot-scope="text">
  207. <a>{{ text }}</a>
  208. </span>
  209. <!-- 多发少发 -->
  210. <span slot="iquantityMoreLess" slot-scope="text">
  211. <a>{{ text }}</a>
  212. </span>
  213. <!-- 附件 -->
  214. <span slot="enclosure" slot-scope="text, record">
  215. <a-button type="primary" @click="openItemOnclosure(record)" :disabled="record.buttonStatus">附件</a-button>
  216. </span>
  217. </a-table>
  218. </div>
  219. <!-- 成本发票 -->
  220. <div style="margin:40px 0" :class="[cost-invoice-table,fabricLoss.fabricCostInvoiceList.length==0?'noprint': '']">
  221. <h6 class="table-title">成本发票</h6>
  222. <a-table
  223. :row-key="record => record.id"
  224. :loading="loading"
  225. :columns="costInvoiceColumns"
  226. :data-source="fabricLoss.fabricCostInvoiceList"
  227. bordered
  228. :pagination="false"
  229. >
  230. <span slot="cbusType" slot-scope="text,record">
  231. <a-input placeholder="请输入" v-model="record.cbusType" v-if="record.bmanual && showSelect==0"/>
  232. <span v-else>{{text}}</span>
  233. </span>
  234. <!-- 成本金额 -->
  235. <span slot="imoney" slot-scope="text,record">
  236. <a v-if="(record.cbusType == '转出成本') || (record.cbusType == '转入成本')&& !record.bmanual" @click="imoneyCell(record)">{{text}}</a>
  237. <span v-if="(record.cbusType !== '转出成本') && (record.cbusType !== '转入成本') && !record.bmanual" >{{text}}</span>
  238. <a-input placeholder="请输入" v-model="record.imoney" v-if="record.bmanual && showSelect==0" @blur="judageNumber(record,'imoney')"/>
  239. <span v-if="record.bmanual && showSelect==1" >{{text}}</span>
  240. </span>
  241. <!-- 工厂 -->
  242. <span slot="cvenAbbName" slot-scope="text,record">
  243. <a-input placeholder="请输入工厂" v-model="record.cvenAbbName" v-if="(record.cbusType == '转出成本' && showSelect==0) ||(record.bmanual&& showSelect==0)"/>
  244. <span v-else>{{text}}</span>
  245. </span>
  246. <!-- 无税金额-->
  247. <span slot="inoTaxMoney" slot-scope="text,record">
  248. <a-input placeholder="请输入" v-model="record.inoTaxMoney" v-if="showSelect==0 && record.cbusType!=='合计'" @blur="judageNumber(record,'inoTaxMoney')"/>
  249. <span v-else>{{text}}</span>
  250. </span>
  251. </a-table>
  252. </div>
  253. <!-- 开票成本-面料 -->
  254. <div :class="[costInvoice-fabric-table,fabricLoss.fabricCostClothList.length==0?'noprint': '']">
  255. <h6 class="table-title">开票成本-面料</h6>
  256. <!-- ref="" -->
  257. <a-table
  258. :row-key="record => record.id"
  259. :loading="loading"
  260. :columns="costInvoiceFabricColumns"
  261. :data-source="fabricLoss.fabricCostClothList"
  262. bordered
  263. :pagination="false"
  264. >
  265. <!-- 发票号码明细 -->
  266. <span slot="invoiceNum" slot-scope="text">
  267. <a v-if="text!=='合计'">{{ text }}</a>
  268. <span v-else>{{text}}</span>
  269. </span>
  270. </a-table>
  271. </div>
  272. <!-- 开票成本-成衣 :footer="clothesFooterShow"-->
  273. <div :class="[costInvoice-clothes-table,fabricLoss.fabricCostClothesList.length==0?'noprint': '']" style="margin:40px 0">
  274. <h6 class="table-title">开票成本-成衣</h6>
  275. <a-table
  276. :row-key="record => record.id"
  277. :loading="loading"
  278. :columns="costInvoiceClothesColumns"
  279. :data-source="fabricLoss.fabricCostClothesList"
  280. bordered
  281. :pagination="false"
  282. >
  283. <!-- 发票数量 -->
  284. <span slot="clInvoiceQuantity" slot-scope="text">
  285. <a>{{ text }}</a>
  286. </span>
  287. </a-table>
  288. </div>
  289. <!-- 开票成本-辅料 -->
  290. <div :class="[costInvoice-ingredient-table,fabricLoss.fabricCostAssistList.length==0?'noprint': '']">
  291. <h6 class="table-title">开票成本-辅料</h6>
  292. <a-table
  293. :row-key="record => record.id"
  294. :loading="loading"
  295. :columns="costInvoiceIngredientColumns"
  296. :data-source="fabricLoss.fabricCostAssistList"
  297. bordered
  298. :pagination="false"
  299. >
  300. <!-- 发票数量 -->
  301. <span slot="ingredientsInvoiceQuantity" slot-scope="text, record">
  302. <a v-if="record.caccount!=='合计'">{{ text }}</a>
  303. <span v-else>{{text}}</span>
  304. </span>
  305. </a-table>
  306. </div>
  307. <!-- 费用支出 -->
  308. <div class="costPay-table noprint" style="margin:40px 0">
  309. <h6 class="table-title">费用支出</h6>
  310. <a-table
  311. :row-key="record => record.id"
  312. :loading="loading"
  313. :columns="costPayColumns"
  314. :data-source="fabricLoss.fabricExpensesList"
  315. bordered
  316. :pagination="false"
  317. :footer="costPayFooterShow"
  318. >
  319. </a-table>
  320. </div>
  321. <!-- 事故单 -->
  322. <div :class="[accidentBill-table,fabricLoss.fabricAccidentList.length==0?'noprint': '']">
  323. <h6 class="table-title">事故单</h6>
  324. <a-table
  325. :row-key="record => record.id"
  326. :loading="loading"
  327. :columns="accidentListColumns"
  328. :data-source="fabricLoss.fabricAccidentList"
  329. bordered
  330. :pagination="false"
  331. >
  332. <!-- 事故单 -->
  333. <span slot="accidentNum" slot-scope="text">
  334. <a>{{ text }}</a>
  335. </span>
  336. </a-table>
  337. </div>
  338. <!-- 备注信息 1 根据角色判断 显示备注 1 或备注 2-->
  339. <div class="note-one" style="marginTop:40px;">
  340. <h6 class="table-title">备注</h6>
  341. <div class="noteDetail">
  342. <a-form-model ref="form" :model="fabricLoss" :rues="validatorRules">
  343. <a-form-model-item prop="noteOne">
  344. <a-input type="textarea" v-model="fabricLoss.noteOne" style="minHeight:160px;" v-show='showSelect==0'/>
  345. <a-input type="textarea" v-text="fabricLoss.noteOne" style="minHeight:160px;" v-show='showSelect==1'/>
  346. </a-form-model-item>
  347. </a-form-model>
  348. </div>
  349. </div>
  350. <!-- 采购订单 -->
  351. <!-- 备注信息 2 根据角色判断 显示备注 1 或备注 2-->
  352. <!-- <div class="note-one" style="marginTop:40px;">
  353. <h6 class="table-title">备注信息 2</h6>
  354. <div class="noteDetail">
  355. <a-form-model ref="form" :model="fabricLoss" :rues="validatorRules">
  356. <a-form-model-item prop="noteOne">
  357. <a-input
  358. type="textarea"
  359. v-model="fabricLoss.noteTwo"
  360. placeholder="请输入备注"
  361. style="minHeight:100px;"
  362. />
  363. </a-form-model-item>
  364. </a-form-model>
  365. </div>
  366. </div> -->
  367. <!-- 页面底部保存 -->
  368. <a-row :gutter="24" style="marginTop:40px;float:right" class="noprint" v-if="!isView">
  369. <a-col :md="12" :sm="12" style="display:flex">
  370. <a-button type="primary" @click="daYin" style="margin-right:6px" :disabled ="PrintButton">
  371. 打印
  372. </a-button>
  373. <a-popconfirm title="已完成,是否要继续保存?" ok-text="是" cancel-text="否" @confirm="save()" v-if="fabricLoss.status=='完成'">
  374. <a-button type="primary" :loading="loadingBtn" :disabled="!(fabricLoss.status==''||fabricLoss.status=='保存'|| fabricLoss.status=='完成'|| fabricLoss.status=='返单')">
  375. 保存
  376. </a-button>
  377. </a-popconfirm>
  378. <a-button type="primary" @click="save" :loading="loadingBtn" :disabled="!(fabricLoss.status==''||fabricLoss.status=='保存'|| fabricLoss.status=='完成'|| fabricLoss.status=='返单')" v-if="fabricLoss.status!=='完成'">
  379. 保存
  380. </a-button>
  381. </a-col>
  382. </a-row>
  383. <!-- 弹框 -->
  384. <div>
  385. <!-- 采购数量弹框 @ok="modalFormOk"-->
  386. <purchaseAmount-modal ref="purchaseAmountModal" :father="aa"></purchaseAmount-modal>
  387. <!-- 来源余纱 -->
  388. <surplusYarn-modal ref="surplusYarnModal" :father="bb"></surplusYarn-modal>
  389. <!-- 余纱 -->
  390. <purchaseLeft-modal ref="purchaseLeftModal"></purchaseLeft-modal>
  391. <!-- 其他入库的纱 -->
  392. <otherYarnsIn-modal ref="otherYarnsInModal" ></otherYarnsIn-modal>
  393. <!-- 多发少发 -->
  394. <iquantityMoreLess-modal ref="iquantityMoreLessModal"></iquantityMoreLess-modal>
  395. <!-- 委外订单国内弹框 -->
  396. <materialsOutQuantity-modal ref="materialsOutQuantityModal" :father="cc" @Bulk-price="bulkPrice"></materialsOutQuantity-modal>
  397. <!-- 采购入库数量弹框 -->
  398. <purchaseInQuantity-modal ref="purchaseInQuantityModal" :father="dd"></purchaseInQuantity-modal>
  399. <!-- 发票号码弹框 -->
  400. <invoiceNum-modal ref="invoiceNumModal" :father="ee"></invoiceNum-modal>
  401. <!-- 发票数量弹框 -->
  402. <invoiceQuantity-modal ref="invoiceQuantityModal" :father="ff"></invoiceQuantity-modal>
  403. <!-- 事故单 -->
  404. <accidentList-modal ref="accidentListModal" :father="gg"></accidentList-modal>
  405. <!-- 附件 -->
  406. <attachment-display ref="attachmentDisplay"></attachment-display>
  407. <imoney-cell ref="imoneyCell"></imoney-cell>
  408. </div>
  409. </a-card>
  410. </div>
  411. </div>
  412. </template>
  413. <script>
  414. import PurchaseAmountModal from '@views/reportForms/fabric-loss-table/purchaseAmountModal.vue'
  415. import materialsOutQuantityModal from '@views/reportForms/fabric-loss-table/materialsOutQuantityModal.vue'
  416. import purchaseInQuantityModal from '@views/reportForms/fabric-loss-table/purchaseInQuantityModal.vue'
  417. import invoiceNumModal from '@views/reportForms/fabric-loss-table/invoiceNumModal.vue'
  418. import invoiceQuantityModal from '@views/reportForms/fabric-loss-table/invoiceQuantityModal.vue'
  419. import accidentListModal from '@views/reportForms/fabric-loss-table/accidentListModal.vue'
  420. import surplusYarnModal from '@views/reportForms/fabric-loss-table/surplusYarnModal.vue'
  421. import purchaseLeftModal from '@views/reportForms/fabric-loss-table/purchaseLeftModal.vue'
  422. import imoneyCell from '@views/reportForms/fabric-loss-table/imoneyCell.vue'
  423. import iquantityMoreLessModal from '@views/reportForms/fabric-loss-table/iquantityMoreLessModal.vue'
  424. import otherYarnsInModal from '@views/reportForms/fabric-loss-table/otherYarnsInModal.vue'
  425. import AttachmentDisplay from '@views/reportForms/fabric-loss-table/attachment-display.vue'
  426. import { getFabricLossDatas,saveFabricLossData,fileDetail } from '@api/reportForms/fabric-loss-table'
  427. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  428. import JEllipsis from '@/components/jeecg/JEllipsis'
  429. import JUpload from '@/components/jeecg/JUpload'
  430. import moment from 'moment'
  431. export default {
  432. name: 'FabricLossTable', // 面料损耗表
  433. mixins: [JeecgListMixin],
  434. components: {
  435. // 面料损耗表 所有弹框
  436. PurchaseAmountModal,
  437. otherYarnsInModal,
  438. materialsOutQuantityModal,
  439. purchaseInQuantityModal,
  440. invoiceNumModal,
  441. invoiceQuantityModal,
  442. iquantityMoreLessModal,
  443. accidentListModal,
  444. surplusYarnModal,
  445. purchaseLeftModal,
  446. JEllipsis,
  447. moment,
  448. JUpload,
  449. AttachmentDisplay,
  450. accessory2:[],
  451. imoneyCell
  452. },
  453. data() {
  454. return {
  455. PrintButton:true,//打印按钮
  456. showSelect:0,//计划号是否是输入框
  457. fabricLoss: {fabricPoOrderList:[],fabricOMOrderList1:[],fabricOMOrderList2:[],fabricCostAssistList:[],fabricCostClothList:[],fabricCostClothesList:[],fabricCostInvoiceList:[],fabricExpensesList:[],fabricAccidentList:[]}, // 主表信息
  458. loading: false, // 表格加载
  459. loadingBtn:false, //保存按钮加载
  460. validatorRules: {
  461. planNum: [{ required: true, message: '请输入计划单号进行搜索', trigger: 'blur' }]
  462. },
  463. fileList: [
  464. ],
  465. fileName:'',
  466. edit:'0',
  467. planNO:'',//计划单号
  468. isView:false,//是否查看状态
  469. // 采购订单 表头
  470. purchaseOrderColumns: [
  471. { title: '货物名称', width: '21%', dataIndex: 'cinvName', className: 'replacecolor specel-width'},
  472. /*
  473. { title: '批号', width: 80, dataIndex: 'cbatch', className: 'replacecolor',
  474. customRender:function(text,record,index){
  475. if (text == null || text == undefined){
  476. return "";
  477. }
  478. if (text.indexOf(",")>-1){
  479. const arr = text.split(',');
  480. return (<div>
  481. {
  482. arr.map(t=>{
  483. return (<li>{t}</li>)
  484. })
  485. }
  486. </div>)
  487. }else{
  488. return text;
  489. }
  490. }
  491. },*/
  492. { title: '订单号', width:'8%' , dataIndex: 'cpoid', className: 'replacecolor',
  493. customRender:function(text,record,index){
  494. if (text == null || text == undefined){
  495. return "";
  496. }
  497. if (text.indexOf(",")>-1){
  498. const arr = text.split(',');
  499. return (<div>
  500. {
  501. arr.map(t=>{
  502. return (<li>{t}</li>)
  503. })
  504. }
  505. </div>)
  506. }else{
  507. return text;
  508. }
  509. }
  510. },
  511. { title: '计划数量', dataIndex: 'iquantity', width:'6%', className: 'replacecolor' },
  512. {
  513. title: '采购数量',
  514. dataIndex: 'iquantityIn',
  515. width: '6%',
  516. className: 'replacecolor',
  517. customCell: this.purchaseQuantityCustomCell,
  518. scopedSlots: { customRender: 'purchaseQuantity' }
  519. },
  520. { title: '采购供应商', dataIndex: 'cvenAbbName', width: '7%', className: 'replacecolor' },
  521. { title: '分配数量', dataIndex: 'iquantityOut', width: '5%', className: 'replacecolor' },
  522. { title: '委外供应商', dataIndex: 'omcVenAbbName', width: '10%', className: 'replacecolor',scopedSlots: { customRender: 'omcVenAbbName' }, },
  523. {
  524. title: '余纱',
  525. dataIndex: 'iquantityLeft',
  526. width:'5%',
  527. className: 'replacecolor',
  528. customCell: this.surplusYarnCustomCell,
  529. scopedSlots: { customRender: 'surplusYarn' }
  530. },
  531. { title: '采购损耗', dataIndex: 'iquantityLeftRate', width: '6%', className: 'replacecolor' }
  532. ],
  533. // 委外订单国内 表头
  534. outsourceOrderColumns: [
  535. { title: '制造工艺', width: '10%', dataIndex: 'cvcname', className: 'replacecolor' },
  536. { title: '工厂', width: 80, dataIndex: 'cvenAbbName', className: 'replacecolor specleWidth' },
  537. {
  538. title: '材料出库数量',
  539. dataIndex: 'iquantityOut',
  540. width: '5%',
  541. className: 'replacecolor',
  542. customCell: this.materialsOutQuantityCustomCell,
  543. scopedSlots: { customRender: 'materialsOutQuantity' }
  544. },
  545. { title: '计划数量', dataIndex: 'iquantity', width: '6%', className: 'replacecolor' },
  546. {
  547. title: '单位',
  548. children: [
  549. {
  550. title: '根',
  551. dataIndex: 'iquantityPCS',
  552. width: '5%',
  553. className: 'replacecolor'
  554. },
  555. {
  556. title: '米',
  557. dataIndex: 'iquantityM',
  558. width: '5%',
  559. className: 'replacecolor'
  560. }
  561. ]
  562. },
  563. {
  564. title: '采购入库数量',
  565. dataIndex: 'iquantityIn',
  566. width: '7%',
  567. className: 'replacecolor',
  568. customCell: this.purchaseInQuantityCustomCell,
  569. scopedSlots: { customRender: 'purchaseInQuantity' }
  570. },
  571. { title: '染厂色号', dataIndex: 'ccolorNumber', width:'10%', className: 'replacecolor' },
  572. { title: '物料编码', dataIndex: 'cinvCode', width: '7%', className: 'replacecolor noprint' },
  573. { title: '货物名称', dataIndex: 'cinvName', width: '20%',className: 'replacecolor specel-width' },
  574. { title: '颜色', dataIndex: 'ccolor', width: '7%', className: 'replacecolor' },
  575. { title: '损耗', dataIndex: 'cquantityLoss', width: '6%',className: 'replacecolor' },
  576. { title: '多发少发', dataIndex: 'iquantityMoreLess', width: '6%', className: 'replacecolor', scopedSlots: { customRender: 'iquantityMoreLess' }, customCell: this.iquantityMoreLessCell, },
  577. { title: '附件', dataIndex: 'enclosure', width: '6%', className: 'noprint', scopedSlots: { customRender: 'enclosure' }}
  578. ],
  579. // 成本发票 表头
  580. costInvoiceColumns: [
  581. { title: '类型', width: 120, dataIndex: 'cvcname', className: 'replacecolor' },
  582. { title: '采购类型', width: 120, dataIndex: 'cbusType', className: 'replacecolor' , scopedSlots: { customRender: 'cbusType' }},
  583. { title: '工厂', width: 120, dataIndex: 'cvenAbbName', className: 'replacecolor', scopedSlots: { customRender: 'cvenAbbName' } },
  584. { title: '成本金额', dataIndex: 'imoney', width: 120, className: 'replacecolor',scopedSlots: { customRender: 'imoney' } },
  585. { title: '无税金额', dataIndex: 'inoTaxMoney', width: 120, className: 'replacecolor',scopedSlots: { customRender: 'inoTaxMoney' } }
  586. ],
  587. costInvoiceData: [
  588. { costInvoiceType: '纱款', factory: '17TW-C-17B', costAmount: '5081.72' },
  589. { costInvoiceType: '纱款', factory: '17TW-C-17C', costAmount: '127754.31' },
  590. { costInvoiceType: '织款', factory: '18TW-C-8', costAmount: '17045.48' },
  591. { costInvoiceType: '染款', factory: '福隆', costAmount: '59762.4' },
  592. { costInvoiceType: '织款', factory: '江阴美纶', costAmount: '20482.95' }
  593. ],
  594. // 开票成本-面料 表头
  595. costInvoiceFabricColumns: [
  596. { title: '序号', width: 80, dataIndex: 'index', className: 'replacecolor' },
  597. {
  598. title: '发票号码',
  599. width: 120,
  600. dataIndex: 'csbvcode',
  601. className: 'replacecolor',
  602. customCell: this.invoiceNumCustomCell,
  603. scopedSlots: { customRender: 'invoiceNum' }
  604. },
  605. { title: '供应商', width: 120, dataIndex: 'cvenName', className: 'replacecolor' },
  606. { title: '采购发票金额', width: 120, dataIndex: 'inatSum', className: 'replacecolor' },
  607. { title: '出运日期', width: 120, dataIndex: 'cshipTime', className: 'replacecolor' }
  608. ],
  609. costInvoiceFabricData: [
  610. { invoiceNum: '18TW-MYA-44', supplier: '供应商1', PurchaseinvoiceCost: '888.88', outData: '2018-05-04' },
  611. { invoiceNum: '18TW-MYA-78', supplier: '供应商1', PurchaseinvoiceCost: '888.88', outData: '2018-05-18' },
  612. { invoiceNum: '18TW-MYA-34', supplier: '供应商1', PurchaseinvoiceCost: '888.88', outData: '2018-06-1' }
  613. ],
  614. costInvoiceClothesColumns:[],
  615. // 开票成本-成衣 表头无美元
  616. costInvoiceClothesColumnsM1:[
  617. { title: '序号', width: 80, dataIndex: 'index', className: 'replacecolor' },
  618. { title: '发票号码', width: 120, dataIndex: 'cpbvcode', className: 'replacecolor' },
  619. { title: '委外供应商', width: 120, dataIndex: 'cvenAbbName', className: 'replacecolor' },
  620. { title: '成衣加工费(人民币)', width: 120, dataIndex: 'isum', className: 'replacecolor' },
  621. { title: '出运日期', width: 120, dataIndex: 'cshipTime', className: 'replacecolor' },
  622. { title: '入库数量', width: 120, dataIndex: 'iquantity', className: 'replacecolor' },
  623. {
  624. title: '发票数量',
  625. dataIndex: 'ipbvquantity',
  626. width: 120,
  627. className: 'replacecolor',
  628. customCell: this.clInvoiceQuantityCustomCell,
  629. scopedSlots: { customRender: 'clInvoiceQuantity' }
  630. }
  631. ],
  632. // 开票成本-成衣 表头
  633. costInvoiceClothesColumnsAll: [
  634. { title: '序号', width: 80, dataIndex: 'index', className: 'replacecolor' },
  635. { title: '发票号码', width: 120, dataIndex: 'cpbvcode', className: 'replacecolor' },
  636. { title: '委外供应商', width: 120, dataIndex: 'cvenAbbName', className: 'replacecolor' },
  637. { title: '成衣加工费(人民币)', width: 120, dataIndex: 'isum', className: 'replacecolor' },
  638. { title: '成衣加工费(美元)', width: 120, dataIndex: 'ioriSum', className: 'replacecolor' },
  639. { title: '出运日期', width: 120, dataIndex: 'cshipTime', className: 'replacecolor' },
  640. { title: '入库数量', width: 120, dataIndex: 'iquantity', className: 'replacecolor' },
  641. {
  642. title: '发票数量',
  643. dataIndex: 'ipbvquantity',
  644. width: 120,
  645. className: 'replacecolor',
  646. customCell: this.clInvoiceQuantityCustomCell,
  647. scopedSlots: { customRender: 'clInvoiceQuantity' }
  648. }
  649. ],
  650. // 开票成本-辅料 表头
  651. costInvoiceIngredientColumns:[],
  652. costInvoiceIngredientColumnsM1:[
  653. { title: '序号', width: '10%', dataIndex: 'index', className: 'replacecolor' },
  654. { title: '账套号', width: '10%', dataIndex: 'caccount', className: 'replacecolor' },
  655. { title: '订单号', width: '10%', dataIndex: 'cpoid', className: 'replacecolor' },
  656. { title: '供应商', width: '7%', dataIndex: 'cvenAbbName', className: 'replacecolor' },
  657. { title: ' 类型', width: '13%', dataIndex: 'cinvName', className: 'replacecolor',align:"left" },
  658. {
  659. title: '发票数量',
  660. width: '7%',
  661. dataIndex: 'iquantityInvoice',
  662. className: 'replacecolor',
  663. customCell: this.ingredientsInvoiceQuantityCustomCell,
  664. scopedSlots: { customRender: 'ingredientsInvoiceQuantity' }
  665. },
  666. { title: '开票金额(人民币)', width: '10%', dataIndex: 'isum', className: 'replacecolor' },
  667. { title: '无税金额', width: '6%', dataIndex: 'inoTaxMoney', className: 'replacecolor' },
  668. { title: '单位', width: '10%', dataIndex: 'ccomUnitName', className: 'replacecolor' },
  669. { title: '订单数', width: '10%', dataIndex: 'iquantity', className: 'replacecolor' },
  670. { title: '采购入库数', width: '10%', dataIndex: 'iquantityIn', className: 'replacecolor' }
  671. ],
  672. costInvoiceIngredientColumnsAll: [
  673. { title: '账套号', width: '10%', dataIndex: 'caccount', className: 'replacecolor' },
  674. { title: '订单号', width: '10%', dataIndex: 'cpoid', className: 'replacecolor' },
  675. { title: '供应商', width: '7%', dataIndex: 'cvenAbbName', className: 'replacecolor' },
  676. { title: ' 类型', width: '10%', dataIndex: 'cinvName', className: 'replacecolor',align:"left" },
  677. {
  678. title: '发票数量',
  679. width: '10%',
  680. dataIndex: 'iquantityInvoice',
  681. className: 'replacecolor',
  682. customCell: this.ingredientsInvoiceQuantityCustomCell,
  683. scopedSlots: { customRender: 'ingredientsInvoiceQuantity' }
  684. },
  685. { title: '开票金额(人民币)', width: '10%', dataIndex: 'isum', className: 'replacecolor' },
  686. { title: '开票金额(美元)', width: '10%', dataIndex: 'ioriSum', className: 'replacecolor',customRender: (text, record, index) => {
  687. if (record.isum == record.ioriSum)
  688. return "";
  689. else
  690. return record.ioriSum;
  691. } },
  692. { title: '无税金额', width: '6%', dataIndex: 'inoTaxMoney', className: 'replacecolor' },
  693. { title: '单位', width: '10%', dataIndex: 'ccomUnitName', className: 'replacecolor' },
  694. { title: '订单数', width: '10%', dataIndex: 'iquantity', className: 'replacecolor' },
  695. { title: '采购入库数', width: '10%', dataIndex: 'iquantityIn', className: 'replacecolor' }
  696. ],
  697. costInvoiceIngredientData: [
  698. { factory: '森加', type: '主标', ingredientsInvoiceQuantity: '45900', invoiceAmountCNY: '259.42' },
  699. { factory: '森加', type: '尺码标', ingredientsInvoiceQuantity: '3670', invoiceAmountCNY: '1475.6' }
  700. ],
  701. // 费用支出 表头
  702. costPayColumns: [
  703. { title: '账套号', width: 120, dataIndex: 'caccount', className: 'replacecolor' },
  704. { title: '支出单号', width: 120, dataIndex: 'cspvcode', className: 'replacecolor' },
  705. { title: '费用项目', dataIndex: 'cexpName', width: 120, className: 'replacecolor' },
  706. { title: '支出人民币金额', dataIndex: 'inatMoney', width: 120, className: 'replacecolor' },
  707. { title: '支出美元金额', dataIndex: 'imoney', width: 120, className: 'replacecolor',customRender: (text, record, index) => {
  708. if (record.imoney == record.inatMoney)
  709. return "";
  710. else
  711. return record.imoney;
  712. } },
  713. { title: '发票号', dataIndex: 'cinvoinceNo', width: 120, className: 'replacecolor' },
  714. { title: '制单人', dataIndex: 'cmaker', width: 120, className: 'replacecolor' }
  715. ],
  716. costPayData: [{}],
  717. // 事故单 表头
  718. accidentListColumns: [
  719. {
  720. title: '单号',
  721. width: 120,
  722. dataIndex: 'cpbvcode',
  723. className: 'replacecolor',
  724. // customCell: this.accidentListCustomCell,
  725. scopedSlots: { customRender: 'cpbvcode' }
  726. },
  727. {
  728. title: '事故单号',
  729. width: 120,
  730. dataIndex: 'cpbvmemo',
  731. className: 'replacecolor',
  732. // customCell: this.accidentListCustomCell,
  733. // scopedSlots: { customRender: 'cpbvcode' }
  734. },
  735. { title: '事故承担方', width: 120, dataIndex: 'cvenAbbName', className: 'replacecolor' },
  736. { title: '金额', dataIndex: 'ioriSum', width: 120, className: 'replacecolor' }
  737. ],
  738. accidentListData: [{ accidentNum: '1100011' }, { accidentNum: '3540011' }],
  739. url: {
  740. list: '/sys/user/list',
  741. importExcelUrl: 'report/FabricLoss/addFile' ,// 导入
  742. },
  743. noteOne: '', // 备注 1
  744. noteTwo: '' // 备注 2
  745. }
  746. },
  747. methods: {
  748. uploadFlie(file) {
  749. this.fileName = file.name
  750. // fileDetail({code:this.planNO,name:file.file.name}).then(res => {
  751. // if (res.success) {
  752. // this.$message.success('上传成功');
  753. // this.fileList.push({
  754. // uid: '-1',
  755. // name: file.file.name,
  756. // status: 'done',
  757. // url:'http://www.myfitt.cn:18001/jeecg-boot/sys/common/static' +'/'+file.file.name
  758. // })
  759. // }else{
  760. // this.loading = false
  761. // this.$message.error(res.message);
  762. // }
  763. // })
  764. // const formData = new FormData()
  765. // formData.append('file', file.file)
  766. },
  767. removeFile(data){
  768. },
  769. daYin(){
  770. this.showSelect = 1
  771. this.$nextTick(() => {
  772. const html = window.document.getElementById('fabricLossTable').innerHTML
  773. const win = window.open();
  774. const style = '<style>\n'
  775. +'.noprint{display:none}'
  776. +'.specleWidth{width:15% !important}'
  777. +'.ant-table-body{overflow-x: hidden !important }' //去除滚动条
  778. +'.kk{display:flex;flex-wrap: wrap}' //主要信息并排
  779. +'.ant-col-sm-8{width:40%;margin-bottom: 6px;}'
  780. +'.ant-form-item-label{width:45%;font-size: 12px;}'
  781. +'.ant-form-item-children{font-size: 12px}'
  782. +'.ant-card-head-title{font-weight: bold;font-size: 0.67em;margin-bottom: 9px;}'
  783. +'.ant-form-item-control-wrapper{width:100%}'
  784. +'.ant-input{width:100%}'
  785. +'.ant-form-item{display:flex}'
  786. + 'table{width: 100% !important;border-collapse: collapse;border-spacing: 0;overflow-x:hidden;}\n'
  787. + 'th,td{width:5%;height: 18px;border: 1px solid #999;font-size: 12px;color: #666;max-width:2000px;text-align: center;}\n'
  788. +'.ant-table-row-cell-break-word{width:5%}'
  789. +'.specel-width{width:25% !important}'
  790. + 'th{color: #333}\n'
  791. + 'a{color: #666; text-decoration:none;}\n'
  792. +'.table-title{margin-bottom: 0% !important;margin-top: 0% !important;}'
  793. +'.outsource-orders-table{margin: 15px 0px !important;}'
  794. +'.cost-invoice-table{ margin: 15px 0px !important;}'
  795. +'.costInvoice-fabric-table{margin: 15px 0px !important;}'
  796. +'.costInvoice-ingredient-table{margin: 15px 0px !important;}'
  797. +'.note-one{ margin-top: 15px;}'
  798. +'.title{text-align: center;}'
  799. + '</style>';
  800. win.document.write(style+html);
  801. win.focus();
  802. setTimeout(function(){
  803. let textArea = win.document.getElementsByTagName('textarea')
  804. for (let i = 0; i < textArea.length; i++) {
  805. textArea[i].style.height = 'auto' // 先设置成auto,再设置高度,删除文字的时候高度才会改变
  806. textArea[i].style.height = textArea[i].scrollHeight+30 + 'px'
  807. }
  808. win.print();
  809. win.close();
  810. this.showSelect = 0
  811. },500)
  812. // win.print();
  813. // win.close();
  814. // this.showSelect = 0
  815. })
  816. },
  817. // 【计划单号】 搜索
  818. onSearch(value,update) {
  819. if (value == "" || value == null){
  820. this.$message.error('请输入计划号!');
  821. }else{
  822. this.loading = true;
  823. this.$nextTick(() => {
  824. getFabricLossDatas({csocode:value,update:update}).then(res => {
  825. this.loading = false;
  826. if (res.success) {
  827. this.PrintButton = false
  828. this.fabricLoss = res.result;
  829. var fileList = this.fabricLoss.attachs.split(",")
  830. this.fileList = []
  831. fileList.map(item=>{
  832. this.fileList.push({
  833. uid: '-1',
  834. name: item,
  835. status: 'done',
  836. url:'http://www.myfitt.cn:18001/jeecg-boot/sys/common/static' +'/'+item
  837. })
  838. })
  839. this.edit = this.fabricLoss.edit
  840. // 开票成本成衣:获取原币和本币金额是否完全相同,完全相同隐藏美元列
  841. var findList = this.fabricLoss.fabricCostClothesList.filter(e=>e.ioriSum!=e.isum);
  842. if (findList.length == 0)
  843. this.costInvoiceClothesColumns = this.costInvoiceClothesColumnsM1;
  844. else
  845. this.costInvoiceClothesColumns = this.costInvoiceClothesColumnsAll;
  846. // 开票成本辅料:获取原币和本币金额是否完全相同,完全相同隐藏美元列
  847. findList = this.fabricLoss.fabricCostAssistList.filter(e=>e.ioriSum!=e.isum);
  848. if (findList.length == 0)
  849. this.costInvoiceIngredientColumns = this.costInvoiceIngredientColumnsM1;
  850. else
  851. this.costInvoiceIngredientColumns = this.costInvoiceIngredientColumnsAll;
  852. // 委外订单国内附件按钮状态
  853. this.fabricLoss.fabricOMOrderList1.map(item=>{
  854. item.buttonStatus = false
  855. if(!item.accessorItemList||item.accessorItemList.length == 0 ){
  856. item.buttonStatus = true
  857. }
  858. })
  859. // 委外订单国外附件按钮状态
  860. this.fabricLoss.fabricOMOrderList2.map(item=>{
  861. item.buttonStatus = false
  862. if(!item.accessorItemList||item.accessorItemList.length == 0 ){
  863. item.buttonStatus = true
  864. }
  865. })
  866. this.fabricLoss.fabricCostClothesList.map((item,index) => {item.index = index +1})
  867. this.fabricLoss.fabricCostClothList.map((item,index) => {item.index = index +1})
  868. this.fabricLoss.fabricCostAssistList.map((item,index) => {item.index = index +1})
  869. this.fabricLoss.fabricPoOrderList.map(item => {
  870. item["omcVenAbbNameArray"] = item.omcVenAbbName ? (item.omcVenAbbName.split(",")) : ''
  871. })
  872. if (this.fabricLoss.fabricAccidentList == null){
  873. this.fabricLoss.fabricAccidentList = [];
  874. }
  875. this.calculateTotal('frist')
  876. this.$forceUpdate()
  877. }else{
  878. this.fabricLoss = {fabricPoOrderList:[],fabricOMOrderList1:[],fabricOMOrderList2:[],fabricCostAssistList:[],fabricCostClothList:[],fabricCostClothesList:[],fabricCostInvoiceList:[],fabricExpensesList:[],fabricAccidentList:[]};
  879. this.$message.info(res.message);
  880. }
  881. })
  882. })
  883. }
  884. },
  885. //计算合计行
  886. calculateTotal(data){
  887. if(data =='notFrist'){
  888. this.fabricLoss.fabricCostInvoiceList.pop()
  889. this.fabricLoss.fabricCostClothList.pop()
  890. this.fabricLoss.fabricAccidentList.pop()
  891. this.fabricLoss.fabricCostClothesList.pop()
  892. this.fabricLoss.fabricCostAssistList.pop()
  893. }
  894. //计算成本发票合计
  895. var imoney = 0,
  896. inoTaxMoney = 0
  897. for (let row of this.fabricLoss.fabricCostInvoiceList){
  898. imoney += row.imoney*1;
  899. inoTaxMoney +=(row.inoTaxMoney?row.inoTaxMoney:0)*1
  900. }
  901. if(this.fabricLoss.fabricCostInvoiceList.length !==0){
  902. this.fabricLoss.fabricCostInvoiceList.push({
  903. cvcname:'',
  904. cbusType:'合计',
  905. cvenAbbName:'',
  906. imoney:parseFloat(imoney.toFixed(2)),
  907. inoTaxMoney:parseFloat(inoTaxMoney.toFixed(2)),
  908. })
  909. }
  910. //计算开票成本-面料合计
  911. var inatSum = 0;
  912. for (let row of this.fabricLoss.fabricCostClothList){
  913. inatSum += row.inatSum*1;
  914. }
  915. if(this.fabricLoss.fabricCostClothList.length !==0){
  916. this.fabricLoss.fabricCostClothList.push({
  917. index:'',
  918. csbvcode:'合计',
  919. cvenName:'',
  920. inatSum:parseFloat(inatSum.toFixed(2)),
  921. cshipTime:''
  922. })
  923. }
  924. //计算开票成本-成衣合计
  925. var isum = 0,ioriSum=0,iquantity=0,ipbvquantity=0;
  926. for (let row of this.fabricLoss.fabricCostClothesList){
  927. isum += row.isum*1;
  928. ioriSum += row.ioriSum*1;
  929. iquantity += row.iquantity*1;
  930. ipbvquantity += row.ipbvquantity*1;
  931. }
  932. if(this.fabricLoss.fabricCostClothesList.length!==0){
  933. this.fabricLoss.fabricCostClothesList.push({
  934. cpbvcode:'合计',
  935. isum: parseFloat(isum.toFixed(2)),
  936. ioriSum: parseFloat(ioriSum.toFixed(2)),
  937. iquantity: parseFloat(iquantity.toFixed(4)),
  938. ipbvquantity: parseFloat(ipbvquantity.toFixed(4)),
  939. })
  940. }
  941. //开票成本-辅料合计
  942. var isum = 0,ioriSum=0,iquantity=0,iquantityIn=0,iquantityInvoice=0,inoTaxMoney = 0
  943. for (let row of this.fabricLoss.fabricCostAssistList){
  944. isum += row.isum*1;
  945. iquantity += row.iquantity*1;
  946. iquantityIn += row.iquantityIn*1;
  947. iquantityInvoice += row.iquantityInvoice*1;
  948. inoTaxMoney += (row.inoTaxMoney?row.inoTaxMoney:0)*1
  949. if(row.isum!==row.ioriSum){
  950. ioriSum += row.ioriSum*1;
  951. }
  952. }
  953. if(this.fabricLoss.fabricCostAssistList.length !== 0){
  954. this.fabricLoss.fabricCostAssistList.push({
  955. caccount:'合计',
  956. isum:parseFloat(isum.toFixed(2)),
  957. ioriSum:parseFloat(ioriSum.toFixed(2)),
  958. iquantity:parseFloat(iquantity.toFixed(4)),
  959. iquantityIn:parseFloat(iquantityIn.toFixed(4)),
  960. iquantityInvoice:parseFloat(iquantityInvoice.toFixed(4)),
  961. inoTaxMoney:parseFloat(inoTaxMoney.toFixed(4)),
  962. })
  963. }
  964. //事故单合计
  965. var item = {
  966. "cvenAbbName":"合计"
  967. };
  968. var ioriSum = 0
  969. for (let row of this.fabricLoss.fabricAccidentList){
  970. ioriSum += row.ioriSum*1
  971. }
  972. if(this.fabricLoss.fabricAccidentList.length !== 0){
  973. this.fabricLoss.fabricAccidentList.push({
  974. cvenAbbName:"合计",
  975. ioriSum:parseFloat(ioriSum.toFixed(4))
  976. })
  977. }
  978. },
  979. //判断哪个列表为空 -----有bug暂时不使用
  980. judgeListLength(){
  981. this.$nextTick(() => {
  982. var data = [
  983. {List:this.fabricLoss.fabricPoOrderList,class:'.purchase-order-table'},
  984. {List:this.fabricLoss.fabricOMOrderList1,class:'.outsource-orders-table'},
  985. {List:this.fabricLoss.fabricOMOrderList2,class:'.outsourceOrder-abroad-table'},
  986. {List:this.fabricLoss.fabricCostInvoiceList,class:'.cost-invoice-table'},
  987. {List:this.fabricLoss.fabricCostClothList,class:'.costInvoice-fabric-table'},
  988. {List:this.fabricLoss.fabricCostClothesList,class:'.costInvoice-clothes-table'},
  989. {List:this.fabricLoss.fabricCostAssistList,class:'.costInvoice-ingredient-table'},
  990. {List:this.fabricLoss.fabricExpensesList,class:'.costPay-table'},
  991. {List:this.fabricLoss.fabricAccidentList,class:'.accidentBill-table'},
  992. ]
  993. data.map(item=>{
  994. if(item.List.length == 0){
  995. var bb =document.querySelector(item.class)
  996. console.log(document)
  997. // bb.className = 'noprint'
  998. }
  999. })
  1000. })
  1001. },
  1002. judageNumber(record,data){
  1003. if(isNaN(Number(record.imoney)) && data=='imoney'){
  1004. this.$message.error('必须输入数字,请重新输入!');
  1005. record.imoney = ''
  1006. }
  1007. if(isNaN(Number(record.inoTaxMoney)) && data=='inoTaxMoney'){
  1008. this.$message.error('必须输入数字,请重新输入!');
  1009. record.inoTaxMoney = ''
  1010. }
  1011. this.calculateTotal('notFrist')
  1012. },
  1013. //行样式
  1014. setRowClassName(record) {
  1015. return(record.iquantityLeft!==0&&record.fabricPoOrderOutList.length == 0) ? "inputRowStyl" : "inputRowSty2";//赋予点击行样式
  1016. },
  1017. // 【采购数量】单元格 弹框
  1018. purchaseQuantityCustomCell(record) {
  1019. return {
  1020. on: {
  1021. click: event => {
  1022. if (record.cpoid == '来源余料') {
  1023. this.$refs.surplusYarnModal.surplusYarnData = record.fabricPoOrderOutList;
  1024. this.$refs.surplusYarnModal.allDataList = record.fabricPoOrderOutList;
  1025. this.$refs.surplusYarnModal.surplusYarnModVis = true
  1026. }else if (record.cpoid == '其他入库') {
  1027. this.$refs.otherYarnsInModal.otherYarnsInData = record.fabricPoOrderOutList;
  1028. this.$refs.otherYarnsInModal.allDataList = record.fabricPoOrderOutList;
  1029. this.$refs.otherYarnsInModal.otherYarnsInModVis = true
  1030. } else {
  1031. this.$refs.purchaseAmountModal.purchaseAmountData = record.fabricPoOrderInList;
  1032. this.$refs.purchaseAmountModal.allDataList = record.fabricPoOrderInList;
  1033. this.$refs.purchaseAmountModal.purchaseAmountModVis = true
  1034. }
  1035. }
  1036. }
  1037. }
  1038. },
  1039. // 余纱
  1040. surplusYarnCustomCell(record) {
  1041. return {
  1042. on: {
  1043. click: event => {
  1044. this.$refs.purchaseLeftModal.surplusYarnData = record.fabricPoOrderOutList;
  1045. this.$refs.purchaseLeftModal.allDataList = record.fabricPoOrderOutList;
  1046. this.$refs.purchaseLeftModal.surplusYarnModVis = true
  1047. }
  1048. }
  1049. }
  1050. },
  1051. iquantityMoreLessCell(record){
  1052. return {
  1053. on: {
  1054. click: event => {
  1055. this.$refs.iquantityMoreLessModal.surplusYarnData = record.fabricPoOrderOutList;
  1056. this.$refs.iquantityMoreLessModal.allDataList = record.fabricPoOrderOutList;
  1057. this.$refs.iquantityMoreLessModal.surplusYarnModVis = true
  1058. }
  1059. }
  1060. }
  1061. },
  1062. //成本金额弹窗
  1063. imoneyCell(record){
  1064. this.$refs.imoneyCell.imoneyModVis = true
  1065. this.$refs.imoneyCell.imoneyData = record.costInvoiceDetailList
  1066. },
  1067. // 【材料出库数量】 弹框
  1068. materialsOutQuantityCustomCell(record) {
  1069. return {
  1070. on: {
  1071. click: event => {
  1072. this.$refs.materialsOutQuantityModal.materialsOutQuantityData = record.fabricMoOrderCKList;
  1073. this.$refs.materialsOutQuantityModal.allDataList = record.fabricMoOrderCKList;
  1074. this.$refs.materialsOutQuantityModal.queryParam = {};
  1075. this.$refs.materialsOutQuantityModal.materialsOutQuantityModVis = true
  1076. }
  1077. }
  1078. }
  1079. },
  1080. // 采购入库数量
  1081. purchaseInQuantityCustomCell(record) {
  1082. return {
  1083. on: {
  1084. click: event => {
  1085. this.$refs.purchaseInQuantityModal.purchaseInQuantityData = record.fabricMoOrderRKList;
  1086. this.$refs.purchaseInQuantityModal.allDataList = record.fabricMoOrderRKList;
  1087. this.$refs.purchaseInQuantityModal.queryParam = {};
  1088. this.$refs.purchaseInQuantityModal.purchaseInQuantityModVis = true
  1089. }
  1090. }
  1091. }
  1092. },
  1093. // 开票成本-面料弹框
  1094. invoiceNumCustomCell(record) {
  1095. if(record.csbvcode!=='合计'){
  1096. return {
  1097. on: {
  1098. click: event => {
  1099. this.$refs.invoiceNumModal.invoiceNumData = record.fabricCostClothDetailList;
  1100. this.$refs.invoiceNumModal.allDataList = record.fabricCostClothDetailList;
  1101. this.$refs.invoiceNumModal.queryParam = {};
  1102. this.$refs.invoiceNumModal.invoiceNumModVis = true;
  1103. }
  1104. }
  1105. }
  1106. }
  1107. },
  1108. //费用支出 ----合计行
  1109. costPayFooterShow(){
  1110. return (
  1111. <a-table
  1112. rowKey={Math.random}
  1113. bordered={false}
  1114. pagination={false}
  1115. columns={this.costPayColumns}
  1116. dataSource={this.costPayFooterDataSource || []}
  1117. showHeader={false}
  1118. ></a-table>
  1119. )
  1120. },
  1121. //事故单 -----合计
  1122. // accidentFooterShow(){
  1123. // return (
  1124. // <a-table
  1125. // rowKey={Math.random}
  1126. // bordered={false}
  1127. // pagination={false}
  1128. // columns={this.accidentListColumns}
  1129. // dataSource={this.accidentFooterDataSource || []}
  1130. // showHeader={false}
  1131. // ></a-table>
  1132. // )
  1133. // },
  1134. // 开票成本-面料 ----合计行
  1135. clothFooterShow(data) {
  1136. return (
  1137. <a-table
  1138. rowKey={Math.random}
  1139. bordered={false}
  1140. pagination={false}
  1141. columns={this.costInvoiceFabricColumns}
  1142. dataSource={this.clothFooterDataSource || []}
  1143. showHeader={false}
  1144. ></a-table>
  1145. )
  1146. },
  1147. // 开票成本成衣-弹框
  1148. clInvoiceQuantityCustomCell(record) {
  1149. return {
  1150. on: {
  1151. click: event => {
  1152. this.$refs.invoiceQuantityModal.invoiceQuantityData = record.fabricCostClothesDetailList;
  1153. this.$refs.invoiceQuantityModal.allDataList = record.fabricCostClothesDetailList;
  1154. this.$refs.invoiceQuantityModal.invoiceQuantityModVis = true;
  1155. }
  1156. }
  1157. }
  1158. },
  1159. // 开票成本辅料-弹框
  1160. ingredientsInvoiceQuantityCustomCell(record) {
  1161. if(record.caccount!=='合计'){
  1162. return {
  1163. on: {
  1164. click: event => {
  1165. this.$refs.invoiceQuantityModal.invoiceQuantityData = record.fabricCostAssistDetailList;
  1166. this.$refs.invoiceQuantityModal.allDataList = record.fabricCostAssistDetailList;
  1167. this.$refs.invoiceQuantityModal.queryParam = {};
  1168. this.$refs.invoiceQuantityModal.invoiceQuantityModVis = true
  1169. }
  1170. }
  1171. }
  1172. }
  1173. },
  1174. // 事故单 单号 弹框
  1175. accidentListCustomCell(record) {
  1176. return {
  1177. on: {
  1178. click: event => {
  1179. console.log('this:', this)
  1180. this.$refs.accidentListModal.accidentListModVis = true
  1181. }
  1182. }
  1183. }
  1184. },
  1185. save() {
  1186. const that = this
  1187. if (this.fabricLoss.makingPeople == null){
  1188. that.$message.info('没有可保存的数据,请先查询数据');
  1189. return;
  1190. }
  1191. this.loadingBtn = true;
  1192. saveFabricLossData(this.fabricLoss).then(res => {
  1193. that.loadingBtn = false;
  1194. if (res.success) {
  1195. this.$message.success(res.message);
  1196. this.onSearch(this.planNO,'0')
  1197. // that.fabricLoss = res.result;
  1198. }else{
  1199. this.$message.error(res.message)
  1200. }
  1201. });
  1202. },
  1203. // 附件
  1204. openEnclosure(){
  1205. this.$refs.attachmentDisplay.AttachmentModVis = true
  1206. var attachList = [];
  1207. if (this.fabricLoss != null && this.fabricLoss.accessorItemList != null){
  1208. this.fabricLoss.accessorItemList.forEach(e=>{
  1209. var attach = {};
  1210. attach.name = e.filename;
  1211. attach.src=e.fileurl;
  1212. attachList.push(attach);
  1213. });
  1214. }
  1215. this.$refs.attachmentDisplay.attachmentData = attachList;
  1216. },
  1217. openItemOnclosure(record){
  1218. var attachList = [];
  1219. record.accessorItemList.forEach(e=>{
  1220. var attach = {};
  1221. attach.name = e.filename;
  1222. attach.src=e.fileurl;
  1223. attachList.push(attach);
  1224. });
  1225. this.$refs.attachmentDisplay.AttachmentModVis = true
  1226. this.$refs.attachmentDisplay.attachmentData = attachList;
  1227. },
  1228. //供应商,颜色,批号
  1229. bulkPrice(supplier,colour,lotNumber,editPricre){
  1230. colour=colour? colour : "";
  1231. lotNumber=lotNumber? lotNumber : "";
  1232. this.fabricLoss.fabricOMOrderList1.map(item=>{
  1233. item.fabricMoOrderCKList.map(event=>{
  1234. if(event.cinvCodeOut == supplier && event.ccolorOut==colour && (event.cvenAbbName == ''|| !event.cvenAbbName)){
  1235. var length =(lotNumber)? lotNumber.length:0
  1236. lotNumber = lotNumber?lotNumber:''
  1237. if(event.cbatchOut.substring(0,length)==lotNumber){
  1238. event.iprice = editPricre
  1239. }
  1240. }
  1241. })
  1242. })
  1243. this.fabricLoss.fabricOMOrderList2.map(item=>{
  1244. item.fabricMoOrderCKList.map(event=>{
  1245. if(event.cinvCodeOut == supplier && event.ccolorOut==colour && (event.cvenAbbName == ''|| !event.cvenAbbName)){
  1246. var length =(lotNumber)? lotNumber.length:0
  1247. lotNumber = lotNumber?lotNumber:''
  1248. if(event.cbatchOut.substring(0,length)==lotNumber){
  1249. event.iprice = editPricre
  1250. }
  1251. }
  1252. })
  1253. })
  1254. },
  1255. // father
  1256. aa() {},
  1257. bb() {},
  1258. cc() {},
  1259. dd() {},
  1260. ee() {},
  1261. ff() {},
  1262. gg() {}
  1263. },
  1264. // 出现滚动条,合计栏跟随 table 滚动
  1265. // watch: {
  1266. // dataSource(val) {
  1267. // console.log(val)
  1268. // // 同步表与footer滚动
  1269. // let dom = this.$refs.TableInfo.$el.querySelectorAll('.ant-table-body')[0]
  1270. // dom.addEventListener(
  1271. // 'scroll',
  1272. // () => {
  1273. // this.$refs.TableInfo.$el.querySelectorAll('.ant-table-body')[1].scrollLeft = dom.scrollLeft
  1274. // console.log('走到这')
  1275. // },
  1276. // true
  1277. // )
  1278. // }
  1279. // },
  1280. // 构建合计数据 --合计
  1281. computed: {
  1282. importExcelUrl: function() {
  1283. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  1284. },
  1285. // costFooterDataSource(){
  1286. // //成本发票 合计
  1287. // var item = {
  1288. // "cbusType":"合计"
  1289. // };
  1290. // var imoney = 0;
  1291. // for (let row of this.fabricLoss.fabricCostInvoiceList){
  1292. // imoney += row.imoney*1;
  1293. // }
  1294. // item.imoney= parseFloat(imoney.toFixed(2));
  1295. // return [item];
  1296. // },
  1297. // clothFooterDataSource() {
  1298. // // 开票成本-面料 合计
  1299. // var item = {
  1300. // "csbvcode":"合计"
  1301. // };
  1302. // var inatSum = 0;
  1303. // for (let row of this.fabricLoss.fabricCostClothList){
  1304. // inatSum += row.inatSum*1;
  1305. // }
  1306. // item.inatSum= parseFloat(inatSum.toFixed(2));
  1307. // return [item];
  1308. // },
  1309. // clothesFooterDataSource() {
  1310. // // 开票成本-衬衣 合计
  1311. // var item = {
  1312. // "cpbvcode":"合计"
  1313. // };
  1314. // var isum = 0,ioriSum=0,iquantity=0,ipbvquantity=0;
  1315. // for (let row of this.fabricLoss.fabricCostClothesList){
  1316. // isum += row.isum*1;
  1317. // ioriSum += row.ioriSum*1;
  1318. // iquantity += row.iquantity*1;
  1319. // ipbvquantity += row.ipbvquantity*1;
  1320. // }
  1321. // item.isum= parseFloat(isum.toFixed(2));
  1322. // item.ioriSum = parseFloat(ioriSum.toFixed(2));
  1323. // item.iquantity = parseFloat(iquantity.toFixed(4));
  1324. // item.ipbvquantity = parseFloat(ipbvquantity.toFixed(4));
  1325. // return [item];
  1326. // },
  1327. // assistFooterDataSource() {
  1328. // // 开票成本-辅料 合计
  1329. // var item = {
  1330. // "caccount":"合计"
  1331. // };
  1332. // var isum = 0,ioriSum=0,iquantity=0,iquantityIn=0,iquantityInvoice=0;
  1333. // for (let row of this.fabricLoss.fabricCostAssistList){
  1334. // isum += row.isum*1;
  1335. // ioriSum += row.ioriSum*1;
  1336. // iquantity += row.iquantity*1;
  1337. // iquantityIn += row.iquantityIn*1;
  1338. // iquantityInvoice += row.iquantityInvoice*1;
  1339. // }
  1340. // item.isum= parseFloat(isum.toFixed(2));
  1341. // item.ioriSum = parseFloat(ioriSum.toFixed(2));
  1342. // item.iquantity = parseFloat(iquantity.toFixed(4));
  1343. // item.iquantityIn = parseFloat(iquantityIn.toFixed(4));
  1344. // item.iquantityInvoice = parseFloat(iquantityInvoice.toFixed(4));
  1345. // return [item];
  1346. // },
  1347. costPayFooterDataSource(){
  1348. //费用支出 合计
  1349. var item = {
  1350. "cspvcode":"合计"
  1351. };
  1352. var inatMoney = 0,imoney=0
  1353. for (let row of this.fabricLoss.fabricExpensesList){
  1354. inatMoney += row.inatMoney*1;
  1355. if(row.inatMoney == row.imoney ){
  1356. imoney += 0
  1357. }else{
  1358. imoney += row.imoney*1
  1359. }
  1360. }
  1361. item.inatMoney = parseFloat(inatMoney.toFixed(4));
  1362. item.imoney = parseFloat(imoney.toFixed(4));
  1363. return [item];
  1364. },
  1365. // accidentFooterDataSource(){
  1366. // //事故单 合计
  1367. // var item = {
  1368. // "cvenAbbName":"合计"
  1369. // };
  1370. // var ioriSum = 0
  1371. // for (let row of this.fabricLoss.fabricAccidentList){
  1372. // ioriSum += row.ioriSum*1
  1373. // }
  1374. // item.ioriSum = parseFloat(ioriSum.toFixed(4));
  1375. // return [item];
  1376. // }
  1377. },
  1378. created(){
  1379. var ccode = this.$route.query.ccode;
  1380. /*
  1381. console.log("----------------ccode 1:"+ccode);
  1382. var url = window.location.href ; //获取当前url
  1383. var dz_url = url.split('#')[0]; //获取#/之前的字符串
  1384. var cs = dz_url.split('?')[1]; //获取?之后的参数字符串
  1385. var cs_arr = cs.split('&'); //参数字符串分割为数组
  1386. var cs={};
  1387. for(var i=0;i<cs_arr.length;i++){ //遍历数组,拿到json对象
  1388. cs[cs_arr[i].split('=')[0]] = cs_arr[i].split('=')[1]
  1389. }
  1390. ccode = cs.ccode;
  1391. console.log("----------------ccode 2:"+ccode); */
  1392. if (ccode != undefined && ccode != ""){
  1393. this.planNO = ccode;
  1394. // this.showSelect=1;
  1395. this.isView = true;
  1396. this.onSearch(this.planNO,'0');
  1397. }
  1398. }
  1399. }
  1400. </script>
  1401. <style lang="less" scoped>
  1402. @import '~@assets/less/common.less';
  1403. @import '~@assets/less/overwriter.less';
  1404. /deep/ .ant-table-thead > tr > th {
  1405. text-align: center;
  1406. // font-weight: 700;
  1407. }
  1408. /deep/ .ant-table-tbody {
  1409. text-align: center;
  1410. }
  1411. // /deep/ th.replacecolor {
  1412. // background-color: #ccc;
  1413. // }
  1414. /deep/ .ant-table-footer .ant-table.body {
  1415. // overflow: hidden !important;
  1416. }
  1417. /deep/ .ant-table.ant-table-bordered .ant-table-footer {
  1418. border: none;
  1419. padding: 0;
  1420. }
  1421. /deep/ .ant-form-item-children {
  1422. display: flex;
  1423. }
  1424. /deep/ form :not(.ant-input-group-wrapper) > .ant-input-group, form .ant-input-group-wrapper{
  1425. width: 65% !important;
  1426. }
  1427. /deep/ .ant-input-group{
  1428. padding-right: 6px !important;
  1429. }
  1430. /deep/ .ant-table .ant-table-row-indent + .ant-table-row-expand-icon{
  1431. display: none !important;
  1432. }
  1433. .title{
  1434. display: none;
  1435. }
  1436. // /deep/.ant-upload.ant-upload-select{
  1437. // float: left;
  1438. // }
  1439. // /deep/.ant-upload-list{
  1440. // float: left;
  1441. // display: flex
  1442. // }
  1443. </style>