materialsOutQuantityModal.vue 8.7 KB

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