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.

1061 lines
34 KiB

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