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.

1967 lines
65 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
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="'ERP物料编码'">
  9. <el-input v-model="searchData.erpPartNo" clearable style="width: 120px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'录入时间'">
  12. <el-date-picker
  13. style="width: 120px"
  14. v-model="searchData.startDate"
  15. type="date"
  16. value-format="yyyy-MM-dd"
  17. placeholder="选择日期">
  18. </el-date-picker>
  19. </el-form-item>
  20. <el-form-item style="margin-top: 23px;">
  21. <laber style="margin-left: 0px;font-size: 19px">&#10142</laber>
  22. </el-form-item>
  23. <el-form-item :label="' '">
  24. <el-date-picker
  25. style="width: 120px"
  26. v-model="searchData.endDate"
  27. type="date"
  28. value-format="yyyy-MM-dd"
  29. placeholder="选择日期">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item :label="'材料描述'">
  33. <el-input v-model="searchData.partDesc" clearable style="width: 120px"></el-input>
  34. </el-form-item>
  35. <el-form-item :label="'材料规格型号'">
  36. <el-input v-model="searchData.spec" clearable style="width: 120px"></el-input>
  37. </el-form-item>
  38. <el-form-item :label="' '">
  39. <el-button @click="getDataList()">查询</el-button>
  40. <el-button type="primary" @click="addModal()">新增</el-button>
  41. <el-button type="primary" @click="delModal()">删除</el-button>
  42. <download-excel
  43. :fields="fields()"
  44. :data="exportData"
  45. type="xls"
  46. :name="exportName"
  47. :header="exportHeader"
  48. :footer="exportFooter"
  49. :fetch="createExportData"
  50. :before-generate="startDownload"
  51. :before-finish="finishDownload"
  52. worksheet="导出信息"
  53. class="el-button el-button--primary el-button--medium">
  54. {{ "导出" }}
  55. </download-excel>
  56. </el-form-item>
  57. </el-form>
  58. <!-- 材料列表 -->
  59. <el-table
  60. :height="height"
  61. :data="dataList"
  62. border
  63. ref="partTable"
  64. @row-click="partClickRow"
  65. @selection-change="selectionPart"
  66. @current-change="changeCurrentRow"
  67. v-loading="dataListLoading"
  68. style="width: 100%;">
  69. <el-table-column
  70. type="selection"
  71. header-align="center"
  72. align="center"
  73. :selectable="selectFlag"
  74. width="50">
  75. </el-table-column>
  76. <el-table-column
  77. v-for="(item,index) in columnList" :key="index"
  78. :sortable="item.columnSortable"
  79. :prop="item.columnProp"
  80. :header-align="item.headerAlign"
  81. :show-overflow-tooltip="item.showOverflowTooltip"
  82. :align="item.align"
  83. :fixed="item.fixed === ''?false:item.fixed"
  84. :min-width="item.columnWidth"
  85. :label="item.columnLabel">
  86. <template slot-scope="scope">
  87. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  88. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column
  92. fixed="right"
  93. header-align="center"
  94. align="center"
  95. width="100"
  96. label="操作">
  97. <template slot-scope="scope">
  98. <a type="text" size="small" @click="updateModal(scope.row)">编辑</a>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <selectDiv ref="selectDiv"></selectDiv>
  103. <!-- 分页插件 -->
  104. <el-pagination style="margin-top: 0px"
  105. @size-change="sizeChangeHandle"
  106. @current-change="currentChangeHandle"
  107. :current-page="pageIndex"
  108. :page-sizes="[20, 50, 100, 200, 500]"
  109. :page-size="pageSize"
  110. :total="totalPage"
  111. layout="total, sizes, prev, pager, next, jumper">
  112. </el-pagination>
  113. <!-- 材料新增/编辑模态框 -->
  114. <el-dialog :title="modalData.title" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="495px">
  115. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  116. <el-form-item label="材料描述" prop="partDesc" :rules="rules.partDesc">
  117. <el-input v-model="modalData.partDesc" style="width: 221px"></el-input>
  118. </el-form-item>
  119. <el-form-item label="ERP物料编码">
  120. <el-input v-model="modalData.erpPartNo" style="width: 221px"></el-input>
  121. </el-form-item>
  122. </el-form>
  123. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  124. <el-form-item label="规格型号" prop="spec" :rules="rules.spec">
  125. <el-input v-model="modalData.spec" style="width: 221px"></el-input>
  126. </el-form-item>
  127. <el-form-item prop="umName" :rules="rules.umName">
  128. <span slot="label" @click="getBaseList(107)"><a herf="#">计量单位</a></span>
  129. <el-input v-model="modalData.umName" style="width: 221px"></el-input>
  130. </el-form-item>
  131. </el-form>
  132. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  133. <el-form-item prop="familyName" :rules="rules.familyName">
  134. <span slot="label" @click="getBaseList(108)"><a herf="#">材料分类1</a></span>
  135. <el-input v-model="modalData.familyName" style="width: 221px"></el-input>
  136. </el-form-item>
  137. <el-form-item prop="groupName" :rules="rules.groupName">
  138. <span slot="label" @click="getBaseList(109)"><a herf="#">材料分类2</a></span>
  139. <el-input v-model="modalData.groupName" style="width: 221px"></el-input>
  140. </el-form-item>
  141. </el-form>
  142. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  143. <el-form-item>
  144. <span slot="label" @click="getBaseList(110)"><a herf="#">商品组1</a></span>
  145. <el-input v-model="modalData.productGroupName1" style="width: 221px"></el-input>
  146. </el-form-item>
  147. <el-form-item>
  148. <span slot="label" @click="getBaseList(111)"><a herf="#">商品组2</a></span>
  149. <el-input v-model="modalData.productGroupName2" style="width: 221px"></el-input>
  150. </el-form-item>
  151. </el-form>
  152. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  153. <el-form-item>
  154. <span slot="label" @click="getBaseList(112)"><a herf="#">商品组3</a></span>
  155. <el-input v-model="modalData.productGroupName3" style="width: 221px"></el-input>
  156. </el-form-item>
  157. <el-form-item>
  158. <span slot="label" @click="getBaseList(113)"><a herf="#">商品组4</a></span>
  159. <el-input v-model="modalData.productGroupName4" style="width: 221px"></el-input>
  160. </el-form-item>
  161. </el-form>
  162. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  163. <el-form-item prop="codeDesc" :rules="rules.codeDesc">
  164. <span slot="label" @click="getBaseList(20)"><a herf="#">属性模板</a></span>
  165. <el-input v-model="modalData.codeDesc" style="width: 221px"></el-input>
  166. </el-form-item>
  167. <el-form-item prop="manufacturerName" :rules="rules.manufacturerName">
  168. <span slot="label" @click="getBaseList(114)"><a herf="#">制造商</a></span>
  169. <el-input v-model="modalData.manufacturerName" style="width: 221px"></el-input>
  170. </el-form-item>
  171. </el-form>
  172. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  173. <el-form-item label="是否在用" prop="active" :rules="rules.active">
  174. <el-select v-model="modalData.active" style="width: 221px">
  175. <el-option label="是" value="Y"></el-option>
  176. <el-option label="否" value="N"></el-option>
  177. </el-select>
  178. </el-form-item>
  179. <el-form-item prop="agentName" :rules="rules.agentName">
  180. <span slot="label" @click="getAgentList()"><a>代理商</a></span>
  181. <el-input v-model="modalData.agentName" style="width: 221px"></el-input>
  182. </el-form-item>
  183. </el-form>
  184. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  185. <el-form-item label="备注">
  186. <el-input
  187. type="textarea"
  188. v-model="modalData.remark"
  189. :rows="1"
  190. resize='none'
  191. maxlength="300"
  192. show-word-limit
  193. style="width: 456px;height: 20px">
  194. </el-input>
  195. </el-form-item>
  196. </el-form>
  197. <el-footer style="height:30px;margin-top: 20px;text-align:center">
  198. <el-button type="primary" @click="saveData()">保存</el-button>
  199. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  200. </el-footer>
  201. </el-dialog>
  202. <!-- 页签 -->
  203. <el-tabs v-model="activeTable" style="margin-top: 0px; width: 100%; min-height: 294px" type="border-card" @tab-click="tabClick" class="customer-tab">
  204. <!-- 材料属性页签 -->
  205. <el-tab-pane label="材料属性" name="part_item">
  206. <el-table
  207. :data="partItemList"
  208. :height="secondHeight"
  209. border
  210. v-loading="dataListLoading"
  211. style="width: 100%;">
  212. <el-table-column
  213. v-for="(item,index) in columnItemList" :key="index"
  214. :sortable="item.columnSortable"
  215. :prop="item.columnProp"
  216. :header-align="item.headerAlign"
  217. :show-overflow-tooltip="item.showOverflowTooltip"
  218. :align="item.align"
  219. :fixed="item.fixed==''?false:item.fixed"
  220. :min-width="item.columnWidth"
  221. :label="item.columnLabel">
  222. <template slot-scope="scope">
  223. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  224. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  225. </template>
  226. </el-table-column>
  227. <el-table-column
  228. header-align="center"
  229. align="center"
  230. width="150"
  231. fixed="right"
  232. label="操作">
  233. <template slot-scope="scope">
  234. <a type="text" size="small" @click="updateItemModal(scope.row)">编辑</a>
  235. </template>
  236. </el-table-column>
  237. </el-table>
  238. </el-tab-pane>
  239. <!-- 代理商页签 -->
  240. <el-tab-pane label="代理商" name="part_agent">
  241. <el-table
  242. :data="partAgentList"
  243. :height="secondHeight"
  244. border
  245. v-loading="dataListLoading"
  246. style="width: 100%;">
  247. <el-table-column
  248. v-for="(item,index) in columnAgentList" :key="index"
  249. :sortable="item.columnSortable"
  250. :prop="item.columnProp"
  251. :header-align="item.headerAlign"
  252. :show-overflow-tooltip="item.showOverflowTooltip"
  253. :align="item.align"
  254. :fixed="item.fixed==''?false:item.fixed"
  255. :min-width="item.columnWidth"
  256. :label="item.columnLabel">
  257. <template slot-scope="scope">
  258. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  259. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  260. </template>
  261. </el-table-column>
  262. <!-- <el-table-column-->
  263. <!-- header-align="center"-->
  264. <!-- align="center"-->
  265. <!-- width="150"-->
  266. <!-- fixed="right"-->
  267. <!-- label="操作">-->
  268. <!-- <template slot-scope="scope">-->
  269. <!-- <a type="text" size="small" @click="updateItemModal(scope.row)">编辑</a>-->
  270. <!-- </template>-->
  271. <!-- </el-table-column>-->
  272. </el-table>
  273. </el-tab-pane>
  274. <!-- 文档页签 -->
  275. <el-tab-pane label="文档" name="part_file">
  276. <el-form label-position="top" style="margin-top: 5px; margin-left: 0px;">
  277. <el-form :inline="true" label-position="top" style="margin-top: 5px">
  278. <el-button type="primary" @click="uploadFile()">上传文件</el-button>
  279. </el-form>
  280. </el-form>
  281. <el-table
  282. :data="fileContentList"
  283. :height="secondHeight"
  284. border
  285. v-loading="dataListLoading"
  286. style="width: 100%; ">
  287. <el-table-column
  288. v-for="(item,index) in columnFileList" :key="index"
  289. :sortable="item.columnSortable"
  290. :prop="item.columnProp"
  291. :header-align="item.headerAlign"
  292. :show-overflow-tooltip="item.showOverflowTooltip"
  293. :align="item.align"
  294. :fixed="item.fixed==''?false:item.fixed"
  295. :min-width="item.columnWidth"
  296. :label="item.columnLabel">
  297. <template slot-scope="scope">
  298. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  299. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  300. </template>
  301. </el-table-column>
  302. <el-table-column
  303. fixed="right"
  304. header-align="center"
  305. align="center"
  306. width="100"
  307. label="操作">
  308. <template slot-scope="scope">
  309. <a @click="downloadFile(scope.row)">下载</a>
  310. <a type="text" size="small" @click="deleteFile(scope.row)">删除</a>
  311. </template>
  312. </el-table-column>
  313. </el-table>
  314. </el-tab-pane>
  315. </el-tabs>
  316. <!-- 材料属性值编辑模态框 -->
  317. <el-dialog title="属性项目" :close-on-click-modal="false" v-drag :visible.sync="itemModalFlag" width="310px">
  318. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  319. <el-form-item label="属性编码:">
  320. <el-input v-model="itemData.propertiesItemNo" disabled style="width: 120px"></el-input>
  321. </el-form-item>
  322. <el-form-item label="属性名称:">
  323. <el-input v-model="itemData.itemDesc" disabled style="width: 120px"></el-input>
  324. </el-form-item>
  325. </el-form>
  326. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  327. <el-form-item label="文本值:">
  328. <el-input v-if="!itemChooseFlag" v-model="itemData.textValue" :disabled="itemTextDisableFlag" type="text" style="width: 120px"></el-input>
  329. <el-select v-if="itemChooseFlag" v-model="itemData.textValue" :disabled="itemTextDisableFlag" style="width: 120px" placeholder="请选择">
  330. <el-option v-for="item in availableValueList" :key="index" :label="item.availableValue" :value="item.availableValue"></el-option>
  331. </el-select>
  332. </el-form-item>
  333. <el-form-item label="数字值:">
  334. <el-input v-if="!itemChooseFlag" v-model="itemData.numValue" :disabled="itemNumberDisableFlag" type="number" style="width: 120px"></el-input>
  335. <el-select v-if="itemChooseFlag" v-model="itemData.numValue" :disabled="itemNumberDisableFlag" style="width: 120px" placeholder="请选择">
  336. <el-option v-for="item in availableValueList" :key="index" :label="item.availableValue" :value="item.availableValue"></el-option>
  337. </el-select>
  338. </el-form-item>
  339. </el-form>
  340. <span slot="footer" class="dialog-footer">
  341. <el-button type="primary" @click="itemSaveData()">保存</el-button>
  342. <el-button type="primary" @click="itemModalFlag=false">关闭</el-button>
  343. </span>
  344. </el-dialog>
  345. <!-- 代理商模态框 -->
  346. <el-dialog title="代理商清单" :close-on-click-modal="false" v-drag :visible.sync="agentModelFlag" width="520px">
  347. <div class="rq">
  348. <el-form :inline="true" label-position="top" :model="agentData">
  349. <el-form-item :label="'代理商编码'">
  350. <el-input v-model="agentData.agentId" clearable style="width: 120px"></el-input>
  351. </el-form-item>
  352. <el-form-item :label="'代理商名称'">
  353. <el-input v-model="agentData.agentName" clearable style="width: 120px"></el-input>
  354. </el-form-item>
  355. <el-form-item :label="' '">
  356. <el-button type="primary" @click="getAgentList()">查询</el-button>
  357. </el-form-item>
  358. </el-form>
  359. <el-table
  360. :height="300"
  361. :data="agentList"
  362. ref="agentTable"
  363. @row-click="agentClickRow"
  364. @selection-change="selectionAgent"
  365. :row-key="getRowKeys"
  366. border
  367. v-loading="dataListLoading"
  368. style="width: 100%;">
  369. <el-table-column
  370. type="selection"
  371. header-align="center"
  372. align="center"
  373. :reserve-selection="true"
  374. width="50">
  375. </el-table-column>
  376. <el-table-column
  377. v-for="(item,index) in agentColumnList" :key="index"
  378. :sortable="item.columnSortable"
  379. :prop="item.columnProp"
  380. :header-align="item.headerAlign"
  381. :show-overflow-tooltip="item.showOverflowTooltip"
  382. :align="item.align"
  383. :fixed="item.fixed==''?false:item.fixed"
  384. :min-width="item.columnWidth"
  385. :label="item.columnLabel">
  386. <template slot-scope="scope">
  387. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  388. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  389. </template>
  390. </el-table-column>
  391. </el-table>
  392. </div>
  393. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  394. <el-button type="primary" @click="confirmAgent()">确认</el-button>
  395. <el-button type="primary" @click="agentModelFlag = false">关闭</el-button>
  396. </el-footer>
  397. </el-dialog>
  398. <!-- chooseList模态框 -->
  399. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  400. <!-- 上传文件的modal -->
  401. <partUploadFile ref="partUploadFile" @refreshPageTables="getFileContentData()" v-drag></partUploadFile>
  402. </div>
  403. </template>
  404. <script>
  405. import {
  406. partInformationSearch, // 材料信息列表查询
  407. partInformationSave, // 材料信息新增
  408. partInformationEdit, // 材料信息编辑
  409. partInformationDelete, // 材料信息删除
  410. getPartItem, // 查询材料属性
  411. savePartItemValue, // 编辑属性值
  412. getAgentList, // 获取代理商列表
  413. getPartAgent, // 获取材料代理商
  414. } from '@/api/part/partInformation.js'
  415. import {
  416. getFileContentList, // 获取材料单附件列表
  417. deleteQuotationFile, // 文件删除
  418. downLoadQuotationFile // 文件下载
  419. } from '@/api/quotation/quotationInformation.js'
  420. import Chooselist from '@/views/modules/common/Chooselist'
  421. import partUploadFile from "./part_upload_file"
  422. export default {
  423. components: {
  424. Chooselist,
  425. partUploadFile
  426. },
  427. watch: {
  428. searchData: {
  429. deep: true,
  430. handler: function (newV, oldV) {
  431. this.searchData.partNo = this.searchData.partNo.toUpperCase()
  432. this.searchData.erpPartNo = this.searchData.erpPartNo.toUpperCase()
  433. }
  434. }
  435. },
  436. data () {
  437. return {
  438. // 导出
  439. exportData: [],
  440. exportName: '物料档案管理' + this.dayjs().format('YYYYMMDDHHmmss'),
  441. exportHeader: ['物料档案管理'],
  442. exportFooter: [],
  443. resultList: [],
  444. // ======== 行高 ========
  445. height: 200,
  446. secondHeight: 200,
  447. // ======== 分页 ========
  448. pageIndex: 1,
  449. pageSize: 50,
  450. totalPage: 0,
  451. selectedDataNum: 0,
  452. // 条件查询
  453. searchData: {
  454. site: this.$store.state.user.site,
  455. partNo: '',
  456. erpPartNo: '',
  457. startDate: '',
  458. endDate: '',
  459. partDesc: '',
  460. spec: '',
  461. page: 1,
  462. limit: 10
  463. },
  464. // 其它
  465. dataListLoading: false,
  466. // 初始页签
  467. activeTable: 'part_item',
  468. // ======== 数据对象 ========
  469. modalData: {
  470. flag: '',
  471. title: '',
  472. site: this.$store.state.user.site,
  473. partNo: '',
  474. partDesc: '',
  475. spec: '',
  476. partTypeDb: '',
  477. partType: '',
  478. familyId: '',
  479. familyName: '',
  480. groupId: '',
  481. groupName: '',
  482. umId: '',
  483. umName: '',
  484. active: '',
  485. remark: '',
  486. supplierId: '',
  487. supplierName: '',
  488. productGroupId1: '',
  489. productGroupName1: '',
  490. productGroupId2: '',
  491. productGroupName2: '',
  492. productGroupId3: '',
  493. productGroupName3: '',
  494. productGroupId4: '',
  495. productGroupName4: '',
  496. erpPartNo: '',
  497. codeNo: '',
  498. codeDesc: '',
  499. manufacturerId: '',
  500. manufacturerName: '',
  501. createDate: '',
  502. createBy: '',
  503. updateDate: '',
  504. updateBy: '',
  505. agentId: '',
  506. agentName: ''
  507. },
  508. itemData:{
  509. site: '',
  510. partNo: '',
  511. propertiesItemNo: '',
  512. itemDesc: '',
  513. textValue: '',
  514. numValue: '',
  515. recordType: 'B'
  516. },
  517. agentData: {
  518. site: this.$store.state.user.site,
  519. agentId: '',
  520. agentName: '',
  521. },
  522. // ======== 数据列表 ========
  523. dataList: [],
  524. partItemList: [],
  525. partAgentList: [],
  526. fileContentList: [],
  527. availableValueList:[],
  528. agentList: [],
  529. agentSelections: [],
  530. // ======== 列表表头 ========
  531. columnList: [
  532. {
  533. userId: this.$store.state.user.name,
  534. functionId: 104001,
  535. serialNumber: '104001Table1PartNo',
  536. tableId: '104001Table1',
  537. tableName: '材料信息表',
  538. columnProp: 'partNo',
  539. headerAlign: 'center',
  540. align: 'center',
  541. columnLabel: '材料编码',
  542. columnHidden: false,
  543. columnImage: false,
  544. columnSortable: false,
  545. sortLv: 0,
  546. status: true,
  547. fixed: '',
  548. columnWidth: 120
  549. },
  550. {
  551. userId: this.$store.state.user.name,
  552. functionId: 104001,
  553. serialNumber: '104001Table1ERPPartNo',
  554. tableId: '104001Table1',
  555. tableName: '材料信息表',
  556. columnProp: 'erpPartNo',
  557. headerAlign: 'center',
  558. align: 'center',
  559. columnLabel: 'ERP物料编码',
  560. columnHidden: false,
  561. columnImage: false,
  562. columnSortable: false,
  563. sortLv: 0,
  564. status: true,
  565. fixed: '',
  566. columnWidth: 120
  567. },
  568. {
  569. userId: this.$store.state.user.name,
  570. functionId: 104001,
  571. serialNumber: '104001Table1PartDesc',
  572. tableId: '104001Table1',
  573. tableName: '材料信息表',
  574. columnProp: 'partDesc',
  575. headerAlign: 'center',
  576. align: 'center',
  577. columnLabel: '材料描述',
  578. columnHidden: false,
  579. columnImage: false,
  580. columnSortable: false,
  581. sortLv: 0,
  582. status: true,
  583. fixed: '',
  584. columnWidth: 120
  585. },
  586. {
  587. userId: this.$store.state.user.name,
  588. functionId: 104001,
  589. serialNumber: '104001Table1Spec',
  590. tableId: '104001Table1',
  591. tableName: '材料信息表',
  592. columnProp: 'spec',
  593. headerAlign: 'center',
  594. align: 'center',
  595. columnLabel: '规格型号',
  596. columnHidden: false,
  597. columnImage: false,
  598. columnSortable: false,
  599. sortLv: 0,
  600. status: true,
  601. fixed: '',
  602. columnWidth: 120
  603. },
  604. {
  605. userId: this.$store.state.user.name,
  606. functionId: 104001,
  607. serialNumber: '104001Table1UmId',
  608. tableId: '104001Table1',
  609. tableName: '材料信息表',
  610. columnProp: 'umName',
  611. headerAlign: 'center',
  612. align: 'center',
  613. columnLabel: '计量单位',
  614. columnHidden: false,
  615. columnImage: false,
  616. columnSortable: false,
  617. sortLv: 0,
  618. status: true,
  619. fixed: '',
  620. columnWidth: 60
  621. },
  622. {
  623. userId: this.$store.state.user.name,
  624. functionId: 104001,
  625. serialNumber: '104001Table1FamilyName',
  626. tableId: '104001Table1',
  627. tableName: '材料信息表',
  628. columnProp: 'familyName',
  629. headerAlign: 'center',
  630. align: 'center',
  631. columnLabel: '材料分类1',
  632. columnHidden: false,
  633. columnImage: false,
  634. columnSortable: false,
  635. sortLv: 0,
  636. status: true,
  637. fixed: '',
  638. columnWidth: 80
  639. },
  640. {
  641. userId: this.$store.state.user.name,
  642. functionId: 104001,
  643. serialNumber: '104001Table1GroupName',
  644. tableId: '104001Table1',
  645. tableName: '材料信息表',
  646. columnProp: 'groupName',
  647. headerAlign: 'center',
  648. align: 'center',
  649. columnLabel: '材料分类2',
  650. columnHidden: false,
  651. columnImage: false,
  652. columnSortable: false,
  653. sortLv: 0,
  654. status: true,
  655. fixed: '',
  656. columnWidth: 80
  657. },
  658. {
  659. userId: this.$store.state.user.name,
  660. functionId: 104001,
  661. serialNumber: '104001Table1OtherGroup1',
  662. tableId: '104001Table1',
  663. tableName: '材料信息表',
  664. columnProp: 'productGroupName1',
  665. headerAlign: 'center',
  666. align: 'center',
  667. columnLabel: '商品组1',
  668. columnHidden: false,
  669. columnImage: false,
  670. columnSortable: false,
  671. sortLv: 0,
  672. status: true,
  673. fixed: '',
  674. columnWidth: 80
  675. },
  676. {
  677. userId: this.$store.state.user.name,
  678. functionId: 104001,
  679. serialNumber: '104001Table1OtherGroup2',
  680. tableId: '104001Table1',
  681. tableName: '材料信息表',
  682. columnProp: 'productGroupName2',
  683. headerAlign: 'center',
  684. align: 'center',
  685. columnLabel: '商品组2',
  686. columnHidden: false,
  687. columnImage: false,
  688. columnSortable: false,
  689. sortLv: 0,
  690. status: true,
  691. fixed: '',
  692. columnWidth: 80
  693. },
  694. {
  695. userId: this.$store.state.user.name,
  696. functionId: 104001,
  697. serialNumber: '104001Table1OtherGroup3',
  698. tableId: '104001Table1',
  699. tableName: '材料信息表',
  700. columnProp: 'productGroupName3',
  701. headerAlign: 'center',
  702. align: 'center',
  703. columnLabel: '商品组3',
  704. columnHidden: false,
  705. columnImage: false,
  706. columnSortable: false,
  707. sortLv: 0,
  708. status: true,
  709. fixed: '',
  710. columnWidth: 80
  711. },
  712. {
  713. userId: this.$store.state.user.name,
  714. functionId: 104001,
  715. serialNumber: '104001Table1OtherGroup4',
  716. tableId: '104001Table1',
  717. tableName: '材料信息表',
  718. columnProp: 'productGroupName4',
  719. headerAlign: 'center',
  720. align: 'center',
  721. columnLabel: '商品组4',
  722. columnHidden: false,
  723. columnImage: false,
  724. columnSortable: false,
  725. sortLv: 0,
  726. status: true,
  727. fixed: '',
  728. columnWidth: 80
  729. },
  730. {
  731. userId: this.$store.state.user.name,
  732. functionId: 104001,
  733. serialNumber: '104001Table1ItemNo',
  734. tableId: '104001Table1',
  735. tableName: '材料信息表',
  736. columnProp: 'codeDesc',
  737. headerAlign: 'center',
  738. align: 'center',
  739. columnLabel: '属性模板',
  740. columnHidden: false,
  741. columnImage: false,
  742. columnSortable: false,
  743. sortLv: 0,
  744. status: true,
  745. fixed: '',
  746. columnWidth: 100
  747. },
  748. {
  749. userId: this.$store.state.user.name,
  750. functionId: 104001,
  751. serialNumber: '104001Table1ManufacturerName',
  752. tableId: '104001Table1',
  753. tableName: '材料信息表',
  754. columnProp: 'manufacturerName',
  755. headerAlign: 'center',
  756. align: 'center',
  757. columnLabel: '制造商',
  758. columnHidden: false,
  759. columnImage: false,
  760. columnSortable: false,
  761. sortLv: 0,
  762. status: true,
  763. fixed: '',
  764. columnWidth: 160
  765. },
  766. {
  767. userId: this.$store.state.user.name,
  768. functionId: 104001,
  769. serialNumber: '104001Table1AgentName',
  770. tableId: '104001Table1',
  771. tableName: '材料信息表',
  772. columnProp: 'agentName',
  773. headerAlign: 'center',
  774. align: 'center',
  775. columnLabel: '代理商',
  776. columnHidden: false,
  777. columnImage: false,
  778. columnSortable: false,
  779. sortLv: 0,
  780. status: true,
  781. fixed: '',
  782. columnWidth: 160
  783. },
  784. {
  785. userId: this.$store.state.user.name,
  786. functionId: 104001,
  787. serialNumber: '104001Table1Remark',
  788. tableId: '104001Table1',
  789. tableName: '材料信息表',
  790. columnProp: 'remark',
  791. headerAlign: 'center',
  792. align: 'center',
  793. columnLabel: '备注',
  794. columnHidden: false,
  795. columnImage: false,
  796. columnSortable: false,
  797. sortLv: 0,
  798. status: true,
  799. fixed: '',
  800. columnWidth: 160
  801. },
  802. {
  803. userId: this.$store.state.user.name,
  804. functionId: 104001,
  805. serialNumber: '104001Table1Active',
  806. tableId: '104001Table1',
  807. tableName: '材料信息表',
  808. columnProp: 'active',
  809. headerAlign: 'center',
  810. align: 'center',
  811. columnLabel: '是否在用',
  812. columnHidden: false,
  813. columnImage: false,
  814. columnSortable: false,
  815. sortLv: 0,
  816. status: true,
  817. fixed: '',
  818. columnWidth: 60
  819. },
  820. {
  821. userId: this.$store.state.user.name,
  822. functionId: 104001,
  823. serialNumber: '104001Table1CreateDate',
  824. tableId: '104001Table1',
  825. tableName: '材料信息表',
  826. columnProp: 'createDate',
  827. headerAlign: 'center',
  828. align: 'center',
  829. columnLabel: '创建时间',
  830. columnHidden: false,
  831. columnImage: false,
  832. columnSortable: false,
  833. sortLv: 0,
  834. status: true,
  835. fixed: '',
  836. columnWidth: 160
  837. },
  838. {
  839. userId: this.$store.state.user.name,
  840. functionId: 104001,
  841. serialNumber: '104001Table1CreateBy',
  842. tableId: '104001Table1',
  843. tableName: '材料信息表',
  844. columnProp: 'createBy',
  845. headerAlign: 'center',
  846. align: 'center',
  847. columnLabel: '创建人',
  848. columnHidden: false,
  849. columnImage: false,
  850. columnSortable: false,
  851. sortLv: 0,
  852. status: true,
  853. fixed: '',
  854. columnWidth: 80
  855. },
  856. {
  857. userId: this.$store.state.user.name,
  858. functionId: 104001,
  859. serialNumber: '104001Table1UpdateDate',
  860. tableId: '104001Table1',
  861. tableName: '材料信息表',
  862. columnProp: 'updateDate',
  863. headerAlign: 'center',
  864. align: 'center',
  865. columnLabel: '更新时间',
  866. columnHidden: false,
  867. columnImage: false,
  868. columnSortable: false,
  869. sortLv: 0,
  870. status: true,
  871. fixed: '',
  872. columnWidth: 160
  873. },
  874. {
  875. userId: this.$store.state.user.name,
  876. functionId: 104001,
  877. serialNumber: '104001Table1UpdateBy',
  878. tableId: '104001Table1',
  879. tableName: '材料信息表',
  880. columnProp: 'updateBy',
  881. headerAlign: 'center',
  882. align: 'center',
  883. columnLabel: '更新人',
  884. columnHidden: false,
  885. columnImage: false,
  886. columnSortable: false,
  887. sortLv: 0,
  888. status: true,
  889. fixed: '',
  890. columnWidth: 80
  891. }
  892. ],
  893. columnItemList: [
  894. {
  895. userId: this.$store.state.user.name,
  896. functionId: 104001,
  897. serialNumber: '104001Table2PropertiesItemID',
  898. tableId: "104001Table2",
  899. tableName: "材料属性表",
  900. columnProp: 'propertiesItemNo',
  901. headerAlign: "center",
  902. align: "center",
  903. columnLabel: '属性编码',
  904. columnHidden: false,
  905. columnImage: false,
  906. columnSortable: true,
  907. sortLv: 0,
  908. status: true,
  909. fixed: '',
  910. columnWidth: 90,
  911. },
  912. {
  913. userId: this.$store.state.user.name,
  914. functionId: 104001,
  915. serialNumber: '104001Table2PropertiesItemDesc',
  916. tableId: "104001Table2",
  917. tableName: "材料属性表",
  918. columnProp: 'itemDesc',
  919. headerAlign: "center",
  920. align: "center",
  921. columnLabel: '属性名称',
  922. columnHidden: false,
  923. columnImage: false,
  924. columnSortable: true,
  925. sortLv: 0,
  926. status: true,
  927. fixed: '',
  928. columnWidth: 90,
  929. },
  930. {
  931. userId: this.$store.state.user.name,
  932. functionId: 104001,
  933. serialNumber: '104001Table2ValueType',
  934. tableId: "104001Table2",
  935. tableName: "材料属性表",
  936. columnProp: 'valueType',
  937. headerAlign: "center",
  938. align: "center",
  939. columnLabel: '属性类型',
  940. columnHidden: false,
  941. columnImage: false,
  942. columnSortable: true,
  943. sortLv: 0,
  944. status: true,
  945. fixed: '',
  946. columnWidth: 70,
  947. },
  948. {
  949. userId: this.$store.state.user.name,
  950. functionId: 104001,
  951. serialNumber: '104001Table2ValueChooseFlag',
  952. tableId: "104001Table2",
  953. tableName: "材料属性表",
  954. columnProp: 'textValue',
  955. headerAlign: "center",
  956. align: "center",
  957. columnLabel: '文本值',
  958. columnHidden: false,
  959. columnImage: false,
  960. columnSortable: true,
  961. sortLv: 0,
  962. status: true,
  963. fixed: '',
  964. columnWidth: 70,
  965. },
  966. {
  967. userId: this.$store.state.user.name,
  968. functionId: 104001,
  969. serialNumber: '104001Table2ValueChooseFlag',
  970. tableId: "104001Table2",
  971. tableName: "材料属性表",
  972. columnProp: 'numValue',
  973. headerAlign: "center",
  974. align: "center",
  975. columnLabel: '数字值',
  976. columnHidden: false,
  977. columnImage: false,
  978. columnSortable: true,
  979. sortLv: 0,
  980. status: true,
  981. fixed: '',
  982. columnWidth: 70,
  983. },
  984. ],
  985. columnAgentList: [
  986. {
  987. userId: this.$store.state.user.name,
  988. functionId: 104001,
  989. serialNumber: '104001Table3AgentId',
  990. tableId: "104001Table3",
  991. tableName: "材料代理商表",
  992. columnProp: 'agentId',
  993. headerAlign: "center",
  994. align: "center",
  995. columnLabel: '代理商编码',
  996. columnHidden: false,
  997. columnImage: false,
  998. columnSortable: true,
  999. sortLv: 0,
  1000. status: true,
  1001. fixed: '',
  1002. },
  1003. {
  1004. userId: this.$store.state.user.name,
  1005. functionId: 104001,
  1006. serialNumber: '104001Table3AgentName',
  1007. tableId: "104001Table3",
  1008. tableName: "材料代理商表",
  1009. columnProp: 'agentName',
  1010. headerAlign: "center",
  1011. align: "center",
  1012. columnLabel: '代理商名称',
  1013. columnHidden: false,
  1014. columnImage: false,
  1015. columnSortable: true,
  1016. sortLv: 0,
  1017. status: true,
  1018. fixed: '',
  1019. },
  1020. {
  1021. userId: this.$store.state.user.name,
  1022. functionId: 104001,
  1023. serialNumber: '104001Table3Active',
  1024. tableId: '104001Table3',
  1025. tableName: '材料代理商表',
  1026. columnProp: 'active',
  1027. headerAlign: 'center',
  1028. align: 'center',
  1029. columnLabel: '是否在用',
  1030. columnHidden: false,
  1031. columnImage: false,
  1032. columnSortable: false,
  1033. sortLv: 0,
  1034. status: true,
  1035. fixed: '',
  1036. },
  1037. {
  1038. userId: this.$store.state.user.name,
  1039. functionId: 104001,
  1040. serialNumber: '104001Table3CreateDate',
  1041. tableId: '104001Table3',
  1042. tableName: '材料代理商表',
  1043. columnProp: 'createDate',
  1044. headerAlign: 'center',
  1045. align: 'center',
  1046. columnLabel: '创建时间',
  1047. columnHidden: false,
  1048. columnImage: false,
  1049. columnSortable: false,
  1050. sortLv: 0,
  1051. status: true,
  1052. fixed: '',
  1053. },
  1054. {
  1055. userId: this.$store.state.user.name,
  1056. functionId: 104001,
  1057. serialNumber: '104001Table3CreateBy',
  1058. tableId: '104001Table3',
  1059. tableName: '材料代理商表',
  1060. columnProp: 'createBy',
  1061. headerAlign: 'center',
  1062. align: 'center',
  1063. columnLabel: '创建人',
  1064. columnHidden: false,
  1065. columnImage: false,
  1066. columnSortable: false,
  1067. sortLv: 0,
  1068. status: true,
  1069. fixed: '',
  1070. },
  1071. {
  1072. userId: this.$store.state.user.name,
  1073. functionId: 104001,
  1074. serialNumber: '104001Table3UpdateDate',
  1075. tableId: '104001Table3',
  1076. tableName: '材料代理商表',
  1077. columnProp: 'updateDate',
  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. },
  1088. {
  1089. userId: this.$store.state.user.name,
  1090. functionId: 104001,
  1091. serialNumber: '104001Table3UpdateBy',
  1092. tableId: '104001Table3',
  1093. tableName: '材料代理商表',
  1094. columnProp: 'updateBy',
  1095. headerAlign: 'center',
  1096. align: 'center',
  1097. columnLabel: '更新人',
  1098. columnHidden: false,
  1099. columnImage: false,
  1100. columnSortable: false,
  1101. sortLv: 0,
  1102. status: true,
  1103. fixed: '',
  1104. }
  1105. ],
  1106. columnFileList: [
  1107. {
  1108. userId: this.$store.state.user.name,
  1109. functionId: 104001,
  1110. serialNumber: '104001Table4FileName',
  1111. tableId: '104001Table4',
  1112. tableName: '文件信息表',
  1113. columnProp: 'fileName',
  1114. headerAlign: 'center',
  1115. align: 'center',
  1116. columnLabel: '文件名称',
  1117. columnHidden: false,
  1118. columnImage: false,
  1119. columnSortable: false,
  1120. sortLv: 0,
  1121. status: true,
  1122. fixed: '',
  1123. },
  1124. {
  1125. userId: this.$store.state.user.name,
  1126. functionId: 104001,
  1127. serialNumber: '104001Table4FileRemark',
  1128. tableId: '104001Table4',
  1129. tableName: '文件信息表',
  1130. columnProp: 'fileRemark',
  1131. headerAlign: 'center',
  1132. align: 'center',
  1133. columnLabel: '备注',
  1134. columnHidden: false,
  1135. columnImage: false,
  1136. columnSortable: false,
  1137. sortLv: 0,
  1138. status: true,
  1139. fixed: '',
  1140. },
  1141. {
  1142. userId: this.$store.state.user.name,
  1143. functionId: 104001,
  1144. serialNumber: '104001Table4CreateDate',
  1145. tableId: '104001Table4',
  1146. tableName: '文件信息表',
  1147. columnProp: 'createDate',
  1148. headerAlign: 'center',
  1149. align: 'center',
  1150. columnLabel: '上传时间',
  1151. columnHidden: false,
  1152. columnImage: false,
  1153. columnSortable: false,
  1154. sortLv: 0,
  1155. status: true,
  1156. fixed: '',
  1157. },
  1158. {
  1159. userId: this.$store.state.user.name,
  1160. functionId: 104001,
  1161. serialNumber: '104001Table4CreatedBy',
  1162. tableId: '104001Table4',
  1163. tableName: '文件信息表',
  1164. columnProp: 'createdBy',
  1165. headerAlign: 'center',
  1166. align: 'center',
  1167. columnLabel: '上传人',
  1168. columnHidden: false,
  1169. columnImage: false,
  1170. columnSortable: false,
  1171. sortLv: 0,
  1172. status: true,
  1173. fixed: '',
  1174. }
  1175. ],
  1176. agentColumnList: [
  1177. {
  1178. columnProp: 'agentId',
  1179. headerAlign: "center",
  1180. align: "center",
  1181. columnLabel: '代理商编码',
  1182. columnHidden: false,
  1183. columnImage: false,
  1184. columnSortable: false,
  1185. sortLv: 0,
  1186. status: true,
  1187. fixed: '',
  1188. },
  1189. {
  1190. columnProp: 'agentName',
  1191. headerAlign: "center",
  1192. align: "center",
  1193. columnLabel: '代理商名称',
  1194. columnHidden: false,
  1195. columnImage: false,
  1196. columnSortable: false,
  1197. sortLv: 0,
  1198. status: true,
  1199. fixed: '',
  1200. },
  1201. ],
  1202. // ======== 必填规则 ========
  1203. rules: {
  1204. partDesc: [
  1205. {
  1206. required: true,
  1207. message: ' ',
  1208. trigger: 'change'
  1209. }
  1210. ],
  1211. spec: [
  1212. {
  1213. required: true,
  1214. message: ' ',
  1215. trigger: 'change'
  1216. }
  1217. ],
  1218. umName: [
  1219. {
  1220. required: true,
  1221. message: ' ',
  1222. trigger: 'change'
  1223. }
  1224. ],
  1225. familyName: [
  1226. {
  1227. required: true,
  1228. message: ' ',
  1229. trigger: 'change'
  1230. }
  1231. ],
  1232. groupName: [
  1233. {
  1234. required: true,
  1235. message: ' ',
  1236. trigger: 'change'
  1237. }
  1238. ],
  1239. codeDesc: [
  1240. {
  1241. required: true,
  1242. message: ' ',
  1243. trigger: 'change'
  1244. }
  1245. ],
  1246. manufacturerName: [
  1247. {
  1248. required: true,
  1249. message: ' ',
  1250. trigger: 'change'
  1251. }
  1252. ],
  1253. active: [
  1254. {
  1255. required: true,
  1256. message: ' ',
  1257. trigger: 'change'
  1258. }
  1259. ],
  1260. agentName: [
  1261. {
  1262. required: true,
  1263. message: ' ',
  1264. trigger: 'change'
  1265. }
  1266. ],
  1267. },
  1268. // ======== 复选数据集 ========
  1269. partSelections: [],
  1270. // ======== 选中的当前行数据 ========
  1271. partCurrentRow: {},
  1272. // ======== 模态框开关控制 ========
  1273. modalFlag: false,
  1274. modalDisableFlag: false,
  1275. itemChooseFlag: false,
  1276. itemTextDisableFlag: false,
  1277. itemNumberDisableFlag: false,
  1278. itemModalDisableFlag: false,
  1279. itemModalFlag: false,
  1280. agentModelFlag: false
  1281. }
  1282. },
  1283. mounted () {
  1284. this.$nextTick(() => {
  1285. this.height = window.innerHeight / 2 - 30
  1286. /*第二个表格高度的动态调整*/
  1287. this.secondHeight = window.innerHeight / 2 - 206
  1288. })
  1289. },
  1290. created () {
  1291. this.getDataList()
  1292. },
  1293. methods: {
  1294. // ======== 分页相关方法 ========
  1295. /**
  1296. * 每页数
  1297. * @param val
  1298. */
  1299. sizeChangeHandle (val) {
  1300. this.pageSize = val
  1301. this.pageIndex = 1
  1302. this.getDataList()
  1303. },
  1304. /**
  1305. * 当前页
  1306. * @param val
  1307. */
  1308. currentChangeHandle (val) {
  1309. this.pageIndex = val
  1310. this.getDataList()
  1311. },
  1312. // ======== 页签切换相关方法 ========
  1313. /**
  1314. * 未知
  1315. * @returns {boolean}
  1316. */
  1317. selectFlag () {
  1318. return true;
  1319. },
  1320. /**
  1321. * 列表表格选择替换
  1322. * @param tab
  1323. * @param event
  1324. */
  1325. tabClick (tab, event) {
  1326. // 刷新列表数据
  1327. this.refreshCurrentTabTable()
  1328. },
  1329. /**
  1330. * 当前值发生变化的时候修改
  1331. * @param row
  1332. * @param oldRow
  1333. */
  1334. changeCurrentRow (row, oldRow) {
  1335. // 判断是否是获取焦点的事件
  1336. if (row) {
  1337. this.partCurrentRow = JSON.parse(JSON.stringify(row))
  1338. //刷新当前页表
  1339. this.refreshCurrentTabTable()
  1340. }
  1341. },
  1342. /**
  1343. * 刷新页签的table数据
  1344. */
  1345. refreshCurrentTabTable () {
  1346. if (this.activeTable === 'part_item') {
  1347. this.getPartItem()
  1348. } else if (this.activeTable === 'part_agent') {
  1349. this.getPartAgent()
  1350. } else if (this.activeTable === 'part_file') {
  1351. this.getFileContentData()
  1352. }
  1353. },
  1354. // ======== 列表数据刷新方法 ========
  1355. /**
  1356. * 查询材料属性
  1357. */
  1358. getPartItem () {
  1359. let tempData = {
  1360. site: this.$store.state.user.site,
  1361. partNo: this.partCurrentRow.partNo,
  1362. codeNo: this.partCurrentRow.codeNo,
  1363. recordType: 'B'
  1364. }
  1365. getPartItem(tempData).then(({data}) => {
  1366. if (data && data.code === 0) {
  1367. this.partItemList = data.rows
  1368. } else {
  1369. this.partItemList = []
  1370. }
  1371. })
  1372. },
  1373. /**
  1374. * 查询材料代理商
  1375. */
  1376. getPartAgent () {
  1377. let tempData = {
  1378. site: this.$store.state.user.site,
  1379. partNo: this.partCurrentRow.partNo,
  1380. agentId: this.partCurrentRow.agentId
  1381. }
  1382. getPartAgent(tempData).then(({data}) => {
  1383. if (data && data.code === 0) {
  1384. this.partAgentList = data.rows
  1385. } else {
  1386. this.partAgentList = []
  1387. }
  1388. })
  1389. },
  1390. // ======== 列表数据刷新方法 ========
  1391. /**
  1392. * 获取数据列表
  1393. */
  1394. getDataList () {
  1395. this.searchData.limit = this.pageSize
  1396. this.searchData.page = this.pageIndex
  1397. partInformationSearch(this.searchData).then(({data}) => {
  1398. if (data.code === 0) {
  1399. this.dataList = data.page.list
  1400. this.pageIndex = data.page.currPage
  1401. this.pageSize = data.page.pageSize
  1402. this.totalPage = data.page.totalCount
  1403. this.$refs.selectDiv.setLengthAll( this.dataList.length)
  1404. // 判断是否全部存在数据
  1405. if(this.totalPage > 0){
  1406. // 设置选中行
  1407. this.$refs.partTable.setCurrentRow(this.dataList[0])
  1408. // 加载当前的页签的table
  1409. this.refreshCurrentTabTable()
  1410. this.partClickRow(this.dataList[0])
  1411. }
  1412. }
  1413. this.dataListLoading = false
  1414. })
  1415. },
  1416. // ======== 新增/编辑模态框 ========
  1417. /**
  1418. * 材料信息新增模态框
  1419. */
  1420. addModal () {
  1421. this.modalData = {
  1422. flag: '1',
  1423. title: '材料新增',
  1424. site: this.$store.state.user.site,
  1425. partNo: '',
  1426. partDesc: '',
  1427. spec: '',
  1428. partTypeDb: '',
  1429. partType: '',
  1430. familyId: '',
  1431. familyName: '',
  1432. groupId: '',
  1433. groupName: '',
  1434. umId: '',
  1435. umName: '',
  1436. active: 'Y',
  1437. remark: '',
  1438. supplierId: '',
  1439. supplierName: '',
  1440. productGroupId1: '',
  1441. productGroupName1: '',
  1442. productGroupId2: '',
  1443. productGroupName2: '',
  1444. productGroupId3: '',
  1445. productGroupName3: '',
  1446. productGroupId4: '',
  1447. productGroupName4: '',
  1448. erpPartNo: '',
  1449. codeNo: '',
  1450. codeDesc: '',
  1451. manufacturerId: '',
  1452. manufacturerName: '',
  1453. agentId: '',
  1454. agentName: '',
  1455. createBy: this.$store.state.user.name
  1456. }
  1457. this.modalDisableFlag = false
  1458. this.modalFlag = true
  1459. },
  1460. /**
  1461. * 材料信息编辑模态框
  1462. * @param row
  1463. */
  1464. updateModal (row) {
  1465. this.modalData = {
  1466. flag: '2',
  1467. title: '材料编辑',
  1468. site: row.site,
  1469. partNo: row.partNo,
  1470. partDesc: row.partDesc,
  1471. spec: row.spec,
  1472. partTypeDb: row.partTypeDb,
  1473. partType: row.partType,
  1474. familyId: row.familyId,
  1475. familyName: row.familyName,
  1476. groupId: row.groupId,
  1477. groupName: row.groupName,
  1478. umId: row.umId,
  1479. umName: row.umName,
  1480. active: row.active,
  1481. remark: row.remark,
  1482. supplierId: row.supplierId,
  1483. supplierName: row.supplierName,
  1484. productGroupId1: row.productGroupId1,
  1485. productGroupName1: row.productGroupName1,
  1486. productGroupId2: row.productGroupId2,
  1487. productGroupName2: row.productGroupName2,
  1488. productGroupId3: row.productGroupId3,
  1489. productGroupName3: row.productGroupName3,
  1490. productGroupId4: row.productGroupId4,
  1491. productGroupName4: row.productGroupName4,
  1492. erpPartNo: row.erpPartNo,
  1493. codeNo: row.codeNo,
  1494. codeDesc: row.codeDesc,
  1495. manufacturerId: row.manufacturerId,
  1496. manufacturerName: row.manufacturerName,
  1497. agentId: row.agentId,
  1498. agentName: row.agentName,
  1499. updateBy: this.$store.state.user.name
  1500. }
  1501. this.modalDisableFlag = true
  1502. this.modalFlag = true
  1503. },
  1504. /**
  1505. * 选择代理商
  1506. */
  1507. getAgentList () {
  1508. // 先清空缓存选中
  1509. this.$nextTick(() => this.$refs.agentTable.clearSelection())
  1510. // 拿到选中的代理商id
  1511. let tempDataList = this.modalData.agentId.split(';')
  1512. // 查询所有代理商
  1513. getAgentList(this.agentData).then(({data}) => {
  1514. if (data && data.code === 0) {
  1515. this.agentList = data.rows
  1516. this.agentList.forEach(val => {
  1517. // 回显选中的代理商
  1518. if (tempDataList.includes(val.agentId)) {
  1519. this.$nextTick(() => this.$refs.agentTable.toggleRowSelection(val, true))
  1520. }
  1521. })
  1522. this.agentModelFlag = true
  1523. } else {
  1524. this.$alert(data.msg, '错误', {
  1525. confirmButtonText: '确定'
  1526. })
  1527. }
  1528. })
  1529. },
  1530. /**
  1531. * 代理商多选
  1532. * @param row
  1533. */
  1534. agentClickRow (row) {
  1535. this.$refs.agentTable.toggleRowSelection(row);
  1536. },
  1537. /**
  1538. * 获得选中的代理商
  1539. * @param val
  1540. */
  1541. selectionAgent (val) {
  1542. this.agentSelections = val
  1543. },
  1544. /**
  1545. * 返回列表唯一值
  1546. * @param row
  1547. * @returns {string|[{trigger: string, message: string, required: boolean}]|*}
  1548. */
  1549. getRowKeys (row) {
  1550. // 唯一值,一般都为id
  1551. return row.agentId;
  1552. },
  1553. /**
  1554. * 确认多选代理商
  1555. * @returns {boolean}
  1556. */
  1557. confirmAgent () {
  1558. this.modalData.agentId = ''
  1559. this.modalData.agentName = ''
  1560. for (let i = 0; i < this.agentSelections.length; i++) {
  1561. this.modalData.agentId = this.modalData.agentId + ";" + this.agentSelections[i].agentId
  1562. this.modalData.agentName = this.modalData.agentName + ";" + this.agentSelections[i].agentName
  1563. }
  1564. this.modalData.agentId = this.modalData.agentId.substring(1)
  1565. this.modalData.agentName = this.modalData.agentName.substring(1)
  1566. this.agentModelFlag = false
  1567. },
  1568. // ======== 新增/编辑/删除方法 ========
  1569. /**
  1570. * 材料信息新增/编辑
  1571. */
  1572. saveData () {
  1573. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  1574. this.$message.warning('请填写材料描述!')
  1575. return
  1576. }
  1577. if (this.modalData.spec === '' || this.modalData.spec == null) {
  1578. this.$message.warning('请填写规格型号!')
  1579. return
  1580. }
  1581. if (this.modalData.umId === '' || this.modalData.umId == null) {
  1582. this.$message.warning('请选择计量单位!')
  1583. return
  1584. }
  1585. if (this.modalData.familyId === '' || this.modalData.familyId == null) {
  1586. this.$message.warning('请选择分类!')
  1587. return
  1588. }
  1589. if (this.modalData.groupId === '' || this.modalData.groupId == null) {
  1590. this.$message.warning('请选择分组!')
  1591. return
  1592. }
  1593. if (this.modalData.codeNo === '' || this.modalData.codeNo == null) {
  1594. this.$message.warning('请选择属性模板!')
  1595. return
  1596. }
  1597. if (this.modalData.manufacturerId === '' || this.modalData.manufacturerId == null) {
  1598. this.$message.warning('请选择制造商!')
  1599. return
  1600. }
  1601. if (this.modalData.active === '' || this.modalData.active == null) {
  1602. this.$message.warning('请选择是否在用!')
  1603. return
  1604. }
  1605. if (this.modalData.agentId === '' || this.modalData.agentId == null) {
  1606. this.$message.warning('请选择代理商!')
  1607. return
  1608. }
  1609. if (this.modalData.flag === '1') {
  1610. partInformationSave(this.modalData).then(({data}) => {
  1611. if (data && data.code === 0) {
  1612. this.getDataList()
  1613. this.modalFlag = false
  1614. this.$message({
  1615. message: '操作成功',
  1616. type: 'success',
  1617. duration: 1500,
  1618. onClose: () => {}
  1619. })
  1620. } else {
  1621. this.$alert(data.msg, '错误', {
  1622. confirmButtonText: '确定'
  1623. })
  1624. }
  1625. })
  1626. } else {
  1627. partInformationEdit(this.modalData).then(({data}) => {
  1628. if (data && data.code === 0) {
  1629. this.getDataList()
  1630. this.modalFlag = false
  1631. this.$message({
  1632. message: '操作成功',
  1633. type: 'success',
  1634. duration: 1500,
  1635. onClose: () => {}
  1636. })
  1637. } else {
  1638. this.$alert(data.msg, '错误', {
  1639. confirmButtonText: '确定'
  1640. })
  1641. }
  1642. })
  1643. }
  1644. },
  1645. /**
  1646. * 材料信息删除
  1647. */
  1648. delModal () {
  1649. if(this.partSelections.length === 0){
  1650. this.$message.warning('请勾选要删除的材料信息!')
  1651. return
  1652. }
  1653. this.$confirm(`是否删除这 `+ this.partSelections.length +` 条材料信息?`, '提示', {
  1654. confirmButtonText: '确定',
  1655. cancelButtonText: '取消',
  1656. type: 'warning'
  1657. }).then(() => {
  1658. let tempData = {
  1659. informationList: this.partSelections
  1660. }
  1661. partInformationDelete(tempData).then(({data}) => {
  1662. if (data && data.code === 0) {
  1663. this.getDataList()
  1664. this.partSelections = []
  1665. this.$message({
  1666. message: '操作成功',
  1667. type: 'success',
  1668. duration: 1500,
  1669. onClose: () => {}
  1670. })
  1671. } else {
  1672. this.$alert(data.msg, '错误', {
  1673. confirmButtonText: '确定'
  1674. })
  1675. }
  1676. })
  1677. }).catch(() => {
  1678. })
  1679. },
  1680. // ======== 列表操作方法 ========
  1681. /**
  1682. * 单机选中材料信息
  1683. * @param row
  1684. */
  1685. partClickRow (row) {
  1686. this.$refs.partTable.toggleRowSelection(row)
  1687. this.partCurrentRow = JSON.parse(JSON.stringify(row))
  1688. },
  1689. /**
  1690. * 复选材料信息
  1691. * @param val
  1692. */
  1693. selectionPart (val) {
  1694. this.partSelections = val
  1695. this.$refs.selectDiv.setLengthselected(this.partSelections.length)
  1696. },
  1697. // ======== 属性页签相关方法 ========
  1698. /**
  1699. * 编辑属性值模态框
  1700. */
  1701. updateItemModal (row) {
  1702. this.itemData = {
  1703. site: row.site,
  1704. partNo: row.partNo,
  1705. propertiesItemNo: row.propertiesItemNo,
  1706. itemDesc: row.itemDesc,
  1707. textValue: row.textValue,
  1708. numValue: row.numValue,
  1709. recordType: 'B'
  1710. }
  1711. this.availableValueList = row.availableValueList
  1712. if (row.valueChooseFlag === 'Y') {
  1713. this.itemChooseFlag = true
  1714. } else {
  1715. this.itemChooseFlag = false
  1716. }
  1717. this.itemTextDisableFlag = true
  1718. this.itemNumberDisableFlag = true
  1719. if (row.valueTypeDb !== 'T') {
  1720. this.itemNumberDisableFlag = false
  1721. } else {
  1722. this.itemTextDisableFlag = false
  1723. }
  1724. this.itemModalDisableFlag = true
  1725. this.itemModalFlag = true
  1726. },
  1727. /**
  1728. * 编辑属性值方法
  1729. * @returns {boolean}
  1730. */
  1731. itemSaveData () {
  1732. if(this.itemData.partNo === '' || this.itemData.partNo == null){
  1733. this.$message.warning('未选择物料!')
  1734. return false
  1735. }
  1736. if(this.itemData.propertiesItemNo === ''|| this.itemData.propertiesItemNo == null){
  1737. this.$message.warning('未选择属性!')
  1738. return false
  1739. }
  1740. savePartItemValue(this.itemData).then(({data}) => {
  1741. if (data && data.code === 0) {
  1742. this.itemModalFlag = false
  1743. this.getPartItem()
  1744. this.$message({
  1745. message: '操作成功',
  1746. type: 'success',
  1747. duration: 1500,
  1748. onClose: () => {}
  1749. })
  1750. } else {
  1751. this.$alert(data.msg, '错误', {
  1752. confirmButtonText: '确定'
  1753. })
  1754. }
  1755. })
  1756. },
  1757. // ======== 附件的相关方法 ========
  1758. /**
  1759. * 获取材料附件列表
  1760. */
  1761. getFileContentData () {
  1762. let currentData = {
  1763. orderRef1: this.$store.state.user.site,
  1764. orderRef2: this.partCurrentRow.partNo
  1765. }
  1766. getFileContentList(currentData).then(({data}) => {
  1767. if (data && data.code === 0) {
  1768. this.fileContentList = data.rows
  1769. } else {
  1770. this.fileContentList = []
  1771. }
  1772. })
  1773. },
  1774. /**
  1775. * 上传文件
  1776. */
  1777. uploadFile () {
  1778. let currentData = {
  1779. titleCon: '材料附件上传',
  1780. site: this.$store.state.user.site,
  1781. createBy: this.$store.state.user.name,
  1782. partNo: this.partCurrentRow.partNo
  1783. }
  1784. //打开组件 去做新增业务
  1785. this.$nextTick(() => {
  1786. this.$refs.partUploadFile.init(currentData);
  1787. })
  1788. },
  1789. /**
  1790. * 文件删除
  1791. * @param row
  1792. */
  1793. deleteFile (row) {
  1794. this.$confirm('确定要删除此文件?', '提示', {
  1795. confirmButtonText: '确定',
  1796. cancelButtonText: '取消',
  1797. type: 'warning'
  1798. }).then(() => {
  1799. deleteQuotationFile(row).then(({data}) => {
  1800. if (data && data.code === 0) {
  1801. this.getFileContentData()
  1802. this.$message({
  1803. message: '操作成功',
  1804. type: 'success',
  1805. duration: 1500,
  1806. onClose: () => {}
  1807. })
  1808. } else {
  1809. this.$alert(data.msg, '错误', {
  1810. confirmButtonText: '确定'
  1811. })
  1812. }
  1813. })
  1814. }).catch(() => {
  1815. })
  1816. },
  1817. /**
  1818. * 文件下载
  1819. * @param row
  1820. */
  1821. downloadFile (row) {
  1822. downLoadQuotationFile(row).then(({data}) => {
  1823. // 不限制文件下载类型
  1824. const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'})
  1825. // 下载文件名称
  1826. const fileName = row.fileName
  1827. // a标签下载
  1828. const linkNode = document.createElement('a')
  1829. linkNode.download = fileName // a标签的download属性规定下载文件的名称
  1830. linkNode.style.display = 'none'
  1831. linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
  1832. document.body.appendChild(linkNode)
  1833. linkNode.click() // 模拟在按钮上的一次鼠标单击
  1834. URL.revokeObjectURL(linkNode.href) // 释放URL 对象
  1835. document.body.removeChild(linkNode)
  1836. })
  1837. },
  1838. // ======== chooseList相关方法 ========
  1839. /**
  1840. * 获取基础数据列表S
  1841. * @param val
  1842. * @param type
  1843. */
  1844. getBaseList (val, type) {
  1845. this.tagNo = val
  1846. this.$nextTick(() => {
  1847. let strVal = ''
  1848. if (val === 107) {
  1849. strVal = this.modalData.umId
  1850. } else if (val === 108) {
  1851. strVal = this.modalData.familyId
  1852. } else if (val === 109) {
  1853. strVal = this.modalData.groupId
  1854. } else if (val === 110) {
  1855. strVal = this.modalData.productGroupId1
  1856. } else if (val === 111) {
  1857. strVal = this.modalData.productGroupId2
  1858. } else if (val === 112) {
  1859. strVal = this.modalData.productGroupId3
  1860. } else if (val === 113) {
  1861. strVal = this.modalData.productGroupId4
  1862. } else if (val === 114) {
  1863. strVal = this.modalData.manufacturerId
  1864. } else if (val === 20) {
  1865. strVal = this.modalData.codeNo
  1866. }
  1867. this.$refs.baseList.init(val, strVal)
  1868. })
  1869. },
  1870. /**
  1871. * 列表方法的回调
  1872. * @param val
  1873. */
  1874. getBaseData (val) {
  1875. if (this.tagNo === 107) {
  1876. this.modalData.umId = val.um_id
  1877. this.modalData.umName = val.um_name
  1878. } else if (this.tagNo === 108) {
  1879. this.modalData.familyId = val.family_id
  1880. this.modalData.familyName = val.family_name
  1881. } else if (this.tagNo === 109) {
  1882. this.modalData.groupId = val.group_id
  1883. this.modalData.groupName = val.group_name
  1884. } else if (this.tagNo === 110) {
  1885. this.modalData.productGroupId1 = val.product_group_id
  1886. this.modalData.productGroupName1 = val.product_group_name
  1887. } else if (this.tagNo === 111) {
  1888. this.modalData.productGroupId2 = val.product_group_id
  1889. this.modalData.productGroupName2 = val.product_group_name
  1890. } else if (this.tagNo === 112) {
  1891. this.modalData.productGroupId3 = val.product_group_id
  1892. this.modalData.productGroupName3 = val.product_group_name
  1893. } else if (this.tagNo === 113) {
  1894. this.modalData.productGroupId4 = val.product_group_id
  1895. this.modalData.productGroupName4 = val.product_group_name
  1896. } else if (this.tagNo === 114) {
  1897. this.modalData.manufacturerId = val.manufacturer_id
  1898. this.modalData.manufacturerName = val.manufacturer_name
  1899. } else if (this.tagNo === 20) {
  1900. this.modalData.codeNo = val.Code_no
  1901. this.$set(this.modalData, 'codeDesc', val.Code_desc)
  1902. }
  1903. },
  1904. // ======== 导出相关方法 ========
  1905. /**
  1906. * 导出excel
  1907. */
  1908. async createExportData () {
  1909. this.searchData.limit = -1
  1910. this.searchData.page = 1
  1911. await partInformationSearch(this.searchData).then(({data}) => {
  1912. this.resultList = data.page.list
  1913. })
  1914. return this.resultList
  1915. },
  1916. startDownload () {
  1917. },
  1918. finishDownload () {
  1919. },
  1920. fields () {
  1921. let json = '{'
  1922. this.columnList.forEach((item, index) => {
  1923. if (index == this.columnList.length - 1) {
  1924. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  1925. } else {
  1926. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  1927. }
  1928. })
  1929. json += '}'
  1930. let s = eval('(' + json + ')')
  1931. return s
  1932. }
  1933. }
  1934. }
  1935. </script>
  1936. <style scoped lang="scss">
  1937. /deep/ .customer-tab .el-tabs__content {
  1938. padding: 0px !important;
  1939. height: 459px;
  1940. }
  1941. /deep/ .customer-tab .el-tabs__content {
  1942. height: 294px;
  1943. }
  1944. </style>