赫艾前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
7.3 KiB

5 years ago
4 years ago
5 years ago
2 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
1 month ago
4 years ago
5 years ago
4 years ago
1 month ago
4 years ago
1 month ago
2 years ago
1 month ago
2 years ago
5 years ago
1 month ago
5 years ago
1 month ago
5 years ago
1 month ago
5 years ago
1 month ago
5 years ago
1 month ago
5 years ago
1 month ago
5 years ago
1 month ago
5 years ago
1 month ago
5 years ago
1 month ago
5 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" >
  4. <el-form-item :label="'工厂编码:'">
  5. <el-input v-model="searchData.site" style="width: 120px"></el-input>
  6. </el-form-item>
  7. <el-form-item :label="'日计划单号:'">
  8. <el-input v-model="searchData.orderNo" style="width: 120px"></el-input>
  9. </el-form-item>
  10. <el-form-item :label="'订单号:'">
  11. <el-input v-model="searchData.orderRef1" style="width: 120px"></el-input>
  12. </el-form-item>
  13. <el-form-item :label="'物料编码 :'">
  14. <el-input v-model="searchData.partNo" style="width: 120px"></el-input>
  15. </el-form-item>
  16. <el-form-item :label="'混炼任务单 :'">
  17. <el-input v-model="searchData.taskNo" style="width: 120px"></el-input>
  18. </el-form-item>
  19. <el-form-item :label="'计划日期:'">
  20. <el-date-picker
  21. style="width: 130px"
  22. v-model="searchData.startDate1"
  23. type="date"
  24. value-format="yyyy-MM-dd"
  25. placeholder="选择日期">
  26. </el-date-picker>
  27. </el-form-item>
  28. <el-form-item style="margin-top: 23px;">
  29. <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
  30. </el-form-item>
  31. <el-form-item :label="' '">
  32. <el-date-picker
  33. style="width: 130px"
  34. v-model="searchData.endDate1"
  35. type="date"
  36. value-format="yyyy-MM-dd"
  37. placeholder="选择日期">
  38. </el-date-picker>
  39. </el-form-item>
  40. <el-form-item :label="' '">
  41. <el-button @click="search()" style="margin-left: 0px;margin-top: 0px" type="primary">查询</el-button>
  42. <!-- rqrq - cancelSfdc 一致columnList + fields() 动态导出 -->
  43. <download-excel
  44. :fields="fields()"
  45. type="xlsx"
  46. :name="exportName"
  47. :fetch="createExportData"
  48. worksheet="导出信息"
  49. class="el-button el-button--primary el-button--medium">
  50. 导出
  51. </download-excel>
  52. </el-form-item>
  53. </el-form>
  54. <el-table
  55. :height="height"
  56. :data="tableData"
  57. border
  58. style="width: 100%">
  59. <el-table-column
  60. v-for="(item,index) in columnList"
  61. :key="index"
  62. :sortable="item.columnSortable"
  63. :prop="item.columnProp"
  64. header-align="center"
  65. :show-overflow-tooltip="item.showOverflowTooltip"
  66. :align="item.align"
  67. :fixed="item.fixed==''?false:item.fixed"
  68. :min-width="item.columnWidth"
  69. :label="item.columnLabel">
  70. <template slot-scope="scope">
  71. <span v-if="item.slotKey === 'shiftQty'" v-show="!item.columnHidden">
  72. {{ shiftQtyFmt(scope.row) }}
  73. </span>
  74. <span v-else-if="!item.columnHidden && !item.columnImage">
  75. {{ scope.row[item.columnProp] }}
  76. </span>
  77. <span v-if="item.columnImage">
  78. <img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/>
  79. </span>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. </div>
  84. </template>
  85. <script>
  86. /**
  87. * rqrq - 列配置常量增删列改中文名仅此维护表格与导出共用
  88. */
  89. const DAILY_PLAN_COLUMN_SPECS = [
  90. { prop: 'site', label: '工厂编码', width: 60, align: 'left', tooltip: true },
  91. { prop: 'orderNo', label: '日计划单号', width: 140, align: 'left', tooltip: true },
  92. { prop: 'orderDate', label: '计划日期', width: 70, align: 'left' },
  93. { prop: 'orderRef1', label: '订单号', width: 90, align: 'left', tooltip: true },
  94. { prop: 'partNo', label: '物料编码', width: 70, align: 'left', tooltip: true },
  95. { prop: 'partDescription', label: '物料名称', width: 200, align: 'left', tooltip: true },
  96. { prop: 'orderQty', label: '计划数量', width: 60, align: 'right' },
  97. { prop: 'partPlanQty', label: '班产量', width: 60, align: 'right' },
  98. { prop: 'shiftQty', label: '计划班数', width: 60, align: 'right', slotKey: 'shiftQty' },
  99. { prop: 'weight', label: '参考数量', width: 60, align: 'right' },
  100. { prop: 'qtyfinished', label: '混炼胶数', width: 70, align: 'right' },
  101. { prop: 'taskNo', label: '混炼任务单', width: 120, align: 'left', tooltip: true },
  102. { prop: 'userName', label: '录入人', width: 50, align: 'left' },
  103. { prop: 'enterDate', label: '录入时间', width: 100, align: 'left', tooltip: true },
  104. { prop: 'reportTime', label: '报工时间', width: 100, align: 'left', tooltip: true }
  105. ]
  106. import {
  107. getDailyPlanData
  108. } from '@/api/production.js'
  109. export default {
  110. name: 'stockPrint',
  111. computed: {
  112. // rqrq - 结构与 cancelSfdcForWareHouse.columnList 一致
  113. columnList () {
  114. const vm = this
  115. return DAILY_PLAN_COLUMN_SPECS.map(spec => ({
  116. tableId: 'dailyPlanSearchList',
  117. tableName: vm.$route.meta.title,
  118. columnProp: spec.prop,
  119. columnLabel: spec.label,
  120. columnHidden: false,
  121. columnImage: false,
  122. columnSortable: false,
  123. columnWidth: spec.width,
  124. format: null,
  125. functionId: vm.$route.meta.menuId,
  126. sortLv: 0,
  127. status: true,
  128. fixed: '',
  129. serialNumber: null,
  130. columnType: null,
  131. align: spec.align || 'left',
  132. showOverflowTooltip: !!spec.tooltip,
  133. slotKey: spec.slotKey || ''
  134. }))
  135. }
  136. },
  137. data () {
  138. return {
  139. exportName: '日计划列表' + this.getStrDate(),
  140. height: 200,
  141. tableData: [],
  142. date1: '',
  143. searchData: {
  144. orderNo: '',
  145. orderRef1: '',
  146. partNo: '',
  147. startDate1: new Date(),
  148. endDate1: '',
  149. taskNo: '',
  150. status: 'all',
  151. site: ''
  152. }
  153. }
  154. },
  155. mounted () {
  156. this.$nextTick(() => {
  157. this.height = window.innerHeight - 210
  158. })
  159. },
  160. methods: {
  161. shiftQtyFmt (row) {
  162. const pp = Number(row.partPlanQty)
  163. const oq = Number(row.orderQty)
  164. if (!(pp > 0)) {
  165. return 0
  166. }
  167. return (oq * 1.0 / pp).toFixed(1)
  168. },
  169. /** rqrq - 动态导出列映射(cancelSfdc 同款) */
  170. fields () {
  171. let json = '{'
  172. this.columnList.forEach((item, index) => {
  173. if (index === this.columnList.length - 1) {
  174. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  175. } else {
  176. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  177. }
  178. })
  179. json += '}'
  180. return eval('(' + json + ')')
  181. },
  182. /** rqrq - 导出时为「计划班数」补充计算字段 shiftQty */
  183. createExportData () {
  184. return this.tableData.map(row => {
  185. const shiftQty = this.shiftQtyFmt(row)
  186. return Object.assign({}, row, { shiftQty })
  187. })
  188. },
  189. search () {
  190. getDailyPlanData(this.searchData).then(({ data }) => {
  191. this.tableData = data.rows
  192. })
  193. },
  194. getStrDate () {
  195. const dd = new Date()
  196. const Y = dd.getFullYear()
  197. const M = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1)
  198. const D = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate()
  199. const H = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
  200. const MM = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
  201. const S = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
  202. return Y + '' + M + D + H + MM + S
  203. }
  204. },
  205. created () {
  206. }
  207. }
  208. </script>
  209. <style scoped>
  210. </style>