purchaseInQuantityModal.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <a-modal
  3. title="采购入库数量"
  4. v-model="purchaseInQuantityModVis"
  5. :confirmLoading="confirmLoading"
  6. width="86%"
  7. :footer="null"
  8. >
  9. <!-- tabel 加载 -->
  10. <a-spin :spinning="confirmLoading">
  11. <!-- 查询 -->
  12. <div class="table-page-search-wrapper">
  13. <a-form layout="inline" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :md="6" :sm="8">
  16. <a-form-item label="委外订单号">
  17. <a-input placeholder="请输入委外订单号" v-model="queryParam.ccode"></a-input>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8">
  21. <a-form-item label="批号">
  22. <a-input placeholder="请输入批号" v-model="queryParam.cbatch"></a-input>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="8">
  26. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  27. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  28. <a-button type="primary" icon="download" @click="exportExcel" style="margin-left: 8px">导出</a-button>
  29. <JsonExcel
  30. :fetch="getExportDataList"
  31. :fields="exportFields"
  32. :header="exportTitle"
  33. name="采购入库数量.xls"
  34. style="display:none"
  35. >
  36. <!-- 上面可以自定义自己的样式,还可以引用其他组件button -->
  37. <a-button type="primary" icon="download" ref="realExportExcel">导出</a-button>
  38. </JsonExcel>
  39. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  40. <!-- <a @click="handleToggleSearch" style="margin-left: 8px">
  41. {{ toggleSearchStatus ? '收起' : '展开' }}
  42. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  43. </a> -->
  44. </span>
  45. </a-col>
  46. </a-row>
  47. </a-form>
  48. </div>
  49. <!-- table -->
  50. <div>
  51. <a-table
  52. ref="tableRef"
  53. :loading="loading"
  54. bordered
  55. :columns="purchaseInQuantityColumns"
  56. :data-source="purchaseInQuantityData"
  57. :pagination="false"
  58. :scroll="{ y: 500,x:1500 }"
  59. :footer="showTotal"
  60. >
  61. </a-table>
  62. <!-- 导出 打印 返回 -->
  63. <a-row style="marginTop:20px;">
  64. <a-col :md="24" :sm="12">
  65. <span style="float: right;" class="table-operator">
  66. <!-- <a-button type="primary" icon="download" @click="handleExportXls('采购入库数量')">导出</a-button>
  67. <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button> -->
  68. <a-button type="primary" @click="backFabricLossTable" icon="rollback">关闭</a-button>
  69. </span>
  70. </a-col>
  71. </a-row>
  72. </div>
  73. </a-spin>
  74. </a-modal>
  75. </template>
  76. <script>
  77. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  78. import JEllipsis from '@/components/jeecg/JEllipsis'
  79. import JsonExcel from 'vue-json-excel'
  80. export default {
  81. name: 'PurchaseInQuantityModal', // 采购入库数量 弹框
  82. mixins: [JeecgListMixin],
  83. components: { JEllipsis,JsonExcel },
  84. data() {
  85. return {
  86. exportTitle:"采购入库数量",
  87. // 表头
  88. purchaseInQuantityColumns: [
  89. {
  90. title: '序号',
  91. width:80,
  92. customRender: (text, record, index) => {
  93. if (record.cbatch == "合计")
  94. return "";
  95. else
  96. return index + 1;
  97. }
  98. },
  99. {
  100. title: '批号',
  101. dataIndex: 'cbatch',
  102. width: 120,
  103. key: '',
  104. className: 'replacecolor'
  105. },
  106. {
  107. title: '委外订单号',
  108. dataIndex: 'cplanCode',
  109. width: 120,
  110. key: '',
  111. className: 'replacecolor'
  112. },
  113. {
  114. title: '采购入库数量',
  115. dataIndex: 'iquantityIn',
  116. width: 120,
  117. key: '',
  118. className: 'replacecolor'
  119. },
  120. {
  121. title: '单个物料成本',
  122. dataIndex: 'iprice',
  123. width: 120,
  124. key: '',
  125. className: 'replacecolor'
  126. },
  127. {
  128. title: '开票数',
  129. dataIndex: 'isumBillQuantity',
  130. width: 120,
  131. key: '',
  132. className: 'replacecolor'
  133. },
  134. {
  135. title: '未开票数',
  136. dataIndex: 'isumBillQuantityN',
  137. width: 120,
  138. key: '',
  139. className: 'replacecolor'
  140. },
  141. {
  142. title: '结算数量',
  143. dataIndex: 'isquantity',
  144. width: 120,
  145. key: '',
  146. className: 'replacecolor'
  147. },
  148. {
  149. title: '未结算数量',
  150. dataIndex: 'isquantityN',
  151. width: 120,
  152. key: '',
  153. className: 'replacecolor'
  154. }
  155. ],
  156. purchaseInQuantityData: [],
  157. allDataList:[],
  158. loading: false, // 表格加载
  159. // orderDataform: this.$form.createForm(this),
  160. confirmLoading: false,
  161. purchaseInQuantityModVis: false,
  162. // 查询条件
  163. queryParam: {
  164. downAboardorderNum: '', // 下游委外订单号
  165. aboardorderNum: '' // 委外订单号
  166. }
  167. }
  168. },
  169. // 接收父组件 方法
  170. props: {
  171. father: {
  172. type: Function,
  173. default: null
  174. }
  175. },
  176. created() {},
  177. watch:{
  178. purchaseInQuantityData(){
  179. this.$nextTick(()=>{
  180. const dom = this.$refs.tableRef.$el.getElementsByClassName('ant-table-body')[0];
  181. dom.addEventListener(
  182. 'scroll',
  183. () => {
  184. this.$refs.tableInfo.$el.querySelectorAll(
  185. '.ant-table-body'
  186. )[0].scrollLeft = dom.scrollLeft
  187. },
  188. true
  189. )
  190. })
  191. }
  192. },
  193. computed: {
  194. // 合计展示
  195. totalDataSource(){
  196. // 开票成本-衬衣 合计
  197. var item = {
  198. "cbatch":"合计"
  199. };
  200. var iquantityIn = 0,isumBillQuantity = 0,isumBillQuantityN=0,isquantity=0,isquantityN=0;
  201. for (let row of this.purchaseInQuantityData){
  202. iquantityIn += row.iquantityIn*1;
  203. isumBillQuantity += row.isumBillQuantity*1;
  204. isumBillQuantityN += row.isumBillQuantityN*1;
  205. isquantity += row.isquantity*1;
  206. isquantityN += row.isquantityN*1;
  207. }
  208. item.iquantityIn= parseFloat(iquantityIn.toFixed(4));
  209. item.isumBillQuantity= parseFloat(isumBillQuantity.toFixed(4));
  210. item.isumBillQuantityN= parseFloat(isumBillQuantityN.toFixed(4));
  211. item.isquantity= parseFloat(isquantity.toFixed(4));
  212. item.isquantityN= parseFloat(isquantityN.toFixed(4));
  213. return [item];
  214. },
  215. // 获取导出json定义
  216. exportFields(){
  217. var ret = {};
  218. this.purchaseInQuantityColumns.forEach((record,index)=>{
  219. if (record.title != "序号"){
  220. if (record.title != "入库单号")
  221. ret[record.title] = record.dataIndex;
  222. else
  223. ret[record.title] = record.dataIndex+"_ex";
  224. }
  225. });
  226. return ret;
  227. }
  228. },
  229. methods: {
  230. // 第一行 导出
  231. handleExportXls() {},
  232. // 打印
  233. print() {},
  234. // 返回
  235. backFabricLossTable() {
  236. console.log('返回到面料损耗表')
  237. // this.$router.push('fabricLoss-table')
  238. // this.materialsOutQuantityModVis = false
  239. this.close()
  240. },
  241. // 弹框查询按钮
  242. searchQuery() {
  243. this.purchaseInQuantityData = this.allDataList.filter(e=>
  244. (this.queryParam.ccode == null || e.ccode.toLowerCase().indexOf(this.queryParam.ccode.toLowerCase())>-1) &&
  245. (this.queryParam.cbatch == null || e.cbatch.toLowerCase().indexOf(this.queryParam.cbatch.toLowerCase())>-1)
  246. );
  247. },
  248. // 重置
  249. searchReset() {
  250. this.queryParam = {}
  251. // this.getShipmentList()
  252. },
  253. close() {
  254. this.$emit('close')
  255. this.purchaseInQuantityModVis = false
  256. },
  257. showTotal(data) {
  258. return (
  259. <a-table
  260. ref="tableInfo"
  261. rowKey={Math.random}
  262. bordered={false}
  263. pagination={false}
  264. columns={this.purchaseInQuantityColumns}
  265. dataSource={this.totalDataSource || []}
  266. showHeader={false}
  267. scroll={{x:1500 }}
  268. ></a-table>
  269. )
  270. },
  271. // 导出excel
  272. exportExcel(){
  273. this.$refs.realExportExcel.$el.click();
  274. },
  275. // 生成导出数据
  276. getExportDataList(){
  277. this.purchaseInQuantityData.forEach((item,index)=>{item["ccode_ex"]="&nbsp;"+item["ccode"]});
  278. return this.purchaseInQuantityData;
  279. }
  280. }
  281. }
  282. </script>
  283. <style lang="less" scoped>
  284. @import '~@assets/less/common.less';
  285. @import '~@assets/less/overwriter.less';
  286. /deep/ .ant-table-thead > tr > th {
  287. text-align: center;
  288. // font-weight: 700;
  289. }
  290. /deep/ .ant-table-tbody {
  291. text-align: center;
  292. }
  293. /deep/ .ant-table-footer .ant-table-body {
  294. overflow: hidden !important;
  295. }
  296. // /deep/ th.replacecolor {
  297. // background-color: #ccc;
  298. // }
  299. </style>