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.

1759 lines
61 KiB

2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 查询条件 -->
  4. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  5. <el-form-item :label="'物料编码'">
  6. <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
  7. </el-form-item>
  8. <el-form-item :label="'物料描述'">
  9. <el-input v-model="searchData.partDesc" clearable style="width: 210px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="' '">
  12. <el-button @click="getDataList()">查询</el-button>
  13. <el-button type="primary" @click="addModal()">新增</el-button>
  14. <!-- <el-button type="primary" @click="delModal()">删除</el-button>-->
  15. <download-excel
  16. :fields="fields()"
  17. :data="exportData"
  18. type="xls"
  19. :name="exportName"
  20. :header="exportHeader"
  21. :footer="exportFooter"
  22. :fetch="createExportData"
  23. :before-generate="startDownload"
  24. :before-finish="finishDownload"
  25. worksheet="导出信息"
  26. class="el-button el-button--primary el-button--medium">
  27. {{ "导出" }}
  28. </download-excel>
  29. </el-form-item>
  30. </el-form>
  31. <!-- 物料列表 -->
  32. <el-table
  33. :height="height"
  34. :data="dataList"
  35. border
  36. ref="partTable"
  37. :row-style="rowStyle"
  38. @row-click="partClickRow"
  39. @selection-change="selectionPart"
  40. @current-change="changeCurrentRow"
  41. style="width: 100%;">
  42. <el-table-column
  43. type="selection"
  44. header-align="center"
  45. align="center"
  46. width="50">
  47. </el-table-column>
  48. <el-table-column
  49. v-for="(item,index) in columnList" :key="index"
  50. :sortable="item.columnSortable"
  51. :prop="item.columnProp"
  52. :header-align="item.headerAlign"
  53. :show-overflow-tooltip="item.showOverflowTooltip"
  54. :align="item.align"
  55. :fixed="item.fixed === ''?false:item.fixed"
  56. :min-width="item.columnWidth"
  57. :label="item.columnLabel">
  58. <template slot-scope="scope">
  59. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  60. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column
  64. fixed="right"
  65. header-align="center"
  66. align="center"
  67. width="100"
  68. label="操作">
  69. <template slot-scope="scope">
  70. <el-link style="cursor: pointer" @click="updateModal(scope.row)">编辑</el-link>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <selectDiv ref="selectDiv"></selectDiv>
  75. <!-- 分页插件 -->
  76. <el-pagination style="margin-top: 0px"
  77. @size-change="sizeChangeHandle"
  78. @current-change="currentChangeHandle"
  79. :current-page="pageIndex"
  80. :page-sizes="[20, 50, 100, 200, 500]"
  81. :page-size="pageSize"
  82. :total="totalPage"
  83. layout="total, sizes, prev, pager, next, jumper">
  84. </el-pagination>
  85. <!-- 物料新增/编辑模态框 -->
  86. <el-dialog :title="modalData.title" top="29vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="737px">
  87. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  88. <el-form-item label="物料编码" prop="partNo" :rules="rules.partNo">
  89. <el-input v-model="modalData.partNo" clearable style="width: 120px" :disabled="modalDisableFlag"></el-input>
  90. </el-form-item>
  91. <el-form-item label="物料描述" prop="partDesc" :rules="rules.partDesc" style="margin-left: -10px">
  92. <el-input v-model="modalData.partDesc" clearable style="width: 330px"></el-input>
  93. </el-form-item>
  94. <el-form-item style="margin-top: 20px">
  95. <el-checkbox v-model="modalData.conditionCodeUsageDb" true-label="Y">允许条件代码</el-checkbox><br>
  96. <el-checkbox v-model="modalData.multilevelTrackingDb" true-label="Y">多级跟踪</el-checkbox><br>
  97. <el-checkbox v-model="modalData.allowAsNotConsumedDb" true-label="Y">允许为未使用</el-checkbox>
  98. </el-form-item>
  99. <!-- <el-form-item v-if="modalData.flag === '2' && modalData.officialFlag !== 'Y'">-->
  100. <!-- <el-button type="primary" @click="toBecomeOfficialPart" style="margin-top: 62px;margin-left: 10px;width: 110px">转正式物料</el-button>-->
  101. <!-- </el-form-item>-->
  102. </el-form>
  103. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  104. <el-form-item prop="umId" :rules="rules.umId">
  105. <span style="cursor: pointer" slot="label" @click="getBaseList(1007)"><a herf="#">计量单位</a></span>
  106. <el-input v-model="modalData.umId" @blur="umIdBlur(1007)" style="width: 120px"></el-input>
  107. <el-input v-model="modalData.umName" disabled style="width: 330px"></el-input>
  108. </el-form-item>
  109. </el-form>
  110. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  111. <el-form-item>
  112. <span style="cursor: pointer" slot="label" @click="getBaseList(22)"><a herf="#">属性模板</a></span>
  113. <el-input v-model="modalData.codeNo" @blur="codeNoBlur(20)" style="width: 120px"></el-input>
  114. <el-input v-model="modalData.codeDesc" disabled style="width: 330px"></el-input>
  115. </el-form-item>
  116. <el-form-item label="批次/批次跟踪">
  117. <el-select v-model="modalData.lotTrackingCode" style="width: 230px">
  118. <el-option label="Lot Tracking" value="Lot Tracking"></el-option>
  119. <el-option label="Not Lot Tracking" value="Not Lot Tracking"></el-option>
  120. <el-option label="Order Based" value="Order Based"></el-option>
  121. </el-select>
  122. </el-form-item>
  123. </el-form>
  124. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  125. <el-form-item label="净重">
  126. <el-input-number :controls="false" :step="0" v-model="modalData.weightNet" style="width: 120px"></el-input-number>
  127. </el-form-item>
  128. <el-form-item label="净重单位" style="margin-left: -10px">
  129. <dict-data-select v-if="modalFlag" v-model="modalData.uomForWeightNet" style="width: 330px" :use-default-value="false" dict-type="part_uom_for_weight_net"></dict-data-select>
  130. </el-form-item>
  131. <!-- <el-form-item>-->
  132. <!-- <span style="cursor: pointer" slot="label" @click="getBaseList(109)"><a herf="#">物料分组</a></span>-->
  133. <!-- <el-input v-model="modalData.partMainGroup" @blur="groupIdBlur(109)" style="width: 120px"></el-input>-->
  134. <!-- <el-input v-model="modalData.groupName" disabled style="width: 330px"></el-input>-->
  135. <!-- </el-form-item>-->
  136. <el-form-item label="批量规则">
  137. <el-select v-model="modalData.lotQuantityRule" :disabled="modalData.lotTrackingCode === 'Not Lot Tracking'" style="width: 230px">
  138. <el-option label="One Lot Per Production Order" value="One Lot Per Production Order"></el-option>
  139. <el-option label="Many Lots Per Production Order" value="Many Lots Per Production Order"></el-option>
  140. </el-select>
  141. </el-form-item>
  142. </el-form>
  143. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  144. <el-form-item label="体积">
  145. <el-input-number :controls="false" :step="0" v-model="modalData.volumeNet" style="width: 120px"></el-input-number>
  146. </el-form-item>
  147. <el-form-item label="体积单位" style="margin-left: -10px">
  148. <dict-data-select v-if="modalFlag" v-model="modalData.uomForVolumeNet" style="width: 330px" dict-type="part_uom_for_volume_net"></dict-data-select>
  149. </el-form-item>
  150. <el-form-item label="子批次规则">
  151. <el-select v-model="modalData.subLotRule" :disabled="modalData.lotTrackingCode === 'Not Lot Tracking'" style="width: 230px">
  152. <el-option label="Sub Lots Allowed" value="Sub Lots Allowed"></el-option>
  153. <el-option label="No Sub Lots Allowed" value="No Sub Lots Allowed"></el-option>
  154. </el-select>
  155. </el-form-item>
  156. </el-form>
  157. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  158. <el-form-item label="组件批次规则" style="margin-left: 468px">
  159. <el-select v-model="modalData.componentLotRule" :disabled="modalData.lotTrackingCode === 'Not Lot Tracking'" style="width: 230px">
  160. <el-option label="Many Lots Allowed" value="Many Lots Allowed"></el-option>
  161. <el-option label="One Lot Allowed" value="One Lot Allowed"></el-option>
  162. </el-select>
  163. </el-form-item>
  164. </el-form>
  165. <el-footer style="height:35px;margin-top: 25px;text-align:center">
  166. <el-button type="primary" @click="saveData()">保存</el-button>
  167. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  168. </el-footer>
  169. </el-dialog>
  170. <!-- 页签 -->
  171. <el-tabs v-model="activeTable" style="width: 100%" :style="{height: this.secondHeight + 'px'}" type="border-card" @tab-click="tabClick" class="customer-tab">
  172. <!-- 物料属性页签 -->
  173. <el-tab-pane label="物料属性" name="part_item">
  174. <el-form label-position="top" style="margin-top: 2px; margin-left: 2px;">
  175. <el-button type="primary" @click="addOrDelItem">新增</el-button>
  176. <!-- <el-button type="primary" @click="updateItemValue">编辑</el-button>-->
  177. <el-button type="primary" :loading="loading" @click="clickSave">{{ attributeDialog?'编辑':'保存' }}</el-button>
  178. </el-form>
  179. <div class="rq" v-if="attributeDialog">
  180. <el-table
  181. :data="partItemList"
  182. :height="secondHeight - 60"
  183. border
  184. style="width: 100%;">
  185. <el-table-column
  186. v-for="(item,index) in columnItemList" :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. <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
  197. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  198. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  199. </div>
  200. <div v-else>
  201. {{scope.row.textValue?scope.row.textValue:scope.row.numValue}}
  202. </div>
  203. </template>
  204. </el-table-column>
  205. </el-table>
  206. </div>
  207. <div class="rq" v-else>
  208. <el-table
  209. :data="copyAttributeList"
  210. :height="secondHeight - 60"
  211. border
  212. style="width: 100%">
  213. <el-table-column
  214. v-for="(item,index) in columnItemList" :key="index"
  215. :sortable="item.columnSortable"
  216. :prop="item.columnProp"
  217. :header-align="item.headerAlign"
  218. :show-overflow-tooltip="item.showOverflowTooltip"
  219. :align="item.align"
  220. :fixed="item.fixed===''?false:item.fixed"
  221. :min-width="item.columnWidth"
  222. :label="item.columnLabel">
  223. <template slot-scope="scope">
  224. <div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
  225. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  226. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  227. </div>
  228. <div v-else>
  229. <div v-if="scope.row.valueChooseFlag !== 'Y'">
  230. <el-input-number v-model="scope.row.numValue" style="padding: 0;width: 100%" v-if="scope.row.valueTypeDb === 'N'" :controls="false"></el-input-number>
  231. <el-input v-model="scope.row.textValue" v-else></el-input>
  232. </div>
  233. <div v-else>
  234. <el-select style="width: 100%;" v-if="scope.row.valueTypeDb === 'T'" v-model="scope.row.textValue">
  235. <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.list" :key="key"></el-option>
  236. </el-select>
  237. <el-select style="width: 100%;" v-else v-model="scope.row.numValue">
  238. <el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.list" :key="key"></el-option>
  239. </el-select>
  240. </div>
  241. </div>
  242. </template>
  243. </el-table-column>
  244. </el-table>
  245. </div>
  246. </el-tab-pane>
  247. </el-tabs>
  248. <!-- 物料属性值编辑模态框 -->
  249. <el-dialog title="物料属性" :close-on-click-modal="false" v-drag :visible.sync="updateItemModelFlag" width="1000px">
  250. <div class="rq ">
  251. <el-table
  252. :data="updatePartItemList"
  253. height="350px"
  254. border
  255. style="width: 100%;">
  256. <el-table-column
  257. v-for="(item,index) in updateColumnItemList" :key="index"
  258. :sortable="item.columnSortable"
  259. :prop="item.columnProp"
  260. :header-align="item.headerAlign"
  261. :show-overflow-tooltip="item.showOverflowTooltip"
  262. :align="item.align"
  263. :fixed="item.fixed==''?false:item.fixed"
  264. :min-width="item.columnWidth"
  265. :label="item.columnLabel">
  266. <template slot-scope="scope">
  267. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  268. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  269. </template>
  270. </el-table-column>
  271. <el-table-column
  272. prop="textValue"
  273. header-align="center"
  274. align="right"
  275. min-width="80"
  276. label="文本值">
  277. <template slot-scope="scope">
  278. <el-input v-if="scope.row.valueTypeDb === 'T' && scope.row.valueChooseFlag === 'N'" v-model="scope.row.textValue" style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
  279. <el-select v-if="scope.row.valueTypeDb === 'T' && scope.row.valueChooseFlag === 'Y'" v-model="scope.row.textValue" style="width: 180px" placeholder="请选择">
  280. <el-option v-for="item in scope.row.availableValueList" :key="index" :label="item.availableValue" :value="item.availableValue"></el-option>
  281. </el-select>
  282. <el-input v-if="scope.row.valueTypeDb !== 'T'" v-model="scope.row.textValue" disabled style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
  283. </template>
  284. </el-table-column>
  285. <el-table-column
  286. prop="numValue"
  287. header-align="center"
  288. align="right"
  289. min-width="80"
  290. label="数字值">
  291. <template slot-scope="scope">
  292. <el-input v-if="scope.row.valueTypeDb === 'N' && scope.row.valueChooseFlag === 'N'" v-model="scope.row.numValue" style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
  293. <el-select v-if="scope.row.valueTypeDb === 'N' && scope.row.valueChooseFlag === 'Y'" v-model="scope.row.numValue" style="width: 180px" placeholder="请选择">
  294. <el-option v-for="item in scope.row.availableValueList" :key="index" :label="item.availableValue" :value="item.availableValue"></el-option>
  295. </el-select>
  296. <el-input v-if="scope.row.valueTypeDb !== 'N'" v-model="scope.row.numValue" disabled style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
  297. </template>
  298. </el-table-column>
  299. </el-table>
  300. </div>
  301. <span slot="footer" class="dialog-footer">
  302. <el-button type="primary" @click="commitItemValue()">保存</el-button>
  303. <el-button type="primary" @click="updateItemModelFlag=false">关闭</el-button>
  304. </span>
  305. </el-dialog>
  306. <el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="fastAddFlag" width="1000px">
  307. <div style="font-size: 12px">
  308. <el-form :inline="true" label-position="top" :model="itemData">
  309. <el-form-item :label="'属性编码'">
  310. <el-input v-model="itemData.propertiesItemNo" clearable style="width: 120px"></el-input>
  311. </el-form-item>
  312. <el-form-item :label="'属性名称'">
  313. <el-input v-model="itemData.itemDesc" clearable style="width: 150px"></el-input>
  314. </el-form-item>
  315. <el-form-item :label="' '">
  316. <el-button type="primary" @click="queryMasterPartItem()">查询</el-button>
  317. </el-form-item>
  318. </el-form>
  319. </div>
  320. <el-container style="margin-top: 0px;">
  321. <el-main style="width: 350px;padding: 1px">
  322. <span style="font-size: 12px" >可选属性</span>
  323. <el-table
  324. height="400px"
  325. :data="itemList1"
  326. border
  327. ref="itemTable1"
  328. @row-click="itemClickRow1"
  329. @selection-change="selectionItem1"
  330. highlight-current-row
  331. style="width: 100%">
  332. <el-table-column
  333. type="selection"
  334. header-align="center"
  335. align="center"
  336. width="50">
  337. </el-table-column>
  338. <el-table-column
  339. prop="itNo"
  340. header-align="center"
  341. align="center"
  342. min-width="80"
  343. label="属性编码">
  344. </el-table-column>
  345. <el-table-column
  346. prop="itemDesc"
  347. header-align="center"
  348. align="center"
  349. min-width="200"
  350. label="属性名称">
  351. </el-table-column>
  352. </el-table>
  353. </el-main>
  354. <el-main style="width: 10px;padding: 1px">
  355. <div style="margin-top: 200px;margin-left: 18px">
  356. <el-button type="primary" @click="addItem()">添加>></el-button>
  357. </div>
  358. <div style="margin-top: 15px;margin-left: 18px">
  359. <el-button type="primary" @click="deleteItem()">删除<<</el-button>
  360. </div>
  361. </el-main>
  362. <el-main style="width: 350px;padding: 1px">
  363. <span style="font-size: 12px" >已有属性</span>
  364. <el-table
  365. height="400px"
  366. :data="itemList2"
  367. border
  368. ref="itemTable2"
  369. @row-click="itemClickRow2"
  370. @selection-change="selectionItem2"
  371. highlight-current-row
  372. style="width: 100%">
  373. <el-table-column
  374. type="selection"
  375. header-align="center"
  376. align="center"
  377. width="50">
  378. </el-table-column>
  379. <el-table-column
  380. prop="itNo"
  381. header-align="center"
  382. align="center"
  383. min-width="80"
  384. label="属性编码">
  385. </el-table-column>
  386. <el-table-column
  387. prop="itemDesc"
  388. header-align="center"
  389. align="center"
  390. min-width="200"
  391. label="属性名称">
  392. </el-table-column>
  393. </el-table>
  394. </el-main>
  395. </el-container>
  396. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  397. <el-button type="primary" @click="fastAddFlag = false">关闭</el-button>
  398. </el-footer>
  399. </el-dialog>
  400. <!-- chooseList模态框 -->
  401. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  402. </div>
  403. </template>
  404. <script>
  405. import {
  406. masterPartSearch, // 物料信息列表查询
  407. masterPartInformationSave, // 物料信息新增
  408. masterPartInformationEdit, // 物料信息编辑
  409. masterPartInformationDelete, // 物料信息删除
  410. getMasterPartItem, // 查询物料属性
  411. commitItemValue, // 修改物料属性值
  412. getItemLists, // 获取模板属性
  413. addMasterPartItem, // 新增物料属性
  414. deleteMasterPartItem, // 删除物料属性
  415. queryMasterPartItem,
  416. toBecomeOfficialMasterPart, // 转正式物料
  417. } from '@/api/part/masterPartInformation.js'
  418. import {getChooselistData, verifyData} from "@/api/chooselist/chooselist.js"
  419. import {getProjectPartNo} from '@/api/part/partInformation.js'
  420. import Chooselist from '@/views/modules/common/Chooselist'
  421. import DictDataSelect from '../sys/dict-data-select.vue'
  422. export default {
  423. components: {
  424. DictDataSelect,
  425. Chooselist
  426. },
  427. watch: {
  428. searchData: {
  429. deep: true,
  430. handler: function (newV, oldV) {
  431. this.searchData.partNo = this.searchData.partNo.toUpperCase()
  432. }
  433. },
  434. modalData: {
  435. deep: true,
  436. handler: function (newV, oldV) {
  437. this.modalData.partNo = this.modalData.partNo.toUpperCase()
  438. //this.modalData.umId = this.modalData.umId.toUpperCase()
  439. this.modalData.codeNo = this.modalData.codeNo.toUpperCase()
  440. }
  441. },
  442. itemData: {
  443. deep: true,
  444. handler: function (newV, oldV) {
  445. this.itemData.propertiesItemNo = this.itemData.propertiesItemNo.toUpperCase()
  446. }
  447. }
  448. },
  449. data () {
  450. return {
  451. // 导出
  452. exportData: [],
  453. exportName: '物料档案管理' + this.dayjs().format('YYYYMMDDHHmmss'),
  454. exportHeader: ['物料档案管理'],
  455. exportFooter: [],
  456. resultList: [],
  457. // ======== 行高 ========
  458. height: 200,
  459. secondHeight: 200,
  460. // ======== 分页 ========
  461. pageIndex: 1,
  462. pageSize: 50,
  463. totalPage: 0,
  464. selectedDataNum: 0,
  465. tempCodeNo: '',
  466. // 条件查询
  467. searchData: {
  468. site: '*',
  469. partNo: '',
  470. partDesc: '',
  471. page: 1,
  472. limit: 10
  473. },
  474. // 其它
  475. // 初始页签
  476. activeTable: 'part_item',
  477. // ======== 数据对象 ========
  478. modalData: {
  479. flag: '',
  480. site: '',
  481. title: '',
  482. partNo: '',
  483. partDesc: '',
  484. umId: '',
  485. umName: '',
  486. partMainGroup: '',
  487. groupName: '',
  488. weightNet: '',
  489. uomForWeightNet: '',
  490. volumeNet: '',
  491. uomForVolumeNet: '',
  492. codeNo: '',
  493. codeDesc: '',
  494. conditionCodeUsageDb: '',
  495. multilevelTrackingDb: '',
  496. allowAsNotConsumedDb: '',
  497. lotTrackingCode: '',
  498. lotQuantityRule: '',
  499. subLotRule: '',
  500. componentLotRule: '',
  501. createDate: '',
  502. createBy: '',
  503. updateDate: '',
  504. updateBy: '',
  505. officialFlag: ''
  506. },
  507. itemData: {
  508. site: '*',
  509. partNo: '',
  510. propertiesItemNo: '',
  511. codeNo: '',
  512. itemDesc: '',
  513. textValue: '',
  514. numValue: '',
  515. recordType: 'MP'
  516. },
  517. // ======== 数据列表 ========
  518. dataList: [],
  519. partItemList: [],
  520. updatePartItemList: [],
  521. availableValueList:[],
  522. itemSelections1: [],
  523. itemSelections2: [],
  524. itemList1:[],
  525. itemList2:[],
  526. copyAttributeList: [],
  527. // ======== 列表表头 ========
  528. columnList: [
  529. {
  530. userId: this.$store.state.user.name,
  531. functionId: 104001,
  532. serialNumber: '104001Table1PartNo',
  533. tableId: '104001Table1',
  534. tableName: '物料信息表',
  535. columnProp: 'partNo',
  536. headerAlign: 'center',
  537. align: 'center',
  538. columnLabel: '物料编码',
  539. columnHidden: false,
  540. columnImage: false,
  541. columnSortable: false,
  542. sortLv: 0,
  543. status: true,
  544. fixed: '',
  545. columnWidth: 120
  546. },
  547. {
  548. userId: this.$store.state.user.name,
  549. functionId: 104001,
  550. serialNumber: '104001Table1PartDesc',
  551. tableId: '104001Table1',
  552. tableName: '物料信息表',
  553. columnProp: 'partDesc',
  554. headerAlign: 'center',
  555. align: 'left',
  556. columnLabel: '物料描述',
  557. columnHidden: false,
  558. columnImage: false,
  559. columnSortable: false,
  560. sortLv: 0,
  561. status: true,
  562. fixed: '',
  563. columnWidth: 150
  564. },
  565. {
  566. userId: this.$store.state.user.name,
  567. functionId: 104001,
  568. serialNumber: '104001Table1OfficialFlag',
  569. tableId: '104001Table1',
  570. tableName: '物料信息表',
  571. columnProp: 'officialFlagDesc',
  572. headerAlign: 'center',
  573. align: 'center',
  574. columnLabel: '物料状态',
  575. columnHidden: false,
  576. columnImage: false,
  577. columnSortable: false,
  578. sortLv: 0,
  579. status: true,
  580. fixed: '',
  581. columnWidth: 100
  582. },
  583. {
  584. userId: this.$store.state.user.name,
  585. functionId: 104001,
  586. serialNumber: '104001Table1OfficialFlag',
  587. tableId: '104001Table1',
  588. tableName: '物料信息表',
  589. columnProp: 'umId',
  590. headerAlign: 'center',
  591. align: 'left',
  592. columnLabel: '计量单位',
  593. columnHidden: false,
  594. columnImage: false,
  595. columnSortable: false,
  596. sortLv: 0,
  597. status: true,
  598. fixed: '',
  599. columnWidth: 100
  600. },
  601. {
  602. userId: this.$store.state.user.name,
  603. functionId: 104001,
  604. serialNumber: '104001Table1WeightNet',
  605. tableId: '104001Table1',
  606. tableName: '物料信息表',
  607. columnProp: 'weightNet',
  608. headerAlign: 'center',
  609. align: 'right',
  610. columnLabel: '净重',
  611. columnHidden: false,
  612. columnImage: false,
  613. columnSortable: false,
  614. sortLv: 0,
  615. status: true,
  616. fixed: '',
  617. columnWidth: 100
  618. },
  619. {
  620. userId: this.$store.state.user.name,
  621. functionId: 104001,
  622. serialNumber: '104001Table1UomForWeightNet',
  623. tableId: '104001Table1',
  624. tableName: '物料信息表',
  625. columnProp: 'uomForWeightNet',
  626. headerAlign: 'center',
  627. align: 'center',
  628. columnLabel: '净重单位',
  629. columnHidden: false,
  630. columnImage: false,
  631. columnSortable: false,
  632. sortLv: 0,
  633. status: true,
  634. fixed: '',
  635. columnWidth: 100
  636. },
  637. {
  638. userId: this.$store.state.user.name,
  639. functionId: 104001,
  640. serialNumber: '104001Table1VolumeNet',
  641. tableId: '104001Table1',
  642. tableName: '物料信息表',
  643. columnProp: 'volumeNet',
  644. headerAlign: 'center',
  645. align: 'right',
  646. columnLabel: '体积',
  647. columnHidden: false,
  648. columnImage: false,
  649. columnSortable: false,
  650. sortLv: 0,
  651. status: true,
  652. fixed: '',
  653. columnWidth: 100
  654. },
  655. {
  656. userId: this.$store.state.user.name,
  657. functionId: 104001,
  658. serialNumber: '104001Table1UomForVolumeNet',
  659. tableId: '104001Table1',
  660. tableName: '物料信息表',
  661. columnProp: 'uomForVolumeNet',
  662. headerAlign: 'center',
  663. align: 'center',
  664. columnLabel: '体积单位',
  665. columnHidden: false,
  666. columnImage: false,
  667. columnSortable: false,
  668. sortLv: 0,
  669. status: true,
  670. fixed: '',
  671. columnWidth: 100
  672. },
  673. {
  674. userId: this.$store.state.user.name,
  675. functionId: 104001,
  676. serialNumber: '104001Table1GroupName',
  677. tableId: '104001Table1',
  678. tableName: '物料信息表',
  679. columnProp: 'groupName',
  680. headerAlign: 'center',
  681. align: 'center',
  682. columnLabel: '物料分组',
  683. columnHidden: false,
  684. columnImage: false,
  685. columnSortable: false,
  686. sortLv: 0,
  687. status: true,
  688. fixed: '',
  689. columnWidth: 100
  690. },
  691. {
  692. userId: this.$store.state.user.name,
  693. functionId: 104001,
  694. serialNumber: '104001Table1CodeDesc',
  695. tableId: '104001Table1',
  696. tableName: '物料信息表',
  697. columnProp: 'codeDesc',
  698. headerAlign: 'center',
  699. align: 'center',
  700. columnLabel: '属性模板',
  701. columnHidden: false,
  702. columnImage: false,
  703. columnSortable: false,
  704. sortLv: 0,
  705. status: true,
  706. fixed: '',
  707. columnWidth: 100
  708. },
  709. {
  710. userId: this.$store.state.user.name,
  711. functionId: 104001,
  712. serialNumber: '104001Table1ConditionCodeUsageDb',
  713. tableId: '104001Table1',
  714. tableName: '物料信息表',
  715. columnProp: 'conditionCodeUsageDb',
  716. headerAlign: 'center',
  717. align: 'center',
  718. columnLabel: '允许条件代码',
  719. columnHidden: false,
  720. columnImage: false,
  721. columnSortable: false,
  722. sortLv: 0,
  723. status: true,
  724. fixed: '',
  725. columnWidth: 100
  726. },
  727. {
  728. userId: this.$store.state.user.name,
  729. functionId: 104001,
  730. serialNumber: '104001Table1MultilevelTrackingDb',
  731. tableId: '104001Table1',
  732. tableName: '物料信息表',
  733. columnProp: 'multilevelTrackingDb',
  734. headerAlign: 'center',
  735. align: 'center',
  736. columnLabel: '多级跟踪',
  737. columnHidden: false,
  738. columnImage: false,
  739. columnSortable: false,
  740. sortLv: 0,
  741. status: true,
  742. fixed: '',
  743. columnWidth: 100
  744. },
  745. {
  746. userId: this.$store.state.user.name,
  747. functionId: 104001,
  748. serialNumber: '104001Table1AllowAsNotConsumedDb',
  749. tableId: '104001Table1',
  750. tableName: '物料信息表',
  751. columnProp: 'allowAsNotConsumedDb',
  752. headerAlign: 'center',
  753. align: 'center',
  754. columnLabel: '允许为未使用',
  755. columnHidden: false,
  756. columnImage: false,
  757. columnSortable: false,
  758. sortLv: 0,
  759. status: true,
  760. fixed: '',
  761. columnWidth: 100
  762. },
  763. {
  764. userId: this.$store.state.user.name,
  765. functionId: 104001,
  766. serialNumber: '104001Table1LotTrackingCode',
  767. tableId: '104001Table1',
  768. tableName: '物料信息表',
  769. columnProp: 'lotTrackingCode',
  770. headerAlign: 'center',
  771. align: 'center',
  772. columnLabel: '批次/批次跟踪',
  773. columnHidden: false,
  774. columnImage: false,
  775. columnSortable: false,
  776. sortLv: 0,
  777. status: true,
  778. fixed: '',
  779. columnWidth: 120
  780. },
  781. {
  782. userId: this.$store.state.user.name,
  783. functionId: 104001,
  784. serialNumber: '104001Table1LotQuantityRule',
  785. tableId: '104001Table1',
  786. tableName: '物料信息表',
  787. columnProp: 'lotQuantityRule',
  788. headerAlign: 'center',
  789. align: 'center',
  790. columnLabel: '批量规则',
  791. columnHidden: false,
  792. columnImage: false,
  793. columnSortable: false,
  794. sortLv: 0,
  795. status: true,
  796. fixed: '',
  797. columnWidth: 120
  798. },
  799. {
  800. userId: this.$store.state.user.name,
  801. functionId: 104001,
  802. serialNumber: '104001Table1SubLotRule',
  803. tableId: '104001Table1',
  804. tableName: '物料信息表',
  805. columnProp: 'subLotRule',
  806. headerAlign: 'center',
  807. align: 'center',
  808. columnLabel: '子批次规则',
  809. columnHidden: false,
  810. columnImage: false,
  811. columnSortable: false,
  812. sortLv: 0,
  813. status: true,
  814. fixed: '',
  815. columnWidth: 120
  816. },
  817. {
  818. userId: this.$store.state.user.name,
  819. functionId: 104001,
  820. serialNumber: '104001Table1ComponentLotRule',
  821. tableId: '104001Table1',
  822. tableName: '物料信息表',
  823. columnProp: 'componentLotRule',
  824. headerAlign: 'center',
  825. align: 'center',
  826. columnLabel: '组件批次规则',
  827. columnHidden: false,
  828. columnImage: false,
  829. columnSortable: false,
  830. sortLv: 0,
  831. status: true,
  832. fixed: '',
  833. columnWidth: 120
  834. },
  835. {
  836. userId: this.$store.state.user.name,
  837. functionId: 104001,
  838. serialNumber: '104001Table1CreateDate',
  839. tableId: '104001Table1',
  840. tableName: '物料信息表',
  841. columnProp: 'createDate',
  842. headerAlign: 'center',
  843. align: 'center',
  844. columnLabel: '创建时间',
  845. columnHidden: false,
  846. columnImage: false,
  847. columnSortable: false,
  848. sortLv: 0,
  849. status: true,
  850. fixed: '',
  851. columnWidth: 160
  852. },
  853. {
  854. userId: this.$store.state.user.name,
  855. functionId: 104001,
  856. serialNumber: '104001Table1CreateBy',
  857. tableId: '104001Table1',
  858. tableName: '物料信息表',
  859. columnProp: 'createBy',
  860. headerAlign: 'center',
  861. align: 'center',
  862. columnLabel: '创建人',
  863. columnHidden: false,
  864. columnImage: false,
  865. columnSortable: false,
  866. sortLv: 0,
  867. status: true,
  868. fixed: '',
  869. columnWidth: 80
  870. },
  871. {
  872. userId: this.$store.state.user.name,
  873. functionId: 104001,
  874. serialNumber: '104001Table1UpdateDate',
  875. tableId: '104001Table1',
  876. tableName: '物料信息表',
  877. columnProp: 'updateDate',
  878. headerAlign: 'center',
  879. align: 'center',
  880. columnLabel: '更新时间',
  881. columnHidden: false,
  882. columnImage: false,
  883. columnSortable: false,
  884. sortLv: 0,
  885. status: true,
  886. fixed: '',
  887. columnWidth: 160
  888. },
  889. {
  890. userId: this.$store.state.user.name,
  891. functionId: 104001,
  892. serialNumber: '104001Table1UpdateBy',
  893. tableId: '104001Table1',
  894. tableName: '物料信息表',
  895. columnProp: 'updateBy',
  896. headerAlign: 'center',
  897. align: 'center',
  898. columnLabel: '更新人',
  899. columnHidden: false,
  900. columnImage: false,
  901. columnSortable: false,
  902. sortLv: 0,
  903. status: true,
  904. fixed: '',
  905. columnWidth: 80
  906. }
  907. ],
  908. columnItemList: [
  909. {
  910. userId: this.$store.state.user.name,
  911. functionId: 104001,
  912. serialNumber: '104001Table2PropertiesItemID',
  913. tableId: "104001Table2",
  914. tableName: "物料属性表",
  915. columnProp: 'propertiesItemNo',
  916. headerAlign: "center",
  917. align: "center",
  918. columnLabel: '属性编码',
  919. columnHidden: false,
  920. columnImage: false,
  921. columnSortable: true,
  922. sortLv: 0,
  923. status: true,
  924. fixed: '',
  925. columnWidth: 100,
  926. },
  927. {
  928. userId: this.$store.state.user.name,
  929. functionId: 104001,
  930. serialNumber: '104001Table2PropertiesItemDesc',
  931. tableId: "104001Table2",
  932. tableName: "物料属性表",
  933. columnProp: 'itemDesc',
  934. headerAlign: "center",
  935. align: "left",
  936. columnLabel: '属性名称',
  937. columnHidden: false,
  938. columnImage: false,
  939. columnSortable: true,
  940. sortLv: 0,
  941. status: true,
  942. fixed: '',
  943. columnWidth: 120,
  944. },
  945. {
  946. userId: this.$store.state.user.name,
  947. functionId: 104001,
  948. serialNumber: '104001Table2ValueType',
  949. tableId: "104001Table2",
  950. tableName: "物料属性表",
  951. columnProp: 'valueType',
  952. headerAlign: "center",
  953. align: "center",
  954. columnLabel: '属性类型',
  955. columnHidden: false,
  956. columnImage: false,
  957. columnSortable: true,
  958. sortLv: 0,
  959. status: true,
  960. fixed: '',
  961. columnWidth: 100,
  962. },
  963. {
  964. userId: this.$store.state.user.name,
  965. functionId: 104001,
  966. serialNumber: '104001Table2ValueChooseFlag',
  967. tableId: "104001Table2",
  968. tableName: "物料属性表",
  969. columnProp: 'textValue',
  970. headerAlign: "center",
  971. align: "left",
  972. columnLabel: '属性值',
  973. columnHidden: false,
  974. columnImage: false,
  975. columnSortable: true,
  976. sortLv: 0,
  977. status: true,
  978. fixed: '',
  979. columnWidth: 100,
  980. },
  981. // {
  982. // userId: this.$store.state.user.name,
  983. // functionId: 104001,
  984. // serialNumber: '104001Table2ValueChooseFlag',
  985. // tableId: "104001Table2",
  986. // tableName: "物料属性表",
  987. // columnProp: 'numValue',
  988. // headerAlign: "center",
  989. // align: "center",
  990. // columnLabel: '数字值',
  991. // columnHidden: false,
  992. // columnImage: false,
  993. // columnSortable: true,
  994. // sortLv: 0,
  995. // status: true,
  996. // fixed: '',
  997. // columnWidth: 70,
  998. // },
  999. ],
  1000. updateColumnItemList: [
  1001. {
  1002. userId: this.$store.state.user.name,
  1003. functionId: 104001,
  1004. serialNumber: '104001Table6PropertiesItemID',
  1005. tableId: "104001Table6",
  1006. tableName: "物料属性表",
  1007. columnProp: 'propertiesItemNo',
  1008. headerAlign: "center",
  1009. align: "center",
  1010. columnLabel: '属性编码',
  1011. columnHidden: false,
  1012. columnImage: false,
  1013. columnSortable: true,
  1014. sortLv: 0,
  1015. status: true,
  1016. fixed: '',
  1017. columnWidth: 90,
  1018. },
  1019. {
  1020. userId: this.$store.state.user.name,
  1021. functionId: 104001,
  1022. serialNumber: '104001Table6PropertiesItemDesc',
  1023. tableId: "104001Table6",
  1024. tableName: "物料属性表",
  1025. columnProp: 'itemDesc',
  1026. headerAlign: "center",
  1027. align: "center",
  1028. columnLabel: '属性名称',
  1029. columnHidden: false,
  1030. columnImage: false,
  1031. columnSortable: true,
  1032. sortLv: 0,
  1033. status: true,
  1034. fixed: '',
  1035. columnWidth: 90,
  1036. },
  1037. {
  1038. userId: this.$store.state.user.name,
  1039. functionId: 104001,
  1040. serialNumber: '104001Table6ValueType',
  1041. tableId: "104001Table6",
  1042. tableName: "物料属性表",
  1043. columnProp: 'valueType',
  1044. headerAlign: "center",
  1045. align: "center",
  1046. columnLabel: '属性类型',
  1047. columnHidden: false,
  1048. columnImage: false,
  1049. columnSortable: true,
  1050. sortLv: 0,
  1051. status: true,
  1052. fixed: '',
  1053. columnWidth: 70,
  1054. },
  1055. ],
  1056. // ======== 必填规则 ========
  1057. rules: {
  1058. partNo: [
  1059. {
  1060. required: true,
  1061. message: ' ',
  1062. trigger: 'change'
  1063. }
  1064. ],
  1065. partDesc: [
  1066. {
  1067. required: true,
  1068. message: ' ',
  1069. trigger: 'change'
  1070. }
  1071. ],
  1072. umId: [
  1073. {
  1074. required: true,
  1075. message: ' ',
  1076. trigger: 'change'
  1077. }
  1078. ],
  1079. codeDesc: [
  1080. {
  1081. required: true,
  1082. message: ' ',
  1083. trigger: 'change'
  1084. }
  1085. ]
  1086. },
  1087. // ======== 复选数据集 ========
  1088. partSelections: [],
  1089. // ======== 选中的当前行数据 ========
  1090. partCurrentRow: {},
  1091. // ======== 模态框开关控制 ========
  1092. modalFlag: false,
  1093. modalDisableFlag: false,
  1094. itemChooseFlag: false,
  1095. itemTextDisableFlag: false,
  1096. itemNumberDisableFlag: false,
  1097. itemModalDisableFlag: false,
  1098. itemModalFlag: false,
  1099. agentModelFlag: false,
  1100. manufacturerModelFlag: false,
  1101. updateItemModelFlag: false,
  1102. fastAddFlag: false,
  1103. loading: false,
  1104. attributeDialog: true,
  1105. }
  1106. },
  1107. mounted () {
  1108. this.$nextTick(() => {
  1109. this.height = window.innerHeight / 2 - 30
  1110. /*第二个表格高度的动态调整*/
  1111. this.secondHeight = window.innerHeight - this.height - 175
  1112. })
  1113. },
  1114. created () {
  1115. this.getDataList()
  1116. },
  1117. methods: {
  1118. focusNextInput (index, type) {
  1119. let aaa = ''
  1120. if (this.updatePartItemList.length - 1 === index) {
  1121. aaa = `${type}0`
  1122. } else {
  1123. aaa = `${type}${index + 1}`
  1124. }
  1125. this.$nextTick(() => {
  1126. this.$refs[aaa].focus()
  1127. })
  1128. },
  1129. clickSave () {
  1130. if (!this.attributeDialog) { // 保存
  1131. this.updateItemValue()
  1132. } else { // 编辑
  1133. this.copyAttributeList = JSON.parse(JSON.stringify(this.partItemList))
  1134. this.attributeDialog = false
  1135. }
  1136. },
  1137. // 编辑物料属性
  1138. updateItemValue () {
  1139. this.loading = true
  1140. let tempData = {
  1141. itemList: JSON.parse(JSON.stringify(this.copyAttributeList))
  1142. }
  1143. commitItemValue(tempData).then(({data}) => {
  1144. if (data && data.code === 0) {
  1145. this.getMasterPartItem()
  1146. this.attributeDialog = true
  1147. this.$message({
  1148. message: '操作成功',
  1149. type: 'success',
  1150. duration: 1500,
  1151. onClose: () => {}
  1152. })
  1153. } else {
  1154. this.$alert(data.msg, '错误', {
  1155. confirmButtonText: '确定'
  1156. })
  1157. }
  1158. this.loading = false
  1159. }).catch((error) => {
  1160. this.$message.error(error)
  1161. this.loading = false
  1162. })
  1163. },
  1164. // 新增/删除物料属性
  1165. addOrDelItem () {
  1166. if (!this.attributeDialog) {
  1167. this.$message.warning('请保存更改!')
  1168. return
  1169. }
  1170. this.itemSelections1 = null
  1171. this.itemSelections2 = null
  1172. this.itemData.propertiesItemNo = ''
  1173. this.itemData.itemDesc = ''
  1174. let tempData = {
  1175. site: '*',
  1176. partNo: this.partCurrentRow.partNo,
  1177. codeNo: this.partCurrentRow.codeNo,
  1178. recordType: 'MP'
  1179. }
  1180. getItemLists(tempData).then(({data}) => {
  1181. this.itemList1 = data.rows.row1
  1182. this.itemList2 = data.rows.row2
  1183. })
  1184. this.fastAddFlag = true
  1185. },
  1186. // 可选属性
  1187. itemClickRow1 (row) {
  1188. this.$refs.itemTable1.toggleRowSelection(row)
  1189. },
  1190. // 已有属性
  1191. itemClickRow2 (row) {
  1192. this.$refs.itemTable2.toggleRowSelection(row)
  1193. },
  1194. selectionItem1 (val) {
  1195. this.itemSelections1 = val
  1196. },
  1197. selectionItem2 (val) {
  1198. this.itemSelections2 = val
  1199. },
  1200. // 物料项目新增
  1201. addItem () {
  1202. if (this.itemSelections1 == null || this.itemSelections1.length === 0) {
  1203. this.$message.warning('请选择可选属性!')
  1204. return
  1205. }
  1206. let inData = {
  1207. site: '*',
  1208. partNo: this.partCurrentRow.partNo,
  1209. codeNo: this.partCurrentRow.codeNo,
  1210. codeDesc: this.partCurrentRow.codeDesc,
  1211. recordType: 'MP',
  1212. itemList: this.itemSelections1
  1213. }
  1214. addMasterPartItem(inData).then(({data}) => {
  1215. if (data && data.code === 0) {
  1216. getItemLists(inData).then(({data}) => {
  1217. this.itemList1 = data.rows.row1
  1218. this.itemList2 = data.rows.row2
  1219. })
  1220. this.getMasterPartItem()
  1221. this.itemSelections1 = []
  1222. } else {
  1223. this.$alert(data.msg, '错误', {
  1224. confirmButtonText: '确定'
  1225. })
  1226. }
  1227. })
  1228. },
  1229. // 物料项目删除
  1230. deleteItem () {
  1231. if (this.itemSelections2 == null || this.itemSelections2.length === 0) {
  1232. this.$alert("请选择已有属性!", '提示', {
  1233. confirmButtonText: '确定'
  1234. })
  1235. return false
  1236. }
  1237. let inData = {
  1238. site: '*',
  1239. partNo: this.partCurrentRow.partNo,
  1240. codeNo: this.partCurrentRow.codeNo,
  1241. codeDesc: this.partCurrentRow.codeDesc,
  1242. recordType: 'MP',
  1243. itemList: this.itemSelections2
  1244. }
  1245. deleteMasterPartItem(inData).then(({data}) => {
  1246. if (data && data.code === 0) {
  1247. getItemLists(inData).then(({data}) => {
  1248. this.itemList1 = data.rows.row1
  1249. this.itemList2 = data.rows.row2
  1250. })
  1251. this.getMasterPartItem()
  1252. this.itemSelections2 = []
  1253. } else {
  1254. this.$alert(data.msg, '错误', {
  1255. confirmButtonText: '确定'
  1256. })
  1257. }
  1258. })
  1259. },
  1260. // 查询物料项目
  1261. queryMasterPartItem () {
  1262. this.itemData.partNo = this.partCurrentRow.partNo
  1263. this.itemData.codeNo = this.partCurrentRow.codeNo
  1264. this.itemData.partNo = this.partCurrentRow.partNo
  1265. queryMasterPartItem(this.itemData).then(({data}) => {
  1266. if (data && data.code === 0) {
  1267. this.itemList1 = data.rows
  1268. } else {
  1269. this.itemList1 = []
  1270. }
  1271. })
  1272. },
  1273. // 确认修改物料属性
  1274. commitItemValue () {
  1275. let tempData = {
  1276. itemList: JSON.parse(JSON.stringify(this.updatePartItemList))
  1277. }
  1278. commitItemValue(tempData).then(({data}) => {
  1279. if (data && data.code === 0) {
  1280. this.getMasterPartItem()
  1281. this.updateItemModelFlag = false
  1282. this.$message({
  1283. message: '操作成功',
  1284. type: 'success',
  1285. duration: 1500,
  1286. onClose: () => {}
  1287. })
  1288. } else {
  1289. this.$alert(data.msg, '错误', {
  1290. confirmButtonText: '确定'
  1291. })
  1292. }
  1293. })
  1294. },
  1295. // ======== 分页相关方法 ========
  1296. // 每页数
  1297. sizeChangeHandle (val) {
  1298. this.pageSize = val
  1299. this.pageIndex = 1
  1300. this.getDataList()
  1301. },
  1302. // 当前页
  1303. currentChangeHandle (val) {
  1304. this.pageIndex = val
  1305. this.getDataList()
  1306. },
  1307. // ======== 页签切换相关方法 ========
  1308. // 列表表格选择替换
  1309. tabClick (tab, event) {
  1310. // 刷新列表数据
  1311. this.refreshCurrentTabTable()
  1312. },
  1313. // 当前值发生变化的时候修改
  1314. changeCurrentRow (row, oldRow) {
  1315. // 判断是否是获取焦点的事件
  1316. if (row) {
  1317. this.partCurrentRow = JSON.parse(JSON.stringify(row))
  1318. // 刷新当前页表
  1319. this.refreshCurrentTabTable()
  1320. }
  1321. },
  1322. // 刷新页签的table数据
  1323. refreshCurrentTabTable () {
  1324. if (this.activeTable === 'part_item') {
  1325. this.getMasterPartItem()
  1326. }
  1327. },
  1328. // ======== 列表数据刷新方法 ========
  1329. // 查询物料属性
  1330. getMasterPartItem () {
  1331. let tempData = {
  1332. site: '*',
  1333. partNo: this.partCurrentRow.partNo,
  1334. codeNo: this.partCurrentRow.codeNo,
  1335. recordType: 'MP'
  1336. }
  1337. getMasterPartItem(tempData).then(({data}) => {
  1338. if (data && data.code === 0) {
  1339. this.partItemList = data.rows
  1340. } else {
  1341. this.partItemList = []
  1342. }
  1343. })
  1344. },
  1345. // ======== 列表数据刷新方法 ========
  1346. // 获取数据列表
  1347. getDataList () {
  1348. this.searchData.site = this.$store.state.user.site
  1349. this.searchData.limit = this.pageSize
  1350. this.searchData.page = this.pageIndex
  1351. masterPartSearch(this.searchData).then(({data}) => {
  1352. if (data.code === 0) {
  1353. this.dataList = data.page.list
  1354. this.pageIndex = data.page.currPage
  1355. this.pageSize = data.page.pageSize
  1356. this.totalPage = data.page.totalCount
  1357. this.$refs.selectDiv.setLengthAll( this.dataList.length)
  1358. // 判断是否全部存在数据
  1359. if (this.dataList.length > 0) {
  1360. // 设置选中行
  1361. this.$refs.partTable.setCurrentRow(this.dataList[0])
  1362. this.partClickRow(this.dataList[0])
  1363. } else {
  1364. this.partCurrentRow = {}
  1365. }
  1366. // 加载当前的页签的table
  1367. this.refreshCurrentTabTable()
  1368. }
  1369. })
  1370. },
  1371. // ======== 新增/编辑模态框 ========
  1372. // 物料信息新增模态框
  1373. addModal () {
  1374. getProjectPartNo(this.searchData).then(({data}) => {
  1375. if (data && data.code === 0) {
  1376. this.modalData = {
  1377. flag: '1',
  1378. site: '*',
  1379. title: '物料新增',
  1380. partNo: data.partNo,
  1381. partDesc: '',
  1382. umId: '',
  1383. umName: '',
  1384. partMainGroup: '',
  1385. groupName: '',
  1386. weightNet: '',
  1387. uomForWeightNet: '',
  1388. volumeNet: '',
  1389. uomForVolumeNet: '',
  1390. codeNo: '',
  1391. codeDesc: '',
  1392. conditionCodeUsageDb: '',
  1393. multilevelTrackingDb: '',
  1394. allowAsNotConsumedDb: '',
  1395. lotTrackingCode: 'Not Lot Tracking',
  1396. lotQuantityRule: 'One Lot Per Production Order',
  1397. subLotRule: 'No Sub Lots Allowed',
  1398. componentLotRule: 'Many Lots Allowed',
  1399. createBy: this.$store.state.user.name,
  1400. officialFlag: 'N'
  1401. }
  1402. this.modalDisableFlag = false
  1403. this.modalFlag = true
  1404. } else {
  1405. this.$message.error(data.msg)
  1406. }
  1407. })
  1408. },
  1409. // 物料信息编辑模态框
  1410. updateModal (row) {
  1411. this.modalData = {
  1412. flag: '2',
  1413. title: '物料编辑',
  1414. site: '*',
  1415. partNo: row.partNo,
  1416. partDesc: row.partDesc,
  1417. umId: row.umId,
  1418. umName: row.umName,
  1419. partMainGroup: row.partMainGroup,
  1420. groupName: row.groupName,
  1421. weightNet: row.weightNet,
  1422. uomForWeightNet: row.uomForWeightNet,
  1423. volumeNet: row.volumeNet,
  1424. uomForVolumeNet: row.uomForVolumeNet,
  1425. codeNo: row.codeNo,
  1426. codeDesc: row.codeDesc,
  1427. conditionCodeUsageDb: row.conditionCodeUsageDb,
  1428. multilevelTrackingDb: row.multilevelTrackingDb,
  1429. allowAsNotConsumedDb: row.allowAsNotConsumedDb,
  1430. lotTrackingCode: row.lotTrackingCode,
  1431. lotQuantityRule: row.lotQuantityRule,
  1432. subLotRule: row.subLotRule,
  1433. componentLotRule: row.componentLotRule,
  1434. updateBy: this.$store.state.user.name,
  1435. officialFlag: row.officialFlag
  1436. }
  1437. this.modalDisableFlag = true
  1438. this.modalFlag = true
  1439. },
  1440. // ======== 新增/编辑/删除方法 ========
  1441. // 物料信息新增/编辑
  1442. saveData () {
  1443. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1444. this.$message.warning('请填写物料编码!')
  1445. return
  1446. }
  1447. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  1448. this.$message.warning('请填写物料描述!')
  1449. return
  1450. }
  1451. if (this.modalData.umId === '' || this.modalData.umId == null) {
  1452. this.$message.warning('请选择计量单位!')
  1453. return
  1454. }
  1455. if (this.modalData.flag === '1') {
  1456. masterPartInformationSave(this.modalData).then(({data}) => {
  1457. if (data && data.code === 0) {
  1458. this.getDataList()
  1459. this.modalFlag = false
  1460. this.$message({
  1461. message: '操作成功',
  1462. type: 'success',
  1463. duration: 1500,
  1464. onClose: () => {}
  1465. })
  1466. } else {
  1467. this.$alert(data.msg, '错误', {
  1468. confirmButtonText: '确定'
  1469. })
  1470. }
  1471. })
  1472. } else {
  1473. masterPartInformationEdit(this.modalData).then(({data}) => {
  1474. if (data && data.code === 0) {
  1475. this.getDataList()
  1476. this.modalFlag = false
  1477. this.$message({
  1478. message: '操作成功',
  1479. type: 'success',
  1480. duration: 1500,
  1481. onClose: () => {}
  1482. })
  1483. } else {
  1484. this.$alert(data.msg, '错误', {
  1485. confirmButtonText: '确定'
  1486. })
  1487. }
  1488. })
  1489. }
  1490. },
  1491. // 物料信息删除
  1492. delModal () {
  1493. if (this.partSelections.length === 0) {
  1494. this.$message.warning('请勾选要删除的物料信息!')
  1495. return
  1496. }
  1497. this.$confirm(`是否删除这 `+ this.partSelections.length +` 条物料信息?`, '提示', {
  1498. confirmButtonText: '确定',
  1499. cancelButtonText: '取消',
  1500. type: 'warning'
  1501. }).then(() => {
  1502. let tempData = {
  1503. informationList: this.partSelections
  1504. }
  1505. masterPartInformationDelete(tempData).then(({data}) => {
  1506. if (data && data.code === 0) {
  1507. this.getDataList()
  1508. this.partSelections = []
  1509. this.$message({
  1510. message: '操作成功',
  1511. type: 'success',
  1512. duration: 1500,
  1513. onClose: () => {}
  1514. })
  1515. } else {
  1516. this.$alert(data.msg, '错误', {
  1517. confirmButtonText: '确定'
  1518. })
  1519. }
  1520. })
  1521. })
  1522. },
  1523. // ======== 列表操作方法 ========
  1524. // 单机选中物料信息
  1525. partClickRow (row) {
  1526. // this.$refs.partTable.toggleRowSelection(row)
  1527. this.partCurrentRow = JSON.parse(JSON.stringify(row))
  1528. },
  1529. // 复选物料信息
  1530. selectionPart (val) {
  1531. this.partSelections = val
  1532. this.$refs.selectDiv.setLengthselected(this.partSelections.length)
  1533. },
  1534. // 转正式物料
  1535. toBecomeOfficialPart () {
  1536. toBecomeOfficialMasterPart(this.modalData).then(({data}) => {
  1537. if (data && data.code === 0) {
  1538. this.getDataList()
  1539. this.modalFlag = false
  1540. this.$message({
  1541. message: '操作成功',
  1542. type: 'success',
  1543. duration: 1500,
  1544. onClose: () => {}
  1545. })
  1546. } else {
  1547. this.$alert(data.msg, '错误', {
  1548. confirmButtonText: '确定'
  1549. })
  1550. }
  1551. })
  1552. },
  1553. // ======== chooseList相关方法 ========
  1554. // 获取基础数据列表S
  1555. getBaseList (val, type) {
  1556. this.tagNo = val
  1557. this.tempCodeNo = this.modalData.codeNo
  1558. this.$nextTick(() => {
  1559. let strVal = ''
  1560. if (val === 1007) {
  1561. strVal = this.modalData.umId
  1562. } else if (val === 109) {
  1563. strVal = this.modalData.partMainGroup
  1564. } else if (val === 22) {
  1565. strVal = this.modalData.codeNo
  1566. }
  1567. this.$refs.baseList.init(val, strVal)
  1568. })
  1569. },
  1570. // 列表方法的回调
  1571. getBaseData (val) {
  1572. if (this.tagNo === 1007) {
  1573. this.modalData.umId = val.um_id
  1574. this.modalData.umName = val.um_name
  1575. } else if (this.tagNo === 109) {
  1576. this.modalData.partMainGroup = val.group_id
  1577. this.modalData.groupName = val.group_name
  1578. } else if (this.tagNo === 22) {
  1579. if (this.modalData.flag === '2') {
  1580. if (val.Code_no != this.tempCodeNo) {
  1581. this.$confirm(`更换属性模板将替换下方物料属性数据,请确认?`, '提示', {
  1582. confirmButtonText: '确定',
  1583. cancelButtonText: '取消',
  1584. type: 'warning'
  1585. }).then(() => {
  1586. this.modalData.codeNo = val.Code_no
  1587. this.$set(this.modalData, 'codeDesc', val.Code_desc)
  1588. }).catch(() => {
  1589. })
  1590. }
  1591. } else {
  1592. this.modalData.codeNo = val.Code_no
  1593. this.$set(this.modalData, 'codeDesc', val.Code_desc)
  1594. }
  1595. }
  1596. },
  1597. // 计量单位输入校验
  1598. umIdBlur (tagNo) {
  1599. if (this.modalData.umId != null && this.modalData.umId !== '') {
  1600. let tempData = {
  1601. tagno: tagNo,
  1602. conditionSql: " and um_id = '" + this.modalData.umId + "'"
  1603. }
  1604. verifyData(tempData).then(({data}) => {
  1605. if (data && data.code === 0) {
  1606. if (data.baseListData.length > 0) {
  1607. this.modalData.umId = data.baseListData[0].um_id
  1608. this.modalData.umName = data.baseListData[0].um_name
  1609. return
  1610. }
  1611. }
  1612. })
  1613. }
  1614. this.modalData.umName = ''
  1615. },
  1616. // 产品代码输入校验
  1617. groupIdBlur (tagNo) {
  1618. if (this.modalData.partMainGroup != null && this.modalData.partMainGroup !== '') {
  1619. let tempData = {
  1620. tagno: tagNo,
  1621. conditionSql: " and group_id = '" + this.modalData.partMainGroup + "'"
  1622. }
  1623. verifyData(tempData).then(({data}) => {
  1624. if (data && data.code === 0) {
  1625. if (data.baseListData.length > 0) {
  1626. this.modalData.partMainGroup = data.baseListData[0].group_id
  1627. this.modalData.groupName = data.baseListData[0].group_name
  1628. return
  1629. }
  1630. }
  1631. })
  1632. }
  1633. this.modalData.groupName = ''
  1634. },
  1635. // 属性模板输入校验
  1636. codeNoBlur (tagNo) {
  1637. if (this.modalData.codeNo != null && this.modalData.codeNo !== '') {
  1638. let tempData = {
  1639. tagno: tagNo,
  1640. conditionSql: " and Code_no = '" + this.modalData.codeNo + "'"
  1641. }
  1642. verifyData(tempData).then(({data}) => {
  1643. if (data && data.code === 0) {
  1644. if (data.baseListData.length > 0) {
  1645. this.modalData.codeNo = data.baseListData[0].Code_no
  1646. this.modalData.codeDesc = data.baseListData[0].Code_desc
  1647. return
  1648. }
  1649. }
  1650. })
  1651. }
  1652. this.modalData.codeDesc = ''
  1653. },
  1654. // ======== 导出相关方法 ========
  1655. // 导出excel
  1656. async createExportData () {
  1657. this.searchData.limit = -1
  1658. this.searchData.page = 1
  1659. await masterPartSearch(this.searchData).then(({data}) => {
  1660. this.resultList = data.page.list
  1661. })
  1662. return this.resultList
  1663. },
  1664. startDownload () {},
  1665. finishDownload () {},
  1666. fields () {
  1667. let json = '{'
  1668. this.columnList.forEach((item, index) => {
  1669. if (index == this.columnList.length - 1) {
  1670. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  1671. } else {
  1672. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  1673. }
  1674. })
  1675. json += '}'
  1676. let s = eval('(' + json + ')')
  1677. return s
  1678. },
  1679. rowStyle ({row}) {
  1680. if (this.partCurrentRow.partNo === row.partNo) {
  1681. return { 'background-color': '#E8F7F6', cursor: 'pointer' };
  1682. }
  1683. },
  1684. }
  1685. }
  1686. </script>
  1687. <style scoped lang="scss">
  1688. /deep/ .customer-tab .el-tabs__content {
  1689. padding: 0px !important;
  1690. height: 459px;
  1691. }
  1692. /deep/ .customer-tab .el-tabs__content {
  1693. height: 294px;
  1694. }
  1695. .numInput /deep/ .el-input__inner{
  1696. text-align: right;
  1697. }
  1698. /deep/ .inlineNumber input::-webkit-outer-spin-button,
  1699. /deep/ .inlineNumber input::-webkit-inner-spin-button {
  1700. -webkit-appearance: none;
  1701. }
  1702. /deep/ .inlineNumber input[type="number"]{
  1703. -moz-appearance: textfield;
  1704. padding-right: 5px !important;
  1705. }
  1706. </style>