cost-allocation-table.vue 16 KB

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