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.

3486 lines
153 KiB

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