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.

1016 lines
34 KiB

  1. <template>
  2. <div class="mod-config">
  3. <div>
  4. <span @click="favoriteFunction()">
  5. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
  6. </span>
  7. </div>
  8. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  9. <el-form-item :label="'BU'">
  10. <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 130px">
  11. <el-option
  12. v-for = "i in userBuList"
  13. :key = "i.buNo"
  14. :label = "i.buDesc"
  15. :value = "i.buDesc">
  16. </el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item :label="'项目阶段'">
  20. <el-select v-model="searchData.projectPhase" placeholder="请选择" clearable style="width: 130px">
  21. <el-option
  22. v-for = "i in projectPhaseList"
  23. :key = "i.projectPhase"
  24. :label = "i.projectPhase"
  25. :value = "i.projectPhase">
  26. </el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item :label="'项目分类'">
  30. <el-select v-model="searchData.projectCategory" placeholder="请选择" clearable style="width: 130px">
  31. <el-option
  32. v-for = "i in projectCategoryList"
  33. :key = "i.projectCategory"
  34. :label = "i.projectCategory"
  35. :value = "i.projectCategory">
  36. </el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item :label="'文档类型ID'">
  40. <span slot="label" style="" @click="getBaseList(1056,1)"><a herf="#">文档类型ID</a></span>
  41. <el-input v-model="searchData.documentTypeId" style="width: 120px" clearable></el-input>
  42. </el-form-item>
  43. <el-form-item :label="'文档类型'">
  44. <el-input v-model="searchData.documentType" style="width: 120px"></el-input>
  45. </el-form-item>
  46. <el-form-item :label="' '">
  47. <el-button v-if="!authSearch" @click="getDataList()">查询</el-button>
  48. <el-button v-if="!authSave" type="primary" @click="addModal()">新增</el-button>
  49. <download-excel
  50. :fields="fields()"
  51. :data="exportData"
  52. type="xls"
  53. :name="exportName"
  54. :header="exportHeader"
  55. :footer="exportFooter"
  56. :fetch="createExportData"
  57. :before-generate="startDownload"
  58. :before-finish="finishDownload"
  59. worksheet="导出信息"
  60. class="el-button el-button--primary el-button--medium">
  61. {{ "导出" }}
  62. </download-excel>
  63. </el-form-item>
  64. </el-form>
  65. <el-table
  66. :height="height"
  67. :data="dataList"
  68. border
  69. style="width: 100%;">
  70. <el-table-column
  71. v-for="(item,index) in columnList" :key="index"
  72. :sortable="item.columnSortable"
  73. :prop="item.columnProp"
  74. :header-align="item.headerAlign"
  75. :show-overflow-tooltip="item.showOverflowTooltip"
  76. :align="item.align"
  77. :fixed="item.fixed==''?false:item.fixed"
  78. :min-width="item.columnWidth"
  79. :label="item.columnLabel">
  80. <template slot-scope="scope">
  81. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  82. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column
  86. fixed="right"
  87. header-align="center"
  88. align="center"
  89. width="100"
  90. label="操作">
  91. <template slot-scope="scope">
  92. <a v-if="!authUpdate" type="text" size="small" @click="updateModal(scope.row)">修改</a>
  93. <a v-if="!authDelete" type="text" size="small" @click="deleteBuDocument(scope.row)">删除</a>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. <el-pagination
  98. @size-change="sizeChangeHandle"
  99. @current-change="currentChangeHandle"
  100. :current-page="pageIndex"
  101. :page-sizes="[20, 50, 100, 200, 500]"
  102. :page-size="pageSize"
  103. :total="totalPage"
  104. layout="total, sizes, prev, pager, next, jumper">
  105. </el-pagination>
  106. <el-dialog title="BU文档清单" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="425px">
  107. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  108. <el-form-item label="BU" prop="bu" :rules="rules.bu">
  109. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 110px">
  110. <el-option
  111. v-for = "i in userBuList"
  112. :key = "i.buNo"
  113. :label = "i.buDesc"
  114. :value = "i.buNo">
  115. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
  116. {{ i.buDesc }}
  117. </span>
  118. </el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item label="项目阶段" prop="projectPhase" :rules="rules.projectPhase">
  122. <el-select v-model="modalData.projectPhase" placeholder="请选择" clearable style="width: 140px" @input="handleInput">
  123. <el-option
  124. v-for = "i in projectPhaseList"
  125. :key = "i.projectPhase"
  126. :label = "i.projectPhase"
  127. :value = "i.projectPhase">
  128. </el-option>
  129. </el-select>
  130. </el-form-item>
  131. <el-form-item label="项目分类" prop="projectCategory" :rules="rules.projectCategoryType">
  132. <el-select v-model="modalData.projectCategory" placeholder="请选择" clearable style="width: 110px" @input="handleInput">
  133. <el-option
  134. v-for = "i in projectCategoryList"
  135. :key = "i.projectCategory"
  136. :label = "i.projectCategory"
  137. :value = "i.projectCategory">
  138. </el-option>
  139. </el-select>
  140. </el-form-item>
  141. <!-- <el-form-item label="是否在用" prop="active" :rules="rules.activeType">-->
  142. <!-- <el-select filterable v-model="modalData.active" style="width: 140px">-->
  143. <!-- <el-option label="是" value="Y"></el-option>-->
  144. <!-- <el-option label="否" value="N"></el-option>-->
  145. <!-- </el-select>-->
  146. <!-- </el-form-item>-->
  147. </el-form>
  148. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  149. <el-form-item prop="documentTypeId" :rules="rules.documentTypeIdType" v-if="!disableButton">
  150. <span slot="label" style="" @click="getBaseList(1056,2)"><a herf="#">文档类型ID</a></span>
  151. <el-input v-model="modalData.documentTypeId" disabled style="width: 110px"></el-input>
  152. </el-form-item>
  153. <el-form-item label="文档类型ID" prop="documentTypeId" :rules="rules.documentTypeIdType" v-if="disableButton">
  154. <el-input v-model="modalData.documentTypeId" disabled style="width: 110px"></el-input>
  155. </el-form-item>
  156. <!-- <el-form-item label="文档类型ID" prop="documentTypeId" :rules="rules.documentTypeIdType">-->
  157. <!-- <el-input v-model="modalData.documentTypeId" style="width: 230px"></el-input>-->
  158. <!-- </el-form-item>-->
  159. <el-form-item label="文档类型" prop="documentType" :rules="rules.documentTypeType">
  160. <el-input v-model="modalData.documentType" disabled style="width: 264px"></el-input>
  161. </el-form-item>
  162. <el-form-item label="责任部门" prop="responsibleDepartment" :rules="rules.responsibleDepartmentType">
  163. <el-input v-model="modalData.responsibleDepartment" disabled style="width: 110px"></el-input>
  164. </el-form-item>
  165. <el-form-item label="预计完成天数" prop="estimatedCompletionDays" :rules="rules.estimatedCompletionDaysType">
  166. <el-input v-model="modalData.estimatedCompletionDays" disabled style="width: 140px"></el-input>
  167. </el-form-item>
  168. </el-form>
  169. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  170. <el-button type="primary" @click="saveData()">保存</el-button>
  171. <el-button type="primary" @click="modalFlag = false;disableButton = false">关闭</el-button>
  172. </el-footer>
  173. </el-dialog>
  174. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  175. </div>
  176. </template>
  177. <script>
  178. import {
  179. eamBuDocumentSearch,
  180. eamBuDocumentSave,
  181. eamBuDocumentEdit,
  182. eamBuDocumentDelete,
  183. getSiteAndBuByUserName
  184. } from "@/api/eam/eam.js"
  185. import Chooselist from '@/views/modules/common/Chooselist_eam'
  186. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  187. import {
  188. getTableDefaultListLanguage,
  189. getTableUserListLanguage,
  190. } from "@/api/table.js"
  191. import {EventBus} from "../../../main";
  192. import {queryEamBuDocument} from "../../../api/eam/eam";
  193. export default {
  194. components: {
  195. Chooselist
  196. },
  197. watch: {
  198. searchData: {
  199. deep: true,
  200. handler: function (newV, oldV) {
  201. this.searchData.documentTypeId = this.searchData.documentTypeId.toUpperCase()
  202. }
  203. },
  204. },
  205. data () {
  206. return {
  207. // 是否收藏
  208. favorite: false,
  209. // 导出 start
  210. exportData: [],
  211. exportName: "BU文档清单" + this.dayjs().format('YYYYMMDDHHmmss'),
  212. exportHeader: ["BU文档清单"],
  213. exportFooter: [],
  214. exportList:[],
  215. // 导出 end
  216. tagNo:'',
  217. tagNo1:'',
  218. searchData: {
  219. site: this.$store.state.user.site,
  220. userName: this.$store.state.user.name,
  221. projectCategory: '',
  222. documentTypeId: '',
  223. documentType: '',
  224. buDesc: '',
  225. responsibleDepartment: '',
  226. estimatedCompletionDays: '',
  227. projectPhase: '',
  228. // active: 'Y',
  229. page: 1,
  230. limit: 10,
  231. },
  232. height: 200,
  233. pageIndex: 1,
  234. pageSize: 20,
  235. totalPage: 0,
  236. dataList: [],
  237. selectTypeFlag: [],
  238. dataListSelections: [],
  239. modalFlag:false,
  240. modalDisableFlag:false,
  241. disableButton: false,
  242. isDataModified: false,
  243. modalData:{
  244. flag:'',
  245. bu: '',
  246. site: this.$store.state.user.site,
  247. documentTypeId:'',
  248. projectCategory:'',
  249. projectPhase:'',
  250. // active:'',
  251. createBy: this.$store.state.user.name,
  252. updateBy: this.$store.state.user.name,
  253. },
  254. modalCompareData:{
  255. flag:'',
  256. bu: '',
  257. site: this.$store.state.user.site,
  258. documentTypeId:'',
  259. projectCategory:'',
  260. projectPhase:'',
  261. // active:'',
  262. createBy: this.$store.state.user.name,
  263. updateBy: this.$store.state.user.name,
  264. },
  265. departmentList:[],
  266. // 展示列集
  267. columnList: [
  268. {
  269. userId: this.$store.state.user.name,
  270. functionId: 401002,
  271. serialNumber: '401002Table1BuDesc',
  272. tableId: "401002Table1",
  273. tableName: "BU文档清单表",
  274. columnProp: 'buDesc',
  275. headerAlign: "center",
  276. align: "center",
  277. columnLabel: 'BU',
  278. columnHidden: false,
  279. columnImage: false,
  280. columnSortable: false,
  281. sortLv: 0,
  282. status: true,
  283. fixed: '',
  284. columnWidth: 100,
  285. },
  286. {
  287. userId: this.$store.state.user.name,
  288. functionId: 401002,
  289. serialNumber: '401002Table1ProjectPhase',
  290. tableId: "401002Table1",
  291. tableName: "BU文档清单表",
  292. columnProp: 'projectPhase',
  293. headerAlign: "center",
  294. align: "left",
  295. columnLabel: '项目阶段',
  296. columnHidden: false,
  297. columnImage: false,
  298. columnSortable: false,
  299. sortLv: 0,
  300. status: true,
  301. fixed: '',
  302. columnWidth: 120,
  303. },
  304. {
  305. userId: this.$store.state.user.name,
  306. functionId: 401002,
  307. serialNumber: '401002Table1ProjectCategory',
  308. tableId: "401002Table1",
  309. tableName: "BU文档清单表",
  310. columnProp: 'projectCategory',
  311. headerAlign: "center",
  312. align: "left",
  313. columnLabel: '项目分类',
  314. columnHidden: false,
  315. columnImage: false,
  316. columnSortable: false,
  317. sortLv: 0,
  318. status: true,
  319. fixed: '',
  320. columnWidth: 120,
  321. },
  322. {
  323. userId: this.$store.state.user.name,
  324. functionId: 401002,
  325. serialNumber: '401002Table1DocumentTypeId',
  326. tableId: "401002Table1",
  327. tableName: "BU文档清单表",
  328. columnProp: 'documentTypeId',
  329. headerAlign: "center",
  330. align: "center",
  331. columnLabel: '文档类型ID',
  332. columnHidden: false,
  333. columnImage: false,
  334. columnSortable: false,
  335. sortLv: 0,
  336. status: true,
  337. fixed: '',
  338. columnWidth: 120,
  339. },
  340. {
  341. userId: this.$store.state.user.name,
  342. functionId: 401002,
  343. serialNumber: '401002Table1DocumentType',
  344. tableId: "401002Table1",
  345. tableName: "BU文档清单表",
  346. columnProp: 'documentType',
  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: 120,
  357. },
  358. {
  359. userId: this.$store.state.user.name,
  360. functionId: 401002,
  361. serialNumber: '401002Table1ResponsibleDepartment',
  362. tableId: "401002Table1",
  363. tableName: "BU文档清单表",
  364. columnProp: 'responsibleDepartment',
  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: 120,
  375. },
  376. {
  377. userId: this.$store.state.user.name,
  378. functionId: 401002,
  379. serialNumber: '401002Table1EstimatedCompletionDays',
  380. tableId: "401002Table1",
  381. tableName: "BU文档清单表",
  382. columnProp: 'estimatedCompletionDays',
  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: 120,
  393. },
  394. {
  395. userId: this.$store.state.user.name,
  396. functionId: 401002,
  397. serialNumber: '401002Table1CreateDate',
  398. tableId: "401002Table1",
  399. tableName: "BU文档清单表",
  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: 120,
  411. },
  412. {
  413. userId: this.$store.state.user.name,
  414. functionId: 401002,
  415. serialNumber: '401002Table1CreateBy',
  416. tableId: "401002Table1",
  417. tableName: "BU文档清单表",
  418. columnProp: 'createBy',
  419. headerAlign: "center",
  420. align: "left",
  421. columnLabel: '创建人',
  422. columnHidden: false,
  423. columnImage: false,
  424. columnSortable: false,
  425. sortLv: 0,
  426. status: true,
  427. fixed: '',
  428. columnWidth: 120,
  429. },
  430. {
  431. userId: this.$store.state.user.name,
  432. functionId: 401002,
  433. serialNumber: '401002Table1UpdateDate',
  434. tableId: "401002Table1",
  435. tableName: "BU文档清单表",
  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: 120,
  447. },
  448. {
  449. userId: this.$store.state.user.name,
  450. functionId: 401002,
  451. serialNumber: '401002Table1UpdateBy',
  452. tableId: "401002Table1",
  453. tableName: "BU文档清单表",
  454. columnProp: 'updateBy',
  455. headerAlign: "center",
  456. align: "left",
  457. columnLabel: '更新人',
  458. columnHidden: false,
  459. columnImage: false,
  460. columnSortable: false,
  461. sortLv: 0,
  462. status: true,
  463. fixed: '',
  464. columnWidth: 120,
  465. },
  466. ],
  467. levelList: [],
  468. rules:{
  469. projectPhase:[
  470. {
  471. required: true,
  472. message: ' ',
  473. trigger: ['blur','change']
  474. }
  475. ],
  476. projectCategoryType:[
  477. {
  478. required: true,
  479. message: ' ',
  480. trigger: ['blur','change']
  481. }
  482. ],
  483. documentTypeIdType:[
  484. {
  485. required: true,
  486. message: ' ',
  487. trigger: ['blur','change']
  488. }
  489. ],
  490. documentTypeType:[
  491. {
  492. required: true,
  493. message: ' ',
  494. trigger: ['blur','change']
  495. }
  496. ],
  497. responsibleDepartmentType:[
  498. {
  499. required: true,
  500. message: ' ',
  501. trigger: ['blur','change']
  502. }
  503. ],
  504. estimatedCompletionDaysType:[
  505. {
  506. required: true,
  507. message: ' ',
  508. trigger: ['blur','change']
  509. }
  510. ],
  511. activeType:[
  512. {
  513. required: true,
  514. message: ' ',
  515. trigger: ['blur','change']
  516. }
  517. ],
  518. bu:[
  519. {
  520. required: true,
  521. message: ' ',
  522. trigger: ['blur','change']
  523. }
  524. ]
  525. },
  526. projectCategoryList: [
  527. {
  528. projectCategory: 'Low Risk',
  529. },
  530. {
  531. projectCategory: 'High Risk',
  532. },
  533. {
  534. projectCategory: 'Sustaining',
  535. }
  536. ],
  537. projectPhaseList: [
  538. {
  539. projectPhase: 'Sample',
  540. },
  541. {
  542. projectPhase: 'Mass Production',
  543. },
  544. ],
  545. userBuList: [],
  546. authSearch: false,
  547. authSave: false,
  548. authUpdate: false,
  549. authDelete: false,
  550. menuId: this.$route.meta.menuId,
  551. }
  552. },
  553. mounted () {
  554. this.$nextTick(() => {
  555. this.height = window.innerHeight - 210
  556. })
  557. EventBus.$on('updateBuDocumentList', () => {
  558. this.getDataList();
  559. });
  560. },
  561. activated() {
  562. this.$store.commit("sift/commitSearchFunction",this.queryDataList)
  563. },
  564. created () {
  565. // 按钮控制
  566. this.getButtonAuthData()
  567. // 获取用户的 site 和 bu
  568. this.getSiteAndBuByUserName()
  569. // 校验用户是否收藏
  570. this.favoriteIsOk()
  571. // 动态列
  572. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  573. if (!this.authSearch) {
  574. // 获取数据列表
  575. this.getDataList()
  576. }
  577. this.$refs.eamDocumentTypeDefinition.$on('getDataList', this.getDataList)
  578. },
  579. methods: {
  580. // 获取用户的bu
  581. getSiteAndBuByUserName () {
  582. let tempData = {
  583. username: this.$store.state.user.name,
  584. }
  585. getSiteAndBuByUserName(tempData).then(({data}) => {
  586. if (data.code === 0) {
  587. this.userBuList = data.rows
  588. }
  589. })
  590. },
  591. // 获取基础数据列表S
  592. getBaseList (val,type) {
  593. this.tagNo = val
  594. this.tagNo1 = type
  595. this.$nextTick(() => {
  596. let strVal = ''
  597. let conSql = ''
  598. if (val === 1056 ) {
  599. if (type === 1) {
  600. strVal = this.searchData.documentTypeId
  601. conSql = " and a.site = '" + this.$store.state.user.site + "'"
  602. } else {
  603. strVal = this.modalData.documentTypeId
  604. conSql = " and a.site = '" + this.$store.state.user.site + "'"
  605. }
  606. this.$refs.baseList.init(val, strVal, conSql)
  607. }
  608. })
  609. },
  610. /* 列表方法的回调 */
  611. getBaseData (val) {
  612. if (this.tagNo === 1056) {
  613. if (this.tagNo1 === 2) {
  614. this.modalData.documentTypeId = val.document_type_id
  615. this.modalData.documentType = val.document_type
  616. this.modalData.responsibleDepartment = val.responsible_department
  617. this.modalData.estimatedCompletionDays = val.estimated_completion_days
  618. }
  619. if (this.tagNo1 === 1) {
  620. this.searchData.documentTypeId = val.document_type_id
  621. }
  622. }
  623. },
  624. // 校验用户是否收藏
  625. favoriteIsOk () {
  626. let userFavorite = {
  627. userId: this.$store.state.user.id,
  628. languageCode: this.$i18n.locale
  629. }
  630. userFavoriteList(userFavorite).then(({data}) => {
  631. for (let i = 0; i < data.list.length; i++) {
  632. if (this.$route.meta.menuId === data.list[i].menuId) {
  633. this.favorite = true
  634. }
  635. }
  636. })
  637. },
  638. // 收藏 OR 取消收藏
  639. favoriteFunction () {
  640. let userFavorite = {
  641. userId: this.$store.state.user.id,
  642. functionId: this.$route.meta.menuId,
  643. }
  644. if (this.favorite) {
  645. removeUserFavorite(userFavorite).then(({data}) => {
  646. this.$message.success(data.msg)
  647. this.favorite = false
  648. })
  649. } else {
  650. // 收藏
  651. saveUserFavorite(userFavorite).then(({data}) => {
  652. this.$message.success(data.msg)
  653. this.favorite = true
  654. })
  655. }
  656. },
  657. //导出excel
  658. async createExportData () {
  659. this.searchData.limit = -1
  660. this.searchData.page = 1
  661. await eamBuDocumentSearch(this.searchData).then(({data}) => {
  662. this.exportList = data.page.list
  663. })
  664. return this.exportList
  665. },
  666. startDownload () {},
  667. finishDownload () {},
  668. fields () {
  669. let json = "{"
  670. this.columnList.forEach((item, index) => {
  671. if (index == this.columnList.length - 1) {
  672. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  673. } else {
  674. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  675. }
  676. })
  677. json += "}"
  678. let s = eval("(" + json + ")")
  679. return s
  680. },
  681. // 获取数据列表
  682. // 获取数据列表
  683. getDataList (params) {
  684. this.selectTypeFlag = params
  685. this.searchData.limit = this.pageSize
  686. this.searchData.page = this.pageIndex
  687. eamBuDocumentSearch(this.searchData).then(({data}) => {
  688. if (data.code === 0) {
  689. this.dataList = data.page.list
  690. this.pageIndex = data.page.currPage
  691. this.pageSize = data.page.pageSize
  692. this.totalPage = data.page.totalCount
  693. for (let i = 0; i < this.dataList.length; i++) {
  694. this.dataList[i].responsibleDepartment = this.dataList[i].roleDesc
  695. }
  696. }
  697. })
  698. },
  699. queryDataList (params) {
  700. this.selectTypeFlag = params
  701. this.searchData.limit = this.pageSize
  702. this.searchData.page = this.pageIndex
  703. if (params !== null && params !== undefined) {
  704. params.limit = this.pageSize
  705. params.page = this.pageIndex
  706. params.site = this.$store.state.user.site
  707. params.userName = this.$store.state.user.name
  708. } else {
  709. params = this.searchData
  710. }
  711. queryEamBuDocument(params).then(({data}) => {
  712. if (data.code === 0) {
  713. this.dataList = data.page.list
  714. this.pageIndex = data.page.currPage
  715. this.pageSize = data.page.pageSize
  716. this.totalPage = data.page.totalCount
  717. for (let i = 0; i < this.dataList.length; i++) {
  718. this.dataList[i].responsibleDepartment = this.dataList[i].roleDesc
  719. }
  720. }
  721. })
  722. },
  723. // 每页数
  724. sizeChangeHandle (val) {
  725. this.pageSize = val
  726. this.pageIndex = 1
  727. if (this.selectTypeFlag !== null && this.selectTypeFlag !== undefined) {
  728. this.queryDataList(this.selectTypeFlag)
  729. } else {
  730. this.getDataList()
  731. }
  732. },
  733. // 当前页
  734. currentChangeHandle (val) {
  735. this.pageIndex = val
  736. if (this.selectTypeFlag !== null && this.selectTypeFlag !== undefined) {
  737. this.queryDataList(this.selectTypeFlag)
  738. } else {
  739. this.getDataList()
  740. }
  741. },
  742. // 多选
  743. selectionChangeHandle (val) {
  744. this.dataListSelections = val
  745. },
  746. addModal () {
  747. this.modalData = {
  748. flag: '1',
  749. bu: this.userBuList[0].buNo,
  750. site: this.$store.state.user.site,
  751. documentTypeId: '',
  752. documentType: '',
  753. projectCategory: '',
  754. responsibleDepartment: '',
  755. estimatedCompletionDays: '',
  756. projectPhase: '',
  757. // active: 'Y',
  758. createBy: this.$store.state.user.name,
  759. updateBy: this.$store.state.user.name,
  760. }
  761. this.modalDisableFlag = false
  762. this.modalFlag = true
  763. },
  764. updateModal (row) {
  765. this.modalData = {
  766. flag: '2',
  767. site: row.site,
  768. id: row.id,
  769. bu: row.site + '_' + row.buNo,
  770. documentTypeId: row.documentTypeId,
  771. documentType: row.documentType,
  772. projectCategory: row.projectCategory,
  773. responsibleDepartment: row.responsibleDepartment,
  774. estimatedCompletionDays: row.estimatedCompletionDays,
  775. projectPhase: row.projectPhase,
  776. // active: row.active,
  777. createBy: this.$store.state.user.name,
  778. updateBy: this.$store.state.user.name,
  779. }
  780. this.modalCompareData = {
  781. flag: '2',
  782. site: this.modalData.site,
  783. id: this.modalData.id,
  784. bu: this.modalData.bu,
  785. documentTypeId: this.modalData.documentTypeId,
  786. documentType: this.modalData.documentType,
  787. projectCategory: this.modalData.projectCategory,
  788. responsibleDepartment: this.modalData.responsibleDepartment,
  789. estimatedCompletionDays: this.modalData.estimatedCompletionDays,
  790. projectPhase: this.modalData.projectPhase,
  791. // active: this.modalData.active,
  792. createBy: this.modalData.createBy,
  793. updateBy: this.modalData.updateBy,
  794. }
  795. this.disableButton = true
  796. this.modalDisableFlag = true
  797. this.modalFlag = true
  798. },
  799. // 删除
  800. deleteBuDocument (row) {
  801. this.$confirm(`是否删除这个BU文档清单?`, '提示', {
  802. confirmButtonText: '确定',
  803. cancelButtonText: '取消',
  804. type: 'warning'
  805. }).then(() => {
  806. eamBuDocumentDelete(row).then(({data}) => {
  807. if (data && data.code === '0') {
  808. this.getDataList()
  809. this.$message({
  810. message: '操作成功',
  811. type: 'success',
  812. duration: 1500,
  813. onClose: () => {}
  814. })
  815. } else {
  816. this.$alert(data.msg, '错误', {
  817. confirmButtonText: '确定'
  818. })
  819. }
  820. })
  821. }).catch(() => {
  822. })
  823. },
  824. saveData () {
  825. if (this.modalData.bu === '' || this.modalData.bu == null) {
  826. this.$message.warning('请选择BU!')
  827. return
  828. }
  829. if (this.modalData.documentTypeId === '' || this.modalData.documentTypeId == null) {
  830. this.$message.warning('请输入文档类型ID!')
  831. return
  832. }
  833. if (this.modalData.documentType === '' || this.modalData.documentType == null) {
  834. this.$message.warning('请输入文档类型!')
  835. return
  836. }
  837. if (this.modalData.projectCategory === '' || this.modalData.projectCategory == null) {
  838. this.$message.warning('请选择项目分类!')
  839. return
  840. }
  841. if (this.modalData.responsibleDepartment === '' || this.modalData.responsibleDepartment == null) {
  842. this.$message.warning('请输入责任部门!')
  843. return
  844. }
  845. if (this.modalData.estimatedCompletionDays === '' || this.modalData.estimatedCompletionDays == null) {
  846. this.$message.warning('请输入预计完成天数!')
  847. return
  848. }
  849. // if (this.modalData.active === '' || this.modalData.active == null) {
  850. // this.$message.warning('选择是否在用!')
  851. // return
  852. // }
  853. if (this.modalData.flag === '1') {
  854. eamBuDocumentSave(this.modalData).then(({data}) => {
  855. if (data && data.code === '0') {
  856. this.getDataList()
  857. this.modalFlag=false
  858. this.disableButton = false
  859. this.$message({
  860. message: '操作成功',
  861. type: 'success',
  862. duration: 1500,
  863. onClose: () => {}
  864. })
  865. } else {
  866. this.$alert(data.msg, '错误', {
  867. confirmButtonText: '确定'
  868. })
  869. }
  870. })
  871. } else {
  872. if (this.modalCompareData.projectCategory !== this.modalData.projectCategory || this.modalCompareData.projectPhase !== this.modalData.projectPhase) {
  873. // 用户进行了修改,可以继续保存数据
  874. // 向后端发送保存请求的逻辑
  875. eamBuDocumentEdit(this.modalData).then(({data}) => {
  876. if (data && data.code === '0') {
  877. EventBus.$emit('updateProjectInfo');
  878. this.getDataList()
  879. this.modalFlag=false
  880. this.disableButton = false
  881. this.$message({
  882. message: '操作成功',
  883. type: 'success',
  884. duration: 1500,
  885. onClose: () => {}
  886. })
  887. } else {
  888. this.$alert(data.msg, '错误', {
  889. confirmButtonText: '确定'
  890. })
  891. }
  892. })
  893. this.modalCompareData.projectPhase = ''
  894. this.modalCompareData.projectCategory = ''
  895. } else {
  896. // 用户没有修改数据,不需要保存
  897. this.modalCompareData.projectPhase = ''
  898. this.modalCompareData.projectCategory = ''
  899. this.modalFlag = false;
  900. this.disableButton = false;
  901. }
  902. }
  903. },
  904. // 动态列开始 获取 用户保存的 格式列
  905. async getTableUserColumn(tableId, columnId) {
  906. let queryTableUser = {
  907. userId: this.$store.state.user.name,
  908. functionId: this.$route.meta.menuId,
  909. tableId: tableId,
  910. status: true,
  911. languageCode: this.$i18n.locale
  912. }
  913. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  914. if (data.rows.length > 0) {
  915. //this.columnList1 = []
  916. switch (columnId) {
  917. case 1:
  918. this.columnList = data.rows
  919. break;
  920. // case 2:
  921. // this.detailColumnList = data.rows
  922. // break;
  923. // case 3:
  924. // this.columnList2 = data.rows
  925. // break;
  926. // case 4:
  927. // this.columnList3 = data.rows
  928. // break;
  929. }
  930. } else {
  931. this.getColumnList(tableId, columnId)
  932. }
  933. })
  934. },
  935. // 获取 tableDefault 列
  936. async getColumnList (tableId, columnId) {
  937. let queryTable= {
  938. functionId: this.$route.meta.menuId,
  939. tableId: tableId,
  940. languageCode: this.$i18n.locale
  941. }
  942. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  943. if (!data.rows.length == 0) {
  944. switch (columnId) {
  945. case 1:
  946. this.columnList = data.rows
  947. break;
  948. // case 2:
  949. // this.detailColumnList = data.rows
  950. // break;
  951. // case 3:
  952. // this.columnList2 = data.rows
  953. // break;
  954. // case 4:
  955. // this.columnList3 = data.rows
  956. // break;
  957. }
  958. } else {
  959. // this.showDefault = true.
  960. }
  961. })
  962. },
  963. //获取按钮的权限数据
  964. getButtonAuthData () {
  965. let searchFlag = this.isAuth(this.menuId+":search")
  966. let saveFlag = this.isAuth(this.menuId+":save")
  967. let updateFlag = this.isAuth(this.menuId+":update")
  968. let deleteFlag = this.isAuth(this.menuId+":delete")
  969. //处理页面的权限数据
  970. this.authSearch = !searchFlag
  971. this.authSave = !saveFlag
  972. this.authUpdate = !updateFlag
  973. this.authDelete = !deleteFlag
  974. },
  975. handleInput() {
  976. this.isDataModified = true;
  977. }
  978. }
  979. }
  980. </script>
  981. <style scoped>
  982. .disabled-link {
  983. pointer-events: none; /* 禁止点击 */
  984. color: gray; /* 可选,改变颜色来显示不可点击状态 */
  985. text-decoration: none; /* 可选,去掉链接的下划线 */
  986. }
  987. </style>