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.

5285 lines
234 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="RoHS状态">
  16. <el-select v-model="searchData.rohsStatus" clearable style="width: 120px">
  17. <el-option label="Active" value="Active"></el-option>
  18. <el-option label="Dead" value="Dead"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="节点审批人">
  22. <el-input v-model="searchData.currentApprover" clearable style="width: 120px"></el-input>
  23. </el-form-item>
  24. <el-form-item label="当前节点">
  25. <el-select v-model="searchData.nodeId" placeholder="请选择节点" clearable style="width: 120px">
  26. <el-option
  27. v-for="option in nodeOptions"
  28. :key="option.id"
  29. :label="option.name"
  30. :value="option.id">
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="IFS物料编码">
  35. <el-input v-model="searchData.ifsPartNo" clearable style="width: 140px"></el-input>
  36. </el-form-item>
  37. <el-form-item label="IFS物料描述">
  38. <el-input v-model="searchData.materialDesc" clearable style="width: 180px"></el-input>
  39. </el-form-item>
  40. <el-form-item :label="' '">
  41. <el-button v-if="authSearch" @click="getDataList">查询</el-button>
  42. <el-button v-if="authUpdate" @click="addOrUpdateHandle()">新增</el-button>
  43. <el-button v-if="authDelete" type="danger" @click="deleteHandle()">删除</el-button>
  44. <download-excel
  45. v-if="authSearch"
  46. :fields="exportFieldMap"
  47. :data="exportData"
  48. type="xls"
  49. :name="exportName"
  50. :header="exportHeader"
  51. :footer="exportFooter"
  52. :fetch="createExportData"
  53. :before-generate="startDownload"
  54. :before-finish="finishDownload"
  55. worksheet="导出信息"
  56. :class="['el-button', 'el-button--primary', 'el-button--medium', {'is-loading': exportLoading}]">
  57. <i v-if="exportLoading" class="el-icon-loading"></i>
  58. <span>{{ "导出" }}</span>
  59. </download-excel>
  60. <el-button v-if="authSearch" @click="searchHandle()">搜索</el-button>
  61. </el-form-item>
  62. </el-form>
  63. <!-- 列表 -->
  64. <el-table
  65. ref="rohsTable"
  66. :height="height"
  67. :data="dataList"
  68. border
  69. :row-style="rowStyle"
  70. @row-click="changeClickRow"
  71. @current-change="currentChange"
  72. @selection-change="dataListSelectionChange"
  73. v-loading="dataListLoading"
  74. style="width: 100%;">
  75. <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
  76. <el-table-column prop="process" header-align="center" align="left" label="工艺" width="80"></el-table-column>
  77. <el-table-column prop="referenceNo" header-align="center" align="center" label="序列号" width="150"></el-table-column>
  78. <el-table-column prop="status" header-align="center" align="left" label="单据状态" width="100"></el-table-column>
  79. <el-table-column prop="nodeName" header-align="center" align="left" label="当前节点" width="150"></el-table-column>
  80. <el-table-column prop="currentApprover" header-align="center" align="left" label="当前节点审批人" width="120"></el-table-column>
  81. <el-table-column prop="applicant" header-align="center" align="left" label="申请人" width="120"></el-table-column>
  82. <el-table-column prop="applicationDate" header-align="center" align="center" label="申请日期" width="130"></el-table-column>
  83. <el-table-column prop="vendorCode" header-align="center" align="left" label="供应商" width="120"></el-table-column>
  84. <el-table-column prop="vendorMaterialCode" header-align="center" align="left" label="供应商材料" width="150" :show-overflow-tooltip="true"></el-table-column>
  85. <el-table-column prop="materialClassify" header-align="center" align="left" label="材料分类" width="250" :show-overflow-tooltip="true"></el-table-column>
  86. <el-table-column prop="endCustomer" header-align="center" align="left" label="最终客户编码" width="100"></el-table-column>
  87. <el-table-column prop="endCustomerName" header-align="center" align="left" label="最终客户名称" width="150"></el-table-column>
  88. <el-table-column prop="projectId" header-align="center" align="left" label="项目编码" width="100"></el-table-column>
  89. <el-table-column prop="projectName" header-align="center" align="left" label="项目名称" width="150"></el-table-column>
  90. <el-table-column prop="materialDesc" header-align="center" align="left" label="材料描述" width="180" :show-overflow-tooltip="true"></el-table-column>
  91. <el-table-column prop="mainIfsPartNo" header-align="center" align="left" label="IFS物料编码" width="120">
  92. <template slot-scope="scope">
  93. <span>{{ scope.row.mainIfsPartNo || '' }}</span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column prop="mainPartDesc" header-align="center" align="left" label="IFS物料描述" width="250" :show-overflow-tooltip="true">
  97. <template slot-scope="scope">
  98. <span>{{ scope.row.mainPartDesc || '' }}</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column prop="materialValidityTime" header-align="center" align="center" label="材料有效期" width="100"></el-table-column>
  102. <el-table-column prop="expiryDate" header-align="center" align="center" label="失效日期" width="130">
  103. <template slot-scope="scope">
  104. <span>{{ normalizeDateOnly(scope.row.expiryDate) }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column fixed="right" header-align="center" align="center" width="130" label="操作">
  108. <template slot-scope="scope">
  109. <el-link v-if="authUpdate && scope.row.status !== '已完成'" style="cursor: pointer" @click="addOrUpdateHandle(scope.row)">编辑</el-link>
  110. <el-link v-if="authUpdate && scope.row.status === '已完成'" style="cursor: pointer" @click="addOrUpdateHandle(scope.row)">详情</el-link>
  111. <el-link v-if="authIssue && scope.row.status === '草稿'" style="cursor: pointer; margin-left: 10px;" @click="issueModal(scope.row)">下达</el-link>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. <!-- 分页 -->
  116. <el-pagination style="margin-top: 0px"
  117. @size-change="sizeChangeHandle"
  118. @current-change="currentChangeHandle"
  119. :current-page="pageIndex"
  120. :page-sizes="[20, 50, 100, 200, 500]"
  121. :page-size="pageSize"
  122. :total="totalPage"
  123. layout="total, sizes, prev, pager, next, jumper">
  124. </el-pagination>
  125. <!-- 编辑模态框 -->
  126. <el-dialog
  127. :title="modalTitle"
  128. :visible.sync="modalFlag"
  129. width="1012px"
  130. top="3.8vh"
  131. v-drag
  132. :close-on-click-modal="false"
  133. :showClose="false">
  134. <el-tabs tab-position="left" type="border-card" v-model="activeName" style="width: 100%;height: 777px;">
  135. <!-- 基本信息 -->
  136. <el-tab-pane label="基本信息" name="basicInfo">
  137. <div style="height: 755px">
  138. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  139. <el-form-item>
  140. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('applicant')" slot="label" @click="getBaseList(103, 1)"><a herf="#">申请人/Reference No.</a></span>
  141. <span v-else slot="label">申请人/Reference No.</span>
  142. <el-input v-model="modalData.applicant" @blur="applicantBlur(103)" :disabled="isRohsFieldDisabled('applicant')" style="width: 100px"></el-input>
  143. <el-input v-model="modalData.applicantName" disabled style="width: 155px"></el-input>
  144. </el-form-item>
  145. <el-form-item label="申请日期/Date">
  146. <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>
  147. </el-form-item>
  148. <el-form-item label="Site">
  149. <el-input v-model="modalData.site" disabled style="width: 95px"></el-input>
  150. </el-form-item>
  151. <el-form-item label="工艺/Process">
  152. <dict-data-select v-model="modalData.process" clearable @change="handleProcessChange" :disabled="isProcessFieldDisabled()" style="width: 121px" dict-type="rohs_process"></dict-data-select>
  153. </el-form-item>
  154. </el-form>
  155. <el-form :inline="true" label-position="top" :model="modalData">
  156. <el-form-item>
  157. <span slot="label" v-if="!modalData.endCustomerFlag && !isRohsFieldDisabled('endCustomer')" @click="getBaseList(102, 1)"><a herf="#">最终客户/End Customer</a></span>
  158. <span slot="label" v-else>最终客户/End Customer</span>
  159. <el-input :disabled="modalData.endCustomerFlag || isRohsFieldDisabled('endCustomer')" readonly v-model="modalData.endCustomer" @blur="handleQueryCustomer" style="width: 100px"></el-input>
  160. <el-input disabled v-model="modalData.endCustomerName" style="width: 155px"></el-input>
  161. </el-form-item>
  162. <el-form-item>
  163. <span slot="label" v-if="!modalData.projectIdFlag && !isRohsFieldDisabled('projectId')" @click="chooseProjectListFlag = true"><a herf="#">项目编码/Project</a></span>
  164. <span slot="label" v-else>项目编码/Project</span>
  165. <el-input :disabled="modalData.projectIdFlag || isRohsFieldDisabled('projectId')" readonly v-model="modalData.projectId" @blur="handleQueryProjectByCustomer" style="width: 100px"></el-input>
  166. <el-input disabled v-model="modalData.projectName" style="width: 155px"></el-input>
  167. </el-form-item>
  168. <el-form-item label="WM所需求规格/The size that WM need">
  169. <el-input v-model="modalData.wmRequiredSpec" :disabled="isRohsFieldDisabled('wmRequiredSpec')" style="width: 260px"></el-input>
  170. </el-form-item>
  171. </el-form>
  172. <el-form :inline="true" label-position="top" :model="modalData">
  173. <el-form-item label="供应商/Vendor Code">
  174. <el-input v-model="modalData.vendorCode" :disabled="isRohsFieldDisabled('vendorCode')" style="width: 396px"></el-input>
  175. </el-form-item>
  176. <el-form-item label="供应商材料编码/Vendor Material Code">
  177. <el-input v-model="modalData.vendorMaterialCode" :disabled="isRohsFieldDisabled('vendorMaterialCode')" style="width: 396px"></el-input>
  178. </el-form-item>
  179. </el-form>
  180. <el-form :inline="true" label-position="top" :model="modalData">
  181. <el-form-item label="材料分类/Material Classify">
  182. <dict-data-select class="rohs-multiple-two-rows" v-model="modalData.materialClassifyList" multiple :title="getMultipleSelectTitle(modalData.materialClassifyList)" :disabled="isRohsFieldDisabled('materialClassify')" style="width: 532px" dict-type="rohs_material_classify"></dict-data-select>
  183. </el-form-item>
  184. <el-form-item label="其他分类/Other Material Classify" v-if="modalData.materialClassifyList && modalData.materialClassifyList.includes('Other其他')">
  185. <el-input v-model="modalData.otherMaterialClassify" :disabled="isRohsFieldDisabled('otherMaterialClassify')" style="width: 260px"></el-input>
  186. </el-form-item>
  187. </el-form>
  188. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 40px">
  189. <el-form-item label="辅材用途/Assiaccessorial Material Use for">
  190. <el-input v-model="modalData.materialUseFor" :disabled="isRohsFieldDisabled('materialUseFor')" style="width: 259px"></el-input>
  191. </el-form-item>
  192. <el-form-item>
  193. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('technicalPlan')" slot="label" @click="getBaseList(2001, 4)"><a herf="#">技术计划/TP</a></span>
  194. <span v-else slot="label">技术计划/TP</span>
  195. <el-input v-model="modalData.technicalPlan" @blur="technicalPlanBlur(2001)" :disabled="isRohsFieldDisabled('technicalPlan')" style="width: 100px"></el-input>
  196. <el-input v-model="modalData.technicalPlanName" disabled style="width: 155px"></el-input>
  197. </el-form-item>
  198. <el-form-item>
  199. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('pm')" slot="label" @click="getBaseList(2054, 5)"><a herf="#">PM人员/PM</a></span>
  200. <span v-else slot="label">PM人员/PM</span>
  201. <el-input v-model="modalData.pm" @blur="pmBlur(2054)" :disabled="isRohsFieldDisabled('pm')" style="width: 100px"></el-input>
  202. <el-input v-model="modalData.pmName" disabled style="width: 156px"></el-input>
  203. </el-form-item>
  204. </el-form>
  205. <el-form :inline="true" label-position="top" :model="modalData">
  206. <el-form-item label="颜色/Color">
  207. <el-input v-model="modalData.color" :disabled="isRohsFieldDisabled('color')" style="width: 532px"></el-input>
  208. </el-form-item>
  209. <el-form-item label="计划转量产时间/Planned Mass Production Date">
  210. <el-date-picker v-model="modalData.plannedMassProductionDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('plannedMassProductionDate')" style="width: 260px" :editable=false></el-date-picker>
  211. </el-form-item>
  212. </el-form>
  213. <el-form :inline="true" label-position="top" :model="modalData">
  214. <el-form-item>
  215. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup1')" slot="label" @click="getBaseList(110)"><a herf="#">商品组1/Comm Group 1</a></span>
  216. <span v-else slot="label">商品组1/Comm Group 1</span>
  217. <el-input v-model="modalData.commGroup1" @change="commGroup1Blur(110)" :disabled="isRohsFieldDisabled('commGroup1')" style="width: 100px"></el-input>
  218. <el-input v-model="modalData.commGroup1Desc" disabled style="width: 155px"></el-input>
  219. </el-form-item>
  220. <el-form-item>
  221. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup2')" slot="label" @click="getBaseList(111)"><a herf="#">商品组2/Comm Group 2</a></span>
  222. <span v-else slot="label">商品组2/Comm Group 2</span>
  223. <el-input v-model="modalData.commGroup2" @change="commGroup2Blur(111)" :disabled="isRohsFieldDisabled('commGroup2')" style="width: 100px"></el-input>
  224. <el-input v-model="modalData.commGroup2Desc" disabled style="width: 155px"></el-input>
  225. </el-form-item>
  226. <el-form-item>
  227. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup3')" slot="label" @click="getBaseList(130)"><a herf="#">商品组3/Comm Group 3</a></span>
  228. <span v-else slot="label">商品组3/Comm Group 3</span>
  229. <el-input v-model="modalData.commGroup3" @change="commGroup3Blur(130)" :disabled="isRohsFieldDisabled('commGroup3') || modalData.commGroup1 !== '00100'" style="width: 100px"></el-input>
  230. <el-input v-model="modalData.commGroup3Desc" disabled style="width: 156px"></el-input>
  231. </el-form-item>
  232. </el-form>
  233. <el-form :inline="true" label-position="top" :model="modalData">
  234. <el-form-item label="是否是Fiber材料">
  235. <el-radio-group v-model="modalData.isFiberMaterial" :disabled="isRohsFieldDisabled('isFiberMaterial')" style="width: 145px">
  236. <el-radio label="Y" @click.native.prevent="radioClick('isFiberMaterial', 'Y')"></el-radio>
  237. <el-radio label="N" @click.native.prevent="radioClick('isFiberMaterial', 'N')"></el-radio>
  238. </el-radio-group>
  239. </el-form-item>
  240. <el-form-item label="是否需要创建IFS料号/Does Need Create IFS Part No.">
  241. <el-radio-group v-model="modalData.needCreateNumber" :disabled="isRohsFieldDisabled('needCreateNumber')" style="width: 374px">
  242. <el-radio label="Y" @click.native.prevent="radioClick('needCreateNumber', 'Y')"></el-radio>
  243. <el-radio label="N" @click.native.prevent="radioClick('needCreateNumber', 'N')"></el-radio>
  244. </el-radio-group>
  245. </el-form-item>
  246. <el-form-item label="材料厚度/Material Thickness">
  247. <el-input v-model="modalData.materialThickness" :disabled="isRohsFieldDisabled('materialThickness')" style="width: 260px"></el-input>
  248. </el-form-item>
  249. </el-form>
  250. <el-form :inline="true" label-position="top" :model="modalData">
  251. <el-form-item label="材料有效期/Material Validity Time">
  252. <dict-data-select v-model="modalData.materialValidityTime" clearable :disabled="isRohsFieldDisabled('materialValidityTime')" style="width: 260px" dict-type="rohs_material_validity_time"></dict-data-select>
  253. </el-form-item>
  254. <el-form-item label="是否需要Deviation/If need deviation or not">
  255. <el-radio-group v-model="modalData.needDeviation" :disabled="isRohsFieldDisabled('needDeviation')" style="width: 259px">
  256. <el-radio label="Y" @click.native.prevent="radioClick('needDeviation', 'Y')"></el-radio>
  257. <el-radio label="N" @click.native.prevent="radioClick('needDeviation', 'N')"></el-radio>
  258. </el-radio-group>
  259. </el-form-item>
  260. <el-form-item>
  261. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('npdEngineer')" slot="label" @click="getBaseList(2001, 3)"><a herf="#">NPD工程师/NPD Engineer</a></span>
  262. <span v-else slot="label">NPD工程师/NPD Engineer</span>
  263. <el-input v-model="modalData.npdEngineer" @blur="npdEngineerBlur(2001)" :disabled="isRohsFieldDisabled('npdEngineer')" style="width: 100px"></el-input>
  264. <el-input v-model="modalData.npdEngineerName" disabled style="width: 155px"></el-input>
  265. </el-form-item>
  266. </el-form>
  267. <el-form :inline="true" label-position="top" :model="modalData">
  268. <el-form-item label="材料有效期备注/Material Validity Time Comments">
  269. <el-input v-model="modalData.materialValidityComments" :disabled="isRohsFieldDisabled('materialValidityComments')" style="width: 260px"></el-input>
  270. </el-form-item>
  271. <el-form-item label="预计提供报告时间(一个月内)/Expect Date" style="margin-left: -2px">
  272. <el-date-picker v-model="modalData.expectReportTime" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('expectReportTime')" style="width: 259px" :editable=false></el-date-picker>
  273. </el-form-item>
  274. <el-form-item>
  275. <span style="cursor: pointer" v-if="!isRohsFieldDisabled('buyer')" slot="label" @click="getBaseList(2000, 2)"><a herf="#">采购/Buyer</a></span>
  276. <span v-else slot="label">采购/Buyer</span>
  277. <el-input v-model="modalData.buyer" @blur="buyerBlur(2000)" :disabled="isRohsFieldDisabled('buyer')" style="width: 100px"></el-input>
  278. <el-input v-model="modalData.buyerName" disabled style="width: 156px"></el-input>
  279. </el-form-item>
  280. </el-form>
  281. <el-form :inline="true" label-position="top" :model="modalData">
  282. <el-form-item label="所需审批文件/Qualification Documents needed" >
  283. <dict-data-select
  284. :key="'qualification-default-' + (modalData.referenceNo || '') + '-' + (isEditMode ? 'edit' : 'add')"
  285. class="rohs-multiple-two-rows"
  286. v-model="modalData.qualificationDocumentsNeededList"
  287. multiple
  288. :use-default-value="!isEditMode"
  289. :use-type-multi-default-value="!isEditMode"
  290. :title="getMultipleSelectTitle(modalData.qualificationDocumentsNeededList)"
  291. :disabled="isRohsFieldDisabled('qualificationDocumentsNeeded')"
  292. style="width: 807px"
  293. dict-type="rohs_qualification_docs">
  294. </dict-data-select>
  295. </el-form-item>
  296. </el-form>
  297. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 40px">
  298. <el-form-item label="测试报告必测项/Test Report including items">
  299. <dict-data-select
  300. :key="'test-report-default-' + (modalData.referenceNo || '') + '-' + (isEditMode ? 'edit' : 'add')"
  301. class="rohs-multiple-two-rows"
  302. v-model="modalData.testReportIncludingItemsList"
  303. multiple
  304. :use-default-value="!isEditMode"
  305. :use-type-multi-default-value="!isEditMode"
  306. :title="getMultipleSelectTitle(modalData.testReportIncludingItemsList)"
  307. :disabled="isRohsFieldDisabled('testReportIncludingItems')"
  308. style="width: 807px"
  309. dict-type="rohs_test_report_items">
  310. </dict-data-select>
  311. </el-form-item>
  312. </el-form>
  313. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 40px">
  314. <el-form-item style="display: block;">
  315. <template slot="label">
  316. <span>备注说明/Comments</span>
  317. <el-button
  318. v-if="authDataEntry"
  319. style="margin-left: 2px;width: 83px;line-height: 0.5;font-size: 10px;"
  320. type="primary"
  321. @click="openRohsRemarkDialog">备注</el-button>
  322. </template>
  323. <el-input type="textarea" :rows="3" v-model="modalData.remark" :disabled="isRohsFieldDisabled('remark')" resize="none" style="width: 804px;height: 30px"></el-input>
  324. </el-form-item>
  325. </el-form>
  326. </div>
  327. </el-tab-pane>
  328. <!-- NPD 信息 -->
  329. <el-tab-pane label="NPD 信息" name="npdInfo">
  330. <div style="height: 755px; overflow-y: auto;">
  331. <!-- <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">-->
  332. <!-- <el-form-item label="现有材料不同规格/Same Material Diff Size">-->
  333. <!-- <el-radio-group v-model="modalData.isSameMaterialDiffSize" :disabled="isRohsFieldDisabled('isSameMaterialDiffSize')" style="width: 190px">-->
  334. <!-- <el-radio label="Y" @click.native.prevent="radioClick('isSameMaterialDiffSize', 'Y')"></el-radio>-->
  335. <!-- <el-radio label="N" @click.native.prevent="radioClick('isSameMaterialDiffSize', 'N')"></el-radio>-->
  336. <!-- </el-radio-group>-->
  337. <!-- </el-form-item>-->
  338. <!-- </el-form>-->
  339. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  340. <el-form-item style="display: block;">
  341. <template slot="label">
  342. <span>材料描述/Material Desc.</span>
  343. <el-button
  344. v-if="authMaterialDescRemark"
  345. style="margin-left: 2px;width: 83px;line-height: 0.5;font-size: 10px;"
  346. type="primary"
  347. @click="openRohsMaterialDescDialog">编辑</el-button>
  348. </template>
  349. <el-input type="textarea" :rows="3" v-model="modalData.materialDesc" :disabled="isRohsFieldDisabled('materialDesc')" resize="none" style="width: 804px;height: 30px"></el-input>
  350. </el-form-item>
  351. </el-form>
  352. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 50px">
  353. <el-form-item label="备注说明/NPD Remark" style="display: block;">
  354. <el-input type="textarea" :rows="3" v-model="modalData.npdRemark" :disabled="isRohsFieldDisabled('npdRemark')" resize="none" style="width: 804px;height: 30px"></el-input>
  355. </el-form-item>
  356. </el-form>
  357. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 50px">
  358. <el-form-item label="内部TDS/Inner TDS" style="display: block;">
  359. <oss-components
  360. ref="modalTdsOss"
  361. :save-visible="authFileSave"
  362. :edit-visible="authFileSave"
  363. :download-visible="authFileDownLoad"
  364. :remove-visible="authFileRemove"
  365. :preview-visible="authFilePreview"
  366. :disabled="showModalFlag || modalData.status === '已完成'"
  367. :enable-upgrade="!showModalFlag && modalData.status !== '已完成'"
  368. :require-file-no-rev="true"
  369. :auto-file-no="true"
  370. :single-upload="true"
  371. :row-click-select="true"
  372. :show-order-ref2="false"
  373. label="序列号"
  374. :height="510"
  375. style="margin-top: 2px"
  376. :columns="tdsFileColumnList"
  377. :order-ref1="modalData.site || ''"
  378. :order-ref2="modalData.referenceNo || ''"
  379. order-ref3="tdsProperty">
  380. </oss-components>
  381. </el-form-item>
  382. </el-form>
  383. </div>
  384. </el-tab-pane>
  385. <!-- HSF 填写信息 -->
  386. <el-tab-pane label="HSF 填写信息" name="hsfInfo">
  387. <div style="height: 755px">
  388. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  389. <el-form-item label="报告日期/Report Date">
  390. <el-date-picker v-model="modalData.expiredDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('expiredDate')" style="width: 150px" :editable=false></el-date-picker>
  391. </el-form-item>
  392. <el-form-item label="有效期数值/Valid Until Value">
  393. <el-input-number
  394. v-model="modalData.validUntilValue"
  395. :controls="false"
  396. :min="0"
  397. :step="1"
  398. :precision="0"
  399. :disabled="isValidUntilValueDisabled()"
  400. style="width: 150px">
  401. </el-input-number>
  402. </el-form-item>
  403. <el-form-item label="有效期单位/Valid Until Unit">
  404. <dict-data-select v-model="modalData.validUntil" clearable :disabled="isValidUntilUnitDisabled()" style="width: 150px" dict-type="rohs_valid_until"></dict-data-select>
  405. </el-form-item>
  406. <el-form-item label="失效日期/Expiry Date">
  407. <el-date-picker v-model="modalData.expiryDate" type="date" value-format="yyyy-MM-dd" disabled style="width: 150px" :editable=false></el-date-picker>
  408. </el-form-item>
  409. <el-form-item label="状态/Status">
  410. <el-select v-model="modalData.rohsStatus" clearable :disabled="isRohsFieldDisabled('rohsStatus')" style="width: 150px">
  411. <el-option label="Active" value="Active"></el-option>
  412. <el-option label="Dead" value="Dead"></el-option>
  413. </el-select>
  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: 260px">
  433. <el-radio label="高风险" @click.native.prevent="radioClick('hsfSupplierClassification', '高风险')">高风险</el-radio>
  434. <el-radio label="中风险" @click.native.prevent="radioClick('hsfSupplierClassification', '中风险')">中风险</el-radio>
  435. <el-radio label="低风险" @click.native.prevent="radioClick('hsfSupplierClassification', '低风险')">低风险</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: 755px">
  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="isEditMode && canEditRohsMaterial()" @click="openCreateIfsPartDialog">创建IFS料号</el-button>
  489. <el-button type="primary" v-if="!showModalFlag && canEditRohsMaterial()" @click="openProjectMaterialDialog">关联料号</el-button>
  490. <el-button type="danger" v-if="!showModalFlag && canEditRohsMaterial()" @click="removeSelectedMaterialRows">删除关联</el-button>
  491. </el-form-item>
  492. </el-form>
  493. <el-table
  494. ref="rohsMaterialTable"
  495. class="rohs-material-table"
  496. border
  497. :data="modalData.materialList"
  498. @selection-change="materialSelectionChange"
  499. :header-cell-style="materialDialogHeaderCellStyle"
  500. :height="715"
  501. style="width: 100%">
  502. <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
  503. <el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
  504. <el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="150" header-align="center" align="left" :show-overflow-tooltip="true">
  505. <template slot-scope="scope">
  506. <el-link style="cursor:pointer;" @click="toPartMenu(scope.row.finalPartNo || scope.row.testPartNo)">
  507. {{ scope.row.finalPartNo || scope.row.testPartNo || '' }}
  508. </el-link>
  509. </template>
  510. </el-table-column>
  511. <el-table-column prop="partDesc" label="描述/Part Desc." min-width="250" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  512. <el-table-column prop="partStatus" label="状态/Part Status" min-width="100" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  513. </el-table>
  514. </div>
  515. </el-tab-pane>
  516. <el-tab-pane label="附件信息" name="attachmentInfo">
  517. <div style="height: 755px; overflow-y: auto;">
  518. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
  519. <el-form-item label="TDS" style="display: block;">
  520. <oss-components
  521. ref="modalAttachmentTdsOss"
  522. :save-visible="authFileSave"
  523. :edit-visible="authFileSave"
  524. :download-visible="authFileDownLoad"
  525. :remove-visible="authFileRemove"
  526. :preview-visible="authFilePreview"
  527. :row-click-select="true"
  528. :disabled="modalData.status === '已完成'"
  529. label="序列号"
  530. :height="145"
  531. style="margin-top: 2px"
  532. :columns="fileColumnList"
  533. :order-ref1="modalData.site || ''"
  534. :order-ref2="modalData.referenceNo || ''"
  535. order-ref3="rohsAttachmentTds">
  536. </oss-components>
  537. </el-form-item>
  538. </el-form>
  539. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 150px;">
  540. <el-form-item label="MSDS" style="display: block;">
  541. <oss-components
  542. ref="modalAttachmentMsdsOss"
  543. :save-visible="authFileSave"
  544. :edit-visible="authFileSave"
  545. :download-visible="authFileDownLoad"
  546. :remove-visible="authFileRemove"
  547. :preview-visible="authFilePreview"
  548. :row-click-select="true"
  549. :disabled="modalData.status === '已完成'"
  550. label="序列号"
  551. :height="145"
  552. style="margin-top: 2px"
  553. :columns="fileColumnList"
  554. :order-ref1="modalData.site || ''"
  555. :order-ref2="modalData.referenceNo || ''"
  556. order-ref3="rohsAttachmentMsds">
  557. </oss-components>
  558. </el-form-item>
  559. </el-form>
  560. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 150px;">
  561. <el-form-item label="测试报告/Test Report" style="display: block;">
  562. <oss-components
  563. ref="modalAttachmentTestReportOss"
  564. :save-visible="authFileSave"
  565. :edit-visible="authFileSave"
  566. :download-visible="authFileDownLoad"
  567. :remove-visible="authFileRemove"
  568. :preview-visible="authFilePreview"
  569. :row-click-select="true"
  570. :disabled="modalData.status === '已完成'"
  571. label="序列号"
  572. :height="145"
  573. style="margin-top: 2px"
  574. :columns="fileColumnList"
  575. :order-ref1="modalData.site || ''"
  576. :order-ref2="modalData.referenceNo || ''"
  577. order-ref3="rohsAttachmentTestReport">
  578. </oss-components>
  579. </el-form-item>
  580. </el-form>
  581. <el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 150px;">
  582. <el-form-item label="Other" style="display: block;">
  583. <oss-components
  584. ref="modalAttachmentOtherOss"
  585. :save-visible="authFileSave"
  586. :edit-visible="authFileSave"
  587. :download-visible="authFileDownLoad"
  588. :remove-visible="authFileRemove"
  589. :preview-visible="authFilePreview"
  590. :row-click-select="true"
  591. :disabled="modalData.status === '已完成'"
  592. label="序列号"
  593. :height="145"
  594. style="margin-top: 2px"
  595. :columns="fileColumnList"
  596. :order-ref1="modalData.site || ''"
  597. :order-ref2="modalData.referenceNo || ''"
  598. order-ref3="rohsAttachmentOther">
  599. </oss-components>
  600. </el-form-item>
  601. </el-form>
  602. </div>
  603. </el-tab-pane>
  604. </el-tabs>
  605. <el-footer style="height:35px;margin-top: 15px;text-align:center">
  606. <el-button type="primary" v-if="canSaveAction()" @click="dataFormSubmit()">保存</el-button>
  607. <el-button type="primary" @click="handleModalClose">关闭</el-button>
  608. <el-button type="primary" v-if="canAgreeAction()" :loading="submitLoading" @click="agreeSubmit">同意</el-button>
  609. <el-button type="primary" v-if="canRejectAction()" :loading="submitLoading" @click="openRejectModal">驳回</el-button>
  610. </el-footer>
  611. </el-dialog>
  612. <!--选择项目模态框-->
  613. <el-dialog title="选择-项目" :close-on-click-modal="false" @close="closeProjectInfoDialog"
  614. @open="searchProjectInfoList" :visible.sync="chooseProjectListFlag" width="35%">
  615. <el-form label-position="top" :model="searchProjectData" ref="closeProjectInfoForm">
  616. <el-row :gutter="10">
  617. <el-col :span="6">
  618. <el-form-item label="项目号">
  619. <el-input v-model="searchProjectData.projectId"></el-input>
  620. </el-form-item>
  621. </el-col>
  622. <el-col :span="6">
  623. <el-form-item label="项目名称">
  624. <el-input v-model="searchProjectData.projectName"></el-input>
  625. </el-form-item>
  626. </el-col>
  627. <el-col :span="6">
  628. <el-form-item label=" ">
  629. <el-button type="primary" @click="searchProjectInfoList">查询</el-button>
  630. </el-form-item>
  631. </el-col>
  632. </el-row>
  633. <el-table :height="223"
  634. :data="projectList"
  635. border
  636. @row-click="projectClickRow">
  637. <el-table-column label="项目号" prop="projectId"/>
  638. <el-table-column label="项目名称" prop="projectName"/>
  639. </el-table>
  640. </el-form>
  641. <el-footer style="height:35px;margin-top: 10px;text-align:center">
  642. <el-button type="primary" @click="chooseProjectListFlag = false">关闭</el-button>
  643. </el-footer>
  644. </el-dialog>
  645. <el-dialog title="选择物料" top="15vh" width="50%" :close-on-click-modal="false" v-drag :visible.sync="projectMaterialDialogFlag">
  646. <el-form :inline="true" label-position="top" :model="projectMaterialSearchData">
  647. <el-form-item label="IFS物料编码/Final Part No.">
  648. <el-input v-model="projectMaterialSearchData.finalPartNo" clearable style="width: 150px"></el-input>
  649. </el-form-item>
  650. <el-form-item label="描述/Part Desc">
  651. <el-input v-model="projectMaterialSearchData.partDesc" clearable style="width: 200px"></el-input>
  652. </el-form-item>
  653. <el-form-item label="状态/Part Status">
  654. <el-input v-model="projectMaterialSearchData.partStatus" clearable style="width: 100px"></el-input>
  655. </el-form-item>
  656. <el-form-item label=" ">
  657. <el-button type="primary" @click="searchProjectMaterialList">查询</el-button>
  658. </el-form-item>
  659. </el-form>
  660. <el-table
  661. ref="projectMaterialTable"
  662. class="rohs-material-table"
  663. border
  664. v-loading="projectMaterialLoading"
  665. :data="projectMaterialList"
  666. @selection-change="projectMaterialSelectionChange"
  667. :header-cell-style="materialDialogHeaderCellStyle"
  668. :height="320"
  669. style="width: 100%">
  670. <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
  671. <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>
  672. <el-table-column prop="partDesc" label="描述/Part Desc." min-width="250" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  673. <el-table-column prop="partStatus" label="状态/Part Status" min-width="80" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  674. </el-table>
  675. <el-pagination
  676. style="margin-top: 10px"
  677. @size-change="projectMaterialSizeChangeHandle"
  678. @current-change="projectMaterialCurrentChangeHandle"
  679. :current-page="projectMaterialPageIndex"
  680. :page-sizes="[20, 50, 100]"
  681. :page-size="projectMaterialPageSize"
  682. :total="projectMaterialTotal"
  683. layout="total, sizes, prev, pager, next, jumper">
  684. </el-pagination>
  685. <el-footer style="height:35px;margin-top: 10px;text-align:center">
  686. <el-button type="primary" @click="confirmProjectMaterialSelection">确定</el-button>
  687. <el-button type="primary" @click="projectMaterialDialogFlag = false">关闭</el-button>
  688. </el-footer>
  689. </el-dialog>
  690. <el-dialog
  691. title="创建IFS料号"
  692. top="7vh"
  693. width="1060px"
  694. v-drag
  695. :close-on-click-modal="false"
  696. :visible.sync="rohsCreatePartDialogFlag"
  697. @close="closeRohsCreatePartDialog">
  698. <el-form :inline="true" label-position="top" :model="rohsCreatePartData" style="margin-top: -5px;">
  699. <el-form-item label="Site">
  700. <el-input v-model="rohsCreatePartData.site" disabled style="width: 80px"></el-input>
  701. </el-form-item>
  702. <el-form-item label="物料编码 / Part No.">
  703. <el-input v-model="rohsCreatePartData.partNo" clearable style="width: 200px"></el-input>
  704. </el-form-item>
  705. <el-form-item label="物料名称 / Part Desc.">
  706. <el-input v-model="rohsCreatePartData.partDesc" clearable style="width: 360px"></el-input>
  707. </el-form-item>
  708. <el-form-item :label="' '">
  709. <el-button type="primary" @click="nextRohsCreatePartNo">Next Part No</el-button>
  710. </el-form-item>
  711. </el-form>
  712. <el-tabs v-model="rohsCreatePartTab" style="width: 100%;height: 465px;" type="border-card">
  713. <el-tab-pane label="General" name="General">
  714. <el-form :inline="true" label-position="top" :model="rohsCreatePartData" style="margin-top: -5px;">
  715. <el-form-item label="零件类型 / Part Type">
  716. <el-select v-model="rohsCreatePartData.partType" style="width: 458px">
  717. <el-option label="Manufactured" value="Manufactured"></el-option>
  718. <el-option label="Manufactured Recipe" value="Manufactured Recipe"></el-option>
  719. <el-option label="Purchased (raw)" value="Purchased (raw)"></el-option>
  720. <el-option label="Purchased" value="Purchased"></el-option>
  721. </el-select>
  722. </el-form-item>
  723. <el-form-item>
  724. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(123)"><a herf="#">安全代码 / Safety Code</a></span>
  725. <el-input v-model="rohsCreatePartData.hazardCode" clearable @blur="rohsCreateHazardCodeBlur(123)" style="width: 128px"></el-input>
  726. <el-input v-model="rohsCreatePartData.hazardDesc" disabled style="width: 327px"></el-input>
  727. </el-form-item>
  728. </el-form>
  729. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  730. <el-form-item>
  731. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(113)"><a herf="#">计划人 / Planner</a></span>
  732. <el-input v-model="rohsCreatePartData.productGroupId4" clearable @blur="rohsCreateProductGroupId4Blur(113)" style="width: 128px"></el-input>
  733. <el-input v-model="rohsCreatePartData.productGroupName4" disabled style="width: 327px"></el-input>
  734. </el-form-item>
  735. <el-form-item>
  736. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(112)"><a herf="#">会计组 / Accounting Group</a></span>
  737. <el-input v-model="rohsCreatePartData.productGroupId3" clearable @blur="rohsCreateProductGroupId3Blur(112)" style="width: 128px"></el-input>
  738. <el-input v-model="rohsCreatePartData.productGroupName3" disabled style="width: 327px"></el-input>
  739. </el-form-item>
  740. </el-form>
  741. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  742. <el-form-item>
  743. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(1007)"><a herf="#">计量单位 / Inventory UoM</a></span>
  744. <el-input v-model="rohsCreatePartData.umId" clearable @blur="rohsCreateUmIdBlur(1007)" style="width: 128px"></el-input>
  745. <el-input v-model="rohsCreatePartData.umName" disabled style="width: 327px"></el-input>
  746. </el-form-item>
  747. <el-form-item>
  748. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(109)"><a herf="#">产品代码 / Product Code</a></span>
  749. <el-input v-model="rohsCreatePartData.groupId" clearable @blur="rohsCreateGroupIdBlur(109)" style="width: 128px"></el-input>
  750. <el-input v-model="rohsCreatePartData.groupName" disabled style="width: 327px"></el-input>
  751. </el-form-item>
  752. </el-form>
  753. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  754. <el-form-item>
  755. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(110)"><a herf="#">商品组1 / Comm Group 1</a></span>
  756. <el-input v-model="rohsCreatePartData.productGroupId1" clearable @blur="rohsCreateProductGroupId1Blur(110)" style="width: 128px"></el-input>
  757. <el-input v-model="rohsCreatePartData.productGroupName1" disabled style="width: 327px"></el-input>
  758. </el-form-item>
  759. <el-form-item>
  760. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(108)"><a herf="#">产品大类 / Product Family</a></span>
  761. <el-input v-model="rohsCreatePartData.familyId" clearable @blur="rohsCreateFamilyIdBlur(108)" style="width: 128px"></el-input>
  762. <el-input v-model="rohsCreatePartData.familyName" disabled style="width: 327px"></el-input>
  763. </el-form-item>
  764. </el-form>
  765. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  766. <el-form-item>
  767. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(111)"><a herf="#">商品组2 / Comm Group 2</a></span>
  768. <el-input v-model="rohsCreatePartData.productGroupId2" clearable @blur="rohsCreateProductGroupId2Blur(111)" style="width: 128px"></el-input>
  769. <el-input v-model="rohsCreatePartData.productGroupName2" disabled style="width: 327px"></el-input>
  770. </el-form-item>
  771. <el-form-item label="类型指定 / Type Designation">
  772. <el-input v-model="rohsCreatePartData.typeDesignation" clearable style="width: 458px"></el-input>
  773. </el-form-item>
  774. </el-form>
  775. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  776. <el-form-item>
  777. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(130)"><a herf="#">商品组3 / Comm Group 3</a></span>
  778. <el-input v-model="rohsCreatePartData.commGroup3" clearable @blur="rohsCreateCommGroup3Blur(130)" style="width: 128px"></el-input>
  779. <el-input v-model="rohsCreatePartData.commGroup3Desc" disabled style="width: 327px"></el-input>
  780. </el-form-item>
  781. </el-form>
  782. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  783. <el-form-item>
  784. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(124)"><a herf="#">资产等级 / Asset Class</a></span>
  785. <el-input v-model="rohsCreatePartData.assetClass" clearable @blur="rohsCreateAssetClassBlur(124)" style="width: 128px"></el-input>
  786. <el-input v-model="rohsCreatePartData.assetClassDesc" disabled style="width: 327px"></el-input>
  787. </el-form-item>
  788. <el-form-item label="尺寸/材质 / Dimension/Quality">
  789. <el-input v-model="rohsCreatePartData.dimQuality" clearable style="width: 458px"></el-input>
  790. </el-form-item>
  791. </el-form>
  792. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  793. <el-form-item>
  794. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(125)"><a herf="#">零件状态 / Part Status</a></span>
  795. <el-input v-model="rohsCreatePartData.partStatus" clearable @blur="rohsCreatePartStatusBlur(125)" style="width: 128px"></el-input>
  796. <el-input v-model="rohsCreatePartData.partStatusDesc" disabled style="width: 327px"></el-input>
  797. </el-form-item>
  798. <el-form-item label="净重">
  799. <el-input class="inlineNumber numInput" v-model="rohsCreatePartData.weightNet" readonly type="number" style="width: 110px"></el-input>
  800. </el-form-item>
  801. <el-form-item label="净重单位" style="margin-left: -10px">
  802. <el-input v-model="rohsCreatePartData.uomForWeightNet" readonly style="width: 110px"></el-input>
  803. </el-form-item>
  804. <el-form-item label="频率级别 / Frequency Class">
  805. <el-input v-model="rohsCreatePartData.frequencyClass" readonly style="width: 220px"></el-input>
  806. </el-form-item>
  807. </el-form>
  808. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  809. <el-form-item>
  810. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(126)"><a herf="#">ABC类 / ABC Class</a></span>
  811. <el-input v-model="rohsCreatePartData.abcClass" clearable @blur="rohsCreateAbcClassBlur(126)" style="width: 128px"></el-input>
  812. <el-input v-model="rohsCreatePartData.abcClassDesc" disabled style="width: 327px"></el-input>
  813. </el-form-item>
  814. <el-form-item label="净数量">
  815. <el-input class="inlineNumber numInput" v-model="rohsCreatePartData.volumeNet" readonly type="number" style="width: 110px"></el-input>
  816. </el-form-item>
  817. <el-form-item label="数量单位" style="margin-left: -10px">
  818. <el-input v-model="rohsCreatePartData.uomForVolumeNet" readonly style="width: 110px"></el-input>
  819. </el-form-item>
  820. <el-form-item label="生命周期阶段 / Lifecycle Stage">
  821. <el-input v-model="rohsCreatePartData.lifecycleStage" readonly style="width: 220px"></el-input>
  822. </el-form-item>
  823. </el-form>
  824. </el-tab-pane>
  825. <el-tab-pane label="Acquisition" name="Acquisition">
  826. <el-form :inline="true" label-position="top" :model="rohsCreatePartData" style="margin-top: -5px;">
  827. <el-form-item label="制造备货期 / Manufacturing Lead Time">
  828. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.manufacturingLeadTime" @change="rohsChangeExpectedLeadTime" :disabled="!(rohsCreatePartData.partType === 'Manufactured' || rohsCreatePartData.partType === 'Manufactured Recipe')" style="width: 222px"></el-input-number>
  829. </el-form-item>
  830. <el-form-item label="Shelf Life(Weeks)">
  831. <el-input class="inlineNumber numInput" v-model="rohsCreatePartData.durabilityWeek" readonly type="number" style="width: 221px"></el-input>
  832. </el-form-item>
  833. <el-form-item>
  834. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(127)"><a herf="#">来源国家 / Country of Origin</a></span>
  835. <el-input v-model="rohsCreatePartData.countryOfOrigin" clearable @blur="rohsCreateCountryOfOriginBlur(127)" style="width: 128px"></el-input>
  836. <el-input v-model="rohsCreatePartData.countryOfOriginDesc" disabled style="width: 327px"></el-input>
  837. </el-form-item>
  838. </el-form>
  839. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  840. <el-form-item label="预期提前期 / Expected Lead Time">
  841. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.expectedLeadTime" style="width: 222px"></el-input-number>
  842. </el-form-item>
  843. <el-form-item label="Shelf Life(Days)">
  844. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.durabilityDay" @change="rohsChangeDurabilityWeek" style="width: 221px"></el-input-number>
  845. </el-form-item>
  846. <el-form-item>
  847. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(128)"><a herf="#">区域代码 / Region Code</a></span>
  848. <el-input v-model="rohsCreatePartData.regionOfOrigin" clearable @blur="rohsCreateRegionOfOriginBlur(128)" style="width: 128px"></el-input>
  849. <el-input v-model="rohsCreatePartData.regionOfOriginDesc" disabled style="width: 327px"></el-input>
  850. </el-form-item>
  851. </el-form>
  852. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  853. <el-form-item label="州内转换因子 / Intrastat Conv Factor">
  854. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.intrastatConvFactor" style="width: 128px"></el-input-number>
  855. <el-input v-model="rohsCreatePartData.umDesc" disabled style="width: 327px"></el-input>
  856. </el-form-item>
  857. <el-form-item>
  858. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(129)"><a herf="#">海关统计序号 / Customs Stat No</a></span>
  859. <el-input v-model="rohsCreatePartData.customsStatNo" clearable @blur="rohsCreateCustomsStatNoBlur(129)" style="width: 128px"></el-input>
  860. <el-input v-model="rohsCreatePartData.customsStatDesc" disabled style="width: 327px"></el-input>
  861. </el-form-item>
  862. </el-form>
  863. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  864. <el-form-item label="默认物料需求供应 / Default Mtr Req Supply">
  865. <el-select v-model="rohsCreatePartData.supplyCode" style="width: 458px" clearable>
  866. <el-option label="Inventory Order" value="Inventory Order"></el-option>
  867. <el-option label="Purchase Order" value="Purchase Order"></el-option>
  868. </el-select>
  869. </el-form-item>
  870. </el-form>
  871. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  872. <el-form-item label="备注" style="height: 80px">
  873. <el-input type="textarea" v-model="rohsCreatePartData.remark" :rows="3" resize='none' show-word-limit style="width: 931px"></el-input>
  874. </el-form-item>
  875. </el-form>
  876. </el-tab-pane>
  877. <el-tab-pane label="Costs" name="Costs">
  878. <el-form :inline="true" label-position="top" :model="rohsCreatePartData" style="margin-top: -5px;">
  879. <el-form-item label="配置标识 / Configuration ID">
  880. <el-select v-model="rohsCreatePartData.configurationId" style="width: 220px">
  881. <el-option label="*" value="*"></el-option>
  882. </el-select>
  883. </el-form-item>
  884. <el-form-item label="估计物料成本 / Estimated Material Cost">
  885. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.estimatedMaterialCost" style="width: 220px"></el-input-number>
  886. </el-form-item>
  887. </el-form>
  888. </el-tab-pane>
  889. <el-tab-pane label="Misc Part Info" name="MiscPartInfo">
  890. <el-form :inline="true" label-position="top" :model="rohsCreatePartData" style="margin-top: -5px;">
  891. <el-form-item label="库存估价方法 / Inventory Valuation Method">
  892. <el-select v-model="rohsCreatePartData.inventoryValuationMethod" style="width: 458px">
  893. <el-option label="Weighted Average" value="Weighted Average"></el-option>
  894. <el-option label="Standard Cost" value="Standard Cost"></el-option>
  895. <el-option label="First In First Out" value="First In First Out"></el-option>
  896. <el-option label="Last In First Out" value="Last In First Out"></el-option>
  897. </el-select>
  898. </el-form-item>
  899. <el-form-item>
  900. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(131)"><a herf="#">零件成本组 / Part Cost Group</a></span>
  901. <el-input v-model="rohsCreatePartData.partCostGroupId" clearable @blur="rohsCreatePartCostGroupIdBlur(131)" style="width: 128px"></el-input>
  902. <el-input v-model="rohsCreatePartData.partCostGroupDesc" disabled style="width: 327px"></el-input>
  903. </el-form-item>
  904. </el-form>
  905. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  906. <el-form-item label="库存件成本层 / Inventory Part Cost Level">
  907. <el-select v-model="rohsCreatePartData.inventoryPartCostLevel" style="width: 458px">
  908. <el-option label="Cost Per Part" value="Cost Per Part"></el-option>
  909. <el-option label="Cost Per Configuration" value="Cost Per Configuration"></el-option>
  910. <el-option label="Cost Per Condition" value="Cost Per Condition"></el-option>
  911. <el-option label="Cost Per Lot Batch" value="Cost Per Lot Batch"></el-option>
  912. <el-option label="Cost Per Serial" value="Cost Per Serial"></el-option>
  913. </el-select>
  914. </el-form-item>
  915. </el-form>
  916. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  917. <el-form-item label="供应商发票事项 / Supplier Invoice Consideration">
  918. <el-select v-model="rohsCreatePartData.invoiceConsideration" style="width: 458px">
  919. <el-option label="Ignore Invoice Price" value="Ignore Invoice Price"></el-option>
  920. <el-option label="Periodic Weighted Average" value="Periodic Weighted Average"></el-option>
  921. <el-option label="Transaction Based" value="Transaction Based"></el-option>
  922. </el-select>
  923. </el-form-item>
  924. </el-form>
  925. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  926. <el-form-item label="零成本 / Zero Cost">
  927. <el-select v-model="rohsCreatePartData.zeroCostFlag" style="width: 458px">
  928. <el-option label="Zero Cost Allowed" value="Zero Cost Allowed"></el-option>
  929. <el-option label="Zero Cost Forbidden" value="Zero Cost Forbidden"></el-option>
  930. <el-option label="Zero Cost Only" value="Zero Cost Only"></el-option>
  931. </el-select>
  932. </el-form-item>
  933. </el-form>
  934. </el-tab-pane>
  935. <el-tab-pane label="Planning Data" name="PlanningData">
  936. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  937. <el-form-item>
  938. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(132)"><a herf="#">计划方法 / Planning Method</a></span>
  939. <el-input v-model="rohsCreatePartData.planningMethod" clearable @blur="rohsCreatePlanningMethodBlur(132)" style="width: 170px"></el-input>
  940. </el-form-item>
  941. <el-form-item label=" ">
  942. <el-input v-model="rohsCreatePartData.planningMethodDesc" disabled style="width: 510px"></el-input>
  943. </el-form-item>
  944. </el-form>
  945. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  946. <el-form-item label="安全库存 / Safety Stock">
  947. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.safetyStock" style="width: 170px"></el-input-number>
  948. </el-form-item>
  949. <el-form-item label="最小批量 / Min Lot Size">
  950. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.minOrderQty" style="width: 170px"></el-input-number>
  951. </el-form-item>
  952. <el-form-item label="最大批量 / Max Lot Size">
  953. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.maxOrderQty" style="width: 155px"></el-input-number>
  954. </el-form-item>
  955. <el-form-item label="多种批量大小 / Multiple Lot Size">
  956. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.mulOrderQty" style="width: 155px"></el-input-number>
  957. </el-form-item>
  958. </el-form>
  959. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  960. <el-form-item label="安全提前期 / Safety Lead Time">
  961. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.safetyLeadTime" style="width: 170px"></el-input-number>
  962. </el-form-item>
  963. <el-form-item label="报废因子(%) / Scrap Factor(%)">
  964. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.shrinkageFac" style="width: 170px"></el-input-number>
  965. </el-form-item>
  966. <el-form-item label="标准批量大小 / Std Lot Size">
  967. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.stdOrderQty" style="width: 155px"></el-input-number>
  968. </el-form-item>
  969. </el-form>
  970. </el-tab-pane>
  971. <el-tab-pane label="Manufacturing" name="Manufacturing">
  972. <el-form :inline="true" label-position="top" :model="rohsCreatePartData" style="margin-top: -5px;">
  973. <el-form-item label="累计提前期 / Cum Lead Time">
  974. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.cumLeadTime" style="width: 294px"></el-input-number>
  975. </el-form-item>
  976. <el-form-item label="预留/下发来源 / Reserve/Issue from">
  977. <el-select v-model="rohsCreatePartData.backFlushPart" style="width: 248px">
  978. <el-option label="All Locations" value="All Locations"></el-option>
  979. <el-option label="Only Floor Stock" value="Only Floor Stock"></el-option>
  980. <el-option label="Only Specified Location" value="Only Specified Location"></el-option>
  981. </el-select>
  982. </el-form-item>
  983. <el-form-item style="margin-top: 23px">
  984. <el-checkbox v-model="rohsCreatePartData.byProdAsSupplyInMrpDb" true-label="Y">将副产品用作MRP中的供应 / Use By-Product as Supply in MRP</el-checkbox>
  985. </el-form-item>
  986. </el-form>
  987. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  988. <el-form-item label="未受保护提前期 / Unprotected Lead Time">
  989. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.unprotectedLeadTime" style="width: 294px"></el-input-number>
  990. </el-form-item>
  991. <el-form-item label="预留/下发方法 / Reserve/Issue Method">
  992. <el-select v-model="rohsCreatePartData.issueType" style="width: 248px">
  993. <el-option label="Reserve" value="Reserve"></el-option>
  994. <el-option label="Backflush" value="Backflush"></el-option>
  995. <el-option label="Reserve And Backflush" value="Reserve And Backflush"></el-option>
  996. <el-option label="Manual" value="Manual"></el-option>
  997. </el-select>
  998. </el-form-item>
  999. <el-form-item style="margin-top: 23px">
  1000. <el-checkbox v-model="rohsCreatePartData.mrpControlFlagDb" true-label="Y">MRP控制 / MRP Control</el-checkbox>
  1001. </el-form-item>
  1002. </el-form>
  1003. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  1004. <el-form-item label="按日固定提前期 / Fixed Lead Time by Day">
  1005. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.fixedLeadTimeDay" style="width: 294px"></el-input-number>
  1006. </el-form-item>
  1007. <el-form-item label="过度报告 / Over Reporting">
  1008. <el-select v-model="rohsCreatePartData.overReporting" style="width: 248px">
  1009. <el-option label="Allowed" value="Allowed"></el-option>
  1010. <el-option label="Allowed with Warning" value="Allowed with Warning"></el-option>
  1011. <el-option label="Not Allowed" value="Not Allowed"></el-option>
  1012. </el-select>
  1013. </el-form-item>
  1014. <el-form-item style="margin-top: 23px">
  1015. <el-checkbox v-model="rohsCreatePartData.useTheoreticalDensityDb" true-label="Y">使用理论 / Use Theoretical</el-checkbox>
  1016. </el-form-item>
  1017. </el-form>
  1018. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  1019. <el-form-item label="按天的可变化提前期 / Variable Lead Time by Day">
  1020. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.variableLeadTimeDay" style="width: 294px"></el-input-number>
  1021. </el-form-item>
  1022. <el-form-item label="报告公差过大 / Over Report Tolerance">
  1023. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.overReportTolerance" style="width: 248px"></el-input-number>
  1024. </el-form-item>
  1025. </el-form>
  1026. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  1027. <el-form-item label="按小时的固定提前期 / Fixed Lead Time by Hour">
  1028. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.fixedLeadTimeHour" style="width: 294px"></el-input-number>
  1029. </el-form-item>
  1030. <el-form-item label="密度 / Density">
  1031. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.density" style="width: 248px"></el-input-number>
  1032. </el-form-item>
  1033. </el-form>
  1034. <el-form :inline="true" label-position="top" :model="rohsCreatePartData">
  1035. <el-form-item label="按小时计算的可变提前期 / Variable Lead Time by Hour">
  1036. <el-input-number :controls="false" :step="0" v-model="rohsCreatePartData.variableLeadTimeHour" style="width: 294px"></el-input-number>
  1037. </el-form-item>
  1038. </el-form>
  1039. </el-tab-pane>
  1040. <el-tab-pane label="Characteristics" name="Characteristics">
  1041. <el-form :inline="true" label-position="top" :model="rohsCreatePartData" style="margin-top: -5px;">
  1042. <el-form-item>
  1043. <span style="cursor: pointer" slot="label" @click="openRohsCreatePartBaseList(20)"><a herf="#">属性模板</a></span>
  1044. <el-input v-model="rohsCreatePartData.codeNo" clearable @blur="rohsCreateCodeNoBlur(20)" style="width: 128px"></el-input>
  1045. <el-input v-model="rohsCreatePartData.codeDesc" disabled style="width: 327px"></el-input>
  1046. </el-form-item>
  1047. <el-form-item :label="' '">
  1048. <el-button type="primary" @click="openRohsCharacteristicDialog">新增</el-button>
  1049. <el-button type="primary" @click="removeRohsPartItemRows">删除</el-button>
  1050. </el-form-item>
  1051. </el-form>
  1052. <div class="rq">
  1053. <el-table
  1054. :data="rohsCreatePartData.partItemList"
  1055. height="355px"
  1056. border
  1057. @selection-change="rohsPartItemSelectionChange"
  1058. style="width: 100%">
  1059. <el-table-column
  1060. type="selection"
  1061. align="center"
  1062. width="50">
  1063. </el-table-column>
  1064. <el-table-column
  1065. v-for="(item,index) in rohsCreatePartColumnItemList" :key="index"
  1066. :sortable="item.columnSortable"
  1067. :prop="item.columnProp"
  1068. :header-align="item.headerAlign"
  1069. :show-overflow-tooltip="item.showOverflowTooltip"
  1070. :align="item.align"
  1071. :fixed="item.fixed===''?false:item.fixed"
  1072. :min-width="item.columnWidth"
  1073. :label="item.columnLabel">
  1074. <template slot-scope="scope">
  1075. <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
  1076. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  1077. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  1078. </div>
  1079. <div v-else>
  1080. <div v-if="scope.row.valueChooseFlag !== 'Y'">
  1081. <el-input-number v-if="scope.row.valueTypeDb === 'N'" v-model="scope.row.numValue" style="padding: 0;width: 100%" :controls="false"></el-input-number>
  1082. <el-input v-else v-model="scope.row.textValue"></el-input>
  1083. </div>
  1084. <div v-else>
  1085. <el-select style="width: 100%;" v-if="scope.row.valueTypeDb === 'T'" v-model="scope.row.textValue" clearable>
  1086. <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableValueList" :key="key"></el-option>
  1087. </el-select>
  1088. <el-select style="width: 100%;" v-else v-model="scope.row.numValue" clearable>
  1089. <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableValueList" :key="key"></el-option>
  1090. </el-select>
  1091. </div>
  1092. </div>
  1093. </template>
  1094. </el-table-column>
  1095. </el-table>
  1096. </div>
  1097. </el-tab-pane>
  1098. </el-tabs>
  1099. <el-footer style="height:35px;margin-top: 10px;text-align:center">
  1100. <el-button type="primary" :loading="rohsCreatePartLoading" @click="saveRohsCreatePart">保存</el-button>
  1101. <el-button type="primary" @click="rohsCreatePartDialogFlag = false">关闭</el-button>
  1102. </el-footer>
  1103. </el-dialog>
  1104. <el-dialog title="物料属性" :close-on-click-modal="false" v-drag :visible.sync="rohsCharacteristicDialogFlag" width="730px">
  1105. <el-form :inline="true" label-position="top" :model="rohsCharacteristicQueryData">
  1106. <el-form-item :label="'属性编码'">
  1107. <el-input v-model="rohsCharacteristicQueryData.propertiesItemNo" clearable style="width: 200px"></el-input>
  1108. </el-form-item>
  1109. <el-form-item :label="'属性名称'">
  1110. <el-input v-model="rohsCharacteristicQueryData.itemDesc" clearable style="width: 200px"></el-input>
  1111. </el-form-item>
  1112. <el-form-item :label="' '">
  1113. <el-button type="primary" @click="queryRohsCharacteristicOptions">查询</el-button>
  1114. </el-form-item>
  1115. </el-form>
  1116. <el-table
  1117. :height="250"
  1118. :data="rohsCharacteristicList"
  1119. border
  1120. ref="rohsCharacteristicTable"
  1121. @row-click="rohsCharacteristicRowClick"
  1122. @selection-change="rohsCharacteristicSelectionChange"
  1123. style="width: 100%;">
  1124. <el-table-column type="selection" align="center" width="50"></el-table-column>
  1125. <el-table-column
  1126. v-for="(item,index) in rohsCharacteristicColumnList" :key="index"
  1127. :sortable="item.columnSortable"
  1128. :prop="item.columnProp"
  1129. :header-align="item.headerAlign"
  1130. :show-overflow-tooltip="item.showOverflowTooltip"
  1131. :align="item.align"
  1132. :fixed="item.fixed===''?false:item.fixed"
  1133. :min-width="item.columnWidth"
  1134. :label="item.columnLabel">
  1135. <template slot-scope="scope">
  1136. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  1137. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  1138. </template>
  1139. </el-table-column>
  1140. </el-table>
  1141. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  1142. <el-button type="primary" @click="saveRohsCharacteristics">保存</el-button>
  1143. <el-button type="primary" @click="rohsCharacteristicDialogFlag = false">关闭</el-button>
  1144. </el-footer>
  1145. </el-dialog>
  1146. <el-dialog title="人员选择" @open="openHsfApproverDialog" @close="closeHsfApproverDialog" v-drag
  1147. :visible.sync="hsfApproverFlag" width="40vw" :close-on-click-modal="false">
  1148. <el-form :inline="true" label-position="top" :model="hsfApproverSearchData">
  1149. <el-form-item label="编码">
  1150. <el-input v-model="hsfApproverSearchData.operatorId" clearable style="width: 120px"></el-input>
  1151. </el-form-item>
  1152. <el-form-item label="名称">
  1153. <el-input v-model="hsfApproverSearchData.operatorName" clearable style="width: 120px"></el-input>
  1154. </el-form-item>
  1155. <el-form-item label=" ">
  1156. <el-button type="primary" @click="filterHsfApproverOptions">查询</el-button>
  1157. </el-form-item>
  1158. </el-form>
  1159. <el-table v-if="hsfApproverFlag"
  1160. :height="300"
  1161. :data="hsfApproverDisplayList"
  1162. @selection-change="handleHsfApproverSelectionChange"
  1163. @row-click="(row,column,event) => handleHsfApproverTableClick(row,column,event,'hsfApproverTable')"
  1164. ref="hsfApproverTable"
  1165. border row-key="operatorId"
  1166. style="width: 100%;">
  1167. <el-table-column
  1168. type="selection"
  1169. header-align="center"
  1170. align="center"
  1171. :reserve-selection="true"
  1172. width="50">
  1173. </el-table-column>
  1174. <el-table-column label="编码" property="operatorId" align="left" header-align="center"/>
  1175. <el-table-column label="名称" property="operatorName" align="left" header-align="center"/>
  1176. </el-table>
  1177. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  1178. <el-button type="primary" @click="saveHsfApproverChooseModal">确定</el-button>
  1179. <el-button type="primary" @click="hsfApproverFlag = false">关闭</el-button>
  1180. </el-footer>
  1181. </el-dialog>
  1182. <el-dialog title="人员选择" @open="openRelatedPeopleDialog" @close="closeRelatedPeopleDialog" v-drag
  1183. :visible.sync="relatedPeopleFlag" width="40vw" :close-on-click-modal="false">
  1184. <el-form :inline="true" label-position="top" :model="relatedPeopleSearchData">
  1185. <el-form-item label="编码">
  1186. <el-input v-model="relatedPeopleSearchData.operatorId" clearable style="width: 120px"></el-input>
  1187. </el-form-item>
  1188. <el-form-item label="名称">
  1189. <el-input v-model="relatedPeopleSearchData.operatorName" clearable style="width: 120px"></el-input>
  1190. </el-form-item>
  1191. <el-form-item label=" ">
  1192. <el-button type="primary" @click="filterRelatedPeopleOptions">查询</el-button>
  1193. </el-form-item>
  1194. </el-form>
  1195. <el-table v-if="relatedPeopleFlag"
  1196. :height="300"
  1197. :data="relatedPeopleDisplayList"
  1198. highlight-current-row
  1199. @current-change="handleRelatedPeopleCurrentChange"
  1200. @row-click="handleRelatedPeopleTableClick"
  1201. ref="relatedPeopleTable"
  1202. border
  1203. style="width: 100%;">
  1204. <el-table-column label="编码" property="operatorId" align="left" header-align="center"/>
  1205. <el-table-column label="名称" property="operatorName" align="left" header-align="center"/>
  1206. </el-table>
  1207. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  1208. <el-button type="primary" @click="saveRelatedPeopleChooseModal">确定</el-button>
  1209. <el-button type="primary" @click="relatedPeopleFlag = false">关闭</el-button>
  1210. </el-footer>
  1211. </el-dialog>
  1212. <el-dialog title="驳回" top="30vh" :close-on-click-modal="false" v-drag :visible.sync="submitModalFlag" width="500px">
  1213. <el-form label-position="top">
  1214. <el-form-item label="驳回意见/Reject Opinion">
  1215. <el-input type="textarea" v-model="rejectOpinion" :rows="3" resize="none" show-word-limit style="width: 479px;height: 30px"></el-input>
  1216. </el-form-item>
  1217. </el-form>
  1218. <el-footer style="height:35px;margin-top:50px;text-align:center">
  1219. <el-button type="primary" :loading="submitLoading" @click="rejectSubmit">确定</el-button>
  1220. <el-button type="primary" @click="submitModalFlag = false">取消</el-button>
  1221. </el-footer>
  1222. </el-dialog>
  1223. <el-dialog width="700px" title="备注" :close-on-click-modal="false" :visible.sync="rohsRemarkFlag" v-drag>
  1224. <el-form label-position="top">
  1225. <el-form-item label="备注说明">
  1226. <el-input
  1227. type="textarea"
  1228. v-model="rohsRemarkForm.remark"
  1229. :rows="6"
  1230. maxlength="255"
  1231. show-word-limit
  1232. resize="none">
  1233. </el-input>
  1234. </el-form-item>
  1235. </el-form>
  1236. <el-footer style="height:35px;margin-top:110px;text-align:center">
  1237. <el-button type="primary" @click="refreshRohsRemark">刷新</el-button>
  1238. <el-button type="primary" @click="saveRohsRemark">保存</el-button>
  1239. <el-button type="primary" @click="rohsRemarkFlag = false">取消</el-button>
  1240. </el-footer>
  1241. </el-dialog>
  1242. <el-dialog width="700px" title="材料描述" :close-on-click-modal="false" :visible.sync="rohsMaterialDescFlag" v-drag>
  1243. <el-form label-position="top">
  1244. <el-form-item label="材料描述">
  1245. <el-input
  1246. type="textarea"
  1247. v-model="rohsMaterialDescForm.materialDesc"
  1248. :rows="6"
  1249. maxlength="255"
  1250. show-word-limit
  1251. resize="none">
  1252. </el-input>
  1253. </el-form-item>
  1254. </el-form>
  1255. <el-footer style="height:35px;margin-top:110px;text-align:center">
  1256. <el-button type="primary" @click="refreshRohsMaterialDesc">刷新</el-button>
  1257. <el-button type="primary" @click="saveRohsMaterialDesc">保存</el-button>
  1258. <el-button type="primary" @click="rohsMaterialDescFlag = false">取消</el-button>
  1259. </el-footer>
  1260. </el-dialog>
  1261. <!-- 底部附件页签 -->
  1262. <el-tabs v-model="activeTable" style="width: 100%; height: 100%;" type="border-card" @tab-click="refreshCurrentTabTable" class="customer-tab">
  1263. <el-tab-pane label="基本信息" name="basicInfo">
  1264. <div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
  1265. <el-form :inline="true" label-position="top" :model="currentRow">
  1266. <el-form-item>
  1267. <span slot="label">申请人/Reference No.</span>
  1268. <el-input :value="currentRow.applicant || ''" disabled style="width: 100px"></el-input>
  1269. <el-input :value="currentRow.applicantName || ''" disabled style="width: 155px"></el-input>
  1270. </el-form-item>
  1271. <el-form-item label="申请日期/Date">
  1272. <el-date-picker :value="currentRow.applicationDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 150px"></el-date-picker>
  1273. </el-form-item>
  1274. <el-form-item label="Site">
  1275. <el-input :value="currentRow.site || ''" disabled style="width: 95px"></el-input>
  1276. </el-form-item>
  1277. <el-form-item label="工艺/Process">
  1278. <el-input :value="currentRow.process || ''" disabled style="width: 121px"></el-input>
  1279. </el-form-item>
  1280. </el-form>
  1281. <el-form :inline="true" label-position="top" :model="currentRow">
  1282. <el-form-item>
  1283. <span slot="label">最终客户/End Customer</span>
  1284. <el-input :value="currentRow.endCustomer || ''" disabled style="width: 100px"></el-input>
  1285. <el-input :value="currentRow.endCustomerName || ''" disabled style="width: 155px"></el-input>
  1286. </el-form-item>
  1287. <el-form-item>
  1288. <span slot="label">项目编码/Project</span>
  1289. <el-input :value="currentRow.projectId || ''" disabled style="width: 100px"></el-input>
  1290. <el-input :value="currentRow.projectName || ''" disabled style="width: 155px"></el-input>
  1291. </el-form-item>
  1292. <el-form-item label="WM所需求规格/The size that WM need">
  1293. <el-input :value="currentRow.wmRequiredSpec || ''" disabled style="width: 260px"></el-input>
  1294. </el-form-item>
  1295. </el-form>
  1296. <el-form :inline="true" label-position="top" :model="currentRow">
  1297. <el-form-item label="供应商/Vendor Code">
  1298. <el-input :value="currentRow.vendorCode || ''" disabled style="width: 396px"></el-input>
  1299. </el-form-item>
  1300. <el-form-item label="供应商材料编码/Vendor Material Code">
  1301. <el-input :value="currentRow.vendorMaterialCode || ''" disabled style="width: 396px"></el-input>
  1302. </el-form-item>
  1303. </el-form>
  1304. <el-form :inline="true" label-position="top" :model="currentRow">
  1305. <el-form-item label="材料分类/Material Classify">
  1306. <el-input type="textarea" :rows="2" resize="none" :value="currentRow.materialClassify || ''" disabled style="width: 532px"></el-input>
  1307. </el-form-item>
  1308. <el-form-item label="其他分类/Other Material Classify" v-if="currentRow.materialClassify && currentRow.materialClassify.includes('Other其他')">
  1309. <el-input :value="currentRow.otherMaterialClassify || ''" disabled style="width: 260px"></el-input>
  1310. </el-form-item>
  1311. </el-form>
  1312. <el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 30px">
  1313. <el-form-item label="辅材用途/Assiaccessorial Material Use for">
  1314. <el-input :value="currentRow.materialUseFor || ''" disabled style="width: 259px"></el-input>
  1315. </el-form-item>
  1316. <el-form-item>
  1317. <span slot="label">技术计划/TP</span>
  1318. <el-input :value="currentRow.technicalPlan || ''" disabled style="width: 100px"></el-input>
  1319. <el-input :value="currentRow.technicalPlanName || ''" disabled style="width: 155px"></el-input>
  1320. </el-form-item>
  1321. <el-form-item>
  1322. <span slot="label">PM人员/PM</span>
  1323. <el-input :value="currentRow.pm || ''" disabled style="width: 100px"></el-input>
  1324. <el-input :value="currentRow.pmName || ''" disabled style="width: 156px"></el-input>
  1325. </el-form-item>
  1326. </el-form>
  1327. <el-form :inline="true" label-position="top" :model="currentRow">
  1328. <el-form-item label="颜色/Color">
  1329. <el-input :value="currentRow.color || ''" disabled style="width: 532px"></el-input>
  1330. </el-form-item>
  1331. <el-form-item label="计划转量产时间/Planned Mass Production Date">
  1332. <el-date-picker :value="normalizeDateOnly(currentRow.plannedMassProductionDate)" disabled type="date" value-format="yyyy-MM-dd" style="width: 260px"></el-date-picker>
  1333. </el-form-item>
  1334. </el-form>
  1335. <el-form :inline="true" label-position="top" :model="currentRow">
  1336. <el-form-item>
  1337. <span slot="label">商品组1/Comm Group 1</span>
  1338. <el-input :value="currentRow.commGroup1 || ''" disabled style="width: 100px"></el-input>
  1339. <el-input :value="currentRow.commGroup1Desc || ''" disabled style="width: 155px"></el-input>
  1340. </el-form-item>
  1341. <el-form-item>
  1342. <span slot="label">商品组2/Comm Group 2</span>
  1343. <el-input :value="currentRow.commGroup2 || ''" disabled style="width: 100px"></el-input>
  1344. <el-input :value="currentRow.commGroup2Desc || ''" disabled style="width: 155px"></el-input>
  1345. </el-form-item>
  1346. <el-form-item>
  1347. <span slot="label">商品组3/Comm Group 3</span>
  1348. <el-input :value="currentRow.commGroup3 || ''" disabled style="width: 100px"></el-input>
  1349. <el-input :value="currentRow.commGroup3Desc || ''" disabled style="width: 156px"></el-input>
  1350. </el-form-item>
  1351. </el-form>
  1352. <el-form :inline="true" label-position="top" :model="currentRow">
  1353. <el-form-item label="是否是Fiber材料">
  1354. <el-radio-group :value="currentRow.isFiberMaterial" disabled style="width: 145px">
  1355. <el-radio label="Y"></el-radio>
  1356. <el-radio label="N"></el-radio>
  1357. </el-radio-group>
  1358. </el-form-item>
  1359. <el-form-item label="是否需要创建IFS料号/Does Need Create IFS Part No.">
  1360. <el-radio-group :value="currentRow.needCreateNumber" disabled style="width: 374px">
  1361. <el-radio label="Y"></el-radio>
  1362. <el-radio label="N"></el-radio>
  1363. </el-radio-group>
  1364. </el-form-item>
  1365. <el-form-item label="材料厚度/Material Thickness">
  1366. <el-input :value="currentRow.materialThickness || ''" disabled style="width: 260px"></el-input>
  1367. </el-form-item>
  1368. </el-form>
  1369. <el-form :inline="true" label-position="top" :model="currentRow">
  1370. <el-form-item label="材料有效期/Material Validity Time">
  1371. <dict-data-select :value="currentRow.materialValidityTime || ''" :use-default-value="false" disabled style="width: 260px" dict-type="rohs_material_validity_time"></dict-data-select>
  1372. </el-form-item>
  1373. <el-form-item label="是否需要Deviation/If need deviation or not">
  1374. <el-radio-group :value="currentRow.needDeviation" disabled style="width: 259px">
  1375. <el-radio label="Y"></el-radio>
  1376. <el-radio label="N"></el-radio>
  1377. </el-radio-group>
  1378. </el-form-item>
  1379. <el-form-item>
  1380. <span slot="label">NPD工程师/NPD Engineer</span>
  1381. <el-input :value="currentRow.npdEngineer || ''" disabled style="width: 100px"></el-input>
  1382. <el-input :value="currentRow.npdEngineerName || ''" disabled style="width: 155px"></el-input>
  1383. </el-form-item>
  1384. </el-form>
  1385. <el-form :inline="true" label-position="top" :model="currentRow">
  1386. <el-form-item label="材料有效期备注/Material Validity Time Comments">
  1387. <el-input :value="currentRow.materialValidityComments || ''" disabled style="width: 260px"></el-input>
  1388. </el-form-item>
  1389. <el-form-item label="预计提供报告时间(一个月内)/Expect Date" style="margin-left: -2px">
  1390. <el-date-picker :value="normalizeDateOnly(currentRow.expectReportTime)" disabled type="date" value-format="yyyy-MM-dd" style="width: 259px"></el-date-picker>
  1391. </el-form-item>
  1392. <el-form-item>
  1393. <span slot="label">采购/Buyer</span>
  1394. <el-input :value="currentRow.buyer || ''" disabled style="width: 100px"></el-input>
  1395. <el-input :value="currentRow.buyerName || ''" disabled style="width: 156px"></el-input>
  1396. </el-form-item>
  1397. </el-form>
  1398. <el-form :inline="true" label-position="top" :model="currentRow">
  1399. <el-form-item label="所需审批文件/Qualification Documents needed">
  1400. <el-input type="textarea" :rows="2" resize="none" :value="currentRow.qualificationDocumentsNeeded || ''" disabled style="width: 807px"></el-input>
  1401. </el-form-item>
  1402. </el-form>
  1403. <el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 30px">
  1404. <el-form-item label="测试报告必测项/Test Report including items">
  1405. <el-input type="textarea" :rows="2" resize="none" :value="currentRow.testReportIncludingItems || ''" disabled style="width: 807px"></el-input>
  1406. </el-form-item>
  1407. </el-form>
  1408. <el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 30px">
  1409. <el-form-item label="备注说明/Comments" style="display: block;">
  1410. <el-input type="textarea" :rows="3" :value="currentRow.remark || ''" disabled resize="none" style="width: 804px;height: 30px"></el-input>
  1411. </el-form-item>
  1412. </el-form>
  1413. </div>
  1414. </el-tab-pane>
  1415. <el-tab-pane label="NPD 信息" name="npdInfo">
  1416. <div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
  1417. <!-- <el-form :inline="true" label-position="top" :model="currentRow">-->
  1418. <!-- <el-form-item label="现有材料不同规格/Same Material Diff Size">-->
  1419. <!-- <el-radio-group :value="currentRow.isSameMaterialDiffSize" disabled style="width: 190px">-->
  1420. <!-- <el-radio label="Y"></el-radio>-->
  1421. <!-- <el-radio label="N"></el-radio>-->
  1422. <!-- </el-radio-group>-->
  1423. <!-- </el-form-item>-->
  1424. <!-- </el-form>-->
  1425. <el-form :inline="true" label-position="top" :model="currentRow">
  1426. <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>
  1427. </el-form>
  1428. <el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
  1429. <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>
  1430. </el-form>
  1431. <el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
  1432. <el-form-item label="内部TDS/Inner TDS" style="display: block;">
  1433. <oss-components
  1434. ref="bottomTdsOss"
  1435. :save-visible="authFileSave"
  1436. :edit-visible="false"
  1437. :download-visible="authFileDownLoad"
  1438. :remove-visible="authFileRemove"
  1439. :preview-visible="authFilePreview"
  1440. :disabled="true"
  1441. label="序列号"
  1442. :height="180"
  1443. style="margin-top: 2px"
  1444. :columns="tdsFileColumnList"
  1445. :order-ref1="currentRow.site || ''"
  1446. :order-ref2="currentRow.referenceNo || ''"
  1447. order-ref3="tdsProperty">
  1448. </oss-components>
  1449. </el-form-item>
  1450. </el-form>
  1451. </div>
  1452. </el-tab-pane>
  1453. <el-tab-pane label="HSF 填写信息" name="hsfInfo">
  1454. <div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
  1455. <el-form :inline="true" label-position="top" :model="currentRow">
  1456. <el-form-item label="报告日期/Report Date">
  1457. <el-date-picker :value="currentRow.expiredDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 150px"></el-date-picker>
  1458. </el-form-item>
  1459. <el-form-item label="有效期数值/Valid Until Value">
  1460. <el-input :value="currentRow.validUntilValue || ''" disabled style="width: 150px"></el-input>
  1461. </el-form-item>
  1462. <el-form-item label="有效期单位/Valid Until Unit">
  1463. <el-input :value="currentRow.validUntil || ''" disabled style="width: 150px"></el-input>
  1464. </el-form-item>
  1465. <el-form-item label="失效日期/Expiry Date">
  1466. <el-date-picker :value="currentRow.expiryDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 150px"></el-date-picker>
  1467. </el-form-item>
  1468. <el-form-item label="状态/Status">
  1469. <el-input :value="currentRow.rohsStatus || ''" disabled style="width: 150px"></el-input>
  1470. </el-form-item>
  1471. </el-form>
  1472. <el-form :inline="true" label-position="top" :model="currentRow">
  1473. <el-form-item label="是否符合RoHS/Meet RoHS Req">
  1474. <el-radio-group :value="currentRow.isMeetRohsRequirement" disabled style="width: 190px">
  1475. <el-radio label="Y"></el-radio>
  1476. <el-radio label="N"></el-radio>
  1477. </el-radio-group>
  1478. </el-form-item>
  1479. <el-form-item label=" ">
  1480. <el-checkbox
  1481. :value="currentRow.isAhGrade"
  1482. true-label="Y"
  1483. false-label="N"
  1484. disabled
  1485. style="width: 190px">材料属性是否是AH/Is AH Grade</el-checkbox>
  1486. </el-form-item>
  1487. <el-form-item label="HSF供应商等级/Supplier Class">
  1488. <el-radio-group :value="currentRow.hsfSupplierClassification" disabled style="width: 260px">
  1489. <el-radio label="高风险">高风险</el-radio>
  1490. <el-radio label="中风险">中风险</el-radio>
  1491. <el-radio label="低风险">低风险</el-radio>
  1492. </el-radio-group>
  1493. </el-form-item>
  1494. </el-form>
  1495. <el-form :inline="true" label-position="top" :model="currentRow">
  1496. <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>
  1497. </el-form>
  1498. <el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 45px">
  1499. <el-form-item label="HSF审批人/HSF Approver"><el-input :value="currentRow.hsfApproverName || currentRow.hsfApprover || ''" disabled style="width: 396px"></el-input></el-form-item>
  1500. <el-form-item label="Inform Related people"><el-input :value="currentRow.relatedPeopleName || currentRow.relatedPeople || ''" disabled style="width: 396px"></el-input></el-form-item>
  1501. </el-form>
  1502. <el-form v-if="shouldShowHsfStandard(currentRow.endCustomer)" :inline="true" label-position="top" :model="currentRow" style="margin-top: 0px">
  1503. <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>
  1504. </el-form>
  1505. </div>
  1506. </el-tab-pane>
  1507. <el-tab-pane label="材料信息" name="materialInfo">
  1508. <div :style="{height: secondHeight + 'px'}" style="overflow-y: auto;">
  1509. <el-table
  1510. class="rohs-material-table"
  1511. border
  1512. :data="currentRow.materialList || []"
  1513. :height="secondHeight"
  1514. style="width: 100%">
  1515. <el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
  1516. <el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="150" header-align="center" align="left" :show-overflow-tooltip="true">
  1517. <template slot-scope="scope">
  1518. <el-link style="cursor:pointer;" @click="toPartMenu(scope.row.finalPartNo || scope.row.testPartNo)">
  1519. {{ scope.row.finalPartNo || scope.row.testPartNo || '' }}
  1520. </el-link>
  1521. </template>
  1522. </el-table-column>
  1523. <el-table-column prop="partDesc" label="描述/Part Desc." min-width="250" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  1524. <el-table-column prop="partStatus" label="状态/Part Status" min-width="100" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
  1525. </el-table>
  1526. </div>
  1527. </el-tab-pane>
  1528. <el-tab-pane label="附件信息" name="attachment">
  1529. <oss-components
  1530. ref="bottomAttachmentOss"
  1531. :save-visible="authFileSave"
  1532. :edit-visible="authFileSave"
  1533. :download-visible="authFileDownLoad"
  1534. :remove-visible="authFileRemove"
  1535. :preview-visible="authFilePreview"
  1536. :disabled="currentRow.status === '已完成'"
  1537. :show-order-ref3-filter="true"
  1538. :order-ref3-filter-options="rohsAttachmentTypeOptionList"
  1539. :query-order-ref3-list="rohsAttachmentQueryOrderRef3List"
  1540. :order-ref3-filter-query-map="rohsAttachmentTypeFilterQueryMap"
  1541. :order-ref3-label-map="rohsAttachmentTypeLabelMap"
  1542. label="序列号"
  1543. :height="secondHeight - 25"
  1544. style="margin-top: 2px"
  1545. :columns="rohsAttachmentSummaryColumnList"
  1546. :order-ref1="currentRow.site"
  1547. :order-ref2="currentRow.referenceNo">
  1548. </oss-components>
  1549. </el-tab-pane>
  1550. <el-tab-pane label="审批信息" name="approvalInformation">
  1551. <approval-information v-model:data-list="approvalList" :height="secondHeight"></approval-information>
  1552. </el-tab-pane>
  1553. </el-tabs>
  1554. <ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
  1555. <filter-search :visible.sync="filterVisible" @search="queryByAnyField"></filter-search>
  1556. </div>
  1557. </template>
  1558. <script>
  1559. import * as api from '@/api/rohs/rohs'
  1560. import { checkSuperAdmin } from "@/api/changeManagement/changeManagement"
  1561. import { verifyData } from "@/api/chooselist/chooselist.js"
  1562. import { searchProjectInfoList } from "@/api/quotation/quotationInformation.js"
  1563. import { queryCustomer } from "@/api/customer/customerInformation"
  1564. import { queryProjectByCustomer } from "@/api/project/project"
  1565. import { queryBuList } from "@/api/base/bu"
  1566. import { createOfficialPartForRohs, getNextPartNo as getPartNextPartNo, getItemListByCodeNo as getPartItemListByCodeNo, getItemExclusionAlreadyExists as getPartItemExclusionAlreadyExists } from "@/api/part/partInformation.js"
  1567. import uploadFileList from '../common/uploadFileList'
  1568. import ossComponents from '../oss/ossComponents.vue'
  1569. import ChooseList from '@/views/modules/common/Chooselist'
  1570. import DictDataSelect from "../sys/dict-data-select.vue"
  1571. import ApprovalInformation from "../changeManagement/approvalInformation.vue"
  1572. import FilterSearch from "../../common/filterSearch.vue"
  1573. export default {
  1574. components: {
  1575. uploadFileList,
  1576. ossComponents,
  1577. ChooseList,
  1578. DictDataSelect,
  1579. ApprovalInformation,
  1580. FilterSearch
  1581. },
  1582. data () {
  1583. return {
  1584. searchData: {
  1585. site: this.$store.state.user.site,
  1586. referenceNo: '',
  1587. status: '',
  1588. rohsStatus: '',
  1589. currentApprover: '',
  1590. nodeId: '',
  1591. ifsPartNo: '',
  1592. materialDesc: ''
  1593. },
  1594. exportLoading: false,
  1595. exportData: [],
  1596. exportFieldMap: {},
  1597. exportName: '',
  1598. exportHeader: ['RoHs记录'],
  1599. exportFooter: [],
  1600. resultList: [],
  1601. dataList: [],
  1602. pageIndex: 1,
  1603. pageSize: 20,
  1604. totalPage: 0,
  1605. dataListLoading: false,
  1606. activeTable: 'basicInfo',
  1607. menuId: '112001',
  1608. authSearch: false,
  1609. authUpdate: false,
  1610. authIssue: false,
  1611. authSubmit: false,
  1612. authReject: false,
  1613. authFileSave: false,
  1614. authFileDownLoad: false,
  1615. authFileRemove: false,
  1616. authFilePreview: false,
  1617. authDataEntry: false,
  1618. authMaterialDescRemark: false,
  1619. authDelete: false,
  1620. superAdmin: false,
  1621. createBy2: this.$store.state.user.name,
  1622. height: 400,
  1623. secondHeight: 200,
  1624. currentRow: {},
  1625. fileColumnList: [
  1626. {
  1627. columnProp: 'fileName',
  1628. headerAlign: 'center',
  1629. align: 'center',
  1630. columnLabel: '文件名称',
  1631. columnHidden: false,
  1632. columnImage: false,
  1633. columnSortable: false,
  1634. status: true,
  1635. fixed: '',
  1636. columnWidth: 140
  1637. },
  1638. {
  1639. columnProp: 'fileRemark',
  1640. headerAlign: 'center',
  1641. align: 'center',
  1642. columnLabel: '备注',
  1643. columnHidden: false,
  1644. columnImage: false,
  1645. columnSortable: false,
  1646. status: true,
  1647. fixed: '',
  1648. columnWidth: 200
  1649. },
  1650. {
  1651. columnProp: 'createDate',
  1652. headerAlign: 'center',
  1653. align: 'center',
  1654. columnLabel: '上传时间',
  1655. columnHidden: false,
  1656. columnImage: false,
  1657. columnSortable: false,
  1658. status: true,
  1659. fixed: '',
  1660. columnWidth: 150
  1661. },
  1662. {
  1663. columnProp: 'createBy',
  1664. headerAlign: 'center',
  1665. align: 'center',
  1666. columnLabel: '上传人',
  1667. columnHidden: false,
  1668. columnImage: false,
  1669. columnSortable: false,
  1670. status: true,
  1671. fixed: '',
  1672. columnWidth: 120
  1673. }
  1674. ],
  1675. rohsAttachmentTypeOptionList: [
  1676. { value: 'rohsAttachmentTds', label: 'TDS' },
  1677. { value: 'rohsAttachmentMsds', label: 'MSDS' },
  1678. { value: 'rohsAttachmentTestReport', label: '测试报告' },
  1679. { value: 'rohsAttachmentOther', label: 'Other' }
  1680. ],
  1681. rohsAttachmentTypeLabelMap: {
  1682. rohsAttachmentTds: 'TDS',
  1683. rohsAttachmentMsds: 'MSDS',
  1684. rohsAttachmentTestReport: '测试报告',
  1685. rohsAttachmentOther: 'Other',
  1686. rohsAttachment: 'Other'
  1687. },
  1688. rohsAttachmentQueryOrderRef3List: [
  1689. 'rohsAttachmentTds',
  1690. 'rohsAttachmentMsds',
  1691. 'rohsAttachmentTestReport',
  1692. 'rohsAttachmentOther',
  1693. 'rohsAttachment'
  1694. ],
  1695. rohsAttachmentTypeFilterQueryMap: {
  1696. rohsAttachmentTds: ['rohsAttachmentTds'],
  1697. rohsAttachmentMsds: ['rohsAttachmentMsds'],
  1698. rohsAttachmentTestReport: ['rohsAttachmentTestReport'],
  1699. rohsAttachmentOther: ['rohsAttachmentOther', 'rohsAttachment']
  1700. },
  1701. rohsAttachmentSummaryColumnList: [
  1702. {
  1703. columnProp: 'orderRef3Label',
  1704. headerAlign: 'center',
  1705. align: 'center',
  1706. columnLabel: '类型',
  1707. columnHidden: false,
  1708. columnImage: false,
  1709. columnSortable: false,
  1710. status: true,
  1711. fixed: '',
  1712. columnWidth: 120
  1713. },
  1714. {
  1715. columnProp: 'fileName',
  1716. headerAlign: 'center',
  1717. align: 'center',
  1718. columnLabel: '文件名称',
  1719. columnHidden: false,
  1720. columnImage: false,
  1721. columnSortable: false,
  1722. status: true,
  1723. fixed: '',
  1724. columnWidth: 160
  1725. },
  1726. {
  1727. columnProp: 'fileRemark',
  1728. headerAlign: 'center',
  1729. align: 'center',
  1730. columnLabel: '备注',
  1731. columnHidden: false,
  1732. columnImage: false,
  1733. columnSortable: false,
  1734. status: true,
  1735. fixed: '',
  1736. columnWidth: 220
  1737. },
  1738. {
  1739. columnProp: 'createDate',
  1740. headerAlign: 'center',
  1741. align: 'center',
  1742. columnLabel: '上传时间',
  1743. columnHidden: false,
  1744. columnImage: false,
  1745. columnSortable: false,
  1746. status: true,
  1747. fixed: '',
  1748. columnWidth: 160
  1749. },
  1750. {
  1751. columnProp: 'createBy',
  1752. headerAlign: 'center',
  1753. align: 'center',
  1754. columnLabel: '上传人',
  1755. columnHidden: false,
  1756. columnImage: false,
  1757. columnSortable: false,
  1758. status: true,
  1759. fixed: '',
  1760. columnWidth: 120
  1761. }
  1762. ],
  1763. tdsFileColumnList: [
  1764. {
  1765. columnProp: 'fileNo',
  1766. headerAlign: 'center',
  1767. align: 'center',
  1768. columnLabel: '文件编码',
  1769. columnHidden: false,
  1770. columnImage: false,
  1771. columnSortable: false,
  1772. status: true,
  1773. fixed: '',
  1774. columnWidth: 130
  1775. },
  1776. {
  1777. columnProp: 'rev',
  1778. headerAlign: 'center',
  1779. align: 'center',
  1780. columnLabel: '版本号',
  1781. columnHidden: false,
  1782. columnImage: false,
  1783. columnSortable: false,
  1784. status: true,
  1785. fixed: '',
  1786. columnWidth: 90
  1787. },
  1788. {
  1789. columnProp: 'fileName',
  1790. headerAlign: 'center',
  1791. align: 'center',
  1792. columnLabel: '文件名称',
  1793. columnHidden: false,
  1794. columnImage: false,
  1795. columnSortable: false,
  1796. status: true,
  1797. fixed: '',
  1798. columnWidth: 160
  1799. },
  1800. {
  1801. columnProp: 'fileRemark',
  1802. headerAlign: 'center',
  1803. align: 'center',
  1804. columnLabel: '备注',
  1805. columnHidden: false,
  1806. columnImage: false,
  1807. columnSortable: false,
  1808. status: true,
  1809. fixed: '',
  1810. columnWidth: 180
  1811. },
  1812. {
  1813. columnProp: 'createDate',
  1814. headerAlign: 'center',
  1815. align: 'center',
  1816. columnLabel: '上传时间',
  1817. columnHidden: false,
  1818. columnImage: false,
  1819. columnSortable: false,
  1820. status: true,
  1821. fixed: '',
  1822. columnWidth: 150
  1823. },
  1824. {
  1825. columnProp: 'invalidationTime',
  1826. headerAlign: 'center',
  1827. align: 'center',
  1828. columnLabel: '失效时间',
  1829. columnHidden: false,
  1830. columnImage: false,
  1831. columnSortable: false,
  1832. status: true,
  1833. fixed: '',
  1834. columnWidth: 150
  1835. },
  1836. {
  1837. columnProp: 'createBy',
  1838. headerAlign: 'center',
  1839. align: 'center',
  1840. columnLabel: '上传人',
  1841. columnHidden: false,
  1842. columnImage: false,
  1843. columnSortable: false,
  1844. status: true,
  1845. fixed: '',
  1846. columnWidth: 120
  1847. }
  1848. ],
  1849. modalFlag: false,
  1850. chooseProjectListFlag: false,
  1851. projectMaterialDialogFlag: false,
  1852. rohsCreatePartDialogFlag: false,
  1853. rohsCreatePartLoading: false,
  1854. rohsCreatePartTab: 'General',
  1855. rohsCreatePartTagNo: 0,
  1856. rohsCharacteristicDialogFlag: false,
  1857. rohsCharacteristicQueryData: {
  1858. propertiesItemNo: '',
  1859. itemDesc: ''
  1860. },
  1861. rohsCharacteristicList: [],
  1862. rohsCharacteristicSelections: [],
  1863. rohsPartItemSelections: [],
  1864. rohsCreatePartColumnItemList: [
  1865. {
  1866. columnProp: 'propertiesItemNo',
  1867. headerAlign: 'center',
  1868. align: 'left',
  1869. columnLabel: '属性编码',
  1870. columnHidden: false,
  1871. columnImage: false,
  1872. status: true,
  1873. fixed: '',
  1874. columnWidth: 100
  1875. },
  1876. {
  1877. columnProp: 'itemDesc',
  1878. headerAlign: 'center',
  1879. align: 'left',
  1880. columnLabel: '属性名称',
  1881. columnHidden: false,
  1882. columnImage: false,
  1883. status: true,
  1884. fixed: '',
  1885. columnWidth: 150
  1886. },
  1887. {
  1888. columnProp: 'valueType',
  1889. headerAlign: 'center',
  1890. align: 'center',
  1891. columnLabel: '属性类型',
  1892. columnHidden: false,
  1893. columnImage: false,
  1894. status: true,
  1895. fixed: '',
  1896. columnWidth: 60
  1897. },
  1898. {
  1899. columnProp: 'textValue',
  1900. headerAlign: 'center',
  1901. align: 'left',
  1902. columnLabel: '属性值',
  1903. columnHidden: false,
  1904. columnImage: false,
  1905. status: true,
  1906. fixed: '',
  1907. columnWidth: 140
  1908. }
  1909. ],
  1910. rohsCharacteristicColumnList: [
  1911. {
  1912. columnProp: 'propertiesItemNo',
  1913. headerAlign: 'center',
  1914. align: 'left',
  1915. columnLabel: '属性编码',
  1916. columnHidden: false,
  1917. columnImage: false,
  1918. status: true,
  1919. fixed: '',
  1920. columnWidth: 100
  1921. },
  1922. {
  1923. columnProp: 'itemDesc',
  1924. headerAlign: 'center',
  1925. align: 'left',
  1926. columnLabel: '属性名称',
  1927. columnHidden: false,
  1928. columnImage: false,
  1929. status: true,
  1930. fixed: '',
  1931. columnWidth: 200
  1932. },
  1933. {
  1934. columnProp: 'valueType',
  1935. headerAlign: 'center',
  1936. align: 'center',
  1937. columnLabel: '属性类型',
  1938. columnHidden: false,
  1939. columnImage: false,
  1940. status: true,
  1941. fixed: '',
  1942. columnWidth: 60
  1943. }
  1944. ],
  1945. rohsCreatePartData: {
  1946. site: '',
  1947. partNo: '',
  1948. partDesc: '',
  1949. partType: 'Purchased',
  1950. hazardCode: '',
  1951. hazardDesc: '',
  1952. familyId: '',
  1953. familyName: '',
  1954. groupId: '',
  1955. groupName: '',
  1956. umId: '',
  1957. umName: '',
  1958. weightNet: '',
  1959. uomForWeightNet: 'kg',
  1960. volumeNet: '',
  1961. uomForVolumeNet: 'm3',
  1962. lotTrackingCode: 'Order Based',
  1963. remark: '',
  1964. productGroupId1: '',
  1965. productGroupName1: '',
  1966. productGroupId2: '',
  1967. productGroupName2: '',
  1968. productGroupId3: '',
  1969. productGroupName3: '',
  1970. productGroupId4: '*',
  1971. productGroupName4: 'NorthSky Application owner',
  1972. commGroup3: '',
  1973. commGroup3Desc: '',
  1974. codeNo: '',
  1975. codeDesc: '',
  1976. typeDesignation: '',
  1977. assetClass: 'S',
  1978. assetClassDesc: '标准',
  1979. dimQuality: '',
  1980. abcClass: 'C',
  1981. abcClassDesc: '',
  1982. frequencyClass: 'Very Slow Mover',
  1983. lifecycleStage: 'Development',
  1984. countryOfOrigin: '',
  1985. countryOfOriginDesc: '',
  1986. regionOfOrigin: '',
  1987. regionOfOriginDesc: '',
  1988. manufacturingLeadTime: 0,
  1989. expectedLeadTime: 0,
  1990. durabilityWeek: '',
  1991. durabilityDay: '',
  1992. intrastatConvFactor: undefined,
  1993. customsStatNo: '',
  1994. customsStatDesc: '',
  1995. umDesc: '',
  1996. planningMethod: 'A',
  1997. planningMethodDesc: '',
  1998. partStatus: 'A',
  1999. partStatusDesc: '活动',
  2000. active: 'Y',
  2001. status: 'Y',
  2002. supplyCode: 'Inventory Order',
  2003. configurationId: '*',
  2004. partCostGroupId: '',
  2005. partCostGroupDesc: '',
  2006. inventoryValuationMethod: 'Standard Cost',
  2007. inventoryPartCostLevel: 'Cost Per Part',
  2008. invoiceConsideration: 'Ignore Invoice Price',
  2009. zeroCostFlag: 'Zero Cost Forbidden',
  2010. estimatedMaterialCost: 0,
  2011. safetyStock: 0,
  2012. minOrderQty: 0,
  2013. maxOrderQty: 0,
  2014. mulOrderQty: 0,
  2015. safetyLeadTime: 0,
  2016. shrinkageFac: 0,
  2017. stdOrderQty: 0,
  2018. cumLeadTime: 0,
  2019. byProdAsSupplyInMrpDb: '',
  2020. unprotectedLeadTime: 0,
  2021. backFlushPart: 'All Locations',
  2022. issueType: 'Reserve And Backflush',
  2023. mrpControlFlagDb: 'Y',
  2024. fixedLeadTimeDay: 0,
  2025. overReporting: 'Allowed',
  2026. useTheoreticalDensityDb: '',
  2027. variableLeadTimeDay: 0,
  2028. overReportTolerance: 0,
  2029. fixedLeadTimeHour: 0,
  2030. density: undefined,
  2031. variableLeadTimeHour: 0,
  2032. showInQueryFlag: 'Y',
  2033. temporaryPartFlag: 'N',
  2034. partItemList: []
  2035. },
  2036. searchProjectData: {
  2037. site: '',
  2038. projectId: undefined,
  2039. projectName: undefined,
  2040. customerId: undefined,
  2041. },
  2042. projectMaterialSearchData: {
  2043. finalPartNo: '',
  2044. partDesc: '',
  2045. partStatus: ''
  2046. },
  2047. projectMaterialList: [],
  2048. projectMaterialSelections: [],
  2049. dataListSelections: [],
  2050. materialSelections: [],
  2051. projectMaterialPageIndex: 1,
  2052. projectMaterialPageSize: 20,
  2053. projectMaterialTotal: 0,
  2054. projectMaterialLoading: false,
  2055. nodeOptions: [],
  2056. projectList: [],
  2057. hsfApproverOptionList: [],
  2058. hsfApproverDisplayList: [],
  2059. hsfApproverSelectionCache: [],
  2060. hsfApproverFlag: false,
  2061. hsfApproverSearchData: {
  2062. operatorId: '',
  2063. operatorName: ''
  2064. },
  2065. relatedPeopleOptionList: [],
  2066. relatedPeopleDisplayList: [],
  2067. relatedPeopleSelection: null,
  2068. relatedPeopleFlag: false,
  2069. relatedPeopleSearchData: {
  2070. operatorId: '',
  2071. operatorName: ''
  2072. },
  2073. userBuPermissionList: [],
  2074. userFirstBuNo: '',
  2075. filterVisible: false,
  2076. isFilterSearch: false,
  2077. filterSearchData: {},
  2078. approvalList: [],
  2079. plmRohsAuthorityArr: [],
  2080. nodeAuthorityLoaded: false,
  2081. isEditMode: false,
  2082. modalTitle: 'RoHS 新增',
  2083. activeName: 'basicInfo',
  2084. showModalFlag: false,
  2085. submitModalFlag: false,
  2086. rohsRemarkFlag: false,
  2087. rohsMaterialDescFlag: false,
  2088. rejectOpinion: '',
  2089. submitLoading: false,
  2090. rohsRemarkForm: {
  2091. remark: ''
  2092. },
  2093. rohsMaterialDescForm: {
  2094. materialDesc: ''
  2095. },
  2096. hsfStandardDefaultText: 'With the follow environmental specification: Macallan regulated Substances specification(069-0135) /Macallan sustainable fiber specification(099-00532)',
  2097. modalData: {
  2098. site: 'DEFAULT',
  2099. referenceNo: '',
  2100. applicant: '',
  2101. pm: '',
  2102. pmName: '',
  2103. applicationDate: '',
  2104. process: '',
  2105. plannedMassProductionDate: '',
  2106. color: '',
  2107. vendorCode: '',
  2108. vendorMaterialCode: '',
  2109. materialClassify: '',
  2110. otherMaterialClassify: '',
  2111. materialUseFor: '',
  2112. endCustomer: '',
  2113. projectId: '',
  2114. commGroup1: '',
  2115. commGroup1Desc: '',
  2116. commGroup2: '',
  2117. commGroup2Desc: '',
  2118. commGroup3: '',
  2119. commGroup3Desc: '',
  2120. needCreateNumber: '',
  2121. npdEngineer: '',
  2122. materialValidityTime: '',
  2123. materialValidityComments: '',
  2124. needDeviation: '',
  2125. technicalPlan: '',
  2126. wmRequiredSpec: '',
  2127. isFiberMaterial: '',
  2128. materialThickness: '',
  2129. buyer: '',
  2130. expectReportTime: '',
  2131. qualificationDocumentsNeeded: '',
  2132. qualificationDocumentsNeededList: [],
  2133. testReportIncludingItems: '',
  2134. testReportIncludingItemsList: [],
  2135. remark: '',
  2136. status: '',
  2137. sgsReportNumber: '',
  2138. rohsStatus: 'Active',
  2139. expiredDate: '',
  2140. expiryDate: '',
  2141. fiberInformation: '',
  2142. hsfStandard: '',
  2143. hsfApprover: '',
  2144. hsfApproverName: '',
  2145. hsfApproverCodeList: [],
  2146. relatedPeople: '',
  2147. relatedPeopleName: '',
  2148. buNo: '',
  2149. validUntilValue: 0,
  2150. validUntil: '',
  2151. isMeetRohsRequirement: '',
  2152. isAhGrade: 'N',
  2153. hsfSupplierClassification: '',
  2154. materialDesc: '',
  2155. npdRemark: '',
  2156. isSameMaterialDiffSize: '',
  2157. ifsPartNo: '',
  2158. materialList: [],
  2159. stepId: null,
  2160. rejectFlag: '',
  2161. rejectStepId: null,
  2162. createBy2: '',
  2163. isReject: 'Y',
  2164. tpProcessControl: 'N',
  2165. csProcessControl: 'N'
  2166. }
  2167. }
  2168. },
  2169. created () {
  2170. this.menuId = (this.$route.meta && this.$route.meta.menuId) || this.menuId || '112001'
  2171. this.getButtonAuthData()
  2172. this.checkSuperAdmin()
  2173. },
  2174. mounted () {
  2175. this.fetchNodeOptions()
  2176. if (this.authSearch) {
  2177. this.handleRouteQuery()
  2178. }
  2179. this.$nextTick(() => {
  2180. this.height = window.innerHeight / 2 - 30
  2181. /*第二个表格高度的动态调整*/
  2182. this.secondHeight = window.innerHeight / 2 - 186
  2183. })
  2184. },
  2185. activated () {
  2186. this.handleRouteQuery()
  2187. },
  2188. watch: {
  2189. activeName (val) {
  2190. if (val === 'attachmentInfo' || val === 'npdInfo') {
  2191. this.$nextTick(() => {
  2192. if (val === 'attachmentInfo') {
  2193. this.refreshOssRef('modalAttachmentTdsOss')
  2194. this.refreshOssRef('modalAttachmentMsdsOss')
  2195. this.refreshOssRef('modalAttachmentTestReportOss')
  2196. this.refreshOssRef('modalAttachmentOtherOss')
  2197. }
  2198. if (val === 'npdInfo') {
  2199. this.refreshOssRef('modalTdsOss')
  2200. }
  2201. })
  2202. }
  2203. },
  2204. 'modalData.expiredDate' () {
  2205. this.syncExpiryDateByRule()
  2206. },
  2207. 'modalData.validUntilValue' () {
  2208. this.syncExpiryDateByRule()
  2209. },
  2210. 'modalData.validUntil' () {
  2211. this.syncExpiryDateByRule()
  2212. },
  2213. 'modalData.endCustomer' () {
  2214. this.applyHsfStandardDefaultByCustomer(this.modalData)
  2215. }
  2216. },
  2217. methods: {
  2218. resolveRouteReferenceNo () {
  2219. const routeParams = this.$route.params || {}
  2220. const routeQuery = this.$route.query || {}
  2221. const referenceNo = routeParams.referenceNo || routeParams.rohsNo || routeParams.docNo || routeParams.documentNo ||
  2222. routeQuery.referenceNo || routeQuery.rohsNo || routeQuery.docNo || routeQuery.documentNo || ''
  2223. return String(referenceNo || '').trim()
  2224. },
  2225. handleRouteQuery () {
  2226. if (!this.authSearch) {
  2227. return
  2228. }
  2229. const routeParams = this.$route.params || {}
  2230. const isTokenLogin = routeParams.type === 'tokenLogin'
  2231. const referenceNo = this.resolveRouteReferenceNo()
  2232. if (isTokenLogin) {
  2233. if (!referenceNo) {
  2234. this.getDataList()
  2235. return
  2236. }
  2237. if (this.modalFlag && String(this.modalData.referenceNo || '').trim() === referenceNo) {
  2238. return
  2239. }
  2240. this.searchData.referenceNo = referenceNo
  2241. this.getDataList().then((rows) => {
  2242. const rowList = Array.isArray(rows) ? rows : (this.dataList || [])
  2243. if (!rowList.length) {
  2244. if (this.$refs.rohsTable) {
  2245. this.$refs.rohsTable.setCurrentRow()
  2246. }
  2247. return
  2248. }
  2249. this.$nextTick(() => {
  2250. if (this.$refs.rohsTable) {
  2251. this.$refs.rohsTable.setCurrentRow(rowList[0])
  2252. }
  2253. this.addOrUpdateHandle(rowList[0], true)
  2254. })
  2255. })
  2256. return
  2257. }
  2258. if (referenceNo) {
  2259. this.searchData.referenceNo = referenceNo
  2260. }
  2261. this.getDataList()
  2262. },
  2263. fetchNodeOptions () {
  2264. if (!this.searchData.site || !this.menuId) {
  2265. this.nodeOptions = []
  2266. return
  2267. }
  2268. let params = {
  2269. site: this.searchData.site,
  2270. menuId: this.menuId
  2271. }
  2272. api.getNodeList(params).then(({data}) => {
  2273. if (data && data.code === 0 && Array.isArray(data.rows)) {
  2274. this.nodeOptions = data.rows
  2275. .filter(item => item && item.nodeId)
  2276. .map(item => ({
  2277. id: item.nodeId,
  2278. name: item.nodeName
  2279. }))
  2280. } else {
  2281. this.nodeOptions = []
  2282. }
  2283. }).catch(() => {
  2284. this.nodeOptions = []
  2285. })
  2286. },
  2287. loadNodeAuthority (site, stepId) {
  2288. if (!site || stepId === null || stepId === undefined || !this.menuId) {
  2289. this.plmRohsAuthorityArr = []
  2290. this.nodeAuthorityLoaded = true
  2291. return Promise.resolve()
  2292. }
  2293. this.nodeAuthorityLoaded = false
  2294. let params = {
  2295. site: site,
  2296. stepId: stepId,
  2297. menuId: this.menuId
  2298. }
  2299. return api.getRohsNodeAuthority(params).then(({data}) => {
  2300. if (data && data.code === 0 && data.rows) {
  2301. this.plmRohsAuthorityArr = data.rows.plm_rohs || []
  2302. } else {
  2303. this.plmRohsAuthorityArr = []
  2304. }
  2305. this.nodeAuthorityLoaded = true
  2306. }).catch(() => {
  2307. this.plmRohsAuthorityArr = []
  2308. this.nodeAuthorityLoaded = true
  2309. })
  2310. },
  2311. rohsFieldFlag (fieldId) {
  2312. if (!this.plmRohsAuthorityArr || this.plmRohsAuthorityArr.length === 0) {
  2313. return 'N'
  2314. }
  2315. let target = this.plmRohsAuthorityArr.find(item => item.fieldId === fieldId)
  2316. return target ? target.updateFlag : 'N'
  2317. },
  2318. isRohsFieldDisabled (fieldId) {
  2319. if (this.showModalFlag) {
  2320. return true
  2321. }
  2322. if (!this.isEditMode) {
  2323. return false
  2324. }
  2325. return this.rohsFieldFlag(fieldId) === 'N'
  2326. },
  2327. isProcessFieldDisabled () {
  2328. return this.isRohsFieldDisabled('process')
  2329. },
  2330. handleProcessChange (value) {
  2331. const processValue = String(value || '').trim()
  2332. this.$set(this.modalData, 'process', processValue)
  2333. },
  2334. isRohsFieldDisabledWithFallback (primaryFieldId, fallbackFieldId) {
  2335. if (this.showModalFlag) {
  2336. return true
  2337. }
  2338. if (!this.isEditMode) {
  2339. return false
  2340. }
  2341. const primaryDisabled = this.rohsFieldFlag(primaryFieldId) === 'N'
  2342. if (!primaryDisabled) {
  2343. return false
  2344. }
  2345. return this.rohsFieldFlag(fallbackFieldId) === 'N'
  2346. },
  2347. isValidUntilValueDisabled () {
  2348. return this.isRohsFieldDisabledWithFallback('validUntilValue', 'validUntil')
  2349. },
  2350. isValidUntilUnitDisabled () {
  2351. return this.isRohsFieldDisabledWithFallback('validUntil', 'validUntilValue')
  2352. },
  2353. canEditRohsMaterial () {
  2354. return !this.showModalFlag
  2355. },
  2356. normalizeDateOnly (value) {
  2357. if (value === null || value === undefined || value === '') {
  2358. return ''
  2359. }
  2360. if (value instanceof Date && !Number.isNaN(value.getTime())) {
  2361. const year = value.getFullYear()
  2362. const month = String(value.getMonth() + 1).padStart(2, '0')
  2363. const day = String(value.getDate()).padStart(2, '0')
  2364. return year + '-' + month + '-' + day
  2365. }
  2366. const text = String(value).trim()
  2367. if (!text) {
  2368. return ''
  2369. }
  2370. if (text.includes('T')) {
  2371. return text.split('T')[0]
  2372. }
  2373. return text.length >= 10 ? text.substring(0, 10) : text
  2374. },
  2375. parseDateOnly (value) {
  2376. const text = this.normalizeDateOnly(value)
  2377. if (!text) {
  2378. return null
  2379. }
  2380. const parts = text.split('-')
  2381. if (parts.length !== 3) {
  2382. return null
  2383. }
  2384. const year = Number.parseInt(parts[0], 10)
  2385. const month = Number.parseInt(parts[1], 10)
  2386. const day = Number.parseInt(parts[2], 10)
  2387. if (Number.isNaN(year) || Number.isNaN(month) || Number.isNaN(day)) {
  2388. return null
  2389. }
  2390. const date = new Date(year, month - 1, day)
  2391. if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
  2392. return null
  2393. }
  2394. return date
  2395. },
  2396. normalizeValidUntilUnitType (unitValue) {
  2397. const text = String(unitValue || '').trim().toLowerCase()
  2398. if (!text) {
  2399. return ''
  2400. }
  2401. if (text === 'd' || text === 'day' || text === 'days' || text.includes('日')) {
  2402. return 'day'
  2403. }
  2404. if (text === 'w' || text === 'week' || text === 'weeks' || text.includes('周')) {
  2405. return 'week'
  2406. }
  2407. if (text === 'm' || text === 'month' || text === 'months' || text.includes('月')) {
  2408. return 'month'
  2409. }
  2410. if (text === 'y' || text === 'year' || text === 'years' || text.includes('年')) {
  2411. return 'year'
  2412. }
  2413. return ''
  2414. },
  2415. addMonthsKeepDay (baseDate, monthDelta) {
  2416. const year = baseDate.getFullYear()
  2417. const month = baseDate.getMonth()
  2418. const day = baseDate.getDate()
  2419. const targetFirstDay = new Date(year, month + monthDelta, 1)
  2420. const targetYear = targetFirstDay.getFullYear()
  2421. const targetMonth = targetFirstDay.getMonth()
  2422. const lastDay = new Date(targetYear, targetMonth + 1, 0).getDate()
  2423. return new Date(targetYear, targetMonth, Math.min(day, lastDay))
  2424. },
  2425. addYearsKeepDay (baseDate, yearDelta) {
  2426. const targetYear = baseDate.getFullYear() + yearDelta
  2427. const month = baseDate.getMonth()
  2428. const day = baseDate.getDate()
  2429. const lastDay = new Date(targetYear, month + 1, 0).getDate()
  2430. return new Date(targetYear, month, Math.min(day, lastDay))
  2431. },
  2432. calculateExpiryDateByRule (reportDate, validUntilValue, validUntilUnit) {
  2433. const baseDate = this.parseDateOnly(reportDate)
  2434. const durationValue = this.normalizeValidUntilValue(validUntilValue)
  2435. const unitType = this.normalizeValidUntilUnitType(validUntilUnit)
  2436. if (!baseDate || !durationValue || !unitType) {
  2437. return ''
  2438. }
  2439. let resultDate = new Date(baseDate.getTime())
  2440. if (unitType === 'day') {
  2441. resultDate.setDate(resultDate.getDate() + durationValue)
  2442. } else if (unitType === 'week') {
  2443. resultDate.setDate(resultDate.getDate() + durationValue * 7)
  2444. } else if (unitType === 'month') {
  2445. resultDate = this.addMonthsKeepDay(baseDate, durationValue)
  2446. } else if (unitType === 'year') {
  2447. resultDate = this.addYearsKeepDay(baseDate, durationValue)
  2448. } else {
  2449. return ''
  2450. }
  2451. return this.normalizeDateOnly(resultDate)
  2452. },
  2453. syncExpiryDateByRule () {
  2454. if (!this.modalData) {
  2455. return ''
  2456. }
  2457. const expiryDate = this.calculateExpiryDateByRule(this.modalData.expiredDate, this.modalData.validUntilValue, this.modalData.validUntil)
  2458. this.$set(this.modalData, 'expiryDate', expiryDate)
  2459. return expiryDate
  2460. },
  2461. getCurrentDateString () {
  2462. return this.normalizeDateOnly(new Date())
  2463. },
  2464. normalizeCheckboxFlag (value) {
  2465. return String(value || '').trim().toUpperCase() === 'Y' ? 'Y' : 'N'
  2466. },
  2467. normalizeValidUntilValue (value) {
  2468. if (value === null || value === undefined || value === '') {
  2469. return null
  2470. }
  2471. const parsed = Number.parseInt(value, 10)
  2472. if (Number.isNaN(parsed) || parsed <= 0) {
  2473. return null
  2474. }
  2475. return parsed
  2476. },
  2477. getValidUntilDisplay (value, unit) {
  2478. const normalizedValue = this.normalizeValidUntilValue(value)
  2479. const normalizedUnit = String(unit || '').trim()
  2480. if (normalizedValue && normalizedUnit) {
  2481. return normalizedValue + normalizedUnit
  2482. }
  2483. if (normalizedValue) {
  2484. return String(normalizedValue)
  2485. }
  2486. return normalizedUnit
  2487. },
  2488. getRohsSubmitFieldValue (fieldId) {
  2489. const fieldMapping = {
  2490. materialClassify: 'materialClassifyList',
  2491. qualificationDocumentsNeeded: 'qualificationDocumentsNeededList',
  2492. testReportIncludingItems: 'testReportIncludingItemsList',
  2493. hsfApprover: 'hsfApproverCodeList'
  2494. }
  2495. const mappedField = fieldMapping[fieldId]
  2496. if (mappedField) {
  2497. return this.modalData[mappedField]
  2498. }
  2499. return this.modalData[fieldId]
  2500. },
  2501. isSubmitFieldEmpty (value) {
  2502. if (Array.isArray(value)) {
  2503. return value.length === 0
  2504. }
  2505. if (typeof value === 'string') {
  2506. return value.trim() === ''
  2507. }
  2508. return !value
  2509. },
  2510. validateSubmitRequiredFields () {
  2511. if (this.plmRohsAuthorityArr && this.plmRohsAuthorityArr.length > 0) {
  2512. let validUntilPairRequiredChecked = false
  2513. for (let i = 0; i < this.plmRohsAuthorityArr.length; i++) {
  2514. const fieldConfig = this.plmRohsAuthorityArr[i]
  2515. if (fieldConfig.required !== 'Y') {
  2516. continue
  2517. }
  2518. if (fieldConfig.fieldId === 'hsfStandard' && !this.shouldShowHsfStandard(this.modalData.endCustomer)) {
  2519. continue
  2520. }
  2521. if (fieldConfig.fieldId === 'commGroup3' && String(this.modalData.commGroup1 || '').trim() !== '00100') {
  2522. continue
  2523. }
  2524. if (fieldConfig.fieldId === 'validUntil' || fieldConfig.fieldId === 'validUntilValue') {
  2525. if (validUntilPairRequiredChecked) {
  2526. continue
  2527. }
  2528. const validUntilValue = this.normalizeValidUntilValue(this.modalData.validUntilValue)
  2529. this.$set(this.modalData, 'validUntilValue', validUntilValue)
  2530. if (this.isSubmitFieldEmpty(validUntilValue) || this.isSubmitFieldEmpty(this.modalData.validUntil)) {
  2531. this.$message.warning('有效期数值/单位不能为空!')
  2532. return false
  2533. }
  2534. validUntilPairRequiredChecked = true
  2535. continue
  2536. }
  2537. const value = this.getRohsSubmitFieldValue(fieldConfig.fieldId)
  2538. if (this.isSubmitFieldEmpty(value)) {
  2539. this.$message.warning((fieldConfig.fieldName || fieldConfig.fieldId) + '不能为空!')
  2540. return false
  2541. }
  2542. }
  2543. }
  2544. return true
  2545. },
  2546. validateValidUntilPair () {
  2547. const validUntilValue = this.normalizeValidUntilValue(this.modalData.validUntilValue)
  2548. const validUntilUnit = String(this.modalData.validUntil || '').trim()
  2549. this.$set(this.modalData, 'validUntilValue', validUntilValue)
  2550. this.$set(this.modalData, 'validUntil', validUntilUnit)
  2551. if (!validUntilValue && !validUntilUnit) {
  2552. return true
  2553. }
  2554. if (!validUntilValue) {
  2555. this.$message.warning('请填写有效期数值')
  2556. return false
  2557. }
  2558. if (!validUntilUnit) {
  2559. this.$message.warning('请选择有效期单位')
  2560. return false
  2561. }
  2562. return true
  2563. },
  2564. materialDialogHeaderCellStyle () {
  2565. return {
  2566. whiteSpace: 'nowrap',
  2567. wordBreak: 'keep-all'
  2568. }
  2569. },
  2570. displayYesNo (value) {
  2571. if (value === 'Y') {
  2572. return '是'
  2573. }
  2574. if (value === 'N') {
  2575. return '否'
  2576. }
  2577. return value || ''
  2578. },
  2579. getMultipleSelectTitle (value) {
  2580. if (!Array.isArray(value)) {
  2581. return ''
  2582. }
  2583. return value
  2584. .filter(item => item !== null && item !== undefined && String(item).trim() !== '')
  2585. .map(item => String(item).trim())
  2586. .join(';')
  2587. },
  2588. shouldShowHsfStandard (customerCode) {
  2589. return String(customerCode || '').trim().toUpperCase() === 'C00052'
  2590. },
  2591. applyHsfStandardDefaultByCustomer (formData) {
  2592. if (!formData || !this.shouldShowHsfStandard(formData.endCustomer)) {
  2593. return
  2594. }
  2595. const currentValue = String(formData.hsfStandard || '').trim()
  2596. if (!currentValue) {
  2597. this.$set(formData, 'hsfStandard', this.hsfStandardDefaultText)
  2598. }
  2599. },
  2600. normalizeHsfStandardByCustomer (formData) {
  2601. if (!formData) {
  2602. return
  2603. }
  2604. if (!this.shouldShowHsfStandard(formData.endCustomer)) {
  2605. this.$set(formData, 'hsfStandard', '')
  2606. return
  2607. }
  2608. this.applyHsfStandardDefaultByCustomer(formData)
  2609. },
  2610. resolveFirstBuNoFromPermissionList (rows) {
  2611. if (!Array.isArray(rows)) {
  2612. return ''
  2613. }
  2614. const firstRow = rows.find(item => item && String(item.buNo || item.bu_no || '').trim())
  2615. return firstRow ? String(firstRow.buNo || firstRow.bu_no || '').trim() : ''
  2616. },
  2617. loadCurrentUserBuPermissionList (forceRefresh = false) {
  2618. if (!forceRefresh && Array.isArray(this.userBuPermissionList) && this.userBuPermissionList.length > 0) {
  2619. return Promise.resolve(this.userBuPermissionList)
  2620. }
  2621. const site = this.modalData.site || this.$store.state.user.site
  2622. const username = this.$store.state.user.name
  2623. if (!site || !username) {
  2624. this.userBuPermissionList = []
  2625. this.userFirstBuNo = ''
  2626. return Promise.resolve([])
  2627. }
  2628. return queryBuList({
  2629. site: site,
  2630. username: username
  2631. }).then(({data}) => {
  2632. if (data && data.code === 0 && Array.isArray(data.rows)) {
  2633. this.userBuPermissionList = data.rows
  2634. this.userFirstBuNo = this.resolveFirstBuNoFromPermissionList(data.rows)
  2635. } else {
  2636. this.userBuPermissionList = []
  2637. this.userFirstBuNo = ''
  2638. }
  2639. return this.userBuPermissionList
  2640. }).catch(() => {
  2641. this.userBuPermissionList = []
  2642. this.userFirstBuNo = ''
  2643. return []
  2644. })
  2645. },
  2646. ensureModalBuNo (showWarning = false, allowUserFirstBuFallback = true) {
  2647. const currentBuNo = String((this.modalData && this.modalData.buNo) || '').trim()
  2648. if (currentBuNo) {
  2649. return Promise.resolve(currentBuNo)
  2650. }
  2651. if (!allowUserFirstBuFallback) {
  2652. if (showWarning) {
  2653. this.$message.warning('当前单据bu_no为空,无法查询HSF审批人')
  2654. }
  2655. return Promise.resolve('')
  2656. }
  2657. return this.loadCurrentUserBuPermissionList(false).then((rows) => {
  2658. const firstBuNo = this.resolveFirstBuNoFromPermissionList(rows)
  2659. if (firstBuNo) {
  2660. this.$set(this.modalData, 'buNo', firstBuNo)
  2661. return firstBuNo
  2662. }
  2663. if (showWarning) {
  2664. this.$message.warning('当前用户未配置BU权限,无法查询HSF审批人')
  2665. }
  2666. return ''
  2667. })
  2668. },
  2669. resolveOperatorNameById (operatorId) {
  2670. const normalizedId = String(operatorId || '').trim()
  2671. if (!normalizedId) {
  2672. return ''
  2673. }
  2674. const option = (this.hsfApproverOptionList || []).find(item => String(item.operatorId || '').trim() === normalizedId) ||
  2675. (this.relatedPeopleOptionList || []).find(item => String(item.operatorId || '').trim() === normalizedId)
  2676. return option ? String(option.operatorName || '').trim() : normalizedId
  2677. },
  2678. resolveOperatorIdByCodeOrName (operatorValue) {
  2679. const normalizedValue = String(operatorValue || '').trim()
  2680. if (!normalizedValue) {
  2681. return ''
  2682. }
  2683. const option = (this.hsfApproverOptionList || []).find(item => String(item.operatorId || '').trim() === normalizedValue) ||
  2684. (this.hsfApproverOptionList || []).find(item => String(item.operatorName || '').trim() === normalizedValue) ||
  2685. (this.relatedPeopleOptionList || []).find(item => String(item.operatorId || '').trim() === normalizedValue) ||
  2686. (this.relatedPeopleOptionList || []).find(item => String(item.operatorName || '').trim() === normalizedValue)
  2687. return option ? String(option.operatorId || '').trim() : normalizedValue
  2688. },
  2689. syncHsfApproverFields () {
  2690. const sourceList = Array.isArray(this.modalData.hsfApproverCodeList)
  2691. ? this.modalData.hsfApproverCodeList
  2692. : []
  2693. const uniqueCodeList = []
  2694. const seen = new Set()
  2695. sourceList.forEach(item => {
  2696. const value = this.resolveOperatorIdByCodeOrName(item)
  2697. if (!value || seen.has(value)) {
  2698. return
  2699. }
  2700. seen.add(value)
  2701. uniqueCodeList.push(value)
  2702. })
  2703. this.$set(this.modalData, 'hsfApproverCodeList', uniqueCodeList)
  2704. this.$set(this.modalData, 'hsfApprover', uniqueCodeList.join(';'))
  2705. this.$set(this.modalData, 'hsfApproverName', uniqueCodeList.map(item => this.resolveOperatorNameById(item)).join(';'))
  2706. this.buildRelatedPeopleOptions(uniqueCodeList)
  2707. const relatedPeopleCode = this.resolveOperatorIdByCodeOrName(this.modalData.relatedPeople)
  2708. if (relatedPeopleCode && !uniqueCodeList.includes(relatedPeopleCode)) {
  2709. this.$set(this.modalData, 'relatedPeople', '')
  2710. this.$set(this.modalData, 'relatedPeopleName', '')
  2711. return
  2712. }
  2713. if (relatedPeopleCode) {
  2714. this.$set(this.modalData, 'relatedPeople', relatedPeopleCode)
  2715. this.$set(this.modalData, 'relatedPeopleName', this.resolveOperatorNameById(relatedPeopleCode))
  2716. }
  2717. },
  2718. buildRelatedPeopleOptions (selectedOperatorIds) {
  2719. const normalizedIds = (Array.isArray(selectedOperatorIds) ? selectedOperatorIds : (this.modalData.hsfApproverCodeList || []))
  2720. .map(item => this.resolveOperatorIdByCodeOrName(item))
  2721. .filter(item => !!item)
  2722. const selectedSet = new Set(normalizedIds)
  2723. let optionList = (this.hsfApproverOptionList || [])
  2724. .filter(item => selectedSet.has(String(item.operatorId || '').trim()))
  2725. .map(item => ({
  2726. operatorId: item.operatorId,
  2727. operatorName: item.operatorName
  2728. }))
  2729. const existingIdSet = new Set(optionList.map(item => String(item.operatorId || '').trim()))
  2730. normalizedIds.forEach(operatorId => {
  2731. if (existingIdSet.has(operatorId)) {
  2732. return
  2733. }
  2734. optionList.push({
  2735. operatorId: operatorId,
  2736. operatorName: this.resolveOperatorNameById(operatorId)
  2737. })
  2738. existingIdSet.add(operatorId)
  2739. })
  2740. this.relatedPeopleOptionList = optionList
  2741. this.filterRelatedPeopleOptions()
  2742. const selectedRelatedPeopleCode = this.resolveOperatorIdByCodeOrName(this.modalData.relatedPeople)
  2743. const selectedRelatedPeopleRow = optionList.find(item => String(item.operatorId || '').trim() === selectedRelatedPeopleCode)
  2744. if (!selectedRelatedPeopleRow) {
  2745. this.$set(this.modalData, 'relatedPeople', '')
  2746. this.$set(this.modalData, 'relatedPeopleName', '')
  2747. } else {
  2748. this.$set(this.modalData, 'relatedPeople', selectedRelatedPeopleCode)
  2749. this.$set(this.modalData, 'relatedPeopleName', String(selectedRelatedPeopleRow.operatorName || '').trim())
  2750. }
  2751. },
  2752. normalizeHsfApproverOptionList (rows) {
  2753. if (!Array.isArray(rows)) {
  2754. return []
  2755. }
  2756. return rows
  2757. .map(item => {
  2758. const operatorId = String(item.operatorId || item.operator_id || item.username || item.userName || '').trim()
  2759. const operatorName = String(item.operatorName || item.operator_name || item.userDisplay || item.user_display || '').trim()
  2760. if (!operatorId || !operatorName) {
  2761. return null
  2762. }
  2763. return {
  2764. operatorId,
  2765. operatorName
  2766. }
  2767. })
  2768. .filter(item => !!item)
  2769. },
  2770. filterHsfApproverOptions () {
  2771. const operatorIdKeyword = String(this.hsfApproverSearchData.operatorId || '').trim().toUpperCase()
  2772. const operatorNameKeyword = String(this.hsfApproverSearchData.operatorName || '').trim().toUpperCase()
  2773. this.hsfApproverDisplayList = (this.hsfApproverOptionList || []).filter(item => {
  2774. const operatorId = String(item.operatorId || '').toUpperCase()
  2775. const operatorName = String(item.operatorName || '').toUpperCase()
  2776. const matchOperatorId = !operatorIdKeyword || operatorId.includes(operatorIdKeyword)
  2777. const matchOperatorName = !operatorNameKeyword || operatorName.includes(operatorNameKeyword)
  2778. return matchOperatorId && matchOperatorName
  2779. })
  2780. },
  2781. filterRelatedPeopleOptions () {
  2782. const operatorIdKeyword = String(this.relatedPeopleSearchData.operatorId || '').trim().toUpperCase()
  2783. const operatorNameKeyword = String(this.relatedPeopleSearchData.operatorName || '').trim().toUpperCase()
  2784. this.relatedPeopleDisplayList = (this.relatedPeopleOptionList || []).filter(item => {
  2785. const operatorId = String(item.operatorId || '').toUpperCase()
  2786. const operatorName = String(item.operatorName || '').toUpperCase()
  2787. const matchOperatorId = !operatorIdKeyword || operatorId.includes(operatorIdKeyword)
  2788. const matchOperatorName = !operatorNameKeyword || operatorName.includes(operatorNameKeyword)
  2789. return matchOperatorId && matchOperatorName
  2790. })
  2791. },
  2792. openHsfApproverChooseModal () {
  2793. if (this.isRohsFieldDisabled('hsfApprover')) {
  2794. return
  2795. }
  2796. this.ensureModalBuNo(true, !this.isEditMode).then((buNo) => {
  2797. if (!buNo) {
  2798. return
  2799. }
  2800. this.loadHsfApproverByCurrentBuNo(false).then(() => {
  2801. if (!this.hsfApproverOptionList || this.hsfApproverOptionList.length === 0) {
  2802. this.$message.warning('未查询到可选HSF审批人')
  2803. return
  2804. }
  2805. this.hsfApproverFlag = true
  2806. })
  2807. })
  2808. },
  2809. openHsfApproverDialog () {
  2810. this.hsfApproverSearchData = {
  2811. operatorId: '',
  2812. operatorName: ''
  2813. }
  2814. this.filterHsfApproverOptions()
  2815. const selectedOperatorSet = new Set(
  2816. (this.modalData.hsfApproverCodeList || [])
  2817. .map(item => String(item || '').trim())
  2818. .filter(item => !!item)
  2819. )
  2820. const selectedRows = (this.hsfApproverOptionList || []).filter(item => selectedOperatorSet.has(String(item.operatorId || '').trim()))
  2821. this.hsfApproverSelectionCache = JSON.parse(JSON.stringify(selectedRows))
  2822. this.$nextTick(() => {
  2823. if (!this.$refs.hsfApproverTable) {
  2824. return
  2825. }
  2826. this.$refs.hsfApproverTable.clearSelection()
  2827. selectedRows.forEach(item => {
  2828. this.$refs.hsfApproverTable.toggleRowSelection(item, true)
  2829. })
  2830. })
  2831. },
  2832. closeHsfApproverDialog () {
  2833. this.hsfApproverSelectionCache = []
  2834. },
  2835. handleHsfApproverSelectionChange (rows) {
  2836. this.hsfApproverSelectionCache = rows || []
  2837. },
  2838. handleHsfApproverTableClick (row, column, event, tableRef) {
  2839. if (this.$refs[tableRef]) {
  2840. this.$refs[tableRef].toggleRowSelection(row)
  2841. }
  2842. },
  2843. saveHsfApproverChooseModal () {
  2844. const selectedCodes = (this.hsfApproverSelectionCache || [])
  2845. .map(item => String(item.operatorId || '').trim())
  2846. .filter(item => !!item)
  2847. this.$set(this.modalData, 'hsfApproverCodeList', selectedCodes)
  2848. this.syncHsfApproverFields()
  2849. this.hsfApproverFlag = false
  2850. },
  2851. clearHsfApproverSelection () {
  2852. this.$set(this.modalData, 'hsfApproverCodeList', [])
  2853. this.syncHsfApproverFields()
  2854. },
  2855. openRelatedPeopleChooseModal () {
  2856. if (this.isRohsFieldDisabled('relatedPeople')) {
  2857. return
  2858. }
  2859. if (!this.modalData || !Array.isArray(this.modalData.hsfApproverCodeList) || this.modalData.hsfApproverCodeList.length === 0) {
  2860. this.$message.warning('请先选择HSF审批人')
  2861. return
  2862. }
  2863. this.buildRelatedPeopleOptions(this.modalData.hsfApproverCodeList)
  2864. if (!this.relatedPeopleOptionList || this.relatedPeopleOptionList.length === 0) {
  2865. this.$message.warning('未查询到可选Inform Related people')
  2866. return
  2867. }
  2868. this.relatedPeopleFlag = true
  2869. },
  2870. openRelatedPeopleDialog () {
  2871. this.relatedPeopleSearchData = {
  2872. operatorId: '',
  2873. operatorName: ''
  2874. }
  2875. this.filterRelatedPeopleOptions()
  2876. const relatedPeopleCode = String(this.modalData.relatedPeople || '').trim()
  2877. const selectedRow = (this.relatedPeopleOptionList || []).find(item => String(item.operatorId || '').trim() === relatedPeopleCode) || null
  2878. this.relatedPeopleSelection = selectedRow
  2879. this.$nextTick(() => {
  2880. if (!this.$refs.relatedPeopleTable) {
  2881. return
  2882. }
  2883. this.$refs.relatedPeopleTable.setCurrentRow(selectedRow || null)
  2884. })
  2885. },
  2886. closeRelatedPeopleDialog () {
  2887. this.relatedPeopleSelection = null
  2888. },
  2889. handleRelatedPeopleCurrentChange (row) {
  2890. this.relatedPeopleSelection = row || null
  2891. },
  2892. handleRelatedPeopleTableClick (row) {
  2893. this.relatedPeopleSelection = row || null
  2894. if (this.$refs.relatedPeopleTable) {
  2895. this.$refs.relatedPeopleTable.setCurrentRow(row)
  2896. }
  2897. },
  2898. saveRelatedPeopleChooseModal () {
  2899. const selectedCode = this.relatedPeopleSelection ? String(this.relatedPeopleSelection.operatorId || '').trim() : ''
  2900. const selectedName = this.relatedPeopleSelection ? String(this.relatedPeopleSelection.operatorName || '').trim() : ''
  2901. this.$set(this.modalData, 'relatedPeople', selectedCode)
  2902. this.$set(this.modalData, 'relatedPeopleName', selectedName)
  2903. this.relatedPeopleFlag = false
  2904. },
  2905. clearRelatedPeopleSelection () {
  2906. this.$set(this.modalData, 'relatedPeople', '')
  2907. this.$set(this.modalData, 'relatedPeopleName', '')
  2908. this.relatedPeopleSelection = null
  2909. if (this.$refs.relatedPeopleTable) {
  2910. this.$refs.relatedPeopleTable.setCurrentRow(null)
  2911. }
  2912. },
  2913. clearHsfApproverFields (clearBuNo = false) {
  2914. if (clearBuNo) {
  2915. this.$set(this.modalData, 'buNo', '')
  2916. }
  2917. this.hsfApproverOptionList = []
  2918. this.hsfApproverDisplayList = []
  2919. this.hsfApproverSelectionCache = []
  2920. this.relatedPeopleOptionList = []
  2921. this.relatedPeopleDisplayList = []
  2922. this.relatedPeopleSelection = null
  2923. this.relatedPeopleFlag = false
  2924. this.hsfApproverSearchData = {
  2925. operatorId: '',
  2926. operatorName: ''
  2927. }
  2928. this.relatedPeopleSearchData = {
  2929. operatorId: '',
  2930. operatorName: ''
  2931. }
  2932. this.$set(this.modalData, 'hsfApproverCodeList', [])
  2933. this.$set(this.modalData, 'hsfApprover', '')
  2934. this.$set(this.modalData, 'hsfApproverName', '')
  2935. this.$set(this.modalData, 'relatedPeople', '')
  2936. this.$set(this.modalData, 'relatedPeopleName', '')
  2937. },
  2938. initHsfApproverForNewRecord () {
  2939. this.clearHsfApproverFields(false)
  2940. this.ensureModalBuNo(false, true).then((buNo) => {
  2941. if (!buNo) {
  2942. return
  2943. }
  2944. this.loadHsfApproverByCurrentBuNo(true)
  2945. })
  2946. },
  2947. loadHsfApproverByCurrentBuNo (forceSelectAll = false) {
  2948. if (!this.modalData || !this.modalData.site) {
  2949. this.hsfApproverOptionList = []
  2950. this.hsfApproverDisplayList = []
  2951. this.hsfApproverSelectionCache = []
  2952. if (forceSelectAll) {
  2953. this.clearHsfApproverFields(false)
  2954. }
  2955. return Promise.resolve()
  2956. }
  2957. const buNo = String(this.modalData.buNo || '').trim()
  2958. if (!buNo) {
  2959. if (forceSelectAll) {
  2960. this.$message.warning('当前单据未维护BU,无法加载HSF审批人')
  2961. this.clearHsfApproverFields(false)
  2962. }
  2963. this.hsfApproverOptionList = []
  2964. this.hsfApproverDisplayList = []
  2965. this.hsfApproverSelectionCache = []
  2966. return Promise.resolve()
  2967. }
  2968. const params = {
  2969. site: this.modalData.site,
  2970. buNo: buNo,
  2971. roleNo: 'R015'
  2972. }
  2973. return api.searchBmUser(params).then(({data}) => {
  2974. if (data && data.code === 0 && Array.isArray(data.rows)) {
  2975. this.hsfApproverOptionList = this.normalizeHsfApproverOptionList(data.rows)
  2976. this.filterHsfApproverOptions()
  2977. this.hsfApproverSelectionCache = []
  2978. if (forceSelectAll) {
  2979. const defaultSelectedCodes = this.hsfApproverOptionList.map(item => item.operatorId).filter(item => item)
  2980. this.$set(this.modalData, 'hsfApproverCodeList', defaultSelectedCodes)
  2981. }
  2982. this.syncHsfApproverFields()
  2983. } else {
  2984. this.hsfApproverOptionList = []
  2985. this.hsfApproverDisplayList = []
  2986. this.hsfApproverSelectionCache = []
  2987. if (forceSelectAll) {
  2988. this.clearHsfApproverFields(false)
  2989. }
  2990. }
  2991. }).catch(() => {
  2992. this.hsfApproverOptionList = []
  2993. this.hsfApproverDisplayList = []
  2994. this.hsfApproverSelectionCache = []
  2995. if (forceSelectAll) {
  2996. this.clearHsfApproverFields(false)
  2997. }
  2998. })
  2999. },
  3000. isCurrentApprover () {
  3001. return this.superAdmin || (this.modalData.createBy2 && this.modalData.createBy2.split(';').includes(this.createBy2))
  3002. },
  3003. canSaveAction () {
  3004. return !this.showModalFlag && (this.modalData.status === '草稿' || (this.modalData.status === '审批中' && this.isCurrentApprover()))
  3005. },
  3006. canAgreeAction () {
  3007. return this.authSubmit && this.isCurrentApprover() && this.modalData.status === '审批中' && this.modalData.tpProcessControl !== 'Y' && this.modalData.csProcessControl !== 'Y'
  3008. },
  3009. canRejectAction () {
  3010. return this.authReject && this.isCurrentApprover() && this.modalData.status === '审批中' && this.modalData.isReject === 'Y'
  3011. },
  3012. hasPersistedRohsRecord () {
  3013. return !!(this.modalData && this.modalData.site && this.modalData.referenceNo && !String(this.modalData.referenceNo).startsWith('TEMP-'))
  3014. },
  3015. openRohsRemarkDialog () {
  3016. this.$set(this.rohsRemarkForm, 'remark', this.modalData.remark || '')
  3017. this.rohsRemarkFlag = true
  3018. },
  3019. refreshRohsRemark () {
  3020. if (!this.hasPersistedRohsRecord()) {
  3021. this.$set(this.rohsRemarkForm, 'remark', this.modalData.remark || '')
  3022. return
  3023. }
  3024. api.getRohsDetail(this.modalData.site, this.modalData.referenceNo).then(({data}) => {
  3025. if (data && data.code === 0 && data.data) {
  3026. this.$set(this.rohsRemarkForm, 'remark', data.data.remark || '')
  3027. } else {
  3028. this.$message.error((data && data.msg) || '刷新失败')
  3029. }
  3030. }).catch(() => {
  3031. this.$message.error('刷新失败')
  3032. })
  3033. },
  3034. saveRohsRemark () {
  3035. const remark = this.rohsRemarkForm.remark || ''
  3036. if (!this.hasPersistedRohsRecord()) {
  3037. this.$set(this.modalData, 'remark', remark)
  3038. this.rohsRemarkFlag = false
  3039. this.$message.success('暂存成功,保存单据后写入数据库')
  3040. return
  3041. }
  3042. const params = {
  3043. site: this.modalData.site,
  3044. referenceNo: this.modalData.referenceNo,
  3045. remark: remark
  3046. }
  3047. api.updateRohsRemark(params).then(({data}) => {
  3048. if (data && data.code === 0) {
  3049. this.$set(this.modalData, 'remark', remark)
  3050. if (this.currentRow && this.currentRow.site === this.modalData.site && this.currentRow.referenceNo === this.modalData.referenceNo) {
  3051. this.$set(this.currentRow, 'remark', remark)
  3052. }
  3053. const target = (this.dataList || []).find(item => item.site === this.modalData.site && item.referenceNo === this.modalData.referenceNo)
  3054. if (target) {
  3055. this.$set(target, 'remark', remark)
  3056. }
  3057. this.rohsRemarkFlag = false
  3058. this.$message.success('操作成功')
  3059. } else {
  3060. this.$message.error((data && data.msg) || '保存失败')
  3061. }
  3062. }).catch(() => {
  3063. this.$message.error('保存失败')
  3064. })
  3065. },
  3066. openRohsMaterialDescDialog () {
  3067. this.$set(this.rohsMaterialDescForm, 'materialDesc', this.modalData.materialDesc || '')
  3068. this.rohsMaterialDescFlag = true
  3069. },
  3070. refreshRohsMaterialDesc () {
  3071. if (!this.hasPersistedRohsRecord()) {
  3072. this.$set(this.rohsMaterialDescForm, 'materialDesc', this.modalData.materialDesc || '')
  3073. return
  3074. }
  3075. api.getRohsDetail(this.modalData.site, this.modalData.referenceNo).then(({data}) => {
  3076. if (data && data.code === 0 && data.data) {
  3077. this.$set(this.rohsMaterialDescForm, 'materialDesc', data.data.materialDesc || '')
  3078. } else {
  3079. this.$message.error((data && data.msg) || '刷新失败')
  3080. }
  3081. }).catch(() => {
  3082. this.$message.error('刷新失败')
  3083. })
  3084. },
  3085. saveRohsMaterialDesc () {
  3086. const materialDesc = this.rohsMaterialDescForm.materialDesc || ''
  3087. if (!this.hasPersistedRohsRecord()) {
  3088. this.$set(this.modalData, 'materialDesc', materialDesc)
  3089. this.rohsMaterialDescFlag = false
  3090. this.$message.success('暂存成功,保存单据后写入数据库')
  3091. return
  3092. }
  3093. const params = {
  3094. site: this.modalData.site,
  3095. referenceNo: this.modalData.referenceNo,
  3096. materialDesc: materialDesc
  3097. }
  3098. api.updateRohsMaterialDesc(params).then(({data}) => {
  3099. if (data && data.code === 0) {
  3100. this.$set(this.modalData, 'materialDesc', materialDesc)
  3101. if (this.currentRow && this.currentRow.site === this.modalData.site && this.currentRow.referenceNo === this.modalData.referenceNo) {
  3102. this.$set(this.currentRow, 'materialDesc', materialDesc)
  3103. }
  3104. const target = (this.dataList || []).find(item => item.site === this.modalData.site && item.referenceNo === this.modalData.referenceNo)
  3105. if (target) {
  3106. this.$set(target, 'materialDesc', materialDesc)
  3107. }
  3108. this.rohsMaterialDescFlag = false
  3109. this.$message.success('操作成功')
  3110. } else {
  3111. this.$message.error((data && data.msg) || '保存失败')
  3112. }
  3113. }).catch(() => {
  3114. this.$message.error('保存失败')
  3115. })
  3116. },
  3117. loadModalButtonCondition () {
  3118. if (!this.modalData.site || !this.modalData.referenceNo || this.modalData.status !== '审批中') {
  3119. this.$set(this.modalData, 'createBy2', '')
  3120. this.$set(this.modalData, 'isReject', 'Y')
  3121. this.$set(this.modalData, 'tpProcessControl', 'N')
  3122. this.$set(this.modalData, 'csProcessControl', 'N')
  3123. return
  3124. }
  3125. let params = {
  3126. site: this.modalData.site,
  3127. referenceNo: this.modalData.referenceNo
  3128. }
  3129. api.getRohsButtonCondition(params).then(({data}) => {
  3130. if (data && data.code === 0 && data.data) {
  3131. this.$set(this.modalData, 'createBy2', data.data.createBy2 || '')
  3132. this.$set(this.modalData, 'isReject', data.data.isReject || 'Y')
  3133. this.$set(this.modalData, 'tpProcessControl', data.data.tpProcessControl || 'N')
  3134. this.$set(this.modalData, 'csProcessControl', data.data.csProcessControl || 'N')
  3135. } else {
  3136. this.$set(this.modalData, 'createBy2', '')
  3137. this.$set(this.modalData, 'isReject', 'Y')
  3138. this.$set(this.modalData, 'tpProcessControl', 'N')
  3139. this.$set(this.modalData, 'csProcessControl', 'N')
  3140. }
  3141. }).catch(() => {
  3142. this.$set(this.modalData, 'createBy2', '')
  3143. this.$set(this.modalData, 'isReject', 'Y')
  3144. this.$set(this.modalData, 'tpProcessControl', 'N')
  3145. this.$set(this.modalData, 'csProcessControl', 'N')
  3146. })
  3147. },
  3148. // 列表行选中变色
  3149. rowStyle ({row}) {
  3150. if (this.currentRow && this.currentRow.referenceNo === row.referenceNo) {
  3151. return { 'background-color': '#E8F7F6', cursor: 'pointer' }
  3152. }
  3153. },
  3154. // 获取按钮的权限数据
  3155. getButtonAuthData () {
  3156. this.authSearch = this.isAuth(this.menuId+":search")
  3157. this.authUpdate = this.isAuth(this.menuId+":update")
  3158. this.authIssue = this.isAuth(this.menuId+":issue")
  3159. this.authSubmit = this.isAuth(this.menuId+":submit")
  3160. this.authReject = this.isAuth(this.menuId+":reject")
  3161. this.authFileSave = this.isAuth(this.menuId+":fileSave")
  3162. this.authFileDownLoad = this.isAuth(this.menuId+":fileDownLoad")
  3163. this.authFileRemove = this.isAuth(this.menuId+":fileRemove")
  3164. this.authFilePreview = this.isAuth(this.menuId+":filePreview")
  3165. this.authDataEntry = this.isAuth(this.menuId+":dataEntry")
  3166. this.authMaterialDescRemark = this.isAuth(this.menuId + ":materialDescRemark")
  3167. this.authDelete = this.isAuth(this.menuId+":delete")
  3168. },
  3169. // 校验是否为超级管理员
  3170. checkSuperAdmin () {
  3171. checkSuperAdmin().then(({data}) => {
  3172. this.superAdmin = data.superAdmin
  3173. })
  3174. },
  3175. changeClickRow (row, column, event) {
  3176. this.loadCurrentRowFromServer(row, row || {})
  3177. },
  3178. currentChange (val) {
  3179. if (val) {
  3180. this.loadCurrentRowFromServer(val, val || {})
  3181. } else {
  3182. this.currentRow = {}
  3183. this.approvalList = []
  3184. }
  3185. },
  3186. dataListSelectionChange (rows) {
  3187. this.dataListSelections = rows || []
  3188. },
  3189. applyCurrentRowData (detailData, fallbackData = {}) {
  3190. this.currentRow = detailData || {}
  3191. if (!Array.isArray(this.currentRow.materialList)) {
  3192. this.$set(this.currentRow, 'materialList', [])
  3193. }
  3194. this.fillDisplayFields(this.currentRow, fallbackData || {})
  3195. this.syncDataListRow(this.currentRow)
  3196. this.refreshCurrentTabTable()
  3197. },
  3198. syncDataListRow (rowData) {
  3199. if (!rowData || !rowData.site || !rowData.referenceNo || !Array.isArray(this.dataList)) {
  3200. return
  3201. }
  3202. const targetIndex = this.dataList.findIndex(item => item.site === rowData.site && item.referenceNo === rowData.referenceNo)
  3203. if (targetIndex < 0) {
  3204. return
  3205. }
  3206. const mergedRow = {
  3207. ...this.dataList[targetIndex],
  3208. ...rowData
  3209. }
  3210. this.fillDisplayFields(mergedRow, this.dataList[targetIndex] || {})
  3211. this.$set(this.dataList, targetIndex, mergedRow)
  3212. },
  3213. loadCurrentRowFromServer (row, fallbackData = {}) {
  3214. if (!row || !row.site || !row.referenceNo) {
  3215. this.applyCurrentRowData(row || {}, fallbackData || {})
  3216. return Promise.resolve()
  3217. }
  3218. return api.getRohsDetail(row.site, row.referenceNo).then(({data}) => {
  3219. if (data && data.code === 0 && data.data) {
  3220. this.applyCurrentRowData(data.data, fallbackData || row)
  3221. } else {
  3222. this.applyCurrentRowData(row || {}, fallbackData || {})
  3223. }
  3224. }).catch(() => {
  3225. this.applyCurrentRowData(row || {}, fallbackData || {})
  3226. })
  3227. },
  3228. refreshCurrentRowFromServer (site, referenceNo) {
  3229. const querySite = site || (this.currentRow && this.currentRow.site)
  3230. const queryReferenceNo = referenceNo || (this.currentRow && this.currentRow.referenceNo)
  3231. if (!querySite || !queryReferenceNo || String(queryReferenceNo).startsWith('TEMP-')) {
  3232. return Promise.resolve()
  3233. }
  3234. return this.loadCurrentRowFromServer({
  3235. site: querySite,
  3236. referenceNo: queryReferenceNo
  3237. }, this.currentRow || {})
  3238. },
  3239. refreshOssRef (refName) {
  3240. const ref = this.$refs[refName]
  3241. if (!ref) {
  3242. return
  3243. }
  3244. const refList = Array.isArray(ref) ? ref : [ref]
  3245. refList.forEach(item => {
  3246. if (item && typeof item.handleQuery === 'function') {
  3247. item.handleQuery()
  3248. }
  3249. })
  3250. },
  3251. refreshAttachmentPanels () {
  3252. this.refreshOssRef('modalAttachmentTdsOss')
  3253. this.refreshOssRef('modalAttachmentMsdsOss')
  3254. this.refreshOssRef('modalAttachmentTestReportOss')
  3255. this.refreshOssRef('modalAttachmentOtherOss')
  3256. this.refreshOssRef('modalTdsOss')
  3257. this.refreshOssRef('bottomAttachmentOss')
  3258. this.refreshOssRef('bottomTdsOss')
  3259. },
  3260. handleModalClose () {
  3261. const site = this.modalData.site
  3262. const referenceNo = this.modalData.referenceNo
  3263. this.modalFlag = false
  3264. this.rohsCreatePartDialogFlag = false
  3265. this.rohsCharacteristicDialogFlag = false
  3266. this.rohsMaterialDescFlag = false
  3267. this.rohsCreatePartTab = 'General'
  3268. this.$nextTick(() => {
  3269. this.refreshAttachmentPanels()
  3270. })
  3271. this.refreshCurrentRowFromServer(site, referenceNo)
  3272. },
  3273. fillDisplayFields (target, fallbackData = {}) {
  3274. if (!target) {
  3275. return
  3276. }
  3277. const fields = ['nodeId', 'nodeName', 'currentApprover', 'applicantName', 'pmName', 'npdEngineerName', 'technicalPlanName', 'buyerName', 'endCustomerName', 'projectName', 'commGroup1Desc', 'commGroup2Desc', 'commGroup3Desc', 'hsfApproverName', 'relatedPeopleName']
  3278. fields.forEach(field => {
  3279. const value = target[field] || fallbackData[field] || ''
  3280. this.$set(target, field, value)
  3281. })
  3282. this.$set(target, 'endCustomerFlag', !!target.endCustomerFlag)
  3283. this.$set(target, 'projectIdFlag', !!target.projectIdFlag)
  3284. const validUntilValue = target.validUntilValue !== undefined && target.validUntilValue !== null && target.validUntilValue !== ''
  3285. ? target.validUntilValue
  3286. : fallbackData.validUntilValue
  3287. this.$set(target, 'validUntilValue', this.normalizeValidUntilValue(validUntilValue))
  3288. const applicationDate = target.applicationDate || fallbackData.applicationDate || ''
  3289. const plannedMassProductionDate = target.plannedMassProductionDate || fallbackData.plannedMassProductionDate || ''
  3290. const expiredDate = target.expiredDate || fallbackData.expiredDate || ''
  3291. const normalizedExpiredDate = this.normalizeDateOnly(expiredDate)
  3292. this.$set(target, 'applicationDate', this.normalizeDateOnly(applicationDate))
  3293. this.$set(target, 'plannedMassProductionDate', this.normalizeDateOnly(plannedMassProductionDate))
  3294. this.$set(target, 'expiredDate', normalizedExpiredDate)
  3295. this.$set(target, 'expiryDate', this.calculateExpiryDateByRule(normalizedExpiredDate, target.validUntilValue, target.validUntil))
  3296. const firstMaterialDisplay = this.resolveFirstMaterialDisplay(target)
  3297. const fallbackMainIfsPartNo = fallbackData.mainIfsPartNo || ''
  3298. const fallbackMainPartDesc = fallbackData.mainPartDesc || ''
  3299. this.$set(target, 'mainIfsPartNo', firstMaterialDisplay.mainIfsPartNo || target.mainIfsPartNo || fallbackMainIfsPartNo)
  3300. this.$set(target, 'mainPartDesc', firstMaterialDisplay.mainPartDesc || target.mainPartDesc || fallbackMainPartDesc)
  3301. },
  3302. resolveFirstMaterialDisplay (target) {
  3303. const materialList = Array.isArray(target && target.materialList) ? target.materialList : []
  3304. if (!materialList.length) {
  3305. return {
  3306. mainIfsPartNo: '',
  3307. mainPartDesc: ''
  3308. }
  3309. }
  3310. const firstMaterial = materialList[0] || {}
  3311. return {
  3312. mainIfsPartNo: String(firstMaterial.finalPartNo || firstMaterial.final_part_no || '').trim(),
  3313. mainPartDesc: String(firstMaterial.partDesc || firstMaterial.part_desc || '').trim()
  3314. }
  3315. },
  3316. refreshCurrentTabTable () {
  3317. if (this.activeTable === 'approvalInformation') {
  3318. this.getApprovalList()
  3319. return
  3320. }
  3321. if (this.activeTable === 'attachment') {
  3322. this.refreshOssRef('bottomAttachmentOss')
  3323. return
  3324. }
  3325. if (this.activeTable === 'npdInfo') {
  3326. this.refreshOssRef('bottomTdsOss')
  3327. }
  3328. },
  3329. getApprovalList () {
  3330. if (!this.currentRow || !this.currentRow.site || !this.currentRow.referenceNo) {
  3331. this.approvalList = []
  3332. return
  3333. }
  3334. let params = {
  3335. site: this.currentRow.site,
  3336. menuId: this.menuId,
  3337. documentNo: this.currentRow.referenceNo
  3338. }
  3339. api.getRohsApprovalList(params).then(({data}) => {
  3340. if (data && data.code === 0) {
  3341. this.approvalList = data.rows || []
  3342. } else {
  3343. this.approvalList = []
  3344. }
  3345. }).catch(() => {
  3346. this.approvalList = []
  3347. })
  3348. },
  3349. // 获取列表
  3350. getDataList () {
  3351. if (!this.authSearch) {
  3352. this.dataList = []
  3353. this.dataListSelections = []
  3354. this.totalPage = 0
  3355. this.currentRow = {}
  3356. this.approvalList = []
  3357. this.isFilterSearch = false
  3358. return Promise.resolve([])
  3359. }
  3360. this.dataListLoading = true
  3361. let params = {
  3362. page: this.pageIndex,
  3363. limit: this.pageSize,
  3364. site: this.$store.state.user.site,
  3365. menuId: this.menuId,
  3366. referenceNo: this.searchData.referenceNo,
  3367. status: this.searchData.status,
  3368. rohsStatus: this.searchData.rohsStatus,
  3369. currentApprover: this.searchData.currentApprover,
  3370. nodeId: this.searchData.nodeId,
  3371. ifsPartNo: this.searchData.ifsPartNo,
  3372. materialDesc: this.searchData.materialDesc
  3373. }
  3374. this.isFilterSearch = false
  3375. return api.getRohsList(params).then(({data}) => {
  3376. if (data && data.code === 0) {
  3377. const list = data.page.list || []
  3378. this.dataList = list.map(item => {
  3379. return {
  3380. applicantName: '',
  3381. pmName: '',
  3382. npdEngineerName: '',
  3383. technicalPlanName: '',
  3384. buyerName: '',
  3385. endCustomerName: '',
  3386. projectName: '',
  3387. nodeId: '',
  3388. nodeName: '',
  3389. currentApprover: '',
  3390. commGroup1Desc: '',
  3391. commGroup2Desc: '',
  3392. commGroup3Desc: '',
  3393. hsfApproverName: '',
  3394. relatedPeopleName: '',
  3395. mainIfsPartNo: '',
  3396. mainPartDesc: '',
  3397. ...item
  3398. }
  3399. })
  3400. this.dataListSelections = []
  3401. this.totalPage = data.page.totalCount
  3402. this.$nextTick(() => {
  3403. if (this.$refs.rohsTable) {
  3404. this.$refs.rohsTable.clearSelection()
  3405. }
  3406. if (this.$refs.rohsTable && this.dataList.length > 0) {
  3407. this.$refs.rohsTable.setCurrentRow(this.dataList[0])
  3408. } else if (this.$refs.rohsTable) {
  3409. this.$refs.rohsTable.setCurrentRow()
  3410. }
  3411. })
  3412. } else {
  3413. this.dataList = []
  3414. this.dataListSelections = []
  3415. this.totalPage = 0
  3416. this.currentRow = {}
  3417. this.approvalList = []
  3418. }
  3419. this.dataListLoading = false
  3420. return this.dataList
  3421. }).catch(() => {
  3422. this.dataListSelections = []
  3423. this.currentRow = {}
  3424. this.approvalList = []
  3425. this.dataListLoading = false
  3426. return []
  3427. })
  3428. },
  3429. // 分页
  3430. sizeChangeHandle (val) {
  3431. this.pageSize = val
  3432. this.pageIndex = 1
  3433. if (this.isFilterSearch === false) {
  3434. this.getDataList()
  3435. } else {
  3436. this.queryByAnyField(this.filterSearchData)
  3437. }
  3438. },
  3439. currentChangeHandle (val) {
  3440. this.pageIndex = val
  3441. if (this.isFilterSearch === false) {
  3442. this.getDataList()
  3443. } else {
  3444. this.queryByAnyField(this.filterSearchData)
  3445. }
  3446. },
  3447. // 搜索条件点击
  3448. searchHandle () {
  3449. if (!this.authSearch) {
  3450. return
  3451. }
  3452. this.filterVisible = true
  3453. },
  3454. queryByAnyField (params) {
  3455. const queryParams = {
  3456. ...(params || {})
  3457. }
  3458. queryParams.no = this.pageIndex
  3459. queryParams.size = this.pageSize
  3460. queryParams.userId = this.$store.state.user.id.toString()
  3461. queryParams.site = this.$store.state.user.site
  3462. queryParams.menuId = this.menuId
  3463. this.dataListLoading = true
  3464. api.getRohsListAny(queryParams).then(({data}) => {
  3465. if (data && data.code === 0) {
  3466. const list = (data.page && data.page.list) || []
  3467. this.dataList = list.map(item => {
  3468. return {
  3469. applicantName: '',
  3470. pmName: '',
  3471. npdEngineerName: '',
  3472. technicalPlanName: '',
  3473. buyerName: '',
  3474. endCustomerName: '',
  3475. projectName: '',
  3476. nodeId: '',
  3477. nodeName: '',
  3478. currentApprover: '',
  3479. commGroup1Desc: '',
  3480. commGroup2Desc: '',
  3481. commGroup3Desc: '',
  3482. hsfApproverName: '',
  3483. relatedPeopleName: '',
  3484. mainIfsPartNo: '',
  3485. mainPartDesc: '',
  3486. ...item
  3487. }
  3488. })
  3489. this.dataListSelections = []
  3490. this.totalPage = data.page.totalCount
  3491. this.$nextTick(() => {
  3492. if (this.$refs.rohsTable) {
  3493. this.$refs.rohsTable.clearSelection()
  3494. }
  3495. if (this.$refs.rohsTable && this.dataList.length > 0) {
  3496. this.$refs.rohsTable.setCurrentRow(this.dataList[0])
  3497. } else if (this.$refs.rohsTable) {
  3498. this.$refs.rohsTable.setCurrentRow()
  3499. }
  3500. })
  3501. } else {
  3502. this.$message.warning((data && data.msg) || '搜索失败')
  3503. this.dataList = []
  3504. this.dataListSelections = []
  3505. this.totalPage = 0
  3506. this.currentRow = {}
  3507. this.approvalList = []
  3508. }
  3509. this.dataListLoading = false
  3510. }).catch(() => {
  3511. this.dataList = []
  3512. this.dataListSelections = []
  3513. this.currentRow = {}
  3514. this.approvalList = []
  3515. this.dataListLoading = false
  3516. })
  3517. this.filterSearchData = JSON.parse(JSON.stringify(queryParams))
  3518. this.isFilterSearch = true
  3519. this.filterVisible = false
  3520. },
  3521. buildExportName () {
  3522. const now = new Date()
  3523. const year = String(now.getFullYear())
  3524. const month = String(now.getMonth() + 1).padStart(2, '0')
  3525. const day = String(now.getDate()).padStart(2, '0')
  3526. const hour = String(now.getHours()).padStart(2, '0')
  3527. const minute = String(now.getMinutes()).padStart(2, '0')
  3528. const second = String(now.getSeconds()).padStart(2, '0')
  3529. return 'RoHs记录' + year + month + day + hour + minute + second
  3530. },
  3531. async createExportData () {
  3532. const params = {
  3533. ...this.searchData,
  3534. site: this.$store.state.user.site,
  3535. menuId: this.menuId,
  3536. page: 1,
  3537. limit: -1
  3538. }
  3539. this.resultList = []
  3540. await api.getRohsList(params).then(({data}) => {
  3541. if (data && data.code === 0 && data.page && Array.isArray(data.page.list)) {
  3542. this.resultList = (data.page.list || []).map(item => {
  3543. const row = {
  3544. ...item
  3545. }
  3546. row.applicationDate = this.normalizeDateOnly(row.applicationDate)
  3547. row.plannedMassProductionDate = this.normalizeDateOnly(row.plannedMassProductionDate)
  3548. row.expectReportTime = this.normalizeDateOnly(row.expectReportTime)
  3549. row.expiredDate = this.normalizeDateOnly(row.expiredDate)
  3550. row.expiryDate = this.normalizeDateOnly(row.expiryDate)
  3551. row.validUntilDisplay = this.getValidUntilDisplay(row.validUntilValue, row.validUntil)
  3552. row.hsfApproverName = row.hsfApproverName || row.hsfApprover || ''
  3553. row.relatedPeopleName = row.relatedPeopleName || row.relatedPeople || ''
  3554. return row
  3555. })
  3556. } else {
  3557. this.$message.warning((data && data.msg) || '导出数据获取失败')
  3558. }
  3559. }).catch(() => {
  3560. this.$message.error('导出数据获取失败')
  3561. })
  3562. return this.resultList
  3563. },
  3564. startDownload () {
  3565. this.exportName = this.buildExportName()
  3566. this.exportFieldMap = this.buildExportFields()
  3567. if (!this.exportFieldMap || Object.keys(this.exportFieldMap).length === 0) {
  3568. this.$message.warning('未获取到可导出的列,请稍后重试')
  3569. }
  3570. this.exportLoading = true
  3571. },
  3572. finishDownload () {
  3573. this.exportLoading = false
  3574. },
  3575. buildExportFields () {
  3576. const tableRef = this.$refs.rohsTable
  3577. if (!tableRef || !Array.isArray(tableRef.columns)) {
  3578. return {}
  3579. }
  3580. const fields = {}
  3581. tableRef.columns.forEach(column => {
  3582. const label = column && column.label ? String(column.label).trim() : ''
  3583. const property = column && column.property ? String(column.property).trim() : ''
  3584. if (!label || !property || label === '操作') {
  3585. return
  3586. }
  3587. fields[label] = property
  3588. })
  3589. return fields
  3590. },
  3591. toPartMenu (ifsPartNo) {
  3592. const targetPartNo = String(ifsPartNo || '').trim()
  3593. if (!targetPartNo) {
  3594. this.$message.warning('IFS物料编码为空,无法跳转')
  3595. return
  3596. }
  3597. if (this.$router.resolve(`/part-partInformation`).resolved.name === '404') {
  3598. this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定'})
  3599. } else {
  3600. // 先关闭当前页面所有可能产生全局遮罩的弹窗,避免跳转后残留遮罩层
  3601. this.modalFlag = false
  3602. this.chooseProjectListFlag = false
  3603. this.projectMaterialDialogFlag = false
  3604. this.rohsCreatePartDialogFlag = false
  3605. this.rohsCharacteristicDialogFlag = false
  3606. this.hsfApproverFlag = false
  3607. this.relatedPeopleFlag = false
  3608. this.submitModalFlag = false
  3609. this.rohsRemarkFlag = false
  3610. this.rohsMaterialDescFlag = false
  3611. this.$nextTick(() => {
  3612. this.$router.push({name: `part-partInformation`, params: {ifsPartNo: targetPartNo}})
  3613. })
  3614. }
  3615. },
  3616. // 单选可取消
  3617. radioClick (field, value) {
  3618. if (this.modalData[field] === value) {
  3619. this.modalData[field] = ''
  3620. } else {
  3621. this.modalData[field] = value
  3622. }
  3623. },
  3624. // 新增 / 修改
  3625. addOrUpdateHandle (row, forceOpen = false) {
  3626. if (!forceOpen && !row && !this.authUpdate) {
  3627. this.$message.warning('没有新增权限')
  3628. return
  3629. }
  3630. if (!forceOpen && row && !this.authUpdate && !this.authDataEntry) {
  3631. this.$message.warning('没有编辑权限')
  3632. return
  3633. }
  3634. this.modalFlag = true
  3635. this.activeName = 'basicInfo'
  3636. this.submitModalFlag = false
  3637. this.rohsRemarkFlag = false
  3638. this.rohsMaterialDescFlag = false
  3639. this.rejectOpinion = ''
  3640. this.rohsRemarkForm = {
  3641. remark: ''
  3642. }
  3643. this.rohsMaterialDescForm = {
  3644. materialDesc: ''
  3645. }
  3646. this.projectMaterialDialogFlag = false
  3647. this.rohsCreatePartDialogFlag = false
  3648. this.rohsCreatePartLoading = false
  3649. this.rohsCreatePartTab = 'General'
  3650. this.rohsCreatePartTagNo = 0
  3651. this.rohsCharacteristicDialogFlag = false
  3652. this.rohsCharacteristicQueryData = {
  3653. propertiesItemNo: '',
  3654. itemDesc: ''
  3655. }
  3656. this.rohsCharacteristicList = []
  3657. this.rohsCharacteristicSelections = []
  3658. this.rohsPartItemSelections = []
  3659. this.projectMaterialSelections = []
  3660. this.materialSelections = []
  3661. this.hsfApproverOptionList = []
  3662. this.hsfApproverDisplayList = []
  3663. this.hsfApproverSelectionCache = []
  3664. this.hsfApproverSearchData = {
  3665. operatorId: '',
  3666. operatorName: ''
  3667. }
  3668. this.hsfApproverFlag = false
  3669. this.relatedPeopleOptionList = []
  3670. this.relatedPeopleDisplayList = []
  3671. this.relatedPeopleSelection = null
  3672. this.relatedPeopleSearchData = {
  3673. operatorId: '',
  3674. operatorName: ''
  3675. }
  3676. this.relatedPeopleFlag = false
  3677. this.plmRohsAuthorityArr = []
  3678. this.nodeAuthorityLoaded = !row
  3679. this.isEditMode = !!row
  3680. this.projectMaterialPageIndex = 1
  3681. this.projectMaterialTotal = 0
  3682. this.projectMaterialList = []
  3683. this.projectMaterialSearchData = {
  3684. finalPartNo: '',
  3685. partDesc: '',
  3686. partStatus: ''
  3687. }
  3688. this.showModalFlag = !!(row && (row.status === '已完成' || !this.authUpdate))
  3689. if (row) {
  3690. this.modalTitle = 'RoHS 编辑'
  3691. api.getRohsDetail(row.site, row.referenceNo).then(({data}) => {
  3692. if (data && data.code === 0) {
  3693. this.modalData = data.data || {}
  3694. this.$set(this.modalData, 'qualificationDocumentsNeededList', this.modalData.qualificationDocumentsNeeded ? this.modalData.qualificationDocumentsNeeded.split(';').filter(item => item) : [])
  3695. this.$set(this.modalData, 'testReportIncludingItemsList', this.modalData.testReportIncludingItems ? this.modalData.testReportIncludingItems.split(';').filter(item => item) : [])
  3696. this.$set(this.modalData, 'materialClassifyList', this.modalData.materialClassify ? this.modalData.materialClassify.split(';').filter(item => item) : [])
  3697. this.$set(this.modalData, 'materialList', Array.isArray(this.modalData.materialList) ? this.modalData.materialList : [])
  3698. this.$set(this.modalData, 'hsfApproverCodeList', this.modalData.hsfApprover ? this.modalData.hsfApprover.split(';').filter(item => item) : [])
  3699. this.$set(this.modalData, 'buNo', String(this.modalData.buNo || '').trim())
  3700. this.$set(this.modalData, 'isAhGrade', this.normalizeCheckboxFlag(this.modalData.isAhGrade))
  3701. this.$set(this.modalData, 'validUntilValue', this.normalizeValidUntilValue(this.modalData.validUntilValue))
  3702. this.syncHsfApproverFields()
  3703. this.fillDisplayFields(this.modalData, row || {})
  3704. this.applyHsfStandardDefaultByCustomer(this.modalData)
  3705. // 编辑时默认可修改工艺、最终客户和项目编码(若流程管控不可编辑则以流程为准)
  3706. this.$set(this.modalData, 'endCustomerFlag', false)
  3707. this.$set(this.modalData, 'projectIdFlag', false)
  3708. this.$set(this.modalData, 'createBy2', '')
  3709. this.$set(this.modalData, 'isReject', 'Y')
  3710. this.$set(this.modalData, 'tpProcessControl', 'N')
  3711. this.$set(this.modalData, 'csProcessControl', 'N')
  3712. this.loadModalButtonCondition()
  3713. this.ensureModalBuNo(true, false).then((buNo) => {
  3714. if (!buNo) {
  3715. return
  3716. }
  3717. this.loadHsfApproverByCurrentBuNo(false)
  3718. })
  3719. 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))
  3720. }
  3721. }).catch(() => {
  3722. this.loadNodeAuthority(row.site, row.stepId !== null && row.stepId !== undefined ? row.stepId : 10)
  3723. })
  3724. } else {
  3725. this.modalTitle = 'RoHS 新增'
  3726. this.showModalFlag = false
  3727. // 生成一个临时ID用于附件上传绑定
  3728. const tempReferenceNo = 'TEMP-' + new Date().getTime() + '-' + Math.floor(Math.random() * 1000)
  3729. this.modalData = {
  3730. site: this.$store.state.user.site,
  3731. referenceNo: tempReferenceNo,
  3732. applicant: this.$store.state.user.name || '',
  3733. applicantName: this.$store.state.user.userDisplay || this.$store.state.user.user_display || '',
  3734. pm: '',
  3735. pmName: '',
  3736. applicationDate: this.getCurrentDateString(),
  3737. process: '',
  3738. plannedMassProductionDate: '',
  3739. color: '',
  3740. vendorCode: '',
  3741. vendorMaterialCode: '',
  3742. materialClassify: '',
  3743. materialClassifyList: [],
  3744. otherMaterialClassify: '',
  3745. materialUseFor: '',
  3746. endCustomer: '',
  3747. endCustomerName: '',
  3748. endCustomerFlag: false,
  3749. projectId: '',
  3750. projectName: '',
  3751. projectIdFlag: true,
  3752. commGroup1: '',
  3753. commGroup1Desc: '',
  3754. commGroup2: '',
  3755. commGroup2Desc: '',
  3756. commGroup3: '',
  3757. commGroup3Desc: '',
  3758. needCreateNumber: '',
  3759. npdEngineer: '',
  3760. npdEngineerName: '',
  3761. materialValidityTime: '',
  3762. materialValidityComments: '',
  3763. needDeviation: '',
  3764. technicalPlan: '',
  3765. wmRequiredSpec: '',
  3766. isFiberMaterial: '',
  3767. materialThickness: '',
  3768. buyer: '',
  3769. buyerName: '',
  3770. expectReportTime: '',
  3771. qualificationDocumentsNeeded: '',
  3772. qualificationDocumentsNeededList: [],
  3773. testReportIncludingItems: '',
  3774. testReportIncludingItemsList: [],
  3775. remark: '',
  3776. status: '草稿',
  3777. sgsReportNumber: '',
  3778. rohsStatus: 'Active',
  3779. expiredDate: '',
  3780. expiryDate: '',
  3781. fiberInformation: '',
  3782. hsfStandard: '',
  3783. hsfApprover: '',
  3784. hsfApproverName: '',
  3785. hsfApproverCodeList: [],
  3786. relatedPeople: '',
  3787. relatedPeopleName: '',
  3788. buNo: '',
  3789. validUntilValue: 0,
  3790. validUntil: '',
  3791. isMeetRohsRequirement: '',
  3792. isAhGrade: 'N',
  3793. hsfSupplierClassification: '',
  3794. materialDesc: '',
  3795. npdRemark: '',
  3796. isSameMaterialDiffSize: '',
  3797. ifsPartNo: '',
  3798. materialList: [],
  3799. stepId: 10,
  3800. rejectFlag: 'N',
  3801. rejectStepId: null,
  3802. createBy2: '',
  3803. isReject: 'Y',
  3804. tpProcessControl: 'N',
  3805. csProcessControl: 'N'
  3806. }
  3807. this.initHsfApproverForNewRecord()
  3808. this.nodeAuthorityLoaded = true
  3809. }
  3810. },
  3811. // 表单提交
  3812. dataFormSubmit () {
  3813. if (!this.canSaveAction()) {
  3814. this.$message.warning('当前状态不允许保存')
  3815. return
  3816. }
  3817. if (!String(this.modalData.process || '').trim()) {
  3818. this.$message.warning('工艺不能为空')
  3819. return
  3820. }
  3821. const isAddMode = this.modalTitle === 'RoHS 新增'
  3822. if (isAddMode && !String(this.modalData.endCustomer || '').trim()) {
  3823. this.$message.warning('最终客户不能为空')
  3824. return
  3825. }
  3826. if (isAddMode && !String(this.modalData.projectId || '').trim()) {
  3827. this.$message.warning('项目编码不能为空')
  3828. return
  3829. }
  3830. this.$set(this.modalData, 'isAhGrade', this.normalizeCheckboxFlag(this.modalData.isAhGrade))
  3831. this.normalizeHsfStandardByCustomer(this.modalData)
  3832. this.syncHsfApproverFields()
  3833. if (!this.validateCommGroupRule()) {
  3834. return
  3835. }
  3836. if (!this.validateValidUntilPair()) {
  3837. return
  3838. }
  3839. this.syncExpiryDateByRule()
  3840. this.modalData.qualificationDocumentsNeeded = this.modalData.qualificationDocumentsNeededList.join(';')
  3841. this.modalData.testReportIncludingItems = this.modalData.testReportIncludingItemsList.join(';')
  3842. this.modalData.materialClassify = this.modalData.materialClassifyList.join(';')
  3843. this.modalData.materialList = (this.modalData.materialList || []).map((item, index) => {
  3844. return {
  3845. ...item,
  3846. lineNo: index + 1,
  3847. projectId: this.modalData.projectId
  3848. }
  3849. })
  3850. const submitMethod = this.modalTitle === 'RoHS 新增' ? api.saveRohs : api.updateRohs
  3851. submitMethod(this.modalData).then(({data}) => {
  3852. if (data && data.code === 0) {
  3853. this.$message.success('操作成功')
  3854. this.modalFlag = false
  3855. this.getDataList()
  3856. } else {
  3857. this.$message.error(data.msg || '操作失败')
  3858. }
  3859. })
  3860. },
  3861. // 同意
  3862. agreeSubmit () {
  3863. if (!this.canAgreeAction()) {
  3864. this.$message.warning('当前状态不允许同意')
  3865. return
  3866. }
  3867. this.$confirm('确认同意该申请单?', '提示', {
  3868. confirmButtonText: '确定',
  3869. cancelButtonText: '取消',
  3870. type: 'warning'
  3871. }).then(() => {
  3872. this.submitRohs('Y')
  3873. })
  3874. },
  3875. openRejectModal () {
  3876. if (!this.canRejectAction()) {
  3877. this.$message.warning('当前状态不允许驳回')
  3878. return
  3879. }
  3880. this.rejectOpinion = ''
  3881. this.submitModalFlag = true
  3882. },
  3883. // 驳回
  3884. rejectSubmit () {
  3885. if (!this.rejectOpinion || !this.rejectOpinion.trim()) {
  3886. this.$message.warning('请填写驳回意见')
  3887. return
  3888. }
  3889. this.submitRohs('N')
  3890. },
  3891. submitRohs (nodeConclusion) {
  3892. if (nodeConclusion === 'Y' && !this.canAgreeAction()) {
  3893. this.$message.warning('当前状态不允许同意')
  3894. return
  3895. }
  3896. if (nodeConclusion === 'N' && !this.canRejectAction()) {
  3897. this.$message.warning('当前状态不允许驳回')
  3898. return
  3899. }
  3900. if (!this.modalData.site || !this.modalData.referenceNo) {
  3901. this.$message.warning('单据主键信息缺失,无法提交审批')
  3902. return
  3903. }
  3904. this.$set(this.modalData, 'isAhGrade', this.normalizeCheckboxFlag(this.modalData.isAhGrade))
  3905. this.normalizeHsfStandardByCustomer(this.modalData)
  3906. this.syncHsfApproverFields()
  3907. if (!this.validateCommGroupRule()) {
  3908. return
  3909. }
  3910. if (!this.validateValidUntilPair()) {
  3911. return
  3912. }
  3913. this.syncExpiryDateByRule()
  3914. if (!this.nodeAuthorityLoaded) {
  3915. this.$message.warning('节点权限加载中,请稍后重试')
  3916. return
  3917. }
  3918. if (nodeConclusion === 'Y' && !this.validateSubmitRequiredFields()) {
  3919. return
  3920. }
  3921. const submitMaterialList = this.normalizeMaterialListForSave(this.modalData.materialList || [])
  3922. this.submitLoading = true
  3923. let params = {
  3924. ...this.modalData,
  3925. site: this.modalData.site,
  3926. referenceNo: this.modalData.referenceNo,
  3927. materialClassify: (this.modalData.materialClassifyList || []).join(';'),
  3928. qualificationDocumentsNeeded: (this.modalData.qualificationDocumentsNeededList || []).join(';'),
  3929. testReportIncludingItems: (this.modalData.testReportIncludingItemsList || []).join(';'),
  3930. materialList: submitMaterialList,
  3931. nodeConclusion: nodeConclusion,
  3932. rejectOpinion: nodeConclusion === 'N' ? this.rejectOpinion : '',
  3933. menuId: this.menuId,
  3934. documentNo: this.modalData.referenceNo
  3935. }
  3936. api.submitRohs(params).then(({data}) => {
  3937. if (data && data.code === 0) {
  3938. this.$message.success(nodeConclusion === 'Y' ? '同意成功' : '驳回成功')
  3939. this.submitModalFlag = false
  3940. this.modalFlag = false
  3941. this.getDataList()
  3942. } else {
  3943. this.$message.error(data.msg || '提交失败')
  3944. }
  3945. this.submitLoading = false
  3946. }).catch(() => {
  3947. this.submitLoading = false
  3948. })
  3949. },
  3950. // 下达
  3951. issueModal (row) {
  3952. if (!this.authIssue) {
  3953. this.$message.warning('没有下达权限')
  3954. return
  3955. }
  3956. this.$confirm('确认下达该申请单?', '提示', {
  3957. confirmButtonText: '确定',
  3958. cancelButtonText: '取消',
  3959. type: 'warning'
  3960. }).then(() => {
  3961. let params = {
  3962. site: row.site,
  3963. referenceNo: row.referenceNo,
  3964. menuId: this.menuId
  3965. }
  3966. api.issueRohs(params).then(({data}) => {
  3967. if (data && data.code === 0) {
  3968. this.$message.success('下达成功')
  3969. if (this.modalFlag && this.modalData.referenceNo === row.referenceNo) {
  3970. this.modalData.status = '审批中'
  3971. }
  3972. this.getDataList()
  3973. } else {
  3974. this.$message.error(data.msg || '下达失败')
  3975. }
  3976. })
  3977. })
  3978. },
  3979. deleteHandle () {
  3980. if (!this.authDelete) {
  3981. this.$message.warning('没有删除权限')
  3982. return
  3983. }
  3984. const selectedRows = (this.dataListSelections || []).filter(item => item && item.site && item.referenceNo)
  3985. if (!selectedRows.length) {
  3986. this.$message.warning('请先勾选要删除的单据')
  3987. return
  3988. }
  3989. const nonDraftRows = selectedRows.filter(item => item.status !== '草稿')
  3990. if (nonDraftRows.length) {
  3991. const previewText = nonDraftRows.slice(0, 3).map(item => item.referenceNo).join('、')
  3992. const suffix = nonDraftRows.length > 3 ? (' 等' + nonDraftRows.length + '条') : ''
  3993. this.$message.warning('仅草稿状态的单据允许删除,当前勾选包含非草稿单据:' + previewText + suffix)
  3994. return
  3995. }
  3996. this.$confirm('确认删除选中的' + selectedRows.length + '条RoHS单据?删除后会同步删除材料和附件数据。', '提示', {
  3997. confirmButtonText: '确定',
  3998. cancelButtonText: '取消',
  3999. type: 'warning'
  4000. }).then(() => {
  4001. const deleteTasks = selectedRows.map(item => {
  4002. return api.deleteRohs({
  4003. site: item.site,
  4004. referenceNo: item.referenceNo
  4005. }).then(({data}) => {
  4006. if (data && data.code === 0) {
  4007. return {
  4008. success: true,
  4009. referenceNo: item.referenceNo
  4010. }
  4011. }
  4012. return {
  4013. success: false,
  4014. referenceNo: item.referenceNo,
  4015. msg: (data && data.msg) || '删除失败'
  4016. }
  4017. }).catch(() => {
  4018. return {
  4019. success: false,
  4020. referenceNo: item.referenceNo,
  4021. msg: '删除失败'
  4022. }
  4023. })
  4024. })
  4025. Promise.all(deleteTasks).then(results => {
  4026. const successRows = results.filter(item => item.success)
  4027. const failRows = results.filter(item => !item.success)
  4028. if (this.modalFlag && successRows.some(item => item.referenceNo === this.modalData.referenceNo)) {
  4029. this.modalFlag = false
  4030. }
  4031. if (!failRows.length) {
  4032. this.$message.success('删除成功,共' + successRows.length + '条')
  4033. } else if (!successRows.length) {
  4034. this.$message.error(failRows[0].msg || '删除失败')
  4035. } else {
  4036. this.$message.warning('已删除' + successRows.length + '条,失败' + failRows.length + '条')
  4037. }
  4038. this.getDataList()
  4039. })
  4040. }).catch(() => {})
  4041. },
  4042. buildRohsCreatePartData () {
  4043. const user = this.$store.state.user || {}
  4044. return {
  4045. site: this.modalData.site || user.site || '',
  4046. partNo: '',
  4047. partDesc: this.modalData.materialDesc || '',
  4048. partType: 'Purchased',
  4049. hazardCode: '',
  4050. hazardDesc: '',
  4051. familyId: '',
  4052. familyName: '',
  4053. groupId: '',
  4054. groupName: '',
  4055. umId: '',
  4056. umName: '',
  4057. weightNet: '',
  4058. uomForWeightNet: 'kg',
  4059. volumeNet: '',
  4060. uomForVolumeNet: 'm3',
  4061. lotTrackingCode: 'Order Based',
  4062. remark: '',
  4063. productGroupId1: this.modalData.commGroup1 || '',
  4064. productGroupName1: this.modalData.commGroup1Desc || '',
  4065. productGroupId2: this.modalData.commGroup2 || '',
  4066. productGroupName2: this.modalData.commGroup2Desc || '',
  4067. productGroupId3: '',
  4068. productGroupName3: '',
  4069. productGroupId4: '*',
  4070. productGroupName4: 'NorthSky Application owner',
  4071. commGroup3: this.modalData.commGroup3 || '',
  4072. commGroup3Desc: this.modalData.commGroup3Desc || '',
  4073. codeNo: '',
  4074. codeDesc: '',
  4075. typeDesignation: '',
  4076. assetClass: 'S',
  4077. assetClassDesc: '标准',
  4078. dimQuality: '',
  4079. abcClass: 'C',
  4080. abcClassDesc: '',
  4081. frequencyClass: 'Very Slow Mover',
  4082. lifecycleStage: 'Development',
  4083. countryOfOrigin: '',
  4084. countryOfOriginDesc: '',
  4085. regionOfOrigin: '',
  4086. regionOfOriginDesc: '',
  4087. manufacturingLeadTime: 0,
  4088. expectedLeadTime: 0,
  4089. durabilityWeek: '',
  4090. durabilityDay: '',
  4091. intrastatConvFactor: undefined,
  4092. customsStatNo: '',
  4093. customsStatDesc: '',
  4094. umDesc: '',
  4095. planningMethod: 'A',
  4096. planningMethodDesc: '',
  4097. partStatus: 'A',
  4098. partStatusDesc: '活动',
  4099. active: 'Y',
  4100. status: 'Y',
  4101. supplyCode: 'Inventory Order',
  4102. configurationId: '*',
  4103. partCostGroupId: '',
  4104. partCostGroupDesc: '',
  4105. inventoryValuationMethod: 'Standard Cost',
  4106. inventoryPartCostLevel: 'Cost Per Part',
  4107. invoiceConsideration: 'Ignore Invoice Price',
  4108. zeroCostFlag: 'Zero Cost Forbidden',
  4109. estimatedMaterialCost: 0,
  4110. safetyStock: 0,
  4111. minOrderQty: 0,
  4112. maxOrderQty: 0,
  4113. mulOrderQty: 0,
  4114. safetyLeadTime: 0,
  4115. shrinkageFac: 0,
  4116. stdOrderQty: 0,
  4117. cumLeadTime: 0,
  4118. byProdAsSupplyInMrpDb: '',
  4119. unprotectedLeadTime: 0,
  4120. backFlushPart: 'All Locations',
  4121. issueType: 'Reserve And Backflush',
  4122. mrpControlFlagDb: 'Y',
  4123. fixedLeadTimeDay: 0,
  4124. overReporting: 'Allowed',
  4125. useTheoreticalDensityDb: '',
  4126. variableLeadTimeDay: 0,
  4127. overReportTolerance: 0,
  4128. fixedLeadTimeHour: 0,
  4129. density: undefined,
  4130. variableLeadTimeHour: 0,
  4131. showInQueryFlag: 'Y',
  4132. temporaryPartFlag: 'N',
  4133. partItemList: [],
  4134. createBy: user.name || '',
  4135. updateBy: user.name || ''
  4136. }
  4137. },
  4138. openCreateIfsPartDialog () {
  4139. if (!this.isEditMode || !this.canEditRohsMaterial()) {
  4140. this.$message.warning('当前状态不允许创建IFS料号')
  4141. return
  4142. }
  4143. this.rohsCreatePartData = this.buildRohsCreatePartData()
  4144. this.rohsCreatePartTab = 'General'
  4145. this.rohsCreatePartTagNo = 0
  4146. this.rohsCharacteristicDialogFlag = false
  4147. this.rohsCharacteristicQueryData = {
  4148. propertiesItemNo: '',
  4149. itemDesc: ''
  4150. }
  4151. this.rohsCharacteristicList = []
  4152. this.rohsCharacteristicSelections = []
  4153. this.rohsPartItemSelections = []
  4154. this.rohsCreatePartDialogFlag = true
  4155. },
  4156. closeRohsCreatePartDialog () {
  4157. this.rohsCreatePartTab = 'General'
  4158. this.rohsCreatePartTagNo = 0
  4159. this.rohsCreatePartLoading = false
  4160. this.rohsCharacteristicDialogFlag = false
  4161. this.rohsCharacteristicQueryData = {
  4162. propertiesItemNo: '',
  4163. itemDesc: ''
  4164. }
  4165. this.rohsCharacteristicList = []
  4166. this.rohsCharacteristicSelections = []
  4167. this.rohsPartItemSelections = []
  4168. this.rohsCreatePartData = this.buildRohsCreatePartData()
  4169. },
  4170. rohsChangeExpectedLeadTime () {
  4171. this.rohsCreatePartData.expectedLeadTime = this.rohsCreatePartData.manufacturingLeadTime
  4172. },
  4173. rohsChangeDurabilityWeek () {
  4174. const day = Number(this.rohsCreatePartData.durabilityDay || 0)
  4175. this.rohsCreatePartData.durabilityWeek = day / 7
  4176. },
  4177. nextRohsCreatePartNo (silent = false) {
  4178. this.rohsCreatePartData.ifsPartNo = this.rohsCreatePartData.partNo
  4179. const params = {
  4180. ...this.rohsCreatePartData,
  4181. ifsPartNo: this.rohsCreatePartData.ifsPartNo,
  4182. site: this.rohsCreatePartData.site || this.$store.state.user.site,
  4183. createBy: this.$store.state.user.name || '',
  4184. updateBy: this.$store.state.user.name || ''
  4185. }
  4186. getPartNextPartNo(params).then(({data}) => {
  4187. if (data && data.code === 0) {
  4188. this.$set(this.rohsCreatePartData, 'partNo', data.rows || '')
  4189. this.$set(this.rohsCreatePartData, 'ifsPartNo', data.rows || '')
  4190. } else if (!silent) {
  4191. this.$message.error((data && data.msg) || '获取料号失败')
  4192. }
  4193. }).catch(() => {
  4194. if (!silent) {
  4195. this.$message.error('获取料号失败')
  4196. }
  4197. })
  4198. },
  4199. openRohsCreatePartBaseList (tagNo) {
  4200. if (!this.rohsCreatePartDialogFlag) {
  4201. return
  4202. }
  4203. this.rohsCreatePartTagNo = tagNo
  4204. this.$nextTick(() => {
  4205. let strVal = ''
  4206. if (tagNo === 1007) {
  4207. strVal = this.rohsCreatePartData.umId
  4208. } else if (tagNo === 108) {
  4209. strVal = this.rohsCreatePartData.familyId
  4210. } else if (tagNo === 109) {
  4211. strVal = this.rohsCreatePartData.groupId
  4212. } else if (tagNo === 110) {
  4213. strVal = this.rohsCreatePartData.productGroupId1
  4214. } else if (tagNo === 111) {
  4215. strVal = this.rohsCreatePartData.productGroupId2
  4216. } else if (tagNo === 112) {
  4217. strVal = this.rohsCreatePartData.productGroupId3
  4218. } else if (tagNo === 113) {
  4219. strVal = this.rohsCreatePartData.productGroupId4
  4220. } else if (tagNo === 123) {
  4221. strVal = this.rohsCreatePartData.hazardCode
  4222. } else if (tagNo === 124) {
  4223. strVal = this.rohsCreatePartData.assetClass
  4224. } else if (tagNo === 125) {
  4225. strVal = this.rohsCreatePartData.partStatus
  4226. } else if (tagNo === 126) {
  4227. strVal = this.rohsCreatePartData.abcClass
  4228. } else if (tagNo === 127) {
  4229. strVal = this.rohsCreatePartData.countryOfOrigin
  4230. } else if (tagNo === 128) {
  4231. strVal = this.rohsCreatePartData.regionOfOrigin
  4232. } else if (tagNo === 129) {
  4233. strVal = this.rohsCreatePartData.customsStatNo
  4234. } else if (tagNo === 130) {
  4235. strVal = this.rohsCreatePartData.commGroup3
  4236. } else if (tagNo === 131) {
  4237. strVal = this.rohsCreatePartData.partCostGroupId
  4238. } else if (tagNo === 20) {
  4239. strVal = this.rohsCreatePartData.codeNo
  4240. } else if (tagNo === 132) {
  4241. strVal = this.rohsCreatePartData.planningMethod
  4242. }
  4243. this.$refs.baseList.init(tagNo, strVal)
  4244. })
  4245. },
  4246. applyRohsCreatePartBaseData (val) {
  4247. if (this.rohsCreatePartTagNo === 1007) {
  4248. this.rohsCreatePartData.umId = val.um_id
  4249. this.rohsCreatePartData.umName = val.um_name
  4250. } else if (this.rohsCreatePartTagNo === 108) {
  4251. this.rohsCreatePartData.familyId = val.family_id
  4252. this.rohsCreatePartData.familyName = val.family_name
  4253. } else if (this.rohsCreatePartTagNo === 109) {
  4254. this.rohsCreatePartData.groupId = val.group_id
  4255. this.rohsCreatePartData.groupName = val.group_name
  4256. } else if (this.rohsCreatePartTagNo === 110) {
  4257. this.rohsCreatePartData.productGroupId1 = val.product_group_id
  4258. this.rohsCreatePartData.productGroupName1 = val.product_group_name
  4259. } else if (this.rohsCreatePartTagNo === 111) {
  4260. this.rohsCreatePartData.productGroupId2 = val.product_group_id
  4261. this.rohsCreatePartData.productGroupName2 = val.product_group_name
  4262. } else if (this.rohsCreatePartTagNo === 112) {
  4263. this.rohsCreatePartData.productGroupId3 = val.product_group_id
  4264. this.rohsCreatePartData.productGroupName3 = val.product_group_name
  4265. } else if (this.rohsCreatePartTagNo === 113) {
  4266. this.rohsCreatePartData.productGroupId4 = val.product_group_id
  4267. this.rohsCreatePartData.productGroupName4 = val.product_group_name
  4268. } else if (this.rohsCreatePartTagNo === 123) {
  4269. this.rohsCreatePartData.hazardCode = val.hazard_code
  4270. this.rohsCreatePartData.hazardDesc = val.hazard_desc
  4271. } else if (this.rohsCreatePartTagNo === 124) {
  4272. this.rohsCreatePartData.assetClass = val.asset_class
  4273. this.rohsCreatePartData.assetClassDesc = val.asset_class_desc
  4274. } else if (this.rohsCreatePartTagNo === 125) {
  4275. this.rohsCreatePartData.partStatus = val.part_status
  4276. this.rohsCreatePartData.partStatusDesc = val.part_status_desc
  4277. } else if (this.rohsCreatePartTagNo === 126) {
  4278. this.rohsCreatePartData.abcClass = val.abc_class
  4279. this.rohsCreatePartData.abcClassDesc = val.abc_class_desc
  4280. } else if (this.rohsCreatePartTagNo === 127) {
  4281. this.rohsCreatePartData.countryOfOrigin = val.country_of_origin
  4282. this.rohsCreatePartData.countryOfOriginDesc = val.country_of_origin_desc
  4283. } else if (this.rohsCreatePartTagNo === 128) {
  4284. this.rohsCreatePartData.regionOfOrigin = val.region_of_origin
  4285. this.rohsCreatePartData.regionOfOriginDesc = val.region_of_origin_desc
  4286. } else if (this.rohsCreatePartTagNo === 129) {
  4287. this.rohsCreatePartData.customsStatNo = val.customs_stat_no
  4288. this.rohsCreatePartData.customsStatDesc = val.customs_stat_desc
  4289. } else if (this.rohsCreatePartTagNo === 130) {
  4290. this.rohsCreatePartData.commGroup3 = val.product_group_id
  4291. this.rohsCreatePartData.commGroup3Desc = val.product_group_name
  4292. } else if (this.rohsCreatePartTagNo === 131) {
  4293. this.rohsCreatePartData.partCostGroupId = val.part_cost_group_id
  4294. this.rohsCreatePartData.partCostGroupDesc = val.part_cost_group_desc
  4295. } else if (this.rohsCreatePartTagNo === 20) {
  4296. this.rohsCreatePartData.codeNo = val.Code_no
  4297. this.rohsCreatePartData.codeDesc = val.Code_desc
  4298. this.loadRohsPartItemListByCodeNo()
  4299. } else if (this.rohsCreatePartTagNo === 132) {
  4300. this.rohsCreatePartData.planningMethod = val.planning_method
  4301. this.rohsCreatePartData.planningMethodDesc = val.planning_method_desc
  4302. }
  4303. this.rohsCreatePartTagNo = 0
  4304. },
  4305. rohsCreateBaseFieldBlur (tagNo, codeKey, descKey, queryField, resultCodeField, resultDescField, withSite = true) {
  4306. this.rohsCreatePartData[codeKey] = (this.rohsCreatePartData[codeKey] || '').replace(/[\s\u00A0\u3000\u200B]/g, '')
  4307. if (!this.rohsCreatePartData[codeKey]) {
  4308. this.rohsCreatePartData[descKey] = ''
  4309. return
  4310. }
  4311. const site = this.rohsCreatePartData.site || this.modalData.site || this.$store.state.user.site
  4312. let conditionSql = " and " + queryField + " = '" + this.rohsCreatePartData[codeKey] + "'"
  4313. if (withSite) {
  4314. conditionSql += " and site = '" + site + "'"
  4315. }
  4316. const tempData = {
  4317. tagno: tagNo,
  4318. conditionSql: conditionSql
  4319. }
  4320. verifyData(tempData).then(({data}) => {
  4321. if (data && data.code === 0 && data.baseListData.length > 0) {
  4322. this.rohsCreatePartData[codeKey] = data.baseListData[0][resultCodeField]
  4323. this.rohsCreatePartData[descKey] = data.baseListData[0][resultDescField]
  4324. } else {
  4325. this.rohsCreatePartData[descKey] = ''
  4326. }
  4327. }).catch(() => {
  4328. this.rohsCreatePartData[descKey] = ''
  4329. })
  4330. },
  4331. rohsCreateHazardCodeBlur (tagNo) {
  4332. this.rohsCreateBaseFieldBlur(tagNo, 'hazardCode', 'hazardDesc', 'hazard_code', 'hazard_code', 'hazard_desc')
  4333. },
  4334. rohsCreateProductGroupId4Blur (tagNo) {
  4335. this.rohsCreateBaseFieldBlur(tagNo, 'productGroupId4', 'productGroupName4', 'product_group_id', 'product_group_id', 'product_group_name')
  4336. },
  4337. rohsCreateProductGroupId1Blur (tagNo) {
  4338. this.rohsCreateBaseFieldBlur(tagNo, 'productGroupId1', 'productGroupName1', 'product_group_id', 'product_group_id', 'product_group_name')
  4339. },
  4340. rohsCreateProductGroupId2Blur (tagNo) {
  4341. this.rohsCreateBaseFieldBlur(tagNo, 'productGroupId2', 'productGroupName2', 'product_group_id', 'product_group_id', 'product_group_name')
  4342. },
  4343. rohsCreateProductGroupId3Blur (tagNo) {
  4344. this.rohsCreateBaseFieldBlur(tagNo, 'productGroupId3', 'productGroupName3', 'product_group_id', 'product_group_id', 'product_group_name')
  4345. },
  4346. rohsCreateCommGroup3Blur (tagNo) {
  4347. this.rohsCreateBaseFieldBlur(tagNo, 'commGroup3', 'commGroup3Desc', 'product_group_id', 'product_group_id', 'product_group_name')
  4348. },
  4349. rohsCreateUmIdBlur (tagNo) {
  4350. this.rohsCreateBaseFieldBlur(tagNo, 'umId', 'umName', 'um_id', 'um_id', 'um_name', false)
  4351. },
  4352. rohsCreateGroupIdBlur (tagNo) {
  4353. this.rohsCreateBaseFieldBlur(tagNo, 'groupId', 'groupName', 'group_id', 'group_id', 'group_name')
  4354. },
  4355. rohsCreateFamilyIdBlur (tagNo) {
  4356. this.rohsCreateBaseFieldBlur(tagNo, 'familyId', 'familyName', 'family_id', 'family_id', 'family_name')
  4357. },
  4358. rohsCreateAssetClassBlur (tagNo) {
  4359. this.rohsCreateBaseFieldBlur(tagNo, 'assetClass', 'assetClassDesc', 'asset_class', 'asset_class', 'asset_class_desc')
  4360. },
  4361. rohsCreatePartStatusBlur (tagNo) {
  4362. this.rohsCreateBaseFieldBlur(tagNo, 'partStatus', 'partStatusDesc', 'part_status', 'part_status', 'part_status_desc')
  4363. },
  4364. rohsCreateAbcClassBlur (tagNo) {
  4365. this.rohsCreateBaseFieldBlur(tagNo, 'abcClass', 'abcClassDesc', 'abc_class', 'abc_class', 'abc_class_desc')
  4366. },
  4367. rohsCreateCountryOfOriginBlur (tagNo) {
  4368. this.rohsCreateBaseFieldBlur(tagNo, 'countryOfOrigin', 'countryOfOriginDesc', 'country_of_origin', 'country_of_origin', 'country_of_origin_desc')
  4369. },
  4370. rohsCreateRegionOfOriginBlur (tagNo) {
  4371. this.rohsCreateBaseFieldBlur(tagNo, 'regionOfOrigin', 'regionOfOriginDesc', 'region_of_origin', 'region_of_origin', 'region_of_origin_desc')
  4372. },
  4373. rohsCreateCustomsStatNoBlur (tagNo) {
  4374. this.rohsCreateBaseFieldBlur(tagNo, 'customsStatNo', 'customsStatDesc', 'customs_stat_no', 'customs_stat_no', 'customs_stat_desc')
  4375. },
  4376. rohsCreatePartCostGroupIdBlur (tagNo) {
  4377. this.rohsCreateBaseFieldBlur(tagNo, 'partCostGroupId', 'partCostGroupDesc', 'part_cost_group_id', 'part_cost_group_id', 'part_cost_group_desc')
  4378. },
  4379. rohsCreatePlanningMethodBlur (tagNo) {
  4380. this.rohsCreateBaseFieldBlur(tagNo, 'planningMethod', 'planningMethodDesc', 'planning_method', 'planning_method', 'planning_method_desc')
  4381. },
  4382. rohsCreateCodeNoBlur (tagNo) {
  4383. this.rohsCreatePartData.codeNo = (this.rohsCreatePartData.codeNo || '').replace(/[\s\u00A0\u3000\u200B]/g, '')
  4384. if (!this.rohsCreatePartData.codeNo) {
  4385. this.rohsCreatePartData.codeDesc = ''
  4386. this.$set(this.rohsCreatePartData, 'partItemList', [])
  4387. this.rohsPartItemSelections = []
  4388. return
  4389. }
  4390. const site = this.rohsCreatePartData.site || this.modalData.site || this.$store.state.user.site
  4391. const tempData = {
  4392. tagno: tagNo,
  4393. conditionSql: " and Code_no = '" + this.rohsCreatePartData.codeNo + "'" + " and site = '" + site + "'"
  4394. }
  4395. verifyData(tempData).then(({data}) => {
  4396. if (data && data.code === 0 && data.baseListData.length > 0) {
  4397. this.rohsCreatePartData.codeNo = data.baseListData[0].Code_no
  4398. this.rohsCreatePartData.codeDesc = data.baseListData[0].Code_desc
  4399. this.loadRohsPartItemListByCodeNo()
  4400. } else {
  4401. this.rohsCreatePartData.codeDesc = ''
  4402. this.$set(this.rohsCreatePartData, 'partItemList', [])
  4403. this.rohsPartItemSelections = []
  4404. }
  4405. }).catch(() => {
  4406. this.rohsCreatePartData.codeDesc = ''
  4407. })
  4408. },
  4409. loadRohsPartItemListByCodeNo () {
  4410. if (!this.rohsCreatePartData.codeNo) {
  4411. this.$set(this.rohsCreatePartData, 'partItemList', [])
  4412. this.rohsPartItemSelections = []
  4413. return
  4414. }
  4415. const params = {
  4416. site: this.rohsCreatePartData.site || this.modalData.site || this.$store.state.user.site,
  4417. codeNo: this.rohsCreatePartData.codeNo,
  4418. recordType: 'IP'
  4419. }
  4420. getPartItemListByCodeNo(params).then(({data}) => {
  4421. if (data && data.code === 0) {
  4422. this.$set(this.rohsCreatePartData, 'partItemList', (data.rows || []).map(item => ({
  4423. ...item,
  4424. numValue: item.numValue === null ? undefined : item.numValue
  4425. })))
  4426. } else {
  4427. this.$set(this.rohsCreatePartData, 'partItemList', [])
  4428. }
  4429. this.rohsPartItemSelections = []
  4430. }).catch(() => {
  4431. this.$set(this.rohsCreatePartData, 'partItemList', [])
  4432. this.rohsPartItemSelections = []
  4433. })
  4434. },
  4435. rohsPartItemSelectionChange (selection) {
  4436. this.rohsPartItemSelections = selection || []
  4437. },
  4438. openRohsCharacteristicDialog () {
  4439. this.rohsCharacteristicSelections = []
  4440. this.rohsCharacteristicQueryData = {
  4441. propertiesItemNo: '',
  4442. itemDesc: ''
  4443. }
  4444. this.queryRohsCharacteristicOptions()
  4445. this.rohsCharacteristicDialogFlag = true
  4446. },
  4447. removeRohsPartItemRows () {
  4448. if (!this.rohsPartItemSelections || this.rohsPartItemSelections.length === 0) {
  4449. this.$message.warning('请选择要删除的属性!')
  4450. return
  4451. }
  4452. this.$confirm('请是否确认删除该属性记录?', '提示', {
  4453. confirmButtonText: '确定',
  4454. cancelButtonText: '取消',
  4455. type: 'warning'
  4456. }).then(() => {
  4457. const removeSet = new Set(this.rohsPartItemSelections.map(item => item.propertiesItemNo))
  4458. this.$set(this.rohsCreatePartData, 'partItemList', (this.rohsCreatePartData.partItemList || []).filter(item => !removeSet.has(item.propertiesItemNo)))
  4459. this.rohsPartItemSelections = []
  4460. }).catch(() => {})
  4461. },
  4462. queryRohsCharacteristicOptions () {
  4463. const itemNos = (this.rohsCreatePartData.partItemList || []).map(item => item.propertiesItemNo).filter(item => item).join(',')
  4464. const params = {
  4465. site: this.rohsCreatePartData.site || this.modalData.site || this.$store.state.user.site,
  4466. recordType: 'IP',
  4467. propertiesItemNo: this.rohsCharacteristicQueryData.propertiesItemNo,
  4468. itemDesc: this.rohsCharacteristicQueryData.itemDesc,
  4469. itemNos: itemNos
  4470. }
  4471. getPartItemExclusionAlreadyExists(params).then(({data}) => {
  4472. if (data && data.code === 0) {
  4473. this.rohsCharacteristicList = data.rows || []
  4474. } else {
  4475. this.rohsCharacteristicList = []
  4476. }
  4477. }).catch(() => {
  4478. this.rohsCharacteristicList = []
  4479. })
  4480. },
  4481. rohsCharacteristicRowClick (row) {
  4482. if (this.$refs.rohsCharacteristicTable) {
  4483. this.$refs.rohsCharacteristicTable.toggleRowSelection(row)
  4484. }
  4485. },
  4486. rohsCharacteristicSelectionChange (selection) {
  4487. this.rohsCharacteristicSelections = selection || []
  4488. },
  4489. saveRohsCharacteristics () {
  4490. if (!this.rohsCharacteristicSelections || this.rohsCharacteristicSelections.length === 0) {
  4491. this.$message.warning('请选择属性!')
  4492. return
  4493. }
  4494. const currentList = Array.isArray(this.rohsCreatePartData.partItemList) ? this.rohsCreatePartData.partItemList : []
  4495. const existSet = new Set(currentList.map(item => item.propertiesItemNo))
  4496. const appendList = this.rohsCharacteristicSelections.filter(item => item && item.propertiesItemNo && !existSet.has(item.propertiesItemNo)).map(item => ({
  4497. ...item,
  4498. numValue: item.numValue === null ? undefined : item.numValue
  4499. }))
  4500. if (appendList.length === 0) {
  4501. this.$message.warning('所选属性已存在')
  4502. return
  4503. }
  4504. this.$set(this.rohsCreatePartData, 'partItemList', [...currentList, ...appendList])
  4505. this.rohsCharacteristicDialogFlag = false
  4506. this.rohsCharacteristicSelections = []
  4507. },
  4508. validateRohsCreatePart () {
  4509. this.rohsCreatePartData.partNo = (this.rohsCreatePartData.partNo || '').replace(/[\s\u00A0\u3000\u200B]/g, '')
  4510. if (!this.rohsCreatePartData.partNo) {
  4511. this.$message.warning('请填写物料编码')
  4512. return false
  4513. }
  4514. if (!/^[A-Za-z0-9._-]+$/.test(this.rohsCreatePartData.partNo)) {
  4515. this.$message.warning('物料编码只能包含字母、数字、-、_、.')
  4516. return false
  4517. }
  4518. if (!this.rohsCreatePartData.partDesc || !String(this.rohsCreatePartData.partDesc).trim()) {
  4519. this.$message.warning('请填写物料名称')
  4520. return false
  4521. }
  4522. if (!this.rohsCreatePartData.partType) {
  4523. this.$message.warning('请选择零件类型')
  4524. return false
  4525. }
  4526. if (!this.rohsCreatePartData.umId) {
  4527. this.$message.warning('请选择计量单位')
  4528. return false
  4529. }
  4530. if (!this.rohsCreatePartData.productGroupId1 || !this.rohsCreatePartData.productGroupId2) {
  4531. this.$message.warning('请选择商品组1/2')
  4532. return false
  4533. }
  4534. if (!this.rohsCreatePartData.productGroupId3) {
  4535. this.$message.warning('请选择会计组')
  4536. return false
  4537. }
  4538. if (!this.rohsCreatePartData.productGroupId4) {
  4539. this.$message.warning('请选择计划人')
  4540. return false
  4541. }
  4542. return true
  4543. },
  4544. appendCreatedPartToRohsMaterial (createdPart) {
  4545. const appendResult = this.appendMaterialRows([{
  4546. site: this.modalData.site,
  4547. referenceNo: this.modalData.referenceNo,
  4548. projectId: this.modalData.projectId,
  4549. testPartNo: createdPart.partNo,
  4550. finalPartNo: createdPart.partNo,
  4551. partDesc: createdPart.partDesc,
  4552. partStatus: createdPart.partStatus || 'A'
  4553. }])
  4554. if (!appendResult.appendedCount) {
  4555. this.$message.warning('IFS料号创建成功,但该料号已存在于材料列表')
  4556. return Promise.resolve()
  4557. }
  4558. if (!this.shouldPersistMaterialsImmediately()) {
  4559. this.$set(this.modalData, 'materialList', appendResult.materialList)
  4560. this.$message.success('IFS料号创建成功,已加入材料列表')
  4561. return Promise.resolve()
  4562. }
  4563. return this.persistMaterialList(appendResult.materialList, 'IFS料号创建成功并已关联到RoHS材料')
  4564. },
  4565. saveRohsCreatePart () {
  4566. if (!this.validateRohsCreatePart()) {
  4567. return
  4568. }
  4569. const payload = {
  4570. ...this.rohsCreatePartData,
  4571. site: this.modalData.site || this.$store.state.user.site,
  4572. buNo: this.modalData.process || '',
  4573. createBy: this.$store.state.user.name || '',
  4574. updateBy: this.$store.state.user.name || '',
  4575. partDesc: (this.rohsCreatePartData.partDesc || '').trim(),
  4576. productGroupId1: this.rohsCreatePartData.productGroupId1,
  4577. productGroupName1: this.rohsCreatePartData.productGroupName1,
  4578. productGroupId2: this.rohsCreatePartData.productGroupId2,
  4579. productGroupName2: this.rohsCreatePartData.productGroupName2,
  4580. productGroupId3: this.rohsCreatePartData.productGroupId3,
  4581. productGroupName3: this.rohsCreatePartData.productGroupName3,
  4582. commGroup3: this.rohsCreatePartData.commGroup3,
  4583. commGroup3Desc: this.rohsCreatePartData.commGroup3Desc,
  4584. status: 'Y',
  4585. showInQueryFlag: 'Y',
  4586. temporaryPartFlag: 'N',
  4587. ifsPartNo: this.rohsCreatePartData.partNo,
  4588. plmPartNo: this.rohsCreatePartData.partNo,
  4589. partItemList: Array.isArray(this.rohsCreatePartData.partItemList) ? this.rohsCreatePartData.partItemList : []
  4590. }
  4591. this.rohsCreatePartLoading = true
  4592. createOfficialPartForRohs(payload).then(({data}) => {
  4593. if (data && data.code === 0) {
  4594. this.appendCreatedPartToRohsMaterial(payload).then(() => {
  4595. this.rohsCreatePartDialogFlag = false
  4596. })
  4597. } else {
  4598. this.$message.error((data && data.msg) || '创建IFS料号失败')
  4599. }
  4600. }).catch(() => {
  4601. this.$message.error('创建IFS料号失败')
  4602. }).finally(() => {
  4603. this.rohsCreatePartLoading = false
  4604. })
  4605. },
  4606. openProjectMaterialDialog () {
  4607. if (!this.canEditRohsMaterial()) {
  4608. this.$message.warning('当前状态不允许编辑材料')
  4609. return
  4610. }
  4611. this.projectMaterialDialogFlag = true
  4612. this.projectMaterialPageIndex = 1
  4613. this.searchProjectMaterialList()
  4614. },
  4615. searchProjectMaterialList () {
  4616. this.projectMaterialLoading = true
  4617. const params = {
  4618. page: this.projectMaterialPageIndex,
  4619. limit: this.projectMaterialPageSize,
  4620. site: this.$store.state.user.site,
  4621. partDesc: this.projectMaterialSearchData.partDesc,
  4622. finalPartNo: this.projectMaterialSearchData.finalPartNo,
  4623. partStatus: this.projectMaterialSearchData.partStatus
  4624. }
  4625. api.getRohsProjectMaterialList(params).then(({data}) => {
  4626. if (data && data.code === 0 && data.page) {
  4627. this.projectMaterialList = data.page.list || []
  4628. this.projectMaterialTotal = data.page.totalCount || 0
  4629. this.$nextTick(() => {
  4630. if (this.$refs.projectMaterialTable) {
  4631. this.$refs.projectMaterialTable.clearSelection()
  4632. }
  4633. })
  4634. } else {
  4635. this.projectMaterialList = []
  4636. this.projectMaterialTotal = 0
  4637. this.$message.error(data.msg || '物料查询失败')
  4638. }
  4639. this.projectMaterialLoading = false
  4640. }).catch(() => {
  4641. this.projectMaterialList = []
  4642. this.projectMaterialTotal = 0
  4643. this.projectMaterialLoading = false
  4644. })
  4645. },
  4646. projectMaterialSelectionChange (rows) {
  4647. this.projectMaterialSelections = rows || []
  4648. },
  4649. projectMaterialSizeChangeHandle (val) {
  4650. this.projectMaterialPageSize = val
  4651. this.projectMaterialPageIndex = 1
  4652. this.searchProjectMaterialList()
  4653. },
  4654. projectMaterialCurrentChangeHandle (val) {
  4655. this.projectMaterialPageIndex = val
  4656. this.searchProjectMaterialList()
  4657. },
  4658. confirmProjectMaterialSelection () {
  4659. if (!this.canEditRohsMaterial()) {
  4660. this.$message.warning('当前状态不允许编辑材料')
  4661. return
  4662. }
  4663. if (!this.projectMaterialSelections || this.projectMaterialSelections.length === 0) {
  4664. this.$message.warning('请至少选择一条物料')
  4665. return
  4666. }
  4667. const appendResult = this.appendMaterialRows(this.projectMaterialSelections)
  4668. if (!appendResult.appendedCount) {
  4669. this.$message.warning('所选物料已存在,未新增数据')
  4670. return
  4671. }
  4672. if (!this.shouldPersistMaterialsImmediately()) {
  4673. this.$set(this.modalData, 'materialList', appendResult.materialList)
  4674. this.projectMaterialDialogFlag = false
  4675. this.$message.success('已加入材料列表,保存单据后写入数据库')
  4676. return
  4677. }
  4678. this.$confirm('确认新增选中材料?', '提示', {
  4679. confirmButtonText: '确定',
  4680. cancelButtonText: '取消',
  4681. type: 'warning'
  4682. }).then(() => {
  4683. this.persistMaterialList(appendResult.materialList, '新增材料成功', () => {
  4684. this.projectMaterialDialogFlag = false
  4685. this.projectMaterialSelections = []
  4686. if (this.$refs.projectMaterialTable) {
  4687. this.$refs.projectMaterialTable.clearSelection()
  4688. }
  4689. })
  4690. }).catch(() => {})
  4691. },
  4692. appendMaterialRows (rows) {
  4693. const materialList = Array.isArray(this.modalData.materialList) ? [...this.modalData.materialList] : []
  4694. const exists = new Set(materialList.map(item => item.testPartNo))
  4695. let appendedCount = 0
  4696. rows.forEach(row => {
  4697. const testPartNo = row.testPartNo || row.test_part_no
  4698. if (!testPartNo || exists.has(testPartNo)) {
  4699. return
  4700. }
  4701. exists.add(testPartNo)
  4702. appendedCount++
  4703. materialList.push({
  4704. site: this.modalData.site,
  4705. referenceNo: this.modalData.referenceNo,
  4706. projectId: this.modalData.projectId,
  4707. testPartNo: testPartNo,
  4708. finalPartNo: row.finalPartNo || row.final_part_no || '',
  4709. partDesc: row.partDesc || row.part_desc || '',
  4710. partStatus: row.partStatus || row.part_status || ''
  4711. })
  4712. })
  4713. return {
  4714. materialList,
  4715. appendedCount
  4716. }
  4717. },
  4718. materialSelectionChange (rows) {
  4719. this.materialSelections = rows || []
  4720. },
  4721. shouldPersistMaterialsImmediately () {
  4722. return this.modalTitle === 'RoHS 编辑' && this.modalData && this.modalData.referenceNo && !String(this.modalData.referenceNo).startsWith('TEMP-')
  4723. },
  4724. normalizeMaterialListForSave (materialList) {
  4725. return (materialList || []).map((item, index) => {
  4726. return {
  4727. site: item.site || this.modalData.site || '',
  4728. referenceNo: item.referenceNo || this.modalData.referenceNo || '',
  4729. projectId: item.projectId || this.modalData.projectId || '',
  4730. testPartNo: item.testPartNo || item.test_part_no || '',
  4731. finalPartNo: item.finalPartNo || item.final_part_no || '',
  4732. partDesc: item.partDesc || item.part_desc || '',
  4733. partStatus: item.partStatus || item.part_status || '',
  4734. lineNo: index + 1
  4735. }
  4736. }).filter(item => item.testPartNo)
  4737. },
  4738. persistMaterialList (materialList, successMsg, successCallback) {
  4739. const normalizedList = this.normalizeMaterialListForSave(materialList)
  4740. const payload = {
  4741. site: this.modalData.site,
  4742. referenceNo: this.modalData.referenceNo,
  4743. projectId: this.modalData.projectId,
  4744. materialList: normalizedList
  4745. }
  4746. return api.updateRohsMaterials(payload).then(({data}) => {
  4747. if (data && data.code === 0) {
  4748. this.$set(this.modalData, 'materialList', normalizedList)
  4749. this.materialSelections = []
  4750. if (this.currentRow && this.currentRow.referenceNo === this.modalData.referenceNo) {
  4751. this.$set(this.currentRow, 'materialList', normalizedList)
  4752. }
  4753. this.$message.success(successMsg || '保存成功')
  4754. if (typeof successCallback === 'function') {
  4755. successCallback()
  4756. }
  4757. } else {
  4758. this.$message.error((data && data.msg) || '保存失败')
  4759. }
  4760. }).catch(() => {
  4761. this.$message.error('保存失败')
  4762. })
  4763. },
  4764. removeSelectedMaterialRows () {
  4765. if (!this.canEditRohsMaterial()) {
  4766. this.$message.warning('当前状态不允许编辑材料')
  4767. return
  4768. }
  4769. if (!this.materialSelections || this.materialSelections.length === 0) {
  4770. this.$message.warning('请先选择要删除的材料')
  4771. return
  4772. }
  4773. const removeSet = new Set(this.materialSelections.map(item => item.testPartNo))
  4774. const materialList = (this.modalData.materialList || []).filter(item => !removeSet.has(item.testPartNo))
  4775. if (!this.shouldPersistMaterialsImmediately()) {
  4776. this.$set(this.modalData, 'materialList', materialList)
  4777. this.materialSelections = []
  4778. this.$message.success('已删除材料,保存单据后写入数据库')
  4779. return
  4780. }
  4781. this.$confirm('确认删除选中材料?', '提示', {
  4782. confirmButtonText: '确定',
  4783. cancelButtonText: '取消',
  4784. type: 'warning'
  4785. }).then(() => {
  4786. this.persistMaterialList(materialList, '删除材料成功')
  4787. }).catch(() => {})
  4788. },
  4789. // ======== chooseList相关方法 ========
  4790. applyCommGroup3RuleByCommGroup1 (needValidate = false) {
  4791. const commGroup1 = String(this.modalData.commGroup1 || '').trim()
  4792. if (commGroup1 !== '00100') {
  4793. this.modalData.commGroup3 = ''
  4794. this.modalData.commGroup3Desc = ''
  4795. return true
  4796. }
  4797. if (needValidate && !String(this.modalData.commGroup3 || '').trim()) {
  4798. this.$message.warning('商品组1为"00100"时,商品组3必填!')
  4799. return false
  4800. }
  4801. return true
  4802. },
  4803. validateCommGroupRule () {
  4804. return this.applyCommGroup3RuleByCommGroup1(true)
  4805. },
  4806. // 获取基础数据列表
  4807. getBaseList (val, type) {
  4808. if (val === 130 && this.modalData.commGroup1 !== '00100') {
  4809. return
  4810. }
  4811. this.tagNo = val
  4812. this.tagNo1 = type
  4813. this.$nextTick(() => {
  4814. let strVal = ''
  4815. let conSql = ''
  4816. if (val === 102) {
  4817. if (type === 1) {
  4818. strVal = this.modalData.endCustomer
  4819. conSql = " order by Customer_no "
  4820. }
  4821. }
  4822. if (val === 103 || val === 2001 || val === 2054) {
  4823. if (type === 1) {
  4824. strVal = this.modalData.applicant
  4825. } else if (type === 3) {
  4826. strVal = this.modalData.npdEngineer
  4827. } else if (type === 4) {
  4828. strVal = this.modalData.technicalPlan
  4829. } else if (type === 5) {
  4830. strVal = this.modalData.pm
  4831. }
  4832. conSql = " and b.site = '" + this.$store.state.user.site + "'"
  4833. }
  4834. if (val === 2000) {
  4835. strVal = this.modalData.buyer
  4836. conSql = " and b.site = '" + this.$store.state.user.site + "'"
  4837. }
  4838. if (val === 110) {
  4839. strVal = this.modalData.commGroup1
  4840. }
  4841. if (val === 111) {
  4842. strVal = this.modalData.commGroup2
  4843. }
  4844. if (val === 130) {
  4845. strVal = this.modalData.commGroup3
  4846. }
  4847. this.$refs.baseList.init(val, strVal, conSql)
  4848. })
  4849. },
  4850. // 列表方法的回调
  4851. getBaseData (val) {
  4852. if (this.rohsCreatePartDialogFlag && this.rohsCreatePartTagNo) {
  4853. this.applyRohsCreatePartBaseData(val)
  4854. return
  4855. }
  4856. if (this.tagNo === 102) {
  4857. if (this.tagNo1 === 1) {
  4858. if (val.Customer_no === this.modalData.endCustomer) {
  4859. return
  4860. }
  4861. if (this.modalData.projectIdFlag) {
  4862. this.modalData.projectIdFlag = false
  4863. }
  4864. this.modalData.endCustomer = val.Customer_no
  4865. this.modalData.endCustomerName = val.Customer_desc
  4866. this.modalData.projectId = ''
  4867. this.modalData.projectName = ''
  4868. this.$set(this.modalData, 'materialList', [])
  4869. }
  4870. }
  4871. if (this.tagNo === 103 || this.tagNo === 2001 || this.tagNo === 2054) {
  4872. if (this.tagNo1 === 1) {
  4873. this.modalData.applicant = val.username
  4874. this.modalData.applicantName = val.user_display
  4875. } else if (this.tagNo1 === 3) {
  4876. this.modalData.npdEngineer = val.username
  4877. this.modalData.npdEngineerName = val.user_display
  4878. } else if (this.tagNo1 === 4) {
  4879. this.modalData.technicalPlan = val.username
  4880. this.modalData.technicalPlanName = val.user_display
  4881. } else if (this.tagNo1 === 5) {
  4882. this.modalData.pm = val.username
  4883. this.modalData.pmName = val.user_display
  4884. }
  4885. }
  4886. if (this.tagNo === 110) {
  4887. this.modalData.commGroup1 = val.product_group_id
  4888. this.modalData.commGroup1Desc = val.product_group_name
  4889. this.applyCommGroup3RuleByCommGroup1(false)
  4890. }
  4891. if (this.tagNo === 111) {
  4892. this.modalData.commGroup2 = val.product_group_id
  4893. this.modalData.commGroup2Desc = val.product_group_name
  4894. }
  4895. if (this.tagNo === 130) {
  4896. this.modalData.commGroup3 = val.product_group_id
  4897. this.modalData.commGroup3Desc = val.product_group_name
  4898. }
  4899. if (this.tagNo === 2000) {
  4900. this.modalData.buyer = val.username
  4901. this.modalData.buyerName = val.user_display
  4902. }
  4903. },
  4904. handleQueryCustomer() {
  4905. if (!this.modalData.endCustomer) {
  4906. this.modalData.endCustomerName = ''
  4907. this.modalData.projectId = ''
  4908. this.modalData.projectName = ''
  4909. this.modalData.projectIdFlag = true
  4910. this.$set(this.modalData, 'materialList', [])
  4911. return
  4912. }
  4913. let params = {
  4914. site: this.$store.state.user.site,
  4915. customerNo: this.modalData.endCustomer
  4916. }
  4917. queryCustomer(params).then(({data}) => {
  4918. if (data && data.code === 0) {
  4919. if (data.rows && data.rows.length === 1) {
  4920. const customer = data.rows[0]
  4921. this.modalData.endCustomerName = customer.customerDesc || customer.Customer_desc || customer.customerName || ''
  4922. this.modalData.projectIdFlag = !!this.modalData.endCustomerFlag
  4923. } else {
  4924. this.modalData.endCustomerName = ''
  4925. this.modalData.projectId = ''
  4926. this.modalData.projectName = ''
  4927. this.modalData.projectIdFlag = true
  4928. this.$set(this.modalData, 'materialList', [])
  4929. }
  4930. } else {
  4931. this.modalData.endCustomerName = ''
  4932. this.modalData.projectId = ''
  4933. this.modalData.projectName = ''
  4934. this.modalData.projectIdFlag = true
  4935. this.$set(this.modalData, 'materialList', [])
  4936. }
  4937. }).catch((error) => {
  4938. this.modalData.endCustomerName = ''
  4939. this.modalData.projectId = ''
  4940. this.modalData.projectName = ''
  4941. this.modalData.projectIdFlag = true
  4942. this.$set(this.modalData, 'materialList', [])
  4943. })
  4944. },
  4945. handleQueryProjectByCustomer() {
  4946. if (!this.modalData.projectId) {
  4947. this.modalData.projectName = ''
  4948. return
  4949. }
  4950. let params = {
  4951. site: this.$store.state.user.site,
  4952. projectId: this.modalData.projectId
  4953. }
  4954. if (this.modalData.endCustomer) {
  4955. params.customerId = this.modalData.endCustomer
  4956. }
  4957. queryProjectByCustomer(params).then(({data}) => {
  4958. if (data && data.code === 0) {
  4959. if (data.rows && data.rows.length === 1) {
  4960. const project = data.rows[0]
  4961. this.modalData.projectName = project.projectName || project.Project_name || ''
  4962. } else {
  4963. this.modalData.projectName = ''
  4964. }
  4965. } else {
  4966. this.modalData.projectName = ''
  4967. }
  4968. }).catch((error) => {
  4969. this.modalData.projectName = ''
  4970. })
  4971. },
  4972. projectClickRow(row) {
  4973. const oldProjectId = this.modalData.projectId
  4974. this.modalData.projectId = row.projectId
  4975. this.modalData.projectName = row.projectName
  4976. if (this.modalData.endCustomer && this.modalData.endCustomer !== '') {
  4977. // do nothing
  4978. } else {
  4979. this.modalData.endCustomer = row.customerId
  4980. this.modalData.endCustomerName = row.customerName
  4981. }
  4982. if (oldProjectId && oldProjectId !== row.projectId) {
  4983. this.$set(this.modalData, 'materialList', [])
  4984. }
  4985. this.chooseProjectListFlag = false
  4986. },
  4987. searchProjectInfoList() {
  4988. this.projectList = [];
  4989. if (this.modalData.endCustomer && this.modalData.endCustomer !== '') {
  4990. this.searchProjectData.customerId = this.modalData.endCustomer
  4991. } else {
  4992. this.searchProjectData.customerId = undefined
  4993. }
  4994. this.searchProjectData.site = this.$store.state.user.site
  4995. searchProjectInfoList(this.searchProjectData).then(({data}) => {
  4996. if (data && data.code === 0) {
  4997. const rows = data.rows || []
  4998. this.projectList = rows
  4999. if ((!this.modalData.endCustomer || this.modalData.endCustomer === '') && rows.length > 0) {
  5000. this.modalData.projectId = rows[0].projectId
  5001. this.modalData.projectName = rows[0].projectName
  5002. this.modalData.endCustomer = rows[0].customerId
  5003. this.modalData.endCustomerName = rows[0].customerName
  5004. }
  5005. } else {
  5006. this.projectList = []
  5007. }
  5008. }).catch((error) => {
  5009. this.$message.error('查询项目信息失败')
  5010. })
  5011. },
  5012. closeProjectInfoDialog() {
  5013. if(this.$refs.closeProjectInfoForm) {
  5014. this.$refs.closeProjectInfoForm.resetFields();
  5015. }
  5016. this.searchProjectData = {
  5017. site: this.$store.state.user.site,
  5018. projectId: undefined,
  5019. projectName: undefined,
  5020. customerId: undefined,
  5021. }
  5022. },
  5023. // 申请人输入校验
  5024. applicantBlur (tagNo) {
  5025. if (this.modalData.applicant != null && this.modalData.applicant !== '') {
  5026. let tempData = {
  5027. tagno: tagNo,
  5028. conditionSql: " and a.username = '" + this.modalData.applicant + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  5029. }
  5030. verifyData(tempData).then(({data}) => {
  5031. if (data && data.code === 0) {
  5032. if (data.baseListData.length > 0) {
  5033. this.modalData.applicant = data.baseListData[0].username
  5034. this.modalData.applicantName = data.baseListData[0].user_display
  5035. return
  5036. }
  5037. }
  5038. this.modalData.applicantName = ''
  5039. })
  5040. } else {
  5041. this.modalData.applicantName = ''
  5042. }
  5043. },
  5044. // PM输入校验
  5045. pmBlur (tagNo) {
  5046. if (this.modalData.pm != null && this.modalData.pm !== '') {
  5047. let tempData = {
  5048. tagno: tagNo,
  5049. conditionSql: " and a.username = '" + this.modalData.pm + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  5050. }
  5051. verifyData(tempData).then(({data}) => {
  5052. if (data && data.code === 0) {
  5053. if (data.baseListData.length > 0) {
  5054. this.modalData.pm = data.baseListData[0].username
  5055. this.modalData.pmName = data.baseListData[0].user_display
  5056. return
  5057. }
  5058. }
  5059. this.modalData.pmName = ''
  5060. })
  5061. } else {
  5062. this.modalData.pmName = ''
  5063. }
  5064. },
  5065. // NPD工程师输入校验
  5066. npdEngineerBlur (tagNo) {
  5067. if (this.modalData.npdEngineer != null && this.modalData.npdEngineer !== '') {
  5068. let tempData = {
  5069. tagno: tagNo,
  5070. conditionSql: " and a.username = '" + this.modalData.npdEngineer + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  5071. }
  5072. verifyData(tempData).then(({data}) => {
  5073. if (data && data.code === 0) {
  5074. if (data.baseListData.length > 0) {
  5075. this.modalData.npdEngineer = data.baseListData[0].username
  5076. this.modalData.npdEngineerName = data.baseListData[0].user_display
  5077. return
  5078. }
  5079. }
  5080. this.modalData.npdEngineerName = ''
  5081. })
  5082. } else {
  5083. this.modalData.npdEngineerName = ''
  5084. }
  5085. },
  5086. // 技术计划输入校验
  5087. technicalPlanBlur (tagNo) {
  5088. if (this.modalData.technicalPlan != null && this.modalData.technicalPlan !== '') {
  5089. let tempData = {
  5090. tagno: tagNo,
  5091. conditionSql: " and a.username = '" + this.modalData.technicalPlan + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  5092. }
  5093. verifyData(tempData).then(({data}) => {
  5094. if (data && data.code === 0) {
  5095. if (data.baseListData.length > 0) {
  5096. this.modalData.technicalPlan = data.baseListData[0].username
  5097. this.modalData.technicalPlanName = data.baseListData[0].user_display
  5098. return
  5099. }
  5100. }
  5101. this.modalData.technicalPlanName = ''
  5102. })
  5103. } else {
  5104. this.modalData.technicalPlanName = ''
  5105. }
  5106. },
  5107. // 采购输入校验
  5108. buyerBlur (tagNo) {
  5109. if (this.modalData.buyer != null && this.modalData.buyer !== '') {
  5110. let tempData = {
  5111. tagno: tagNo,
  5112. conditionSql: " and a.username = '" + this.modalData.buyer + "'" + " and b.site = '" + this.$store.state.user.site + "'"
  5113. }
  5114. verifyData(tempData).then(({data}) => {
  5115. if (data && data.code === 0) {
  5116. if (data.baseListData.length > 0) {
  5117. this.modalData.buyer = data.baseListData[0].username
  5118. this.modalData.buyerName = data.baseListData[0].user_display
  5119. return
  5120. }
  5121. }
  5122. this.modalData.buyerName = ''
  5123. })
  5124. } else {
  5125. this.modalData.buyerName = ''
  5126. }
  5127. },
  5128. // 商品组1输入校验
  5129. commGroup1Blur (tagNo) {
  5130. this.applyCommGroup3RuleByCommGroup1(false)
  5131. if (this.modalData.commGroup1 != null && this.modalData.commGroup1 !== '') {
  5132. let tempData = {
  5133. tagno: tagNo,
  5134. conditionSql: " and product_group_id = '" + this.modalData.commGroup1 + "'" + " and site = '" + this.$store.state.user.site + "'"
  5135. }
  5136. verifyData(tempData).then(({data}) => {
  5137. if (data && data.code === 0 && data.baseListData.length > 0) {
  5138. this.modalData.commGroup1 = data.baseListData[0].product_group_id
  5139. this.modalData.commGroup1Desc = data.baseListData[0].product_group_name
  5140. this.applyCommGroup3RuleByCommGroup1(false)
  5141. } else {
  5142. this.modalData.commGroup1Desc = ''
  5143. }
  5144. })
  5145. } else {
  5146. this.modalData.commGroup1Desc = ''
  5147. }
  5148. },
  5149. // 商品组2输入校验
  5150. commGroup2Blur (tagNo) {
  5151. if (this.modalData.commGroup2 != null && this.modalData.commGroup2 !== '') {
  5152. let tempData = {
  5153. tagno: tagNo,
  5154. conditionSql: " and product_group_id = '" + this.modalData.commGroup2 + "'" + " and site = '" + this.$store.state.user.site + "'"
  5155. }
  5156. verifyData(tempData).then(({data}) => {
  5157. if (data && data.code === 0 && data.baseListData.length > 0) {
  5158. this.modalData.commGroup2 = data.baseListData[0].product_group_id
  5159. this.modalData.commGroup2Desc = data.baseListData[0].product_group_name
  5160. } else {
  5161. this.modalData.commGroup2Desc = ''
  5162. }
  5163. })
  5164. } else {
  5165. this.modalData.commGroup2Desc = ''
  5166. }
  5167. },
  5168. // 商品组3输入校验
  5169. commGroup3Blur (tagNo) {
  5170. if (this.modalData.commGroup1 !== '00100') {
  5171. this.applyCommGroup3RuleByCommGroup1(false)
  5172. return
  5173. }
  5174. if (this.modalData.commGroup3 != null && this.modalData.commGroup3 !== '') {
  5175. let tempData = {
  5176. tagno: tagNo,
  5177. conditionSql: " and product_group_id = '" + this.modalData.commGroup3 + "'" + " and site = '" + this.$store.state.user.site + "'"
  5178. }
  5179. verifyData(tempData).then(({data}) => {
  5180. if (data && data.code === 0 && data.baseListData.length > 0) {
  5181. this.modalData.commGroup3 = data.baseListData[0].product_group_id
  5182. this.modalData.commGroup3Desc = data.baseListData[0].product_group_name
  5183. } else {
  5184. this.modalData.commGroup3Desc = ''
  5185. }
  5186. })
  5187. } else {
  5188. this.modalData.commGroup3Desc = ''
  5189. }
  5190. }
  5191. }
  5192. }
  5193. </script>
  5194. <style scoped lang="scss">
  5195. /deep/ .customer-tab .el-tabs__content {
  5196. padding: 0 !important;
  5197. }
  5198. /deep/ .rohs-material-table .el-table__header-wrapper th > .cell {
  5199. white-space: nowrap;
  5200. word-break: keep-all;
  5201. }
  5202. /deep/ .rohs-multiple-two-rows.el-select .el-input__inner,
  5203. /deep/ .rohs-multiple-two-rows .el-select .el-input__inner {
  5204. min-height: 62px !important;
  5205. height: auto !important;
  5206. padding-top: 6px !important;
  5207. padding-bottom: 6px !important;
  5208. }
  5209. /deep/ .rohs-multiple-two-rows.el-select .el-select__tags,
  5210. /deep/ .rohs-multiple-two-rows .el-select .el-select__tags {
  5211. max-width: calc(100% - 34px) !important;
  5212. max-height: 50px;
  5213. overflow-y: auto;
  5214. overflow-x: hidden;
  5215. white-space: normal;
  5216. }
  5217. /deep/ .rohs-multiple-two-rows.el-select .el-select__tags > span,
  5218. /deep/ .rohs-multiple-two-rows .el-select .el-select__tags > span {
  5219. display: inline;
  5220. max-width: 100%;
  5221. white-space: normal;
  5222. }
  5223. /deep/ .rohs-multiple-two-rows.el-select .el-select__tags .el-tag,
  5224. /deep/ .rohs-multiple-two-rows .el-select .el-select__tags .el-tag {
  5225. display: inline-flex;
  5226. max-width: 100%;
  5227. height: auto;
  5228. line-height: 16px;
  5229. padding-top: 2px;
  5230. padding-bottom: 2px;
  5231. margin-right: 4px;
  5232. white-space: normal;
  5233. vertical-align: middle;
  5234. }
  5235. /deep/ .rohs-multiple-two-rows.el-select .el-select__tags .el-tag .el-select__tags-text,
  5236. /deep/ .rohs-multiple-two-rows .el-select .el-select__tags .el-tag .el-select__tags-text {
  5237. white-space: normal;
  5238. word-break: break-all;
  5239. }
  5240. </style>