surplusYarnModal.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <a-modal
  3. title="来源余纱"
  4. v-model="surplusYarnModVis"
  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.cplanCode"></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" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  29. <a @click="handleToggleSearch" style="margin-left: 8px">
  30. {{ toggleSearchStatus ? '收起' : '展开' }}
  31. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  32. </a>
  33. </span>
  34. </a-col>
  35. </a-row>
  36. </a-form>
  37. </div>
  38. <!-- table -->
  39. <div>
  40. <a-table
  41. bordered
  42. :loading="loading"
  43. :columns="surplusYarnColumns"
  44. :data-source="surplusYarnData"
  45. :pagination="false"
  46. :scroll="{ y: 500 }"
  47. :footer="showTotal"
  48. >
  49. </a-table>
  50. <!-- 导出 打印 返回 -->
  51. <a-row style="marginTop:20px;">
  52. <a-col :md="24" :sm="12">
  53. <span style="float: right;" class="table-operator">
  54. <a-button type="primary" icon="download" @click="handleExportXls('采购数量')">导出</a-button>
  55. <a-button type="primary" @click="print" icon="printer" style="margin:0 10px;">打印</a-button>
  56. <a-button type="primary" @click="backFabricLossTable" icon="rollback">返回</a-button>
  57. </span>
  58. </a-col>
  59. </a-row>
  60. </div>
  61. </a-spin>
  62. </a-modal>
  63. </template>
  64. <script>
  65. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  66. import JEllipsis from '@/components/jeecg/JEllipsis'
  67. export default {
  68. name: 'SurplusYarnModal', // 余纱 弹框
  69. mixins: [JeecgListMixin],
  70. components: { JEllipsis },
  71. data() {
  72. return {
  73. // 表头
  74. surplusYarnColumns: [
  75. {
  76. title: '序号',
  77. width:80,
  78. customRender: (text, record, index) => {
  79. if (record.ccode == "合计")
  80. return "";
  81. else
  82. return index + 1;
  83. }
  84. },
  85. {
  86. title: '委外订单号',
  87. dataIndex: 'ccode',
  88. width: 120,
  89. key: '',
  90. className: 'replacecolor'
  91. },
  92. {
  93. title: '批号',
  94. dataIndex: 'cbatch',
  95. width: 120,
  96. className: 'replacecolor'
  97. },
  98. {
  99. title: '使用数量',
  100. dataIndex: 'iquantity',
  101. width: 120,
  102. key: '',
  103. className: 'replacecolor'
  104. },
  105. {
  106. title: '计划号',
  107. dataIndex: 'cplanCode',
  108. width: 120,
  109. key: '',
  110. className: 'replacecolor'
  111. },
  112. {
  113. title: '采购单价',
  114. dataIndex: 'iprice',
  115. width: 120,
  116. key: '',
  117. className: 'replacecolor'
  118. }
  119. ],
  120. surplusYarnData: [],
  121. allDataList:[],
  122. loading: false, // 表格加载
  123. // orderDataform: this.$form.createForm(this),
  124. confirmLoading: false,
  125. surplusYarnModVis: false,
  126. // 查询条件
  127. queryParam: {
  128. aboardorderNum: '', // aboardorderNum
  129. planNum: '' // 计划号
  130. }
  131. }
  132. },
  133. // 接收父组件 方法
  134. props: {
  135. father: {
  136. type: Function,
  137. default: null
  138. }
  139. },
  140. computed: {
  141. // 合计展示
  142. totalDataSource(){
  143. // 开票成本-衬衣 合计
  144. var item = {
  145. "ccode":"合计"
  146. };
  147. var iquantity = 0;
  148. for (let row of this.surplusYarnData){
  149. iquantity += row.iquantity*1;
  150. }
  151. item.iquantity= parseFloat(iquantity.toFixed(4));
  152. return [item];
  153. }
  154. },
  155. created() {},
  156. methods: {
  157. // 第一行 导出
  158. handleExportXls() {},
  159. // 打印
  160. print() {},
  161. // 返回
  162. backFabricLossTable() {
  163. console.log('返回到面料损耗表')
  164. // this.$router.push('fabricLoss-table')
  165. // this.surplusYarnModVis = false
  166. this.close()
  167. },
  168. // 弹框查询按钮
  169. searchQuery() {
  170. this.surplusYarnData = this.allDataList.filter(e=>(this.queryParam.ccode == null || e.ccode.toLowerCase().indexOf(this.queryParam.ccode.toLowerCase())>-1)
  171. && (this.queryParam.cplanCode == null || e.cplanCode.toLowerCase().indexOf(this.queryParam.cplanCode.toLowerCase())>-1));
  172. },
  173. // 重置
  174. searchReset() {
  175. this.queryParam = {}
  176. // this.getShipmentList()
  177. },
  178. close() {
  179. this.$emit('close')
  180. this.surplusYarnModVis = false
  181. },
  182. showTotal(data) {
  183. return (
  184. <a-table
  185. rowKey={Math.random}
  186. bordered={false}
  187. pagination={false}
  188. columns={this.surplusYarnColumns}
  189. dataSource={this.totalDataSource || []}
  190. showHeader={false}
  191. ></a-table>
  192. )
  193. },
  194. }
  195. }
  196. </script>
  197. <style lang="less" scoped>
  198. @import '~@assets/less/common.less';
  199. @import '~@assets/less/overwriter.less';
  200. /deep/ .ant-table-thead > tr > th {
  201. text-align: center;
  202. // font-weight: 700;
  203. }
  204. /deep/ .ant-table-tbody {
  205. text-align: center;
  206. }
  207. // /deep/ th.replacecolor {
  208. // background-color: #ccc;
  209. // }
  210. </style>