iquantityMoreLessModal.vue 7.8 KB

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