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.

838 lines
27 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" :model="searchData">
  4. <el-form-item :label="'BU'">
  5. <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px">
  6. <el-option
  7. v-for = "i in userBuList"
  8. :key = "i.buNo"
  9. :label = "i.buDesc"
  10. :value = "i.buDesc">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item :label="'制造商编码'">
  15. <el-input v-model="searchData.manufacturerID" style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="'制造商名称'">
  18. <el-input v-model="searchData.manufacturerName" style="width: 200px"></el-input>
  19. </el-form-item>
  20. <el-form-item :label="'在用'">
  21. <el-select filterable v-model="searchData.active" style="width: 80px">
  22. <el-option label="全部" value=""></el-option>
  23. <el-option label="是" value="Y"></el-option>
  24. <el-option label="否" value="N"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item :label="' '">
  28. <el-button v-if="!authSearch" @click="getDataList()">查询</el-button>
  29. <el-button v-if="!authSave" type="primary" @click="addModal()">新增</el-button>
  30. <download-excel
  31. :fields="fields()"
  32. :data="exportData"
  33. type="xls"
  34. :name="exportName"
  35. :header="exportHeader"
  36. :footer="exportFooter"
  37. :fetch="createExportData"
  38. :before-generate="startDownload"
  39. :before-finish="finishDownload"
  40. worksheet="导出信息"
  41. class="el-button el-button--primary el-button--medium">
  42. {{ "导出" }}
  43. </download-excel>
  44. </el-form-item>
  45. </el-form>
  46. <el-table
  47. :height="height"
  48. :data="dataList"
  49. border
  50. style="width: 100%;">
  51. <el-table-column
  52. v-for="(item,index) in columnList" :key="index"
  53. :sortable="item.columnSortable"
  54. :prop="item.columnProp"
  55. :header-align="item.headerAlign"
  56. :show-overflow-tooltip="item.showOverflowTooltip"
  57. :align="item.align"
  58. :fixed="item.fixed==''?false:item.fixed"
  59. :min-width="item.columnWidth"
  60. :label="item.columnLabel">
  61. <template slot-scope="scope">
  62. <span v-if="!item.columnHidden">
  63. <span v-if="columnsProp.includes(item.columnProp)">{{ scope.row[`${item.columnProp}Desc`] }}</span>
  64. <span v-else>
  65. {{ scope.row[item.columnProp] }}
  66. </span>
  67. </span>
  68. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column
  72. fixed="right"
  73. header-align="center"
  74. align="center"
  75. width="100"
  76. label="操作">
  77. <template slot-scope="scope">
  78. <el-link v-if="!authUpdate" style="cursor: pointer" @click="updateModal(scope.row)">修改</el-link>
  79. <el-link v-if="!authDelete" style="cursor: pointer" @click="deleteManufacturer(scope.row)">删除</el-link>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <el-pagination
  84. @size-change="sizeChangeHandle"
  85. @current-change="currentChangeHandle"
  86. :current-page="pageIndex"
  87. :page-sizes="[20, 50, 100, 200, 500]"
  88. :page-size="pageSize"
  89. :total="totalPage"
  90. layout="total, sizes, prev, pager, next, jumper">
  91. </el-pagination>
  92. <el-dialog title="制造商" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="430px">
  93. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  94. <el-form-item label="BU" prop="bu" :rules="rules.bu">
  95. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 230px">
  96. <el-option
  97. v-for = "i in userBuList"
  98. :key = "i.buNo"
  99. :label = "i.sitename"
  100. :value = "i.buNo">
  101. <span style="float: left;width: 100px">{{ i.sitename }}</span>
  102. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">{{ i.buDesc }}</span>
  103. </el-option>
  104. </el-select>
  105. </el-form-item>
  106. <el-form-item label="是否在用:" prop="active" :rules="rules.activeType">
  107. <el-select filterable v-model="modalData.active" style="width: 140px">
  108. <el-option label="是" value="Y"></el-option>
  109. <el-option label="否" value="N"></el-option>
  110. </el-select>
  111. </el-form-item>
  112. </el-form>
  113. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  114. <el-form-item label="制造商编码:" prop="manufacturerID" :rules="rules.manufacturerIdType">
  115. <el-input v-model="modalData.manufacturerID" :disabled="modalDisableFlag" style="width: 140px"></el-input>
  116. </el-form-item>
  117. <el-form-item label="制造商名称:" prop="manufacturerName" :rules="rules.manufacturerNameType">
  118. <el-input v-model="modalData.manufacturerName" :disabled="modalDisableFlag" style="width: 230px"></el-input>
  119. </el-form-item>
  120. </el-form>
  121. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: 0px;">
  122. <el-form-item label="联系人">
  123. <el-input v-model="modalData.contact" style="width: 140px"></el-input>
  124. </el-form-item>
  125. <el-form-item label="地址">
  126. <el-input v-model="modalData.address" style="width: 230px"></el-input>
  127. </el-form-item>
  128. </el-form>
  129. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
  130. <el-form-item label="电话">
  131. <el-input v-model="modalData.phone" style="width: 140px"></el-input>
  132. </el-form-item>
  133. <el-form-item label="邮箱">
  134. <el-input v-model="modalData.email" style="width: 230px"></el-input>
  135. </el-form-item>
  136. </el-form>
  137. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
  138. <el-form-item label="备注">
  139. <el-input
  140. type="textarea"
  141. v-model="modalData.remark"
  142. :rows="3"
  143. resize='none'
  144. show-word-limit
  145. style="width: 388px;height: 60px">
  146. </el-input>
  147. </el-form-item>
  148. </el-form>
  149. <el-footer style="height:40px;margin-top: 50px;text-align:center">
  150. <el-button type="primary" @click="saveData()">保存</el-button>
  151. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  152. </el-footer>
  153. </el-dialog>
  154. </div>
  155. </template>
  156. <script>
  157. import {
  158. eamManufacturerSearch,
  159. eamManufacturerSave,
  160. eamManufacturerEdit,
  161. eamManufacturerDelete,
  162. getSiteAndBuByUserName
  163. } from "@/api/eam/eam.js"
  164. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  165. import {
  166. getTableDefaultListLanguage,
  167. getTableUserListLanguage,
  168. } from "@/api/table.js"
  169. export default {
  170. watch: {
  171. searchData: {
  172. deep: true,
  173. handler: function (newV, oldV) {
  174. this.searchData.manufacturerID = this.searchData.manufacturerID.toUpperCase()
  175. }
  176. },
  177. modalData: {
  178. deep: true,
  179. handler: function (newV, oldV) {
  180. this.modalData.manufacturerID = this.modalData.manufacturerID.toUpperCase()
  181. }
  182. }
  183. },
  184. data () {
  185. return {
  186. columnsProp:['createBy','active','updateBy'],
  187. // 是否收藏
  188. favorite: false,
  189. // 导出 start
  190. exportData: [],
  191. exportName: "设备制造商" + this.dayjs().format('YYYYMMDDHHmmss'),
  192. exportHeader: ["设备制造商"],
  193. exportFooter: [],
  194. exportList: [],
  195. // 导出 end
  196. searchData: {
  197. site: '',
  198. userName: this.$store.state.user.name,
  199. manufacturerID: '',
  200. manufacturerName: '',
  201. buDesc: '',
  202. active: 'Y',
  203. page: 1,
  204. limit: 10,
  205. },
  206. height: 200,
  207. pageIndex: 1,
  208. pageSize: 20,
  209. totalPage: 0,
  210. dataList: [],
  211. dataListSelections: [],
  212. modalFlag: false,
  213. modalDisableFlag: false,
  214. modalData: {
  215. flag: '',
  216. bu: '',
  217. site: '',
  218. manufacturerID: '',
  219. manufacturerName: '',
  220. active: '',
  221. contact: '',
  222. phone: '',
  223. address: '',
  224. email: '',
  225. remark: '',
  226. updateBy: this.$store.state.user.name,
  227. createBy: this.$store.state.user.name,
  228. },
  229. departmentList: [],
  230. // 展示列集
  231. columnList: [
  232. {
  233. userId: this.$store.state.user.name,
  234. functionId: 101001005,
  235. serialNumber: '101001005Table1BuDesc',
  236. tableId: "101001005Table1",
  237. tableName: "设备制造商表",
  238. columnProp: 'buDesc',
  239. headerAlign: "center",
  240. align: "center",
  241. columnLabel: 'BU',
  242. columnHidden: false,
  243. columnImage: false,
  244. columnSortable: false,
  245. sortLv: 0,
  246. status: true,
  247. fixed: '',
  248. columnWidth: 100,
  249. },
  250. {
  251. userId: this.$store.state.user.name,
  252. functionId: 101001005,
  253. serialNumber: '101001005Table1ManufacturerID',
  254. tableId: "101001005Table1",
  255. tableName: "设备制造商表",
  256. columnProp: 'manufacturerID',
  257. headerAlign: "center",
  258. align: "center",
  259. columnLabel: '制造商编码',
  260. columnHidden: false,
  261. columnImage: false,
  262. columnSortable: false,
  263. sortLv: 0,
  264. status: true,
  265. fixed: '',
  266. columnWidth: 120,
  267. },
  268. {
  269. userId: this.$store.state.user.name,
  270. functionId: 101001005,
  271. serialNumber: '101001005Table1ManufacturerName',
  272. tableId: "101001005Table1",
  273. tableName: "设备制造商表",
  274. columnProp: 'manufacturerName',
  275. headerAlign: "center",
  276. align: "left",
  277. columnLabel: '制造商名称',
  278. columnHidden: false,
  279. columnImage: false,
  280. columnSortable: false,
  281. sortLv: 0,
  282. status: true,
  283. fixed: '',
  284. columnWidth: 200,
  285. },
  286. {
  287. userId: this.$store.state.user.name,
  288. functionId: 101001005,
  289. serialNumber: '101001005Table1Active',
  290. tableId: "101001005Table1",
  291. tableName: "设备制造商表",
  292. columnProp: 'active',
  293. headerAlign: "center",
  294. align: "center",
  295. columnLabel: '在用',
  296. columnHidden: false,
  297. columnImage: false,
  298. columnSortable: false,
  299. sortLv: 0,
  300. status: true,
  301. fixed: '',
  302. columnWidth: 100,
  303. },
  304. {
  305. userId: this.$store.state.user.name,
  306. functionId: 101001005,
  307. serialNumber: '101001005Table1Contact',
  308. tableId: "101001005Table1",
  309. tableName: "设备制造商表",
  310. columnProp: 'contact',
  311. headerAlign: "center",
  312. align: "center",
  313. columnLabel: '联系人',
  314. columnHidden: false,
  315. columnImage: false,
  316. columnSortable: false,
  317. sortLv: 0,
  318. status: true,
  319. fixed: '',
  320. columnWidth: 100,
  321. },
  322. {
  323. userId: this.$store.state.user.name,
  324. functionId: 101001005,
  325. serialNumber: '101001005Table1Phone',
  326. tableId: "101001005Table1",
  327. tableName: "设备制造商表",
  328. columnProp: 'phone',
  329. headerAlign: "center",
  330. align: "center",
  331. columnLabel: '电话',
  332. columnHidden: false,
  333. columnImage: false,
  334. columnSortable: false,
  335. sortLv: 0,
  336. status: true,
  337. fixed: '',
  338. columnWidth: 130,
  339. },
  340. {
  341. userId: this.$store.state.user.name,
  342. functionId: 101001005,
  343. serialNumber: '101001005Table1Address',
  344. tableId: "101001005Table1",
  345. tableName: "设备制造商表",
  346. columnProp: 'address',
  347. headerAlign: "center",
  348. align: "left",
  349. columnLabel: '地址',
  350. columnHidden: false,
  351. columnImage: false,
  352. columnSortable: false,
  353. sortLv: 0,
  354. status: true,
  355. fixed: '',
  356. columnWidth: 200,
  357. },
  358. {
  359. userId: this.$store.state.user.name,
  360. functionId: 101001005,
  361. serialNumber: '101001005Table1Email',
  362. tableId: "101001005Table1",
  363. tableName: "设备制造商表",
  364. columnProp: 'email',
  365. headerAlign: "center",
  366. align: "left",
  367. columnLabel: '邮箱',
  368. columnHidden: false,
  369. columnImage: false,
  370. columnSortable: false,
  371. sortLv: 0,
  372. status: true,
  373. fixed: '',
  374. columnWidth: 130,
  375. },
  376. {
  377. userId: this.$store.state.user.name,
  378. functionId: 101001005,
  379. serialNumber: '101001005Table1Remark',
  380. tableId: "101001005Table1",
  381. tableName: "设备制造商表",
  382. columnProp: 'remark',
  383. headerAlign: "center",
  384. align: "left",
  385. columnLabel: '备注',
  386. columnHidden: false,
  387. columnImage: false,
  388. columnSortable: false,
  389. sortLv: 0,
  390. status: true,
  391. fixed: '',
  392. columnWidth: 200,
  393. },
  394. {
  395. userId: this.$store.state.user.name,
  396. functionId: 101001005,
  397. serialNumber: '101001005Table1CreateDate',
  398. tableId: "101001005Table1",
  399. tableName: "设备制造商表",
  400. columnProp: 'createDate',
  401. headerAlign: "center",
  402. align: "center",
  403. columnLabel: '创建时间',
  404. columnHidden: false,
  405. columnImage: false,
  406. columnSortable: false,
  407. sortLv: 0,
  408. status: true,
  409. fixed: '',
  410. columnWidth: 170,
  411. },
  412. {
  413. userId: this.$store.state.user.name,
  414. functionId: 101001005,
  415. serialNumber: '101001005Table1CreateBy',
  416. tableId: "101001005Table1",
  417. tableName: "设备制造商表",
  418. columnProp: 'createBy',
  419. headerAlign: "center",
  420. align: "center",
  421. columnLabel: '创建人',
  422. columnHidden: false,
  423. columnImage: false,
  424. columnSortable: false,
  425. sortLv: 0,
  426. status: true,
  427. fixed: '',
  428. columnWidth: 100,
  429. },
  430. {
  431. userId: this.$store.state.user.name,
  432. functionId: 101001005,
  433. serialNumber: '101001005Table1UpdateDate',
  434. tableId: "101001005Table1",
  435. tableName: "设备制造商表",
  436. columnProp: 'updateDate',
  437. headerAlign: "center",
  438. align: "center",
  439. columnLabel: '更新时间',
  440. columnHidden: false,
  441. columnImage: false,
  442. columnSortable: false,
  443. sortLv: 0,
  444. status: true,
  445. fixed: '',
  446. columnWidth: 170,
  447. },
  448. {
  449. userId: this.$store.state.user.name,
  450. functionId: 101001005,
  451. serialNumber: '101001005Table1UpdateBy',
  452. tableId: "101001005Table1",
  453. tableName: "设备制造商表",
  454. columnProp: 'updateBy',
  455. headerAlign: "center",
  456. align: "center",
  457. columnLabel: '更新人',
  458. columnHidden: false,
  459. columnImage: false,
  460. columnSortable: false,
  461. sortLv: 0,
  462. status: true,
  463. fixed: '',
  464. columnWidth: 100,
  465. },
  466. ],
  467. levelList: [],
  468. rules: {
  469. manufacturerIdType:[
  470. {
  471. required: true,
  472. message: ' ',
  473. trigger: ['blur','change']
  474. }
  475. ],
  476. manufacturerNameType:[
  477. {
  478. required: true,
  479. message: ' ',
  480. trigger: ['blur','change']
  481. }
  482. ],
  483. activeType:[
  484. {
  485. required: true,
  486. message: ' ',
  487. trigger: ['blur','change']
  488. }
  489. ],
  490. bu:[
  491. {
  492. required: true,
  493. message: ' ',
  494. trigger: ['blur','change']
  495. }
  496. ]
  497. },
  498. userBuList: [],
  499. authSearch: false,
  500. authSave: false,
  501. authUpdate: false,
  502. authDelete: false,
  503. menuId: this.$route.meta.menuId,
  504. }
  505. },
  506. mounted () {
  507. this.$nextTick(() => {
  508. this.height = window.innerHeight - 180
  509. })
  510. },
  511. created () {
  512. // 按钮控制
  513. this.getButtonAuthData()
  514. // 获取用户的 site 和 bu
  515. this.getSiteAndBuByUserName()
  516. // 校验用户是否收藏
  517. this.favoriteIsOk()
  518. // 动态列
  519. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  520. if (!this.authSearch) {
  521. // 获取数据列表
  522. this.getDataList()
  523. }
  524. },
  525. methods: {
  526. // 获取用户的bu
  527. getSiteAndBuByUserName () {
  528. let tempData = {
  529. username: this.$store.state.user.name,
  530. }
  531. getSiteAndBuByUserName(tempData).then(({data}) => {
  532. if (data.code === 0) {
  533. this.userBuList = data.rows
  534. }
  535. })
  536. },
  537. // 校验用户是否收藏
  538. favoriteIsOk () {
  539. let userFavorite = {
  540. userId: this.$store.state.user.id,
  541. languageCode: this.$i18n.locale
  542. }
  543. userFavoriteList(userFavorite).then(({data}) => {
  544. for (let i = 0; i < data.list.length; i++) {
  545. if(this.$route.meta.menuId === data.list[i].menuId){
  546. this.favorite = true
  547. }
  548. }
  549. })
  550. },
  551. // 收藏 OR 取消收藏
  552. favoriteFunction () {
  553. let userFavorite = {
  554. userId: this.$store.state.user.id,
  555. functionId: this.$route.meta.menuId,
  556. }
  557. if (this.favorite) {
  558. removeUserFavorite(userFavorite).then(({data}) => {
  559. this.$message.success(data.msg)
  560. this.favorite = false
  561. })
  562. } else {
  563. // 收藏
  564. saveUserFavorite(userFavorite).then(({data}) => {
  565. this.$message.success(data.msg)
  566. this.favorite = true
  567. })
  568. }
  569. },
  570. //导出excel
  571. async createExportData () {
  572. this.searchData.limit = -1
  573. this.searchData.page = 1
  574. await eamManufacturerSearch(this.searchData).then(({data}) => {
  575. this.exportList = data.page.list
  576. })
  577. return this.exportList
  578. },
  579. startDownload () {},
  580. finishDownload () {},
  581. fields () {
  582. let json = "{"
  583. this.columnList.forEach((item, index) => {
  584. if (index == this.columnList.length - 1) {
  585. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  586. } else {
  587. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  588. }
  589. })
  590. json += "}"
  591. let s = eval("(" + json + ")")
  592. return s
  593. },
  594. // 获取数据列表
  595. getDataList () {
  596. this.searchData.limit = this.pageSize
  597. this.searchData.page = this.pageIndex
  598. eamManufacturerSearch(this.searchData).then(({data}) => {
  599. if (data.code === 0) {
  600. this.dataList = data.page.list
  601. this.pageIndex = data.page.currPage
  602. this.pageSize = data.page.pageSize
  603. this.totalPage = data.page.totalCount
  604. }
  605. })
  606. },
  607. // 每页数
  608. sizeChangeHandle (val) {
  609. this.pageSize = val
  610. this.pageIndex = 1
  611. this.getDataList()
  612. },
  613. // 当前页
  614. currentChangeHandle (val) {
  615. this.pageIndex = val
  616. this.getDataList()
  617. },
  618. // 多选
  619. selectionChangeHandle (val) {
  620. this.dataListSelections = val
  621. },
  622. addModal () {
  623. this.modalData = {
  624. flag: '1',
  625. bu: this.userBuList[0].buNo,
  626. site: '',
  627. manufacturerID: '',
  628. manufacturerName: '',
  629. active: 'Y',
  630. contact: '',
  631. phone: '',
  632. address: '',
  633. email: '',
  634. remark: '',
  635. createBy: this.$store.state.user.name,
  636. updateBy: this.$store.state.user.name,
  637. }
  638. this.modalDisableFlag = false
  639. this.modalFlag = true
  640. },
  641. updateModal (row) {
  642. this.modalData = {
  643. flag: '2',
  644. bu: row.site + '_' + row.buNo,
  645. site: row.site,
  646. manufacturerID: row.manufacturerID,
  647. manufacturerName: row.manufacturerName,
  648. active: row.active,
  649. contact: row.contact,
  650. phone: row.phone,
  651. address: row.address,
  652. email: row.email,
  653. remark: row.remark,
  654. updateBy: this.$store.state.user.name,
  655. }
  656. this.modalDisableFlag = true
  657. this.modalFlag = true
  658. },
  659. // 删除
  660. deleteManufacturer (row) {
  661. this.$confirm(`是否删除这个制造商?`, '提示', {
  662. confirmButtonText: '确定',
  663. cancelButtonText: '取消',
  664. type: 'warning'
  665. }).then(() => {
  666. eamManufacturerDelete(row).then(({data}) => {
  667. if (data && data.code === '0') {
  668. this.getDataList()
  669. this.$message({
  670. message: '操作成功',
  671. type: 'success',
  672. duration: 1500,
  673. onClose: () => {}
  674. })
  675. } else {
  676. this.$alert(data.msg, '错误', {
  677. confirmButtonText: '确定'
  678. })
  679. }
  680. })
  681. }).catch(() => {
  682. })
  683. },
  684. saveData () {
  685. if (this.modalData.bu === '' || this.modalData.bu == null) {
  686. this.$message.warning('请选择BU!')
  687. return
  688. }
  689. if (this.modalData.manufacturerID === '' || this.modalData.manufacturerID == null) {
  690. this.$message.warning('请输入制造商编码!')
  691. return
  692. }
  693. if (this.modalData.manufacturerName === '' || this.modalData.manufacturerName == null) {
  694. this.$message.warning('请输入制造商名称!')
  695. return
  696. }
  697. if (this.modalData.active === '' || this.modalData.active == null) {
  698. this.$message.warning('选择是否在用!')
  699. return
  700. }
  701. if (this.modalData.flag === '1') {
  702. eamManufacturerSave(this.modalData).then(({data}) => {
  703. if (data && data.code === '0') {
  704. this.getDataList()
  705. this.modalFlag=false
  706. this.$message({
  707. message: '操作成功',
  708. type: 'success',
  709. duration: 1500,
  710. onClose: () => {}
  711. })
  712. } else {
  713. this.$alert(data.msg, '错误', {
  714. confirmButtonText: '确定'
  715. })
  716. }
  717. })
  718. } else {
  719. eamManufacturerEdit(this.modalData).then(({data}) => {
  720. if (data && data.code === '0') {
  721. this.getDataList()
  722. this.modalFlag=false
  723. this.$message({
  724. message: '操作成功',
  725. type: 'success',
  726. duration: 1500,
  727. onClose: () => {}
  728. })
  729. } else {
  730. this.$alert(data.msg, '错误', {
  731. confirmButtonText: '确定'
  732. })
  733. }
  734. })
  735. }
  736. },
  737. // 动态列开始 获取 用户保存的 格式列
  738. async getTableUserColumn (tableId, columnId) {
  739. let queryTableUser = {
  740. userId: this.$store.state.user.name,
  741. functionId: this.$route.meta.menuId,
  742. tableId: tableId,
  743. status: true,
  744. languageCode: this.$i18n.locale
  745. }
  746. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  747. if (data.rows.length > 0) {
  748. //this.columnList1 = []
  749. switch (columnId) {
  750. case 1:
  751. this.columnList = data.rows
  752. break;
  753. // case 2:
  754. // this.detailColumnList = data.rows
  755. // break;
  756. // case 3:
  757. // this.columnList2 = data.rows
  758. // break;
  759. // case 4:
  760. // this.columnList3 = data.rows
  761. // break;
  762. }
  763. } else {
  764. this.getColumnList(tableId, columnId)
  765. }
  766. })
  767. },
  768. // 获取 tableDefault 列
  769. async getColumnList (tableId, columnId) {
  770. let queryTable = {
  771. functionId: this.$route.meta.menuId,
  772. tableId: tableId,
  773. languageCode: this.$i18n.locale
  774. }
  775. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  776. if (!data.rows.length == 0) {
  777. switch (columnId) {
  778. case 1:
  779. this.columnList = data.rows
  780. break;
  781. // case 2:
  782. // this.detailColumnList = data.rows
  783. // break;
  784. // case 3:
  785. // this.columnList2 = data.rows
  786. // break;
  787. // case 4:
  788. // this.columnList3 = data.rows
  789. // break;
  790. }
  791. } else {
  792. // this.showDefault = true.
  793. }
  794. })
  795. },
  796. //获取按钮的权限数据
  797. getButtonAuthData () {
  798. let searchFlag = this.isAuth(this.menuId+":search")
  799. let saveFlag = this.isAuth(this.menuId+":save")
  800. let updateFlag = this.isAuth(this.menuId+":update")
  801. let deleteFlag = this.isAuth(this.menuId+":delete")
  802. //处理页面的权限数据
  803. this.authSearch = !searchFlag
  804. this.authSave = !saveFlag
  805. this.authUpdate = !updateFlag
  806. this.authDelete = !deleteFlag
  807. },
  808. }
  809. }
  810. </script>
  811. <style scoped>
  812. .el-table /deep/ .cell{
  813. height: auto;
  814. line-height: 1.5;
  815. }
  816. </style>