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.

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