cost-allocation-table.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <!--报表 成本分配表 (保存后数据到单证的成本分配汇总内)-->
  3. <div id="costAllocationTable">
  4. <a-card :bordered="false">
  5. <!-- 主表信息 点击搜索后 回显--->
  6. <div class="table-page-search-wrapper">
  7. <!-- ref="form" :model="costAllocationTable" -->
  8. <a-form-model layout="inline">
  9. <a-row :gutter="24">
  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"
  17. />
  18. </a-form-model-item>
  19. </a-col>
  20. <!-- 回显以下【备注】需要输入,后进行保存 disabled -->
  21. <a-col :md="6" :sm="8">
  22. <a-form-model-item label="产品款号" prop="poStyleNum">
  23. {{ detailsPlanNum.poStyleNum }}
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8">
  27. <a-form-model-item label="外销员" prop="exportSales">
  28. {{ detailsPlanNum.exportSales }}
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="6" :sm="8">
  32. <a-form-model-item label="成衣合同号" prop="garmentContractno">
  33. {{ detailsPlanNum.garmentContractno }}
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :md="6" :sm="8">
  37. <a-form-model-item label="部门" prop="department">
  38. {{ detailsPlanNum.department }}
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :md="6" :sm="8">
  42. <a-form-model-item label="客户简称" prop="customerShortame">
  43. {{ detailsPlanNum.customerShortame }}
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :md="6" :sm="8">
  47. <a-form-model-item label="加工单位" prop="processUnit">
  48. {{ detailsPlanNum.processUnit }}
  49. </a-form-model-item>
  50. </a-col>
  51. <a-col :md="6" :sm="8">
  52. <a-form-model-item label="出运日期" prop="outdata">
  53. {{ detailsPlanNum.outdata }}
  54. </a-form-model-item>
  55. </a-col>
  56. <a-col :md="6" :sm="8">
  57. <a-form-model-item label="计划数量" prop="planQuantity">
  58. {{ detailsPlanNum.planQuantity }}
  59. </a-form-model-item>
  60. </a-col>
  61. <a-col :md="6" :sm="8">
  62. <a-form-model-item label="美元外销总价" prop="usdTotalexportprice">
  63. {{ detailsPlanNum.usdTotalexportprice }}
  64. </a-form-model-item>
  65. </a-col>
  66. <a-col :md="6" :sm="8">
  67. <a-form-model-item label="人民币费用支出" prop="rmbExpense">
  68. <a href="javascript:void(0)" @click="mainTableExpenseCNY()">{{ detailsPlanNum.rmbExpense }}</a>
  69. </a-form-model-item>
  70. </a-col>
  71. <a-col :md="6" :sm="8">
  72. <a-form-model-item label="税率%" prop="taxrate">
  73. {{ detailsPlanNum.taxrate }}
  74. </a-form-model-item>
  75. </a-col>
  76. <a-col :md="6" :sm="8">
  77. <a-form-model-item label="实际出货数量" prop="actualShipquantity">
  78. {{ detailsPlanNum.actualShipquantity }}
  79. </a-form-model-item>
  80. </a-col>
  81. <a-col :md="6" :sm="8">
  82. <a-form-model-item label="人民币外销金额" prop="rmbExportamount">
  83. {{ detailsPlanNum.rmbExportamount }}
  84. </a-form-model-item>
  85. </a-col>
  86. <a-col :md="6" :sm="8">
  87. <a-form-model-item label="美元费用支出" prop="usdExpense">
  88. <a href="javascript:void(0)" @click="mainTableExpenseUSD()">{{ detailsPlanNum.usdExpense }}</a>
  89. </a-form-model-item>
  90. </a-col>
  91. <a-col :md="6" :sm="8">
  92. <a-form-model-item label="加工费" prop="rmbProcesscost">
  93. {{ detailsPlanNum.rmbProcesscost }}
  94. </a-form-model-item>
  95. </a-col>
  96. <a-col :md="6" :sm="8">
  97. <a-form-model-item label="短出数" prop="shortseveral">
  98. {{ detailsPlanNum.shortseveral }}
  99. </a-form-model-item>
  100. </a-col>
  101. <a-col :md="6" :sm="8">
  102. <a-form-model-item label="短出货值" prop="shortvalue">
  103. {{ detailsPlanNum.shortvalue }}
  104. </a-form-model-item>
  105. </a-col>
  106. <a-col :md="6" :sm="8">
  107. <a-form-model-item label="短出面料成本" prop="fabricshortcost">
  108. {{ detailsPlanNum.fabricshortcost }}
  109. </a-form-model-item>
  110. </a-col>
  111. <a-col :md="6" :sm="8">
  112. <a-form-model-item label="事故单美金金额" prop="accidentUsdamount">
  113. {{ detailsPlanNum.accidentUsdamount }}
  114. </a-form-model-item>
  115. </a-col>
  116. <a-col :md="6" :sm="8">
  117. <a-form-model-item label="面料含税成本" prop="fabriccostIncludestax">
  118. {{ detailsPlanNum.fabriccostIncludestax }}
  119. </a-form-model-item>
  120. </a-col>
  121. <a-col :md="6" :sm="8">
  122. <a-form-model-item label="辅料含税成本" prop="excipiencostIncludestax">
  123. {{ detailsPlanNum.excipiencostIncludestax }}
  124. </a-form-model-item>
  125. </a-col>
  126. <a-col :md="6" :sm="8">
  127. <a-form-model-item label="销售订单本币总额" prop="salesordersLocaltotal">
  128. {{ detailsPlanNum.salesordersLocaltotal }}
  129. </a-form-model-item>
  130. </a-col>
  131. <a-col :md="6" :sm="8">
  132. <a-form-model-item label="事故单人民币金额" prop="accidentcnyAmount">
  133. {{ detailsPlanNum.accidentcnyAmount }}
  134. </a-form-model-item>
  135. </a-col>
  136. <a-col :md="6" :sm="8">
  137. <a-form-model-item label="面料不含税成本" prop="fabriccostNotincludestax">
  138. {{ detailsPlanNum.fabriccostNotincludestax }}
  139. </a-form-model-item>
  140. </a-col>
  141. <a-col :md="6" :sm="8">
  142. <a-form-model-item label="辅料不含税成本" prop="excipiencostNotincludestax">
  143. {{ detailsPlanNum.excipiencostNotincludestax }}
  144. </a-form-model-item>
  145. </a-col>
  146. <a-col :md="6" :sm="8">
  147. <a-form-model-item label="销售订单原币总额" prop="salesrrdersOriginaltotal">
  148. {{ detailsPlanNum.salesrrdersOriginaltotal }}
  149. </a-form-model-item>
  150. </a-col>
  151. <a-col :md="6" :sm="8">
  152. <a-form-model-item label="制单人" prop="preparedBy">
  153. {{ detailsPlanNum.preparedBy }}
  154. </a-form-model-item>
  155. </a-col>
  156. <a-col :md="6" :sm="8">
  157. <h4 style="color:red;">
  158. 标记
  159. <span>(计算结果是负值时,该标记是红色)</span>
  160. </h4>
  161. </a-col>
  162. </a-row>
  163. </a-form-model>
  164. </div>
  165. </a-card>
  166. <!--tabs 组件引入 -->
  167. <a-card :bordered="false" style=" marginTop:10px;">
  168. <div><tabs ref="unitTabs" /></div>
  169. </a-card>
  170. <!-- 事故单 -->
  171. <a-card :bordered="true" style="margin:10px 0">
  172. <div style="margin:60px 0 40px 0">
  173. <h6 class="table-title">事故单</h6>
  174. <a-table
  175. rowKey="id"
  176. :loading="loading"
  177. :columns="accidentListColumns"
  178. :data-source="accidentListData"
  179. bordered
  180. :pagination="false"
  181. :scroll="{ y: 300 }"
  182. >
  183. <!-- 事故单 -->
  184. <span slot="accidentNum" slot-scope="text">
  185. <a>{{ text }}</a>
  186. </span>
  187. </a-table>
  188. </div>
  189. <!-- 费用支出 -->
  190. <div>
  191. <h6 class="table-title">费用支出</h6>
  192. <a-table
  193. rowKey="id"
  194. :loading="loading"
  195. :columns="costPayColumns"
  196. :data-source="costPayData"
  197. bordered
  198. :pagination="false"
  199. >
  200. </a-table>
  201. </div>
  202. <!-- 备注信息 根据角色权限控制【填写】、【查看】-->
  203. <div class="note-one" style="marginTop:40px;">
  204. <h6 class="table-title">备注</h6>
  205. <div class="noteDetail">
  206. <a-form-model ref="form" :model="detailsPlanNum">
  207. <a-form-model-item prop="remarks">
  208. <a-input
  209. type="textarea"
  210. v-model="detailsPlanNum.remarks"
  211. placeholder="请输入备注"
  212. style="minHeight:100px;"
  213. />
  214. </a-form-model-item>
  215. </a-form-model>
  216. </div>
  217. </div>
  218. <!-- 页面底部保存 -->
  219. <a-row :gutter="24" style="marginTop:40px;float:right">
  220. <a-col :md="12" :sm="12">
  221. <a-button type="primary" @click="save" :disabled="isDisabled">
  222. 保存
  223. </a-button>
  224. </a-col>
  225. </a-row>
  226. </a-card>
  227. <!-- 弹框 -->
  228. <div>
  229. <!-- 主表 人民币费用支出 弹框 -->
  230. <mainTableExpenseCNY-modal ref="mainTableExpenseCNYModal" :father="aa"></mainTableExpenseCNY-modal>
  231. <!-- 主表 美元费用支出 弹框 -->
  232. <mainTableExpenseUSD-modal ref="mainTableExpenseUSDModal" :father="bb"></mainTableExpenseUSD-modal>
  233. <!-- 事故单 -->
  234. <accidentList-modal ref="accidentListModal" :father="cc"></accidentList-modal>
  235. </div>
  236. </div>
  237. </template>
  238. <script>
  239. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  240. import JEllipsis from '@/components/jeecg/JEllipsis'
  241. import moment from 'moment'
  242. // 原始文件(应该跟单证内弹框一样,尝试公用,成功后可删除以下注释)
  243. // import mainTableExpenseCNYModal from '@views/reportForms/cost-allocation-table/mainTableExpenseCNYModal.vue'
  244. // import mainTableExpenseUSDModal from '@views/reportForms/cost-allocation-table/mainTableExpenseUSDModal.vue'
  245. // import accidentListModal from '@views/reportForms/fabric-loss-table/accidentListModal.vue' // 事故单
  246. // import tabs from '@views/cost-allocation-total/tabs.vue' // tabs组件
  247. import tabs from '@views/reportForms/cost-allocation-table/tabs.vue' // tabs组件
  248. import mainTableExpenseCNYModal from '@views/cost-allocation-total/modal/mainTableExpenseCNYModal.vue'
  249. import mainTableExpenseUSDModal from '@views/cost-allocation-total/modal/mainTableExpenseUSDModal.vue'
  250. import accidentListModal from '@views/cost-allocation-total/modal/accidentListModal.vue' // 事故单
  251. import { seachPlanNum, addHalfInfo } from '@api/document/cost-allocation-total.js'
  252. export default {
  253. name: 'CostAllocationTable', // 成本分配 (新增)
  254. mixins: [JeecgListMixin],
  255. components: { JEllipsis, moment, tabs, mainTableExpenseCNYModal, mainTableExpenseUSDModal, accidentListModal },
  256. data() {
  257. return {
  258. key: '', //客户输入的订单号
  259. loading: false, // 表格加载
  260. detailsPlanNum: {
  261. planNum: ''
  262. }, // 详情所有数据
  263. remarks: '', // 备注
  264. // 事故单 表头
  265. accidentListColumns: [
  266. {
  267. title: '单号',
  268. width: 120,
  269. dataIndex: 'accidentNum',
  270. className: 'replacecolor',
  271. customCell: this.accidentListCustomCell,
  272. scopedSlots: { customRender: 'accidentNum' }
  273. },
  274. { title: '事故承担方', width: 120, dataIndex: 'accidentUndertaker', className: 'replacecolor' },
  275. { title: '金额', dataIndex: 'amount', width: 120, className: 'replacecolor' }
  276. ],
  277. accidentListData: [],
  278. // 费用支出 表头
  279. costPayColumns: [
  280. { title: '账套号', width: 120, dataIndex: 'setNo', className: 'replacecolor' },
  281. { title: '支出单号', width: 120, dataIndex: 'disbursementSlipNo', className: 'replacecolor' },
  282. { title: '费用项目', dataIndex: 'expenseItem', width: 120, className: 'replacecolor' },
  283. { title: ' 支出本币金额', dataIndex: 'disbursedLocalmoney', width: 120, className: 'replacecolor' },
  284. { title: '支出原币金额', dataIndex: 'disbursedOriginalmoney', width: 120, className: 'replacecolor' },
  285. { title: '发票号', dataIndex: 'invoicenum', width: 120, className: 'replacecolor' },
  286. { title: '制单人', dataIndex: 'preparedBy', width: 120, className: 'replacecolor' }
  287. ],
  288. costPayData: [],
  289. isDisabled: false, //按钮禁止
  290. billstatus: '' // 单据状态
  291. // dateFormat: 'YYYY-MM-DD',
  292. }
  293. },
  294. created() {},
  295. methods: {
  296. // 【计划单号】 搜索
  297. onSearch() {
  298. this.$nextTick(() => {
  299. // TODO:接口完善后,type 应改为 add(暂时为了回显数据)
  300. seachPlanNum({ plannum: this.detailsPlanNum.planNum, type: 'query' }).then(res => {
  301. if (res.success) {
  302. this.detailsPlanNum = res.result //所有详情
  303. this.accidentListData = res.result.syCostAllocationAccidentList //事故单
  304. this.costPayData = res.result.syCostAllocationCostpayList //支出费用
  305. // tabs 名称集合
  306. this.$refs.unitTabs.tabNameList = res.result.processUnit.split(',')
  307. //所有tabs数据
  308. this.$refs.unitTabs.tabsAllData = res.result.processUnitList
  309. // 页面打开加载的数据
  310. var oneData = this.$refs.unitTabs.tabsAllData[0]
  311. this.$refs.unitTabs.fabData = oneData.syCostAllocationFabricList
  312. this.$refs.unitTabs.ingData = oneData.syCostAllocationIngredientList
  313. this.$refs.unitTabs.shipData = oneData.syCostAllocationShipdetailList
  314. this.pagination = {
  315. total: res.result.total,
  316. current: res.result.current,
  317. pageSize: res.result.size
  318. }
  319. }
  320. })
  321. })
  322. },
  323. // 页面 保存
  324. save() {
  325. console.log('点击保存')
  326. this.isDisabled = true
  327. setTimeout(() => {
  328. let that = this
  329. that.isDisabled = false
  330. }, 3000)
  331. if (this.detailsPlanNum.remarks) {
  332. // 保存 部分信息
  333. var halfInfo = {}
  334. halfInfo.planNum = this.detailsPlanNum.planNum
  335. halfInfo.remarks = this.detailsPlanNum.remarks
  336. halfInfo.billstatus = '1'
  337. console.log(halfInfo.planNum, halfInfo.remarks, halfInfo.billstatus)
  338. addHalfInfo(halfInfo).then(res => {
  339. if (res.success) {
  340. console.log('保存的部分信息', halfInfo)
  341. this.$message.success('保存成功')
  342. halfInfo = {}
  343. }
  344. })
  345. } else {
  346. this.$message.error('订单号不能为空')
  347. }
  348. },
  349. // 主表:人民币费用支出 弹框
  350. mainTableExpenseCNY() {
  351. console.log('点击:主表人民币费用支出')
  352. this.$refs.mainTableExpenseCNYModal.mainTableExpenseCNYModVis = true
  353. },
  354. // 主表:美元费用支出 弹框
  355. mainTableExpenseUSD() {
  356. console.log('点击:主表美元费用支出')
  357. this.$refs.mainTableExpenseUSDModal.mainTableExpenseUSDModVis = true
  358. },
  359. // 事故单 单号 弹框
  360. accidentListCustomCell(record) {
  361. return {
  362. on: {
  363. click: event => {
  364. console.log('this:', this)
  365. // 调用【面料损耗表】中的【事故单】弹框
  366. this.$refs.accidentListModal.accidentListModVis = true
  367. }
  368. }
  369. }
  370. },
  371. // father 方法
  372. aa() {},
  373. bb() {},
  374. cc() {}
  375. },
  376. computed: {},
  377. mounted() {}
  378. }
  379. </script>
  380. <style lang="less" scoped>
  381. @import '~@assets/less/common.less';
  382. @import '~@assets/less/overwriter.less';
  383. /deep/ .ant-table-thead > tr > th {
  384. text-align: center;
  385. // font-weight: 700;
  386. }
  387. /deep/ .ant-table-tbody {
  388. text-align: center;
  389. }
  390. // /deep/ th.replacecolor {
  391. // background-color: #ccc;
  392. // }
  393. // 抽屉里的card样式
  394. // /deep/ .ant-drawer-content {
  395. // background-color: #f0f2f5;
  396. // }
  397. // /deep/ .ant-drawer-body {
  398. // padding: 10px;
  399. // }
  400. </style>