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.

2721 lines
102 KiB

5 months ago
5 months ago
​
5 months ago
​
5 months ago
​
5 months ago
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
5 months ago
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 months ago
5 months ago
6 months ago
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
5 months ago
5 months ago
​
​
​
4 months ago
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
5 months ago
5 months ago
​
​
​
​
​
​
​
​
5 months ago
5 months ago
​
​
​
​
​
5 months ago
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
5 months ago
​
​
5 months ago
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
5 months ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
5 months ago
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
5 months ago
​
5 months ago
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 months ago
5 months ago
​
​
​
​
​
​
6 months ago
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 weeks ago
5 months ago
​
​
5 months ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
4 weeks ago
​
5 months ago
4 weeks ago
​
5 months ago
​
5 months ago
5 months ago
5 months ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
4 weeks ago
​
​
5 months ago
​
​
​
​
​
​
​
5 months ago
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
5 months ago
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
5 months ago
​
5 months ago
​
​
​
​
​
​
4 months ago
5 months ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
5 months ago
4 months ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
3 months ago
​
​
​
6 months ago
​
​
3 months ago
​
​
​
​
​
5 months ago
​
​
​
​
​
​
5 months ago
​
​
​
​
​
5 months ago
​
​
​
​
​
5 months ago
​
​
​
​
​
5 months ago
​
​
​
​
​
5 months ago
​
​
5 months ago
​
​
​
​
5 months ago
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
4 weeks ago
​
5 months ago
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
5 months ago
​
4 weeks ago
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <template>
  2. <div class="customer-css" ref="pageRoot">
  3. <!-- 查询时间和产品 -->
  4. <el-form ref="searchForm" :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;" >
  5. <el-row>
  6. <el-col :span="24" style="">
  7. <el-form-item :label="'产品编码:'">
  8. <!-- <span style="cursor: pointer" slot="label" @click="getBaseList(520)"><a href="#">产品编码</a></span> -->
  9. <el-input v-model="searchData.partNo" style="width: 130px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'基准料号:'">
  12. <el-input v-model="searchData.basePartNo" style="width: 130px"></el-input>
  13. </el-form-item>
  14. <!-- <el-form-item :label="'NPC货号:'">-->
  15. <!-- <el-input v-model="searchData.npc" style="width: 130px"></el-input>-->
  16. <!-- </el-form-item>-->
  17. <el-form-item :label="'产品名称:'">
  18. <el-input v-model="searchData.partDesc" style="width: 130px"></el-input>
  19. </el-form-item>
  20. <el-form-item :label="'Item:'">
  21. <el-input v-model="searchData.item" style="width: 130px"></el-input>
  22. </el-form-item>
  23. <el-form-item :label="'SKU:'">
  24. <el-input v-model="searchData.sku" style="width: 130px"></el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <!-- 查询条件与验货申请页「供应商编码」一样可点标签开 Chooselist 520 选供应商;
  28. 选中后回填供应商简称(c_short_npc)展示,后端同一条件兼容按编码模糊查,输入框仍可手输回车查询 - rqrq -->
  29. <span style="cursor: pointer" slot="label" @click="getBaseList(520, '', 'searchSupplier')"><a href="#">默认供应商:</a></span>
  30. <el-input v-model="searchData.defaultSupplierNo" style="width: 130px" @keyup.enter.native="getMainData"></el-input>
  31. </el-form-item>
  32. <el-form-item :label="'一级分类:'">
  33. <el-select v-model="searchData.category" clearable filterable style="width: 130px" @change="onSearchCategoryChange">
  34. <el-option v-for="item in searchCategoryLevel1Options" :key="item.familyId"
  35. :label="item.familyName" :value="item.familyId" />
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item :label="'二级分类:'">
  39. <el-select v-model="searchData.categoryLevel2" clearable filterable style="width: 130px"
  40. :disabled="!searchData.category" @change="onSearchCategoryLevel2Change">
  41. <el-option v-for="item in searchCategoryLevel2Options" :key="item.familyId"
  42. :label="item.familyName" :value="item.familyId" />
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item :label="'三级分类:'">
  46. <el-select v-model="searchData.categoryLevel3" clearable filterable style="width: 130px"
  47. :disabled="!searchData.categoryLevel2">
  48. <el-option v-for="item in searchCategoryLevel3Options" :key="item.familyId"
  49. :label="item.familyName" :value="item.familyId" />
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item :label="' '">
  53. <el-button class="customer-bun-min" type="primary" @click="getMainData" style="">查询</el-button>
  54. <el-button @click="addPart()" type="primary" style="margin-left: 2px">新增</el-button>
  55. <!-- <el-button @click="openCopyDialog" type="primary" style="margin-left: 2px">复制</el-button>-->
  56. <!-- 主表导出:风格与供应商列表一致,复用当前查询条件全量导出 - rqrq -->
  57. <el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
  58. <!-- 高级复制固定使用当前选中物料,保存后刷新主表及当前明细 - rqrq -->
  59. <el-button @click="$refs.advancedCopyDialog.open(currentRow)" type="primary" style="margin-left: 2px">高级复制</el-button>
  60. <!-- 按基准料号统一指定SKU - rqrq -->
  61. <el-button @click="openSpecifySkuDialog" type="primary" style="margin-left: 2px">指定SKU</el-button>
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. </el-form>
  66. <el-table
  67. :height="height"
  68. :data="mainDataList"
  69. border
  70. ref="mainTable"
  71. highlight-current-row
  72. @row-click="changeData"
  73. v-loading="dataListLoading"
  74. style="margin-top: 0px; width: 100%;">
  75. <el-table-column
  76. v-for="(item,index) in columnArray1" :key="index"
  77. :sortable="item.columnSortable"
  78. :prop="item.columnProp"
  79. :header-align="item.headerAlign"
  80. :show-overflow-tooltip="item.showOverflowTooltip"
  81. :align="item.align"
  82. :fixed="item.fixed==''?false:item.fixed"
  83. :min-width="item.columnWidth"
  84. :label="item.columnLabel">
  85. <template slot-scope="scope">
  86. <span v-if="!item.columnHidden">{{
  87. formatTableCell(item.columnProp, scope.row)
  88. }}</span>
  89. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  90. style="width: 100px; height: 100px"/></span>
  91. </template>
  92. </el-table-column>
  93. <!-- 操作列 -->
  94. <el-table-column
  95. fixed="right"
  96. header-align="center"
  97. align="center"
  98. width="260"
  99. label="操作">
  100. <template slot-scope="scope">
  101. <!-- <el-link style="cursor: pointer" v-if="scope.row.flowStatus === 'COMPLETED' || scope.row.flowStatus === 'TERMINATED'" @click="handleRestart(scope.row)">重新审批 |</el-link>
  102. <el-link style="cursor: pointer" v-if="scope.row.flowStatus === 'RUNNING'" @click="openApproveDialog(scope.row)">审批 |</el-link> -->
  103. <!-- <el-link style="cursor: pointer" v-if="scope.row.partStage === 'Created'" @click="startFormalApprove(scope.row)">转正 |</el-link>-->
  104. <el-link style="cursor: pointer" @click="openCurrentRowPriceDialog(scope.row)">价格表 |</el-link>
  105. <el-link style="cursor: pointer" @click="openChangeDefaultSupplier(scope.row)">变更默认供应商 |</el-link>
  106. <el-link style="cursor: pointer" @click="editPart(scope.row)">编辑 |</el-link>
  107. <el-link style="cursor: pointer" @click="deletePart(scope.row)">删除</el-link>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <!-- 分页插件 -->
  112. <el-pagination ref="mainPagination" style="margin-top: 0px"
  113. @size-change="sizeChangeHandle"
  114. @current-change="currentChangeHandle"
  115. :current-page="pageIndex"
  116. :page-sizes="[20, 50, 100, 200, 500]"
  117. :page-size="pageSize"
  118. :total="totalPage"
  119. layout="total, sizes, prev, pager, next, jumper">
  120. </el-pagination>
  121. <el-tabs ref="partTabs" v-model="activeName" style="margin-top: 0px; width: 99%;" @tab-click="tabClick" class="customer-tab" type="border-card">
  122. <el-tab-pane label="基础信息" name="basicInfo" style="">
  123. <basicInfo ref="basicInfo"></basicInfo>
  124. </el-tab-pane>
  125. <el-tab-pane label="规格参数" name="specParams" style="">
  126. <specParams ref="specParams"></specParams>
  127. </el-tab-pane>
  128. <!-- <el-tab-pane label="关联供应商" name="suppliers" style="">-->
  129. <!-- <suppliers ref="suppliers"></suppliers>-->
  130. <!-- </el-tab-pane>-->
  131. <!-- <el-tab-pane label="审批与放行" name="approval" style="">-->
  132. <!-- <approval ref="approval"></approval>-->
  133. <!-- </el-tab-pane>-->
  134. <el-tab-pane label="附件" name="attachments" style="">
  135. <attachments ref="attachments"></attachments>
  136. </el-tab-pane>
  137. </el-tabs>
  138. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  139. <PartAdvancedCopyDialog ref="advancedCopyDialog" @copied="handleAdvancedCopyResult" />
  140. <!--
  141. 供应商可供物料价格表弹窗(沿用 poOrder.vue 查看价格表实现)
  142. 用途:按默认供应商 + 物料编码查询当前生效阶梯价并展示
  143. 关联状态:
  144. priceDialogVisible / priceDialogRows / priceDialogLoading
  145. priceDialogPartNo / priceDialogSupplierNo
  146. -->
  147. <el-dialog
  148. title="供应商可供物料价格表"
  149. v-drag
  150. :visible.sync="priceDialogVisible"
  151. width="680px"
  152. top="8vh"
  153. append-to-body
  154. :close-on-click-modal="false"
  155. @closed="resetSupplierPartPriceDialog">
  156. <div style="margin-bottom: 10px; color: #606266;">
  157. <span>供应商:{{ priceDialogSupplierNo }}</span>
  158. <span style="margin-left: 16px;">物料编码:{{ priceDialogPartNo }}</span>
  159. </div>
  160. <el-table
  161. :data="priceDialogRows"
  162. :height="360"
  163. border
  164. stripe
  165. v-loading="priceDialogLoading"
  166. empty-text="该供应商物料未维护价格表">
  167. <el-table-column prop="qtyStart" label="数量起" min-width="100" header-align="center" align="center" />
  168. <el-table-column label="数量止" min-width="100" header-align="center" align="center">
  169. <template slot-scope="scope">{{ scope.row.qtyEnd === null || scope.row.qtyEnd === undefined || scope.row.qtyEnd === '' ? '∞' : scope.row.qtyEnd }}</template>
  170. </el-table-column>
  171. <el-table-column prop="unitPrice" label="单价" min-width="100" header-align="center" align="center" />
  172. <el-table-column prop="priceDate" label="价格日期" min-width="120" header-align="center" align="center" />
  173. <el-table-column prop="remark" label="备注" min-width="160" header-align="center" align="left" show-overflow-tooltip />
  174. </el-table>
  175. <div slot="footer" class="dialog-footer">
  176. <el-button type="primary" @click="openTierChangeFromPriceDialog">维护价格表</el-button>
  177. <el-button @click="priceDialogVisible = false">关闭</el-button>
  178. </div>
  179. </el-dialog>
  180. <!-- 阶梯价格变更弹窗:与 supplierPartMoqPrice 页面「变更」弹窗功能一致,保存后刷新上方价格展示 -->
  181. <SupplierPartTierChangeDialog ref="tierChangeDialog" @saved="handleTierChangeSaved" />
  182. <!-- 产品编辑对话框 -->
  183. <!-- 默认弹窗可拖动,特殊需求除外 - rqrq -->
  184. <el-dialog :title="isAdd ? '新增产品' : '编辑产品'" :visible.sync="partDialogVisible" width="720px" top="3vh" :close-on-click-modal="false" class="part-dialog" v-drag>
  185. <div class="dialog-content">
  186. <el-form
  187. :model="currentpart"
  188. :rules="partRules"
  189. ref="partForm"
  190. label-position="top"
  191. class="part-form">
  192. <div class="form-section">
  193. <el-row :gutter="24">
  194. <el-col :span="6">
  195. <el-form-item label="基准料号" prop="basePartNo" :required="isAdd">
  196. <el-input v-model="currentpart.basePartNo" :disabled="!isAdd" @input="syncGeneratedPartNo" @blur="onBasePartNoBlur"></el-input>
  197. </el-form-item>
  198. </el-col>
  199. <el-col :span="6">
  200. <!-- 后缀可不填,空值时产品编码直接使用基准料号 - rqrq -->
  201. <el-form-item label="物料后缀" prop="partSuffix">
  202. <el-input v-model="currentpart.partSuffix" :disabled="!isAdd" @input="syncGeneratedPartNo"></el-input>
  203. </el-form-item>
  204. </el-col>
  205. <el-col :span="6">
  206. <el-form-item label="产品编码" prop="partNo">
  207. <el-input v-model="currentpart.partNo" disabled></el-input>
  208. </el-form-item>
  209. </el-col>
  210. <!-- <el-col :span="6">-->
  211. <!-- <el-form-item label="NPC货号" prop="npc">-->
  212. <!-- <el-input v-model="currentpart.npc"></el-input>-->
  213. <!-- </el-form-item>-->
  214. <!-- </el-col>-->
  215. </el-row>
  216. <el-row :gutter="24">
  217. <el-col :span="6">
  218. <el-form-item>
  219. <span style="cursor: pointer" slot="label" @click="getBaseList(510)"><a href="#">计量单位</a></span>
  220. <el-input v-model="currentpart.unit" ></el-input>
  221. </el-form-item>
  222. </el-col>
  223. <el-col :span="6">
  224. <el-form-item prop="defaultSupplierNo" :required="isAdd">
  225. <span style="cursor: pointer" slot="label" @click="getBaseList(520)"><a href="#">默认供应商</a></span>
  226. <el-input v-model="currentpart.defaultSupplierNo" ></el-input>
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="6">
  230. <el-form-item label="Item">
  231. <el-input v-model="currentpart.item"></el-input>
  232. </el-form-item>
  233. </el-col>
  234. <el-col :span="6" v-if="showSkuInDialog && isAdd">
  235. <el-form-item prop="sku">
  236. <span style="cursor: pointer" slot="label" @click="getBaseList(508)"><a href="#">SKU</a></span>
  237. <el-autocomplete
  238. v-model="currentpart.sku"
  239. :fetch-suggestions="querySkuSuggestions"
  240. clearable
  241. style="width: 100%"
  242. placeholder="选择或输入SKU">
  243. </el-autocomplete>
  244. </el-form-item>
  245. </el-col>
  246. </el-row>
  247. <el-row :gutter="24">
  248. <el-col :span="6">
  249. <el-form-item label="一级分类">
  250. <el-select v-model="currentpart.category" clearable filterable style="width: 100%" @change="onPartCategoryChange">
  251. <el-option v-for="item in categoryLevel1Options" :key="item.familyId"
  252. :label="item.familyName" :value="item.familyId" />
  253. </el-select>
  254. </el-form-item>
  255. </el-col>
  256. <el-col :span="6">
  257. <el-form-item label="二级分类">
  258. <el-select v-model="currentpart.categoryLevel2" clearable filterable style="width: 100%"
  259. :disabled="!currentpart.category" @change="onPartCategoryLevel2Change">
  260. <el-option v-for="item in categoryLevel2Options" :key="item.familyId"
  261. :label="item.familyName" :value="item.familyId" />
  262. </el-select>
  263. </el-form-item>
  264. </el-col>
  265. <el-col :span="6">
  266. <el-form-item label="三级分类">
  267. <el-select v-model="currentpart.categoryLevel3" clearable filterable style="width: 100%"
  268. :disabled="!currentpart.categoryLevel2">
  269. <el-option v-for="item in categoryLevel3Options" :key="item.familyId"
  270. :label="item.familyName" :value="item.familyId" />
  271. </el-select>
  272. </el-form-item>
  273. </el-col>
  274. </el-row>
  275. <el-row :gutter="24">
  276. <el-col :span="12">
  277. <el-form-item label="产品名称" prop="partDesc">
  278. <el-input v-model="currentpart.partDesc"></el-input>
  279. </el-form-item>
  280. </el-col>
  281. <el-col :span="12">
  282. <el-form-item label="产品规格" prop="partSpec">
  283. <el-input v-model="currentpart.partSpec" placeholder="无产品规格请保持N/A"></el-input>
  284. </el-form-item>
  285. </el-col>
  286. </el-row>
  287. </div>
  288. <div class="form-section">
  289. <el-row :gutter="24">
  290. <el-col :span="6">
  291. <el-form-item >
  292. <span style="cursor: pointer" slot="label" @click="getBaseList(529)"><a href="#">采购员</a></span>
  293. <el-input v-model="currentpart.buyerName" ></el-input>
  294. </el-form-item>
  295. </el-col>
  296. <el-col :span="6">
  297. <el-form-item >
  298. <span style="cursor: pointer" slot="label" @click="getBaseList(528)"><a href="#">sourcing专员</a></span>
  299. <el-input v-model="currentpart.sourcingName" ></el-input>
  300. </el-form-item>
  301. </el-col>
  302. <el-col :span="6">
  303. <el-form-item label="属性模板" prop="codeNo">
  304. <el-select v-model="currentpart.codeNo" clearable filterable placeholder="请选择" style="width: 100%">
  305. <el-option v-for="code in codeNoOptions" :key="code" :label="code" :value="code" />
  306. </el-select>
  307. </el-form-item>
  308. </el-col>
  309. <el-col :span="6">
  310. <el-form-item label="是否在用">
  311. <el-select v-model="currentpart.status" placeholder="请选择" >
  312. <el-option label="在用" value="Y"></el-option>
  313. <el-option label="禁用" value="N"></el-option>
  314. </el-select>
  315. </el-form-item>
  316. </el-col>
  317. </el-row>
  318. </div>
  319. <div class="form-section">
  320. <el-row :gutter="24">
  321. <el-col :span="24">
  322. <el-form-item label="备注">
  323. <el-input v-model="currentpart.remark" type="textarea" :rows="2" resize="none" ></el-input>
  324. </el-form-item>
  325. </el-col>
  326. </el-row>
  327. </div>
  328. </el-form>
  329. </div>
  330. <div slot="footer" class="dialog-footer" style="margin-top: 20px">
  331. <el-button type="primary" @click="savePart()">保存</el-button>
  332. <el-button @click="partDialogVisible = false">取消</el-button>
  333. </div>
  334. </el-dialog>
  335. <el-dialog title="复制物料" :visible.sync="copyDialogVisible" width="520px" :close-on-click-modal="false" v-drag>
  336. <el-form :model="copyForm" :rules="copyRules" ref="copyForm" label-position="top">
  337. <el-row :gutter="24">
  338. <el-col :span="12">
  339. <el-form-item label="基准料号" prop="basePartNo">
  340. <el-input v-model="copyForm.basePartNo"></el-input>
  341. </el-form-item>
  342. </el-col>
  343. <el-col :span="12">
  344. <el-form-item label="物料后缀" prop="partSuffix">
  345. <el-input v-model="copyForm.partSuffix"></el-input>
  346. </el-form-item>
  347. </el-col>
  348. </el-row>
  349. </el-form>
  350. <div slot="footer" class="dialog-footer">
  351. <el-button type="primary" @click="confirmCopyPart">确认</el-button>
  352. <el-button @click="copyDialogVisible = false">取消</el-button>
  353. </div>
  354. </el-dialog>
  355. <!-- 按基准料号统一指定SKU - rqrq -->
  356. <el-dialog title="指定SKU" :visible.sync="specifySkuDialogVisible" width="460px" :close-on-click-modal="false" v-drag>
  357. <el-form :model="specifySkuForm" label-position="top">
  358. <el-form-item label="基准料号">
  359. <el-input v-model="specifySkuForm.basePartNo" disabled></el-input>
  360. </el-form-item>
  361. <el-form-item>
  362. <span style="cursor: pointer" slot="label" @click="openSpecifySkuPicker"><a href="#">SKU</a></span>
  363. <el-input v-model="specifySkuForm.sku" placeholder="选择或输入SKU"></el-input>
  364. </el-form-item>
  365. <div style="color:#909399;font-size:12px;line-height:1.5">将把基准料号 {{ specifySkuForm.basePartNo }} 下所有物料的 SKU 统一修改为上述值。</div>
  366. </el-form>
  367. <div slot="footer" class="dialog-footer">
  368. <el-button type="primary" :loading="specifySkuSaving" @click="confirmSpecifySku">确认</el-button>
  369. <el-button @click="specifySkuDialogVisible = false">取消</el-button>
  370. </div>
  371. </el-dialog>
  372. <el-dialog title="变更默认供应商" :visible.sync="changeSupplierDialogVisible" width="560px" :close-on-click-modal="false" v-drag>
  373. <el-form :model="changeSupplierForm" label-position="top">
  374. <el-row :gutter="24">
  375. <el-col :span="12">
  376. <el-form-item label="变更范围">
  377. <el-select v-model="changeSupplierForm.changeMode" style="width: 100%">
  378. <el-option label="按产品编码" value="PART_NO"></el-option>
  379. <el-option label="按基准物料" value="BASE_PART"></el-option>
  380. </el-select>
  381. </el-form-item>
  382. </el-col>
  383. <el-col :span="12">
  384. <el-form-item label="当前供应商编码">
  385. <el-input v-model="changeSupplierForm.currentSupplierNo" disabled></el-input>
  386. </el-form-item>
  387. </el-col>
  388. </el-row>
  389. <el-row :gutter="24">
  390. <el-col :span="24">
  391. <el-form-item label="当前供应商描述">
  392. <el-input v-model="changeSupplierForm.currentSupplierName" disabled></el-input>
  393. </el-form-item>
  394. </el-col>
  395. </el-row>
  396. <el-row :gutter="24">
  397. <el-col :span="24">
  398. <el-form-item>
  399. <span style="cursor: pointer" slot="label" @click="getBaseList(520, '', 'changeSupplier')"><a href="#">目标供应商</a></span>
  400. <el-input
  401. v-model="changeSupplierForm.targetSupplierNo"
  402. readonly
  403. placeholder="请选择目标供应商"
  404. @click.native="getBaseList(520, '', 'changeSupplier')">
  405. <i slot="suffix" class="el-icon-search" style="cursor:pointer" @click.stop="getBaseList(520, '', 'changeSupplier')"></i>
  406. </el-input>
  407. </el-form-item>
  408. </el-col>
  409. </el-row>
  410. </el-form>
  411. <div slot="footer" class="dialog-footer">
  412. <el-button type="primary" :loading="changeSupplierLoading" @click="confirmChangeDefaultSupplier">确认</el-button>
  413. <el-button @click="changeSupplierDialogVisible = false">取消</el-button>
  414. </div>
  415. </el-dialog>
  416. <!-- 审批对话框 - rqrq -->
  417. <!-- <el-dialog
  418. title="审批"
  419. :visible.sync="approveDialogVisible"
  420. width="550px"
  421. :close-on-click-modal="false"
  422. v-drag>
  423. <el-form :model="approveData" label-position="top">
  424. <el-row :gutter="20">
  425. <el-col :span="12">
  426. <el-form-item label="是否特殊放行">
  427. <el-select v-model="approveData.specialRelease" style="width: 100%">
  428. <el-option label="否" value="N"></el-option>
  429. <el-option label="是" value="Y"></el-option>
  430. </el-select>
  431. </el-form-item>
  432. </el-col>
  433. </el-row>
  434. <el-form-item label="审批意见">
  435. <el-input type="textarea" v-model="approveData.comment" :rows="3" placeholder="请输入审批意见"></el-input>
  436. </el-form-item>
  437. </el-form>
  438. <el-footer style="height:40px;margin-top: 60px;text-align:center">
  439. <el-button type="success" @click="submitApprove('APPROVED')" :loading="approveLoading">同意</el-button>
  440. <el-button type="danger" @click="submitApprove('REJECTED')" :loading="approveLoading">驳回</el-button>
  441. <el-button @click="approveDialogVisible = false" :disabled="approveLoading">取消</el-button>
  442. </el-footer>
  443. </el-dialog> -->
  444. <!-- 新品流程确认三按钮弹窗:发起并审核 / 发起 / 取消 -->
  445. <el-dialog
  446. title="新品流程确认"
  447. :visible.sync="newProductFlowDialogVisible"
  448. width="440px"
  449. :close-on-click-modal="false"
  450. v-drag
  451. append-to-body>
  452. <div style="line-height: 1.6">供应商价格表中未找到该物料记录,是否产生供应商价格表(可供物料)并进入新品流程?</div>
  453. <div slot="footer" class="dialog-footer">
  454. <el-button type="primary" @click="confirmNewProductFlow(true)">发起并审核</el-button>
  455. <el-button type="primary" plain @click="confirmNewProductFlow(false)">发起</el-button>
  456. <el-button @click="cancelNewProductFlow">取消</el-button>
  457. </div>
  458. </el-dialog>
  459. <!-- 新品登记审核弹窗:发起并审核后跳出,布局与 supplierPartNewProductAudit 页面的登记审核弹窗一致 -->
  460. <el-dialog
  461. title="登记审核"
  462. :visible.sync="auditDialogVisible"
  463. width="460px"
  464. :close-on-click-modal="false"
  465. v-drag
  466. append-to-body>
  467. <el-form :model="auditForm" class="rq" label-width="80px" label-position="top">
  468. <el-row :gutter="16">
  469. <el-col :span="12">
  470. <el-form-item label="部门" >
  471. <el-select v-model="auditForm.deptType" disabled style="width: 100%">
  472. <el-option label="采购部门" value="PURCHASE" />
  473. <el-option label="质量部门" value="QUALITY" />
  474. </el-select>
  475. </el-form-item>
  476. </el-col>
  477. <el-col :span="12">
  478. <el-form-item label="审核结论" required>
  479. <el-select v-model="auditForm.auditResult" style="width: 100%">
  480. <el-option label="同意" value="AGREE" />
  481. <el-option label="不同意" value="REJECT" />
  482. </el-select>
  483. </el-form-item>
  484. </el-col>
  485. </el-row>
  486. <el-row :gutter="16">
  487. <el-col :span="12">
  488. <el-form-item label="是否需要测试">
  489. <el-checkbox v-model="auditForm.needTestFlag">需要测试</el-checkbox>
  490. </el-form-item>
  491. </el-col>
  492. <el-col :span="12">
  493. <el-form-item label="审核人">
  494. <el-input :value="currentLoginUser" disabled />
  495. </el-form-item>
  496. </el-col>
  497. </el-row>
  498. <el-form-item label="审核意见" :style="calcTextareaFollowGapStyle(3)">
  499. <el-input
  500. v-model="auditForm.auditOpinion"
  501. type="textarea"
  502. resize="none"
  503. :autosize="{ minRows: 3, maxRows: 3 }"
  504. placeholder="可不填"
  505. />
  506. </el-form-item>
  507. </el-form>
  508. <span slot="footer" class="dialog-footer">
  509. <el-button type="primary" :loading="auditSaveLoading" @click="submitPartNewProductAudit">确认</el-button>
  510. <el-button :disabled="auditSaveLoading" @click="auditDialogVisible = false">取消</el-button>
  511. </span>
  512. </el-dialog>
  513. </div>
  514. </template>
  515. <script>
  516. /* 组件 */
  517. import {
  518. searchPartList,
  519. createPart,
  520. updatePart,
  521. copyPartByBase,
  522. deletePart,
  523. startPartFormalApprove,
  524. changePartDefaultSupplier,
  525. listSkuByBasePartNo,
  526. updateSkuByBasePartNo,
  527. checkSkuBasePartNo
  528. } from '@/api/part/partInfo.js'
  529. import { checkSupplierPartByItemSku, addSupplierPartMoq, listSupplierPartMoq } from '@/api/supplier/supplierPartMoqPrice'
  530. import { listPoCurrentTierPrice } from '@/api/order/poOrder'
  531. import { startNewProductAudit, listNewProductAuditRecord, submitNewProductAuditRecord } from '@/api/supplier/supplierPartNewProductAudit'
  532. import excel from '@/utils/excel-util.js'
  533. import { fetchSupplierDetail, resolveSupplierShortFieldsFromDetail } from '@/utils/supplierChooselistHelper'
  534. import { getChooselistEam, getChooselistDataEam } from '@/api/chooselist/chooselist.js'
  535. import Chooselist from '@/views/modules/common/Chooselist_eam'
  536. import basicInfo from './com_part_BasicInfo'
  537. import specParams from './com_part_SpecParams'
  538. import suppliers from './com_part_Suppliers'
  539. import approval from './com_part_Approval'
  540. import attachments from './com_part_Attachments'
  541. import PartAdvancedCopyDialog from './PartAdvancedCopyDialog'
  542. import SupplierPartTierChangeDialog from '@/views/modules/supplier/com_supplierPartTierChangeDialog'
  543. import {
  544. approveNodeInstance,
  545. restartFlowInstance
  546. } from '@/api/workFlow/workFlow.js'
  547. import { listPartFamilyByType } from '@/api/baseInformation/srmPartFamily.js'
  548. import { refreshPropertiesModal as refreshPartPropertiesModal } from '@/api/part/partProperties.js'
  549. export default {
  550. watch: {
  551. searchData: {
  552. deep: true,
  553. handler: function (newV, oldV) {
  554. this.searchData.partNo = this.searchData.partNo.toUpperCase()
  555. this.searchData.npc = this.searchData.npc.toUpperCase()
  556. this.searchData.category = (this.searchData.category || '').toUpperCase()
  557. this.searchData.categoryLevel2 = (this.searchData.categoryLevel2 || '').toUpperCase()
  558. this.searchData.categoryLevel3 = (this.searchData.categoryLevel3 || '').toUpperCase()
  559. this.searchData.unit = this.searchData.unit.toUpperCase()
  560. this.searchData.codeNo = this.searchData.codeNo.toUpperCase()
  561. this.searchData.partDesc = this.searchData.partDesc.toUpperCase()
  562. this.searchData.partSpec = this.searchData.partSpec.toUpperCase()
  563. this.searchData.basePartNo = (this.searchData.basePartNo || '').toUpperCase()
  564. this.searchData.sku = (this.searchData.sku || '').toUpperCase()
  565. this.searchData.item = (this.searchData.item || '').toUpperCase()
  566. this.searchData.defaultSupplierNo = (this.searchData.defaultSupplierNo || '').toUpperCase()
  567. }
  568. },
  569. currentpart: {
  570. deep: true,
  571. handler: function (newV, oldV) {
  572. this.currentpart.partNo = this.currentpart.partNo.toUpperCase()
  573. this.currentpart.npc = this.currentpart.npc.toUpperCase()
  574. this.currentpart.category = (this.currentpart.category || '').toUpperCase()
  575. this.currentpart.categoryLevel2 = (this.currentpart.categoryLevel2 || '').toUpperCase()
  576. this.currentpart.categoryLevel3 = (this.currentpart.categoryLevel3 || '').toUpperCase()
  577. this.currentpart.unit = this.currentpart.unit.toUpperCase()
  578. this.currentpart.codeNo = (this.currentpart.codeNo || '').toUpperCase()
  579. this.currentpart.partDesc = this.currentpart.partDesc.toUpperCase()
  580. this.currentpart.partSpec = this.currentpart.partSpec.toUpperCase()
  581. this.currentpart.basePartNo = (this.currentpart.basePartNo || '').toUpperCase()
  582. this.currentpart.partSuffix = (this.currentpart.partSuffix || '').toUpperCase()
  583. this.currentpart.sku = (this.currentpart.sku || '').toUpperCase()
  584. this.currentpart.item = (this.currentpart.item || '').toUpperCase()
  585. this.currentpart.defaultSupplierNo = (this.currentpart.defaultSupplierNo || '').toUpperCase()
  586. if (this.isAdd) {
  587. this.currentpart.partNo = this.generatePartNo(this.currentpart.basePartNo, this.currentpart.partSuffix)
  588. }
  589. }
  590. }
  591. },
  592. computed: {
  593. currentLoginUser () {
  594. return this.$store.state.user.username || this.$store.state.user.name || ''
  595. }
  596. },
  597. data () {
  598. return {
  599. functionId: this.$route.meta.menuId,
  600. height: 200,
  601. detailHeight: 320,
  602. currentRow: {},
  603. searchData: {
  604. partNo: '',
  605. basePartNo: '',
  606. npc: '',
  607. partDesc: '',
  608. partSpec: '',
  609. sku: '',
  610. item: '',
  611. defaultSupplierNo: '',
  612. buyerName: '',
  613. sourcingName: '',
  614. category: '',
  615. categoryLevel2: '',
  616. categoryLevel3: '',
  617. unit: '',
  618. status: '',
  619. codeNo: '',
  620. createBy: '',
  621. site: this.$store.state.user.site,
  622. page: 1,
  623. limit: 10
  624. },
  625. pageIndex: 1,
  626. pageSize: 50,
  627. totalPage: 0,
  628. searchCategoryLevel1Options: [],
  629. searchCategoryLevel2Options: [],
  630. searchCategoryLevel3Options: [],
  631. categoryLevel1Options: [],
  632. categoryLevel2Options: [],
  633. categoryLevel3Options: [],
  634. // 属性模板下拉选项(来源与 Chooselist 527 同一数据源)
  635. codeNoOptions: [],
  636. tagNo: '',
  637. mainDataList: [],
  638. dataListLoading: false,
  639. activeName: 'basicInfo',
  640. // 审批对话框
  641. approveDialogVisible: false,
  642. approveLoading: false,
  643. approveData: {
  644. applyNo: '',
  645. // nodeCode: '',
  646. // nodeName: '',
  647. // departmentName: '', // 审批部门 - rqrq
  648. // assigneeName: '',
  649. site: '',
  650. orderType: '',
  651. comment: '',
  652. flowCode: '',
  653. flowVersion: null
  654. },
  655. columnArray1: [
  656. {
  657. userId: this.$store.state.user.name,
  658. functionId: this.functionId,
  659. serialNumber: 'partTablePartNo',
  660. tableId: 'partTable',
  661. tableName: '产品信息',
  662. columnProp: 'partNo',
  663. headerAlign: 'center',
  664. align: 'center',
  665. columnLabel: '产品编码',
  666. columnWidth: '100',
  667. columnHidden: false,
  668. columnImage: false,
  669. columnSortable: true,
  670. sortLv: 0,
  671. status: true,
  672. fixed: false
  673. },
  674. {
  675. userId: this.$store.state.user.name,
  676. functionId: this.functionId,
  677. serialNumber: 'partTableBasePartNo',
  678. tableId: 'partTable',
  679. tableName: '产品信息',
  680. columnProp: 'basePartNo',
  681. headerAlign: 'center',
  682. align: 'center',
  683. columnLabel: '基准料号',
  684. columnWidth: '120',
  685. columnHidden: false,
  686. columnImage: false,
  687. columnSortable: false,
  688. sortLv: 0,
  689. status: true,
  690. fixed: false
  691. },
  692. // {
  693. // userId: this.$store.state.user.name,
  694. // functionId: this.functionId,
  695. // serialNumber: 'partTableNpc',
  696. // tableId: 'partTable',
  697. // tableName: '产品信息',
  698. // columnProp: 'npc',
  699. // headerAlign: 'center',
  700. // align: 'center',
  701. // columnLabel: 'NPC货号',
  702. // columnWidth: '100',
  703. // columnHidden: false,
  704. // columnImage: false,
  705. // columnSortable: false,
  706. // sortLv: 0,
  707. // status: true,
  708. // fixed: false
  709. // },
  710. {
  711. userId: this.$store.state.user.name,
  712. functionId: this.functionId,
  713. serialNumber: 'partTableItem',
  714. tableId: 'partTable',
  715. tableName: '产品信息',
  716. columnProp: 'item',
  717. headerAlign: 'center',
  718. align: 'center',
  719. columnLabel: 'Item',
  720. columnWidth: '120',
  721. columnHidden: false,
  722. columnImage: false,
  723. columnSortable: true,
  724. sortLv: 0,
  725. status: true,
  726. fixed: false
  727. },
  728. {
  729. userId: this.$store.state.user.name,
  730. functionId: this.functionId,
  731. serialNumber: 'partTableSku',
  732. tableId: 'partTable',
  733. tableName: '产品信息',
  734. columnProp: 'sku',
  735. headerAlign: 'center',
  736. align: 'center',
  737. columnLabel: 'SKU',
  738. columnWidth: '120',
  739. columnHidden: false,
  740. columnImage: false,
  741. columnSortable: true,
  742. sortLv: 0,
  743. status: true,
  744. fixed: false
  745. },
  746. {
  747. userId: this.$store.state.user.name,
  748. functionId: this.functionId,
  749. serialNumber: 'partTableDefaultSupplierNo',
  750. tableId: 'partTable',
  751. tableName: '产品信息',
  752. // 默认供应商列改为展示供应商简称(后端未维护简称时回退供应商编码),导出共用该列配置 - rqrq
  753. columnProp: 'defaultSupplierShortName',
  754. headerAlign: 'center',
  755. align: 'center',
  756. columnLabel: '默认供应商',
  757. columnWidth: '120',
  758. columnHidden: false,
  759. columnImage: false,
  760. columnSortable: false,
  761. sortLv: 0,
  762. status: true,
  763. fixed: false
  764. },
  765. {
  766. userId: this.$store.state.user.name,
  767. functionId: this.functionId,
  768. serialNumber: 'partTablePartDesc',
  769. tableId: 'partTable',
  770. tableName: '产品信息',
  771. columnProp: 'partDesc',
  772. headerAlign: 'center',
  773. align: 'left',
  774. columnLabel: '产品名称',
  775. columnWidth: '200',
  776. columnHidden: false,
  777. columnImage: false,
  778. columnSortable: false,
  779. sortLv: 0,
  780. status: true,
  781. fixed: false
  782. },
  783. {
  784. userId: this.$store.state.user.name,
  785. functionId: this.functionId,
  786. serialNumber: 'partTablepartSpec',
  787. tableId: 'partTable',
  788. tableName: '产品信息',
  789. columnProp: 'partSpec',
  790. headerAlign: 'center',
  791. align: 'left',
  792. columnLabel: '产品规格',
  793. columnWidth: '150',
  794. columnHidden: false,
  795. columnImage: false,
  796. columnSortable: false,
  797. sortLv: 0,
  798. status: true,
  799. fixed: false
  800. },
  801. {
  802. userId: this.$store.state.user.name,
  803. functionId: this.functionId,
  804. serialNumber: 'partTableBuyerName',
  805. tableId: 'partTable',
  806. tableName: '产品信息',
  807. columnProp: 'buyerName',
  808. headerAlign: 'center',
  809. align: 'center',
  810. columnLabel: '采购员',
  811. columnWidth: '100',
  812. columnHidden: false,
  813. columnImage: false,
  814. columnSortable: false,
  815. sortLv: 0,
  816. status: true,
  817. fixed: false
  818. },
  819. {
  820. userId: this.$store.state.user.name,
  821. functionId: this.functionId,
  822. serialNumber: 'partTableSourcingName',
  823. tableId: 'partTable',
  824. tableName: '产品信息',
  825. columnProp: 'sourcingName',
  826. headerAlign: 'center',
  827. align: 'center',
  828. columnLabel: 'sourcing专员',
  829. columnWidth: '100',
  830. columnHidden: false,
  831. columnImage: false,
  832. columnSortable: false,
  833. sortLv: 0,
  834. status: true,
  835. fixed: false
  836. },
  837. {
  838. userId: this.$store.state.user.name,
  839. functionId: this.functionId,
  840. serialNumber: 'partTableCategory',
  841. tableId: 'partTable',
  842. tableName: '产品信息',
  843. columnProp: 'categoryName',
  844. headerAlign: 'center',
  845. align: 'center',
  846. columnLabel: '一级分类',
  847. columnWidth: '100',
  848. columnHidden: false,
  849. columnImage: false,
  850. columnSortable: false,
  851. sortLv: 0,
  852. status: true,
  853. fixed: false
  854. },
  855. {
  856. userId: this.$store.state.user.name,
  857. functionId: this.functionId,
  858. serialNumber: 'partTableCategoryLevel2',
  859. tableId: 'partTable',
  860. tableName: '产品信息',
  861. columnProp: 'categoryLevel2Name',
  862. headerAlign: 'center',
  863. align: 'center',
  864. columnLabel: '二级分类',
  865. columnWidth: '100',
  866. columnHidden: false,
  867. columnImage: false,
  868. columnSortable: false,
  869. sortLv: 0,
  870. status: true,
  871. fixed: false
  872. },
  873. {
  874. userId: this.$store.state.user.name,
  875. functionId: this.functionId,
  876. serialNumber: 'partTableCategoryLevel3',
  877. tableId: 'partTable',
  878. tableName: '产品信息',
  879. columnProp: 'categoryLevel3Name',
  880. headerAlign: 'center',
  881. align: 'center',
  882. columnLabel: '三级分类',
  883. columnWidth: '100',
  884. columnHidden: false,
  885. columnImage: false,
  886. columnSortable: false,
  887. sortLv: 0,
  888. status: true,
  889. fixed: false
  890. },
  891. {
  892. userId: this.$store.state.user.name,
  893. functionId: this.functionId,
  894. serialNumber: 'partTableUnit',
  895. tableId: 'partTable',
  896. tableName: '产品信息',
  897. columnProp: 'unit',
  898. headerAlign: 'center',
  899. align: 'center',
  900. columnLabel: '计量单位',
  901. columnWidth: '80',
  902. columnHidden: false,
  903. columnImage: false,
  904. columnSortable: false,
  905. sortLv: 0,
  906. status: true,
  907. fixed: false
  908. },
  909. {
  910. userId: this.$store.state.user.name,
  911. functionId: this.functionId,
  912. serialNumber: 'partTablePartStage',
  913. tableId: 'partTable',
  914. tableName: '产品信息',
  915. columnProp: 'partStage',
  916. headerAlign: 'center',
  917. align: 'center',
  918. columnLabel: '物料阶段',
  919. columnWidth: '100',
  920. columnHidden: false,
  921. columnImage: false,
  922. columnSortable: false,
  923. sortLv: 0,
  924. status: true,
  925. fixed: false
  926. },
  927. {
  928. userId: this.$store.state.user.name,
  929. functionId: this.functionId,
  930. serialNumber: 'partTableStatus',
  931. tableId: 'partTable',
  932. tableName: '产品信息',
  933. columnProp: 'status',
  934. headerAlign: 'center',
  935. align: 'center',
  936. columnLabel: '是否在用',
  937. columnWidth: '80',
  938. columnHidden: false,
  939. columnImage: false,
  940. columnSortable: false,
  941. sortLv: 0,
  942. status: true,
  943. fixed: false
  944. },
  945. {
  946. userId: this.$store.state.user.name,
  947. functionId: this.functionId,
  948. serialNumber: 'partTableCodeNo',
  949. tableId: 'partTable',
  950. tableName: '产品信息',
  951. columnProp: 'codeNo',
  952. headerAlign: 'center',
  953. align: 'center',
  954. columnLabel: '属性模板',
  955. columnWidth: '100',
  956. columnHidden: false,
  957. columnImage: false,
  958. columnSortable: false,
  959. sortLv: 0,
  960. status: true,
  961. fixed: false
  962. },
  963. {
  964. userId: this.$store.state.user.name,
  965. functionId: this.functionId,
  966. serialNumber: 'partTableCreateBy',
  967. tableId: 'partTable',
  968. tableName: '产品信息',
  969. columnProp: 'createBy',
  970. headerAlign: 'center',
  971. align: 'center',
  972. columnLabel: '创建人',
  973. columnWidth: '100',
  974. columnHidden: false,
  975. columnImage: false,
  976. columnSortable: false,
  977. sortLv: 0,
  978. status: true,
  979. fixed: false
  980. },
  981. {
  982. userId: this.$store.state.user.name,
  983. functionId: this.functionId,
  984. serialNumber: 'partTableCreateDate',
  985. tableId: 'partTable',
  986. tableName: '产品信息',
  987. columnProp: 'createDate',
  988. headerAlign: 'center',
  989. align: 'center',
  990. columnLabel: '创建时间',
  991. columnWidth: '150',
  992. columnHidden: false,
  993. columnImage: false,
  994. columnSortable: true,
  995. sortLv: 0,
  996. status: true,
  997. fixed: false
  998. }
  999. // {
  1000. // userId: this.$store.state.user.name,
  1001. // functionId: this.functionId,
  1002. // serialNumber: 'partTableDepartmentName',
  1003. // tableId: 'partTable',
  1004. // tableName: '产品信息',
  1005. // columnProp: 'departmentName',
  1006. // headerAlign: 'center',
  1007. // align: 'center',
  1008. // columnLabel: '审批部门',
  1009. // columnWidth: '100',
  1010. // columnHidden: false,
  1011. // columnImage: false,
  1012. // columnSortable: false,
  1013. // sortLv: 0,
  1014. // status: true,
  1015. // fixed: false
  1016. // },
  1017. // {
  1018. // userId: this.$store.state.user.name,
  1019. // functionId: this.functionId,
  1020. // serialNumber: 'partTableApproverName',
  1021. // tableId: 'partTable',
  1022. // tableName: '产品信息',
  1023. // columnProp: 'assigneeName',
  1024. // headerAlign: 'center',
  1025. // align: 'center',
  1026. // columnLabel: '要求审批人',
  1027. // columnWidth: '100',
  1028. // columnHidden: false,
  1029. // columnImage: false,
  1030. // columnSortable: false,
  1031. // sortLv: 0,
  1032. // status: true,
  1033. // fixed: false
  1034. // },
  1035. // {
  1036. // userId: this.$store.state.user.name,
  1037. // functionId: this.functionId,
  1038. // serialNumber: 'partTableFlowStatus',
  1039. // tableId: 'partTable',
  1040. // tableName: '产品信息',
  1041. // columnProp: 'flowStatus',
  1042. // headerAlign: 'center',
  1043. // align: 'center',
  1044. // columnLabel: '审批状态',
  1045. // columnWidth: '100',
  1046. // columnHidden: false,
  1047. // columnImage: false,
  1048. // columnSortable: false,
  1049. // sortLv: 0,
  1050. // status: true,
  1051. // fixed: false
  1052. // }
  1053. ],
  1054. exportName: '产品信息' + this.dayjs().format('YYYYMMDDHHmmss'),
  1055. // 供应商可供物料价格表弹窗状态 - rqrq
  1056. priceDialogVisible: false,
  1057. priceDialogLoading: false,
  1058. priceDialogRows: [],
  1059. priceDialogPartNo: '',
  1060. priceDialogSupplierNo: '',
  1061. // 产品对话框相关
  1062. partDialogVisible: false,
  1063. isAdd: true,
  1064. skuOptions: [],
  1065. currentpart: {
  1066. partNo: '',
  1067. basePartNo: '',
  1068. partSuffix: '',
  1069. npc: '',
  1070. partDesc: '',
  1071. partSpec: '',
  1072. sku: '',
  1073. item: '',
  1074. defaultSupplierNo: '',
  1075. buyerName: '',
  1076. sourcingName: '',
  1077. category: '',
  1078. categoryLevel2: '',
  1079. categoryLevel3: '',
  1080. unit: '',
  1081. status: 'Y',
  1082. codeNo: '',
  1083. createBy: '',
  1084. remark: '',
  1085. site: this.$store.state.user.site,
  1086. },
  1087. partRules: {
  1088. partSpec: [
  1089. { required: true, message: ' ', trigger: 'blur' }
  1090. ],
  1091. npc: [
  1092. { required: true, message: ' ', trigger: 'blur' }
  1093. ],
  1094. codeNo: [
  1095. { required: true, message: ' ', trigger: 'blur' }
  1096. ],
  1097. sku: [
  1098. {
  1099. validator: (rule, value, callback) => {
  1100. // 新增时单向强校验:填了 Item 就必须填 SKU;只填 SKU 时 Item 仍可留空
  1101. // 编辑态不强制,避免历史“有 Item 无 SKU”的数据无法保存
  1102. if (this.isAdd && String(this.currentpart.item || '').trim() && !String(value || '').trim()) {
  1103. callback(new Error('填写 Item 后必须填写 SKU'))
  1104. return
  1105. }
  1106. callback()
  1107. },
  1108. trigger: ['blur', 'change']
  1109. }
  1110. ]
  1111. },
  1112. copyDialogVisible: false,
  1113. // 新品流程三按钮确认与登记审核弹窗
  1114. newProductFlowDialogVisible: false,
  1115. auditDialogVisible: false,
  1116. auditSaveLoading: false,
  1117. auditForm: {
  1118. id: null,
  1119. site: '',
  1120. supplierCode: '',
  1121. partNo: '',
  1122. auditRoundNo: null,
  1123. deptType: 'PURCHASE',
  1124. auditResult: '',
  1125. needTestFlag: false,
  1126. auditOpinion: ''
  1127. },
  1128. copyForm: {
  1129. basePartNo: '',
  1130. partSuffix: ''
  1131. },
  1132. // 编辑/新增弹窗中展示 SKU 字段(与“指定SKU”按钮批量维护并存),不需要时改为 false
  1133. showSkuInDialog: true,
  1134. // 指定SKU弹窗
  1135. specifySkuDialogVisible: false,
  1136. specifySkuSaving: false,
  1137. specifySkuForm: {
  1138. site: '',
  1139. basePartNo: '',
  1140. sku: ''
  1141. },
  1142. changeSupplierDialogVisible: false,
  1143. changeSupplierLoading: false,
  1144. changeSupplierForm: {
  1145. changeMode: 'PART_NO',
  1146. partNo: '',
  1147. basePartNo: '',
  1148. currentSupplierNo: '',
  1149. currentSupplierName: '',
  1150. targetSupplierNo: '',
  1151. targetSupplierName: ''
  1152. },
  1153. basePickScene: '',
  1154. copyRules: {
  1155. basePartNo: [
  1156. { required: true, message: '请输入基准料号', trigger: 'blur' }
  1157. ]
  1158. }
  1159. }
  1160. },
  1161. /* 组件 */
  1162. components: {
  1163. PartAdvancedCopyDialog,
  1164. SupplierPartTierChangeDialog,
  1165. Chooselist,
  1166. basicInfo,
  1167. specParams,
  1168. suppliers,
  1169. approval,
  1170. attachments
  1171. },
  1172. created() {
  1173. this.loadSearchCategoryLevel1()
  1174. this.getMainData()
  1175. },
  1176. mounted () {
  1177. this.handleResize()
  1178. window.addEventListener('resize', this.handleResize)
  1179. this.loadCodeNoOptions()
  1180. },
  1181. beforeDestroy () {
  1182. window.removeEventListener('resize', this.handleResize)
  1183. },
  1184. methods: {
  1185. getOuterHeight (el) {
  1186. if (!el) return 0
  1187. const rect = el.getBoundingClientRect()
  1188. const style = window.getComputedStyle(el)
  1189. return rect.height + (parseFloat(style.marginTop) || 0) + (parseFloat(style.marginBottom) || 0)
  1190. },
  1191. handleResize () {
  1192. this.$nextTick(() => {
  1193. const rootEl = this.$refs.pageRoot || this.$el
  1194. if (!rootEl) return
  1195. const searchFormEl = this.$refs.searchForm && this.$refs.searchForm.$el
  1196. ? this.$refs.searchForm.$el
  1197. : this.$refs.searchForm
  1198. const paginationEl = this.$refs.mainPagination && this.$refs.mainPagination.$el
  1199. ? this.$refs.mainPagination.$el
  1200. : this.$refs.mainPagination
  1201. const tabsEl = this.$refs.partTabs && this.$refs.partTabs.$el
  1202. ? this.$refs.partTabs.$el
  1203. : this.$refs.partTabs
  1204. const tabsHeaderEl = tabsEl ? tabsEl.querySelector('.el-tabs__header') : null
  1205. const viewportBottomGap = 24
  1206. const pageTop = rootEl.getBoundingClientRect().top
  1207. const availableViewportHeight = window.innerHeight - pageTop - viewportBottomGap
  1208. const fixedBlockHeight = this.getOuterHeight(searchFormEl) + this.getOuterHeight(paginationEl) + this.getOuterHeight(tabsHeaderEl) + 22
  1209. const splitAvailable = availableViewportHeight - fixedBlockHeight
  1210. if (!Number.isFinite(splitAvailable) || splitAvailable <= 0) return
  1211. let mainTableHeight
  1212. let detailHeight
  1213. if (splitAvailable < 520) {
  1214. mainTableHeight = Math.max(180, Math.floor(splitAvailable * 0.45))
  1215. detailHeight = Math.max(220, splitAvailable - mainTableHeight)
  1216. } else {
  1217. mainTableHeight = Math.max(220, Math.floor(splitAvailable * 0.42))
  1218. detailHeight = splitAvailable - mainTableHeight
  1219. if (detailHeight < 320) {
  1220. detailHeight = 320
  1221. mainTableHeight = Math.max(200, splitAvailable - detailHeight)
  1222. }
  1223. }
  1224. this.height = mainTableHeight
  1225. this.detailHeight = detailHeight
  1226. this.applyCurrentTabHeight()
  1227. this.$nextTick(() => {
  1228. if (this.$refs.mainTable && this.$refs.mainTable.doLayout) {
  1229. this.$refs.mainTable.doLayout()
  1230. }
  1231. })
  1232. })
  1233. },
  1234. getBasicTabHeight () {
  1235. return Math.max(Number(this.height) - 20, 180)
  1236. },
  1237. getDetailTabHeight (offset = 0) {
  1238. return Math.max(Number(this.detailHeight) - Number(offset || 0), 220)
  1239. },
  1240. applyCurrentTabHeight () {
  1241. if (this.$refs.basicInfo && this.$refs.basicInfo.searchData) {
  1242. this.$refs.basicInfo.searchData.height = this.getBasicTabHeight()
  1243. }
  1244. if (this.$refs.specParams && this.$refs.specParams.setTableHeight) {
  1245. this.$refs.specParams.setTableHeight(this.getDetailTabHeight(70))
  1246. }
  1247. if (this.$refs.suppliers && this.$refs.suppliers.setTableHeight) {
  1248. this.$refs.suppliers.setTableHeight(this.getDetailTabHeight(90))
  1249. }
  1250. if (this.$refs.approval && this.$refs.approval.setTableHeight) {
  1251. this.$refs.approval.setTableHeight(this.getDetailTabHeight(30))
  1252. }
  1253. if (this.$refs.attachments && this.$refs.attachments.setTableHeight) {
  1254. this.$refs.attachments.setTableHeight(this.getDetailTabHeight(90))
  1255. }
  1256. },
  1257. formatPartStageDesc (partStage) {
  1258. if (partStage === 'Approved') {
  1259. return '正式物料'
  1260. }
  1261. if (partStage === 'Approving') {
  1262. return '转正审批中'
  1263. }
  1264. return '新增物料'
  1265. },
  1266. formatTableCell (columnProp, row) {
  1267. if (columnProp === 'partStage') {
  1268. return this.formatPartStageDesc(row.partStage)
  1269. }
  1270. if (columnProp === 'status') {
  1271. return row.status === 'Y' ? '在用' : row.status === 'N' ? '禁用' : row.status
  1272. }
  1273. if (columnProp === 'categoryName') {
  1274. return row.categoryName || row.category || ''
  1275. }
  1276. if (columnProp === 'categoryLevel2Name') {
  1277. return row.categoryLevel2Name || row.categoryLevel2 || ''
  1278. }
  1279. if (columnProp === 'categoryLevel3Name') {
  1280. return row.categoryLevel3Name || row.categoryLevel3 || ''
  1281. }
  1282. return row[columnProp]
  1283. },
  1284. // 新增和原有复制共用规则:后缀允许包含 '-',为空时直接使用基准料号 - rqrq
  1285. generatePartNo (basePartNo, partSuffix) {
  1286. const base = (basePartNo || '').trim().toUpperCase()
  1287. const suffix = (partSuffix || '').trim().toUpperCase()
  1288. if (!base) {
  1289. return ''
  1290. }
  1291. return suffix ? `${base}-${suffix}` : base
  1292. },
  1293. syncGeneratedPartNo () {
  1294. if (!this.isAdd) return
  1295. this.currentpart.partNo = this.generatePartNo(this.currentpart.basePartNo, this.currentpart.partSuffix)
  1296. },
  1297. // 基准料号失焦:查询该基准料号下已维护过的SKU,作为SKU联想建议(仍允许输入不存在的SKU)
  1298. onBasePartNoBlur () {
  1299. if (!this.isAdd) return
  1300. const basePartNo = (this.currentpart.basePartNo || '').trim().toUpperCase()
  1301. if (!basePartNo) {
  1302. this.skuOptions = []
  1303. return
  1304. }
  1305. const site = (this.$store.state.user.site || '').trim().toUpperCase()
  1306. // 当前SKU为空、或是上一次自动带出/联想列表中的值时,才允许被新的第一个覆盖,避免冲掉用户手动录入的自定义SKU
  1307. const prevOptions = this.skuOptions || []
  1308. const curSku = this.currentpart.sku
  1309. const canOverwrite = !curSku || prevOptions.indexOf(curSku) !== -1
  1310. listSkuByBasePartNo({ site, basePartNo }).then(({ data }) => {
  1311. const rows = (data && data.code === 0 && data.rows) ? data.rows : []
  1312. this.skuOptions = rows
  1313. // 默认选中第一个自动赋值给SKU输入框
  1314. if (rows.length && canOverwrite) {
  1315. this.currentpart.sku = rows[0]
  1316. // 程序赋值不触发输入框校验,重算一次避免旧的报错残留(未带出值时不主动校验,防止提前抛错)
  1317. if (this.showSkuInDialog && this.isAdd && this.$refs.partForm) {
  1318. this.$refs.partForm.validateField('sku')
  1319. }
  1320. }
  1321. }).catch(() => {
  1322. this.skuOptions = []
  1323. })
  1324. },
  1325. // SKU 联想:从已维护的 skuOptions 中前缀/包含匹配,无匹配时也允许直接录入
  1326. querySkuSuggestions (queryString, cb) {
  1327. const list = this.skuOptions || []
  1328. const kw = (queryString || '').trim().toUpperCase()
  1329. const results = kw ? list.filter(item => (item || '').toUpperCase().indexOf(kw) !== -1) : list
  1330. cb(results.map(item => ({ value: item })))
  1331. },
  1332. extractBasePartNo (partNo) {
  1333. const value = (partNo || '').trim().toUpperCase()
  1334. if (!value) return ''
  1335. const index = value.indexOf('-')
  1336. return index > 0 ? value.substring(0, index) : value
  1337. },
  1338. // 以已存基准料号为边界提取完整后缀;基准为空或与编码不匹配时留空,避免按首个 '-' 误拆 - rqrq。
  1339. extractPartSuffix (partNo, basePartNo) {
  1340. const value = (partNo || '').trim().toUpperCase()
  1341. const base = (basePartNo || '').trim().toUpperCase()
  1342. return base && value.indexOf(`${base}-`) === 0 ? value.substring(base.length + 1) : ''
  1343. },
  1344. openCopyDialog () {
  1345. const selectedBasePartNo = (this.currentRow && this.currentRow.basePartNo) ? this.currentRow.basePartNo : ''
  1346. this.copyForm = {
  1347. // 复制弹窗默认带出当前选中行基准料号 - rqrq
  1348. basePartNo: (selectedBasePartNo || '').trim().toUpperCase(),
  1349. partSuffix: ''
  1350. }
  1351. this.copyDialogVisible = true
  1352. this.$nextTick(() => {
  1353. if (this.$refs.copyForm) {
  1354. this.$refs.copyForm.clearValidate()
  1355. }
  1356. })
  1357. },
  1358. confirmCopyPart () {
  1359. this.$refs.copyForm.validate((valid) => {
  1360. if (!valid) return
  1361. const basePartNo = (this.copyForm.basePartNo || '').trim().toUpperCase()
  1362. const partSuffix = (this.copyForm.partSuffix || '').trim().toUpperCase()
  1363. // 后缀内的 '-' 属于编码内容,只校验拼接后的完整编码长度 - rqrq。
  1364. if (this.generatePartNo(basePartNo, partSuffix).length > 30) {
  1365. this.$message.warning('产品编码不能超过30个字符')
  1366. return
  1367. }
  1368. copyPartByBase({
  1369. site: this.$store.state.user.site,
  1370. basePartNo,
  1371. partSuffix
  1372. }).then(({ data }) => {
  1373. if (data && data.code === 0) {
  1374. this.$message.success(`复制成功,新产品编码:${data.partNo || this.generatePartNo(basePartNo, partSuffix)}`)
  1375. this.copyDialogVisible = false
  1376. this.getMainData()
  1377. return
  1378. }
  1379. this.$message.error((data && data.msg) || '复制失败')
  1380. }).catch(error => {
  1381. this.$message.error('复制失败: ' + error.message)
  1382. })
  1383. })
  1384. },
  1385. // 打开“指定SKU”弹窗:默认带入当前选中行的基准料号与SKU
  1386. openSpecifySkuDialog () {
  1387. const row = this.currentRow
  1388. if (!row || !row.partNo) {
  1389. this.$message.warning('请先选择一条物料')
  1390. return
  1391. }
  1392. let basePartNo = (row.basePartNo || '').trim().toUpperCase()
  1393. if (!basePartNo) {
  1394. basePartNo = this.extractBasePartNo(row.partNo)
  1395. }
  1396. if (!basePartNo) {
  1397. this.$message.warning('未找到基准料号,无法指定SKU')
  1398. return
  1399. }
  1400. this.specifySkuForm = {
  1401. site: this.$store.state.user.site,
  1402. basePartNo: basePartNo,
  1403. sku: (row.sku || '').trim().toUpperCase()
  1404. }
  1405. this.specifySkuDialogVisible = true
  1406. },
  1407. // 指定SKU弹窗中的SKU选择器(Chooselist 508)
  1408. openSpecifySkuPicker () {
  1409. this.tagNo = 508
  1410. this.basePickScene = 'specifySku'
  1411. this.$nextTick(() => {
  1412. this.$refs.baseList.init(508, this.specifySkuForm.sku || '')
  1413. })
  1414. },
  1415. // 确认指定:按基准料号统一修改SKU
  1416. confirmSpecifySku () {
  1417. const sku = (this.specifySkuForm.sku || '').trim().toUpperCase()
  1418. if (!sku) {
  1419. this.$message.warning('请选择或输入SKU')
  1420. return
  1421. }
  1422. this.$confirm(`确认将基准料号 ${this.specifySkuForm.basePartNo} 下所有物料的SKU统一修改为 ${sku}?`, '提示', {
  1423. confirmButtonText: '确定',
  1424. cancelButtonText: '取消',
  1425. type: 'warning'
  1426. }).then(() => {
  1427. // 与新增弹窗同一套 SKU 与基准料号一一对应校验,冲突时不执行指定
  1428. this.doSkuBasePartNoCheck(this.specifySkuForm.site, sku, this.specifySkuForm.basePartNo, true).then(pass => {
  1429. if (!pass) return
  1430. this.execUpdateSkuByBasePartNo(sku)
  1431. })
  1432. }).catch(() => {})
  1433. },
  1434. // 执行按基准料号统一修改SKU并刷新列表
  1435. execUpdateSkuByBasePartNo (sku) {
  1436. this.specifySkuSaving = true
  1437. updateSkuByBasePartNo({
  1438. site: this.specifySkuForm.site,
  1439. basePartNo: this.specifySkuForm.basePartNo,
  1440. sku
  1441. }).then(({ data }) => {
  1442. this.specifySkuSaving = false
  1443. if (data && data.code === 0) {
  1444. const updatedCount = data.updatedCount || 0
  1445. this.$message.success(updatedCount > 0 ? `指定成功,共更新 ${updatedCount} 条物料` : '该基准料号下物料SKU已是最新,已同步SKU对照表')
  1446. this.specifySkuDialogVisible = false
  1447. this.getMainData()
  1448. } else {
  1449. this.$message.error((data && data.msg) || '指定SKU失败')
  1450. }
  1451. }).catch(error => {
  1452. this.specifySkuSaving = false
  1453. this.$message.error('指定SKU失败: ' + error.message)
  1454. })
  1455. },
  1456. // 查看当前物料价格表:按默认供应商 + 物料编码查当前生效阶梯价(同 poOrder.vue) - rqrq
  1457. openCurrentRowPriceDialog (row) {
  1458. if (!row || !row.partNo) {
  1459. this.$message.warning('请先选择一行数据')
  1460. return
  1461. }
  1462. const site = String(row.site || this.$store.state.user.site || '').trim()
  1463. const supplierCode = String(row.defaultSupplierNo || row.supplierNo || '').trim()
  1464. const partNo = String(row.partNo || '').trim()
  1465. if (!site || !supplierCode || !partNo) {
  1466. this.$message.warning('当前行缺少供应商或物料编码,无法查询价格')
  1467. return
  1468. }
  1469. this.loadSupplierPartPriceDialog({ site, supplierCode, partNo })
  1470. },
  1471. // 共用的阶梯价加载:拉取当前生效阶梯价并渲染到价格弹窗
  1472. loadSupplierPartPriceDialog ({ site, supplierCode, partNo }) {
  1473. this.priceDialogPartNo = partNo
  1474. this.priceDialogSupplierNo = supplierCode
  1475. this.priceDialogRows = []
  1476. this.priceDialogVisible = true
  1477. this.priceDialogLoading = true
  1478. listPoCurrentTierPrice({
  1479. site,
  1480. supplierCode,
  1481. partNo
  1482. }).then(({ data }) => {
  1483. if (data && data.code === 0) {
  1484. this.priceDialogRows = (data.rows || []).map(item => ({
  1485. qtyStart: (item.qtyStart === null || item.qtyStart === undefined) ? '' : item.qtyStart,
  1486. qtyEnd: (item.qtyEnd === null || item.qtyEnd === undefined) ? '' : item.qtyEnd,
  1487. unitPrice: (item.unitPrice === null || item.unitPrice === undefined) ? '' : item.unitPrice,
  1488. priceDate: item.priceDate || '',
  1489. remark: item.remark || ''
  1490. }))
  1491. return
  1492. }
  1493. this.priceDialogRows = []
  1494. this.$message.error((data && data.msg) || '获取供应商价格表失败')
  1495. }).catch(() => {
  1496. this.priceDialogRows = []
  1497. this.$message.error('获取供应商价格表失败')
  1498. }).finally(() => {
  1499. this.priceDialogLoading = false
  1500. })
  1501. },
  1502. resetSupplierPartPriceDialog () {
  1503. this.priceDialogLoading = false
  1504. this.priceDialogRows = []
  1505. this.priceDialogPartNo = ''
  1506. this.priceDialogSupplierNo = ''
  1507. },
  1508. // 价格表弹窗内「维护价格表」:打开与 supplierPartMoqPrice「变更」一致的阶梯价格变更弹窗
  1509. openTierChangeFromPriceDialog () {
  1510. if (!this.priceDialogSupplierNo || !this.priceDialogPartNo) {
  1511. this.$message.warning('缺少供应商或物料编码,无法维护价格表')
  1512. return
  1513. }
  1514. this.$refs.tierChangeDialog.open({
  1515. site: this.$store.state.user.site,
  1516. supplierCode: this.priceDialogSupplierNo,
  1517. partNo: this.priceDialogPartNo
  1518. })
  1519. },
  1520. // 阶梯价格变更保存成功后刷新价格表弹窗的当前生效阶梯价
  1521. handleTierChangeSaved ({ site, supplierCode, partNo }) {
  1522. if (this.priceDialogVisible) {
  1523. this.loadSupplierPartPriceDialog({ site, supplierCode, partNo })
  1524. }
  1525. },
  1526. openChangeDefaultSupplier (row) {
  1527. if (!row || !row.partNo) {
  1528. this.$message.warning('请先选择物料')
  1529. return
  1530. }
  1531. this.changeSupplierForm = {
  1532. changeMode: 'PART_NO',
  1533. partNo: (row.partNo || '').trim().toUpperCase(),
  1534. basePartNo: (row.basePartNo || '').trim().toUpperCase(),
  1535. currentSupplierNo: (row.defaultSupplierNo || '').trim().toUpperCase(),
  1536. currentSupplierName: row.defaultSupplierName || '',
  1537. targetSupplierNo: '',
  1538. targetSupplierName: ''
  1539. }
  1540. this.changeSupplierDialogVisible = true
  1541. },
  1542. confirmChangeDefaultSupplier () {
  1543. const targetSupplierNo = (this.changeSupplierForm.targetSupplierNo || '').trim().toUpperCase()
  1544. const currentSupplierNo = (this.changeSupplierForm.currentSupplierNo || '').trim().toUpperCase()
  1545. if (!targetSupplierNo) {
  1546. this.$message.warning('目标供应商不能为空')
  1547. return
  1548. }
  1549. if (targetSupplierNo === currentSupplierNo) {
  1550. this.$message.warning('目标供应商不能与当前供应商相同')
  1551. return
  1552. }
  1553. const payload = {
  1554. site: this.$store.state.user.site,
  1555. partNo: this.changeSupplierForm.partNo,
  1556. changeMode: this.changeSupplierForm.changeMode,
  1557. targetSupplierNo
  1558. }
  1559. this.changeSupplierLoading = true
  1560. changePartDefaultSupplier(payload).then(({ data }) => {
  1561. if (data && data.code === 0) {
  1562. const updatedCount = data.updatedCount || 0
  1563. this.$message.success(`变更成功,影响 ${updatedCount} 条物料`)
  1564. this.changeSupplierDialogVisible = false
  1565. this.getMainData()
  1566. return
  1567. }
  1568. this.$message.error((data && data.msg) || '变更失败')
  1569. }).catch(error => {
  1570. this.$message.error('变更失败: ' + error.message)
  1571. }).finally(() => {
  1572. this.changeSupplierLoading = false
  1573. })
  1574. },
  1575. startFormalApprove (row) {
  1576. if (!row || !row.partNo) {
  1577. this.$message.warning('未找到有效产品编码')
  1578. return
  1579. }
  1580. // 新增物料阶段手动发起转正审批 - rqrq
  1581. this.$confirm('确认发起该物料的转正流程吗?', '提示', {
  1582. confirmButtonText: '确定',
  1583. cancelButtonText: '取消',
  1584. type: 'warning'
  1585. }).then(() => {
  1586. let inData = {
  1587. site: this.$store.state.user.site,
  1588. partNo: row.partNo
  1589. }
  1590. startPartFormalApprove(inData).then(({ data }) => {
  1591. if (data && data.code === 0) {
  1592. this.$message.success(data.msg || '操作成功')
  1593. this.getMainData()
  1594. return
  1595. }
  1596. this.$message.error((data && data.msg) || '发起转正失败')
  1597. }).catch(error => {
  1598. this.$message.error('发起转正失败: ' + error.message)
  1599. })
  1600. }).catch(() => {})
  1601. },
  1602. fetchPartFamilyOptions (familyType, parentPartFamily) {
  1603. return listPartFamilyByType({
  1604. site: this.$store.state.user.site,
  1605. familyType,
  1606. parentPartFamily: parentPartFamily || '',
  1607. active: 'Y'
  1608. }).then(({ data }) => {
  1609. if (data && data.code === 0) {
  1610. return data.list || []
  1611. }
  1612. return []
  1613. }).catch(() => [])
  1614. },
  1615. loadSearchCategoryLevel1 () {
  1616. this.fetchPartFamilyOptions('level1').then(list => {
  1617. this.searchCategoryLevel1Options = list
  1618. })
  1619. },
  1620. onSearchCategoryChange () {
  1621. this.searchData.categoryLevel2 = ''
  1622. this.searchData.categoryLevel3 = ''
  1623. this.searchCategoryLevel2Options = []
  1624. this.searchCategoryLevel3Options = []
  1625. if (!this.searchData.category) return
  1626. this.fetchPartFamilyOptions('level2', this.searchData.category).then(list => {
  1627. this.searchCategoryLevel2Options = list
  1628. })
  1629. },
  1630. onSearchCategoryLevel2Change () {
  1631. this.searchData.categoryLevel3 = ''
  1632. this.searchCategoryLevel3Options = []
  1633. if (!this.searchData.categoryLevel2) return
  1634. this.fetchPartFamilyOptions('level3', this.searchData.categoryLevel2).then(list => {
  1635. this.searchCategoryLevel3Options = list
  1636. })
  1637. },
  1638. loadPartCategoryLevel1 () {
  1639. return this.fetchPartFamilyOptions('level1').then(list => {
  1640. this.categoryLevel1Options = list
  1641. })
  1642. },
  1643. loadPartCategoryLevel2 (keepValues) {
  1644. if (!this.currentpart.category) {
  1645. this.categoryLevel2Options = []
  1646. if (!keepValues) {
  1647. this.currentpart.categoryLevel2 = ''
  1648. this.currentpart.categoryLevel3 = ''
  1649. this.categoryLevel3Options = []
  1650. }
  1651. return Promise.resolve()
  1652. }
  1653. return this.fetchPartFamilyOptions('level2', this.currentpart.category).then(list => {
  1654. this.categoryLevel2Options = list
  1655. if (!keepValues) {
  1656. this.currentpart.categoryLevel2 = ''
  1657. this.currentpart.categoryLevel3 = ''
  1658. this.categoryLevel3Options = []
  1659. }
  1660. })
  1661. },
  1662. loadPartCategoryLevel3 (keepValues) {
  1663. if (!this.currentpart.categoryLevel2) {
  1664. this.categoryLevel3Options = []
  1665. if (!keepValues) {
  1666. this.currentpart.categoryLevel3 = ''
  1667. }
  1668. return Promise.resolve()
  1669. }
  1670. return this.fetchPartFamilyOptions('level3', this.currentpart.categoryLevel2).then(list => {
  1671. this.categoryLevel3Options = list
  1672. if (!keepValues) {
  1673. this.currentpart.categoryLevel3 = ''
  1674. }
  1675. })
  1676. },
  1677. onPartCategoryChange () {
  1678. this.loadPartCategoryLevel2(false)
  1679. },
  1680. onPartCategoryLevel2Change () {
  1681. this.loadPartCategoryLevel3(false)
  1682. },
  1683. initPartCategoryOptions (keepValues) {
  1684. return this.loadPartCategoryLevel1().then(() => {
  1685. return this.loadPartCategoryLevel2(keepValues).then(() => {
  1686. return this.loadPartCategoryLevel3(keepValues)
  1687. })
  1688. })
  1689. },
  1690. // 加载属性模板下拉选项:复用 Chooselist 527 的配置数据源,按当前站点过滤取全量 code_no
  1691. loadCodeNoOptions () {
  1692. const currentSite = (this.$store.state.user.site || '').trim()
  1693. getChooselistEam({ tagNo: 527 }).then(({ data }) => {
  1694. const config = data && data.data
  1695. if (!config || !config.sqlcode) {
  1696. this.codeNoOptions = []
  1697. return
  1698. }
  1699. let sql = config.sqlcode
  1700. if (currentSite) {
  1701. sql += " and site = '" + currentSite + "' "
  1702. }
  1703. getChooselistDataEam({ sqlcode: sql }).then(({ data: res }) => {
  1704. if (res.code === 0) {
  1705. const rows = res.baseListData || []
  1706. const codes = rows.map(r => r.code_no).filter(v => v !== null && v !== undefined && v !== '')
  1707. this.codeNoOptions = Array.from(new Set(codes))
  1708. } else {
  1709. this.codeNoOptions = []
  1710. }
  1711. })
  1712. })
  1713. },
  1714. getBaseList (val, type, scene) {
  1715. this.tagNo = val
  1716. this.basePickScene = scene || ''
  1717. this.$nextTick(() => {
  1718. let strVal = ''
  1719. let conSql = ''
  1720. if (this.tagNo === 510) {
  1721. strVal = this.currentpart.unit
  1722. }
  1723. if (val === 508) {
  1724. strVal = this.currentpart.sku
  1725. }
  1726. if (val === 529) {
  1727. strVal = this.currentpart.buyerName
  1728. }
  1729. if (val === 528) {
  1730. strVal = this.currentpart.sourcingName
  1731. }
  1732. if (val === 527) {
  1733. strVal = this.currentpart.codeNo
  1734. }
  1735. if (val === 520) {
  1736. strVal = this.currentpart.defaultSupplierNo
  1737. }
  1738. if (val === 520 && this.basePickScene === 'changeSupplier') {
  1739. strVal = this.changeSupplierForm.targetSupplierNo
  1740. }
  1741. // 查询条件场景:按站点过滤(与验货申请页一致);520 只按编码/全称匹配,而查询框里可能是回填的
  1742. // 简称,预填会把列表筛空,因此不预填,需要时可在弹窗内的条件框手动筛 - rqrq
  1743. if (val === 520 && this.basePickScene === 'searchSupplier') {
  1744. strVal = ''
  1745. conSql = " and site = '" + this.$store.state.user.site + "'"
  1746. }
  1747. this.$refs.baseList.init(val, strVal?strVal:'', conSql)
  1748. })
  1749. },
  1750. /* 列表方法的回调 */
  1751. getBaseData (val) {
  1752. if (this.tagNo === 510) {
  1753. this.currentpart.unit = val.UMID
  1754. }
  1755. if (this.tagNo === 508) {
  1756. if (this.basePickScene === 'specifySku') {
  1757. this.specifySkuForm.sku = val.sku || val.SKU || ''
  1758. // 选择SKU后直接执行指定并刷新页面
  1759. this.confirmSpecifySku()
  1760. } else {
  1761. this.currentpart.sku = val.sku
  1762. // 选择器回填为程序赋值,不会触发输入框 change/blur,此处主动重算 SKU 校验,避免旧的「必须填写 SKU」报错残留
  1763. if (this.showSkuInDialog && this.isAdd && this.$refs.partForm) {
  1764. this.$refs.partForm.validateField('sku')
  1765. }
  1766. }
  1767. }
  1768. if (this.tagNo === 529) {
  1769. this.currentpart.buyerName = val.UserName
  1770. }
  1771. if (this.tagNo === 528) {
  1772. this.currentpart.sourcingName = val.UserName
  1773. }
  1774. if (this.tagNo === 527) {
  1775. this.currentpart.codeNo = val.code_no
  1776. }
  1777. if (this.tagNo === 520) {
  1778. if (this.basePickScene === 'searchSupplier') {
  1779. // 查询条件按业务约定展示供应商简称:520 只返回编码与全称,需回查主数据取 c_short_npc;
  1780. // 先回填编码保证无简称时仍有可用筛选值,也不写 currentpart,避免把查询值带进新增/编辑表单 - rqrq
  1781. const supplierNo = (val.supplier_no || val.supplierNo || '').trim().toUpperCase()
  1782. this.searchData.defaultSupplierNo = supplierNo
  1783. if (supplierNo) {
  1784. fetchSupplierDetail(supplierNo, this.$store.state.user.site).then(detail => {
  1785. const { shortNpc } = resolveSupplierShortFieldsFromDetail(detail)
  1786. // 仅当期间用户没改动查询框时才把编码换成简称,避免异步回包覆盖手动输入
  1787. if (shortNpc && this.searchData.defaultSupplierNo === supplierNo) {
  1788. this.searchData.defaultSupplierNo = shortNpc
  1789. }
  1790. })
  1791. }
  1792. } else {
  1793. this.currentpart.defaultSupplierNo = val.supplier_no || ''
  1794. }
  1795. }
  1796. if (this.tagNo === 520 && this.basePickScene === 'changeSupplier') {
  1797. const supplierNo = val.supplier_no || ''
  1798. const supplierName = val.supplier_name || ''
  1799. this.changeSupplierForm.targetSupplierNo = (supplierNo || '').trim().toUpperCase()
  1800. this.changeSupplierForm.targetSupplierName = supplierName || ''
  1801. }
  1802. this.basePickScene = ''
  1803. },
  1804. getMainData () {
  1805. this.searchData.limit = this.pageSize
  1806. this.searchData.page = this.pageIndex
  1807. searchPartList(this.searchData).then(({data}) => {
  1808. if (data.code === 0) {
  1809. // 处理列表数据,确保可以正确显示嵌套属性
  1810. this.mainDataList = data.page.list.map(item => {
  1811. // 方式1:将嵌套属性提取到顶层
  1812. if (item.flowNodeInstanceData) {
  1813. item.departmentName = item.flowNodeInstanceData.departmentName;
  1814. item.assigneeName = item.flowNodeInstanceData.assigneeName;
  1815. } else {
  1816. item.departmentName = '';
  1817. item.assigneeName = '';
  1818. }
  1819. return item;
  1820. });
  1821. // this.mainDataList = data.page.list
  1822. this.pageIndex = data.page.currPage
  1823. this.pageSize = data.page.pageSize
  1824. this.totalPage = data.page.totalCount
  1825. // 判断是否全部存在数据
  1826. if (this.mainDataList.length > 0) {
  1827. // 设置选中行
  1828. this.$refs.mainTable.setCurrentRow(this.mainDataList[0])
  1829. this.changeData(this.mainDataList[0])
  1830. } else {
  1831. this.changeData(null)
  1832. }
  1833. }
  1834. this.dataListLoading = false
  1835. })
  1836. },
  1837. tabClick (tab, event) {
  1838. this.refreshCurrentTabTable()
  1839. },
  1840. // 每页数
  1841. sizeChangeHandle (val) {
  1842. this.pageSize = val
  1843. this.pageIndex = 1
  1844. this.getMainData()
  1845. },
  1846. // 当前页
  1847. currentChangeHandle (val) {
  1848. this.pageIndex = val
  1849. this.getMainData()
  1850. },
  1851. changeData (row) {
  1852. this.currentRow = JSON.parse(JSON.stringify(row))
  1853. this.refreshCurrentTabTable()
  1854. },
  1855. refreshCurrentTabTable () {
  1856. if (this.currentRow === '' || this.currentRow === null) {
  1857. this.currentRow = {site: '', partNo: ''}
  1858. }
  1859. if (this.activeName === 'basicInfo') {
  1860. this.refreshBasicInfo()
  1861. }
  1862. if (this.activeName === 'specParams') {
  1863. this.refreshSpecParams()
  1864. }
  1865. if (this.activeName === 'suppliers') {
  1866. this.refreshSuppliers()
  1867. }
  1868. if (this.activeName === 'approval') {
  1869. this.refreshApproval()
  1870. }
  1871. if (this.activeName === 'attachments') {
  1872. this.refreshAttachments()
  1873. }
  1874. },
  1875. /**
  1876. * 主表导出。
  1877. * 业务意图:与供应商列表导出风格保持一致。
  1878. * 规则:
  1879. * 1) 复用当前查询条件与主表列配置;
  1880. * 2) 分页改为 page=1、limit=-1,一次导出全部命中数据;
  1881. * 3) 产品阶段列按描述文案导出,避免只导出编码。
  1882. */
  1883. async exportExcel () {
  1884. // 导出单独组参,避免把列表当前 pageSize 改成 -1。site 以前端查询条件为准。 - rqrq
  1885. const params = Object.assign({}, this.searchData, {
  1886. page: 1,
  1887. limit: -1,
  1888. site: this.searchData.site || this.$store.state.user.site
  1889. })
  1890. excel.exportTable({
  1891. url: '/part/searchPartList',
  1892. columnMapping: this.columnArray1, // 可以直接用table,不需要的列就剔除
  1893. mergeSetting: [], // 需要合并的列
  1894. params: params,
  1895. fileName: this.exportName + '.xlsx',
  1896. rowFetcher: res => res.data,
  1897. columnFormatter: [
  1898. { columnProp: 'partStage', formatter: (val) => this.formatPartStageDesc(val) }
  1899. ],
  1900. dropColumns: []// 需要剔除的列
  1901. })
  1902. },
  1903. refreshBasicInfo () {
  1904. let inData = {
  1905. site: this.currentRow.site,
  1906. partNo: this.currentRow.partNo,
  1907. partDesc: this.currentRow.partDesc,
  1908. height: this.getBasicTabHeight()
  1909. }
  1910. this.$refs.basicInfo.init(inData)
  1911. },
  1912. refreshSpecParams () {
  1913. let inData = {
  1914. site: this.currentRow.site,
  1915. partNo: this.currentRow.partNo,
  1916. codeNo: this.currentRow.codeNo,
  1917. functionType:"P",
  1918. height: this.getDetailTabHeight(70)
  1919. }
  1920. this.$refs.specParams.init(inData)
  1921. },
  1922. refreshSuppliers () {
  1923. let inData = {
  1924. site: this.currentRow.site,
  1925. partNo: this.currentRow.partNo,
  1926. height: this.getDetailTabHeight(90)
  1927. }
  1928. this.$refs.suppliers.init(inData)
  1929. },
  1930. refreshApproval () {
  1931. let inData = {
  1932. site: this.currentRow.site,
  1933. orderRef1: this.currentRow.partNo,
  1934. orderType: '产品资料',
  1935. height: this.getDetailTabHeight(30)
  1936. }
  1937. this.$refs.approval.init(inData)
  1938. },
  1939. refreshAttachments () {
  1940. let inData = {
  1941. orderRef1: this.currentRow.site,
  1942. orderRef2: this.currentRow.partNo,
  1943. orderRef3: this.currentRow.partDesc,
  1944. orderReftype: 'part',
  1945. height: this.getDetailTabHeight(90)
  1946. }
  1947. this.$refs.attachments.init(inData)
  1948. },
  1949. // 新增产品
  1950. addPart() {
  1951. this.isAdd = true
  1952. this.skuOptions = []
  1953. this.currentpart = {
  1954. partNo: '',
  1955. basePartNo: '',
  1956. partSuffix: '',
  1957. npc: '',
  1958. partDesc: '',
  1959. partSpec: 'N/A',
  1960. sku: '',
  1961. item: '',
  1962. defaultSupplierNo: '',
  1963. buyerName: '',
  1964. sourcingName: '',
  1965. category: '',
  1966. categoryLevel2: '',
  1967. categoryLevel3: '',
  1968. unit: '',
  1969. status: 'Y',
  1970. codeNo: '',
  1971. createBy: this.$store.state.user.name,
  1972. remark: '',
  1973. site: this.$store.state.user.site,
  1974. }
  1975. this.categoryLevel2Options = []
  1976. this.categoryLevel3Options = []
  1977. this.loadPartCategoryLevel1()
  1978. this.partDialogVisible = true
  1979. },
  1980. // 编辑产品
  1981. editPart(row) {
  1982. if (!row) {
  1983. this.$message.warning('请选择一个产品修改')
  1984. return
  1985. }
  1986. this.isAdd = false
  1987. this.skuOptions = []
  1988. this.currentpart = {...row}
  1989. // 编辑时按已存基准料号回显完整后缀,基准料号空值保持为空 - rqrq。
  1990. this.currentpart.partSuffix = this.extractPartSuffix(this.currentpart.partNo, this.currentpart.basePartNo)
  1991. this.initPartCategoryOptions(true).then(() => {
  1992. this.partDialogVisible = true
  1993. })
  1994. },
  1995. // 新增后自动刷新属性模板 - rqrq
  1996. autoRefreshPartPropertiesAfterCreate () {
  1997. const site = (this.$store.state.user.site || '').trim().toUpperCase()
  1998. const partNo = (this.currentpart.partNo || '').trim().toUpperCase()
  1999. const codeNo = (this.currentpart.codeNo || '').trim().toUpperCase()
  2000. if (!site || !partNo || !codeNo) {
  2001. return Promise.resolve(false)
  2002. }
  2003. // 新增料号成功后自动刷新属性模板,提前生成属性 - rqrq
  2004. return refreshPartPropertiesModal({
  2005. site,
  2006. partNo,
  2007. codeNo,
  2008. recordType: 'P'
  2009. }).then(({ data }) => {
  2010. if (data && data.code === 0) {
  2011. return true
  2012. }
  2013. this.$message.warning((data && data.msg) || '刷新属性模板失败')
  2014. return false
  2015. }).catch(error => {
  2016. this.$message.warning('刷新属性模板失败: ' + (error.message || error))
  2017. return false
  2018. })
  2019. },
  2020. // 保存产品
  2021. savePart() {
  2022. if (this.isAdd) {
  2023. const basePartNo = (this.currentpart.basePartNo || '').trim().toUpperCase()
  2024. const partSuffix = (this.currentpart.partSuffix || '').trim().toUpperCase()
  2025. // 基准料号必填,后缀允许留空;与高级复制的编码规则一致 - rqrq
  2026. if (!basePartNo) {
  2027. this.$message.warning('请填写基准料号')
  2028. return
  2029. }
  2030. // 与普通复制、高级复制一致,允许多段后缀并限制完整产品编码为30位 - rqrq。
  2031. if (this.generatePartNo(basePartNo, partSuffix).length > 30) {
  2032. this.$message.warning('产品编码不能超过30个字符')
  2033. return
  2034. }
  2035. if (!(this.currentpart.defaultSupplierNo || '').trim()) {
  2036. this.$message.warning('请填写默认供应商')
  2037. return
  2038. }
  2039. this.currentpart.defaultSupplierNo = (this.currentpart.defaultSupplierNo || '').trim().toUpperCase()
  2040. this.currentpart.basePartNo = basePartNo
  2041. this.currentpart.partSuffix = partSuffix
  2042. this.currentpart.partNo = this.generatePartNo(basePartNo, partSuffix)
  2043. }
  2044. this.$refs.partForm.validate((valid) => {
  2045. if (!valid) {
  2046. this.$message.warning('请填写必填字段')
  2047. return
  2048. }
  2049. // 新增时先校验 SKU 与基准料号的一一对应关系,通过后进入原有价格表校验及保存
  2050. this.ensureSkuBasePartNoConsistent().then(pass => {
  2051. if (pass) {
  2052. this.checkPriceAndSave()
  2053. }
  2054. })
  2055. })
  2056. },
  2057. /**
  2058. * 新增时校验 SKU 与基准料号互为一一对应(仅新增弹窗、两者均有值时触发):
  2059. * part_sku 无该 SKU → 放行,保存物料时自动新建;
  2060. * SKU 存在但基准料号为空 → 后端自动回填本次基准料号后放行;
  2061. * SKU 已对应其他基准料号 → 仍然拦截,提示去 SKU 管理页人工维护;
  2062. * 基准料号已对应其他 SKU → 询问是否统一修改该基准料号下的产品SKU(同“指定SKU”功能)。
  2063. */
  2064. ensureSkuBasePartNoConsistent () {
  2065. const basePartNo = (this.currentpart.basePartNo || '').trim().toUpperCase()
  2066. const sku = (this.currentpart.sku || '').trim().toUpperCase()
  2067. // 编辑态不校验;SKU 或基准料号有一方未填时交给原有逻辑处理(保存时不写 part_sku 对应关系)
  2068. if (!this.isAdd || !basePartNo || !sku) {
  2069. return Promise.resolve(true)
  2070. }
  2071. return this.doSkuBasePartNoCheck(this.$store.state.user.site, sku, basePartNo, false)
  2072. },
  2073. /**
  2074. * 调用 part_sku 一致性校验接口:无记录放行、空基准料号后端自动回填、冲突按场景处理。
  2075. * 新增弹窗与“指定SKU”弹窗共用;skipNavigation=true 时冲突不跳转,留在当前弹窗。
  2076. * 统一返回 Promise<boolean>:true 可继续保存/指定,false 中止。
  2077. */
  2078. doSkuBasePartNoCheck (site, sku, basePartNo, skipNavigation) {
  2079. return checkSkuBasePartNo({
  2080. site,
  2081. sku,
  2082. basePartNo
  2083. }).then(({ data }) => {
  2084. if (data && data.code === 0) {
  2085. if (data.conflict) {
  2086. // 冲突可能转为“统一修改该基准料号下的SKU”,按其结果决定是否继续
  2087. return this.promptSkuBasePartNoConflict(data, sku, skipNavigation, basePartNo)
  2088. }
  2089. return true
  2090. }
  2091. // 接口返回异常时中止保存/指定,避免写入不一致的对应关系
  2092. this.$message.error((data && data.msg) || 'SKU与基准料号一致性校验失败')
  2093. return false
  2094. }).catch(() => {
  2095. this.$message.error('SKU与基准料号一致性校验失败,请稍后重试')
  2096. return false
  2097. })
  2098. },
  2099. // 冲突处理:基准料号已对应其他SKU时走“统一修改该基准料号下的SKU”;方向A(SKU 已被其他基准料号占用)已放开,不再拦截
  2100. promptSkuBasePartNoConflict (data, sku, skipNavigation, basePartNo) {
  2101. // 基准料号已对应其他SKU:本次目标就是把它们统一成新SKU,不存在占用风险,直接按统一修改处理
  2102. if (data.conflictType === 'BASE_PART_NO') {
  2103. // “指定SKU”弹窗已二次确认过,直接放行到统一修改;新增弹窗需先询问用户
  2104. if (skipNavigation) {
  2105. return Promise.resolve(true)
  2106. }
  2107. return this.$confirm(
  2108. `当前基准料号的SKU为:${data.conflictSku},是否统一修改该基准料号下的产品SKU:${sku}?`,
  2109. 'SKU与基准料号不一致',
  2110. {
  2111. confirmButtonText: '是',
  2112. cancelButtonText: '否',
  2113. type: 'warning'
  2114. }
  2115. ).then(() => {
  2116. return this.unifySkuByBasePartNo(sku, basePartNo)
  2117. }).catch(() => {
  2118. this.$message.info('已取消统一修改,本次新增未保存,请调整SKU后再保存。')
  2119. return false
  2120. })
  2121. }
  2122. // 方向A 已放开:后端不再产生 conflictType='SKU',其余情况直接放行继续保存/指定 - rqrq
  2123. return Promise.resolve(true)
  2124. },
  2125. // 按基准料号统一修改SKU(后端按 part 表把该基准料号下所有物料 sku 统一),成功返回 true 继续保存
  2126. unifySkuByBasePartNo (sku, basePartNo) {
  2127. return updateSkuByBasePartNo({
  2128. site: this.$store.state.user.site,
  2129. basePartNo,
  2130. sku
  2131. }).then(({ data }) => {
  2132. if (data && data.code === 0) {
  2133. this.$message.success(`已统一修改该基准料号下的SKU为 ${sku}`)
  2134. return true
  2135. }
  2136. this.$message.error((data && data.msg) || '统一修改SKU失败')
  2137. return false
  2138. }).catch(() => {
  2139. this.$message.error('统一修改SKU失败,请稍后重试')
  2140. return false
  2141. })
  2142. },
  2143. // 原有价格表校验:供应商编码、Item、SKU 三者都有值时校验价格表是否已存在该组合
  2144. checkPriceAndSave () {
  2145. const supplierCode = (this.currentpart.defaultSupplierNo || '').trim().toUpperCase()
  2146. const item = (this.currentpart.item || '').trim().toUpperCase()
  2147. const sku = (this.currentpart.sku || '').trim().toUpperCase()
  2148. // 供应商编码、Item、SKU 三者都有值时,校验价格表是否已存在该组合
  2149. if (supplierCode && item && sku) {
  2150. checkSupplierPartByItemSku({
  2151. site: this.$store.state.user.site,
  2152. supplierCode,
  2153. item,
  2154. sku
  2155. }).then(({ data }) => {
  2156. if (data && data.code === 0 && data.exists) {
  2157. // 价格表已存在该组合,正常保存
  2158. this.doSavePart(false)
  2159. } else {
  2160. // 组合不存在时再按 供应商+物料号 查价格表行:编辑改 Item 会查不到组合,
  2161. // 但行已存在(已在供/审核流程中),保存时后端会自动同步新 Item,不应重复弹新品流程确认
  2162. this.hasSupplierPartRow(supplierCode).then(exists => {
  2163. if (exists) {
  2164. this.doSavePart(false)
  2165. } else {
  2166. this.promptCreateSupplierPriceAndAudit()
  2167. }
  2168. })
  2169. }
  2170. }).catch(() => {
  2171. // 校验接口异常时不阻塞保存
  2172. this.doSavePart(false)
  2173. })
  2174. } else {
  2175. this.doSavePart(false)
  2176. }
  2177. },
  2178. /**
  2179. * 按 供应商+物料号 判断价格表(可供物料)行是否已存在。
  2180. * listSupplierPart 的 supplierCode 条件实际按简称模糊匹配,故仅按 partNo 查询后在前端精确匹配
  2181. */
  2182. hasSupplierPartRow (supplierCode) {
  2183. const partNo = (this.currentpart.partNo || '').trim().toUpperCase()
  2184. if (!partNo) {
  2185. return Promise.resolve(false)
  2186. }
  2187. return listSupplierPartMoq({
  2188. site: this.$store.state.user.site,
  2189. partNo
  2190. }).then(({ data }) => {
  2191. if (!(data && data.code === 0)) {
  2192. return false
  2193. }
  2194. return (data.rows || []).some(row =>
  2195. (row.partNo || '').trim().toUpperCase() === partNo &&
  2196. (row.supplierCode || '').trim().toUpperCase() === supplierCode
  2197. )
  2198. }).catch(() => false)
  2199. },
  2200. /**
  2201. * 未查询到价格表记录时,弹出三按钮确认弹窗:
  2202. * 发起并审核→保存后产生价格表并发起审核,随后跳出登记审核弹窗;
  2203. * 发起→仅产生价格表并发起审核(不默认审核);取消→仅保存,不产生价格表也不进入新品流程
  2204. */
  2205. promptCreateSupplierPriceAndAudit () {
  2206. this.newProductFlowDialogVisible = true
  2207. },
  2208. confirmNewProductFlow (withAudit) {
  2209. this.newProductFlowDialogVisible = false
  2210. this.doSavePart(true, withAudit)
  2211. },
  2212. cancelNewProductFlow () {
  2213. this.newProductFlowDialogVisible = false
  2214. // 取消:仅保存物料,不产生价格表也不进入新品流程
  2215. this.doSavePart(false)
  2216. },
  2217. /**
  2218. * 执行实际保存逻辑
  2219. * @param {boolean} needCreatePriceAndAudit 保存成功后是否产生价格表并发起新品审核
  2220. * @param {boolean} auditAfterStart 发起审核后是否跳出登记审核弹窗(发起并审核)
  2221. */
  2222. doSavePart (needCreatePriceAndAudit, auditAfterStart) {
  2223. const apiCall = this.isAdd ? createPart(this.currentpart) : updatePart(this.currentpart)
  2224. apiCall.then(({data}) => {
  2225. if (data && data.code === 0) {
  2226. const finishSave = (refreshOk) => {
  2227. const successMsg = this.isAdd
  2228. ? (refreshOk ? '新增产品成功,已刷新属性模板' : '新增产品成功')
  2229. : '修改产品成功'
  2230. this.$message.success(successMsg)
  2231. this.partDialogVisible = false
  2232. this.getMainData()
  2233. // 保存成功后,根据用户选择决定是否产生价格表并进入新品流程
  2234. if (needCreatePriceAndAudit) {
  2235. this.createSupplierPriceAndStartAudit(null, auditAfterStart)
  2236. }
  2237. }
  2238. // 新增后自动执行“刷新属性模板”按钮同等逻辑 - rqrq
  2239. if (this.isAdd) {
  2240. this.autoRefreshPartPropertiesAfterCreate().then((refreshOk) => {
  2241. finishSave(refreshOk)
  2242. })
  2243. return
  2244. }
  2245. finishSave(false)
  2246. } else {
  2247. this.$message.error(data.msg || '操作失败')
  2248. }
  2249. }).catch(error => {
  2250. this.$message.error('操作失败: ' + error.message)
  2251. })
  2252. },
  2253. /**
  2254. * 新增物料保存成功后:先产生供应商价格表(可供物料),再进入新品审核流程。
  2255. * 价格表已存在或创建失败时不阻断,继续尝试发起审核(审核接口会校验可供物料关系)。
  2256. * 注意:后端保存物料时已按 供应商+物料号 sync 过 SupplierforPart,这里先查重,已存在则跳过新增,
  2257. * 避免 addSupplierPart 撞重复校验报"供应商+物料已存在,请勿重复新增"
  2258. * 不传 payload 时默认取当前编辑弹窗的物料(普通新增/编辑保存链路),高级复制传目标物料信息复用同一逻辑
  2259. * @param {boolean} auditAfterStart 发起审核后是否跳出登记审核弹窗(发起并审核)
  2260. */
  2261. createSupplierPriceAndStartAudit (payload, auditAfterStart) {
  2262. const site = this.$store.state.user.site
  2263. const supplierCode = ((payload && payload.supplierCode) || this.currentpart.defaultSupplierNo || '').trim().toUpperCase()
  2264. const partNo = ((payload && payload.partNo) || this.currentpart.partNo || '').trim().toUpperCase()
  2265. if (!supplierCode || !partNo) {
  2266. return
  2267. }
  2268. // listSupplierPart 的 supplierCode 条件实际按简称模糊匹配,故仅按 partNo 查询后在前端精确匹配供应商编码
  2269. listSupplierPartMoq({
  2270. site,
  2271. partNo
  2272. }).then(({ data }) => {
  2273. if (data && data.code === 0) {
  2274. const rows = data.rows || []
  2275. const exists = rows.some(row =>
  2276. (row.partNo || '').trim().toUpperCase() === partNo &&
  2277. (row.supplierCode || '').trim().toUpperCase() === supplierCode
  2278. )
  2279. if (exists) {
  2280. this.$message.info('供应商价格表(可供物料)已存在,跳过新增')
  2281. return
  2282. }
  2283. return addSupplierPartMoq({
  2284. site,
  2285. supplierCode,
  2286. partNo
  2287. }).then(({ data: addRes }) => {
  2288. if (addRes && addRes.code === 0) {
  2289. this.$message.success('已产生供应商价格表(可供物料)')
  2290. } else {
  2291. this.$message.warning((addRes && addRes.msg) || '产生供应商价格表失败')
  2292. }
  2293. }).catch(error => {
  2294. this.$message.warning('产生供应商价格表失败: ' + (error.message || error))
  2295. })
  2296. }
  2297. }).catch(() => {
  2298. // 查重接口异常时不阻断,按原逻辑直接尝试新增
  2299. return addSupplierPartMoq({
  2300. site,
  2301. supplierCode,
  2302. partNo
  2303. }).then(({ data }) => {
  2304. if (data && data.code === 0) {
  2305. this.$message.success('已产生供应商价格表(可供物料)')
  2306. }
  2307. // 后端重复校验报"已存在"属正常情况(保存物料时已自动建立关系),不再弹出警告
  2308. }).catch(() => {})
  2309. }).then(() => {
  2310. // 无论价格表是否刚创建,都尝试发起新品审核
  2311. this.executeStartNewProductAudit(payload, auditAfterStart)
  2312. })
  2313. },
  2314. /**
  2315. * 调用开始审核接口,生成新品审核记录;同样支持 payload 传入,供高级复制链路复用
  2316. * auditAfterStart 为 true(发起并审核)时,开始审核成功后跳出登记审核弹窗
  2317. */
  2318. executeStartNewProductAudit (payload, auditAfterStart) {
  2319. const supplierCode = ((payload && payload.supplierCode) || this.currentpart.defaultSupplierNo || '').trim().toUpperCase()
  2320. const partNo = ((payload && payload.partNo) || this.currentpart.partNo || '').trim().toUpperCase()
  2321. if (!supplierCode || !partNo) {
  2322. return
  2323. }
  2324. startNewProductAudit({
  2325. site: this.$store.state.user.site,
  2326. supplierCode,
  2327. partNo
  2328. }).then(({ data }) => {
  2329. if (data && data.code === 0) {
  2330. this.$message.success('已创建新品审核记录')
  2331. if (auditAfterStart) {
  2332. this.openNewProductAuditDialog(supplierCode, partNo)
  2333. }
  2334. } else {
  2335. this.$message.warning((data && data.msg) || '开始审核失败')
  2336. }
  2337. }).catch(() => {
  2338. this.$message.warning('开始审核失败')
  2339. })
  2340. },
  2341. /**
  2342. * 发起并审核:查询该物料最新轮次待审核的采购部门记录,跳出登记审核弹窗选择同意/不同意
  2343. */
  2344. openNewProductAuditDialog (supplierCode, partNo) {
  2345. listNewProductAuditRecord({
  2346. site: this.$store.state.user.site,
  2347. supplierCode,
  2348. partNo
  2349. }).then(({ data }) => {
  2350. if (data && data.code === 0) {
  2351. // 取最大轮次待登记的采购记录
  2352. const record = (data.rows || []).reduce((max, row) => {
  2353. if ((row.deptType || '').toUpperCase() !== 'PURCHASE' || (row.status || '').toUpperCase() !== 'PENDING') {
  2354. return max
  2355. }
  2356. return (!max || (row.auditRoundNo || 0) > (max.auditRoundNo || 0)) ? row : max
  2357. }, null)
  2358. if (!record) {
  2359. this.$message.warning('未找到待登记的采购部门审核记录,请到新品审核页面处理')
  2360. return
  2361. }
  2362. this.auditForm = {
  2363. id: record.id,
  2364. site: record.site,
  2365. supplierCode: record.supplierCode,
  2366. partNo: record.partNo,
  2367. auditRoundNo: record.auditRoundNo,
  2368. deptType: 'PURCHASE',
  2369. auditResult: '',
  2370. needTestFlag: false,
  2371. auditOpinion: ''
  2372. }
  2373. this.auditDialogVisible = true
  2374. } else {
  2375. this.$message.warning((data && data.msg) || '查询审核记录失败')
  2376. }
  2377. }).catch(() => {
  2378. this.$message.warning('查询审核记录失败')
  2379. })
  2380. },
  2381. // 登记审核弹窗提交:结论必选,同意后整轮完成判定由后端 applyRoundOutcome 处理
  2382. submitPartNewProductAudit () {
  2383. if (!this.auditForm.id) {
  2384. this.$message.warning('审核记录无效')
  2385. return
  2386. }
  2387. if (!this.auditForm.auditResult) {
  2388. this.$message.warning('请选择审核结论')
  2389. return
  2390. }
  2391. this.auditSaveLoading = true
  2392. submitNewProductAuditRecord({
  2393. id: this.auditForm.id,
  2394. site: this.auditForm.site,
  2395. supplierCode: this.auditForm.supplierCode,
  2396. partNo: this.auditForm.partNo,
  2397. auditRoundNo: this.auditForm.auditRoundNo,
  2398. deptType: this.auditForm.deptType,
  2399. auditResult: this.auditForm.auditResult,
  2400. needTest: this.auditForm.needTestFlag ? 'Y' : 'N',
  2401. auditOpinion: (this.auditForm.auditOpinion || '').trim()
  2402. }).then(({ data }) => {
  2403. if (data && data.code === 0) {
  2404. this.$message.success('审核登记成功')
  2405. this.auditDialogVisible = false
  2406. this.getMainData()
  2407. } else {
  2408. this.$message.error((data && data.msg) || '审核登记失败')
  2409. }
  2410. }).catch(() => {
  2411. this.$message.error('审核登记失败')
  2412. }).finally(() => {
  2413. this.auditSaveLoading = false
  2414. })
  2415. },
  2416. // 审核意见文本域后表单项的跟随间距,与 supplierPartNewProductAudit 页面同口径
  2417. calcTextareaFollowGapStyle (rows) {
  2418. const rowCount = Number(rows) || 1
  2419. const followGap = rowCount > 1 ? (rowCount - 1) * 20 : 0
  2420. return { marginBottom: `${followGap}px` }
  2421. },
  2422. /**
  2423. * 高级复制成功后的回调:先刷新主表,再按弹窗内用户的新品流程选择执行——
  2424. * createPriceAndAudit 为 true(发起)/'audit'(发起并审核)时产生价格表并发起新品审核,'audit' 额外跳出登记审核弹窗,
  2425. * false 仅刷新;兼容旧 payload 结构:未携带该标志时回退为后端回填字段齐全即执行
  2426. */
  2427. handleAdvancedCopyResult (payload) {
  2428. this.getMainData()
  2429. if (!payload) {
  2430. return
  2431. }
  2432. const supplierCode = (payload.supplierNo || '').trim().toUpperCase()
  2433. const item = (payload.item || '').trim().toUpperCase()
  2434. const sku = (payload.sku || '').trim().toUpperCase()
  2435. const flowChoice = payload.createPriceAndAudit
  2436. const shouldCreate = flowChoice === true || flowChoice === 'audit' ||
  2437. (typeof flowChoice !== 'boolean' && flowChoice !== 'audit' && !!(supplierCode && item && sku))
  2438. if (!shouldCreate) {
  2439. return
  2440. }
  2441. this.createSupplierPriceAndStartAudit({
  2442. supplierCode,
  2443. partNo: (payload.partNo || '').trim().toUpperCase()
  2444. }, flowChoice === 'audit')
  2445. },
  2446. // 删除产品
  2447. deletePart(row) {
  2448. this.$confirm('你确定删除该产品?', '确认删除', {
  2449. confirmButtonText: '确认',
  2450. cancelButtonText: '取消',
  2451. type: 'warning'
  2452. }).then(() => {
  2453. deletePart({
  2454. id: row.id,
  2455. site: row.site,
  2456. partNo: row.partNo
  2457. }).then(({data}) => {
  2458. if (data && data.code === 0) {
  2459. this.$message.success('产品删除成功')
  2460. this.getMainData()
  2461. } else {
  2462. this.$message.error(data.msg || '删除失败')
  2463. }
  2464. }).catch(error => {
  2465. this.$message.error('删除失败: ' + error.message)
  2466. })
  2467. })
  2468. }
  2469. // 打开审批对话框
  2470. // openApproveDialog(row) {
  2471. // this.approveData = {
  2472. // applyNo: row.flowNodeInstanceData.applyNo,
  2473. // site: row.flowNodeInstanceData.site,
  2474. // orderType: row.flowNodeInstanceData.orderType,
  2475. // flowCode: row.flowNodeInstanceData.flowCode,
  2476. // flowVersion: row.flowNodeInstanceData.flowVersion,
  2477. // nodeCode: row.flowNodeInstanceData.nodeCode,
  2478. // comment: ''
  2479. // }
  2480. // this.approveDialogVisible = true
  2481. // },
  2482. // 提交审批
  2483. // submitApprove(action) {
  2484. // if (action === 'REJECTED' && !this.approveData.comment) {
  2485. // this.$message.warning('驳回时必须填写审批意见')
  2486. // return
  2487. // }
  2488. // this.approveLoading = true
  2489. // approveNodeInstance({
  2490. // applyNo: this.approveData.applyNo,
  2491. // nodeCode: this.approveData.nodeCode,
  2492. // site: this.approveData.site,
  2493. // orderType: this.approveData.orderType,
  2494. // specialRelease: this.approveData.specialRelease,
  2495. // action: action,
  2496. // comment: this.approveData.comment
  2497. // }).then(({ data }) => {
  2498. // if (data && data.code === 0) {
  2499. // this.$message.success(action === 'APPROVED' ? '审批通过成功' : '驳回成功')
  2500. // this.approveDialogVisible = false
  2501. // //刷新列表
  2502. // this.getMainData()
  2503. // } else {
  2504. // this.$message.error(data.msg || '操作失败')
  2505. // }
  2506. // }).finally(() => {
  2507. // this.approveLoading = false
  2508. // })
  2509. // },
  2510. // 重新审批 - rqrq
  2511. // handleRestart(row) {
  2512. // this.$confirm('确定要重新发起审批流程吗?', '提示', {
  2513. // confirmButtonText: '确定',
  2514. // cancelButtonText: '取消',
  2515. // type: 'warning'
  2516. // }).then(() => {
  2517. // restartFlowInstance({
  2518. // applyNo: row.applyNo,
  2519. // site: row.site,
  2520. // orderType: row.orderType
  2521. // }).then(({ data }) => {
  2522. // if (data && data.code === 0) {
  2523. // this.$message.success('重新审批成功')
  2524. // this.getMainData()
  2525. // } else {
  2526. // this.$message.error(data.msg || '操作失败')
  2527. // }
  2528. // })
  2529. // }).catch(() => {})
  2530. // }
  2531. }
  2532. }
  2533. </script>
  2534. <!--当前页面的标签样式-->
  2535. <style scoped lang="scss">
  2536. /deep/ .customer-tab .el-tabs__content {
  2537. padding: 5px !important;
  2538. }
  2539. /* 产品对话框整体样式 */
  2540. .part-dialog {
  2541. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  2542. }
  2543. .part-dialog .el-dialog {
  2544. margin-top: 5vh !important;
  2545. margin-bottom: 5vh !important;
  2546. }
  2547. .part-dialog .el-dialog__header {
  2548. padding: 20px 25px 15px 25px;
  2549. border-bottom: 1px solid #E4E7ED;
  2550. }
  2551. .part-dialog .el-dialog__body {
  2552. padding: 25px 25px 25px 25px;
  2553. max-height: 75vh;
  2554. overflow-y: auto;
  2555. min-height: 400px;
  2556. }
  2557. .dialog-content {
  2558. width: 100%;
  2559. }
  2560. /* 产品表单样式 */
  2561. .part-form {
  2562. width: 100%;
  2563. }
  2564. .part-form .el-form-item {
  2565. margin-bottom: 1px;
  2566. }
  2567. .part-form .el-form-item__label {
  2568. font-weight: 500;
  2569. color: #303133;
  2570. line-height: 32px;
  2571. padding-right: 12px;
  2572. }
  2573. .part-form .el-form-item__content {
  2574. line-height: normal;
  2575. }
  2576. /* 表单分组样式 */
  2577. .form-section {
  2578. margin-bottom: 5px;
  2579. }
  2580. .form-section:last-child {
  2581. margin-bottom: 5px;
  2582. }
  2583. /* 输入框样式 */
  2584. .part-form .el-input,
  2585. .part-form .el-textarea,
  2586. .part-form .el-date-editor {
  2587. width: 100%;
  2588. }
  2589. /* 文本域样式优化 */
  2590. .part-form .el-textarea__inner {
  2591. resize: none;
  2592. font-family: inherit;
  2593. line-height: 1.5;
  2594. }
  2595. /* 对话框底部按钮居中 */
  2596. .dialog-footer-center {
  2597. text-align: center;
  2598. padding: 15px 0 5px 0;
  2599. border-top: 1px solid #E4E7ED;
  2600. margin-top: 15px;
  2601. }
  2602. .dialog-footer-center .el-button {
  2603. margin: 0 10px;
  2604. min-width: 90px;
  2605. height: 36px;
  2606. padding: 0 20px;
  2607. font-size: 14px;
  2608. }
  2609. /* 响应式调整 */
  2610. @media (max-width: 1200px) {
  2611. .part-dialog {
  2612. width: 95% !important;
  2613. }
  2614. .part-dialog .el-dialog__body {
  2615. padding: 20px 20px 15px 20px;
  2616. }
  2617. }
  2618. @media (max-width: 768px) {
  2619. .part-form .el-col {
  2620. margin-bottom: 20px;
  2621. }
  2622. .form-section {
  2623. margin-bottom: 35px;
  2624. }
  2625. .part-form .el-form-item__label {
  2626. line-height: 28px;
  2627. height: 28px;
  2628. }
  2629. }
  2630. </style>