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

2913 lines
129 KiB

  1. <template>
  2. <div class="mod-config">
  3. <!-- 查询条件 -->
  4. <el-form :inline="true" label-position="top" :model="searchData">
  5. <el-form-item label="序列号">
  6. <el-input v-model="searchData.referenceNo" clearable style="width: 120px"></el-input>
  7. </el-form-item>
  8. <el-form-item label="单据状态">
  9. <el-select v-model="searchData.status" clearable style="width: 120px">
  10. <el-option label="草稿" value="草稿"></el-option>
  11. <el-option label="审批中" value="审批中"></el-option>
  12. <el-option label="已完成" value="已完成"></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="节点审批人">
  16. <el-input v-model="searchData.currentApprover" clearable style="width: 120px"></el-input>
  17. </el-form-item>
  18. <el-form-item label="当前节点">
  19. <el-select v-model="searchData.nodeId" placeholder="请选择节点" clearable style="width: 120px">
  20. <el-option
  21. v-for="option in nodeOptions"
  22. :key="option.id"
  23. :label="option.name"
  24. :value="option.id">
  25. </el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item :label="' '">
  29. <el-button v-if="authSearch" @click="getDataList">查询</el-button>
  30. <el-button v-if="authUpdate" @click="addOrUpdateHandle()">新增</el-button>
  31. <el-button v-if="authSearch" @click="exportHandle()">导出</el-button>
  32. <el-button v-if="authSearch" @click="searchHandle()">搜索</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <!-- 列表 -->
  36. <el-table
  37. ref="rohsTable"
  38. :height="height"
  39. :data="dataList"
  40. border
  41. :row-style="rowStyle"
  42. @row-click="changeClickRow"
  43. @current-change="currentChange"
  44. v-loading="dataListLoading"
  45. style="width: 100%;">
  46. <el-table-column prop="referenceNo" header-align="center" align="center" label="序列号" width="165"></el-table-column>
  47. <el-table-column prop="status" header-align="center" align="center" label="单据状态" width="120"></el-table-column>
  48. <el-table-column prop="nodeId" header-align="center" align="center" label="当前节点ID" width="130"></el-table-column>
  49. <el-table-column prop="nodeName" header-align="center" align="center" label="当前节点" width="150"></el-table-column>
  50. <el-table-column prop="currentApprover" header-align="center" align="center" label="当前节点审批人" width="170"></el-table-column>
  51. <el-table-column prop="applicant" header-align="center" align="center" label="申请人编码" width="130"></el-table-column>
  52. <el-table-column prop="applicantName" header-align="center" align="center" label="申请人名称" width="150"></el-table-column>
  53. <el-table-column prop="pm" header-align="center" align="center" label="PM编码" width="130"></el-table-column>
  54. <el-table-column prop="pmName" header-align="center" align="center" label="PM名称" width="150"></el-table-column>
  55. <el-table-column prop="applicationDate" header-align="center" align="center" label="申请日期" width="165"></el-table-column>
  56. <el-table-column header-align="center" align="center" label="计划转量产时间" width="165">
  57. <template slot-scope="scope">
  58. <span>{{ normalizeDateOnly(scope.row.plannedMassProductionDate) }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="process" header-align="center" align="center" label="工艺" width="120"></el-table-column>
  62. <el-table-column prop="color" header-align="center" align="center" label="颜色" width="120"></el-table-column>
  63. <el-table-column prop="vendorCode" header-align="center" align="center" label="供应商代码" width="160"></el-table-column>
  64. <el-table-column prop="vendorMaterialCode" header-align="center" align="center" label="供应商材料编号" width="200" :show-overflow-tooltip="true"></el-table-column>
  65. <el-table-column prop="materialClassify" header-align="center" align="center" label="材料分类" width="200" :show-overflow-tooltip="true"></el-table-column>
  66. <el-table-column prop="otherMaterialClassify" header-align="center" align="center" label="其他材料分类" width="210" :show-overflow-tooltip="true"></el-table-column>
  67. <el-table-column prop="materialUseFor" header-align="center" align="center" label="辅材用途" width="180" :show-overflow-tooltip="true"></el-table-column>
  68. <el-table-column prop="endCustomer" header-align="center" align="center" label="最终客户编码" width="160"></el-table-column>
  69. <el-table-column prop="endCustomerName" header-align="center" align="center" label="最终客户名称" width="180"></el-table-column>
  70. <el-table-column prop="projectId" header-align="center" align="center" label="项目编码" width="140"></el-table-column>
  71. <el-table-column prop="projectName" header-align="center" align="center" label="项目名称" width="180"></el-table-column>
  72. <el-table-column prop="commGroup1" header-align="center" align="center" label="商品组1编码" width="170"></el-table-column>
  73. <el-table-column prop="commGroup1Desc" header-align="center" align="center" label="商品组1名称" width="170"></el-table-column>
  74. <el-table-column prop="commGroup2" header-align="center" align="center" label="商品组2编码" width="170"></el-table-column>
  75. <el-table-column prop="commGroup2Desc" header-align="center" align="center" label="商品组2名称" width="170"></el-table-column>
  76. <el-table-column prop="commGroup3" header-align="center" align="center" label="商品组3编码" width="170"></el-table-column>
  77. <el-table-column prop="commGroup3Desc" header-align="center" align="center" label="商品组3名称" width="170"></el-table-column>
  78. <el-table-column prop="needCreateNumber" header-align="center" align="center" label="需创建内部编号" width="200"></el-table-column>
  79. <el-table-column prop="npdEngineer" header-align="center" align="center" label="NPD工程师编码" width="170"></el-table-column>
  80. <el-table-column prop="npdEngineerName" header-align="center" align="center" label="NPD工程师名称" width="170"></el-table-column>
  81. <el-table-column prop="materialValidityTime" header-align="center" align="center" label="材料有效期" width="200"></el-table-column>
  82. <el-table-column prop="needDeviation" header-align="center" align="center" label="是否需偏差许可" width="190"></el-table-column>
  83. <el-table-column prop="technicalPlan" header-align="center" align="center" label="技术计划编码" width="170"></el-table-column>
  84. <el-table-column prop="technicalPlanName" header-align="center" align="center" label="技术计划名称" width="170"></el-table-column>
  85. <el-table-column prop="buyer" header-align="center" align="center" label="采购编码" width="130"></el-table-column>
  86. <el-table-column prop="buyerName" header-align="center" align="center" label="采购名称" width="130"></el-table-column>
  87. <el-table-column prop="expectReportTime" header-align="center" align="center" label="报告时间(月)" width="200"></el-table-column>
  88. <el-table-column prop="sgsReportNumber" header-align="center" align="center" label="SGS报告编号" width="190" :show-overflow-tooltip="true"></el-table-column>
  89. <el-table-column prop="expiredDate" header-align="center" align="center" label="报告日期" width="165"></el-table-column>
  90. <el-table-column header-align="center" align="center" label="有效期" width="170" :show-overflow-tooltip="true">
  91. <template slot-scope="scope">
  92. <span>{{ getValidUntilDisplay(scope.row.validUntilValue, scope.row.validUntil) }}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column prop="isMeetRohsRequirement" header-align="center" align="center" label="符合RoHS" width="170"></el-table-column>
  96. <el-table-column prop="isAhGrade" header-align="center" align="center" label="AH属性" width="140"></el-table-column>
  97. <el-table-column prop="hsfSupplierClassification" header-align="center" align="center" label="HSF供应商等级" width="220"></el-table-column>
  98. <el-table-column prop="hsfApprover" header-align="center" align="center" label="HSF审批人" width="240" :show-overflow-tooltip="true"></el-table-column>
  99. <el-table-column prop="relatedPeople" header-align="center" align="center" label="Inform Related people" width="200" :show-overflow-tooltip="true"></el-table-column>
  100. <el-table-column prop="isSameMaterialDiffSize" header-align="center" align="center" label="同材不同规格" width="220"></el-table-column>
  101. <el-table-column prop="ifsPartNo" header-align="center" align="center" label="IFS编号" width="150"></el-table-column>
  102. <el-table-column prop="remark" header-align="center" align="center" label="备注" width="220" :show-overflow-tooltip="true"></el-table-column>
  103. <el-table-column fixed="right" header-align="center" align="center" width="130" label="操作">
  104. <template slot-scope="scope">
  105. <el-link v-if="authUpdate && scope.row.status !== '已完成'" style="cursor: pointer" @click="addOrUpdateHandle(scope.row)">编辑</el-link>
  106. <el-link v-if="authUpdate && scope.row.status === '已完成'" style="cursor: pointer" @click="addOrUpdateHandle(scope.row)">详情</el-link>
  107. <el-link v-if="authIssue && scope.row.status === '草稿'" style="cursor: pointer; margin-left: 10px;" @click="issueModal(scope.row)">下达</el-link>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <!-- 分页 -->
  112. <el-pagination 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. <!-- 编辑模态框 -->
  122. <el-dialog
  123. :title="modalTitle"
  124. :visible.sync="modalFlag"
  125. width="1010px"
  126. top="10vh"
  127. v-drag
  128. :close-on-click-modal="false"
  129. :showClose="false">
  130. <el-tabs tab-position="left" type="border-card" v-model="activeName" style="width: 100%;height: 650px;">
  131. <!-- 基本信息 -->
  132. <el-tab-pane label="基本信息" name="basicInfo">
  133. <div style="height: 635px">
  134. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  135. <el-form-item>
  136. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('applicant')" slot="label" @click="getBaseList(103, 1)"><a herf="#">申请人/Applicant</a></span>
  137. <span v-else slot="label">申请人/Applicant</span>
  138. <el-input v-model="modalData.applicant" @blur="applicantBlur(103)" :disabled="isRohsFieldDisabled('applicant')" style="width: 150px"></el-input>
  139. <el-input v-model="modalData.applicantName" disabled style="width: 240px"></el-input>
  140. </el-form-item>
  141. <el-form-item label="申请日期/Application Date">
  142. <el-date-picker v-model="modalData.applicationDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('applicationDate')" style="width: 190px" :editable=false></el-date-picker>
  143. </el-form-item>
  144. <el-form-item label="工艺/Process">
  145. <dict-data-select v-model="modalData.process" clearable :disabled="isRohsFieldDisabled('process')" style="width: 190px" dict-type="rohs_process"></dict-data-select>
  146. </el-form-item>
  147. </el-form>
  148. <el-form :inline="true" label-position="top" :model="modalData">
  149. <el-form-item label="供应商代码/Vendor Code">
  150. <el-input v-model="modalData.vendorCode" :disabled="isRohsFieldDisabled('vendorCode')" style="width: 150px"></el-input>
  151. </el-form-item>
  152. <el-form-item label="供应商材料编号/Vendor Material Code" style="margin-left: -10px">
  153. <el-input v-model="modalData.vendorMaterialCode" :disabled="isRohsFieldDisabled('vendorMaterialCode')" style="width: 240px"></el-input>
  154. </el-form-item>
  155. <el-form-item label="辅材用途/Material Use For">
  156. <el-input v-model="modalData.materialUseFor" :disabled="isRohsFieldDisabled('materialUseFor')" style="width: 190px"></el-input>
  157. </el-form-item>
  158. </el-form>
  159. <el-form :inline="true" label-position="top" :model="modalData">
  160. <el-form-item label="材料分类/Material Classify">
  161. <dict-data-select class="rohs-multiple-ellipsis" v-model="modalData.materialClassifyList" multiple :title="getMultipleSelectTitle(modalData.materialClassifyList)" :disabled="isRohsFieldDisabled('materialClassify')" style="width: 394px" dict-type="rohs_material_classify"></dict-data-select>
  162. </el-form-item>
  163. <el-form-item label="其他材料分类/Other Material Classify" v-if="modalData.materialClassifyList && modalData.materialClassifyList.includes('Other其他')">
  164. <el-input v-model="modalData.otherMaterialClassify" :disabled="isRohsFieldDisabled('otherMaterialClassify')" style="width: 190px"></el-input>
  165. </el-form-item>
  166. </el-form>
  167. <el-form :inline="true" label-position="top" :model="modalData">
  168. <el-form-item>
  169. <span slot="label" v-if="!modalData.endCustomerFlag && !isRohsFieldDisabled('endCustomer')" @click="getBaseList(102, 1)"><a herf="#">最终客户/End Customer</a></span>
  170. <span slot="label" v-else>最终客户/End Customer</span>
  171. <el-input :disabled="modalData.endCustomerFlag || isRohsFieldDisabled('endCustomer')" readonly v-model="modalData.endCustomer" @blur="handleQueryCustomer" style="width: 150px"></el-input>
  172. <el-input disabled v-model="modalData.endCustomerName" style="width: 240px"></el-input>
  173. </el-form-item>
  174. <el-form-item>
  175. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('pm')" slot="label" @click="getBaseList(2054, 5)"><a herf="#">PM人员/PM</a></span>
  176. <span v-else slot="label">PM人员/PM</span>
  177. <el-input v-model="modalData.pm" @blur="pmBlur(2054)" :disabled="isRohsFieldDisabled('pm')" style="width: 150px"></el-input>
  178. <el-input v-model="modalData.pmName" disabled style="width: 240px"></el-input>
  179. </el-form-item>
  180. </el-form>
  181. <el-form :inline="true" label-position="top" :model="modalData">
  182. <el-form-item>
  183. <span slot="label" v-if="!modalData.projectIdFlag && !isRohsFieldDisabled('projectId')" @click="chooseProjectListFlag = true"><a herf="#">项目编码/Project ID</a></span>
  184. <span slot="label" v-else>项目编码/Project ID</span>
  185. <el-input :disabled="modalData.projectIdFlag || isRohsFieldDisabled('projectId')" readonly v-model="modalData.projectId" @blur="handleQueryProjectByCustomer" style="width: 150px"></el-input>
  186. <el-input disabled v-model="modalData.projectName" style="width: 240px"></el-input>
  187. </el-form-item>
  188. <el-form-item label="颜色/Color">
  189. <el-input v-model="modalData.color" :disabled="isRohsFieldDisabled('color')" style="width: 150px"></el-input>
  190. </el-form-item>
  191. <el-form-item label="计划转量产时间/Planned Mass Production">
  192. <el-date-picker v-model="modalData.plannedMassProductionDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('plannedMassProductionDate')" style="width: 190px" :editable=false></el-date-picker>
  193. </el-form-item>
  194. </el-form>
  195. <el-form :inline="true" label-position="top" :model="modalData">
  196. <el-form-item>
  197. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup1')" slot="label" @click="getBaseList(110)"><a herf="#">商品组1 / Comm Group 1</a></span>
  198. <span v-else slot="label">商品组1 / Comm Group 1</span>
  199. <el-input v-model="modalData.commGroup1" @change="commGroup1Blur(110)" :disabled="isRohsFieldDisabled('commGroup1')" style="width: 150px"></el-input>
  200. <el-input v-model="modalData.commGroup1Desc" disabled style="width: 240px"></el-input>
  201. </el-form-item>
  202. <el-form-item label="是否需偏差许可/Need Deviation">
  203. <el-radio-group v-model="modalData.needDeviation" :disabled="isRohsFieldDisabled('needDeviation')" style="width: 190px">
  204. <el-radio label="Y" @click.native.prevent="radioClick('needDeviation', 'Y')"></el-radio>
  205. <el-radio label="N" @click.native.prevent="radioClick('needDeviation', 'N')"></el-radio>
  206. </el-radio-group>
  207. </el-form-item>
  208. </el-form>
  209. <el-form :inline="true" label-position="top" :model="modalData">
  210. <el-form-item>
  211. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup2')" slot="label" @click="getBaseList(111)"><a herf="#">商品组2 / Comm Group 2</a></span>
  212. <span v-else slot="label">商品组2 / Comm Group 2</span>
  213. <el-input v-model="modalData.commGroup2" @change="commGroup2Blur(111)" :disabled="isRohsFieldDisabled('commGroup2')" style="width: 150px"></el-input>
  214. <el-input v-model="modalData.commGroup2Desc" disabled style="width: 240px"></el-input>
  215. </el-form-item>
  216. <el-form-item label="需创建内部编号/Need Create No.">
  217. <el-radio-group v-model="modalData.needCreateNumber" :disabled="isRohsFieldDisabled('needCreateNumber')" style="width: 190px">
  218. <el-radio label="Y" @click.native.prevent="radioClick('needCreateNumber', 'Y')"></el-radio>
  219. <el-radio label="N" @click.native.prevent="radioClick('needCreateNumber', 'N')"></el-radio>
  220. </el-radio-group>
  221. </el-form-item>
  222. </el-form>
  223. <el-form :inline="true" label-position="top" :model="modalData">
  224. <el-form-item>
  225. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup3')" slot="label" @click="getBaseList(130)"><a herf="#">商品组3 / Comm Group 3</a></span>
  226. <span v-else slot="label">商品组3 / Comm Group 3</span>
  227. <el-input v-model="modalData.commGroup3" @change="commGroup3Blur(130)" :disabled="isRohsFieldDisabled('commGroup3')" style="width: 150px"></el-input>
  228. <el-input v-model="modalData.commGroup3Desc" disabled style="width: 240px"></el-input>
  229. </el-form-item>
  230. <el-form-item label="是否Fiber材料/Fiber Material">
  231. <el-radio-group v-model="modalData.isFiberMaterial" :disabled="isRohsFieldDisabled('isFiberMaterial')" style="width: 190px">
  232. <el-radio label="Y" @click.native.prevent="radioClick('isFiberMaterial', 'Y')"></el-radio>
  233. <el-radio label="N" @click.native.prevent="radioClick('isFiberMaterial', 'N')"></el-radio>
  234. </el-radio-group>
  235. </el-form-item>
  236. </el-form>
  237. <el-form :inline="true" label-position="top" :model="modalData">
  238. <el-form-item>
  239. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('npdEngineer')" slot="label" @click="getBaseList(2001, 3)"><a herf="#">NPD工程师/NPD Engineer</a></span>
  240. <span v-else slot="label">NPD工程师/NPD Engineer</span>
  241. <el-input v-model="modalData.npdEngineer" @blur="npdEngineerBlur(2001)" :disabled="isRohsFieldDisabled('npdEngineer')" style="width: 150px"></el-input>
  242. <el-input v-model="modalData.npdEngineerName" disabled style="width: 240px"></el-input>
  243. </el-form-item>
  244. <el-form-item label="WM所需求规格/WM Required Spec">
  245. <el-input v-model="modalData.wmRequiredSpec" :disabled="isRohsFieldDisabled('wmRequiredSpec')" style="width: 190px"></el-input>
  246. </el-form-item>
  247. <el-form-item label="材料厚度/Material Thickness">
  248. <el-input v-model="modalData.materialThickness" :disabled="isRohsFieldDisabled('materialThickness')" style="width: 190px"></el-input>
  249. </el-form-item>
  250. </el-form>
  251. <el-form :inline="true" label-position="top" :model="modalData">
  252. <el-form-item label="材料有效期/Material Validity Time">
  253. <el-date-picker v-model="modalData.materialValidityTime" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('materialValidityTime')" style="width: 190px" :editable=false></el-date-picker>
  254. </el-form-item>
  255. <el-form-item label="有效期备注/Validity Comments">
  256. <el-input v-model="modalData.materialValidityComments" :disabled="isRohsFieldDisabled('materialValidityComments')" style="width: 190px"></el-input>
  257. </el-form-item>
  258. <el-form-item label="报告时间(月)/Expect Report Time">
  259. <el-input class="inlineNumber numInput" v-model="modalData.expectReportTime" :disabled="isRohsFieldDisabled('expectReportTime')" type="number" style="width: 190px"></el-input>
  260. </el-form-item>
  261. </el-form>
  262. <el-form :inline="true" label-position="top" :model="modalData">
  263. <el-form-item>
  264. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('technicalPlan')" slot="label" @click="getBaseList(2001, 4)"><a herf="#">技术计划/Technical Plan</a></span>
  265. <span v-else slot="label">技术计划/Technical Plan</span>
  266. <el-input v-model="modalData.technicalPlan" @blur="technicalPlanBlur(2001)" :disabled="isRohsFieldDisabled('technicalPlan')" style="width: 150px"></el-input>
  267. <el-input v-model="modalData.technicalPlanName" disabled style="width: 240px"></el-input>
  268. </el-form-item>
  269. <el-form-item>
  270. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('buyer')" slot="label" @click="getBaseList(2000, 2)"><a herf="#">采购/Buyer</a></span>
  271. <span v-else slot="label">采购/Buyer</span>
  272. <el-input v-model="modalData.buyer" @blur="buyerBlur(2000)" :disabled="isRohsFieldDisabled('buyer')" style="width: 150px"></el-input>
  273. <el-input v-model="modalData.buyerName" disabled style="width: 240px"></el-input>
  274. </el-form-item>
  275. </el-form>
  276. <el-form :inline="true" label-position="top" :model="modalData">
  277. <el-form-item label="所需审批文件/Docs Needed" >
  278. <dict-data-select class="rohs-multiple-ellipsis" v-model="modalData.qualificationDocumentsNeededList" multiple :title="getMultipleSelectTitle(modalData.qualificationDocumentsNeededList)" :disabled="isRohsFieldDisabled('qualificationDocumentsNeeded')" style="width: 394px" dict-type="rohs_qualification_docs"></dict-data-select>
  279. </el-form-item>
  280. <el-form-item label="测试报告必测项/Test Items">
  281. <dict-data-select class="rohs-multiple-ellipsis" v-model="modalData.testReportIncludingItemsList" multiple :title="getMultipleSelectTitle(modalData.testReportIncludingItemsList)" :disabled="isRohsFieldDisabled('testReportIncludingItems')" style="width: 394px" dict-type="rohs_test_report_items"></dict-data-select>
  282. </el-form-item>
  283. </el-form>
  284. <el-form :inline="true" label-position="top" :model="modalData">
  285. <el-form-item style="display: block;">
  286. <template slot="label">
  287. <span>备注说明/Remark</span>
  288. <el-button
  289. v-if="authDataEntry"
  290. style="margin-left: 2px;width: 83px;line-height: 0.5;font-size: 10px;"
  291. type="primary"
  292. @click="openRohsRemarkDialog">RoHs备注</el-button>
  293. </template>
  294. <el-input type="textarea" :rows="3" v-model="modalData.remark" :disabled="isRohsFieldDisabled('remark')" resize="none" style="width: 802px;height: 30px"></el-input>
  295. </el-form-item>
  296. </el-form>
  297. </div>
  298. </el-tab-pane>
  299. <!-- HSF 填写信息 -->
  300. <el-tab-pane label="HSF 填写信息" name="hsfInfo">
  301. <div style="height: 635px">
  302. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  303. <el-form-item label="SGS报告编号/SGS Report Number">
  304. <el-input v-model="modalData.sgsReportNumber" :disabled="isRohsFieldDisabled('sgsReportNumber')" style="width: 230px"></el-input>
  305. </el-form-item>
  306. <el-form-item label="报告日期/Expired Date">
  307. <el-date-picker v-model="modalData.expiredDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('expiredDate')" style="width: 180px" :editable=false></el-date-picker>
  308. </el-form-item>
  309. <el-form-item label="有效期数值/Valid Until Value">
  310. <el-input-number
  311. v-model="modalData.validUntilValue"
  312. :controls="false"
  313. :min="0"
  314. :step="1"
  315. :precision="0"
  316. :disabled="isValidUntilValueDisabled()"
  317. style="width: 150px">
  318. </el-input-number>
  319. </el-form-item>
  320. <el-form-item label="有效期单位/Valid Until Unit">
  321. <dict-data-select v-model="modalData.validUntil" clearable :disabled="isValidUntilUnitDisabled()" style="width: 180px" dict-type="rohs_valid_until"></dict-data-select>
  322. </el-form-item>
  323. </el-form>
  324. <el-form :inline="true" label-position="top" :model="modalData">
  325. <el-form-item label="是否符合RoHS/Meet RoHS Req">
  326. <el-radio-group v-model="modalData.isMeetRohsRequirement" :disabled="isRohsFieldDisabled('isMeetRohsRequirement')" style="width: 230px">
  327. <el-radio label="Y" @click.native.prevent="radioClick('isMeetRohsRequirement', 'Y')"></el-radio>
  328. <el-radio label="N" @click.native.prevent="radioClick('isMeetRohsRequirement', 'N')"></el-radio>
  329. </el-radio-group>
  330. </el-form-item>
  331. <el-form-item label="材料属性是否是AH/Is AH Grade">
  332. <el-radio-group v-model="modalData.isAhGrade" :disabled="isRohsFieldDisabled('isAhGrade')" style="width: 180px">
  333. <el-radio label="Y" @click.native.prevent="radioClick('isAhGrade', 'Y')"></el-radio>
  334. <el-radio label="N" @click.native.prevent="radioClick('isAhGrade', 'N')"></el-radio>
  335. </el-radio-group>
  336. </el-form-item>
  337. <el-form-item label="HSF供应商等级/Supplier Class">
  338. <el-radio-group v-model="modalData.hsfSupplierClassification" :disabled="isRohsFieldDisabled('hsfSupplierClassification')" style="width: 200px">
  339. <el-radio label="A类" @click.native.prevent="radioClick('hsfSupplierClassification', 'A类')">A类</el-radio>
  340. <el-radio label="B类" @click.native.prevent="radioClick('hsfSupplierClassification', 'B类')">B类</el-radio>
  341. <el-radio label="C类" @click.native.prevent="radioClick('hsfSupplierClassification', 'C类')">C类</el-radio>
  342. </el-radio-group>
  343. </el-form-item>
  344. </el-form>
  345. <el-form :inline="true" label-position="top" :model="modalData">
  346. <el-form-item label="Fiber报告信息/Fiber Information" style="display: block;">
  347. <el-input type="textarea" :rows="3" v-model="modalData.fiberInformation" :disabled="isRohsFieldDisabled('fiberInformation')" resize="none" style="width: 802px;height: 30px"></el-input>
  348. </el-form-item>
  349. </el-form>
  350. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 45px">
  351. <el-form-item>
  352. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('hsfApprover')" slot="label" @click="openHsfApproverChooseModal"><a herf="#">HSF审批人/HSF Approver</a></span>
  353. <span v-else slot="label">HSF审批人/HSF Approver</span>
  354. <el-input
  355. v-model="modalData.hsfApprover"
  356. readonly
  357. :disabled="isRohsFieldDisabled('hsfApprover')"
  358. style="width: 420px"
  359. placeholder="请选择人员"
  360. @focus="openHsfApproverChooseModal">
  361. <span slot="suffix" v-show="modalData.hsfApprover && !isRohsFieldDisabled('hsfApprover')" @click.stop="clearHsfApproverSelection">
  362. <i class="el-icon-circle-close" style="margin-left: 5px;cursor: pointer;"></i>
  363. </span>
  364. </el-input>
  365. </el-form-item>
  366. </el-form>
  367. <el-form :inline="true" label-position="top" :model="modalData">
  368. <el-form-item label="Inform Related people">
  369. <el-select
  370. v-model="modalData.relatedPeople"
  371. clearable
  372. filterable
  373. :disabled="isRohsFieldDisabled('relatedPeople')"
  374. style="width: 420px"
  375. placeholder="请从HSF审批人中选择">
  376. <el-option
  377. v-for="item in (modalData.hsfApproverList || [])"
  378. :key="item"
  379. :label="item"
  380. :value="item">
  381. </el-option>
  382. </el-select>
  383. </el-form-item>
  384. </el-form>
  385. <el-form v-if="shouldShowHsfStandard(modalData.endCustomer)" :inline="true" label-position="top" :model="modalData" style="margin-top: 0px">
  386. <el-form-item label="HSF标准/HSF Standard" style="display: block;">
  387. <el-input type="textarea" :rows="3" v-model="modalData.hsfStandard" :disabled="isRohsFieldDisabled('hsfStandard')" resize="none" style="width: 802px;height: 30px"></el-input>
  388. </el-form-item>
  389. </el-form>
  390. </div>
  391. </el-tab-pane>
  392. <!-- NPD 信息 -->
  393. <el-tab-pane label="NPD 信息" name="npdInfo">
  394. <div style="height: 635px; overflow-y: auto;">
  395. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  396. <el-form-item label="现有材料不同规格/Same Material Diff Size">
  397. <el-radio-group v-model="modalData.isSameMaterialDiffSize" :disabled="isRohsFieldDisabled('isSameMaterialDiffSize')" style="width: 190px">
  398. <el-radio label="Y" @click.native.prevent="radioClick('isSameMaterialDiffSize', 'Y')"></el-radio>
  399. <el-radio label="N" @click.native.prevent="radioClick('isSameMaterialDiffSize', 'N')"></el-radio>
  400. </el-radio-group>
  401. </el-form-item>
  402. </el-form>
  403. <el-form :inline="true" label-position="top" :model="modalData">
  404. <el-form-item label="材料描述/Material Desc." style="display: block;">
  405. <el-input type="textarea" :rows="3" v-model="modalData.materialDesc" :disabled="isRohsFieldDisabled('materialDesc')" resize="none" style="width: 802px;height: 30px"></el-input>
  406. </el-form-item>
  407. </el-form>
  408. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 50px">
  409. <el-form-item label="备注说明/NPD Remark" style="display: block;">
  410. <el-input type="textarea" :rows="3" v-model="modalData.npdRemark" :disabled="isRohsFieldDisabled('npdRemark')" resize="none" style="width: 802px;height: 30px"></el-input>
  411. </el-form-item>
  412. </el-form>
  413. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 50px">
  414. <el-form-item label="TDS属性/TDS Property" style="display: block;">
  415. <oss-components
  416. :save-visible="authFileSave"
  417. :download-visible="authFileDownLoad"
  418. :remove-visible="authFileRemove"
  419. :preview-visible="authFilePreview"
  420. :disabled="showModalFlag || modalData.status === '已完成'"
  421. :enable-upgrade="!showModalFlag && modalData.status !== '已完成'"
  422. :require-file-no-rev="true"
  423. :auto-file-no="true"
  424. :single-upload="true"
  425. :row-click-select="true"
  426. :show-order-ref2="false"
  427. label="序列号"
  428. :height="350"
  429. style="margin-top: 2px"
  430. :columns="tdsFileColumnList"
  431. :order-ref1="modalData.site || ''"
  432. :order-ref2="modalData.referenceNo || ''"
  433. order-ref3="tdsProperty">
  434. </oss-components>
  435. </el-form-item>
  436. </el-form>
  437. </div>
  438. </el-tab-pane>
  439. <!-- 材料信息 -->
  440. <el-tab-pane label="材料信息" name="materialInfo">
  441. <div style="height: 635px">
  442. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -15px;">
  443. <el-form-item label=" ">
  444. <el-button type="primary" v-if="!showModalFlag && canEditRohsMaterial()" @click="openProjectMaterialDialog">新增材料</el-button>
  445. <el-button type="danger" v-if="!showModalFlag && canEditRohsMaterial()" @click="removeSelectedMaterialRows">删除材料</el-button>
  446. </el-form-item>
  447. </el-form>
  448. <el-table
  449. ref="rohsMaterialTable"
  450. class="rohs-material-table"
  451. border
  452. :data="modalData.materialList"
  453. @selection-change="materialSelectionChange"
  454. :header-cell-style="materialDialogHeaderCellStyle"
  455. :height="585"
  456. style="width: 100%">
  457. <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
  458. <el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
  459. <el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="150" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  460. <el-table-column prop="partDesc" label="描述/Part Desc." min-width="250" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  461. <el-table-column prop="partStatus" label="状态/Part Status" min-width="100" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  462. </el-table>
  463. </div>
  464. </el-tab-pane>
  465. <el-tab-pane label="附件信息" name="attachmentInfo">
  466. <div style="height: 635px">
  467. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -15px;">
  468. <el-form-item label=" ">
  469. <el-button type="primary" icon="el-icon-upload" @click="uploadDialog = true">上传附件</el-button>
  470. </el-form-item>
  471. </el-form>
  472. </div>
  473. </el-tab-pane>
  474. </el-tabs>
  475. <el-footer style="height:35px;margin-top: 15px;text-align:center">
  476. <el-button type="primary" v-if="canSaveAction()" @click="dataFormSubmit()">保存</el-button>
  477. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  478. <el-button type="primary" v-if="canAgreeAction()" :loading="submitLoading" @click="agreeSubmit">同意</el-button>
  479. <el-button type="primary" v-if="canRejectAction()" :loading="submitLoading" @click="openRejectModal">驳回</el-button>
  480. </el-footer>
  481. </el-dialog>
  482. <upload-file-list
  483. v-if="modalFlag"
  484. folder="rohs"
  485. order-ref3="rohsAttachment"
  486. title="RoHs 附件上传"
  487. :label="'序列号'"
  488. :file-list.sync="fileList"
  489. :no="modalData.referenceNo"
  490. :upload-dialog.sync="uploadDialog"
  491. path="/upload/test">
  492. </upload-file-list>
  493. <!--选择项目模态框-->
  494. <el-dialog title="选择-项目" :close-on-click-modal="false" @close="closeProjectInfoDialog"
  495. @open="searchProjectInfoList" :visible.sync="chooseProjectListFlag" width="35%">
  496. <el-form label-position="top" :model="searchProjectData" ref="closeProjectInfoForm">
  497. <el-row :gutter="10">
  498. <el-col :span="6">
  499. <el-form-item label="项目号">
  500. <el-input v-model="searchProjectData.projectId"></el-input>
  501. </el-form-item>
  502. </el-col>
  503. <el-col :span="6">
  504. <el-form-item label="项目名称">
  505. <el-input v-model="searchProjectData.projectName"></el-input>
  506. </el-form-item>
  507. </el-col>
  508. <el-col :span="6">
  509. <el-form-item label=" ">
  510. <el-button type="primary" @click="searchProjectInfoList">查询</el-button>
  511. </el-form-item>
  512. </el-col>
  513. </el-row>
  514. <el-table :height="223"
  515. :data="projectList"
  516. border
  517. @row-click="projectClickRow">
  518. <el-table-column label="项目号" prop="projectId"/>
  519. <el-table-column label="项目名称" prop="projectName"/>
  520. </el-table>
  521. </el-form>
  522. <el-footer style="height:35px;margin-top: 10px;text-align:center">
  523. <el-button type="primary" @click="chooseProjectListFlag = false">关闭</el-button>
  524. </el-footer>
  525. </el-dialog>
  526. <el-dialog title="选择项目物料" top="15vh" width="75%" :close-on-click-modal="false" v-drag :visible.sync="projectMaterialDialogFlag">
  527. <el-form :inline="true" label-position="top" :model="projectMaterialSearchData">
  528. <el-form-item label="IFS物料编码/Final Part No.">
  529. <el-input v-model="projectMaterialSearchData.finalPartNo" clearable style="width: 150px"></el-input>
  530. </el-form-item>
  531. <el-form-item label="描述/Part Desc">
  532. <el-input v-model="projectMaterialSearchData.partDesc" clearable style="width: 200px"></el-input>
  533. </el-form-item>
  534. <el-form-item label="状态/Part Status">
  535. <el-input v-model="projectMaterialSearchData.partStatus" clearable style="width: 100px"></el-input>
  536. </el-form-item>
  537. <el-form-item label=" ">
  538. <el-button type="primary" @click="searchProjectMaterialList">查询</el-button>
  539. </el-form-item>
  540. </el-form>
  541. <el-table
  542. ref="projectMaterialTable"
  543. class="rohs-material-table"
  544. border
  545. v-loading="projectMaterialLoading"
  546. :data="projectMaterialList"
  547. @selection-change="projectMaterialSelectionChange"
  548. :header-cell-style="materialDialogHeaderCellStyle"
  549. :height="320"
  550. style="width: 100%">
  551. <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
  552. <el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="150" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  553. <el-table-column prop="partDesc" label="描述/Part Desc." min-width="250" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  554. <el-table-column prop="partStatus" label="状态/Part Status" min-width="100" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  555. </el-table>
  556. <el-pagination
  557. style="margin-top: 10px"
  558. @size-change="projectMaterialSizeChangeHandle"
  559. @current-change="projectMaterialCurrentChangeHandle"
  560. :current-page="projectMaterialPageIndex"
  561. :page-sizes="[20, 50, 100]"
  562. :page-size="projectMaterialPageSize"
  563. :total="projectMaterialTotal"
  564. layout="total, sizes, prev, pager, next, jumper">
  565. </el-pagination>
  566. <el-footer style="height:35px;margin-top: 10px;text-align:center">
  567. <el-button type="primary" @click="confirmProjectMaterialSelection">确定</el-button>
  568. <el-button type="primary" @click="projectMaterialDialogFlag = false">关闭</el-button>
  569. </el-footer>
  570. </el-dialog>
  571. <el-dialog title="人员选择" @open="openHsfApproverDialog" @close="closeHsfApproverDialog" v-drag
  572. :visible.sync="hsfApproverFlag" width="40vw" :close-on-click-modal="false">
  573. <el-form :inline="true" label-position="top" :model="hsfApproverSearchData">
  574. <el-form-item label="编码">
  575. <el-input v-model="hsfApproverSearchData.operatorId" clearable style="width: 120px"></el-input>
  576. </el-form-item>
  577. <el-form-item label="名称">
  578. <el-input v-model="hsfApproverSearchData.operatorName" clearable style="width: 120px"></el-input>
  579. </el-form-item>
  580. <el-form-item label=" ">
  581. <el-button type="primary" @click="filterHsfApproverOptions">查询</el-button>
  582. </el-form-item>
  583. </el-form>
  584. <el-table v-if="hsfApproverFlag"
  585. :height="300"
  586. :data="hsfApproverDisplayList"
  587. @selection-change="handleHsfApproverSelectionChange"
  588. @row-click="(row,column,event) => handleHsfApproverTableClick(row,column,event,'hsfApproverTable')"
  589. ref="hsfApproverTable"
  590. border row-key="operatorId"
  591. style="width: 100%;">
  592. <el-table-column
  593. type="selection"
  594. header-align="center"
  595. align="center"
  596. :reserve-selection="true"
  597. width="50">
  598. </el-table-column>
  599. <el-table-column label="编码" property="operatorId" align="left" header-align="center"/>
  600. <el-table-column label="名称" property="operatorName" align="left" header-align="center"/>
  601. </el-table>
  602. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  603. <el-button type="primary" @click="saveHsfApproverChooseModal">确定</el-button>
  604. <el-button type="primary" @click="hsfApproverFlag = false">关闭</el-button>
  605. </el-footer>
  606. </el-dialog>
  607. <el-dialog title="驳回" top="30vh" :close-on-click-modal="false" v-drag :visible.sync="submitModalFlag" width="500px">
  608. <el-form label-position="top">
  609. <el-form-item label="驳回意见/Reject Opinion">
  610. <el-input type="textarea" v-model="rejectOpinion" :rows="3" resize="none" show-word-limit style="width: 479px;height: 30px"></el-input>
  611. </el-form-item>
  612. </el-form>
  613. <el-footer style="height:35px;margin-top:50px;text-align:center">
  614. <el-button type="primary" :loading="submitLoading" @click="rejectSubmit">确定</el-button>
  615. <el-button type="primary" @click="submitModalFlag = false">取消</el-button>
  616. </el-footer>
  617. </el-dialog>
  618. <el-dialog width="700px" title="RoHs备注" :close-on-click-modal="false" :visible.sync="rohsRemarkFlag" v-drag>
  619. <el-form label-position="top">
  620. <el-form-item label="备注说明/Remark">
  621. <el-input
  622. type="textarea"
  623. v-model="rohsRemarkForm.remark"
  624. :rows="6"
  625. maxlength="255"
  626. show-word-limit
  627. resize="none">
  628. </el-input>
  629. </el-form-item>
  630. </el-form>
  631. <el-footer style="height:35px;margin-top:110px;text-align:center">
  632. <el-button type="primary" @click="refreshRohsRemark">刷新</el-button>
  633. <el-button type="primary" @click="saveRohsRemark">保存</el-button>
  634. <el-button type="primary" @click="rohsRemarkFlag = false">取消</el-button>
  635. </el-footer>
  636. </el-dialog>
  637. <!-- 底部附件页签 -->
  638. <el-tabs v-model="activeTable" style="width: 100%; height: 100%;" type="border-card" @tab-click="refreshCurrentTabTable" class="customer-tab">
  639. <el-tab-pane label="基本信息" name="basicInfo">
  640. <div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
  641. <el-form :inline="true" label-position="top" :model="currentRow">
  642. <el-form-item>
  643. <span slot="label">申请人/Applicant</span>
  644. <el-input :value="currentRow.applicant || ''" disabled style="width: 150px"></el-input>
  645. <el-input :value="currentRow.applicantName || ''" disabled style="width: 240px"></el-input>
  646. </el-form-item>
  647. <el-form-item label="申请日期/Application Date">
  648. <el-date-picker :value="currentRow.applicationDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 190px"></el-date-picker>
  649. </el-form-item>
  650. <el-form-item label="工艺/Process">
  651. <el-input :value="currentRow.process || ''" disabled style="width: 190px"></el-input>
  652. </el-form-item>
  653. </el-form>
  654. <el-form :inline="true" label-position="top" :model="currentRow">
  655. <el-form-item label="供应商代码/Vendor Code">
  656. <el-input :value="currentRow.vendorCode || ''" disabled style="width: 150px"></el-input>
  657. </el-form-item>
  658. <el-form-item label="供应商材料编号/Vendor Material Code" style="margin-left: -10px">
  659. <el-input :value="currentRow.vendorMaterialCode || ''" disabled style="width: 240px"></el-input>
  660. </el-form-item>
  661. <el-form-item label="辅材用途/Material Use For">
  662. <el-input :value="currentRow.materialUseFor || ''" disabled style="width: 190px"></el-input>
  663. </el-form-item>
  664. </el-form>
  665. <el-form :inline="true" label-position="top" :model="currentRow">
  666. <el-form-item label="材料分类/Material Classify">
  667. <el-input :value="currentRow.materialClassify || ''" disabled style="width: 394px"></el-input>
  668. </el-form-item>
  669. <el-form-item label="其他材料分类/Other Material Classify" v-if="currentRow.materialClassify && currentRow.materialClassify.includes('Other其他')">
  670. <el-input :value="currentRow.otherMaterialClassify || ''" disabled style="width: 190px"></el-input>
  671. </el-form-item>
  672. </el-form>
  673. <el-form :inline="true" label-position="top" :model="currentRow">
  674. <el-form-item>
  675. <span slot="label">最终客户/End Customer</span>
  676. <el-input :value="currentRow.endCustomer || ''" disabled style="width: 150px"></el-input>
  677. <el-input :value="currentRow.endCustomerName || ''" disabled style="width: 240px"></el-input>
  678. </el-form-item>
  679. <el-form-item>
  680. <span slot="label">PM人员/PM</span>
  681. <el-input :value="currentRow.pm || ''" disabled style="width: 150px"></el-input>
  682. <el-input :value="currentRow.pmName || ''" disabled style="width: 240px"></el-input>
  683. </el-form-item>
  684. </el-form>
  685. <el-form :inline="true" label-position="top" :model="currentRow">
  686. <el-form-item>
  687. <span slot="label">项目编码/Project ID</span>
  688. <el-input :value="currentRow.projectId || ''" disabled style="width: 150px"></el-input>
  689. <el-input :value="currentRow.projectName || ''" disabled style="width: 240px"></el-input>
  690. </el-form-item>
  691. <el-form-item label="颜色/Color">
  692. <el-input :value="currentRow.color || ''" disabled style="width: 150px"></el-input>
  693. </el-form-item>
  694. <el-form-item label="计划转量产时间/Planned Mass Production">
  695. <el-date-picker :value="normalizeDateOnly(currentRow.plannedMassProductionDate)" disabled type="date" value-format="yyyy-MM-dd" style="width: 190px"></el-date-picker>
  696. </el-form-item>
  697. </el-form>
  698. <el-form :inline="true" label-position="top" :model="currentRow">
  699. <el-form-item>
  700. <span slot="label">商品组1 / Comm Group 1</span>
  701. <el-input :value="currentRow.commGroup1 || ''" disabled style="width: 150px"></el-input>
  702. <el-input :value="currentRow.commGroup1Desc || ''" disabled style="width: 240px"></el-input>
  703. </el-form-item>
  704. <el-form-item label="是否需偏差许可/Need Deviation">
  705. <el-input :value="displayYesNo(currentRow.needDeviation)" disabled style="width: 190px"></el-input>
  706. </el-form-item>
  707. </el-form>
  708. <el-form :inline="true" label-position="top" :model="currentRow">
  709. <el-form-item>
  710. <span slot="label">商品组2 / Comm Group 2</span>
  711. <el-input :value="currentRow.commGroup2 || ''" disabled style="width: 150px"></el-input>
  712. <el-input :value="currentRow.commGroup2Desc || ''" disabled style="width: 240px"></el-input>
  713. </el-form-item>
  714. <el-form-item label="需创建内部编号/Need Create No.">
  715. <el-input :value="displayYesNo(currentRow.needCreateNumber)" disabled style="width: 190px"></el-input>
  716. </el-form-item>
  717. </el-form>
  718. <el-form :inline="true" label-position="top" :model="currentRow">
  719. <el-form-item>
  720. <span slot="label">商品组3 / Comm Group 3</span>
  721. <el-input :value="currentRow.commGroup3 || ''" disabled style="width: 150px"></el-input>
  722. <el-input :value="currentRow.commGroup3Desc || ''" disabled style="width: 240px"></el-input>
  723. </el-form-item>
  724. <el-form-item label="是否Fiber材料/Fiber Material">
  725. <el-input :value="displayYesNo(currentRow.isFiberMaterial)" disabled style="width: 190px"></el-input>
  726. </el-form-item>
  727. </el-form>
  728. <el-form :inline="true" label-position="top" :model="currentRow">
  729. <el-form-item>
  730. <span slot="label">NPD工程师/NPD Engineer</span>
  731. <el-input :value="currentRow.npdEngineer || ''" disabled style="width: 150px"></el-input>
  732. <el-input :value="currentRow.npdEngineerName || ''" disabled style="width: 240px"></el-input>
  733. </el-form-item>
  734. <el-form-item label="WM所需求规格/WM Required Spec">
  735. <el-input :value="currentRow.wmRequiredSpec || ''" disabled style="width: 190px"></el-input>
  736. </el-form-item>
  737. <el-form-item label="材料厚度/Material Thickness">
  738. <el-input :value="currentRow.materialThickness || ''" disabled style="width: 190px"></el-input>
  739. </el-form-item>
  740. </el-form>
  741. <el-form :inline="true" label-position="top" :model="currentRow">
  742. <el-form-item label="材料有效期/Material Validity Time">
  743. <el-date-picker :value="currentRow.materialValidityTime" disabled type="date" value-format="yyyy-MM-dd" style="width: 190px"></el-date-picker>
  744. </el-form-item>
  745. <el-form-item label="有效期备注/Validity Comments">
  746. <el-input :value="currentRow.materialValidityComments || ''" disabled style="width: 190px"></el-input>
  747. </el-form-item>
  748. <el-form-item label="报告时间(月)/Expect Report Time">
  749. <el-input :value="currentRow.expectReportTime" disabled style="width: 190px"></el-input>
  750. </el-form-item>
  751. </el-form>
  752. <el-form :inline="true" label-position="top" :model="currentRow">
  753. <el-form-item>
  754. <span slot="label">技术计划/Technical Plan</span>
  755. <el-input :value="currentRow.technicalPlan || ''" disabled style="width: 150px"></el-input>
  756. <el-input :value="currentRow.technicalPlanName || ''" disabled style="width: 240px"></el-input>
  757. </el-form-item>
  758. <el-form-item>
  759. <span slot="label">采购/Buyer</span>
  760. <el-input :value="currentRow.buyer || ''" disabled style="width: 150px"></el-input>
  761. <el-input :value="currentRow.buyerName || ''" disabled style="width: 240px"></el-input>
  762. </el-form-item>
  763. </el-form>
  764. <el-form :inline="true" label-position="top" :model="currentRow">
  765. <el-form-item label="所需审批文件/Docs Needed">
  766. <el-input :value="currentRow.qualificationDocumentsNeeded || ''" disabled style="width: 394px"></el-input>
  767. </el-form-item>
  768. <el-form-item label="测试报告必测项/Test Items">
  769. <el-input :value="currentRow.testReportIncludingItems || ''" disabled style="width: 394px"></el-input>
  770. </el-form-item>
  771. </el-form>
  772. <el-form :inline="true" label-position="top" :model="currentRow">
  773. <el-form-item label="备注说明/Remark" style="display: block;">
  774. <el-input type="textarea" :rows="3" :value="currentRow.remark || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input>
  775. </el-form-item>
  776. </el-form>
  777. </div>
  778. </el-tab-pane>
  779. <el-tab-pane label="HSF 填写信息" name="hsfInfo">
  780. <div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
  781. <el-form :inline="true" label-position="top" :model="currentRow">
  782. <el-form-item label="SGS报告编号/SGS Report Number">
  783. <el-input :value="currentRow.sgsReportNumber || ''" disabled style="width: 230px"></el-input>
  784. </el-form-item>
  785. <el-form-item label="报告日期/Expired Date">
  786. <el-date-picker :value="currentRow.expiredDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 180px"></el-date-picker>
  787. </el-form-item>
  788. <el-form-item label="有效期数值/Valid Until Value">
  789. <el-input :value="currentRow.validUntilValue || ''" disabled style="width: 150px"></el-input>
  790. </el-form-item>
  791. <el-form-item label="有效期单位/Valid Until Unit">
  792. <el-input :value="currentRow.validUntil || ''" disabled style="width: 180px"></el-input>
  793. </el-form-item>
  794. </el-form>
  795. <el-form :inline="true" label-position="top" :model="currentRow">
  796. <el-form-item label="是否符合RoHS/Meet RoHS Req"><el-input :value="displayYesNo(currentRow.isMeetRohsRequirement)" disabled style="width: 230px"></el-input></el-form-item>
  797. <el-form-item label="材料属性是否是AH/Is AH Grade"><el-input :value="displayYesNo(currentRow.isAhGrade)" disabled style="width: 180px"></el-input></el-form-item>
  798. <el-form-item label="HSF供应商等级/Supplier Class"><el-input :value="currentRow.hsfSupplierClassification || ''" disabled style="width: 200px"></el-input></el-form-item>
  799. </el-form>
  800. <el-form :inline="true" label-position="top" :model="currentRow">
  801. <el-form-item label="HSF审批人/HSF Approver"><el-input :value="currentRow.hsfApprover || ''" disabled style="width: 420px"></el-input></el-form-item>
  802. </el-form>
  803. <el-form :inline="true" label-position="top" :model="currentRow">
  804. <el-form-item label="Inform Related people"><el-input :value="currentRow.relatedPeople || ''" disabled style="width: 420px"></el-input></el-form-item>
  805. </el-form>
  806. <el-form :inline="true" label-position="top" :model="currentRow">
  807. <el-form-item label="Fiber报告信息/Fiber Information" style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.fiberInformation || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
  808. </el-form>
  809. <el-form v-if="shouldShowHsfStandard(currentRow.endCustomer)" :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
  810. <el-form-item label="HSF标准/HSF Standard" style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.hsfStandard || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
  811. </el-form>
  812. </div>
  813. </el-tab-pane>
  814. <el-tab-pane label="NPD 信息" name="npdInfo">
  815. <div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
  816. <el-form :inline="true" label-position="top" :model="currentRow">
  817. <el-form-item label="现有材料不同规格/Same Material Diff Size"><el-input :value="displayYesNo(currentRow.isSameMaterialDiffSize)" disabled style="width: 205px"></el-input></el-form-item>
  818. </el-form>
  819. <el-form :inline="true" label-position="top" :model="currentRow">
  820. <el-form-item label="材料描述/Material Desc." style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.materialDesc || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
  821. </el-form>
  822. <el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
  823. <el-form-item label="备注说明/NPD Remark" style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.npdRemark || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
  824. </el-form>
  825. <el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
  826. <el-form-item label="TDS属性/TDS Property" style="display: block;">
  827. <oss-components
  828. :save-visible="authFileSave"
  829. :download-visible="authFileDownLoad"
  830. :remove-visible="authFileRemove"
  831. :preview-visible="authFilePreview"
  832. :disabled="true"
  833. label="序列号"
  834. :height="180"
  835. style="margin-top: 2px"
  836. :columns="tdsFileColumnList"
  837. :order-ref1="currentRow.site || ''"
  838. :order-ref2="currentRow.referenceNo || ''"
  839. order-ref3="tdsProperty">
  840. </oss-components>
  841. </el-form-item>
  842. </el-form>
  843. </div>
  844. </el-tab-pane>
  845. <el-tab-pane label="材料信息" name="materialInfo">
  846. <div :style="{height: secondHeight + 'px'}" style="overflow-y: auto;">
  847. <el-table
  848. class="rohs-material-table"
  849. border
  850. :data="currentRow.materialList || []"
  851. :height="secondHeight"
  852. style="width: 100%">
  853. <el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
  854. <el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="150" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  855. <el-table-column prop="partDesc" label="描述/Part Desc." min-width="250" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  856. <el-table-column prop="partStatus" label="状态/Part Status" min-width="100" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  857. </el-table>
  858. </div>
  859. </el-tab-pane>
  860. <el-tab-pane label="附件信息" name="attachment">
  861. <oss-components
  862. :save-visible="authFileSave"
  863. :download-visible="authFileDownLoad"
  864. :remove-visible="authFileRemove"
  865. :preview-visible="authFilePreview"
  866. :disabled="currentRow.status === '已完成'"
  867. label="序列号"
  868. :height="secondHeight - 25"
  869. style="margin-top: 2px"
  870. :columns="fileColumnList"
  871. :order-ref1="currentRow.site"
  872. :order-ref2="currentRow.referenceNo"
  873. order-ref3="rohsAttachment">
  874. </oss-components>
  875. </el-tab-pane>
  876. <el-tab-pane label="审批信息" name="approvalInformation">
  877. <approval-information v-model:data-list="approvalList" :height="secondHeight"></approval-information>
  878. </el-tab-pane>
  879. </el-tabs>
  880. <ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
  881. </div>
  882. </template>
  883. <script>
  884. import * as api from '@/api/rohs/rohs'
  885. import { checkSuperAdmin } from "@/api/changeManagement/changeManagement"
  886. import { verifyData } from "@/api/chooselist/chooselist.js"
  887. import { searchProjectInfoList } from "@/api/quotation/quotationInformation.js"
  888. import { queryCustomer } from "@/api/customer/customerInformation"
  889. import { queryProjectByCustomer } from "@/api/project/project"
  890. import uploadFileList from '../common/uploadFileList'
  891. import ossComponents from '../oss/ossComponents.vue'
  892. import ChooseList from '@/views/modules/common/Chooselist'
  893. import DictDataSelect from "../sys/dict-data-select.vue"
  894. import ApprovalInformation from "../changeManagement/approvalInformation.vue"
  895. export default {
  896. components: {
  897. uploadFileList,
  898. ossComponents,
  899. ChooseList,
  900. DictDataSelect,
  901. ApprovalInformation
  902. },
  903. data () {
  904. return {
  905. searchData: {
  906. site: this.$store.state.user.site,
  907. referenceNo: '',
  908. status: '',
  909. currentApprover: '',
  910. nodeId: ''
  911. },
  912. dataList: [],
  913. pageIndex: 1,
  914. pageSize: 20,
  915. totalPage: 0,
  916. dataListLoading: false,
  917. activeTable: 'basicInfo',
  918. menuId: '108006', // 暂定ROHS菜单ID
  919. authSearch: false,
  920. authUpdate: false,
  921. authIssue: false,
  922. authSubmit: false,
  923. authReject: false,
  924. authFileSave: false,
  925. authFileDownLoad: false,
  926. authFileRemove: false,
  927. authFilePreview: false,
  928. authDataEntry: false,
  929. authDelete: false,
  930. superAdmin: false,
  931. createBy2: this.$store.state.user.name,
  932. height: 400,
  933. secondHeight: 200,
  934. currentRow: {},
  935. fileColumnList: [
  936. {
  937. columnProp: 'fileName',
  938. headerAlign: 'center',
  939. align: 'center',
  940. columnLabel: '文件名称',
  941. columnHidden: false,
  942. columnImage: false,
  943. columnSortable: false,
  944. status: true,
  945. fixed: '',
  946. columnWidth: 140
  947. },
  948. {
  949. columnProp: 'fileRemark',
  950. headerAlign: 'center',
  951. align: 'center',
  952. columnLabel: '备注',
  953. columnHidden: false,
  954. columnImage: false,
  955. columnSortable: false,
  956. status: true,
  957. fixed: '',
  958. columnWidth: 200
  959. },
  960. {
  961. columnProp: 'createDate',
  962. headerAlign: 'center',
  963. align: 'center',
  964. columnLabel: '上传时间',
  965. columnHidden: false,
  966. columnImage: false,
  967. columnSortable: false,
  968. status: true,
  969. fixed: '',
  970. columnWidth: 150
  971. },
  972. {
  973. columnProp: 'createBy',
  974. headerAlign: 'center',
  975. align: 'center',
  976. columnLabel: '上传人',
  977. columnHidden: false,
  978. columnImage: false,
  979. columnSortable: false,
  980. status: true,
  981. fixed: '',
  982. columnWidth: 120
  983. }
  984. ],
  985. tdsFileColumnList: [
  986. {
  987. columnProp: 'fileNo',
  988. headerAlign: 'center',
  989. align: 'center',
  990. columnLabel: '文件编码',
  991. columnHidden: false,
  992. columnImage: false,
  993. columnSortable: false,
  994. status: true,
  995. fixed: '',
  996. columnWidth: 130
  997. },
  998. {
  999. columnProp: 'rev',
  1000. headerAlign: 'center',
  1001. align: 'center',
  1002. columnLabel: '版本号',
  1003. columnHidden: false,
  1004. columnImage: false,
  1005. columnSortable: false,
  1006. status: true,
  1007. fixed: '',
  1008. columnWidth: 90
  1009. },
  1010. {
  1011. columnProp: 'fileName',
  1012. headerAlign: 'center',
  1013. align: 'center',
  1014. columnLabel: '文件名称',
  1015. columnHidden: false,
  1016. columnImage: false,
  1017. columnSortable: false,
  1018. status: true,
  1019. fixed: '',
  1020. columnWidth: 160
  1021. },
  1022. {
  1023. columnProp: 'fileRemark',
  1024. headerAlign: 'center',
  1025. align: 'center',
  1026. columnLabel: '备注',
  1027. columnHidden: false,
  1028. columnImage: false,
  1029. columnSortable: false,
  1030. status: true,
  1031. fixed: '',
  1032. columnWidth: 180
  1033. },
  1034. {
  1035. columnProp: 'createDate',
  1036. headerAlign: 'center',
  1037. align: 'center',
  1038. columnLabel: '上传时间',
  1039. columnHidden: false,
  1040. columnImage: false,
  1041. columnSortable: false,
  1042. status: true,
  1043. fixed: '',
  1044. columnWidth: 150
  1045. },
  1046. {
  1047. columnProp: 'invalidationTime',
  1048. headerAlign: 'center',
  1049. align: 'center',
  1050. columnLabel: '失效时间',
  1051. columnHidden: false,
  1052. columnImage: false,
  1053. columnSortable: false,
  1054. status: true,
  1055. fixed: '',
  1056. columnWidth: 150
  1057. },
  1058. {
  1059. columnProp: 'createBy',
  1060. headerAlign: 'center',
  1061. align: 'center',
  1062. columnLabel: '上传人',
  1063. columnHidden: false,
  1064. columnImage: false,
  1065. columnSortable: false,
  1066. status: true,
  1067. fixed: '',
  1068. columnWidth: 120
  1069. }
  1070. ],
  1071. modalFlag: false,
  1072. uploadDialog: false,
  1073. chooseProjectListFlag: false,
  1074. projectMaterialDialogFlag: false,
  1075. searchProjectData: {
  1076. site: '',
  1077. projectId: undefined,
  1078. projectName: undefined,
  1079. customerId: undefined,
  1080. },
  1081. projectMaterialSearchData: {
  1082. finalPartNo: '',
  1083. partDesc: '',
  1084. partStatus: ''
  1085. },
  1086. projectMaterialList: [],
  1087. projectMaterialSelections: [],
  1088. materialSelections: [],
  1089. projectMaterialPageIndex: 1,
  1090. projectMaterialPageSize: 20,
  1091. projectMaterialTotal: 0,
  1092. projectMaterialLoading: false,
  1093. nodeOptions: [],
  1094. projectList: [],
  1095. hsfApproverOptionList: [],
  1096. hsfApproverDisplayList: [],
  1097. hsfApproverSelectionCache: [],
  1098. hsfApproverFlag: false,
  1099. hsfApproverSearchData: {
  1100. operatorId: '',
  1101. operatorName: ''
  1102. },
  1103. fileList: [],
  1104. approvalList: [],
  1105. plmRohsAuthorityArr: [],
  1106. nodeAuthorityLoaded: false,
  1107. isEditMode: false,
  1108. modalTitle: 'RoHs 新增',
  1109. activeName: 'basicInfo',
  1110. showModalFlag: false,
  1111. submitModalFlag: false,
  1112. rohsRemarkFlag: false,
  1113. rejectOpinion: '',
  1114. submitLoading: false,
  1115. rohsRemarkForm: {
  1116. remark: ''
  1117. },
  1118. modalData: {
  1119. site: 'DEFAULT',
  1120. referenceNo: '',
  1121. applicant: '',
  1122. pm: '',
  1123. pmName: '',
  1124. applicationDate: '',
  1125. process: '',
  1126. plannedMassProductionDate: '',
  1127. color: '',
  1128. vendorCode: '',
  1129. vendorMaterialCode: '',
  1130. materialClassify: '',
  1131. otherMaterialClassify: '',
  1132. materialUseFor: '',
  1133. endCustomer: '',
  1134. projectId: '',
  1135. commGroup1: '',
  1136. commGroup1Desc: '',
  1137. commGroup2: '',
  1138. commGroup2Desc: '',
  1139. commGroup3: '',
  1140. commGroup3Desc: '',
  1141. needCreateNumber: '',
  1142. npdEngineer: '',
  1143. materialValidityTime: '',
  1144. materialValidityComments: '',
  1145. needDeviation: '',
  1146. technicalPlan: '',
  1147. wmRequiredSpec: '',
  1148. isFiberMaterial: '',
  1149. materialThickness: '',
  1150. buyer: '',
  1151. expectReportTime: 0,
  1152. qualificationDocumentsNeeded: '',
  1153. qualificationDocumentsNeededList: [],
  1154. testReportIncludingItems: '',
  1155. testReportIncludingItemsList: [],
  1156. remark: '',
  1157. status: '',
  1158. sgsReportNumber: '',
  1159. expiredDate: '',
  1160. fiberInformation: '',
  1161. hsfStandard: '',
  1162. hsfApprover: '',
  1163. hsfApproverList: [],
  1164. relatedPeople: '',
  1165. buNo: '',
  1166. validUntilValue: 0,
  1167. validUntil: '',
  1168. isMeetRohsRequirement: '',
  1169. isAhGrade: '',
  1170. hsfSupplierClassification: '',
  1171. materialDesc: '',
  1172. npdRemark: '',
  1173. isSameMaterialDiffSize: '',
  1174. ifsPartNo: '',
  1175. materialList: [],
  1176. stepId: null,
  1177. rejectFlag: '',
  1178. rejectStepId: null,
  1179. createBy2: '',
  1180. isReject: 'Y',
  1181. tpProcessControl: 'N',
  1182. csProcessControl: 'N'
  1183. }
  1184. }
  1185. },
  1186. created () {
  1187. this.menuId = this.$route.meta.menuId
  1188. this.getButtonAuthData()
  1189. this.checkSuperAdmin()
  1190. },
  1191. mounted () {
  1192. this.fetchNodeOptions()
  1193. if (this.authSearch) {
  1194. this.getDataList()
  1195. }
  1196. this.$nextTick(() => {
  1197. this.height = window.innerHeight / 2 - 30
  1198. /*第二个表格高度的动态调整*/
  1199. this.secondHeight = window.innerHeight / 2 - 186
  1200. })
  1201. },
  1202. methods: {
  1203. fetchNodeOptions () {
  1204. if (!this.searchData.site || !this.menuId) {
  1205. this.nodeOptions = []
  1206. return
  1207. }
  1208. let params = {
  1209. site: this.searchData.site,
  1210. menuId: this.menuId
  1211. }
  1212. api.getNodeList(params).then(({data}) => {
  1213. if (data && data.code === 0 && Array.isArray(data.rows)) {
  1214. this.nodeOptions = data.rows
  1215. .filter(item => item && item.nodeId)
  1216. .map(item => ({
  1217. id: item.nodeId,
  1218. name: item.nodeName
  1219. }))
  1220. } else {
  1221. this.nodeOptions = []
  1222. }
  1223. }).catch(() => {
  1224. this.nodeOptions = []
  1225. })
  1226. },
  1227. loadNodeAuthority (site, stepId) {
  1228. if (!site || stepId === null || stepId === undefined || !this.menuId) {
  1229. this.plmRohsAuthorityArr = []
  1230. this.nodeAuthorityLoaded = true
  1231. return Promise.resolve()
  1232. }
  1233. this.nodeAuthorityLoaded = false
  1234. let params = {
  1235. site: site,
  1236. stepId: stepId,
  1237. menuId: this.menuId
  1238. }
  1239. return api.getRohsNodeAuthority(params).then(({data}) => {
  1240. if (data && data.code === 0 && data.rows) {
  1241. this.plmRohsAuthorityArr = data.rows.plm_rohs || []
  1242. } else {
  1243. this.plmRohsAuthorityArr = []
  1244. }
  1245. this.nodeAuthorityLoaded = true
  1246. }).catch(() => {
  1247. this.plmRohsAuthorityArr = []
  1248. this.nodeAuthorityLoaded = true
  1249. })
  1250. },
  1251. rohsFieldFlag (fieldId) {
  1252. if (!this.plmRohsAuthorityArr || this.plmRohsAuthorityArr.length === 0) {
  1253. return 'N'
  1254. }
  1255. let target = this.plmRohsAuthorityArr.find(item => item.fieldId === fieldId)
  1256. return target ? target.updateFlag : 'N'
  1257. },
  1258. isRohsFieldDisabled (fieldId) {
  1259. if (this.showModalFlag) {
  1260. return true
  1261. }
  1262. if (!this.isEditMode) {
  1263. return false
  1264. }
  1265. return this.rohsFieldFlag(fieldId) === 'N'
  1266. },
  1267. isRohsFieldDisabledWithFallback (primaryFieldId, fallbackFieldId) {
  1268. if (this.showModalFlag) {
  1269. return true
  1270. }
  1271. if (!this.isEditMode) {
  1272. return false
  1273. }
  1274. const primaryDisabled = this.rohsFieldFlag(primaryFieldId) === 'N'
  1275. if (!primaryDisabled) {
  1276. return false
  1277. }
  1278. return this.rohsFieldFlag(fallbackFieldId) === 'N'
  1279. },
  1280. isValidUntilValueDisabled () {
  1281. return this.isRohsFieldDisabledWithFallback('validUntilValue', 'validUntil')
  1282. },
  1283. isValidUntilUnitDisabled () {
  1284. return this.isRohsFieldDisabledWithFallback('validUntil', 'validUntilValue')
  1285. },
  1286. canEditRohsMaterial () {
  1287. return !this.showModalFlag
  1288. },
  1289. normalizeDateOnly (value) {
  1290. if (value === null || value === undefined || value === '') {
  1291. return ''
  1292. }
  1293. if (value instanceof Date && !Number.isNaN(value.getTime())) {
  1294. const year = value.getFullYear()
  1295. const month = String(value.getMonth() + 1).padStart(2, '0')
  1296. const day = String(value.getDate()).padStart(2, '0')
  1297. return year + '-' + month + '-' + day
  1298. }
  1299. const text = String(value).trim()
  1300. if (!text) {
  1301. return ''
  1302. }
  1303. if (text.includes('T')) {
  1304. return text.split('T')[0]
  1305. }
  1306. return text.length >= 10 ? text.substring(0, 10) : text
  1307. },
  1308. getCurrentDateString () {
  1309. return this.normalizeDateOnly(new Date())
  1310. },
  1311. normalizeValidUntilValue (value) {
  1312. if (value === null || value === undefined || value === '') {
  1313. return null
  1314. }
  1315. const parsed = Number.parseInt(value, 10)
  1316. if (Number.isNaN(parsed) || parsed <= 0) {
  1317. return null
  1318. }
  1319. return parsed
  1320. },
  1321. getValidUntilDisplay (value, unit) {
  1322. const normalizedValue = this.normalizeValidUntilValue(value)
  1323. const normalizedUnit = String(unit || '').trim()
  1324. if (normalizedValue && normalizedUnit) {
  1325. return normalizedValue + normalizedUnit
  1326. }
  1327. if (normalizedValue) {
  1328. return String(normalizedValue)
  1329. }
  1330. return normalizedUnit
  1331. },
  1332. getRohsSubmitFieldValue (fieldId) {
  1333. const fieldMapping = {
  1334. materialClassify: 'materialClassifyList',
  1335. qualificationDocumentsNeeded: 'qualificationDocumentsNeededList',
  1336. testReportIncludingItems: 'testReportIncludingItemsList',
  1337. hsfApprover: 'hsfApproverList'
  1338. }
  1339. const mappedField = fieldMapping[fieldId]
  1340. if (mappedField) {
  1341. return this.modalData[mappedField]
  1342. }
  1343. return this.modalData[fieldId]
  1344. },
  1345. isSubmitFieldEmpty (value) {
  1346. if (Array.isArray(value)) {
  1347. return value.length === 0
  1348. }
  1349. if (typeof value === 'string') {
  1350. return value.trim() === ''
  1351. }
  1352. return !value
  1353. },
  1354. validateSubmitRequiredFields () {
  1355. if (this.plmRohsAuthorityArr && this.plmRohsAuthorityArr.length > 0) {
  1356. let validUntilPairRequiredChecked = false
  1357. for (let i = 0; i < this.plmRohsAuthorityArr.length; i++) {
  1358. const fieldConfig = this.plmRohsAuthorityArr[i]
  1359. if (fieldConfig.required !== 'Y') {
  1360. continue
  1361. }
  1362. if (fieldConfig.fieldId === 'hsfStandard' && !this.shouldShowHsfStandard(this.modalData.endCustomer)) {
  1363. continue
  1364. }
  1365. if (fieldConfig.fieldId === 'validUntil' || fieldConfig.fieldId === 'validUntilValue') {
  1366. if (validUntilPairRequiredChecked) {
  1367. continue
  1368. }
  1369. const validUntilValue = this.normalizeValidUntilValue(this.modalData.validUntilValue)
  1370. this.$set(this.modalData, 'validUntilValue', validUntilValue)
  1371. if (this.isSubmitFieldEmpty(validUntilValue) || this.isSubmitFieldEmpty(this.modalData.validUntil)) {
  1372. this.$message.warning('有效期数值/单位不能为空!')
  1373. return false
  1374. }
  1375. validUntilPairRequiredChecked = true
  1376. continue
  1377. }
  1378. const value = this.getRohsSubmitFieldValue(fieldConfig.fieldId)
  1379. if (this.isSubmitFieldEmpty(value)) {
  1380. this.$message.warning((fieldConfig.fieldName || fieldConfig.fieldId) + '不能为空!')
  1381. return false
  1382. }
  1383. }
  1384. }
  1385. return true
  1386. },
  1387. validateValidUntilPair () {
  1388. const validUntilValue = this.normalizeValidUntilValue(this.modalData.validUntilValue)
  1389. const validUntilUnit = String(this.modalData.validUntil || '').trim()
  1390. this.$set(this.modalData, 'validUntilValue', validUntilValue)
  1391. this.$set(this.modalData, 'validUntil', validUntilUnit)
  1392. if (!validUntilValue && !validUntilUnit) {
  1393. return true
  1394. }
  1395. if (!validUntilValue) {
  1396. this.$message.warning('请填写有效期数值')
  1397. return false
  1398. }
  1399. if (!validUntilUnit) {
  1400. this.$message.warning('请选择有效期单位')
  1401. return false
  1402. }
  1403. return true
  1404. },
  1405. materialDialogHeaderCellStyle () {
  1406. return {
  1407. whiteSpace: 'nowrap',
  1408. wordBreak: 'keep-all'
  1409. }
  1410. },
  1411. displayYesNo (value) {
  1412. if (value === 'Y') {
  1413. return '是'
  1414. }
  1415. if (value === 'N') {
  1416. return '否'
  1417. }
  1418. return value || ''
  1419. },
  1420. getMultipleSelectTitle (value) {
  1421. if (!Array.isArray(value)) {
  1422. return ''
  1423. }
  1424. return value
  1425. .filter(item => item !== null && item !== undefined && String(item).trim() !== '')
  1426. .map(item => String(item).trim())
  1427. .join(';')
  1428. },
  1429. shouldShowHsfStandard (customerCode) {
  1430. return String(customerCode || '').trim().toUpperCase() === 'C00052'
  1431. },
  1432. normalizeHsfStandardByCustomer (formData) {
  1433. if (!formData) {
  1434. return
  1435. }
  1436. if (!this.shouldShowHsfStandard(formData.endCustomer)) {
  1437. this.$set(formData, 'hsfStandard', '')
  1438. }
  1439. },
  1440. syncHsfApproverFields () {
  1441. const sourceList = Array.isArray(this.modalData.hsfApproverList)
  1442. ? this.modalData.hsfApproverList
  1443. : []
  1444. const uniqueList = []
  1445. const seen = new Set()
  1446. sourceList.forEach(item => {
  1447. const value = String(item || '').trim()
  1448. if (!value || seen.has(value)) {
  1449. return
  1450. }
  1451. seen.add(value)
  1452. uniqueList.push(value)
  1453. })
  1454. this.$set(this.modalData, 'hsfApproverList', uniqueList)
  1455. this.$set(this.modalData, 'hsfApprover', uniqueList.join(';'))
  1456. if (!uniqueList.includes(this.modalData.relatedPeople)) {
  1457. this.$set(this.modalData, 'relatedPeople', '')
  1458. }
  1459. },
  1460. normalizeHsfApproverOptionList (rows) {
  1461. if (!Array.isArray(rows)) {
  1462. return []
  1463. }
  1464. return rows
  1465. .map(item => {
  1466. const operatorId = String(item.operatorId || item.operator_id || item.username || item.userName || '').trim()
  1467. const operatorName = String(item.operatorName || item.operator_name || item.userDisplay || item.user_display || '').trim()
  1468. if (!operatorId || !operatorName) {
  1469. return null
  1470. }
  1471. return {
  1472. operatorId,
  1473. operatorName
  1474. }
  1475. })
  1476. .filter(item => !!item)
  1477. },
  1478. filterHsfApproverOptions () {
  1479. const operatorIdKeyword = String(this.hsfApproverSearchData.operatorId || '').trim().toUpperCase()
  1480. const operatorNameKeyword = String(this.hsfApproverSearchData.operatorName || '').trim().toUpperCase()
  1481. this.hsfApproverDisplayList = (this.hsfApproverOptionList || []).filter(item => {
  1482. const operatorId = String(item.operatorId || '').toUpperCase()
  1483. const operatorName = String(item.operatorName || '').toUpperCase()
  1484. const matchOperatorId = !operatorIdKeyword || operatorId.includes(operatorIdKeyword)
  1485. const matchOperatorName = !operatorNameKeyword || operatorName.includes(operatorNameKeyword)
  1486. return matchOperatorId && matchOperatorName
  1487. })
  1488. },
  1489. openHsfApproverChooseModal () {
  1490. if (this.isRohsFieldDisabled('hsfApprover')) {
  1491. return
  1492. }
  1493. if (!this.modalData || !this.modalData.projectId) {
  1494. this.$message.warning('请先选择项目编码')
  1495. return
  1496. }
  1497. this.loadHsfApproverByCurrentProject(false).then(() => {
  1498. if (!this.hsfApproverOptionList || this.hsfApproverOptionList.length === 0) {
  1499. this.$message.warning('未查询到可选HSF审批人')
  1500. return
  1501. }
  1502. this.hsfApproverFlag = true
  1503. })
  1504. },
  1505. openHsfApproverDialog () {
  1506. this.hsfApproverSearchData = {
  1507. operatorId: '',
  1508. operatorName: ''
  1509. }
  1510. this.filterHsfApproverOptions()
  1511. const selectedNameSet = new Set(
  1512. (this.modalData.hsfApproverList || [])
  1513. .map(item => String(item || '').trim())
  1514. .filter(item => !!item)
  1515. )
  1516. const selectedRows = (this.hsfApproverOptionList || []).filter(item => selectedNameSet.has(item.operatorName))
  1517. this.hsfApproverSelectionCache = JSON.parse(JSON.stringify(selectedRows))
  1518. this.$nextTick(() => {
  1519. if (!this.$refs.hsfApproverTable) {
  1520. return
  1521. }
  1522. this.$refs.hsfApproverTable.clearSelection()
  1523. selectedRows.forEach(item => {
  1524. this.$refs.hsfApproverTable.toggleRowSelection(item, true)
  1525. })
  1526. })
  1527. },
  1528. closeHsfApproverDialog () {
  1529. this.hsfApproverSelectionCache = []
  1530. },
  1531. handleHsfApproverSelectionChange (rows) {
  1532. this.hsfApproverSelectionCache = rows || []
  1533. },
  1534. handleHsfApproverTableClick (row, column, event, tableRef) {
  1535. if (this.$refs[tableRef]) {
  1536. this.$refs[tableRef].toggleRowSelection(row)
  1537. }
  1538. },
  1539. saveHsfApproverChooseModal () {
  1540. const selectedNames = (this.hsfApproverSelectionCache || [])
  1541. .map(item => String(item.operatorName || '').trim())
  1542. .filter(item => !!item)
  1543. this.$set(this.modalData, 'hsfApproverList', selectedNames)
  1544. this.syncHsfApproverFields()
  1545. this.hsfApproverFlag = false
  1546. },
  1547. clearHsfApproverSelection () {
  1548. this.$set(this.modalData, 'hsfApproverList', [])
  1549. this.syncHsfApproverFields()
  1550. },
  1551. clearHsfApproverFields (clearBuNo = false) {
  1552. if (clearBuNo) {
  1553. this.$set(this.modalData, 'buNo', '')
  1554. }
  1555. this.hsfApproverOptionList = []
  1556. this.hsfApproverDisplayList = []
  1557. this.hsfApproverSelectionCache = []
  1558. this.hsfApproverSearchData = {
  1559. operatorId: '',
  1560. operatorName: ''
  1561. }
  1562. this.$set(this.modalData, 'hsfApproverList', [])
  1563. this.$set(this.modalData, 'hsfApprover', '')
  1564. this.$set(this.modalData, 'relatedPeople', '')
  1565. },
  1566. loadHsfApproverByCurrentProject (forceSelectAll = false) {
  1567. if (!this.modalData || !this.modalData.site || !this.modalData.projectId) {
  1568. if (forceSelectAll) {
  1569. this.$message.warning('请先选择项目编码')
  1570. }
  1571. this.hsfApproverOptionList = []
  1572. this.hsfApproverDisplayList = []
  1573. this.hsfApproverSelectionCache = []
  1574. if (forceSelectAll) {
  1575. this.clearHsfApproverFields(false)
  1576. }
  1577. return Promise.resolve()
  1578. }
  1579. const queryByBu = (buNo) => {
  1580. if (!buNo) {
  1581. if (forceSelectAll) {
  1582. this.$message.warning('当前项目未维护BU,无法查询HSF审批人')
  1583. }
  1584. this.hsfApproverOptionList = []
  1585. this.hsfApproverDisplayList = []
  1586. this.hsfApproverSelectionCache = []
  1587. if (forceSelectAll) {
  1588. this.clearHsfApproverFields(false)
  1589. }
  1590. return Promise.resolve()
  1591. }
  1592. const params = {
  1593. site: this.modalData.site,
  1594. buNo: buNo,
  1595. roleNo: 'R015'
  1596. }
  1597. return api.searchBmUser(params).then(({data}) => {
  1598. if (data && data.code === 0 && Array.isArray(data.rows)) {
  1599. this.hsfApproverOptionList = this.normalizeHsfApproverOptionList(data.rows)
  1600. this.filterHsfApproverOptions()
  1601. this.hsfApproverSelectionCache = []
  1602. if (forceSelectAll) {
  1603. const defaultSelectedNames = this.hsfApproverOptionList.map(item => item.operatorName).filter(item => item)
  1604. this.$set(this.modalData, 'hsfApproverList', defaultSelectedNames)
  1605. }
  1606. this.syncHsfApproverFields()
  1607. } else {
  1608. this.hsfApproverOptionList = []
  1609. this.hsfApproverDisplayList = []
  1610. this.hsfApproverSelectionCache = []
  1611. if (forceSelectAll) {
  1612. this.clearHsfApproverFields(false)
  1613. }
  1614. }
  1615. }).catch(() => {
  1616. this.hsfApproverOptionList = []
  1617. this.hsfApproverDisplayList = []
  1618. this.hsfApproverSelectionCache = []
  1619. if (forceSelectAll) {
  1620. this.clearHsfApproverFields(false)
  1621. }
  1622. })
  1623. }
  1624. if (this.modalData.buNo) {
  1625. return queryByBu(this.modalData.buNo)
  1626. }
  1627. const projectParams = {
  1628. site: this.modalData.site,
  1629. projectId: this.modalData.projectId
  1630. }
  1631. if (this.modalData.endCustomer) {
  1632. projectParams.customerId = this.modalData.endCustomer
  1633. }
  1634. return queryProjectByCustomer(projectParams).then(({data}) => {
  1635. if (data && data.code === 0 && data.rows && data.rows.length === 1) {
  1636. const project = data.rows[0]
  1637. this.$set(this.modalData, 'buNo', project.buNo || project.bu_no || '')
  1638. return queryByBu(this.modalData.buNo)
  1639. } else {
  1640. if (forceSelectAll) {
  1641. this.clearHsfApproverFields(false)
  1642. }
  1643. }
  1644. }).catch(() => {
  1645. if (forceSelectAll) {
  1646. this.clearHsfApproverFields(false)
  1647. }
  1648. })
  1649. },
  1650. isCurrentApprover () {
  1651. return this.superAdmin || (this.modalData.createBy2 && this.modalData.createBy2.split(';').includes(this.createBy2))
  1652. },
  1653. canSaveAction () {
  1654. return !this.showModalFlag && (this.modalData.status === '草稿' || (this.modalData.status === '审批中' && this.isCurrentApprover()))
  1655. },
  1656. canAgreeAction () {
  1657. return this.authSubmit && this.isCurrentApprover() && this.modalData.status === '审批中' && this.modalData.tpProcessControl !== 'Y' && this.modalData.csProcessControl !== 'Y'
  1658. },
  1659. canRejectAction () {
  1660. return this.authReject && this.isCurrentApprover() && this.modalData.status === '审批中' && this.modalData.isReject === 'Y'
  1661. },
  1662. hasPersistedRohsRecord () {
  1663. return !!(this.modalData && this.modalData.site && this.modalData.referenceNo && !String(this.modalData.referenceNo).startsWith('TEMP-'))
  1664. },
  1665. openRohsRemarkDialog () {
  1666. this.$set(this.rohsRemarkForm, 'remark', this.modalData.remark || '')
  1667. this.rohsRemarkFlag = true
  1668. },
  1669. refreshRohsRemark () {
  1670. if (!this.hasPersistedRohsRecord()) {
  1671. this.$set(this.rohsRemarkForm, 'remark', this.modalData.remark || '')
  1672. return
  1673. }
  1674. api.getRohsDetail(this.modalData.site, this.modalData.referenceNo).then(({data}) => {
  1675. if (data && data.code === 0 && data.data) {
  1676. this.$set(this.rohsRemarkForm, 'remark', data.data.remark || '')
  1677. } else {
  1678. this.$message.error((data && data.msg) || '刷新失败')
  1679. }
  1680. }).catch(() => {
  1681. this.$message.error('刷新失败')
  1682. })
  1683. },
  1684. saveRohsRemark () {
  1685. const remark = this.rohsRemarkForm.remark || ''
  1686. if (!this.hasPersistedRohsRecord()) {
  1687. this.$set(this.modalData, 'remark', remark)
  1688. this.rohsRemarkFlag = false
  1689. this.$message.success('暂存成功,保存单据后写入数据库')
  1690. return
  1691. }
  1692. const params = {
  1693. site: this.modalData.site,
  1694. referenceNo: this.modalData.referenceNo,
  1695. remark: remark
  1696. }
  1697. api.updateRohsRemark(params).then(({data}) => {
  1698. if (data && data.code === 0) {
  1699. this.$set(this.modalData, 'remark', remark)
  1700. if (this.currentRow && this.currentRow.site === this.modalData.site && this.currentRow.referenceNo === this.modalData.referenceNo) {
  1701. this.$set(this.currentRow, 'remark', remark)
  1702. }
  1703. const target = (this.dataList || []).find(item => item.site === this.modalData.site && item.referenceNo === this.modalData.referenceNo)
  1704. if (target) {
  1705. this.$set(target, 'remark', remark)
  1706. }
  1707. this.rohsRemarkFlag = false
  1708. this.$message.success('操作成功')
  1709. } else {
  1710. this.$message.error((data && data.msg) || '保存失败')
  1711. }
  1712. }).catch(() => {
  1713. this.$message.error('保存失败')
  1714. })
  1715. },
  1716. loadModalButtonCondition () {
  1717. if (!this.modalData.site || !this.modalData.referenceNo || this.modalData.status !== '审批中') {
  1718. this.$set(this.modalData, 'createBy2', '')
  1719. this.$set(this.modalData, 'isReject', 'Y')
  1720. this.$set(this.modalData, 'tpProcessControl', 'N')
  1721. this.$set(this.modalData, 'csProcessControl', 'N')
  1722. return
  1723. }
  1724. let params = {
  1725. site: this.modalData.site,
  1726. referenceNo: this.modalData.referenceNo
  1727. }
  1728. api.getRohsButtonCondition(params).then(({data}) => {
  1729. if (data && data.code === 0 && data.data) {
  1730. this.$set(this.modalData, 'createBy2', data.data.createBy2 || '')
  1731. this.$set(this.modalData, 'isReject', data.data.isReject || 'Y')
  1732. this.$set(this.modalData, 'tpProcessControl', data.data.tpProcessControl || 'N')
  1733. this.$set(this.modalData, 'csProcessControl', data.data.csProcessControl || 'N')
  1734. } else {
  1735. this.$set(this.modalData, 'createBy2', '')
  1736. this.$set(this.modalData, 'isReject', 'Y')
  1737. this.$set(this.modalData, 'tpProcessControl', 'N')
  1738. this.$set(this.modalData, 'csProcessControl', 'N')
  1739. }
  1740. }).catch(() => {
  1741. this.$set(this.modalData, 'createBy2', '')
  1742. this.$set(this.modalData, 'isReject', 'Y')
  1743. this.$set(this.modalData, 'tpProcessControl', 'N')
  1744. this.$set(this.modalData, 'csProcessControl', 'N')
  1745. })
  1746. },
  1747. // 列表行选中变色
  1748. rowStyle ({row}) {
  1749. if (this.currentRow && this.currentRow.referenceNo === row.referenceNo) {
  1750. return { 'background-color': '#E8F7F6', cursor: 'pointer' }
  1751. }
  1752. },
  1753. // 获取按钮的权限数据
  1754. getButtonAuthData () {
  1755. this.authSearch = this.isAuth(this.menuId+":search")
  1756. this.authUpdate = this.isAuth(this.menuId+":update")
  1757. this.authIssue = this.isAuth(this.menuId+":issue")
  1758. this.authSubmit = this.isAuth(this.menuId+":submit")
  1759. this.authReject = this.isAuth(this.menuId+":reject")
  1760. this.authFileSave = this.isAuth(this.menuId+":fileSave")
  1761. this.authFileDownLoad = this.isAuth(this.menuId+":fileDownLoad")
  1762. this.authFileRemove = this.isAuth(this.menuId+":fileRemove")
  1763. this.authFilePreview = this.isAuth(this.menuId+":filePreview")
  1764. this.authDataEntry = this.isAuth(this.menuId+":dataEntry")
  1765. this.authDelete = this.isAuth(this.menuId+":delete")
  1766. },
  1767. // 校验是否为超级管理员
  1768. checkSuperAdmin () {
  1769. checkSuperAdmin().then(({data}) => {
  1770. this.superAdmin = data.superAdmin
  1771. })
  1772. },
  1773. changeClickRow (row, column, event) {
  1774. // 通过接口或直接赋值,让底部的页签显示当前选中行的数据
  1775. api.getRohsDetail(row.site, row.referenceNo).then(({data}) => {
  1776. if (data && data.code === 0) {
  1777. this.currentRow = data.data || {}
  1778. } else {
  1779. this.currentRow = row || {}
  1780. }
  1781. if (!Array.isArray(this.currentRow.materialList)) {
  1782. this.$set(this.currentRow, 'materialList', [])
  1783. }
  1784. this.fillDisplayFields(this.currentRow, row || {})
  1785. this.refreshCurrentTabTable()
  1786. }).catch(() => {
  1787. this.currentRow = row || {}
  1788. if (!Array.isArray(this.currentRow.materialList)) {
  1789. this.$set(this.currentRow, 'materialList', [])
  1790. }
  1791. this.fillDisplayFields(this.currentRow)
  1792. this.refreshCurrentTabTable()
  1793. })
  1794. },
  1795. currentChange (val) {
  1796. this.currentRow = val || {}
  1797. if (val) {
  1798. if (!Array.isArray(this.currentRow.materialList)) {
  1799. this.$set(this.currentRow, 'materialList', [])
  1800. }
  1801. this.fillDisplayFields(this.currentRow)
  1802. this.refreshCurrentTabTable()
  1803. } else {
  1804. this.approvalList = []
  1805. }
  1806. },
  1807. fillDisplayFields (target, fallbackData = {}) {
  1808. if (!target) {
  1809. return
  1810. }
  1811. const fields = ['applicantName', 'pmName', 'npdEngineerName', 'technicalPlanName', 'buyerName', 'endCustomerName', 'projectName', 'commGroup1Desc', 'commGroup2Desc', 'commGroup3Desc']
  1812. fields.forEach(field => {
  1813. const value = target[field] || fallbackData[field] || ''
  1814. this.$set(target, field, value)
  1815. })
  1816. this.$set(target, 'endCustomerFlag', !!target.endCustomerFlag)
  1817. this.$set(target, 'projectIdFlag', !!target.projectIdFlag)
  1818. const validUntilValue = target.validUntilValue !== undefined && target.validUntilValue !== null && target.validUntilValue !== ''
  1819. ? target.validUntilValue
  1820. : fallbackData.validUntilValue
  1821. this.$set(target, 'validUntilValue', this.normalizeValidUntilValue(validUntilValue))
  1822. const applicationDate = target.applicationDate || fallbackData.applicationDate || ''
  1823. const plannedMassProductionDate = target.plannedMassProductionDate || fallbackData.plannedMassProductionDate || ''
  1824. this.$set(target, 'applicationDate', this.normalizeDateOnly(applicationDate))
  1825. this.$set(target, 'plannedMassProductionDate', this.normalizeDateOnly(plannedMassProductionDate))
  1826. },
  1827. refreshCurrentTabTable () {
  1828. if (this.activeTable === 'approvalInformation') {
  1829. this.getApprovalList()
  1830. }
  1831. },
  1832. getApprovalList () {
  1833. if (!this.currentRow || !this.currentRow.site || !this.currentRow.referenceNo) {
  1834. this.approvalList = []
  1835. return
  1836. }
  1837. let params = {
  1838. site: this.currentRow.site,
  1839. menuId: this.menuId,
  1840. documentNo: this.currentRow.referenceNo
  1841. }
  1842. api.getRohsApprovalList(params).then(({data}) => {
  1843. if (data && data.code === 0) {
  1844. this.approvalList = data.rows || []
  1845. } else {
  1846. this.approvalList = []
  1847. }
  1848. }).catch(() => {
  1849. this.approvalList = []
  1850. })
  1851. },
  1852. // 获取列表
  1853. getDataList () {
  1854. if (!this.authSearch) {
  1855. this.dataList = []
  1856. this.totalPage = 0
  1857. this.currentRow = {}
  1858. this.approvalList = []
  1859. return
  1860. }
  1861. this.dataListLoading = true
  1862. let params = {
  1863. page: this.pageIndex,
  1864. limit: this.pageSize,
  1865. site: this.$store.state.user.site,
  1866. menuId: this.menuId,
  1867. referenceNo: this.searchData.referenceNo,
  1868. status: this.searchData.status,
  1869. currentApprover: this.searchData.currentApprover,
  1870. nodeId: this.searchData.nodeId
  1871. }
  1872. api.getRohsList(params).then(({data}) => {
  1873. if (data && data.code === 0) {
  1874. const list = data.page.list || []
  1875. this.dataList = list.map(item => {
  1876. return {
  1877. applicantName: '',
  1878. pmName: '',
  1879. npdEngineerName: '',
  1880. technicalPlanName: '',
  1881. buyerName: '',
  1882. endCustomerName: '',
  1883. projectName: '',
  1884. nodeId: '',
  1885. nodeName: '',
  1886. currentApprover: '',
  1887. commGroup1Desc: '',
  1888. commGroup2Desc: '',
  1889. commGroup3Desc: '',
  1890. ...item
  1891. }
  1892. })
  1893. this.totalPage = data.page.totalCount
  1894. this.$nextTick(() => {
  1895. if (this.$refs.rohsTable && this.dataList.length > 0) {
  1896. this.$refs.rohsTable.setCurrentRow(this.dataList[0])
  1897. } else if (this.$refs.rohsTable) {
  1898. this.$refs.rohsTable.setCurrentRow()
  1899. }
  1900. })
  1901. } else {
  1902. this.dataList = []
  1903. this.totalPage = 0
  1904. this.currentRow = {}
  1905. this.approvalList = []
  1906. }
  1907. this.dataListLoading = false
  1908. }).catch(() => {
  1909. this.currentRow = {}
  1910. this.approvalList = []
  1911. this.dataListLoading = false
  1912. })
  1913. },
  1914. // 分页
  1915. sizeChangeHandle (val) {
  1916. this.pageSize = val
  1917. this.pageIndex = 1
  1918. this.getDataList()
  1919. },
  1920. currentChangeHandle (val) {
  1921. this.pageIndex = val
  1922. this.getDataList()
  1923. },
  1924. // 搜索条件点击
  1925. searchHandle () {
  1926. if (!this.authSearch) {
  1927. return
  1928. }
  1929. this.pageIndex = 1
  1930. this.getDataList()
  1931. },
  1932. // 单选可取消
  1933. radioClick (field, value) {
  1934. if (this.modalData[field] === value) {
  1935. this.modalData[field] = ''
  1936. } else {
  1937. this.modalData[field] = value
  1938. }
  1939. },
  1940. // 导出
  1941. exportHandle () {
  1942. if (!this.authSearch) {
  1943. return
  1944. }
  1945. this.$message.info('导出功能开发中')
  1946. },
  1947. // 新增 / 修改
  1948. addOrUpdateHandle (row) {
  1949. if (!row && !this.authUpdate) {
  1950. this.$message.warning('没有新增权限')
  1951. return
  1952. }
  1953. if (row && !this.authUpdate && !this.authDataEntry) {
  1954. this.$message.warning('没有编辑权限')
  1955. return
  1956. }
  1957. this.modalFlag = true
  1958. this.activeName = 'basicInfo'
  1959. this.fileList = []
  1960. this.uploadDialog = false
  1961. this.submitModalFlag = false
  1962. this.rohsRemarkFlag = false
  1963. this.rejectOpinion = ''
  1964. this.rohsRemarkForm = {
  1965. remark: ''
  1966. }
  1967. this.projectMaterialDialogFlag = false
  1968. this.projectMaterialSelections = []
  1969. this.materialSelections = []
  1970. this.hsfApproverOptionList = []
  1971. this.hsfApproverDisplayList = []
  1972. this.hsfApproverSelectionCache = []
  1973. this.hsfApproverSearchData = {
  1974. operatorId: '',
  1975. operatorName: ''
  1976. }
  1977. this.hsfApproverFlag = false
  1978. this.plmRohsAuthorityArr = []
  1979. this.nodeAuthorityLoaded = !row
  1980. this.isEditMode = !!row
  1981. this.projectMaterialPageIndex = 1
  1982. this.projectMaterialTotal = 0
  1983. this.projectMaterialList = []
  1984. this.projectMaterialSearchData = {
  1985. finalPartNo: '',
  1986. partDesc: '',
  1987. partStatus: ''
  1988. }
  1989. this.showModalFlag = !!(row && (row.status === '已完成' || !this.authUpdate))
  1990. if (row) {
  1991. this.modalTitle = 'RoHs 编辑'
  1992. api.getRohsDetail(row.site, row.referenceNo).then(({data}) => {
  1993. if (data && data.code === 0) {
  1994. this.modalData = data.data || {}
  1995. this.$set(this.modalData, 'qualificationDocumentsNeededList', this.modalData.qualificationDocumentsNeeded ? this.modalData.qualificationDocumentsNeeded.split(';').filter(item => item) : [])
  1996. this.$set(this.modalData, 'testReportIncludingItemsList', this.modalData.testReportIncludingItems ? this.modalData.testReportIncludingItems.split(';').filter(item => item) : [])
  1997. this.$set(this.modalData, 'materialClassifyList', this.modalData.materialClassify ? this.modalData.materialClassify.split(';').filter(item => item) : [])
  1998. this.$set(this.modalData, 'materialList', Array.isArray(this.modalData.materialList) ? this.modalData.materialList : [])
  1999. this.$set(this.modalData, 'hsfApproverList', this.modalData.hsfApprover ? this.modalData.hsfApprover.split(';').filter(item => item) : [])
  2000. this.$set(this.modalData, 'buNo', this.modalData.buNo || '')
  2001. this.$set(this.modalData, 'validUntilValue', this.normalizeValidUntilValue(this.modalData.validUntilValue))
  2002. this.syncHsfApproverFields()
  2003. this.fillDisplayFields(this.modalData, row || {})
  2004. // 编辑时不允许修改最终客户和项目编码
  2005. this.$set(this.modalData, 'endCustomerFlag', true)
  2006. this.$set(this.modalData, 'projectIdFlag', true)
  2007. this.$set(this.modalData, 'createBy2', '')
  2008. this.$set(this.modalData, 'isReject', 'Y')
  2009. this.$set(this.modalData, 'tpProcessControl', 'N')
  2010. this.$set(this.modalData, 'csProcessControl', 'N')
  2011. this.loadModalButtonCondition()
  2012. this.loadHsfApproverByCurrentProject(false)
  2013. this.loadNodeAuthority(this.modalData.site || row.site, this.modalData.stepId !== null && this.modalData.stepId !== undefined ? this.modalData.stepId : (row.stepId !== null && row.stepId !== undefined ? row.stepId : 10))
  2014. }
  2015. }).catch(() => {
  2016. this.loadNodeAuthority(row.site, row.stepId !== null && row.stepId !== undefined ? row.stepId : 10)
  2017. })
  2018. } else {
  2019. this.modalTitle = 'RoHs 新增'
  2020. this.showModalFlag = false
  2021. // 生成一个临时ID用于附件上传绑定
  2022. const tempReferenceNo = 'TEMP-' + new Date().getTime() + '-' + Math.floor(Math.random() * 1000)
  2023. this.modalData = {
  2024. site: this.$store.state.user.site,
  2025. referenceNo: tempReferenceNo,
  2026. applicant: this.$store.state.user.name || '',
  2027. applicantName: this.$store.state.user.userDisplay || this.$store.state.user.user_display || '',
  2028. pm: '',
  2029. pmName: '',
  2030. applicationDate: this.getCurrentDateString(),
  2031. process: '',
  2032. plannedMassProductionDate: '',
  2033. color: '',
  2034. vendorCode: '',
  2035. vendorMaterialCode: '',
  2036. materialClassify: '',
  2037. materialClassifyList: [],
  2038. otherMaterialClassify: '',
  2039. materialUseFor: '',
  2040. endCustomer: '',
  2041. endCustomerName: '',
  2042. endCustomerFlag: false,
  2043. projectId: '',
  2044. projectName: '',
  2045. projectIdFlag: true,
  2046. commGroup1: '',
  2047. commGroup1Desc: '',
  2048. commGroup2: '',
  2049. commGroup2Desc: '',
  2050. commGroup3: '',
  2051. commGroup3Desc: '',
  2052. needCreateNumber: '',
  2053. npdEngineer: '',
  2054. npdEngineerName: '',
  2055. materialValidityTime: '',
  2056. materialValidityComments: '',
  2057. needDeviation: '',
  2058. technicalPlan: '',
  2059. wmRequiredSpec: '',
  2060. isFiberMaterial: '',
  2061. materialThickness: '',
  2062. buyer: '',
  2063. buyerName: '',
  2064. expectReportTime: 0,
  2065. qualificationDocumentsNeeded: '',
  2066. qualificationDocumentsNeededList: [],
  2067. testReportIncludingItems: '',
  2068. testReportIncludingItemsList: [],
  2069. remark: '',
  2070. status: '草稿',
  2071. sgsReportNumber: '',
  2072. expiredDate: '',
  2073. fiberInformation: '',
  2074. hsfStandard: '',
  2075. hsfApprover: '',
  2076. hsfApproverList: [],
  2077. relatedPeople: '',
  2078. buNo: '',
  2079. validUntilValue: 0,
  2080. validUntil: '',
  2081. isMeetRohsRequirement: '',
  2082. isAhGrade: '',
  2083. hsfSupplierClassification: '',
  2084. materialDesc: '',
  2085. npdRemark: '',
  2086. isSameMaterialDiffSize: '',
  2087. ifsPartNo: '',
  2088. materialList: [],
  2089. stepId: 10,
  2090. rejectFlag: 'N',
  2091. rejectStepId: null,
  2092. createBy2: '',
  2093. isReject: 'Y',
  2094. tpProcessControl: 'N',
  2095. csProcessControl: 'N'
  2096. }
  2097. this.nodeAuthorityLoaded = true
  2098. }
  2099. },
  2100. // 表单提交
  2101. dataFormSubmit () {
  2102. if (!this.canSaveAction()) {
  2103. this.$message.warning('当前状态不允许保存')
  2104. return
  2105. }
  2106. this.normalizeHsfStandardByCustomer(this.modalData)
  2107. this.syncHsfApproverFields()
  2108. if (!this.validateValidUntilPair()) {
  2109. return
  2110. }
  2111. this.modalData.qualificationDocumentsNeeded = this.modalData.qualificationDocumentsNeededList.join(';')
  2112. this.modalData.testReportIncludingItems = this.modalData.testReportIncludingItemsList.join(';')
  2113. this.modalData.materialClassify = this.modalData.materialClassifyList.join(';')
  2114. this.modalData.materialList = (this.modalData.materialList || []).map((item, index) => {
  2115. return {
  2116. ...item,
  2117. lineNo: index + 1,
  2118. projectId: this.modalData.projectId
  2119. }
  2120. })
  2121. const submitMethod = this.modalTitle === 'RoHs 新增' ? api.saveRohs : api.updateRohs
  2122. submitMethod(this.modalData).then(({data}) => {
  2123. if (data && data.code === 0) {
  2124. this.$message.success('操作成功')
  2125. this.modalFlag = false
  2126. this.getDataList()
  2127. } else {
  2128. this.$message.error(data.msg || '操作失败')
  2129. }
  2130. })
  2131. },
  2132. // 同意
  2133. agreeSubmit () {
  2134. if (!this.canAgreeAction()) {
  2135. this.$message.warning('当前状态不允许同意')
  2136. return
  2137. }
  2138. this.$confirm('确认同意该申请单?', '提示', {
  2139. confirmButtonText: '确定',
  2140. cancelButtonText: '取消',
  2141. type: 'warning'
  2142. }).then(() => {
  2143. this.submitRohs('Y')
  2144. })
  2145. },
  2146. openRejectModal () {
  2147. if (!this.canRejectAction()) {
  2148. this.$message.warning('当前状态不允许驳回')
  2149. return
  2150. }
  2151. this.rejectOpinion = ''
  2152. this.submitModalFlag = true
  2153. },
  2154. // 驳回
  2155. rejectSubmit () {
  2156. if (!this.rejectOpinion || !this.rejectOpinion.trim()) {
  2157. this.$message.warning('请填写驳回意见')
  2158. return
  2159. }
  2160. this.submitRohs('N')
  2161. },
  2162. submitRohs (nodeConclusion) {
  2163. if (nodeConclusion === 'Y' && !this.canAgreeAction()) {
  2164. this.$message.warning('当前状态不允许同意')
  2165. return
  2166. }
  2167. if (nodeConclusion === 'N' && !this.canRejectAction()) {
  2168. this.$message.warning('当前状态不允许驳回')
  2169. return
  2170. }
  2171. if (!this.modalData.site || !this.modalData.referenceNo) {
  2172. this.$message.warning('单据主键信息缺失,无法提交审批')
  2173. return
  2174. }
  2175. this.normalizeHsfStandardByCustomer(this.modalData)
  2176. this.syncHsfApproverFields()
  2177. if (!this.validateValidUntilPair()) {
  2178. return
  2179. }
  2180. if (!this.nodeAuthorityLoaded) {
  2181. this.$message.warning('节点权限加载中,请稍后重试')
  2182. return
  2183. }
  2184. if (!this.validateSubmitRequiredFields()) {
  2185. return
  2186. }
  2187. const submitMaterialList = this.normalizeMaterialListForSave(this.modalData.materialList || [])
  2188. this.submitLoading = true
  2189. let params = {
  2190. ...this.modalData,
  2191. site: this.modalData.site,
  2192. referenceNo: this.modalData.referenceNo,
  2193. materialClassify: (this.modalData.materialClassifyList || []).join(';'),
  2194. qualificationDocumentsNeeded: (this.modalData.qualificationDocumentsNeededList || []).join(';'),
  2195. testReportIncludingItems: (this.modalData.testReportIncludingItemsList || []).join(';'),
  2196. materialList: submitMaterialList,
  2197. nodeConclusion: nodeConclusion,
  2198. rejectOpinion: nodeConclusion === 'N' ? this.rejectOpinion : '',
  2199. menuId: this.menuId,
  2200. documentNo: this.modalData.referenceNo
  2201. }
  2202. api.submitRohs(params).then(({data}) => {
  2203. if (data && data.code === 0) {
  2204. this.$message.success(nodeConclusion === 'Y' ? '同意成功' : '驳回成功')
  2205. this.submitModalFlag = false
  2206. this.modalFlag = false
  2207. this.getDataList()
  2208. } else {
  2209. this.$message.error(data.msg || '提交失败')
  2210. }
  2211. this.submitLoading = false
  2212. }).catch(() => {
  2213. this.submitLoading = false
  2214. })
  2215. },
  2216. // 下达
  2217. issueModal (row) {
  2218. if (!this.authIssue) {
  2219. this.$message.warning('没有下达权限')
  2220. return
  2221. }
  2222. this.$confirm('确认下达该申请单?', '提示', {
  2223. confirmButtonText: '确定',
  2224. cancelButtonText: '取消',
  2225. type: 'warning'
  2226. }).then(() => {
  2227. let params = {
  2228. site: row.site,
  2229. referenceNo: row.referenceNo,
  2230. menuId: this.menuId
  2231. }
  2232. api.issueRohs(params).then(({data}) => {
  2233. if (data && data.code === 0) {
  2234. this.$message.success('下达成功')
  2235. if (this.modalFlag && this.modalData.referenceNo === row.referenceNo) {
  2236. this.modalData.status = '审批中'
  2237. }
  2238. this.getDataList()
  2239. } else {
  2240. this.$message.error(data.msg || '下达失败')
  2241. }
  2242. })
  2243. })
  2244. },
  2245. openProjectMaterialDialog () {
  2246. if (!this.canEditRohsMaterial()) {
  2247. this.$message.warning('当前状态不允许编辑材料')
  2248. return
  2249. }
  2250. if (!this.modalData.projectId) {
  2251. this.$message.warning('请先选择项目编码')
  2252. return
  2253. }
  2254. if (!this.modalData.endCustomer) {
  2255. this.$message.warning('请先选择最终客户')
  2256. return
  2257. }
  2258. this.projectMaterialDialogFlag = true
  2259. this.projectMaterialPageIndex = 1
  2260. this.searchProjectMaterialList()
  2261. },
  2262. searchProjectMaterialList () {
  2263. if (!this.modalData.projectId) {
  2264. this.projectMaterialList = []
  2265. this.projectMaterialTotal = 0
  2266. return
  2267. }
  2268. this.projectMaterialLoading = true
  2269. const params = {
  2270. page: this.projectMaterialPageIndex,
  2271. limit: this.projectMaterialPageSize,
  2272. site: this.$store.state.user.site,
  2273. projectId: this.modalData.projectId,
  2274. endCustomer: this.modalData.endCustomer,
  2275. partDesc: this.projectMaterialSearchData.partDesc,
  2276. finalPartNo: this.projectMaterialSearchData.finalPartNo,
  2277. partStatus: this.projectMaterialSearchData.partStatus
  2278. }
  2279. api.getRohsProjectMaterialList(params).then(({data}) => {
  2280. if (data && data.code === 0 && data.page) {
  2281. this.projectMaterialList = data.page.list || []
  2282. this.projectMaterialTotal = data.page.totalCount || 0
  2283. this.$nextTick(() => {
  2284. if (this.$refs.projectMaterialTable) {
  2285. this.$refs.projectMaterialTable.clearSelection()
  2286. }
  2287. })
  2288. } else {
  2289. this.projectMaterialList = []
  2290. this.projectMaterialTotal = 0
  2291. this.$message.error(data.msg || '项目物料查询失败')
  2292. }
  2293. this.projectMaterialLoading = false
  2294. }).catch(() => {
  2295. this.projectMaterialList = []
  2296. this.projectMaterialTotal = 0
  2297. this.projectMaterialLoading = false
  2298. })
  2299. },
  2300. projectMaterialSelectionChange (rows) {
  2301. this.projectMaterialSelections = rows || []
  2302. },
  2303. projectMaterialSizeChangeHandle (val) {
  2304. this.projectMaterialPageSize = val
  2305. this.projectMaterialPageIndex = 1
  2306. this.searchProjectMaterialList()
  2307. },
  2308. projectMaterialCurrentChangeHandle (val) {
  2309. this.projectMaterialPageIndex = val
  2310. this.searchProjectMaterialList()
  2311. },
  2312. confirmProjectMaterialSelection () {
  2313. if (!this.canEditRohsMaterial()) {
  2314. this.$message.warning('当前状态不允许编辑材料')
  2315. return
  2316. }
  2317. if (!this.projectMaterialSelections || this.projectMaterialSelections.length === 0) {
  2318. this.$message.warning('请至少选择一条项目物料')
  2319. return
  2320. }
  2321. const appendResult = this.appendMaterialRows(this.projectMaterialSelections)
  2322. if (!appendResult.appendedCount) {
  2323. this.$message.warning('所选物料已存在,未新增数据')
  2324. return
  2325. }
  2326. if (!this.shouldPersistMaterialsImmediately()) {
  2327. this.$set(this.modalData, 'materialList', appendResult.materialList)
  2328. this.projectMaterialDialogFlag = false
  2329. this.$message.success('已加入材料列表,保存单据后写入数据库')
  2330. return
  2331. }
  2332. this.$confirm('确认新增选中材料?', '提示', {
  2333. confirmButtonText: '确定',
  2334. cancelButtonText: '取消',
  2335. type: 'warning'
  2336. }).then(() => {
  2337. this.persistMaterialList(appendResult.materialList, '新增材料成功', () => {
  2338. this.projectMaterialDialogFlag = false
  2339. this.projectMaterialSelections = []
  2340. if (this.$refs.projectMaterialTable) {
  2341. this.$refs.projectMaterialTable.clearSelection()
  2342. }
  2343. })
  2344. }).catch(() => {})
  2345. },
  2346. appendMaterialRows (rows) {
  2347. const materialList = Array.isArray(this.modalData.materialList) ? [...this.modalData.materialList] : []
  2348. const exists = new Set(materialList.map(item => item.testPartNo))
  2349. let appendedCount = 0
  2350. rows.forEach(row => {
  2351. const testPartNo = row.testPartNo || row.test_part_no
  2352. if (!testPartNo || exists.has(testPartNo)) {
  2353. return
  2354. }
  2355. exists.add(testPartNo)
  2356. appendedCount++
  2357. materialList.push({
  2358. site: this.modalData.site,
  2359. referenceNo: this.modalData.referenceNo,
  2360. projectId: this.modalData.projectId,
  2361. testPartNo: testPartNo,
  2362. finalPartNo: row.finalPartNo || row.final_part_no || '',
  2363. partDesc: row.partDesc || row.part_desc || '',
  2364. partStatus: row.partStatus || row.part_status || ''
  2365. })
  2366. })
  2367. return {
  2368. materialList,
  2369. appendedCount
  2370. }
  2371. },
  2372. materialSelectionChange (rows) {
  2373. this.materialSelections = rows || []
  2374. },
  2375. shouldPersistMaterialsImmediately () {
  2376. return this.modalTitle === 'RoHs 编辑' && this.modalData && this.modalData.referenceNo && !String(this.modalData.referenceNo).startsWith('TEMP-')
  2377. },
  2378. normalizeMaterialListForSave (materialList) {
  2379. return (materialList || []).map((item, index) => {
  2380. return {
  2381. site: item.site || this.modalData.site || '',
  2382. referenceNo: item.referenceNo || this.modalData.referenceNo || '',
  2383. projectId: item.projectId || this.modalData.projectId || '',
  2384. testPartNo: item.testPartNo || item.test_part_no || '',
  2385. finalPartNo: item.finalPartNo || item.final_part_no || '',
  2386. partDesc: item.partDesc || item.part_desc || '',
  2387. partStatus: item.partStatus || item.part_status || '',
  2388. lineNo: index + 1
  2389. }
  2390. }).filter(item => item.testPartNo)
  2391. },
  2392. persistMaterialList (materialList, successMsg, successCallback) {
  2393. const normalizedList = this.normalizeMaterialListForSave(materialList)
  2394. const payload = {
  2395. site: this.modalData.site,
  2396. referenceNo: this.modalData.referenceNo,
  2397. projectId: this.modalData.projectId,
  2398. materialList: normalizedList
  2399. }
  2400. api.updateRohsMaterials(payload).then(({data}) => {
  2401. if (data && data.code === 0) {
  2402. this.$set(this.modalData, 'materialList', normalizedList)
  2403. this.materialSelections = []
  2404. if (this.currentRow && this.currentRow.referenceNo === this.modalData.referenceNo) {
  2405. this.$set(this.currentRow, 'materialList', normalizedList)
  2406. }
  2407. this.$message.success(successMsg || '保存成功')
  2408. if (typeof successCallback === 'function') {
  2409. successCallback()
  2410. }
  2411. } else {
  2412. this.$message.error((data && data.msg) || '保存失败')
  2413. }
  2414. }).catch(() => {
  2415. this.$message.error('保存失败')
  2416. })
  2417. },
  2418. removeSelectedMaterialRows () {
  2419. if (!this.canEditRohsMaterial()) {
  2420. this.$message.warning('当前状态不允许编辑材料')
  2421. return
  2422. }
  2423. if (!this.materialSelections || this.materialSelections.length === 0) {
  2424. this.$message.warning('请先选择要删除的材料')
  2425. return
  2426. }
  2427. const removeSet = new Set(this.materialSelections.map(item => item.testPartNo))
  2428. const materialList = (this.modalData.materialList || []).filter(item => !removeSet.has(item.testPartNo))
  2429. if (!this.shouldPersistMaterialsImmediately()) {
  2430. this.$set(this.modalData, 'materialList', materialList)
  2431. this.materialSelections = []
  2432. this.$message.success('已删除材料,保存单据后写入数据库')
  2433. return
  2434. }
  2435. this.$confirm('确认删除选中材料?', '提示', {
  2436. confirmButtonText: '确定',
  2437. cancelButtonText: '取消',
  2438. type: 'warning'
  2439. }).then(() => {
  2440. this.persistMaterialList(materialList, '删除材料成功')
  2441. }).catch(() => {})
  2442. },
  2443. // ======== chooseList相关方法 ========
  2444. // 获取基础数据列表
  2445. getBaseList (val, type) {
  2446. this.tagNo = val
  2447. this.tagNo1 = type
  2448. this.$nextTick(() => {
  2449. let strVal = ''
  2450. let conSql = ''
  2451. if (val === 102) {
  2452. if (type === 1) {
  2453. strVal = this.modalData.endCustomer
  2454. }
  2455. }
  2456. if (val === 103 || val === 2001 || val === 2054) {
  2457. if (type === 1) {
  2458. strVal = this.modalData.applicant
  2459. } else if (type === 3) {
  2460. strVal = this.modalData.npdEngineer
  2461. } else if (type === 4) {
  2462. strVal = this.modalData.technicalPlan
  2463. } else if (type === 5) {
  2464. strVal = this.modalData.pm
  2465. }
  2466. conSql = " and b.site = '" + this.$store.state.user.site + "'"
  2467. }
  2468. if (val === 2000) {
  2469. strVal = this.modalData.buyer
  2470. conSql = " and b.site = '" + this.$store.state.user.site + "'"
  2471. }
  2472. if (val === 110) {
  2473. strVal = this.modalData.commGroup1
  2474. }
  2475. if (val === 111) {
  2476. strVal = this.modalData.commGroup2
  2477. }
  2478. if (val === 130) {
  2479. strVal = this.modalData.commGroup3
  2480. }
  2481. this.$refs.baseList.init(val, strVal, conSql)
  2482. })
  2483. },
  2484. // 列表方法的回调
  2485. getBaseData (val) {
  2486. if (this.tagNo === 102) {
  2487. if (this.tagNo1 === 1) {
  2488. if (val.Customer_no === this.modalData.endCustomer) {
  2489. return
  2490. }
  2491. if (this.modalData.projectIdFlag) {
  2492. this.modalData.projectIdFlag = false
  2493. }
  2494. this.modalData.endCustomer = val.Customer_no
  2495. this.modalData.endCustomerName = val.Customer_desc
  2496. this.modalData.projectId = ''
  2497. this.modalData.projectName = ''
  2498. this.modalData.buNo = ''
  2499. this.$set(this.modalData, 'materialList', [])
  2500. this.clearHsfApproverFields(false)
  2501. }
  2502. }
  2503. if (this.tagNo === 103 || this.tagNo === 2001 || this.tagNo === 2054) {
  2504. if (this.tagNo1 === 1) {
  2505. this.modalData.applicant = val.username
  2506. this.modalData.applicantName = val.user_display
  2507. } else if (this.tagNo1 === 3) {
  2508. this.modalData.npdEngineer = val.username
  2509. this.modalData.npdEngineerName = val.user_display
  2510. } else if (this.tagNo1 === 4) {
  2511. this.modalData.technicalPlan = val.username
  2512. this.modalData.technicalPlanName = val.user_display
  2513. } else if (this.tagNo1 === 5) {
  2514. this.modalData.pm = val.username
  2515. this.modalData.pmName = val.user_display
  2516. }
  2517. }
  2518. if (this.tagNo === 110) {
  2519. this.modalData.commGroup1 = val.product_group_id
  2520. this.modalData.commGroup1Desc = val.product_group_name
  2521. }
  2522. if (this.tagNo === 111) {
  2523. this.modalData.commGroup2 = val.product_group_id
  2524. this.modalData.commGroup2Desc = val.product_group_name
  2525. }
  2526. if (this.tagNo === 130) {
  2527. this.modalData.commGroup3 = val.product_group_id
  2528. this.modalData.commGroup3Desc = val.product_group_name
  2529. }
  2530. if (this.tagNo === 2000) {
  2531. this.modalData.buyer = val.username
  2532. this.modalData.buyerName = val.user_display
  2533. }
  2534. },
  2535. handleQueryCustomer() {
  2536. if (!this.modalData.endCustomer) {
  2537. this.modalData.endCustomerName = ''
  2538. this.modalData.projectId = ''
  2539. this.modalData.projectName = ''
  2540. this.modalData.buNo = ''
  2541. this.modalData.projectIdFlag = true
  2542. this.$set(this.modalData, 'materialList', [])
  2543. this.clearHsfApproverFields(false)
  2544. return
  2545. }
  2546. let params = {
  2547. site: this.$store.state.user.site,
  2548. customerNo: this.modalData.endCustomer
  2549. }
  2550. queryCustomer(params).then(({data}) => {
  2551. if (data && data.code === 0) {
  2552. if (data.rows && data.rows.length === 1) {
  2553. const customer = data.rows[0]
  2554. this.modalData.endCustomerName = customer.customerDesc || customer.Customer_desc || customer.customerName || ''
  2555. this.modalData.projectIdFlag = !!this.modalData.endCustomerFlag
  2556. } else {
  2557. this.modalData.endCustomerName = ''
  2558. this.modalData.projectId = ''
  2559. this.modalData.projectName = ''
  2560. this.modalData.buNo = ''
  2561. this.modalData.projectIdFlag = true
  2562. this.$set(this.modalData, 'materialList', [])
  2563. this.clearHsfApproverFields(false)
  2564. }
  2565. } else {
  2566. this.modalData.endCustomerName = ''
  2567. this.modalData.projectId = ''
  2568. this.modalData.projectName = ''
  2569. this.modalData.buNo = ''
  2570. this.modalData.projectIdFlag = true
  2571. this.$set(this.modalData, 'materialList', [])
  2572. this.clearHsfApproverFields(false)
  2573. }
  2574. }).catch((error) => {
  2575. this.modalData.endCustomerName = ''
  2576. this.modalData.projectId = ''
  2577. this.modalData.projectName = ''
  2578. this.modalData.buNo = ''
  2579. this.modalData.projectIdFlag = true
  2580. this.$set(this.modalData, 'materialList', [])
  2581. this.clearHsfApproverFields(false)
  2582. })
  2583. },
  2584. handleQueryProjectByCustomer() {
  2585. if (!this.modalData.projectId) {
  2586. this.modalData.projectName = ''
  2587. this.modalData.buNo = ''
  2588. this.clearHsfApproverFields(false)
  2589. return
  2590. }
  2591. let params = {
  2592. site: this.$store.state.user.site,
  2593. projectId: this.modalData.projectId
  2594. }
  2595. if (this.modalData.endCustomer) {
  2596. params.customerId = this.modalData.endCustomer
  2597. }
  2598. queryProjectByCustomer(params).then(({data}) => {
  2599. if (data && data.code === 0) {
  2600. if (data.rows && data.rows.length === 1) {
  2601. const project = data.rows[0]
  2602. this.modalData.projectName = project.projectName || project.Project_name || ''
  2603. this.modalData.buNo = project.buNo || project.bu_no || ''
  2604. const forceSelectAll = !this.isEditMode
  2605. this.loadHsfApproverByCurrentProject(forceSelectAll)
  2606. } else {
  2607. this.modalData.projectName = ''
  2608. this.modalData.buNo = ''
  2609. this.clearHsfApproverFields(false)
  2610. }
  2611. } else {
  2612. this.modalData.projectName = ''
  2613. this.modalData.buNo = ''
  2614. this.clearHsfApproverFields(false)
  2615. }
  2616. }).catch((error) => {
  2617. this.modalData.projectName = ''
  2618. this.modalData.buNo = ''
  2619. this.clearHsfApproverFields(false)
  2620. })
  2621. },
  2622. projectClickRow(row) {
  2623. const oldProjectId = this.modalData.projectId
  2624. this.modalData.projectId = row.projectId
  2625. this.modalData.projectName = row.projectName
  2626. this.modalData.buNo = row.buNo || row.bu_no || ''
  2627. if (this.modalData.endCustomer && this.modalData.endCustomer !== '') {
  2628. // do nothing
  2629. } else {
  2630. this.modalData.endCustomer = row.customerId
  2631. this.modalData.endCustomerName = row.customerName
  2632. }
  2633. if (oldProjectId && oldProjectId !== row.projectId) {
  2634. this.$set(this.modalData, 'materialList', [])
  2635. }
  2636. this.loadHsfApproverByCurrentProject(!this.isEditMode)
  2637. this.chooseProjectListFlag = false
  2638. },
  2639. searchProjectInfoList() {
  2640. this.projectList = [];
  2641. if (this.modalData.endCustomer && this.modalData.endCustomer !== '') {
  2642. this.searchProjectData.customerId = this.modalData.endCustomer
  2643. } else {
  2644. this.searchProjectData.customerId = undefined
  2645. }
  2646. this.searchProjectData.site = this.$store.state.user.site
  2647. searchProjectInfoList(this.searchProjectData).then(({data}) => {
  2648. if (data && data.code === 0) {
  2649. const rows = data.rows || []
  2650. this.projectList = rows
  2651. if ((!this.modalData.endCustomer || this.modalData.endCustomer === '') && rows.length > 0) {
  2652. this.modalData.projectId = rows[0].projectId
  2653. this.modalData.projectName = rows[0].projectName
  2654. this.modalData.endCustomer = rows[0].customerId
  2655. this.modalData.endCustomerName = rows[0].customerName
  2656. this.modalData.buNo = rows[0].buNo || rows[0].bu_no || ''
  2657. this.loadHsfApproverByCurrentProject(!this.isEditMode)
  2658. }
  2659. } else {
  2660. this.projectList = []
  2661. }
  2662. }).catch((error) => {
  2663. this.$message.error('查询项目信息失败')
  2664. })
  2665. },
  2666. closeProjectInfoDialog() {
  2667. if(this.$refs.closeProjectInfoForm) {
  2668. this.$refs.closeProjectInfoForm.resetFields();
  2669. }
  2670. this.searchProjectData = {
  2671. site: this.$store.state.user.site,
  2672. projectId: undefined,
  2673. projectName: undefined,
  2674. customerId: undefined,
  2675. }
  2676. },
  2677. // 申请人输入校验
  2678. applicantBlur (tagNo) {
  2679. if (this.modalData.applicant != null && this.modalData.applicant !== '') {
  2680. let tempData = {
  2681. tagno: tagNo,
  2682. conditionSql: " and a.username = '" + this.modalData.applicant + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  2683. }
  2684. verifyData(tempData).then(({data}) => {
  2685. if (data && data.code === 0) {
  2686. if (data.baseListData.length > 0) {
  2687. this.modalData.applicant = data.baseListData[0].username
  2688. this.modalData.applicantName = data.baseListData[0].user_display
  2689. return
  2690. }
  2691. }
  2692. this.modalData.applicantName = ''
  2693. })
  2694. } else {
  2695. this.modalData.applicantName = ''
  2696. }
  2697. },
  2698. // PM输入校验
  2699. pmBlur (tagNo) {
  2700. if (this.modalData.pm != null && this.modalData.pm !== '') {
  2701. let tempData = {
  2702. tagno: tagNo,
  2703. conditionSql: " and a.username = '" + this.modalData.pm + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  2704. }
  2705. verifyData(tempData).then(({data}) => {
  2706. if (data && data.code === 0) {
  2707. if (data.baseListData.length > 0) {
  2708. this.modalData.pm = data.baseListData[0].username
  2709. this.modalData.pmName = data.baseListData[0].user_display
  2710. return
  2711. }
  2712. }
  2713. this.modalData.pmName = ''
  2714. })
  2715. } else {
  2716. this.modalData.pmName = ''
  2717. }
  2718. },
  2719. // NPD工程师输入校验
  2720. npdEngineerBlur (tagNo) {
  2721. if (this.modalData.npdEngineer != null && this.modalData.npdEngineer !== '') {
  2722. let tempData = {
  2723. tagno: tagNo,
  2724. conditionSql: " and a.username = '" + this.modalData.npdEngineer + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  2725. }
  2726. verifyData(tempData).then(({data}) => {
  2727. if (data && data.code === 0) {
  2728. if (data.baseListData.length > 0) {
  2729. this.modalData.npdEngineer = data.baseListData[0].username
  2730. this.modalData.npdEngineerName = data.baseListData[0].user_display
  2731. return
  2732. }
  2733. }
  2734. this.modalData.npdEngineerName = ''
  2735. })
  2736. } else {
  2737. this.modalData.npdEngineerName = ''
  2738. }
  2739. },
  2740. // 技术计划输入校验
  2741. technicalPlanBlur (tagNo) {
  2742. if (this.modalData.technicalPlan != null && this.modalData.technicalPlan !== '') {
  2743. let tempData = {
  2744. tagno: tagNo,
  2745. conditionSql: " and a.username = '" + this.modalData.technicalPlan + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  2746. }
  2747. verifyData(tempData).then(({data}) => {
  2748. if (data && data.code === 0) {
  2749. if (data.baseListData.length > 0) {
  2750. this.modalData.technicalPlan = data.baseListData[0].username
  2751. this.modalData.technicalPlanName = data.baseListData[0].user_display
  2752. return
  2753. }
  2754. }
  2755. this.modalData.technicalPlanName = ''
  2756. })
  2757. } else {
  2758. this.modalData.technicalPlanName = ''
  2759. }
  2760. },
  2761. // 采购输入校验
  2762. buyerBlur (tagNo) {
  2763. if (this.modalData.buyer != null && this.modalData.buyer !== '') {
  2764. let tempData = {
  2765. tagno: tagNo,
  2766. conditionSql: " and a.username = '" + this.modalData.buyer + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  2767. }
  2768. verifyData(tempData).then(({data}) => {
  2769. if (data && data.code === 0) {
  2770. if (data.baseListData.length > 0) {
  2771. this.modalData.buyer = data.baseListData[0].username
  2772. this.modalData.buyerName = data.baseListData[0].user_display
  2773. return
  2774. }
  2775. }
  2776. this.modalData.buyerName = ''
  2777. })
  2778. } else {
  2779. this.modalData.buyerName = ''
  2780. }
  2781. },
  2782. // 商品组1输入校验
  2783. commGroup1Blur (tagNo) {
  2784. if (this.modalData.commGroup1 != null && this.modalData.commGroup1 !== '') {
  2785. let tempData = {
  2786. tagno: tagNo,
  2787. conditionSql: " and product_group_id = '" + this.modalData.commGroup1 + "'" + " and site = '" + this.$store.state.user.site + "'"
  2788. }
  2789. verifyData(tempData).then(({data}) => {
  2790. if (data && data.code === 0 && data.baseListData.length > 0) {
  2791. this.modalData.commGroup1 = data.baseListData[0].product_group_id
  2792. this.modalData.commGroup1Desc = data.baseListData[0].product_group_name
  2793. } else {
  2794. this.modalData.commGroup1Desc = ''
  2795. }
  2796. })
  2797. } else {
  2798. this.modalData.commGroup1Desc = ''
  2799. }
  2800. },
  2801. // 商品组2输入校验
  2802. commGroup2Blur (tagNo) {
  2803. if (this.modalData.commGroup2 != null && this.modalData.commGroup2 !== '') {
  2804. let tempData = {
  2805. tagno: tagNo,
  2806. conditionSql: " and product_group_id = '" + this.modalData.commGroup2 + "'" + " and site = '" + this.$store.state.user.site + "'"
  2807. }
  2808. verifyData(tempData).then(({data}) => {
  2809. if (data && data.code === 0 && data.baseListData.length > 0) {
  2810. this.modalData.commGroup2 = data.baseListData[0].product_group_id
  2811. this.modalData.commGroup2Desc = data.baseListData[0].product_group_name
  2812. } else {
  2813. this.modalData.commGroup2Desc = ''
  2814. }
  2815. })
  2816. } else {
  2817. this.modalData.commGroup2Desc = ''
  2818. }
  2819. },
  2820. // 商品组3输入校验
  2821. commGroup3Blur (tagNo) {
  2822. if (this.modalData.commGroup3 != null && this.modalData.commGroup3 !== '') {
  2823. let tempData = {
  2824. tagno: tagNo,
  2825. conditionSql: " and product_group_id = '" + this.modalData.commGroup3 + "'" + " and site = '" + this.$store.state.user.site + "'"
  2826. }
  2827. verifyData(tempData).then(({data}) => {
  2828. if (data && data.code === 0 && data.baseListData.length > 0) {
  2829. this.modalData.commGroup3 = data.baseListData[0].product_group_id
  2830. this.modalData.commGroup3Desc = data.baseListData[0].product_group_name
  2831. } else {
  2832. this.modalData.commGroup3Desc = ''
  2833. }
  2834. })
  2835. } else {
  2836. this.modalData.commGroup3Desc = ''
  2837. }
  2838. }
  2839. }
  2840. }
  2841. </script>
  2842. <style scoped lang="scss">
  2843. /deep/ .customer-tab .el-tabs__content {
  2844. padding: 0 !important;
  2845. }
  2846. /deep/ .rohs-material-table .el-table__header-wrapper th > .cell {
  2847. white-space: nowrap;
  2848. word-break: keep-all;
  2849. }
  2850. /deep/ .rohs-multiple-ellipsis.el-select .el-select__tags,
  2851. /deep/ .rohs-multiple-ellipsis .el-select .el-select__tags {
  2852. max-width: calc(100% - 34px) !important;
  2853. overflow: hidden;
  2854. white-space: nowrap;
  2855. }
  2856. /deep/ .rohs-multiple-ellipsis.el-select .el-select__tags > span,
  2857. /deep/ .rohs-multiple-ellipsis .el-select .el-select__tags > span {
  2858. display: block;
  2859. max-width: 100%;
  2860. overflow: hidden;
  2861. white-space: nowrap;
  2862. text-overflow: ellipsis;
  2863. }
  2864. /deep/ .rohs-multiple-ellipsis.el-select .el-select__tags .el-tag,
  2865. /deep/ .rohs-multiple-ellipsis .el-select .el-select__tags .el-tag {
  2866. display: inline-flex;
  2867. max-width: 120px;
  2868. margin-right: 4px;
  2869. overflow: hidden;
  2870. vertical-align: middle;
  2871. }
  2872. /deep/ .rohs-multiple-ellipsis.el-select .el-select__tags .el-tag .el-select__tags-text,
  2873. /deep/ .rohs-multiple-ellipsis .el-select .el-select__tags .el-tag .el-select__tags-text {
  2874. overflow: hidden;
  2875. text-overflow: ellipsis;
  2876. white-space: nowrap;
  2877. }
  2878. </style>