plm前端
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.

221 lines
12 KiB

  1. <template>
  2. <div class="mod-config">
  3. <el-form
  4. :inline="true"
  5. label-position="top"
  6. :model="searchData"
  7. @keyup.enter.native="getDataList()">
  8. <el-form-item label="子件编码">
  9. <el-input v-model="searchData.componentPart" clearable style="width: 160px" />
  10. </el-form-item>
  11. <el-form-item label="子件描述">
  12. <el-input v-model="searchData.componentPartDesc" clearable style="width: 160px" />
  13. </el-form-item>
  14. <el-form-item label="子件零件类型">
  15. <el-select v-model="searchData.componentPartType" clearable style="width: 150px">
  16. <el-option label="Manufactured" value="Manufactured"></el-option>
  17. <el-option label="Manufactured Recipe" value="Manufactured Recipe"></el-option>
  18. <el-option label="Purchased (raw)" value="Purchased (raw)"></el-option>
  19. <el-option label="Purchased" value="Purchased"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item>
  23. <span style="cursor: pointer" slot="label" @click="getBaseList(125)"><a herf="#">子件零件状态</a></span>
  24. <el-input v-model="searchData.componentPartStatus" @change="partStatusBlur(125)" clearable style="width: 128px"></el-input>
  25. </el-form-item>
  26. <el-form-item label=" ">
  27. <el-button type="primary" :loading="queryLoading" @click="getDataList()">查询</el-button>
  28. </el-form-item>
  29. </el-form>
  30. <el-table
  31. :height="height"
  32. :data="dataList"
  33. border
  34. v-loading="dataListLoading"
  35. style="width: 100%;">
  36. <el-table-column
  37. v-for="(item, index) in columnList"
  38. :key="index"
  39. :sortable="item.columnSortable"
  40. :prop="item.columnProp"
  41. :header-align="item.headerAlign"
  42. :show-overflow-tooltip="item.showOverflowTooltip"
  43. :align="item.align"
  44. :fixed="item.fixed === '' ? false : item.fixed"
  45. :min-width="item.columnWidth"
  46. :label="item.columnLabel">
  47. <template slot-scope="scope">
  48. <span v-if="!item.columnHidden && ['qtyPerAssembly', 'componentScrap', 'shrinkageFactor'].includes(item.columnProp)">{{ formatNumber(scope.row[item.columnProp]) }}</span>
  49. <span v-else-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  54. <el-pagination
  55. style="margin-top: 0px"
  56. @size-change="sizeChangeHandle"
  57. @current-change="currentChangeHandle"
  58. :current-page="pageIndex"
  59. :page-sizes="[20, 50, 100, 200, 500]"
  60. :page-size="pageSize"
  61. :total="totalPage"
  62. layout="total, sizes, prev, pager, next, jumper" />
  63. </div>
  64. </template>
  65. <script>
  66. import { completeWhereUsedSearch } from '@/api/part/completeWhereUsed.js'
  67. import Chooselist from '@/views/modules/common/Chooselist'
  68. import { verifyData } from '@/api/chooselist/chooselist.js'
  69. export default {
  70. name: 'CompleteWhereUsed',
  71. components: {
  72. Chooselist
  73. },
  74. data () {
  75. return {
  76. height: 200,
  77. pageIndex: 1,
  78. pageSize: 50,
  79. totalPage: 0,
  80. queryLoading: false,
  81. dataListLoading: false,
  82. dataList: [],
  83. searchData: {
  84. site: this.$store.state.user.site,
  85. componentPart: '',
  86. componentPartDesc: '',
  87. componentPartType: '',
  88. componentPartStatus: '',
  89. page: 1,
  90. limit: 50
  91. },
  92. columnList: [
  93. { columnProp: 'site', columnLabel: '工厂', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 80 },
  94. { columnProp: 'parentPartNo', columnLabel: '父件编码', headerAlign: 'center', align: 'left', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 130 },
  95. { columnProp: 'parentPartDesc', columnLabel: '父件描述', headerAlign: 'center', align: 'left', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 180 },
  96. { columnProp: 'parentPartType', columnLabel: '父件零件类型', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 120 },
  97. { columnProp: 'parentPartStatus', columnLabel: '父件零件状态', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 100 },
  98. { columnProp: 'parentPartStatusDesc', columnLabel: '父件零件状态描述', headerAlign: 'center', align: 'left', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 120 },
  99. { columnProp: 'engChgLevel', columnLabel: 'BOM版本', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 90 },
  100. { columnProp: 'alternativeNo', columnLabel: '替代编码', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 110 },
  101. { columnProp: 'bomDetailStatus', columnLabel: '替代状态', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 100 },
  102. { columnProp: 'lineItemNo', columnLabel: '行号', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 80 },
  103. { columnProp: 'lineSequence', columnLabel: '行序', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 80 },
  104. { columnProp: 'componentPart', columnLabel: '子件编码', headerAlign: 'center', align: 'left', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 130 },
  105. { columnProp: 'componentPartDesc', columnLabel: '子件描述', headerAlign: 'center', align: 'left', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 180 },
  106. { columnProp: 'componentPartType', columnLabel: '子件零件类型', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 120 },
  107. { columnProp: 'issueType', columnLabel: '生产属性', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 150 },
  108. { columnProp: 'componentPartStatus', columnLabel: '子件零件状态', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 100 },
  109. { columnProp: 'componentPartStatusDesc', columnLabel: '子件零件状态描述', headerAlign: 'center', align: 'left', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 120 },
  110. { columnProp: 'bomType', columnLabel: '制造类型', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 120 },
  111. { columnProp: 'effPhaseInDate', columnLabel: '生效日期', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 160 },
  112. { columnProp: 'effPhaseOutDate', columnLabel: '失效日期', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 160 },
  113. { columnProp: 'qtyPerAssembly', columnLabel: '单位用量', headerAlign: 'center', align: 'right', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 100 },
  114. { columnProp: 'componentScrap', columnLabel: '调机量', headerAlign: 'center', align: 'right', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 90 },
  115. { columnProp: 'shrinkageFactor', columnLabel: '损耗率', headerAlign: 'center', align: 'right', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 90 },
  116. { columnProp: 'operationNo', columnLabel: '工序号', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 90 },
  117. { columnProp: 'issueToLoc', columnLabel: '发料库位', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 110 },
  118. { columnProp: 'noteText', columnLabel: '备注', headerAlign: 'center', align: 'left', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 160 },
  119. { columnProp: 'consumptionItem', columnLabel: '消耗项目', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 110 },
  120. { columnProp: 'printUnit', columnLabel: '单位', headerAlign: 'center', align: 'center', columnSortable: false, columnHidden: false, showOverflowTooltip: true, fixed: '', columnWidth: 80 }
  121. ]
  122. }
  123. },
  124. watch: {
  125. searchData: {
  126. deep: true,
  127. handler: function () {
  128. if (typeof this.searchData.componentPart === 'string') {
  129. this.searchData.componentPart = this.searchData.componentPart.toUpperCase()
  130. }
  131. }
  132. }
  133. },
  134. mounted () {
  135. this.$nextTick(() => {
  136. this.height = window.innerHeight - 170
  137. })
  138. },
  139. methods: {
  140. formatNumber (value) {
  141. if (value === null || value === undefined || value === '') return value
  142. let numStr = String(value)
  143. if (numStr.includes('e') || numStr.includes('E')) {
  144. return Number(value).toLocaleString('fullwide', { useGrouping: false, maximumFractionDigits: 10 })
  145. }
  146. return value
  147. },
  148. getBaseList (val) {
  149. this.$nextTick(() => {
  150. let strVal = ''
  151. if (val === 125) {
  152. strVal = this.searchData.componentPartStatus
  153. }
  154. this.$refs.baseList.init(val, strVal)
  155. })
  156. },
  157. getBaseData (val) {
  158. if (val && val.part_status) {
  159. this.searchData.componentPartStatus = val.part_status
  160. }
  161. },
  162. partStatusBlur (tagNo) {
  163. let tempData = {
  164. tagno: tagNo,
  165. conditionSql: " and part_status = '" + this.searchData.componentPartStatus + "'" + " and site = '" + this.searchData.site + "'"
  166. }
  167. verifyData(tempData).then(({data}) => {
  168. if (data && data.code === 0) {
  169. if (data.baseListData.length > 0) {
  170. this.searchData.componentPartStatus = data.baseListData[0].part_status
  171. } else {
  172. this.searchData.componentPartStatus = ''
  173. }
  174. }
  175. })
  176. },
  177. sizeChangeHandle (val) {
  178. this.pageSize = val
  179. this.pageIndex = 1
  180. this.getDataList()
  181. },
  182. currentChangeHandle (val) {
  183. this.pageIndex = val
  184. this.getDataList()
  185. },
  186. getDataList () {
  187. if (!this.searchData.componentPart && !this.searchData.componentPartDesc && !this.searchData.componentPartType && !this.searchData.componentPartStatus) {
  188. this.$message.warning('请至少填写一项查询条件')
  189. return
  190. }
  191. this.searchData.limit = this.pageSize
  192. this.searchData.page = this.pageIndex
  193. this.queryLoading = true
  194. this.dataListLoading = true
  195. completeWhereUsedSearch(this.searchData)
  196. .then(({ data }) => {
  197. if (data.code === 0) {
  198. this.dataList = data.page.list
  199. this.pageIndex = data.page.currPage
  200. this.pageSize = data.page.pageSize
  201. this.totalPage = data.page.totalCount
  202. } else {
  203. this.$message.error(data.msg || '查询失败')
  204. }
  205. })
  206. .catch(() => {
  207. this.$message.error('请求失败')
  208. })
  209. .finally(() => {
  210. this.queryLoading = false
  211. this.dataListLoading = false
  212. })
  213. }
  214. }
  215. }
  216. </script>