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.

2972 lines
98 KiB

  1. <template>
  2. <div>
  3. <!-- 物料新增/编辑模态框 -->
  4. <el-dialog :title="modalData.title" top="10vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="1000px">
  5. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
  6. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules">
  7. <el-form-item label="物料编码" prop="partNo">
  8. <el-input v-model="modalData.partNo" disabled style="width: 128px"></el-input>
  9. </el-form-item>
  10. <el-form-item label="物料描述" prop="partDesc" style="margin-left: -10px">
  11. <el-input v-model="modalData.partDesc" clearable style="width: 346px"></el-input>
  12. </el-form-item>
  13. <el-form-item label="物料描述(英文)">
  14. <el-input v-model="modalData.partDesceEn" style="width: 477px"></el-input>
  15. </el-form-item>
  16. </el-form>
  17. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
  18. <el-form-item prop="spec" label="规格">
  19. <el-input v-model="modalData.spec" style="width: 477px"></el-input>
  20. </el-form-item>
  21. <el-form-item label="BU" prop="bu">
  22. <el-select v-model="modalData.bu" placeholder="请选择" @change="getPreviousPartNo" :disabled="modalDisableFlag" style="width: 90px">
  23. <el-option
  24. v-for = "i in userBuList"
  25. :key = "i.buNo"
  26. :label = "i.buDesc"
  27. :value = "i.buNo">
  28. </el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item prop="active" label="是否在用">
  32. <el-select v-model="modalData.active" style="width: 80px">
  33. <el-option label="是" value="Y"></el-option>
  34. <el-option label="否" value="N"></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item prop="partType2" label="零件类型">
  38. <el-select v-model="modalData.partType2" style="width: 120px">
  39. <el-option label="成品" value="Manufactured"></el-option>
  40. <el-option label="半成品" value="Manufactured Recipe"></el-option>
  41. <el-option label="原材料" value="Purchased (raw)"></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item v-if="modalData.flag === '1'" style="margin-top: 23px">
  45. <el-checkbox v-model="modalData.tblBaseFlag" true-label="Y">复制属性({{previousPartNo}})</el-checkbox>
  46. </el-form-item>
  47. </el-form>
  48. <el-tabs v-model="inventoryPartTable" style="width: 100%;height: 305px;" @tab-click="tabClick" type="border-card">
  49. <!-- 主信息页签 -->
  50. <el-tab-pane label="General" name="General">
  51. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
  52. <el-form-item prop="umId2">
  53. <span style="cursor: pointer" slot="label" @click="getBaseList(510)"><a herf="#">计量单位</a></span>
  54. <el-input v-model="modalData.umId2" @blur="umIdBlur(510)" style="width: 128px"></el-input>
  55. <el-input v-model="modalData.umName" disabled style="width: 330px"></el-input>
  56. </el-form-item>
  57. <el-form-item>
  58. <span style="cursor: pointer" slot="label" @click="getBaseList(214)"><a herf="#">物料分类</a></span>
  59. <el-input v-model="modalData.familyID" @blur="partFamilyBlur(214)" style="width: 128px"></el-input>
  60. <el-input v-model="modalData.familyName" disabled style="width: 330px"></el-input>
  61. </el-form-item>
  62. </el-form>
  63. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
  64. </el-form>
  65. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
  66. <el-form-item>
  67. <span style="cursor: pointer" slot="label" @click="getBaseList(211)"><a herf="#">商品组1</a></span>
  68. <el-input v-model="modalData.productGroupId1" @blur="productGroupId1Blur(211)" style="width: 128px"></el-input>
  69. <el-input v-model="modalData.productGroupName1" disabled style="width: 330px"></el-input>
  70. </el-form-item>
  71. <el-form-item>
  72. <span style="cursor: pointer" slot="label" @click="getBaseList(212)"><a herf="#">商品组2</a></span>
  73. <el-input v-model="modalData.productGroupId2" @blur="productGroupId2Blur(212)" style="width: 128px"></el-input>
  74. <el-input v-model="modalData.productGroupName2" disabled style="width: 330px"></el-input>
  75. </el-form-item>
  76. </el-form>
  77. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
  78. <el-form-item>
  79. <span style="cursor: pointer" slot="label" @click="getBaseList(213)"><a herf="#">商品组3</a></span>
  80. <el-input v-model="modalData.productGroupId3" @blur="productGroupId3Blur(213)" style="width: 128px"></el-input>
  81. <el-input v-model="modalData.productGroupName3" disabled style="width: 330px"></el-input>
  82. </el-form-item>
  83. <el-form-item>
  84. <span style="cursor: pointer" v-if="!modalDisableFlag" slot="label" @click="getBaseList(219)"><a herf="#">属性模板</a></span>
  85. <span v-else="modalDisableFlag" slot="label">属性模板</span>
  86. <el-input v-model="modalData.codeNo" :disabled="modalDisableFlag" @blur="modelBlur(219)" style="width: 128px"></el-input>
  87. <el-input v-model="modalData.codeDesc" disabled style="width: 330px"></el-input>
  88. </el-form-item>
  89. </el-form>
  90. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
  91. <el-form-item label="备注" style="height: 135px">
  92. <el-input type="textarea" v-model="modalData.remark" :rows="5" resize='none' show-word-limit style="width: 939px"></el-input>
  93. </el-form-item>
  94. </el-form>
  95. </el-tab-pane>
  96. <!-- 物料属性页签 -->
  97. <el-tab-pane v-if="modalDisableFlag" label="物料属性" style="margin-top: -10px" name="part_item">
  98. <el-form label-position="top" style="margin-left: 2px;">
  99. <el-button type="primary" @click="addOrDelItem">新增</el-button>
  100. <el-button type="primary" :loading="loading" @click="clickSave">{{ attributeDialog?'编辑':'保存' }}</el-button>
  101. </el-form>
  102. <div class="rq " v-if="attributeDialog">
  103. <el-table
  104. :data="partItemList"
  105. height="233px"
  106. border
  107. style="width: 100%;">
  108. <el-table-column
  109. v-for="(item,index) in columnItemList" :key="index"
  110. :sortable="item.columnSortable"
  111. :prop="item.columnProp"
  112. :header-align="item.headerAlign"
  113. :show-overflow-tooltip="item.showOverflowTooltip"
  114. :align="item.align"
  115. :fixed="item.fixed==''?false:item.fixed"
  116. :min-width="item.columnWidth"
  117. :label="item.columnLabel">
  118. <template slot-scope="scope">
  119. <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
  120. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  121. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  122. </div>
  123. <div v-else>
  124. <template v-if="item.columnProp==='textValue' && scope.row.valueTypeDb==='T'">
  125. {{ scope.row['textValue'] }}
  126. </template>
  127. <template v-else-if="item.columnProp==='textValue' && scope.row.valueTypeDb==='N'">
  128. {{ scope.row['numValue'] }}
  129. </template>
  130. </div>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. </div>
  135. <div class="rq " v-else>
  136. <el-table
  137. :data="copyAttributeList"
  138. height="233px"
  139. border
  140. style="width: 100%">
  141. <el-table-column
  142. v-for="(item,index) in columnItemList" :key="index"
  143. :sortable="item.columnSortable"
  144. :prop="item.columnProp"
  145. :header-align="item.headerAlign"
  146. :show-overflow-tooltip="item.showOverflowTooltip"
  147. :align="item.align"
  148. :fixed="item.fixed===''?false:item.fixed"
  149. :min-width="item.columnWidth"
  150. :label="item.columnLabel">
  151. <template slot-scope="scope">
  152. <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
  153. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  154. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  155. </div>
  156. <div v-else>
  157. <div v-if="scope.row.valueChooseFlag !== 'Y'">
  158. <el-input-number v-model="scope.row.numValue" style="padding: 0;width: 100%" v-if="scope.row.valueTypeDb === 'N'" :controls="false"></el-input-number>
  159. <el-input v-model="scope.row.textValue" v-else></el-input>
  160. </div>
  161. <div v-else>
  162. <el-select style="width: 100%;" v-if="scope.row.valueTypeDb === 'T'" v-model="scope.row.textValue">
  163. <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableValueList" :key="key"></el-option>
  164. </el-select>
  165. <el-select style="width: 100%;" v-else v-model="scope.row.numValue">
  166. <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableValueList" :key="key"></el-option>
  167. </el-select>
  168. </div>
  169. </div>
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. </div>
  174. </el-tab-pane>
  175. <!-- 代理商页签 -->
  176. <el-tab-pane v-if="modalDisableFlag" label="代理商" style="margin-top: -10px" name="part_agent">
  177. <el-form label-position="top" style="margin-left: 2px;">
  178. <el-button type="primary" @click="savePartAgent">新增</el-button>
  179. </el-form>
  180. <el-table
  181. :data="partAgentList"
  182. height="233px"
  183. border
  184. style="width: 100%;">
  185. <el-table-column
  186. v-for="(item,index) in columnAgentList" :key="index"
  187. :sortable="item.columnSortable"
  188. :prop="item.columnProp"
  189. :header-align="item.headerAlign"
  190. :show-overflow-tooltip="item.showOverflowTooltip"
  191. :align="item.align"
  192. :fixed="item.fixed==''?false:item.fixed"
  193. :min-width="item.columnWidth"
  194. :label="item.columnLabel">
  195. <template slot-scope="scope">
  196. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  197. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  198. </template>
  199. </el-table-column>
  200. <el-table-column
  201. header-align="center"
  202. align="center"
  203. width="100"
  204. fixed="right"
  205. label="操作">
  206. <template slot-scope="scope">
  207. <el-link style="cursor: pointer" @click="deleteAgent2(scope.row)">删除</el-link>
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. </el-tab-pane>
  212. <!-- 制造商页签 -->
  213. <el-tab-pane v-if="modalDisableFlag" label="制造商" style="margin-top: -10px" name="part_manufacturer">
  214. <el-form label-position="top" style="margin-left: 2px;">
  215. <el-button type="primary" @click="savePartManufacturer">新增</el-button>
  216. </el-form>
  217. <el-table
  218. :data="partManufacturerList"
  219. height="233px"
  220. border
  221. style="width: 100%;">
  222. <el-table-column
  223. v-for="(item,index) in columnManufacturerList" :key="index"
  224. :sortable="item.columnSortable"
  225. :prop="item.columnProp"
  226. :header-align="item.headerAlign"
  227. :show-overflow-tooltip="item.showOverflowTooltip"
  228. :align="item.align"
  229. :fixed="item.fixed==''?false:item.fixed"
  230. :min-width="item.columnWidth"
  231. :label="item.columnLabel">
  232. <template slot-scope="scope">
  233. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  234. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  235. </template>
  236. </el-table-column>
  237. <el-table-column
  238. header-align="center"
  239. align="center"
  240. width="100"
  241. fixed="right"
  242. label="操作">
  243. <template slot-scope="scope">
  244. <el-link style="cursor: pointer" @click="deleteManufacturer2(scope.row)">删除</el-link>
  245. </template>
  246. </el-table-column>
  247. </el-table>
  248. </el-tab-pane>
  249. <!-- 默认库位页签 -->
  250. <el-tab-pane v-if="modalDisableFlag" label="默认库位" style="margin-top: -10px" name="default_locations">
  251. <el-form label-position="top" style="margin-left: 2px;">
  252. <el-button type="primary" @click="saveDefaultLocation()">新增</el-button>
  253. </el-form>
  254. <el-table
  255. :data="defaultLocationList"
  256. height="233px"
  257. border
  258. style="width: 100%;">
  259. <el-table-column
  260. v-for="(item,index) in columnLocationList" :key="index"
  261. :sortable="item.columnSortable"
  262. :prop="item.columnProp"
  263. :header-align="item.headerAlign"
  264. :show-overflow-tooltip="item.showOverflowTooltip"
  265. :align="item.align"
  266. :fixed="item.fixed==''?false:item.fixed"
  267. :min-width="item.columnWidth"
  268. :label="item.columnLabel">
  269. <template slot-scope="scope">
  270. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  271. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  272. </template>
  273. </el-table-column>
  274. <el-table-column
  275. header-align="center"
  276. align="center"
  277. width="100"
  278. fixed="right"
  279. label="操作">
  280. <template slot-scope="scope">
  281. <el-link style="cursor: pointer" @click="deleteLocation2(scope.row)">删除</el-link>
  282. </template>
  283. </el-table-column>
  284. </el-table>
  285. </el-tab-pane>
  286. <!-- 文档页签 -->
  287. <el-tab-pane v-if="modalDisableFlag" label="文档" style="margin-top: -10px" name="part_file">
  288. <el-form label-position="top" style="margin-left: 2px;">
  289. <el-button type="primary" @click="uploadFile">上传文件</el-button>
  290. </el-form>
  291. <el-table
  292. :data="fileContentList"
  293. height="233px"
  294. border
  295. style="width: 100%; ">
  296. <el-table-column
  297. v-for="(item,index) in columnFileList" :key="index"
  298. :sortable="item.columnSortable"
  299. :prop="item.columnProp"
  300. :header-align="item.headerAlign"
  301. :show-overflow-tooltip="item.showOverflowTooltip"
  302. :align="item.align"
  303. :fixed="item.fixed==''?false:item.fixed"
  304. :min-width="item.columnWidth"
  305. :label="item.columnLabel">
  306. <template slot-scope="scope">
  307. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  308. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  309. </template>
  310. </el-table-column>
  311. <el-table-column
  312. fixed="right"
  313. header-align="center"
  314. align="center"
  315. width="130"
  316. label="操作">
  317. <template slot-scope="scope">
  318. <el-link style="cursor: pointer" @click="previewFile(scope.row)">预览</el-link>
  319. <el-link style="cursor: pointer" @click="downloadFile(scope.row)">下载</el-link>
  320. <el-link style="cursor: pointer" @click="deleteFile(scope.row)">删除</el-link>
  321. </template>
  322. </el-table-column>
  323. </el-table>
  324. </el-tab-pane>
  325. </el-tabs>
  326. </el-form>
  327. <el-footer style="height:35px;margin-top: 20px;text-align:center">
  328. <el-button type="primary" :loading="saveLoading" @click="saveData(false)">应用</el-button>
  329. <el-button type="primary" :loading="saveLoading" @click="saveData(true)">保存</el-button>
  330. </el-footer>
  331. </el-dialog>
  332. <!-- 物料属性-> 快速新增 -->
  333. <el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="fastAddFlag" width="1000px">
  334. <div style="font-size: 12px">
  335. <el-form :inline="true" label-position="top" :model="itemData">
  336. <el-form-item :label="'属性编码'">
  337. <el-input v-model="itemData.propertiesItemNo" clearable style="width: 120px"></el-input>
  338. </el-form-item>
  339. <el-form-item :label="'属性名称'">
  340. <el-input v-model="itemData.itemDesc" clearable style="width: 150px"></el-input>
  341. </el-form-item>
  342. <el-form-item :label="' '">
  343. <el-button type="primary" @click="queryPartItem()">查询</el-button>
  344. </el-form-item>
  345. </el-form>
  346. </div>
  347. <el-container style="margin-top: 0px;">
  348. <el-main style="width: 350px;padding: 1px">
  349. <span style="font-size: 12px" >可选属性</span>
  350. <el-table
  351. height="400px"
  352. :data="itemList1"
  353. border
  354. ref="itemTable1"
  355. @row-click="itemClickRow1"
  356. @selection-change="selectionItem1"
  357. highlight-current-row
  358. style="width: 100%">
  359. <el-table-column
  360. type="selection"
  361. header-align="center"
  362. align="center"
  363. width="50">
  364. </el-table-column>
  365. <el-table-column
  366. prop="itNo"
  367. header-align="center"
  368. align="center"
  369. min-width="80"
  370. label="属性编码">
  371. </el-table-column>
  372. <el-table-column
  373. prop="itemDesc"
  374. header-align="center"
  375. align="center"
  376. min-width="200"
  377. label="属性名称">
  378. </el-table-column>
  379. </el-table>
  380. </el-main>
  381. <el-main style="width: 10px;padding: 1px">
  382. <div style="margin-top: 200px;margin-left: 18px">
  383. <el-button type="primary" @click="addItem()">添加>></el-button>
  384. </div>
  385. <div style="margin-top: 15px;margin-left: 18px">
  386. <el-button type="primary" @click="deleteItem()">删除<<</el-button>
  387. </div>
  388. </el-main>
  389. <el-main style="width: 350px;padding: 1px">
  390. <span style="font-size: 12px" >已有属性</span>
  391. <el-table
  392. height="400px"
  393. :data="itemList2"
  394. border
  395. ref="itemTable2"
  396. @row-click="itemClickRow2"
  397. @selection-change="selectionItem2"
  398. highlight-current-row
  399. style="width: 100%">
  400. <el-table-column
  401. type="selection"
  402. header-align="center"
  403. align="center"
  404. width="50">
  405. </el-table-column>
  406. <el-table-column
  407. prop="itNo"
  408. header-align="center"
  409. align="center"
  410. min-width="80"
  411. label="属性编码">
  412. </el-table-column>
  413. <el-table-column
  414. prop="itemDesc"
  415. header-align="center"
  416. align="center"
  417. min-width="200"
  418. label="属性名称">
  419. </el-table-column>
  420. </el-table>
  421. </el-main>
  422. </el-container>
  423. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  424. <el-button type="primary" @click="fastAddFlag = false">关闭</el-button>
  425. </el-footer>
  426. </el-dialog>
  427. <!-- 代理商-> 快速新增 -->
  428. <el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="agentModelFlag" width="900px">
  429. <div style="font-size: 12px">
  430. <el-form :inline="true" label-position="top" :model="agentData">
  431. <el-form-item :label="'代理商编码'">
  432. <el-input v-model="agentData.agentId" clearable style="width: 120px"></el-input>
  433. </el-form-item>
  434. <el-form-item :label="'代理商名称'">
  435. <el-input v-model="agentData.agentName" clearable style="width: 120px"></el-input>
  436. </el-form-item>
  437. <el-form-item :label="' '">
  438. <el-button type="primary" @click="getAgentList">查询</el-button>
  439. </el-form-item>
  440. </el-form>
  441. </div>
  442. <el-container style="margin-top: 0px;">
  443. <el-main style="width: 350px; padding: 1px">
  444. <span style="font-size: 12px" >可选代理商</span>
  445. <el-table
  446. height="400px"
  447. :data="agentList1"
  448. border
  449. ref="agentTable1"
  450. @row-click="agentClickRow1"
  451. @selection-change="selectionAgent1"
  452. highlight-current-row
  453. style="width: 100%">
  454. <el-table-column
  455. type="selection"
  456. header-align="center"
  457. align="center"
  458. width="50">
  459. </el-table-column>
  460. <el-table-column
  461. prop="agentId"
  462. header-align="center"
  463. align="center"
  464. min-width="80"
  465. label="代理商编码">
  466. </el-table-column>
  467. <el-table-column
  468. prop="agentName"
  469. header-align="center"
  470. align="center"
  471. min-width="120"
  472. label="代理商名称">
  473. </el-table-column>
  474. </el-table>
  475. </el-main>
  476. <el-main style="width: 111px;padding: -1px">
  477. <div style="margin-top: 182px;margin-left: 18px">
  478. <el-button type="primary" @click="addAgent">添加>></el-button>
  479. </div>
  480. <div style="margin-top: 15px;margin-left: 18px">
  481. <el-button type="primary" @click="deleteAgent">删除<<</el-button>
  482. </div>
  483. </el-main>
  484. <el-main style="width: 350px;padding: 1px">
  485. <span style="font-size: 12px" >已有代理商</span>
  486. <el-table
  487. height="400px"
  488. :data="agentList2"
  489. border
  490. ref="agentTable2"
  491. @row-click="agentClickRow2"
  492. @selection-change="selectionAgent2"
  493. highlight-current-row
  494. style="width: 100%">
  495. <el-table-column
  496. type="selection"
  497. header-align="center"
  498. align="center"
  499. width="50">
  500. </el-table-column>
  501. <el-table-column
  502. prop="agentId"
  503. header-align="center"
  504. align="center"
  505. min-width="80"
  506. label="代理商编码">
  507. </el-table-column>
  508. <el-table-column
  509. prop="agentName"
  510. header-align="center"
  511. align="center"
  512. min-width="120"
  513. label="代理商名称">
  514. </el-table-column>
  515. </el-table>
  516. </el-main>
  517. </el-container>
  518. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  519. <el-button type="primary" @click="agentModelFlag = false">关闭</el-button>
  520. </el-footer>
  521. </el-dialog>
  522. <!-- 制造商-> 快速新增 -->
  523. <el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="manufacturerModelFlag" width="900px">
  524. <div style="font-size: 12px">
  525. <el-form :inline="true" label-position="top" :model="manufacturerData">
  526. <el-form-item :label="'制造商编码'">
  527. <el-input v-model="manufacturerData.manufacturerId" clearable style="width: 120px"></el-input>
  528. </el-form-item>
  529. <el-form-item :label="'制造商名称'">
  530. <el-input v-model="manufacturerData.manufacturerName" clearable style="width: 120px"></el-input>
  531. </el-form-item>
  532. <el-form-item :label="' '">
  533. <el-button type="primary" @click="getManufacturerList()">查询</el-button>
  534. </el-form-item>
  535. </el-form>
  536. </div>
  537. <el-container style="margin-top: 0px;">
  538. <el-main style="width: 350px; padding: 1px">
  539. <span style="font-size: 12px" >可选制造商</span>
  540. <el-table
  541. height="400px"
  542. :data="manufacturerList1"
  543. border
  544. ref="manufacturerTable1"
  545. @row-click="manufacturerClickRow1"
  546. @selection-change="selectionManufacturer1"
  547. highlight-current-row
  548. style="width: 100%">
  549. <el-table-column
  550. type="selection"
  551. header-align="center"
  552. align="center"
  553. width="50">
  554. </el-table-column>
  555. <el-table-column
  556. prop="manufacturerId"
  557. header-align="center"
  558. align="center"
  559. min-width="80"
  560. label="制造商编码">
  561. </el-table-column>
  562. <el-table-column
  563. prop="manufacturerName"
  564. header-align="center"
  565. align="center"
  566. min-width="120"
  567. label="制造商名称">
  568. </el-table-column>
  569. </el-table>
  570. </el-main>
  571. <el-main style="width: 111px;padding: -1px">
  572. <div style="margin-top: 182px;margin-left: 18px">
  573. <el-button type="primary" @click="addManufacturer()">添加>></el-button>
  574. </div>
  575. <div style="margin-top: 15px;margin-left: 18px">
  576. <el-button type="primary" @click="deleteManufacturer()">删除<<</el-button>
  577. </div>
  578. </el-main>
  579. <el-main style="width: 350px;padding: 1px">
  580. <span style="font-size: 12px" >已有制造商</span>
  581. <el-table
  582. height="400px"
  583. :data="manufacturerList2"
  584. border
  585. ref="manufacturerTable2"
  586. @row-click="manufacturerClickRow2"
  587. @selection-change="selectionManufacturer2"
  588. highlight-current-row
  589. style="width: 100%">
  590. <el-table-column
  591. type="selection"
  592. header-align="center"
  593. align="center"
  594. width="50">
  595. </el-table-column>
  596. <el-table-column
  597. prop="manufacturerId"
  598. header-align="center"
  599. align="center"
  600. min-width="80"
  601. label="制造商编码">
  602. </el-table-column>
  603. <el-table-column
  604. prop="manufacturerName"
  605. header-align="center"
  606. align="center"
  607. min-width="120"
  608. label="制造商名称">
  609. </el-table-column>
  610. </el-table>
  611. </el-main>
  612. </el-container>
  613. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  614. <el-button type="primary" @click="manufacturerModelFlag = false">关闭</el-button>
  615. </el-footer>
  616. </el-dialog>
  617. <!-- 默认库位-> 快速新增 -->
  618. <el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="locationModelFlag" width="900px">
  619. <div style="font-size: 12px">
  620. <el-form :inline="true" label-position="top" :model="locationData">
  621. <el-form-item :label="'库位编码'">
  622. <el-input v-model="locationData.locationId" clearable style="width: 120px"></el-input>
  623. </el-form-item>
  624. <el-form-item :label="'库位名称'">
  625. <el-input v-model="locationData.locationName" clearable style="width: 120px"></el-input>
  626. </el-form-item>
  627. <el-form-item :label="' '">
  628. <el-button type="primary" @click="getLocationList()">查询</el-button>
  629. </el-form-item>
  630. </el-form>
  631. </div>
  632. <el-container style="margin-top: 0px;">
  633. <el-main style="width: 350px; padding: 1px">
  634. <span style="font-size: 12px" >可选库位</span>
  635. <el-table
  636. height="400px"
  637. :data="locationList1"
  638. border
  639. ref="locationTable1"
  640. @row-click="locationClickRow1"
  641. @selection-change="selectionLocation1"
  642. highlight-current-row
  643. style="width: 100%">
  644. <el-table-column
  645. type="selection"
  646. header-align="center"
  647. align="center"
  648. width="50">
  649. </el-table-column>
  650. <el-table-column
  651. prop="locationId"
  652. header-align="center"
  653. align="center"
  654. min-width="80"
  655. label="库位编码">
  656. </el-table-column>
  657. <el-table-column
  658. prop="locationName"
  659. header-align="center"
  660. align="center"
  661. min-width="120"
  662. label="库位名称">
  663. </el-table-column>
  664. </el-table>
  665. </el-main>
  666. <el-main style="width: 111px;padding: -1px">
  667. <div style="margin-top: 182px;margin-left: 18px">
  668. <el-button type="primary" @click="addLocation()">添加>></el-button>
  669. </div>
  670. <div style="margin-top: 15px;margin-left: 18px">
  671. <el-button type="primary" @click="deleteLocation()">删除<<</el-button>
  672. </div>
  673. </el-main>
  674. <el-main style="width: 350px;padding: 1px">
  675. <span style="font-size: 12px" >已有库位</span>
  676. <el-table
  677. height="400px"
  678. :data="locationList2"
  679. border
  680. ref="locationTable2"
  681. @row-click="locationClickRow2"
  682. @selection-change="selectionLocation2"
  683. highlight-current-row
  684. style="width: 100%">
  685. <el-table-column
  686. type="selection"
  687. header-align="center"
  688. align="center"
  689. width="50">
  690. </el-table-column>
  691. <el-table-column
  692. prop="locationId"
  693. header-align="center"
  694. align="center"
  695. min-width="80"
  696. label="库位编码">
  697. </el-table-column>
  698. <el-table-column
  699. prop="locationName"
  700. header-align="center"
  701. align="center"
  702. min-width="120"
  703. label="库位名称">
  704. </el-table-column>
  705. </el-table>
  706. </el-main>
  707. </el-container>
  708. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  709. <el-button type="primary" @click="locationModelFlag = false">关闭</el-button>
  710. </el-footer>
  711. </el-dialog>
  712. <!-- chooseList模态框 -->
  713. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  714. <!-- 上传文件的modal -->
  715. <partUploadFile ref="partUploadFile" @refreshPageTables="getFileContentData" v-drag></partUploadFile>
  716. </div>
  717. </template>
  718. <script>
  719. import {
  720. partInformationSearch, // 物料信息列表查询
  721. partInformationSave, // 物料信息新增
  722. partInformationEdit, // 物料信息编辑
  723. partInformationDelete, // 物料信息删除
  724. getPartItem, // 查询物料属性
  725. getAgentList, // 获取代理商列表
  726. getPartAgent, // 获取物料代理商
  727. getAgentListBy, // 根据条件查询可选代理商
  728. addPartAgent, // 新增物料代理商
  729. deletePartAgent, // 删除物料代理商
  730. deleteAgent, // 删除物料代理商(单删)
  731. getManufacturerList, // 获取制造商列表
  732. getPartManufacturer, // 获取物料制造商
  733. getManufacturerListBy, // 根据条件查询可选制造商
  734. addPartManufacturer, // 新增物料制造商
  735. deletePartManufacturer, // 删除物料制造商
  736. deleteManufacturer, // 删除物料制造商(单删)
  737. getLocationList, // 获取库位列表
  738. getDefaultLocation, // 获取物料库位
  739. getLocationListBy, // 根据条件查询可选库位
  740. addDefaultLocation, // 新增物料库位
  741. deleteDefaultLocation, // 删除物料库位
  742. deleteLocation, // 删除物料库位(单删)
  743. commitItemValue, // 修改物料属性值
  744. getItemLists, // 获取模板属性
  745. addPartItem, // 新增物料属性
  746. deletePartItem, // 删除物料属性
  747. queryPartItem,
  748. copyPart, // 复制物料
  749. getProjectPartNo, // 获取物料编码
  750. verifyData, // 校验参数
  751. getPreviousPartNo, // 获取上一个物料编码
  752. } from '@/api/part/partInformation.js'
  753. import {
  754. savePartInfo
  755. } from "@/api/part/quicklyCreateBom.js"
  756. import {getFileContentList, downLoadObjectFile} from '@/api/eam/eam_object_list.js'
  757. import {getSiteAndBuByUserName} from "@/api/qc/qc.js"
  758. import {deleteObjectFile} from '@/api/eam/eam.js'
  759. import Chooselist from '@/views/modules/common/Chooselist_eam'
  760. import partUploadFile from "./part_upload_file"
  761. export default {
  762. name: 'partCreate',
  763. components: {
  764. Chooselist,
  765. partUploadFile
  766. },
  767. watch: {
  768. modalData: {
  769. deep: true,
  770. handler: function (newV, oldV) {
  771. this.modalData.partNo = this.modalData.partNo.toUpperCase()
  772. }
  773. },
  774. },
  775. data() {
  776. return {
  777. userBuList: [],
  778. // ======== 分页 ========
  779. pageIndex: 1,
  780. pageSize: 20,
  781. totalPage: 0,
  782. selectedDataNum: 0,
  783. tempCodeNo: '',
  784. // 条件查询
  785. searchData: {
  786. site: '',
  787. userName: this.$store.state.user.name,
  788. buNo: '',
  789. partNo: '',
  790. startDate: '',
  791. endDate: '',
  792. partDesc: '',
  793. page: 1,
  794. limit: 10
  795. },
  796. // 其它
  797. loading: false,
  798. // 初始页签
  799. activeTable: 'part_item',
  800. inventoryPartTable: 'General',
  801. // ======== 数据对象 ========
  802. modalData: {
  803. flag: '',
  804. title: '',
  805. site: '',
  806. buNo: '',
  807. bu: '',
  808. partNo: '',
  809. partDesc: '',
  810. umId2: '',
  811. umName: '',
  812. spec: '',
  813. active: '',
  814. partType2: '',
  815. standardBoxQty: '',
  816. productGroupId1: '',
  817. productGroupName1: '',
  818. productGroupId2: '',
  819. productGroupName2: '',
  820. productGroupId3: '',
  821. productGroupName3: '',
  822. familyID: '',
  823. familyName: '',
  824. partDesceEn: '',
  825. remark: '',
  826. codeNo: '',
  827. codeDesc: '',
  828. tblBaseFlag: ''
  829. },
  830. itemData: {
  831. site: this.$store.state.user.site,
  832. partNo: '',
  833. propertiesItemNo: '',
  834. codeNo: '',
  835. itemDesc: '',
  836. textValue: '',
  837. numValue: '',
  838. recordType: ''
  839. },
  840. agentData: {
  841. site: '',
  842. buNo: '',
  843. agentId: '',
  844. agentName: '',
  845. },
  846. manufacturerData: {
  847. site: '',
  848. buNo: '',
  849. manufacturerId: '',
  850. manufacturerName: '',
  851. },
  852. locationData: {
  853. site: '',
  854. buNo: '',
  855. locationId: '',
  856. locationName: '',
  857. },
  858. copyPartData: {
  859. site: '',
  860. partNo: '',
  861. partDesc: '',
  862. copyGeneral: 'Y',
  863. copyCosts: '',
  864. copyPlanningData: '',
  865. copyManufacturing: '',
  866. copyDefaultLocation: '',
  867. copyRevision: '',
  868. previousVersion: {},
  869. createBy: ''
  870. },
  871. // ======== 数据列表 ========
  872. dataList: [],
  873. partItemList: [],
  874. updatePartItemList: [],
  875. partAgentList: [],
  876. partManufacturerList: [],
  877. defaultLocationList: [],
  878. fileContentList: [],
  879. availableValueList:[],
  880. agentList: [],
  881. agentSelections: [],
  882. agentSelections1: [],
  883. agentSelections2: [],
  884. agentList1: [],
  885. agentList2: [],
  886. manufacturerList: [],
  887. manufacturerSelections: [],
  888. manufacturerSelections1: [],
  889. manufacturerSelections2: [],
  890. manufacturerList1: [],
  891. manufacturerList2: [],
  892. locationList: [],
  893. locationSelections: [],
  894. locationSelections1: [],
  895. locationSelections2: [],
  896. locationList1: [],
  897. locationList2: [],
  898. itemSelections1: [],
  899. itemSelections2: [],
  900. itemList1:[],
  901. itemList2:[],
  902. revisionList: [],
  903. bomAlternativeList: [],
  904. routingAlternativeList: [],
  905. copyAttributeList: [],
  906. fileList: [],
  907. // ======== 列表表头 ========
  908. columnList: [
  909. {
  910. userId: this.$store.state.user.name,
  911. functionId: 601001,
  912. serialNumber: '601001Table1Bu',
  913. tableId: '601001Table1',
  914. tableName: '物料信息表',
  915. columnProp: 'buDesc',
  916. headerAlign: 'center',
  917. align: 'center',
  918. columnLabel: 'BU',
  919. columnHidden: false,
  920. columnImage: false,
  921. columnSortable: false,
  922. sortLv: 0,
  923. status: true,
  924. fixed: '',
  925. columnWidth: 80
  926. },
  927. {
  928. userId: this.$store.state.user.name,
  929. functionId: 601001,
  930. serialNumber: '601001Table1PartNo',
  931. tableId: '601001Table1',
  932. tableName: '物料信息表',
  933. columnProp: 'partNo',
  934. headerAlign: 'center',
  935. align: 'center',
  936. columnLabel: '物料编码',
  937. columnHidden: false,
  938. columnImage: false,
  939. columnSortable: false,
  940. sortLv: 0,
  941. status: true,
  942. fixed: '',
  943. columnWidth: 120
  944. },
  945. {
  946. userId: this.$store.state.user.name,
  947. functionId: 601001,
  948. serialNumber: '601001Table1PartDesc',
  949. tableId: '601001Table1',
  950. tableName: '物料信息表',
  951. columnProp: 'partDesc',
  952. headerAlign: 'center',
  953. align: 'center',
  954. columnLabel: '物料描述',
  955. columnHidden: false,
  956. columnImage: false,
  957. columnSortable: false,
  958. sortLv: 0,
  959. status: true,
  960. fixed: '',
  961. columnWidth: 300
  962. },
  963. {
  964. userId: this.$store.state.user.name,
  965. functionId: 601001,
  966. serialNumber: '601001Table1PartDesceEn',
  967. tableId: '601001Table1',
  968. tableName: '物料信息表',
  969. columnProp: 'partDesceEn',
  970. headerAlign: 'center',
  971. align: 'center',
  972. columnLabel: '物料描述(英文)',
  973. columnHidden: false,
  974. columnImage: false,
  975. columnSortable: false,
  976. sortLv: 0,
  977. status: true,
  978. fixed: '',
  979. columnWidth: 300
  980. },
  981. {
  982. userId: this.$store.state.user.name,
  983. functionId: 601001,
  984. serialNumber: '601001Table1Spec',
  985. tableId: '601001Table1',
  986. tableName: '物料信息表',
  987. columnProp: 'spec',
  988. headerAlign: 'center',
  989. align: 'center',
  990. columnLabel: '规格',
  991. columnHidden: false,
  992. columnImage: false,
  993. columnSortable: false,
  994. sortLv: 0,
  995. status: true,
  996. fixed: '',
  997. columnWidth: 300
  998. },
  999. {
  1000. userId: this.$store.state.user.name,
  1001. functionId: 601001,
  1002. serialNumber: '601001Table1ActiveDesc',
  1003. tableId: '601001Table1',
  1004. tableName: '物料信息表',
  1005. columnProp: 'activeDesc',
  1006. headerAlign: 'center',
  1007. align: 'center',
  1008. columnLabel: '是否在用',
  1009. columnHidden: false,
  1010. columnImage: false,
  1011. columnSortable: false,
  1012. sortLv: 0,
  1013. status: true,
  1014. fixed: '',
  1015. columnWidth: 80
  1016. },
  1017. {
  1018. userId: this.$store.state.user.name,
  1019. functionId: 601001,
  1020. serialNumber: '601001Table1PartType2Desc',
  1021. tableId: '601001Table1',
  1022. tableName: '物料信息表',
  1023. columnProp: 'partType2Desc',
  1024. headerAlign: 'center',
  1025. align: 'center',
  1026. columnLabel: '零件类型',
  1027. columnHidden: false,
  1028. columnImage: false,
  1029. columnSortable: false,
  1030. sortLv: 0,
  1031. status: true,
  1032. fixed: '',
  1033. columnWidth: 100
  1034. },
  1035. {
  1036. userId: this.$store.state.user.name,
  1037. functionId: 601001,
  1038. serialNumber: '601001Table1UmId',
  1039. tableId: '601001Table1',
  1040. tableName: '物料信息表',
  1041. columnProp: 'umId2',
  1042. headerAlign: 'center',
  1043. align: 'center',
  1044. columnLabel: '计量单位编码',
  1045. columnHidden: false,
  1046. columnImage: false,
  1047. columnSortable: false,
  1048. sortLv: 0,
  1049. status: true,
  1050. fixed: '',
  1051. columnWidth: 100
  1052. },
  1053. {
  1054. userId: this.$store.state.user.name,
  1055. functionId: 601001,
  1056. serialNumber: '601001Table1UmName',
  1057. tableId: '601001Table1',
  1058. tableName: '物料信息表',
  1059. columnProp: 'umName',
  1060. headerAlign: 'center',
  1061. align: 'center',
  1062. columnLabel: '计量单位名称',
  1063. columnHidden: false,
  1064. columnImage: false,
  1065. columnSortable: false,
  1066. sortLv: 0,
  1067. status: true,
  1068. fixed: '',
  1069. columnWidth: 150
  1070. },
  1071. {
  1072. userId: this.$store.state.user.name,
  1073. functionId: 601001,
  1074. serialNumber: '601001Table1FamilyID',
  1075. tableId: '601001Table1',
  1076. tableName: '物料信息表',
  1077. columnProp: 'familyID',
  1078. headerAlign: 'center',
  1079. align: 'center',
  1080. columnLabel: '物料分类编码',
  1081. columnHidden: false,
  1082. columnImage: false,
  1083. columnSortable: false,
  1084. sortLv: 0,
  1085. status: true,
  1086. fixed: '',
  1087. columnWidth: 100
  1088. },
  1089. {
  1090. userId: this.$store.state.user.name,
  1091. functionId: 601001,
  1092. serialNumber: '601001Table1FamilyName',
  1093. tableId: '601001Table1',
  1094. tableName: '物料信息表',
  1095. columnProp: 'familyName',
  1096. headerAlign: 'center',
  1097. align: 'center',
  1098. columnLabel: '物料分类名称',
  1099. columnHidden: false,
  1100. columnImage: false,
  1101. columnSortable: false,
  1102. sortLv: 0,
  1103. status: true,
  1104. fixed: '',
  1105. columnWidth: 150
  1106. },
  1107. {
  1108. userId: this.$store.state.user.name,
  1109. functionId: 601001,
  1110. serialNumber: '601001Table1OtherGroup1',
  1111. tableId: '601001Table1',
  1112. tableName: '物料信息表',
  1113. columnProp: 'productGroupId1',
  1114. headerAlign: 'center',
  1115. align: 'center',
  1116. columnLabel: '商品组1编码',
  1117. columnHidden: false,
  1118. columnImage: false,
  1119. columnSortable: false,
  1120. sortLv: 0,
  1121. status: true,
  1122. fixed: '',
  1123. columnWidth: 100
  1124. },
  1125. {
  1126. userId: this.$store.state.user.name,
  1127. functionId: 601001,
  1128. serialNumber: '601001Table1OtherGroupName1',
  1129. tableId: '601001Table1',
  1130. tableName: '物料信息表',
  1131. columnProp: 'productGroupName1',
  1132. headerAlign: 'center',
  1133. align: 'center',
  1134. columnLabel: '商品组1名称',
  1135. columnHidden: false,
  1136. columnImage: false,
  1137. columnSortable: false,
  1138. sortLv: 0,
  1139. status: true,
  1140. fixed: '',
  1141. columnWidth: 150
  1142. },
  1143. {
  1144. userId: this.$store.state.user.name,
  1145. functionId: 601001,
  1146. serialNumber: '601001Table1OtherGroup2',
  1147. tableId: '601001Table1',
  1148. tableName: '物料信息表',
  1149. columnProp: 'productGroupId2',
  1150. headerAlign: 'center',
  1151. align: 'center',
  1152. columnLabel: '商品组2编码',
  1153. columnHidden: false,
  1154. columnImage: false,
  1155. columnSortable: false,
  1156. sortLv: 0,
  1157. status: true,
  1158. fixed: '',
  1159. columnWidth: 100
  1160. },
  1161. {
  1162. userId: this.$store.state.user.name,
  1163. functionId: 601001,
  1164. serialNumber: '601001Table1OtherGroupName2',
  1165. tableId: '601001Table1',
  1166. tableName: '物料信息表',
  1167. columnProp: 'productGroupName2',
  1168. headerAlign: 'center',
  1169. align: 'center',
  1170. columnLabel: '商品组2名称',
  1171. columnHidden: false,
  1172. columnImage: false,
  1173. columnSortable: false,
  1174. sortLv: 0,
  1175. status: true,
  1176. fixed: '',
  1177. columnWidth: 150
  1178. },
  1179. {
  1180. userId: this.$store.state.user.name,
  1181. functionId: 601001,
  1182. serialNumber: '601001Table1OtherGroup3',
  1183. tableId: '601001Table1',
  1184. tableName: '物料信息表',
  1185. columnProp: 'productGroupId3',
  1186. headerAlign: 'center',
  1187. align: 'center',
  1188. columnLabel: '商品组3编码',
  1189. columnHidden: false,
  1190. columnImage: false,
  1191. columnSortable: false,
  1192. sortLv: 0,
  1193. status: true,
  1194. fixed: '',
  1195. columnWidth: 100
  1196. },
  1197. {
  1198. userId: this.$store.state.user.name,
  1199. functionId: 601001,
  1200. serialNumber: '601001Table1OtherGroupName3',
  1201. tableId: '601001Table1',
  1202. tableName: '物料信息表',
  1203. columnProp: 'productGroupName3',
  1204. headerAlign: 'center',
  1205. align: 'center',
  1206. columnLabel: '商品组3名称',
  1207. columnHidden: false,
  1208. columnImage: false,
  1209. columnSortable: false,
  1210. sortLv: 0,
  1211. status: true,
  1212. fixed: '',
  1213. columnWidth: 150
  1214. },
  1215. {
  1216. userId: this.$store.state.user.name,
  1217. functionId: 601001,
  1218. serialNumber: '601001Table1CodeNo',
  1219. tableId: '601001Table1',
  1220. tableName: '物料信息表',
  1221. columnProp: 'codeNo',
  1222. headerAlign: 'center',
  1223. align: 'center',
  1224. columnLabel: '属性模板编码',
  1225. columnHidden: false,
  1226. columnImage: false,
  1227. columnSortable: false,
  1228. sortLv: 0,
  1229. status: true,
  1230. fixed: '',
  1231. columnWidth: 150
  1232. },
  1233. {
  1234. userId: this.$store.state.user.name,
  1235. functionId: 601001,
  1236. serialNumber: '601001Table1CodeDesc',
  1237. tableId: '601001Table1',
  1238. tableName: '物料信息表',
  1239. columnProp: 'codeDesc',
  1240. headerAlign: 'center',
  1241. align: 'center',
  1242. columnLabel: '属性模板名称',
  1243. columnHidden: false,
  1244. columnImage: false,
  1245. columnSortable: false,
  1246. sortLv: 0,
  1247. status: true,
  1248. fixed: '',
  1249. columnWidth: 200
  1250. },
  1251. {
  1252. userId: this.$store.state.user.name,
  1253. functionId: 601001,
  1254. serialNumber: '601001Table1Remark',
  1255. tableId: '601001Table1',
  1256. tableName: '物料信息表',
  1257. columnProp: 'remark',
  1258. headerAlign: 'center',
  1259. align: 'center',
  1260. columnLabel: '备注',
  1261. columnHidden: false,
  1262. columnImage: false,
  1263. columnSortable: false,
  1264. sortLv: 0,
  1265. status: true,
  1266. fixed: '',
  1267. columnWidth: 300
  1268. },
  1269. {
  1270. userId: this.$store.state.user.name,
  1271. functionId: 601001,
  1272. serialNumber: '601001Table1CreateDate',
  1273. tableId: '601001Table1',
  1274. tableName: '物料信息表',
  1275. columnProp: 'createDate',
  1276. headerAlign: 'center',
  1277. align: 'center',
  1278. columnLabel: '创建时间',
  1279. columnHidden: false,
  1280. columnImage: false,
  1281. columnSortable: false,
  1282. sortLv: 0,
  1283. status: true,
  1284. fixed: '',
  1285. columnWidth: 150
  1286. },
  1287. {
  1288. userId: this.$store.state.user.name,
  1289. functionId: 601001,
  1290. serialNumber: '601001Table1CreateBy',
  1291. tableId: '601001Table1',
  1292. tableName: '物料信息表',
  1293. columnProp: 'createBy',
  1294. headerAlign: 'center',
  1295. align: 'center',
  1296. columnLabel: '创建人',
  1297. columnHidden: false,
  1298. columnImage: false,
  1299. columnSortable: false,
  1300. sortLv: 0,
  1301. status: true,
  1302. fixed: '',
  1303. columnWidth: 100
  1304. },
  1305. ],
  1306. columnItemList: [
  1307. {
  1308. userId: this.$store.state.user.name,
  1309. functionId: 601001,
  1310. serialNumber: '601001Table2PropertiesItemID',
  1311. tableId: "601001Table2",
  1312. tableName: "物料属性表",
  1313. columnProp: 'propertiesItemNo',
  1314. headerAlign: "center",
  1315. align: "center",
  1316. columnLabel: '属性编码',
  1317. columnHidden: false,
  1318. columnImage: false,
  1319. status: true,
  1320. fixed: '',
  1321. columnWidth: 100,
  1322. },
  1323. {
  1324. userId: this.$store.state.user.name,
  1325. functionId: 601001,
  1326. serialNumber: '601001Table2PropertiesItemDesc',
  1327. tableId: "601001Table2",
  1328. tableName: "物料属性表",
  1329. columnProp: 'itemDesc',
  1330. headerAlign: "center",
  1331. align: "center",
  1332. columnLabel: '属性名称',
  1333. columnHidden: false,
  1334. columnImage: false,
  1335. status: true,
  1336. fixed: '',
  1337. columnWidth: 120,
  1338. },
  1339. {
  1340. userId: this.$store.state.user.name,
  1341. functionId: 601001,
  1342. serialNumber: '601001Table2ValueType',
  1343. tableId: "601001Table2",
  1344. tableName: "物料属性表",
  1345. columnProp: 'valueType',
  1346. headerAlign: "center",
  1347. align: "center",
  1348. columnLabel: '属性类型',
  1349. columnHidden: false,
  1350. columnImage: false,
  1351. status: true,
  1352. fixed: '',
  1353. columnWidth: 100,
  1354. },
  1355. {
  1356. userId: this.$store.state.user.name,
  1357. functionId: 601001,
  1358. serialNumber: '601001Table2ValueChooseFlag',
  1359. tableId: "601001Table2",
  1360. tableName: "物料属性表",
  1361. columnProp: 'textValue',
  1362. headerAlign: "center",
  1363. align: "center",
  1364. columnLabel: '属性值',
  1365. columnHidden: false,
  1366. columnImage: false,
  1367. status: true,
  1368. fixed: '',
  1369. columnWidth: 100,
  1370. },
  1371. ],
  1372. updateColumnItemList: [
  1373. {
  1374. userId: this.$store.state.user.name,
  1375. functionId: 601001,
  1376. serialNumber: '601001Table6PropertiesItemID',
  1377. tableId: "601001Table6",
  1378. tableName: "物料属性表",
  1379. columnProp: 'propertiesItemNo',
  1380. headerAlign: "center",
  1381. align: "center",
  1382. columnLabel: '属性编码',
  1383. columnHidden: false,
  1384. columnImage: false,
  1385. status: true,
  1386. fixed: '',
  1387. columnWidth: 90,
  1388. },
  1389. {
  1390. userId: this.$store.state.user.name,
  1391. functionId: 601001,
  1392. serialNumber: '601001Table6PropertiesItemDesc',
  1393. tableId: "601001Table6",
  1394. tableName: "物料属性表",
  1395. columnProp: 'itemDesc',
  1396. headerAlign: "center",
  1397. align: "center",
  1398. columnLabel: '属性名称',
  1399. columnHidden: false,
  1400. columnImage: false,
  1401. status: true,
  1402. fixed: '',
  1403. columnWidth: 90,
  1404. },
  1405. {
  1406. userId: this.$store.state.user.name,
  1407. functionId: 601001,
  1408. serialNumber: '601001Table6ValueType',
  1409. tableId: "601001Table6",
  1410. tableName: "物料属性表",
  1411. columnProp: 'valueType',
  1412. headerAlign: "center",
  1413. align: "center",
  1414. columnLabel: '属性类型',
  1415. columnHidden: false,
  1416. columnImage: false,
  1417. status: true,
  1418. fixed: '',
  1419. columnWidth: 70,
  1420. },
  1421. ],
  1422. columnAgentList: [
  1423. {
  1424. userId: this.$store.state.user.name,
  1425. functionId: 601001,
  1426. serialNumber: '601001Table3AgentId',
  1427. tableId: "601001Table3",
  1428. tableName: "物料代理商表",
  1429. columnProp: 'agentId',
  1430. headerAlign: "center",
  1431. align: "center",
  1432. columnLabel: '代理商编码',
  1433. columnHidden: false,
  1434. columnImage: false,
  1435. status: true,
  1436. fixed: '',
  1437. },
  1438. {
  1439. userId: this.$store.state.user.name,
  1440. functionId: 601001,
  1441. serialNumber: '601001Table3AgentName',
  1442. tableId: "601001Table3",
  1443. tableName: "物料代理商表",
  1444. columnProp: 'agentName',
  1445. headerAlign: "center",
  1446. align: "center",
  1447. columnLabel: '代理商名称',
  1448. columnHidden: false,
  1449. columnImage: false,
  1450. status: true,
  1451. fixed: '',
  1452. },
  1453. {
  1454. userId: this.$store.state.user.name,
  1455. functionId: 601001,
  1456. serialNumber: '601001Table3Active',
  1457. tableId: '601001Table3',
  1458. tableName: '物料代理商表',
  1459. columnProp: 'active',
  1460. headerAlign: 'center',
  1461. align: 'center',
  1462. columnLabel: '是否在用',
  1463. columnHidden: false,
  1464. columnImage: false,
  1465. status: true,
  1466. fixed: '',
  1467. },
  1468. {
  1469. userId: this.$store.state.user.name,
  1470. functionId: 601001,
  1471. serialNumber: '601001Table3CreateDate',
  1472. tableId: '601001Table3',
  1473. tableName: '物料代理商表',
  1474. columnProp: 'createDate',
  1475. headerAlign: 'center',
  1476. align: 'center',
  1477. columnLabel: '创建时间',
  1478. columnHidden: false,
  1479. columnImage: false,
  1480. status: true,
  1481. fixed: '',
  1482. },
  1483. {
  1484. userId: this.$store.state.user.name,
  1485. functionId: 601001,
  1486. serialNumber: '601001Table3CreateBy',
  1487. tableId: '601001Table3',
  1488. tableName: '物料代理商表',
  1489. columnProp: 'createBy',
  1490. headerAlign: 'center',
  1491. align: 'center',
  1492. columnLabel: '创建人',
  1493. columnHidden: false,
  1494. columnImage: false,
  1495. status: true,
  1496. fixed: '',
  1497. },
  1498. {
  1499. userId: this.$store.state.user.name,
  1500. functionId: 601001,
  1501. serialNumber: '601001Table3UpdateDate',
  1502. tableId: '601001Table3',
  1503. tableName: '物料代理商表',
  1504. columnProp: 'updateDate',
  1505. headerAlign: 'center',
  1506. align: 'center',
  1507. columnLabel: '更新时间',
  1508. columnHidden: false,
  1509. columnImage: false,
  1510. status: true,
  1511. fixed: '',
  1512. },
  1513. {
  1514. userId: this.$store.state.user.name,
  1515. functionId: 601001,
  1516. serialNumber: '601001Table3UpdateBy',
  1517. tableId: '601001Table3',
  1518. tableName: '物料代理商表',
  1519. columnProp: 'updateBy',
  1520. headerAlign: 'center',
  1521. align: 'center',
  1522. columnLabel: '更新人',
  1523. columnHidden: false,
  1524. columnImage: false,
  1525. status: true,
  1526. fixed: '',
  1527. }
  1528. ],
  1529. columnManufacturerList: [
  1530. {
  1531. userId: this.$store.state.user.name,
  1532. functionId: 601001,
  1533. serialNumber: '601001Table5ManufacturerId',
  1534. tableId: "601001Table5",
  1535. tableName: "物料制造商表",
  1536. columnProp: 'manufacturerId',
  1537. headerAlign: "center",
  1538. align: "center",
  1539. columnLabel: '制造商编码',
  1540. columnHidden: false,
  1541. columnImage: false,
  1542. status: true,
  1543. fixed: '',
  1544. },
  1545. {
  1546. userId: this.$store.state.user.name,
  1547. functionId: 601001,
  1548. serialNumber: '601001Table5ManufacturerName',
  1549. tableId: "601001Table5",
  1550. tableName: "物料制造商表",
  1551. columnProp: 'manufacturerName',
  1552. headerAlign: "center",
  1553. align: "center",
  1554. columnLabel: '制造商名称',
  1555. columnHidden: false,
  1556. columnImage: false,
  1557. status: true,
  1558. fixed: '',
  1559. },
  1560. {
  1561. userId: this.$store.state.user.name,
  1562. functionId: 601001,
  1563. serialNumber: '601001Table5Active',
  1564. tableId: '601001Table5',
  1565. tableName: '物料制造商表',
  1566. columnProp: 'active',
  1567. headerAlign: 'center',
  1568. align: 'center',
  1569. columnLabel: '是否在用',
  1570. columnHidden: false,
  1571. columnImage: false,
  1572. status: true,
  1573. fixed: '',
  1574. },
  1575. {
  1576. userId: this.$store.state.user.name,
  1577. functionId: 601001,
  1578. serialNumber: '601001Table5CreateDate',
  1579. tableId: '601001Table5',
  1580. tableName: '物料制造商表',
  1581. columnProp: 'createDate',
  1582. headerAlign: 'center',
  1583. align: 'center',
  1584. columnLabel: '创建时间',
  1585. columnHidden: false,
  1586. columnImage: false,
  1587. status: true,
  1588. fixed: '',
  1589. },
  1590. {
  1591. userId: this.$store.state.user.name,
  1592. functionId: 601001,
  1593. serialNumber: '601001Table5CreateBy',
  1594. tableId: '601001Table5',
  1595. tableName: '物料制造商表',
  1596. columnProp: 'createBy',
  1597. headerAlign: 'center',
  1598. align: 'center',
  1599. columnLabel: '创建人',
  1600. columnHidden: false,
  1601. columnImage: false,
  1602. status: true,
  1603. fixed: '',
  1604. },
  1605. {
  1606. userId: this.$store.state.user.name,
  1607. functionId: 601001,
  1608. serialNumber: '601001Table5UpdateDate',
  1609. tableId: '601001Table5',
  1610. tableName: '物料制造商表',
  1611. columnProp: 'updateDate',
  1612. headerAlign: 'center',
  1613. align: 'center',
  1614. columnLabel: '更新时间',
  1615. columnHidden: false,
  1616. columnImage: false,
  1617. status: true,
  1618. fixed: '',
  1619. },
  1620. {
  1621. userId: this.$store.state.user.name,
  1622. functionId: 601001,
  1623. serialNumber: '601001Table5UpdateBy',
  1624. tableId: '601001Table5',
  1625. tableName: '物料制造商表',
  1626. columnProp: 'updateBy',
  1627. headerAlign: 'center',
  1628. align: 'center',
  1629. columnLabel: '更新人',
  1630. columnHidden: false,
  1631. columnImage: false,
  1632. status: true,
  1633. fixed: '',
  1634. }
  1635. ],
  1636. columnLocationList: [
  1637. {
  1638. userId: this.$store.state.user.name,
  1639. functionId: 601001,
  1640. serialNumber: '601001Table7LocationId',
  1641. tableId: "601001Table7",
  1642. tableName: "物料库位表",
  1643. columnProp: 'locationId',
  1644. headerAlign: "center",
  1645. align: "center",
  1646. columnLabel: '库位编码',
  1647. columnHidden: false,
  1648. columnImage: false,
  1649. status: true,
  1650. fixed: '',
  1651. },
  1652. {
  1653. userId: this.$store.state.user.name,
  1654. functionId: 601001,
  1655. serialNumber: '601001Table7LocationName',
  1656. tableId: "601001Table7",
  1657. tableName: "物料库位表",
  1658. columnProp: 'locationName',
  1659. headerAlign: "center",
  1660. align: "center",
  1661. columnLabel: '库位名称',
  1662. columnHidden: false,
  1663. columnImage: false,
  1664. status: true,
  1665. fixed: '',
  1666. },
  1667. {
  1668. userId: this.$store.state.user.name,
  1669. functionId: 601001,
  1670. serialNumber: '601001Table7warehouseId',
  1671. tableId: "601001Table7",
  1672. tableName: "物料库位表",
  1673. columnProp: 'warehouseId',
  1674. headerAlign: "center",
  1675. align: "center",
  1676. columnLabel: '仓库编码',
  1677. columnHidden: false,
  1678. columnImage: false,
  1679. status: true,
  1680. fixed: '',
  1681. },
  1682. {
  1683. userId: this.$store.state.user.name,
  1684. functionId: 601001,
  1685. serialNumber: '601001Table7Active',
  1686. tableId: '601001Table7',
  1687. tableName: '物料库位表',
  1688. columnProp: 'active',
  1689. headerAlign: 'center',
  1690. align: 'center',
  1691. columnLabel: '是否在用',
  1692. columnHidden: false,
  1693. columnImage: false,
  1694. status: true,
  1695. fixed: '',
  1696. },
  1697. {
  1698. userId: this.$store.state.user.name,
  1699. functionId: 601001,
  1700. serialNumber: '601001Table7CreateDate',
  1701. tableId: '601001Table7',
  1702. tableName: '物料库位表',
  1703. columnProp: 'createDate',
  1704. headerAlign: 'center',
  1705. align: 'center',
  1706. columnLabel: '创建时间',
  1707. columnHidden: false,
  1708. columnImage: false,
  1709. status: true,
  1710. fixed: '',
  1711. },
  1712. {
  1713. userId: this.$store.state.user.name,
  1714. functionId: 601001,
  1715. serialNumber: '601001Table7CreateBy',
  1716. tableId: '601001Table7',
  1717. tableName: '物料库位表',
  1718. columnProp: 'createBy',
  1719. headerAlign: 'center',
  1720. align: 'center',
  1721. columnLabel: '创建人',
  1722. columnHidden: false,
  1723. columnImage: false,
  1724. status: true,
  1725. fixed: '',
  1726. },
  1727. {
  1728. userId: this.$store.state.user.name,
  1729. functionId: 601001,
  1730. serialNumber: '601001Table7UpdateDate',
  1731. tableId: '601001Table7',
  1732. tableName: '物料库位表',
  1733. columnProp: 'updateDate',
  1734. headerAlign: 'center',
  1735. align: 'center',
  1736. columnLabel: '更新时间',
  1737. columnHidden: false,
  1738. columnImage: false,
  1739. status: true,
  1740. fixed: '',
  1741. },
  1742. {
  1743. userId: this.$store.state.user.name,
  1744. functionId: 601001,
  1745. serialNumber: '601001Table7UpdateBy',
  1746. tableId: '601001Table7',
  1747. tableName: '物料库位表',
  1748. columnProp: 'updateBy',
  1749. headerAlign: 'center',
  1750. align: 'center',
  1751. columnLabel: '更新人',
  1752. columnHidden: false,
  1753. columnImage: false,
  1754. status: true,
  1755. fixed: '',
  1756. }
  1757. ],
  1758. columnFileList: [
  1759. {
  1760. userId: this.$store.state.user.name,
  1761. functionId: 601001,
  1762. serialNumber: '601001Table4FileName',
  1763. tableId: '601001Table4',
  1764. tableName: '文件信息表',
  1765. columnProp: 'fileName',
  1766. headerAlign: 'center',
  1767. align: 'center',
  1768. columnLabel: '文件名称',
  1769. columnHidden: false,
  1770. columnImage: false,
  1771. status: true,
  1772. fixed: '',
  1773. columnWidth: 200,
  1774. },
  1775. {
  1776. userId: this.$store.state.user.name,
  1777. functionId: 601001,
  1778. serialNumber: '601001Table4FileRemark',
  1779. tableId: '601001Table4',
  1780. tableName: '文件信息表',
  1781. columnProp: 'url',
  1782. headerAlign: 'center',
  1783. align: 'center',
  1784. columnLabel: '文件路径',
  1785. columnHidden: false,
  1786. columnImage: false,
  1787. status: true,
  1788. fixed: '',
  1789. columnWidth: 300,
  1790. },
  1791. {
  1792. userId: this.$store.state.user.name,
  1793. functionId: 601001,
  1794. serialNumber: '601001Table4CreateDate',
  1795. tableId: '601001Table4',
  1796. tableName: '文件信息表',
  1797. columnProp: 'createDate',
  1798. headerAlign: 'center',
  1799. align: 'center',
  1800. columnLabel: '上传时间',
  1801. columnHidden: false,
  1802. columnImage: false,
  1803. status: true,
  1804. fixed: '',
  1805. columnWidth: 170,
  1806. },
  1807. {
  1808. userId: this.$store.state.user.name,
  1809. functionId: 601001,
  1810. serialNumber: '601001Table4CreatedBy',
  1811. tableId: '601001Table4',
  1812. tableName: '文件信息表',
  1813. columnProp: 'createdBy',
  1814. headerAlign: 'center',
  1815. align: 'center',
  1816. columnLabel: '上传人',
  1817. columnHidden: false,
  1818. columnImage: false,
  1819. status: true,
  1820. fixed: '',
  1821. columnWidth: 120,
  1822. }
  1823. ],
  1824. // ======== 必填规则 ========
  1825. rules: {
  1826. bu: [
  1827. {
  1828. required: true,
  1829. message: ' ',
  1830. trigger: ['blur','change']
  1831. }
  1832. ],
  1833. partNo: [
  1834. {
  1835. required: true,
  1836. message: ' ',
  1837. trigger: ['blur','change']
  1838. }
  1839. ],
  1840. partDesc: [
  1841. {
  1842. required: true,
  1843. message: ' ',
  1844. trigger: ['blur','change']
  1845. }
  1846. ],
  1847. umId2: [
  1848. {
  1849. required: true,
  1850. message: ' ',
  1851. trigger: ['blur','change']
  1852. }
  1853. ],
  1854. codeNo: [
  1855. {
  1856. required: true,
  1857. message: ' ',
  1858. trigger: ['blur','change']
  1859. }
  1860. ],
  1861. manufacturerName: [
  1862. {
  1863. required: true,
  1864. message: ' ',
  1865. trigger: ['blur','change']
  1866. }
  1867. ],
  1868. active: [
  1869. {
  1870. required: true,
  1871. message: ' ',
  1872. trigger: ['blur','change']
  1873. }
  1874. ],
  1875. agentName: [
  1876. {
  1877. required: true,
  1878. message: ' ',
  1879. trigger: ['blur','change']
  1880. }
  1881. ],
  1882. partType2: [
  1883. {
  1884. required: true,
  1885. message: ' ',
  1886. trigger: ['blur','change']
  1887. }
  1888. ],
  1889. productGroupId4: [
  1890. {
  1891. required: true,
  1892. message: ' ',
  1893. trigger: ['blur','change']
  1894. }
  1895. ],
  1896. lotTrackingCode: [
  1897. {
  1898. required: true,
  1899. message: ' ',
  1900. trigger: ['blur','change']
  1901. }
  1902. ],
  1903. },
  1904. // ======== 复选数据集 ========
  1905. partSelections: [],
  1906. bomAlternativeSelections: [],
  1907. routingAlternativeSelections: [],
  1908. // ======== 选中的当前行数据 ========
  1909. partCurrentRow: {},
  1910. // ======== 模态框开关控制 ========
  1911. authSearch: false,
  1912. authSave: false,
  1913. authUpdate: false,
  1914. authDelete: false,
  1915. modalFlag: false,
  1916. modalDisableFlag: false,
  1917. itemChooseFlag: false,
  1918. itemTextDisableFlag: false,
  1919. itemNumberDisableFlag: false,
  1920. itemModalDisableFlag: false,
  1921. itemModalFlag: false,
  1922. agentModelFlag: false,
  1923. manufacturerModelFlag: false,
  1924. updateItemModelFlag: false,
  1925. fastAddFlag: false,
  1926. locationModelFlag: false,
  1927. copyPartModelFlag: false,
  1928. attributeDialog: true,
  1929. uploadDialog: false,
  1930. menuId: this.$route.meta.menuId,
  1931. previousPartNo: '',
  1932. saveLoading: false
  1933. }
  1934. },
  1935. created () {
  1936. // 获取用户的 site 和 bu
  1937. this.getSiteAndBuByUserName()
  1938. },
  1939. methods: {
  1940. // 初始化组件的参数
  1941. init () {
  1942. this.modalData = {
  1943. flag: '1',
  1944. title: '物料新增',
  1945. site: '',
  1946. buNo: '',
  1947. bu: this.userBuList[0].buNo,
  1948. partNo: '',
  1949. partDesc: '',
  1950. umId2: '',
  1951. umName: '',
  1952. spec: '',
  1953. active: 'Y',
  1954. partType2: 'Purchased (raw)',
  1955. standardBoxQty: '',
  1956. productGroupId1: '',
  1957. productGroupName1: '',
  1958. productGroupId2: '',
  1959. productGroupName2: '',
  1960. productGroupId3: '',
  1961. productGroupName3: '',
  1962. familyID: '',
  1963. familyName: '',
  1964. partDesceEn: '',
  1965. remark: '',
  1966. codeNo: '',
  1967. codeDesc: '',
  1968. tblBaseFlag: '',
  1969. createBy: this.$store.state.user.name
  1970. }
  1971. this.inventoryPartTable = 'General'
  1972. this.modalDisableFlag = false
  1973. this.modalFlag = true
  1974. this.getPreviousPartNo()
  1975. },
  1976. // 获取上一个物料编码
  1977. getPreviousPartNo () {
  1978. let tempData = {
  1979. site: this.modalData.bu.split('_')[0],
  1980. type: 'thePreviousPartItem',
  1981. thirdType: this.modalData.bu.split('_')[1],
  1982. secondType: this.$store.state.user.name
  1983. }
  1984. getPreviousPartNo(tempData).then(({data}) => {
  1985. if (data && data.code === 0) {
  1986. this.previousPartNo = data.previousPartNo
  1987. } else {
  1988. this.previousPartNo = ''
  1989. }
  1990. })
  1991. },
  1992. // 获取用户的bu
  1993. getSiteAndBuByUserName () {
  1994. let tempData = {
  1995. username: this.$store.state.user.name,
  1996. }
  1997. getSiteAndBuByUserName(tempData).then(({data}) => {
  1998. if (data.code === 0) {
  1999. this.userBuList = data.rows
  2000. }
  2001. })
  2002. },
  2003. // 物料信息新增/编辑
  2004. saveData (isClose) {
  2005. if (!this.attributeDialog) {
  2006. this.$message.warning('请保存属性更改!')
  2007. return
  2008. }
  2009. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  2010. this.$message.warning('请填写物料描述!')
  2011. return
  2012. }
  2013. if (this.modalData.bu === '' || this.modalData.bu == null) {
  2014. this.$message.warning('请选择BU!')
  2015. return
  2016. }
  2017. if (this.modalData.umId2 === '' || this.modalData.umId2 == null) {
  2018. this.$message.warning('请选择计量单位!')
  2019. return
  2020. }
  2021. if (this.modalData.tblBaseFlag === 'Y' && this.modalData.codeNo === '') {
  2022. this.$message.warning('请选择属性模板!')
  2023. return
  2024. }
  2025. this.saveLoading = true
  2026. savePartInfo(this.modalData).then(({data}) => {
  2027. if (data && data.code === 0) {
  2028. this.modalData = data.rows
  2029. this.modalData.title = '物料编辑'
  2030. if (isClose) {
  2031. // 保存
  2032. this.modalFlag = false
  2033. // 刷新BOM页面数据
  2034. this.$emit('refreshPageTables', data.rows)
  2035. }
  2036. this.modalDisableFlag = true
  2037. this.$message({
  2038. message: '操作成功',
  2039. type: 'success',
  2040. duration: 1500,
  2041. onClose: () => {}
  2042. })
  2043. } else {
  2044. this.$alert(data.msg, '错误', {
  2045. confirmButtonText: '确定'
  2046. })
  2047. }
  2048. this.saveLoading = false
  2049. }).catch(() => {
  2050. this.saveLoading = false
  2051. })
  2052. },
  2053. // 列表表格选择替换
  2054. tabClick (tab, event) {
  2055. this.refreshCurrentTabTable()
  2056. },
  2057. // 刷新页签的table数据
  2058. refreshCurrentTabTable () {
  2059. if (this.inventoryPartTable === 'part_item') {
  2060. this.getPartItem()
  2061. } else if (this.inventoryPartTable === 'part_agent') {
  2062. this.getPartAgent()
  2063. } else if (this.inventoryPartTable === 'part_file') {
  2064. this.getFileContentData()
  2065. } else if (this.inventoryPartTable === 'part_manufacturer') {
  2066. this.getPartManufacturer()
  2067. } else if (this.inventoryPartTable === 'default_locations') {
  2068. this.getDefaultLocation()
  2069. }
  2070. },
  2071. // 关闭模态框后刷新列表
  2072. refreshDetailList () {
  2073. this.getPartAgent()
  2074. this.getPartManufacturer()
  2075. this.getDefaultLocation()
  2076. },
  2077. // ======== 属性 ========
  2078. // 查询物料属性
  2079. getPartItem () {
  2080. let tempData = {
  2081. site: this.modalData.site,
  2082. buNo: this.modalData.buNo,
  2083. partNo: this.modalData.partNo,
  2084. codeNo: this.modalData.codeNo,
  2085. recordType: 'IP'
  2086. }
  2087. getPartItem(tempData).then(({data}) => {
  2088. if (data && data.code === 0) {
  2089. this.partItemList = data.rows
  2090. } else {
  2091. this.partItemList = []
  2092. }
  2093. })
  2094. },
  2095. // 保存属性
  2096. clickSave () {
  2097. if (!this.attributeDialog) { // 保存
  2098. this.updateItemValue()
  2099. } else { // 编辑
  2100. this.copyAttributeList = JSON.parse(JSON.stringify(this.partItemList))
  2101. this.attributeDialog = false
  2102. }
  2103. },
  2104. // 编辑物料属性
  2105. updateItemValue () {
  2106. this.loading = true
  2107. let tempData = {
  2108. itemList: JSON.parse(JSON.stringify(this.copyAttributeList))
  2109. }
  2110. commitItemValue(tempData).then(({data}) => {
  2111. if (data && data.code === 0) {
  2112. this.getPartItem()
  2113. this.attributeDialog = true
  2114. this.$message({
  2115. message: '操作成功',
  2116. type: 'success',
  2117. duration: 1500,
  2118. onClose: () => {}
  2119. })
  2120. } else {
  2121. this.$alert(data.msg, '错误', {
  2122. confirmButtonText: '确定'
  2123. })
  2124. }
  2125. this.loading = false
  2126. }).catch((error) => {
  2127. this.$message.error(error)
  2128. this.loading = false
  2129. })
  2130. },
  2131. // 新增/删除物料属性
  2132. addOrDelItem () {
  2133. if (!this.attributeDialog) {
  2134. this.$message.warning('请保存更改!')
  2135. return
  2136. }
  2137. this.itemSelections1 = null
  2138. this.itemSelections2 = null
  2139. this.itemData.propertiesItemNo = ''
  2140. this.itemData.itemDesc = ''
  2141. let tempData = {
  2142. site: this.modalData.site,
  2143. buNo: this.modalData.buNo,
  2144. partNo: this.modalData.partNo,
  2145. codeNo: this.modalData.codeNo,
  2146. recordType: 'IP'
  2147. }
  2148. getItemLists(tempData).then(({data}) => {
  2149. this.itemList1 = data.row1
  2150. this.itemList2 = data.row2
  2151. })
  2152. this.fastAddFlag = true
  2153. },
  2154. // 查询物料属性
  2155. queryPartItem () {
  2156. this.itemData.codeNo = this.modalData.codeNo
  2157. this.itemData.partNo = this.modalData.partNo
  2158. queryPartItem(this.itemData).then(({data}) => {
  2159. if (data && data.code === 0) {
  2160. this.itemList1 = data.rows
  2161. } else {
  2162. this.itemList1 = []
  2163. }
  2164. })
  2165. },
  2166. // 可选属性
  2167. itemClickRow1 (row) {
  2168. this.$refs.itemTable1.toggleRowSelection(row)
  2169. },
  2170. // 已有属性
  2171. itemClickRow2 (row) {
  2172. this.$refs.itemTable2.toggleRowSelection(row)
  2173. },
  2174. // 复选属性
  2175. selectionItem1 (val) {
  2176. this.itemSelections1 = val
  2177. },
  2178. // 复选属性
  2179. selectionItem2 (val) {
  2180. this.itemSelections2 = val
  2181. },
  2182. // 物料项目新增
  2183. addItem () {
  2184. if (this.itemSelections1 == null || this.itemSelections1.length === 0) {
  2185. this.$message.warning('请选择可选属性!')
  2186. return
  2187. }
  2188. let inData = {
  2189. site: this.modalData.site,
  2190. buNo: this.modalData.buNo,
  2191. partNo: this.modalData.partNo,
  2192. codeNo: this.modalData.codeNo,
  2193. codeDesc: this.modalData.codeDesc,
  2194. recordType: 'IP',
  2195. itemList: this.itemSelections1
  2196. }
  2197. addPartItem(inData).then(({data}) => {
  2198. if (data && data.code === 0) {
  2199. getItemLists(inData).then(({data}) => {
  2200. this.itemList1 = data.row1
  2201. this.itemList2 = data.row2
  2202. })
  2203. this.getPartItem()
  2204. this.itemSelections1 = []
  2205. } else {
  2206. this.$alert(data.msg, '错误', {
  2207. confirmButtonText: '确定'
  2208. })
  2209. }
  2210. })
  2211. },
  2212. // 物料项目删除
  2213. deleteItem () {
  2214. if (this.itemSelections2 == null || this.itemSelections2.length === 0) {
  2215. this.$alert("请选择已有属性!", '提示', {
  2216. confirmButtonText: '确定'
  2217. })
  2218. return false
  2219. }
  2220. let inData = {
  2221. site: this.modalData.site,
  2222. buNo: this.modalData.buNo,
  2223. partNo: this.modalData.partNo,
  2224. codeNo: this.modalData.codeNo,
  2225. codeDesc: this.modalData.codeDesc,
  2226. recordType: 'IP',
  2227. itemList: this.itemSelections2
  2228. }
  2229. deletePartItem(inData).then(({data}) => {
  2230. if (data && data.code === 0) {
  2231. getItemLists(inData).then(({data}) => {
  2232. this.itemList1 = data.row1
  2233. this.itemList2 = data.row2
  2234. })
  2235. this.getPartItem()
  2236. this.itemSelections2 = []
  2237. } else {
  2238. this.$alert(data.msg, '错误', {
  2239. confirmButtonText: '确定'
  2240. })
  2241. }
  2242. })
  2243. },
  2244. // ======== 代理商 ========
  2245. // 选择代理商
  2246. getAgentList () {
  2247. // 查询所有代理商
  2248. getAgentListBy(this.agentData).then(({data}) => {
  2249. if (data && data.code === 0) {
  2250. this.agentList1 = data.rows
  2251. } else {
  2252. this.$alert(data.msg, '错误', {
  2253. confirmButtonText: '确定'
  2254. })
  2255. }
  2256. })
  2257. },
  2258. // 新增代理商模态框
  2259. savePartAgent () {
  2260. this.agentSelections1 = null
  2261. this.agentSelections2 = null
  2262. getAgentList(this.modalData).then(({data}) => {
  2263. this.agentList1 = data.row1
  2264. this.agentList2 = data.row2
  2265. })
  2266. this.agentData = {
  2267. site: this.modalData.site,
  2268. buNo: this.modalData.buNo,
  2269. agentId: '',
  2270. agentName: '',
  2271. }
  2272. this.agentModelFlag = true
  2273. },
  2274. // 可选代理商
  2275. agentClickRow1 (row) {
  2276. this.$refs.agentTable1.toggleRowSelection(row)
  2277. },
  2278. // 已有代理商
  2279. agentClickRow2 (row) {
  2280. this.$refs.agentTable2.toggleRowSelection(row)
  2281. },
  2282. // 代理商复选
  2283. selectionAgent1 (val) {
  2284. this.agentSelections1 = val
  2285. },
  2286. // 代理商复选
  2287. selectionAgent2 (val) {
  2288. this.agentSelections2 = val
  2289. },
  2290. // 添加代理商
  2291. addAgent () {
  2292. if (this.agentSelections1 == null || this.agentSelections1.length === 0) {
  2293. this.$message.warning('请选择可选代理商!')
  2294. return
  2295. }
  2296. let inData = {
  2297. site: this.modalData.site,
  2298. buNo: this.modalData.buNo,
  2299. partNo: this.modalData.partNo,
  2300. agentList: this.agentSelections1
  2301. }
  2302. addPartAgent(inData).then(({data}) => {
  2303. if (data && data.code === 0) {
  2304. getAgentList(this.modalData).then(({data}) => {
  2305. this.agentList1 = data.row1
  2306. this.agentList2 = data.row2
  2307. })
  2308. this.agentSelections1 = []
  2309. } else {
  2310. this.$alert(data.msg, '错误', {
  2311. confirmButtonText: '确定'
  2312. })
  2313. }
  2314. })
  2315. },
  2316. // 删除物料代理商
  2317. deleteAgent () {
  2318. if(this.agentSelections2 == null || this.agentSelections2.length === 0){
  2319. this.$message.warning('请选择已有代理商!')
  2320. return
  2321. }
  2322. let inData = {
  2323. site: this.modalData.site,
  2324. buNo: this.modalData.buNo,
  2325. partNo: this.modalData.partNo,
  2326. agentList: this.agentSelections2
  2327. }
  2328. deletePartAgent(inData).then(({data}) => {
  2329. if (data && data.code === 0) {
  2330. getAgentList(this.modalData).then(({data}) => {
  2331. this.agentList1 = data.row1
  2332. this.agentList2 = data.row2
  2333. })
  2334. this.agentSelections2 = []
  2335. } else {
  2336. this.$alert(data.msg, '错误', {
  2337. confirmButtonText: '确定'
  2338. })
  2339. }
  2340. })
  2341. },
  2342. // 单删
  2343. deleteAgent2 (row) {
  2344. this.$confirm(`是否删除该代理商?`, '提示', {
  2345. confirmButtonText: '确定',
  2346. cancelButtonText: '取消',
  2347. type: 'warning'
  2348. }).then(() => {
  2349. deleteAgent(row).then(({data}) => {
  2350. if (data && data.code === 0) {
  2351. this.getPartAgent()
  2352. this.$message({
  2353. message: '操作成功',
  2354. type: 'success',
  2355. duration: 1500,
  2356. onClose: () => {}
  2357. })
  2358. } else {
  2359. this.$alert(data.msg, '错误', {
  2360. confirmButtonText: '确定'
  2361. })
  2362. }
  2363. })
  2364. })
  2365. },
  2366. // ======== 制造商 ========
  2367. // 选择制造商
  2368. getManufacturerList () {
  2369. // 查询所有代理商
  2370. getManufacturerListBy(this.manufacturerData).then(({data}) => {
  2371. if (data && data.code === 0) {
  2372. this.manufacturerList1 = data.rows
  2373. } else {
  2374. this.$alert(data.msg, '错误', {
  2375. confirmButtonText: '确定'
  2376. })
  2377. }
  2378. })
  2379. },
  2380. // 新增制造商模态框
  2381. savePartManufacturer () {
  2382. this.manufacturerSelections1 = null
  2383. this.manufacturerSelections2 = null
  2384. getManufacturerList(this.modalData).then(({data}) => {
  2385. this.manufacturerList1 = data.row1
  2386. this.manufacturerList2 = data.row2
  2387. })
  2388. this.manufacturerData = {
  2389. site: this.modalData.site,
  2390. buNo: this.modalData.buNo,
  2391. manufacturerId: '',
  2392. manufacturerName: '',
  2393. }
  2394. this.manufacturerModelFlag = true
  2395. },
  2396. // 可选制造商
  2397. manufacturerClickRow1 (row) {
  2398. this.$refs.manufacturerTable1.toggleRowSelection(row)
  2399. },
  2400. // 已有制造商
  2401. manufacturerClickRow2 (row) {
  2402. this.$refs.manufacturerTable2.toggleRowSelection(row)
  2403. },
  2404. // 制造商复选
  2405. selectionManufacturer1 (val) {
  2406. this.manufacturerSelections1 = val
  2407. },
  2408. // 制造商复选
  2409. selectionManufacturer2 (val) {
  2410. this.manufacturerSelections2 = val
  2411. },
  2412. // 添加制造商
  2413. addManufacturer () {
  2414. if (this.manufacturerSelections1 == null || this.manufacturerSelections1.length === 0) {
  2415. this.$message.warning('请选择可选制造商!')
  2416. return
  2417. }
  2418. let inData = {
  2419. site: this.modalData.site,
  2420. buNo: this.modalData.buNo,
  2421. partNo: this.modalData.partNo,
  2422. manufacturerList: this.manufacturerSelections1
  2423. }
  2424. addPartManufacturer(inData).then(({data}) => {
  2425. if (data && data.code === 0) {
  2426. getManufacturerList(this.modalData).then(({data}) => {
  2427. this.manufacturerList1 = data.row1
  2428. this.manufacturerList2 = data.row2
  2429. })
  2430. this.manufacturerSelections1 = []
  2431. } else {
  2432. this.$alert(data.msg, '错误', {
  2433. confirmButtonText: '确定'
  2434. })
  2435. }
  2436. })
  2437. },
  2438. // 删除物料制造商
  2439. deleteManufacturer () {
  2440. if (this.manufacturerSelections2 == null || this.manufacturerSelections2.length === 0) {
  2441. this.$message.warning('请选择已有制造商!')
  2442. return
  2443. }
  2444. let inData = {
  2445. site: this.modalData.site,
  2446. buNo: this.modalData.buNo,
  2447. partNo: this.modalData.partNo,
  2448. manufacturerList: this.manufacturerSelections2
  2449. }
  2450. deletePartManufacturer(inData).then(({data}) => {
  2451. if (data && data.code === 0) {
  2452. getManufacturerList(this.modalData).then(({data}) => {
  2453. this.manufacturerList1 = data.row1
  2454. this.manufacturerList2 = data.row2
  2455. })
  2456. this.manufacturerSelections2 = []
  2457. } else {
  2458. this.$alert(data.msg, '错误', {
  2459. confirmButtonText: '确定'
  2460. })
  2461. }
  2462. })
  2463. },
  2464. // 单删
  2465. deleteManufacturer2 (row) {
  2466. this.$confirm(`是否删除该制造商?`, '提示', {
  2467. confirmButtonText: '确定',
  2468. cancelButtonText: '取消',
  2469. type: 'warning'
  2470. }).then(() => {
  2471. deleteManufacturer(row).then(({data}) => {
  2472. if (data && data.code === 0) {
  2473. this.getPartManufacturer()
  2474. this.$message({
  2475. message: '操作成功',
  2476. type: 'success',
  2477. duration: 1500,
  2478. onClose: () => {}
  2479. })
  2480. } else {
  2481. this.$alert(data.msg, '错误', {
  2482. confirmButtonText: '确定'
  2483. })
  2484. }
  2485. })
  2486. })
  2487. },
  2488. // ======== 库位 ========
  2489. // 选择默认库位
  2490. getLocationList () {
  2491. // 查询所有库位
  2492. getLocationListBy(this.locationData).then(({data}) => {
  2493. if (data && data.code === 0) {
  2494. this.locationList1 = data.rows
  2495. } else {
  2496. this.$alert(data.msg, '错误', {
  2497. confirmButtonText: '确定'
  2498. })
  2499. }
  2500. })
  2501. },
  2502. // 新增库位模态框
  2503. saveDefaultLocation () {
  2504. this.locationSelections1 = null
  2505. this.locationSelections2 = null
  2506. getLocationList(this.modalData).then(({data}) => {
  2507. this.locationList1 = data.row1
  2508. this.locationList2 = data.row2
  2509. })
  2510. this.locationData = {
  2511. site: this.modalData.site,
  2512. buNo: this.modalData.buNo,
  2513. locationId: '',
  2514. locationName: '',
  2515. }
  2516. this.locationModelFlag = true
  2517. },
  2518. // 可选库位
  2519. locationClickRow1 (row) {
  2520. this.$refs.locationTable1.toggleRowSelection(row)
  2521. },
  2522. // 已有库位
  2523. locationClickRow2 (row) {
  2524. this.$refs.locationTable2.toggleRowSelection(row)
  2525. },
  2526. // 库位复选
  2527. selectionLocation1 (val) {
  2528. this.locationSelections1 = val
  2529. },
  2530. // 库位复选
  2531. selectionLocation2 (val) {
  2532. this.locationSelections2 = val
  2533. },
  2534. // 添加库位
  2535. addLocation () {
  2536. if (this.locationSelections1 == null || this.locationSelections1.length === 0) {
  2537. this.$message.warning('请选择可选库位!')
  2538. return
  2539. }
  2540. let inData = {
  2541. site: this.modalData.site,
  2542. buNo: this.modalData.buNo,
  2543. partNo: this.modalData.partNo,
  2544. locationList: this.locationSelections1
  2545. }
  2546. addDefaultLocation(inData).then(({data}) => {
  2547. if (data && data.code === 0) {
  2548. getLocationList(this.modalData).then(({data}) => {
  2549. this.locationList1 = data.row1
  2550. this.locationList2 = data.row2
  2551. })
  2552. this.locationSelections1 = []
  2553. } else {
  2554. this.$alert(data.msg, '错误', {
  2555. confirmButtonText: '确定'
  2556. })
  2557. }
  2558. })
  2559. },
  2560. // 删除库位
  2561. deleteLocation () {
  2562. if (this.locationSelections2 == null || this.locationSelections2.length === 0) {
  2563. this.$message.warning('请选择已有库位!')
  2564. return
  2565. }
  2566. let inData = {
  2567. site: this.modalData.site,
  2568. buNo: this.modalData.buNo,
  2569. partNo: this.modalData.partNo,
  2570. locationList: this.locationSelections2
  2571. }
  2572. deleteDefaultLocation(inData).then(({data}) => {
  2573. if (data && data.code === 0) {
  2574. getLocationList(this.modalData).then(({data}) => {
  2575. this.locationList1 = data.row1
  2576. this.locationList2 = data.row2
  2577. })
  2578. this.locationSelections2 = []
  2579. } else {
  2580. this.$alert(data.msg, '错误', {
  2581. confirmButtonText: '确定'
  2582. })
  2583. }
  2584. })
  2585. },
  2586. // 单删
  2587. deleteLocation2 (row) {
  2588. this.$confirm(`是否删除该库位?`, '提示', {
  2589. confirmButtonText: '确定',
  2590. cancelButtonText: '取消',
  2591. type: 'warning'
  2592. }).then(() => {
  2593. deleteLocation(row).then(({data}) => {
  2594. if (data && data.code === 0) {
  2595. this.getDefaultLocation()
  2596. this.$message({
  2597. message: '操作成功',
  2598. type: 'success',
  2599. duration: 1500,
  2600. onClose: () => {}
  2601. })
  2602. } else {
  2603. this.$alert(data.msg, '错误', {
  2604. confirmButtonText: '确定'
  2605. })
  2606. }
  2607. })
  2608. })
  2609. },
  2610. // ======== 附件的相关方法 ========
  2611. // 获取物料附件列表
  2612. getFileContentData () {
  2613. let currentData = {
  2614. orderRef1: this.modalData.site,
  2615. orderRef2: this.modalData.partNo,
  2616. orderRef3: 'part',
  2617. orderRef4: this.modalData.buNo,
  2618. }
  2619. getFileContentList(currentData).then(({data}) => {
  2620. if (data && data.code === 200) {
  2621. this.fileContentList = data.rows
  2622. } else {
  2623. this.fileContentList = []
  2624. }
  2625. })
  2626. },
  2627. // 上传文件
  2628. uploadFile () {
  2629. let currentData = {
  2630. titleCon: '物料附件上传',
  2631. site: this.modalData.site,
  2632. buNo: this.modalData.buNo,
  2633. createBy: this.$store.state.user.name,
  2634. partNo: this.modalData.partNo,
  2635. folder: 'part'
  2636. }
  2637. this.uploadDialog = true
  2638. // 打开组件去做新增业务
  2639. this.$nextTick(() => {
  2640. this.$refs.partUploadFile.init(currentData);
  2641. })
  2642. },
  2643. // 文件删除
  2644. deleteFile (row) {
  2645. this.$confirm('确定要删除此文件?', '提示', {
  2646. confirmButtonText: '确定',
  2647. cancelButtonText: '取消',
  2648. type: 'warning'
  2649. }).then(() => {
  2650. deleteObjectFile(row).then(({data}) => {
  2651. if (data && data.code === 0) {
  2652. this.getFileContentData()
  2653. this.$message({
  2654. message: '操作成功',
  2655. type: 'success',
  2656. duration: 1500,
  2657. onClose: () => {}
  2658. })
  2659. } else {
  2660. this.$alert(data.msg, '错误', {
  2661. confirmButtonText: '确定'
  2662. })
  2663. }
  2664. })
  2665. }).catch(() => {
  2666. })
  2667. },
  2668. // 文件下载
  2669. downloadFile (row) {
  2670. downLoadObjectFile(row).then(({data}) => {
  2671. // 不限制文件下载类型
  2672. const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'})
  2673. // 下载文件名称
  2674. const fileName = row.fileName
  2675. // a标签下载
  2676. const linkNode = document.createElement('a')
  2677. linkNode.download = fileName // a标签的download属性规定下载文件的名称
  2678. linkNode.style.display = 'none'
  2679. linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
  2680. document.body.appendChild(linkNode)
  2681. linkNode.click() // 模拟在按钮上的一次鼠标单击
  2682. URL.revokeObjectURL(linkNode.href) // 释放URL 对象
  2683. document.body.removeChild(linkNode)
  2684. })
  2685. },
  2686. // 预览
  2687. previewFile (row) {
  2688. // 预览文件
  2689. let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
  2690. let type = ''
  2691. if (image.includes(row.fileType.toLowerCase())) {
  2692. type = 'image/' + row.fileType
  2693. }
  2694. let video = ['mp4', 'avi', 'mov', 'wmv', 'flv']
  2695. if (video.includes(row.fileType.toLowerCase())) {
  2696. type = 'video/' + row.fileType
  2697. }
  2698. let txt = ['txt']
  2699. if (txt.includes(row.fileType.toLowerCase())) {
  2700. type = 'text/plain'
  2701. }
  2702. let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']
  2703. if (office.includes(row.fileType.toLowerCase())) {
  2704. this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`)
  2705. return
  2706. }
  2707. let pdf = ['pdf']
  2708. if (pdf.includes(row.fileType.toLowerCase())) {
  2709. type = 'application/pdf'
  2710. }
  2711. if (type === ''){
  2712. this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`)
  2713. return;
  2714. }
  2715. downLoadObjectFile(row).then(({data}) => {
  2716. const blob = new Blob([data], { type: type });
  2717. // 创建URL来生成预览
  2718. const fileURL = URL.createObjectURL(blob);
  2719. // 在新标签页中打开文件预览
  2720. const newTab = window.open(fileURL, '_blank')
  2721. })
  2722. },
  2723. // ======== 基础数据失焦事件 ========
  2724. // 计量单位输入校验
  2725. umIdBlur (tagNo) {
  2726. if (this.modalData.umId2 != null && this.modalData.umId2 !== '') {
  2727. let tempData = {
  2728. tagno: tagNo,
  2729. conditionSql: " and UMID = '" + this.modalData.umId2 + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'"
  2730. }
  2731. verifyData(tempData).then(({data}) => {
  2732. if (data && data.code === 0) {
  2733. if (data.baseListData.length > 0) {
  2734. this.modalData.umId2 = data.baseListData[0].UMID
  2735. this.modalData.umName = data.baseListData[0].UMName
  2736. return
  2737. }
  2738. }
  2739. })
  2740. }
  2741. this.modalData.umName = ''
  2742. },
  2743. // 商品组1输入校验
  2744. productGroupId1Blur (tagNo) {
  2745. if (this.modalData.productGroupId1 != null && this.modalData.productGroupId1 !== '') {
  2746. let tempData = {
  2747. tagno: tagNo,
  2748. conditionSql: " and product_group_id = '" + this.modalData.productGroupId1 + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
  2749. }
  2750. verifyData(tempData).then(({data}) => {
  2751. if (data && data.code === 0) {
  2752. if (data.baseListData.length > 0) {
  2753. this.modalData.productGroupId1 = data.baseListData[0].product_group_id
  2754. this.modalData.productGroupName1 = data.baseListData[0].product_group_name
  2755. return
  2756. }
  2757. }
  2758. })
  2759. }
  2760. this.modalData.productGroupName1 = ''
  2761. },
  2762. // 商品组2输入校验
  2763. productGroupId2Blur (tagNo) {
  2764. if (this.modalData.productGroupId2 != null && this.modalData.productGroupId2 !== '') {
  2765. let tempData = {
  2766. tagno: tagNo,
  2767. conditionSql: " and product_group_id = '" + this.modalData.productGroupId2 + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
  2768. }
  2769. verifyData(tempData).then(({data}) => {
  2770. if (data && data.code === 0) {
  2771. if (data.baseListData.length > 0) {
  2772. this.modalData.productGroupId2 = data.baseListData[0].product_group_id
  2773. this.modalData.productGroupName2 = data.baseListData[0].product_group_name
  2774. return
  2775. }
  2776. }
  2777. })
  2778. }
  2779. this.modalData.productGroupName2 = ''
  2780. },
  2781. // 商品组3输入校验
  2782. productGroupId3Blur (tagNo) {
  2783. if (this.modalData.productGroupId3 != null && this.modalData.productGroupId3 !== '') {
  2784. let tempData = {
  2785. tagno: tagNo,
  2786. conditionSql: " and product_group_id = '" + this.modalData.productGroupId3 + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
  2787. }
  2788. verifyData(tempData).then(({data}) => {
  2789. if (data && data.code === 0) {
  2790. if (data.baseListData.length > 0) {
  2791. this.modalData.productGroupId3 = data.baseListData[0].product_group_id
  2792. this.modalData.productGroupName3 = data.baseListData[0].product_group_name
  2793. return
  2794. }
  2795. }
  2796. })
  2797. }
  2798. this.modalData.productGroupName3 = ''
  2799. },
  2800. // 物料分类输入校验
  2801. partFamilyBlur (tagNo) {
  2802. if (this.modalData.familyID != null && this.modalData.familyID !== '') {
  2803. let tempData = {
  2804. tagno: tagNo,
  2805. conditionSql: " and family_id = '" + this.modalData.familyID + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
  2806. }
  2807. verifyData(tempData).then(({data}) => {
  2808. if (data && data.code === 0) {
  2809. if (data.baseListData.length > 0) {
  2810. this.modalData.familyID = data.baseListData[0].family_id
  2811. this.modalData.familyName = data.baseListData[0].family_name
  2812. return
  2813. }
  2814. }
  2815. })
  2816. }
  2817. this.modalData.familyName = ''
  2818. },
  2819. // 属性输入校验
  2820. modelBlur (tagNo) {
  2821. if (this.modalData.codeNo != null && this.modalData.codeNo !== '') {
  2822. let tempData = {
  2823. tagno: tagNo,
  2824. conditionSql: " and code_no = '" + this.modalData.codeNo + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
  2825. }
  2826. verifyData(tempData).then(({data}) => {
  2827. if (data && data.code === 0) {
  2828. if (data.baseListData.length > 0) {
  2829. this.modalData.codeNo = data.baseListData[0].code_no
  2830. this.modalData.codeDesc = data.baseListData[0].code_desc
  2831. return
  2832. }
  2833. }
  2834. })
  2835. }
  2836. this.modalData.codeDesc = ''
  2837. },
  2838. // ======== chooseList相关方法 ========
  2839. // 获取基础数据列表S
  2840. getBaseList (val, type) {
  2841. this.tagNo = val
  2842. this.tempCodeNo = this.modalData.codeNo
  2843. this.$nextTick(() => {
  2844. let strVal = ''
  2845. let conSql = ''
  2846. if (this.modalData.bu === null || this.modalData.bu === '') {
  2847. this.$message.warning("请选择BU!")
  2848. return
  2849. } else {
  2850. conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
  2851. }
  2852. if (val === 510) {
  2853. strVal = this.modalData.umId2
  2854. conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'"
  2855. } else if (val === 211) {
  2856. strVal = this.modalData.productGroupId1
  2857. } else if (val === 212) {
  2858. strVal = this.modalData.productGroupId2
  2859. } else if (val === 213) {
  2860. strVal = this.modalData.productGroupId3
  2861. } else if (val === 214) {
  2862. strVal = this.modalData.familyID
  2863. } else if (val === 219) {
  2864. strVal = this.modalData.codeNo
  2865. }
  2866. this.$refs.baseList.init(val, strVal, conSql)
  2867. })
  2868. },
  2869. // 列表方法的回调
  2870. getBaseData (val) {
  2871. if (this.tagNo === 510) {
  2872. this.modalData.umId2 = val.UMID
  2873. this.modalData.umName = val.UMName
  2874. } else if (this.tagNo === 211) {
  2875. this.modalData.productGroupId1 = val.product_group_id
  2876. this.modalData.productGroupName1 = val.product_group_name
  2877. } else if (this.tagNo === 212) {
  2878. this.modalData.productGroupId2 = val.product_group_id
  2879. this.modalData.productGroupName2 = val.product_group_name
  2880. } else if (this.tagNo === 213) {
  2881. this.modalData.productGroupId3 = val.product_group_id
  2882. this.modalData.productGroupName3 = val.product_group_name
  2883. } else if (this.tagNo === 214) {
  2884. this.modalData.familyID = val.family_id
  2885. this.modalData.familyName = val.family_name
  2886. } else if (this.tagNo === 219) {
  2887. if (this.modalData.flag === '2') {
  2888. if (val.code_no != this.tempCodeNo) {
  2889. this.$confirm(`更换属性模板将替换下方物料属性数据,请确认?`, '提示', {
  2890. confirmButtonText: '确定',
  2891. cancelButtonText: '取消',
  2892. type: 'warning'
  2893. }).then(() => {
  2894. this.modalData.codeNo = val.code_no
  2895. this.$set(this.modalData, 'codeDesc', val.code_desc)
  2896. }).catch(() => {
  2897. })
  2898. }
  2899. } else {
  2900. this.modalData.codeNo = val.code_no
  2901. this.$set(this.modalData, 'codeDesc', val.code_desc)
  2902. }
  2903. }
  2904. },
  2905. }
  2906. }
  2907. </script>