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.

1071 lines
35 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
1 year 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 year 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
3 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 year ago
1 year ago
4 years ago
1 year 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" @keyup.enter.native="getDataList()">
  4. <el-form-item :label="'机修人员编码'">
  5. <el-input v-model="searchData.adminID" clearable style="width: 120px"></el-input>
  6. </el-form-item>
  7. <el-form-item :label="'机修人员姓名'">
  8. <el-input v-model="searchData.adminName" clearable style="width: 120px"></el-input>
  9. </el-form-item>
  10. <el-form-item :label="'所属部门'">
  11. <el-input v-model="searchData.departmentName" clearable style="width: 120px"></el-input>
  12. </el-form-item>
  13. <el-form-item :label="'在用'">
  14. <el-select filterable v-model="searchData.active" style="width: 130px">
  15. <el-option label="全部" value=""></el-option>
  16. <el-option label="是" value="Y"></el-option>
  17. <el-option label="否" value="N"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item :label="' '">
  21. <el-button @click="getDataList()">查询</el-button>
  22. <el-button type="primary" @click="addModal()">新增</el-button>
  23. <el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
  24. <!-- <download-excel-->
  25. <!-- :fields="fields()"-->
  26. <!-- :data="exportData"-->
  27. <!-- type="xls"-->
  28. <!-- :name="exportName"-->
  29. <!-- :header="exportHeader"-->
  30. <!-- :footer="exportFooter"-->
  31. <!-- :fetch="createExportData"-->
  32. <!-- :before-generate="startDownload"-->
  33. <!-- :before-finish="finishDownload"-->
  34. <!-- worksheet="导出信息"-->
  35. <!-- class="el-button el-button&#45;&#45;primary el-button&#45;&#45;medium">-->
  36. <!-- {{ "导出" }}-->
  37. <!-- </download-excel>-->
  38. </el-form-item>
  39. </el-form>
  40. <el-table
  41. :height="height"
  42. :data="dataList"
  43. border
  44. style="width: 100%;">
  45. <el-table-column
  46. v-for="(item,index) in columnList" :key="index"
  47. :sortable="item.columnSortable"
  48. :prop="item.columnProp"
  49. :header-align="item.headerAlign"
  50. :show-overflow-tooltip="item.showOverflowTooltip"
  51. :align="item.align"
  52. :fixed="item.fixed==''?false:item.fixed"
  53. :min-width="item.columnWidth"
  54. :label="item.columnLabel">
  55. <template slot-scope="scope">
  56. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  57. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. fixed="right"
  62. header-align="center"
  63. align="center"
  64. width="100"
  65. label="操作">
  66. <template slot-scope="scope">
  67. <a type="text" size="small" @click="updateModal(scope.row)">修改</a>
  68. <a type="text" size="small" @click="deleteAdmin(scope.row)">删除</a>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. <el-pagination
  73. @size-change="sizeChangeHandle"
  74. @current-change="currentChangeHandle"
  75. :current-page="pageIndex"
  76. :page-sizes="[20, 50, 100, 200, 500]"
  77. :page-size="pageSize"
  78. :total="totalPage"
  79. layout="total, sizes, prev, pager, next, jumper">
  80. </el-pagination>
  81. <el-dialog title="机修人员" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="430px">
  82. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  83. <el-form-item label="BU" prop="bu" :rules="rules.bu">
  84. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 230px">
  85. <el-option
  86. v-for = "i in userBuList"
  87. :key = "i.buNo"
  88. :label = "i.sitename"
  89. :value = "i.buNo">
  90. <span style="float: left;width: 100px">{{ i.sitename }}</span>
  91. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
  92. {{ i.buDesc }}
  93. </span>
  94. </el-option>
  95. </el-select>
  96. </el-form-item>
  97. <el-form-item label="是否在用:" prop="active" :rules="rules.activeType">
  98. <el-select filterable v-model="modalData.active" style="width: 140px">
  99. <el-option label="是" value="Y"></el-option>
  100. <el-option label="否" value="N"></el-option>
  101. </el-select>
  102. </el-form-item>
  103. </el-form>
  104. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  105. <el-form-item label="机修人员编码:" prop="adminID" :rules="rules.adminIdType">
  106. <el-input v-model="modalData.adminID" :disabled="modalDisableFlag" style="width: 140px"></el-input>
  107. </el-form-item>
  108. <el-form-item label="机修人员姓名:" prop="adminName" :rules="rules.adminNameType">
  109. <el-input v-model="modalData.adminName" style="width: 230px"></el-input>
  110. </el-form-item>
  111. </el-form>
  112. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  113. <el-form-item prop="departmentName" :rules="rules.departmentNameType">
  114. <span slot="label" @click="getDepartmentList()"><a>部门</a></span>
  115. <el-input v-model="modalData.departmentName" style="width: 383px"></el-input>
  116. </el-form-item>
  117. </el-form>
  118. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  119. <el-form-item label="手机号码:">
  120. <el-input v-model="modalData.phone" style="width: 140px"></el-input>
  121. </el-form-item>
  122. <el-form-item label="公司座机:">
  123. <el-input v-model="modalData.tel" style="width: 230px"></el-input>
  124. </el-form-item>
  125. </el-form>
  126. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  127. <el-form-item label="登录账号:">
  128. <el-select v-model="modalData.mesUser" placeholder="请选择" style="width: 140px">
  129. <el-option
  130. v-for = "i in mesList"
  131. :key = "i.username"
  132. :label = "i.username"
  133. :value = "i.username">
  134. </el-option>
  135. </el-select>
  136. </el-form-item>
  137. <el-form-item label="邮箱:">
  138. <el-input v-model="modalData.email" style="width: 230px"></el-input>
  139. </el-form-item>
  140. </el-form>
  141. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  142. <el-form-item prop="levelDesc" :rules="rules.levelDescType">
  143. <span slot="label" style="" @click="getBaseList(202)"><a href="#">工种编码</a></span>
  144. <el-input v-model="modalData.levelID" style="width: 140px"></el-input>
  145. </el-form-item>
  146. <el-form-item label="工种名称">
  147. <el-input v-model="modalData.levelDesc" disabled style="width: 230px"></el-input>
  148. </el-form-item>
  149. </el-form>
  150. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  151. <el-button type="primary" @click="saveData()">保存</el-button>
  152. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  153. </el-footer>
  154. </el-dialog>
  155. <!-- 部门 -->
  156. <el-dialog title="部门清单" :close-on-click-modal="false" v-drag :visible.sync="departmentModelFlag" width="520px">
  157. <div class="rq">
  158. <el-form :inline="true" label-position="top" :model="departmentData">
  159. <el-form-item :label="'部门编码'">
  160. <el-input v-model="departmentData.deptId" clearable style="width: 120px"></el-input>
  161. </el-form-item>
  162. <el-form-item :label="'部门名称'">
  163. <el-input v-model="departmentData.deptName" clearable style="width: 120px"></el-input>
  164. </el-form-item>
  165. <el-form-item :label="' '">
  166. <el-button type="primary" @click="getDepartmentList()">查询</el-button>
  167. </el-form-item>
  168. </el-form>
  169. <el-table
  170. :height="300"
  171. :data="departmentList"
  172. ref="departmentTable"
  173. @row-click="departmentClickRow"
  174. @selection-change="selectionDepartment"
  175. :row-key="getRowKeys"
  176. border
  177. style="width: 100%;">
  178. <el-table-column
  179. type="selection"
  180. header-align="center"
  181. align="center"
  182. :reserve-selection="true"
  183. width="50">
  184. </el-table-column>
  185. <el-table-column
  186. v-for="(item,index) in departmentDetailList" :key="index"
  187. :sortable="item.columnSortable"
  188. :prop="item.columnProp"
  189. :header-align="item.headerAlign"
  190. :show-overflow-tooltip="item.showOverflowTooltip"
  191. :align="item.align"
  192. :fixed="item.fixed==''?false:item.fixed"
  193. :min-width="item.columnWidth"
  194. :label="item.columnLabel">
  195. <template slot-scope="scope">
  196. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  197. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  198. </template>
  199. </el-table-column>
  200. </el-table>
  201. </div>
  202. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  203. <el-button type="primary" @click="confirmDepartment()">确认</el-button>
  204. <el-button type="primary" @click="departmentModelFlag = false">关闭</el-button>
  205. </el-footer>
  206. </el-dialog>
  207. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  208. </div>
  209. </template>
  210. <script>
  211. import {
  212. eamAdminSearch,
  213. eamAdminSave,
  214. eamAdminEdit,
  215. eamAdminDelete,
  216. getEmpyDeptList,
  217. getMesList, // 获取可用的MES账号
  218. getSiteAndBuByUserName
  219. } from "@/api/eam/eam.js"
  220. import Chooselist from '@/views/modules/common/Chooselist_eam'
  221. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  222. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  223. import excel from "@/utils/excel-util.js";
  224. export default {
  225. components: {
  226. Chooselist
  227. },
  228. watch: {
  229. searchData: {
  230. deep: true,
  231. handler: function (newV, oldV) {
  232. this.searchData.adminID = this.searchData.adminID.toUpperCase()
  233. }
  234. },
  235. modalData: {
  236. deep: true,
  237. handler: function (newV, oldV) {
  238. this.modalData.adminID = this.modalData.adminID.toUpperCase()
  239. this.modalData.levelID = this.modalData.levelID.toUpperCase()
  240. }
  241. }
  242. },
  243. data () {
  244. return {
  245. // 是否收藏
  246. favorite: false,
  247. // 导出 start
  248. exportData: [],
  249. exportName: "机修人员" + this.dayjs().format('YYYYMMDDHHmmss'),
  250. exportHeader: ["机修人员"],
  251. exportFooter: [],
  252. exportList: [],
  253. // 导出 end
  254. tagNo: '',
  255. searchData: {
  256. site: this.$store.state.user.site,
  257. userName: this.$store.state.user.name,
  258. adminID: '',
  259. adminName: '',
  260. departmentName: '',
  261. active: 'Y',
  262. page: 1,
  263. limit: 10,
  264. },
  265. pageIndex: 1,
  266. pageSize: 20,
  267. totalPage: 0,
  268. height: 200,
  269. dataList: [],
  270. dataListSelections: [],
  271. modalFlag: false,
  272. modalDisableFlag: false,
  273. modalData: {
  274. flag: '',
  275. bu: '',
  276. site: this.$store.state.user.site,
  277. adminID: '',
  278. adminName: '',
  279. active: '',
  280. department: '',
  281. departmentName: '',
  282. phone: '',
  283. tel: '',
  284. email: '',
  285. levelID: '',
  286. levelDesc: '',
  287. mesUser: '',
  288. createdBy: this.$store.state.user.name,
  289. updateBy: this.$store.state.user.name,
  290. },
  291. departmentList:[],
  292. // 展示列集
  293. columnList: [
  294. {
  295. userId: this.$store.state.user.name,
  296. functionId: 101001007,
  297. serialNumber: '101001007Table1BuDesc',
  298. tableId: "101001007Table1",
  299. tableName: "机修人员表",
  300. columnProp: 'buDesc',
  301. headerAlign: "center",
  302. align: "left",
  303. columnLabel: 'BU',
  304. columnHidden: false,
  305. columnImage: false,
  306. columnSortable: false,
  307. sortLv: 0,
  308. status: true,
  309. fixed: '',
  310. columnWidth: 100,
  311. },
  312. {
  313. userId: this.$store.state.user.name,
  314. functionId: 101001007,
  315. serialNumber: '101001007Table1AdminID',
  316. tableId: "101001007Table1",
  317. tableName: "机修人员表",
  318. columnProp: 'adminID',
  319. headerAlign: "center",
  320. align: "left",
  321. columnLabel: '机修人员编码',
  322. columnHidden: false,
  323. columnImage: false,
  324. columnSortable: false,
  325. sortLv: 0,
  326. status: true,
  327. fixed: '',
  328. columnWidth: 80,
  329. },
  330. {
  331. userId: this.$store.state.user.name,
  332. functionId: 101001007,
  333. serialNumber: '101001007Table1AdminName',
  334. tableId: "101001007Table1",
  335. tableName: "机修人员表",
  336. columnProp: 'adminName',
  337. headerAlign: "center",
  338. align: "left",
  339. columnLabel: '机修人员姓名',
  340. columnHidden: false,
  341. columnImage: false,
  342. columnSortable: false,
  343. sortLv: 0,
  344. status: true,
  345. fixed: '',
  346. columnWidth: 117,
  347. },
  348. {
  349. userId: this.$store.state.user.name,
  350. functionId: 101001007,
  351. serialNumber: '101001007Table1Active',
  352. tableId: "101001007Table1",
  353. tableName: "机修人员表",
  354. columnProp: 'active',
  355. headerAlign: "center",
  356. align: "center",
  357. columnLabel: '在用',
  358. columnHidden: false,
  359. columnImage: false,
  360. columnSortable: false,
  361. sortLv: 0,
  362. status: true,
  363. fixed: '',
  364. columnWidth: 70,
  365. },
  366. {
  367. userId: this.$store.state.user.name,
  368. functionId: 101001007,
  369. serialNumber: '101001007Table1DepartmentName',
  370. tableId: "101001007Table1",
  371. tableName: "机修人员表",
  372. columnProp: 'departmentName',
  373. headerAlign: "center",
  374. align: "left",
  375. columnLabel: '部门',
  376. columnHidden: false,
  377. columnImage: false,
  378. columnSortable: false,
  379. sortLv: 0,
  380. status: true,
  381. fixed: '',
  382. columnWidth: 370,
  383. },
  384. {
  385. userId: this.$store.state.user.name,
  386. functionId: 101001007,
  387. serialNumber: '101001007Table1Phone',
  388. tableId: "101001007Table1",
  389. tableName: "机修人员表",
  390. columnProp: 'phone',
  391. headerAlign: "center",
  392. align: "center",
  393. columnLabel: '手机号码',
  394. columnHidden: false,
  395. columnImage: false,
  396. columnSortable: false,
  397. sortLv: 0,
  398. status: true,
  399. fixed: '',
  400. columnWidth: 80,
  401. },
  402. {
  403. userId: this.$store.state.user.name,
  404. functionId: 101001007,
  405. serialNumber: '101001007Table1Tel',
  406. tableId: "101001007Table1",
  407. tableName: "机修人员表",
  408. columnProp: 'tel',
  409. headerAlign: "center",
  410. align: "center",
  411. columnLabel: '公司座机',
  412. columnHidden: false,
  413. columnImage: false,
  414. columnSortable: false,
  415. sortLv: 0,
  416. status: true,
  417. fixed: '',
  418. columnWidth: 90,
  419. },
  420. {
  421. userId: this.$store.state.user.name,
  422. functionId: 101001007,
  423. serialNumber: '101001007Table1Email',
  424. tableId: "101001007Table1",
  425. tableName: "机修人员表",
  426. columnProp: 'email',
  427. headerAlign: "center",
  428. align: "left",
  429. columnLabel: '邮箱',
  430. columnHidden: false,
  431. columnImage: false,
  432. columnSortable: false,
  433. sortLv: 0,
  434. status: true,
  435. fixed: '',
  436. columnWidth: 161,
  437. },
  438. {
  439. userId: this.$store.state.user.name,
  440. functionId: 101001007,
  441. serialNumber: '101001007Table1AdminLevelDesc',
  442. tableId: "101001007Table1",
  443. tableName: "机修人员表",
  444. columnProp: 'adminLevelDesc',
  445. headerAlign: "center",
  446. align: "left",
  447. columnLabel: '工种',
  448. columnHidden: false,
  449. columnImage: false,
  450. columnSortable: false,
  451. sortLv: 0,
  452. status: true,
  453. fixed: '',
  454. columnWidth: 143,
  455. },
  456. {
  457. userId: this.$store.state.user.name,
  458. functionId: 101001007,
  459. serialNumber: '101001007Table1MesUser',
  460. tableId: "101001007Table1",
  461. tableName: "机修人员表",
  462. columnProp: 'mesUser',
  463. headerAlign: "center",
  464. align: "left",
  465. columnLabel: '登录账号',
  466. columnHidden: false,
  467. columnImage: false,
  468. columnSortable: false,
  469. sortLv: 0,
  470. status: true,
  471. fixed: '',
  472. columnWidth: 70,
  473. },
  474. {
  475. userId: this.$store.state.user.name,
  476. functionId: 101001007,
  477. serialNumber: '101001007Table1CreatedDate',
  478. tableId: "101001007Table1",
  479. tableName: "机修人员表",
  480. columnProp: 'createdDate',
  481. headerAlign: "center",
  482. align: "center",
  483. columnLabel: '创建时间',
  484. columnHidden: false,
  485. columnImage: false,
  486. columnSortable: false,
  487. sortLv: 0,
  488. status: true,
  489. fixed: '',
  490. columnWidth: 125,
  491. },
  492. {
  493. userId: this.$store.state.user.name,
  494. functionId: 101001007,
  495. serialNumber: '101001007Table1CreatedBy',
  496. tableId: "101001007Table1",
  497. tableName: "机修人员表",
  498. columnProp: 'createdBy',
  499. headerAlign: "center",
  500. align: "left",
  501. columnLabel: '创建人',
  502. columnHidden: false,
  503. columnImage: false,
  504. columnSortable: false,
  505. sortLv: 0,
  506. status: true,
  507. fixed: '',
  508. columnWidth: 70,
  509. },
  510. {
  511. userId: this.$store.state.user.name,
  512. functionId: 101001007,
  513. serialNumber: '101001007Table1UpdateDate',
  514. tableId: "101001007Table1",
  515. tableName: "机修人员表",
  516. columnProp: 'updateDate',
  517. headerAlign: "center",
  518. align: "center",
  519. columnLabel: '更新时间',
  520. columnHidden: false,
  521. columnImage: false,
  522. columnSortable: false,
  523. sortLv: 0,
  524. status: true,
  525. fixed: '',
  526. columnWidth: 125,
  527. },
  528. {
  529. userId: this.$store.state.user.name,
  530. functionId: 101001007,
  531. serialNumber: '101001007Table1UpdateBy',
  532. tableId: "101001007Table1",
  533. tableName: "机修人员表",
  534. columnProp: 'updateBy',
  535. headerAlign: "center",
  536. align: "left",
  537. columnLabel: '更新人',
  538. columnHidden: false,
  539. columnImage: false,
  540. columnSortable: false,
  541. sortLv: 0,
  542. status: true,
  543. fixed: '',
  544. columnWidth: 70,
  545. },
  546. ],
  547. levelList:[],
  548. departmentModelFlag: false,
  549. departmentData: {
  550. site: this.$store.state.user.site,
  551. userName: this.$store.state.user.name,
  552. deptId: '',
  553. deptName: '',
  554. },
  555. departmentListSelections: [],
  556. departmentDetailList: [
  557. {
  558. columnProp: 'deptId',
  559. headerAlign: "center",
  560. align: "left",
  561. columnLabel: '部门编码',
  562. columnHidden: false,
  563. columnImage: false,
  564. columnSortable: false,
  565. sortLv: 0,
  566. status: true,
  567. fixed: '',
  568. },
  569. {
  570. columnProp: 'deptName',
  571. headerAlign: "center",
  572. align: "left",
  573. columnLabel: '部门名称',
  574. columnHidden: false,
  575. columnImage: false,
  576. columnSortable: false,
  577. sortLv: 0,
  578. status: true,
  579. fixed: '',
  580. },
  581. ],
  582. mesList: [],
  583. rules:{
  584. adminIdType:[
  585. {
  586. required: true,
  587. message: ' ',
  588. trigger: ['blur','change']
  589. }
  590. ],
  591. adminNameType:[
  592. {
  593. required: true,
  594. message: ' ',
  595. trigger: ['blur','change']
  596. }
  597. ],
  598. activeType:[
  599. {
  600. required: true,
  601. message: ' ',
  602. trigger: ['blur','change']
  603. }
  604. ],
  605. departmentNameType:[
  606. {
  607. required: true,
  608. message: ' ',
  609. trigger: ['blur','change']
  610. }
  611. ],
  612. levelDescType:[
  613. {
  614. required: true,
  615. message: ' ',
  616. trigger: ['blur','change']
  617. }
  618. ],
  619. bu:[
  620. {
  621. required: true,
  622. message: ' ',
  623. trigger: ['blur','change']
  624. }
  625. ]
  626. },
  627. userBuList: []
  628. }
  629. },
  630. mounted () {
  631. this.$nextTick(() => {
  632. this.height = window.innerHeight - 210
  633. })
  634. },
  635. created () {
  636. // 获取用户的 site 和 bu
  637. this.getSiteAndBuByUserName()
  638. // 校验用户是否收藏
  639. this.favoriteIsOk()
  640. // 获取数据列表
  641. this.getDataList()
  642. // 动态列
  643. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  644. },
  645. methods: {
  646. // 获取用户的bu
  647. getSiteAndBuByUserName () {
  648. let tempData = {
  649. username: this.$store.state.user.name,
  650. }
  651. getSiteAndBuByUserName(tempData).then(({data}) => {
  652. if (data.code === 0) {
  653. this.userBuList = data.rows
  654. }
  655. })
  656. },
  657. // 部门
  658. departmentClickRow (row) {
  659. this.$refs.departmentTable.toggleRowSelection(row);
  660. },
  661. // 多选
  662. selectionDepartment (val) {
  663. this.departmentListSelections = val
  664. },
  665. getRowKeys (row) {
  666. //唯一值,一般都为id
  667. return row.deptId
  668. },
  669. selectFlag () {
  670. return true
  671. },
  672. // 确认多选部门
  673. confirmDepartment () {
  674. if (this.departmentListSelections.length === 0) {
  675. this.$message.warning('请勾选部门!')
  676. return
  677. }
  678. this.modalData.department = ''
  679. this.modalData.departmentName = ''
  680. for (let i = 0; i < this.departmentListSelections.length; i++) {
  681. this.modalData.department = this.modalData.department + ";" + this.departmentListSelections[i].deptId
  682. this.modalData.departmentName = this.modalData.departmentName + ";" + this.departmentListSelections[i].deptName
  683. }
  684. this.modalData.department = this.modalData.department.substring(1)
  685. this.modalData.departmentName = this.modalData.departmentName.substring(1)
  686. this.departmentModelFlag = false
  687. },
  688. // 获取基础数据列表S
  689. getBaseList (val) {
  690. this.tagNo = val
  691. this.$nextTick(() => {
  692. let strVal = ''
  693. if (val === 202) {
  694. strVal = this.modalData.levelID
  695. }
  696. this.$refs.baseList.init(val, strVal)
  697. })
  698. },
  699. /* 列表方法的回调 */
  700. getBaseData (val) {
  701. if (this.tagNo === 202) {
  702. this.modalData.levelID = val.AdminLevelID
  703. this.$set(this.modalData,'levelDesc',val.AdminLevelDesc);
  704. }
  705. },
  706. async exportExcel() {
  707. this.searchData.limit = -1
  708. this.searchData.page = 1
  709. excel.exportTable({
  710. url: "/pms/eam/eamAdminSearch",
  711. columnMapping: this.columnList,//可以直接用table,不需要的列就剔除
  712. mergeSetting: [],//需要合并的列
  713. params: this.searchData,
  714. fileName: this.exportName+".xlsx",
  715. rowFetcher: res => res.data,
  716. columnFormatter: [],
  717. dropColumns: [],//需要剔除的列,例如dropColumns: ["netWeight"],即剔除净重列
  718. });
  719. },
  720. //导出excel
  721. // async createExportData() {
  722. // this.searchData.limit = -1
  723. // this.searchData.page = 1
  724. // await eamAdminSearch(this.searchData).then(({data}) => {
  725. // this.exportList = data.rows
  726. // })
  727. // return this.exportList
  728. // },
  729. // startDownload() {},
  730. // finishDownload() {},
  731. // fields () {
  732. // let json = "{"
  733. // this.columnList.forEach((item, index) => {
  734. // if (index == this.columnList.length - 1) {
  735. // json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  736. // } else {
  737. // json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  738. // }
  739. // })
  740. // json += "}"
  741. // let s = eval("(" + json + ")")
  742. // return s
  743. // },
  744. // 获取数据列表
  745. getDataList () {
  746. // this.searchData.limit = this.pageSize
  747. // this.searchData.page = this.pageIndex
  748. eamAdminSearch(this.searchData).then(({data}) => {
  749. if (data.code === 0) {
  750. this.dataList = data.rows
  751. // this.pageIndex = data.page.currPage
  752. // this.pageSize = data.page.pageSize
  753. // this.totalPage = data.page.totalCount
  754. }
  755. })
  756. },
  757. // 每页数
  758. sizeChangeHandle (val) {
  759. this.pageSize = val
  760. this.pageIndex = 1
  761. this.getDataList()
  762. },
  763. // 当前页
  764. currentChangeHandle (val) {
  765. this.pageIndex = val
  766. this.getDataList()
  767. },
  768. // 多选
  769. selectionChangeHandle (val) {
  770. this.dataListSelections = val
  771. },
  772. addModal () {
  773. this.modalData = {
  774. flag: '1',
  775. bu: this.userBuList[0].buNo,
  776. site: this.$store.state.user.site,
  777. adminID: '',
  778. adminName: '',
  779. active: 'Y',
  780. departmentName: '',
  781. department: '',
  782. phone: '',
  783. tel: '',
  784. email: '',
  785. levelID: '',
  786. levelDesc: '',
  787. mesUser: '',
  788. createdBy: this.$store.state.user.name,
  789. updateBy: this.$store.state.user.name,
  790. }
  791. let inData = {
  792. site: this.$store.state.user.site,
  793. }
  794. getMesList(inData).then(({data}) => {
  795. this.mesList = data.rows
  796. })
  797. this.modalDisableFlag = false
  798. this.modalFlag = true
  799. },
  800. updateModal (row) {
  801. this.modalData = {
  802. flag: '2',
  803. bu: row.site + '_' + row.buNo,
  804. site: row.site,
  805. adminID: row.adminID,
  806. adminName: row.adminName,
  807. active: row.active,
  808. department: row.department,
  809. departmentName: row.departmentName,
  810. phone: row.phone,
  811. tel: row.tel,
  812. email: row.email,
  813. levelID: row.levelID,
  814. levelDesc: row.adminLevelDesc,
  815. mesUser: row.mesUser,
  816. updateBy: this.$store.state.user.name,
  817. }
  818. let inData = {
  819. site: this.$store.state.user.site,
  820. }
  821. getMesList(inData).then(({data}) => {
  822. this.mesList = data.rows
  823. })
  824. this.modalDisableFlag = true
  825. this.modalFlag = true
  826. },
  827. // 删除
  828. deleteAdmin (row) {
  829. this.$confirm(`是否删除这个机修人员?`, '提示', {
  830. confirmButtonText: '确定',
  831. cancelButtonText: '取消',
  832. type: 'warning'
  833. }).then(() => {
  834. eamAdminDelete(row).then(({data}) => {
  835. if (data && data.code === '0') {
  836. this.getDataList()
  837. this.$message({
  838. message: '操作成功',
  839. type: 'success',
  840. duration: 1500,
  841. onClose: () => {}
  842. })
  843. } else {
  844. this.$alert(data.msg, '错误', {
  845. confirmButtonText: '确定'
  846. })
  847. }
  848. })
  849. }).catch(() => {
  850. })
  851. },
  852. saveData(){
  853. if (this.modalData.adminID === '' || this.modalData.adminID == null) {
  854. this.$alert('请输入机修人员编码!', '错误', {
  855. confirmButtonText: '确定'
  856. })
  857. return false
  858. }
  859. if (this.modalData.adminName === '' || this.modalData.adminName == null) {
  860. this.$alert('请输入机修人员姓名!', '错误', {
  861. confirmButtonText: '确定'
  862. })
  863. return false
  864. }
  865. if (this.modalData.active === '' || this.modalData.active == null) {
  866. this.$alert('选择是否在用!', '错误', {
  867. confirmButtonText: '确定'
  868. })
  869. return false
  870. }
  871. if (this.modalData.department === '' || this.modalData.department == null) {
  872. this.$alert('请选择部门!', '错误', {
  873. confirmButtonText: '确定'
  874. })
  875. return false
  876. }
  877. if (this.modalData.levelID === '' || this.modalData.levelID == null) {
  878. this.$alert('请选择工种!', '错误', {
  879. confirmButtonText: '确定'
  880. })
  881. return false
  882. }
  883. if (this.modalData.flag === '1') {
  884. eamAdminSave(this.modalData).then(({data}) => {
  885. if (data && data.code === '0') {
  886. this.getDataList()
  887. this.modalFlag = false
  888. this.$message({
  889. message: '操作成功',
  890. type: 'success',
  891. duration: 1500,
  892. onClose: () => {}
  893. })
  894. } else {
  895. this.$alert(data.msg, '错误', {
  896. confirmButtonText: '确定'
  897. })
  898. }
  899. })
  900. } else {
  901. eamAdminEdit(this.modalData).then(({data}) => {
  902. if (data && data.code === '0') {
  903. this.getDataList()
  904. this.modalFlag = false
  905. this.$message({
  906. message: '操作成功',
  907. type: 'success',
  908. duration: 1500,
  909. onClose: () => {}
  910. })
  911. } else {
  912. this.$alert(data.msg, '错误', {
  913. confirmButtonText: '确定'
  914. })
  915. }
  916. })
  917. }
  918. },
  919. // 获取部门列表
  920. getDepartmentList () {
  921. // 先清空缓存选中
  922. this.$nextTick(() => this.$refs.departmentTable.clearSelection())
  923. // 拿到选中的部门编号
  924. let tempDataList = (this.modalData.department == null ? '' : this.modalData.department).split(';')
  925. // 查询所有部门
  926. getEmpyDeptList(this.departmentData).then(({data}) => {
  927. if (data && data.code === 0) {
  928. this.departmentList = data.rows
  929. this.departmentList.forEach(val => {
  930. // 回显选中的部门
  931. if (tempDataList.includes(val.deptId)) {
  932. this.$nextTick(() => this.$refs.departmentTable.toggleRowSelection(val, true))
  933. }
  934. })
  935. this.departmentModelFlag = true
  936. }else {
  937. this.$alert(data.msg, '错误', {
  938. confirmButtonText: '确定'
  939. })
  940. }
  941. })
  942. },
  943. // 校验用户是否收藏
  944. favoriteIsOk () {
  945. let userFavorite = {
  946. userId: this.$store.state.user.id,
  947. languageCode: this.$i18n.locale
  948. }
  949. userFavoriteList(userFavorite).then(({data}) => {
  950. for (let i = 0; i < data.list.length; i++) {
  951. if(this.$route.meta.menuId==data.list[i].menuId){
  952. this.favorite = true
  953. }
  954. }
  955. })
  956. },
  957. // 收藏 OR 取消收藏
  958. favoriteFunction () {
  959. let userFavorite = {
  960. userId: this.$store.state.user.id,
  961. functionId: this.$route.meta.menuId,
  962. }
  963. if (this.favorite) {
  964. removeUserFavorite(userFavorite).then(({data}) => {
  965. this.$message.success(data.msg)
  966. this.favorite = false
  967. })
  968. } else {
  969. // 收藏
  970. saveUserFavorite(userFavorite).then(({data}) => {
  971. this.$message.success(data.msg)
  972. this.favorite = true
  973. })
  974. }
  975. },
  976. // 动态列开始 获取 用户保存的 格式列
  977. async getTableUserColumn (tableId, columnId) {
  978. let queryTableUser = {
  979. userId: this.$store.state.user.name,
  980. functionId: this.$route.meta.menuId,
  981. tableId: tableId,
  982. status: true,
  983. languageCode: this.$i18n.locale
  984. }
  985. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  986. if (data.rows.length > 0) {
  987. //this.columnList1 = []
  988. switch (columnId) {
  989. case 1:
  990. this.columnList = data.rows
  991. break;
  992. // case 2:
  993. // this.detailColumnList = data.rows
  994. // break;
  995. // case 3:
  996. // this.columnList2 = data.rows
  997. // break;
  998. // case 4:
  999. // this.columnList3 = data.rows
  1000. // break;
  1001. }
  1002. } else {
  1003. this.getColumnList(tableId, columnId)
  1004. }
  1005. })
  1006. },
  1007. // 获取 tableDefault 列
  1008. async getColumnList(tableId, columnId) {
  1009. let queryTable= {
  1010. functionId: this.$route.meta.menuId,
  1011. tableId: tableId,
  1012. languageCode: this.$i18n.locale
  1013. }
  1014. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  1015. if (!data.rows.length == 0) {
  1016. switch (columnId) {
  1017. case 1:
  1018. this.columnList = data.rows
  1019. break;
  1020. // case 2:
  1021. // this.detailColumnList = data.rows
  1022. // break;
  1023. // case 3:
  1024. // this.columnList2 = data.rows
  1025. // break;
  1026. // case 4:
  1027. // this.columnList3 = data.rows
  1028. // break;
  1029. }
  1030. } else {
  1031. // this.showDefault = true.
  1032. }
  1033. })
  1034. },
  1035. }
  1036. }
  1037. </script>