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.

1702 lines
53 KiB

9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
4 months ago
4 months ago
7 months ago
9 months ago
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
7 months ago
9 months ago
​
​
7 months ago
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
9 months ago
​
9 months ago
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
9 months ago
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
9 months ago
​
​
​
9 months ago
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
7 months ago
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
9 months ago
​
9 months ago
​
​
9 months ago
​
9 months ago
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 months ago
9 months ago
2 months ago
9 months ago
2 months ago
9 months ago
​
​
​
​
​
​
2 months ago
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
2 months ago
9 months ago
​
​
​
​
​
9 months ago
​
​
9 months ago
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
2 months ago
9 months ago
2 months ago
9 months ago
2 months ago
​
​
​
​
9 months ago
​
​
2 months ago
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
2 months ago
9 months ago
2 months ago
9 months ago
2 months ago
​
​
​
​
9 months ago
​
​
2 months ago
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
9 months ago
​
​
​
9 months ago
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
9 months ago
9 months ago
​
​
​
9 months ago
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
9 months ago
​
9 months ago
​
​
​
9 months ago
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
9 months ago
​
9 months ago
​
​
9 months ago
​
​
​
​
​
​
​
9 months ago
​
​
​
​
​
​
9 months ago
9 months ago
9 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <template>
  2. <div class="mod-user">
  3. <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
  4. <el-form-item>
  5. <el-input v-model="dataForm.userName" placeholder="用户账号" clearable></el-input>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-input v-model="dataForm.userDisplay" placeholder="用户名" clearable></el-input>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-select v-model="dataForm.type" placeholder="类型" clearable style="width: 150px;">
  12. <el-option
  13. v-for="i in typeOptions"
  14. :key="i.value"
  15. :label="i.label"
  16. :value="i.value">
  17. </el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button @click="getDataList" type="primary">{{ buttons.search || '查询' }}</el-button>
  22. <el-button v-if="isAuth('sys:user:save')" type="primary" @click="addOrUpdateHandle()">{{ buttons.add || '新增' }}</el-button>
  23. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="siteAuthorize()">{{ buttons.factoryAuthorization || '工厂授权' }}</el-button>
  24. <!-- <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="buAuthorize()">{{ buttons.buAuthorization || 'BU授权' }}</el-button>-->
  25. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="viewUserDept()">{{ buttons.viewUserDept || '查看部门' }}</el-button>
  26. <!-- <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="deptAuthorize()">{{ buttons.deptAuthorization || '部门授权' }}</el-button>-->
  27. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="businessRoleAuthorize()">{{ buttons.businessRoleAuthorization || '岗位' }}
  28. </el-button>
  29. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="specialAuthorize()">{{ buttons.specialCompetencies || '特殊权限' }}</el-button>
  30. </el-form-item>
  31. </el-form>
  32. <el-table
  33. :data="dataList"
  34. border
  35. :height="height"
  36. v-loading="dataListLoading"
  37. @selection-change="selectionChangeHandle"
  38. highlight-current-row
  39. @current-change="handleCurrentChange"
  40. style="width: 100%;">
  41. <el-table-column
  42. prop="username"
  43. header-align="center"
  44. align="center"
  45. :label="buttons.username||'用户账号'">
  46. </el-table-column>
  47. <el-table-column
  48. prop="userDisplay"
  49. header-align="center"
  50. align="center"
  51. :label="buttons.userDisplay||'用户名'">
  52. </el-table-column>
  53. <el-table-column
  54. prop="type"
  55. header-align="center"
  56. align="center"
  57. :label="'类型'">
  58. <template slot-scope="scope">
  59. {{ typeLabel(scope.row.type) }}
  60. </template>
  61. </el-table-column>
  62. <el-table-column
  63. prop="email"
  64. header-align="center"
  65. align="center"
  66. :label="buttons.email||'邮箱'">
  67. </el-table-column>
  68. <el-table-column
  69. prop="mobile"
  70. header-align="center"
  71. align="center"
  72. :label="buttons.mobile||'手机号'">
  73. </el-table-column>
  74. <el-table-column
  75. prop="status"
  76. header-align="center"
  77. align="center"
  78. :label="buttons.status||'状态'">
  79. <template slot-scope="scope">
  80. <el-link v-if="scope.row.status === 0" type="success">{{ buttons.disable || '禁用' }}</el-link>
  81. <el-link v-else type="danger">{{ buttons.normal || '正常' }}</el-link>
  82. </template>
  83. </el-table-column>
  84. <el-table-column
  85. prop="createTime"
  86. header-align="center"
  87. align="center"
  88. width="180"
  89. :label="buttons.createTime||'创建时间'">
  90. </el-table-column>
  91. <!-- <el-table-column-->
  92. <!-- prop="workShopName"-->
  93. <!-- header-align="center"-->
  94. <!-- align="center"-->
  95. <!-- :label="'车间'">-->
  96. <!-- </el-table-column>-->
  97. <el-table-column
  98. prop="supplierNo"
  99. header-align="center"
  100. align="left"
  101. :label="'供应商编码'">
  102. </el-table-column>
  103. <el-table-column
  104. fixed="right"
  105. header-align="center"
  106. align="center"
  107. width="150"
  108. :label="buttons.cz||'操作'">
  109. <template slot-scope="scope">
  110. <a v-if="!adminUser && scope.row.userId === 1" type="text" size="small" style="pointer-events:none;color: #8a979e">{{ buttons.edit || '修改' }}</a>
  111. <a v-if="!adminUser && scope.row.userId !== 1" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">{{ buttons.edit || '修改' }}</a>
  112. <a v-if="adminUser" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">{{ buttons.edit || '修改' }}</a>
  113. <a v-if="!adminUser && scope.row.userId === 1" type="text" size="small" style="pointer-events:none;color: #8a979e">{{ buttons.delete || '删除' }}</a>
  114. <a v-if="!adminUser && scope.row.userId !== 1" type="text" size="small" @click="deleteHandle(scope.row.userId)">{{ buttons.delete || '删除' }}</a>
  115. <a v-if="adminUser" type="text" size="small" @click="deleteHandle(scope.row.userId)">{{ buttons.delete || '删除' }}</a>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <el-pagination
  120. @size-change="sizeChangeHandle"
  121. @current-change="currentChangeHandle"
  122. :current-page="pageIndex"
  123. :page-sizes="[20, 50, 100, 200,500]"
  124. :page-size="pageSize"
  125. :total="totalPage"
  126. layout="total, sizes, prev, pager, next, jumper">
  127. </el-pagination>
  128. <!-- 弹窗, 新增 / 修改 -->
  129. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @close="closeDialog"></add-or-update>
  130. <!-- 审核权限 -->
  131. <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag :title="inputSearch1" :visible.sync="setUp.reviewFlag" width="518px">
  132. <template>
  133. <el-transfer v-model="checked" :data="transferData" :titles="[buttons.allAuth || '所有权限', buttons.currentAuth || '当前权限']"></el-transfer>
  134. </template>
  135. <span slot="footer" class="dialog-footer">
  136. <div style="margin-top: 5px">
  137. <el-button type="primary" :disabled="setUp.saveButton" @click="saveUserRoleFlag()">确定</el-button>
  138. <el-button type="primary" @click="setUp.reviewFlag = false">取消</el-button>
  139. </div>
  140. </span>
  141. </el-dialog>
  142. <!-- 特殊权限 -->
  143. <el-dialog
  144. v-drag
  145. :title="'特殊性权限'"
  146. :visible.sync="specialVisible"
  147. width="820px"
  148. :append-to-body="true">
  149. <el-table
  150. :data="securityList"
  151. border
  152. :height="securityHeight"
  153. v-loading="dataListLoading"
  154. style="width: 100%;">
  155. <el-table-column
  156. v-for="(item,index) in columnList" :key="index"
  157. :sortable="item.columnSortable"
  158. :prop="item.columnProp"
  159. :header-align="item.headerAlign"
  160. :show-overflow-tooltip="item.showOverflowTooltip"
  161. :align="item.align"
  162. :fixed="item.fixed==''?false:item.fixed"
  163. :min-width="item.columnWidth"
  164. :label="item.columnLabel">
  165. <template slot-scope="scope">
  166. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  167. <span v-if="item.columnHidden">
  168. <el-checkbox v-model="scope.row[item.columnProp] "></el-checkbox>
  169. </span>
  170. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  171. </template>
  172. </el-table-column>
  173. </el-table>
  174. <span slot="footer" class="dialog-footer">
  175. <el-button type="primary" @click="saveUserSecurity()">确定</el-button>
  176. <el-button @click="specialVisible = false" type="primary">取消</el-button>
  177. </span>
  178. </el-dialog>
  179. <!-- BU授权 -->
  180. <el-dialog
  181. style="font-size: 12px"
  182. v-drag
  183. :title="'BU授权'"
  184. :visible.sync="buVisible"
  185. width="518px"
  186. :append-to-body="true">
  187. <el-transfer
  188. class="rq"
  189. filterable
  190. v-model="selectBUList"
  191. :props="{key: 'buNo', label: 'buDesc'}" :data="buList" :titles="['未授权BU', '已授权BU']">
  192. </el-transfer>
  193. <span slot="footer" class="dialog-footer">
  194. <div style="margin-top: 5px">
  195. <el-button type="primary" @click="saveBuAssessSite()">确定</el-button>
  196. <el-button @click="buVisible = false" type="primary">取消</el-button>
  197. </div>
  198. </span>
  199. </el-dialog>
  200. <!-- 查看用户部门(Access_dept) -->
  201. <el-dialog
  202. :title="'用户部门 — ' + (selectUser && selectUser.username ? selectUser.username : '')"
  203. :close-on-click-modal="false"
  204. v-drag
  205. :visible.sync="userDeptModalVisible"
  206. width="900px"
  207. append-to-body>
  208. <el-table
  209. :data="userDeptList"
  210. border
  211. v-loading="userDeptLoading"
  212. height="400"
  213. style="width: 100%">
  214. <el-table-column prop="site" header-align="center" align="center" min-width="70" label="工厂"></el-table-column>
  215. <el-table-column prop="buNo" header-align="center" align="center" min-width="80" label="BU"></el-table-column>
  216. <el-table-column prop="buDesc" header-align="center" align="left" min-width="100" label="BU名称" show-overflow-tooltip></el-table-column>
  217. <el-table-column prop="departmentId" header-align="center" align="center" min-width="90" label="部门编码"></el-table-column>
  218. <el-table-column prop="departmentName" header-align="center" align="left" min-width="100" label="部门名称" show-overflow-tooltip></el-table-column>
  219. <el-table-column prop="jobTitle" header-align="center" align="left" min-width="90" label="职称" show-overflow-tooltip></el-table-column>
  220. <el-table-column prop="deptManagerFlag" header-align="center" align="center" width="90" label="部门经理"></el-table-column>
  221. <el-table-column prop="superiorUsername" header-align="center" align="center" min-width="90" label="上级"></el-table-column>
  222. </el-table>
  223. <el-footer style="height:40px;margin-top: 16px;text-align:center">
  224. <el-button type="primary" @click="userDeptModalVisible = false">关闭</el-button>
  225. </el-footer>
  226. </el-dialog>
  227. <!-- 岗位 -->
  228. <el-dialog
  229. style="font-size: 12px"
  230. v-drag
  231. :title="'岗位'"
  232. :visible.sync="businessRoleVisible"
  233. width="518px"
  234. :append-to-body="true">
  235. <el-transfer
  236. class="rq"
  237. filterable
  238. v-model="selectBusinessRoleList"
  239. :props="{key: 'roleNo', label: 'roleDesc'}" :data="businessRoleList" :titles="['未授权角色', '已授权角色']">
  240. </el-transfer>
  241. <span slot="footer" class="dialog-footer">
  242. <div style="margin-top: 5px">
  243. <el-button type="primary" @click="saveBusinessRoleSite()">确定</el-button>
  244. <el-button @click="businessRoleVisible = false" type="primary">取消</el-button>
  245. </div>
  246. </span>
  247. </el-dialog>
  248. <!-- 新增用户site -->
  249. <el-dialog title="工厂" :close-on-click-modal="false" v-drag :visible.sync="siteAddModal" width="900px">
  250. <div style="font-size: 12px">
  251. <el-form :inline="true" label-position="top" :model="siteData">
  252. <el-form-item :label="'工厂编码'">
  253. <el-input v-model="siteData.siteid" clearable style="width: 120px"></el-input>
  254. </el-form-item>
  255. <el-form-item :label="'工厂名称'">
  256. <el-input v-model="siteData.sitename" clearable style="width: 200px"></el-input>
  257. </el-form-item>
  258. <el-form-item :label="' '">
  259. <el-button type="primary" @click="getSite()">查询</el-button>
  260. </el-form-item>
  261. </el-form>
  262. </div>
  263. <el-container style="margin-top: 0px;">
  264. <el-main style="width: 400px; padding: 1px">
  265. <span style="font-size: 12px" >可选工厂</span>
  266. <el-table
  267. height="400px"
  268. :data="siteList1"
  269. border
  270. ref="siteTable1"
  271. @row-click="siteClickRow1"
  272. @selection-change="selectionSite1"
  273. highlight-current-row
  274. style="width: 100%">
  275. <el-table-column
  276. type="selection"
  277. header-align="center"
  278. align="center"
  279. :selectable="selectFlag"
  280. width="50">
  281. </el-table-column>
  282. <el-table-column
  283. prop="siteid"
  284. header-align="center"
  285. align="center"
  286. min-width="80"
  287. label="工厂编码">
  288. </el-table-column>
  289. <el-table-column
  290. prop="sitename"
  291. header-align="center"
  292. align="center"
  293. min-width="120"
  294. label="工厂名称">
  295. </el-table-column>
  296. </el-table>
  297. </el-main>
  298. <el-main style="width: 111px;padding: 1px">
  299. <div style="margin-top: 182px;margin-left: 18px">
  300. <el-button type="primary" @click="addSite()">添加>></el-button>
  301. </div>
  302. <div style="margin-top: 15px;margin-left: 18px">
  303. <el-button type="primary" @click="deleteSite()">删除<<</el-button>
  304. </div>
  305. </el-main>
  306. <el-main style="width: 400px;padding: 1px">
  307. <span style="font-size: 12px" >已有工厂</span>
  308. <el-table
  309. height="400px"
  310. :data="siteList2"
  311. border
  312. ref="siteTable2"
  313. @row-click="siteClickRow2"
  314. @selection-change="selectionSite2"
  315. highlight-current-row
  316. style="width: 100%">
  317. <el-table-column
  318. type="selection"
  319. header-align="center"
  320. align="center"
  321. :selectable="selectFlag"
  322. width="50">
  323. </el-table-column>
  324. <el-table-column
  325. prop="siteid"
  326. header-align="center"
  327. align="center"
  328. min-width="80"
  329. label="工厂编码">
  330. </el-table-column>
  331. <el-table-column
  332. prop="sitename"
  333. header-align="center"
  334. align="center"
  335. min-width="120"
  336. label="工厂名称">
  337. </el-table-column>
  338. </el-table>
  339. </el-main>
  340. </el-container>
  341. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  342. <el-button type="primary" @click="siteAddModal = false">关闭</el-button>
  343. </el-footer>
  344. </el-dialog>
  345. <!-- 新增用户bu -->
  346. <el-dialog title="BU" :close-on-click-modal="false" v-drag :visible.sync="buAddModal" width="900px">
  347. <div style="font-size: 12px">
  348. <el-form :inline="true" label-position="top" :model="buData">
  349. <el-form-item :label="'工厂编码'">
  350. <el-input v-model="buData.site" clearable style="width: 120px"></el-input>
  351. </el-form-item>
  352. <el-form-item :label="'BU编码'">
  353. <el-input v-model="buData.buNo" clearable style="width: 120px"></el-input>
  354. </el-form-item>
  355. <el-form-item :label="'BU名称'">
  356. <el-input v-model="buData.buDesc" clearable style="width: 200px"></el-input>
  357. </el-form-item>
  358. <el-form-item :label="' '">
  359. <el-button type="primary" @click="getBu()">查询</el-button>
  360. </el-form-item>
  361. </el-form>
  362. </div>
  363. <el-container style="margin-top: 0px;">
  364. <el-main style="width: 400px; padding: 1px">
  365. <span style="font-size: 12px" >可选BU</span>
  366. <el-table
  367. height="400px"
  368. :data="buList1"
  369. border
  370. ref="buTable1"
  371. @row-click="buClickRow1"
  372. @selection-change="selectionBu1"
  373. highlight-current-row
  374. style="width: 100%">
  375. <el-table-column
  376. type="selection"
  377. header-align="center"
  378. align="center"
  379. :selectable="selectFlag"
  380. width="50">
  381. </el-table-column>
  382. <el-table-column
  383. prop="site"
  384. header-align="center"
  385. align="center"
  386. min-width="80"
  387. label="工厂编码">
  388. </el-table-column>
  389. <el-table-column
  390. prop="buNo"
  391. header-align="center"
  392. align="center"
  393. min-width="80"
  394. label="BU编码">
  395. </el-table-column>
  396. <el-table-column
  397. prop="buDesc"
  398. header-align="center"
  399. align="center"
  400. min-width="120"
  401. label="BU名称">
  402. </el-table-column>
  403. </el-table>
  404. </el-main>
  405. <el-main style="width: 111px;padding: 1px">
  406. <div style="margin-top: 182px;margin-left: 18px">
  407. <el-button type="primary" @click="addBu()">添加>></el-button>
  408. </div>
  409. <div style="margin-top: 15px;margin-left: 18px">
  410. <el-button type="primary" @click="deleteBu()">删除<<</el-button>
  411. </div>
  412. </el-main>
  413. <el-main style="width: 400px;padding: 1px">
  414. <span style="font-size: 12px" >已有BU</span>
  415. <el-table
  416. height="400px"
  417. :data="buList2"
  418. border
  419. ref="buTable2"
  420. @row-click="buClickRow2"
  421. @selection-change="selectionBu2"
  422. highlight-current-row
  423. style="width: 100%">
  424. <el-table-column
  425. type="selection"
  426. header-align="center"
  427. align="center"
  428. :selectable="selectFlag"
  429. width="50">
  430. </el-table-column>
  431. <el-table-column
  432. prop="site"
  433. header-align="center"
  434. align="center"
  435. min-width="80"
  436. label="工厂编码">
  437. </el-table-column>
  438. <el-table-column
  439. prop="buNo"
  440. header-align="center"
  441. align="center"
  442. min-width="80"
  443. label="BU编码">
  444. </el-table-column>
  445. <el-table-column
  446. prop="buDesc"
  447. header-align="center"
  448. align="center"
  449. min-width="120"
  450. label="BU名称">
  451. </el-table-column>
  452. </el-table>
  453. </el-main>
  454. </el-container>
  455. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  456. <el-button type="primary" @click="buAddModal = false">关闭</el-button>
  457. </el-footer>
  458. </el-dialog>
  459. <!-- 新增用户部门 -->
  460. <el-dialog title="部门" :close-on-click-modal="false" v-drag :visible.sync="deptAddModal" width="900px">
  461. <div style="font-size: 12px">
  462. <el-form :inline="true" label-position="top" :model="deptData">
  463. <el-form-item :label="'部门编码'">
  464. <el-input v-model="deptData.departmentId" clearable style="width: 120px"></el-input>
  465. </el-form-item>
  466. <el-form-item :label="'部门名称'">
  467. <el-input v-model="deptData.departmentName" clearable style="width: 200px"></el-input>
  468. </el-form-item>
  469. <el-form-item :label="' '">
  470. <el-button type="primary" @click="getDept()">查询</el-button>
  471. </el-form-item>
  472. </el-form>
  473. </div>
  474. <el-container style="margin-top: 0px;">
  475. <el-main style="width: 400px; padding: 1px">
  476. <span style="font-size: 12px" >可选部门</span>
  477. <el-table
  478. height="400px"
  479. :data="deptList1"
  480. border
  481. ref="deptTable1"
  482. @row-click="deptClickRow1"
  483. @selection-change="selectionDept1"
  484. highlight-current-row
  485. style="width: 100%">
  486. <el-table-column
  487. type="selection"
  488. header-align="center"
  489. align="center"
  490. :selectable="selectFlag"
  491. width="50">
  492. </el-table-column>
  493. <el-table-column
  494. prop="buDesc"
  495. header-align="center"
  496. align="center"
  497. min-width="80"
  498. label="BU">
  499. </el-table-column>
  500. <el-table-column
  501. prop="departmentId"
  502. header-align="center"
  503. align="center"
  504. min-width="80"
  505. label="部门编码">
  506. </el-table-column>
  507. <el-table-column
  508. prop="departmentName"
  509. header-align="center"
  510. align="center"
  511. min-width="120"
  512. label="部门名称">
  513. </el-table-column>
  514. </el-table>
  515. </el-main>
  516. <el-main style="width: 111px;padding: 1px">
  517. <div style="margin-top: 182px;margin-left: 18px">
  518. <el-button type="primary" @click="addDept()">添加>></el-button>
  519. </div>
  520. <div style="margin-top: 15px;margin-left: 18px">
  521. <el-button type="primary" @click="deleteDept()">删除<<</el-button>
  522. </div>
  523. </el-main>
  524. <el-main style="width: 400px;padding: 1px">
  525. <span style="font-size: 12px" >已有部门</span>
  526. <el-table
  527. height="400px"
  528. :data="deptList2"
  529. border
  530. ref="deptTable2"
  531. @row-click="deptClickRow2"
  532. @selection-change="selectionDept2"
  533. highlight-current-row
  534. style="width: 100%">
  535. <el-table-column
  536. type="selection"
  537. header-align="center"
  538. align="center"
  539. :selectable="selectFlag"
  540. width="50">
  541. </el-table-column>
  542. <el-table-column
  543. prop="buDesc"
  544. header-align="center"
  545. align="center"
  546. min-width="80"
  547. label="BU">
  548. </el-table-column>
  549. <el-table-column
  550. prop="departmentId"
  551. header-align="center"
  552. align="center"
  553. min-width="80"
  554. label="部门编码">
  555. </el-table-column>
  556. <el-table-column
  557. prop="departmentName"
  558. header-align="center"
  559. align="center"
  560. min-width="120"
  561. label="部门名称">
  562. </el-table-column>
  563. </el-table>
  564. </el-main>
  565. </el-container>
  566. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  567. <el-button type="primary" @click="deptAddModal = false">关闭</el-button>
  568. </el-footer>
  569. </el-dialog>
  570. <!-- 新增用户角色 -->
  571. <el-dialog title="岗位" :close-on-click-modal="false" v-drag :visible.sync="businessRoleAddModal" width="900px">
  572. <div style="font-size: 12px">
  573. <el-form :inline="true" label-position="top" :model="businessRoleData">
  574. <el-form-item :label="'岗位编码'">
  575. <el-input v-model="businessRoleData.roleNo" clearable style="width: 120px"></el-input>
  576. </el-form-item>
  577. <el-form-item :label="'岗位名称'">
  578. <el-input v-model="businessRoleData.roleDesc" clearable style="width: 200px"></el-input>
  579. </el-form-item>
  580. <el-form-item :label="' '">
  581. <el-button type="primary" @click="getBusinessRole()">查询</el-button>
  582. </el-form-item>
  583. </el-form>
  584. </div>
  585. <el-container style="margin-top: 0px;">
  586. <el-main style="width: 400px; padding: 1px">
  587. <span style="font-size: 12px" >可选岗位</span>
  588. <el-table
  589. height="400px"
  590. :data="businessRoleList1"
  591. border
  592. ref="businessRoleTable1"
  593. @row-click="businessRoleClickRow1"
  594. @selection-change="selectionBusinessRole1"
  595. highlight-current-row
  596. style="width: 100%">
  597. <el-table-column
  598. type="selection"
  599. header-align="center"
  600. align="center"
  601. :selectable="selectFlag"
  602. width="50">
  603. </el-table-column>
  604. <el-table-column
  605. prop="roleNo"
  606. header-align="center"
  607. align="center"
  608. min-width="80"
  609. label="岗位编码">
  610. </el-table-column>
  611. <el-table-column
  612. prop="roleDesc"
  613. header-align="center"
  614. align="center"
  615. min-width="120"
  616. label="岗位名称">
  617. </el-table-column>
  618. </el-table>
  619. </el-main>
  620. <el-main style="width: 111px;padding: 1px">
  621. <div style="margin-top: 182px;margin-left: 18px">
  622. <el-button type="primary" @click="addBusinessRole()">添加>></el-button>
  623. </div>
  624. <div style="margin-top: 15px;margin-left: 18px">
  625. <el-button type="primary" @click="deleteBusinessRole()">删除<<</el-button>
  626. </div>
  627. </el-main>
  628. <el-main style="width: 400px;padding: 1px">
  629. <span style="font-size: 12px" >已有岗位</span>
  630. <el-table
  631. height="400px"
  632. :data="businessRoleList2"
  633. border
  634. ref="businessRoleTable2"
  635. @row-click="businessRoleClickRow2"
  636. @selection-change="selectionBusinessRole2"
  637. highlight-current-row
  638. style="width: 100%">
  639. <el-table-column
  640. type="selection"
  641. header-align="center"
  642. align="center"
  643. :selectable="selectFlag"
  644. width="50">
  645. </el-table-column>
  646. <el-table-column
  647. prop="roleNo"
  648. header-align="center"
  649. align="center"
  650. min-width="80"
  651. label="岗位编码">
  652. </el-table-column>
  653. <el-table-column
  654. prop="roleDesc"
  655. header-align="center"
  656. align="center"
  657. min-width="120"
  658. label="岗位名称">
  659. </el-table-column>
  660. </el-table>
  661. </el-main>
  662. </el-container>
  663. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  664. <el-button type="primary" @click="businessRoleAddModal = false">关闭</el-button>
  665. </el-footer>
  666. </el-dialog>
  667. </div>
  668. </template>
  669. <script>
  670. import {getSiteList, addUserSite, delUserSite, getSite, getBuList, addUserBu, delUserBu, getBu, getDeptList, addUserDept, delUserDept, getDept, getBusinessRole, getBusinessRoleList, addUserBusinessRole, delUserBusinessRole} from '@/api/factory/site.js'
  671. import { listAccessDeptByUsername } from '@/api/factory/accessDept.js'
  672. import {saveAccessBU, saveBusinessRole} from '@/api/base/site.js'
  673. import AddOrUpdate from './user-add-or-update'
  674. import {saveUserBusinessRole} from '@/api/auditManagement/auditType.js'
  675. import {getUserSpecialSecurity, updateUserSpecialSecurity} from '@/api/factory/userSpecialSecurity.js'
  676. import {throttle} from '../../../utils/common'
  677. import {searchFunctionButtonList} from '@/api/sysLanguage.js'
  678. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  679. export default {
  680. data () {
  681. return {
  682. // 是否收藏
  683. favorite: false,
  684. showButton: true,
  685. height: 200,
  686. securityHeight: 300,
  687. specialVisible: false,
  688. buVisible: false,
  689. businessRoleVisible: false,
  690. currentData: {},
  691. userId: this.$store.state.user.name,
  692. transferData: [],
  693. checked: [],
  694. inputSearch1: '审核权限',
  695. // 设置
  696. setUp: {
  697. reviewFlag: false,
  698. saveButton: false
  699. },
  700. dataForm: {
  701. userName: '',
  702. userDisplay: '',
  703. type: ''
  704. },
  705. typeOptions: [
  706. { label: '员工', value: 'EMPLOYEE' },
  707. { label: '供应商', value: 'SUPPLIER' },
  708. { label: '客户', value: 'CUSTOMER' }
  709. ],
  710. columnList: [
  711. {
  712. userId: this.$store.state.user.name,
  713. serialNumber: 'security' + this.$route.meta.menuId + 'permissionCode',
  714. tableId: this.$route.meta.menuId + 'security',
  715. tableName: 'securityTable',
  716. columnProp: 'permissionCode',
  717. headerAlign: 'center',
  718. align: 'left',
  719. columnLabel: '权限号',
  720. columnHidden: false,
  721. columnImage: false,
  722. columnSortable: false,
  723. columnWidth: 28,
  724. sortLv: 0,
  725. status: true,
  726. fixed: ''
  727. },
  728. {
  729. userId: this.$store.state.user.name,
  730. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  731. tableId: this.$route.meta.menuId + 'security',
  732. tableName: 'securityTable',
  733. columnProp: 'securitydesc',
  734. headerAlign: 'center',
  735. align: 'left',
  736. columnLabel: '参数描述',
  737. columnHidden: false,
  738. columnImage: false,
  739. columnWidth: 70,
  740. columnSortable: false,
  741. sortLv: 0,
  742. status: true,
  743. fixed: ''
  744. },
  745. {
  746. userId: this.$store.state.user.name,
  747. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  748. tableId: this.$route.meta.menuId + 'security',
  749. tableName: 'securityTable',
  750. columnProp: 'module',
  751. headerAlign: 'center',
  752. align: 'left',
  753. columnLabel: '模块',
  754. columnHidden: false,
  755. columnImage: false,
  756. columnSortable: false,
  757. columnWidth: 20,
  758. sortLv: 0,
  759. status: true,
  760. fixed: ''
  761. },
  762. {
  763. userId: this.$store.state.user.name,
  764. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  765. tableId: this.$route.meta.menuId + 'security',
  766. tableName: 'securityTable',
  767. columnProp: 'itemvalue',
  768. headerAlign: 'center',
  769. align: 'center',
  770. columnLabel: '参数值',
  771. columnHidden: true,
  772. columnImage: false,
  773. columnSortable: false,
  774. columnWidth: 10,
  775. sortLv: 0,
  776. status: true,
  777. fixed: ''
  778. }
  779. ],
  780. buttons: {
  781. cz: '操作',
  782. search: '查询',
  783. add: '添加',
  784. edit: '编辑',
  785. delete: '删除',
  786. specialCompetencies: '特殊权限',
  787. factoryAuthorization: '工厂授权',
  788. buAuthorization: 'BU授权',
  789. deptAuthorization: '部门授权',
  790. viewUserDept: '查看部门',
  791. businessRoleAuthorization: '岗位',
  792. createTime: '创建时间',
  793. username: '用户账号',
  794. userDisplay: '用户名',
  795. email: '邮箱',
  796. mobile: '手机号',
  797. status: '状态',
  798. disable: '禁用',
  799. normal: '正常',
  800. auth: '审核',
  801. allAuth: '所有权限',
  802. currentAuth: '当前权限'
  803. },
  804. dataList: [],
  805. securityList: [],
  806. selectSpecialList: [],
  807. siteList: [],
  808. selectSitList: [],
  809. selectUser: {},
  810. pageIndex: 1,
  811. pageSize: 20,
  812. totalPage: 0,
  813. dataListLoading: false,
  814. dataListSelections: [],
  815. addOrUpdateVisible: false,
  816. selectBUList: [],
  817. buList: [],
  818. siteList1: [],
  819. siteList2: [],
  820. siteSelections1: [],
  821. siteSelections2: [],
  822. siteAddModal: false,
  823. siteData: {
  824. username: '',
  825. siteid: '',
  826. sitename: '',
  827. active: ''
  828. },
  829. buList1: [],
  830. buList2: [],
  831. buSelections1: [],
  832. buSelections2: [],
  833. buAddModal: false,
  834. buData: {
  835. site: '',
  836. buNo: '',
  837. buDesc: '',
  838. active: '',
  839. username: ''
  840. },
  841. userDeptModalVisible: false,
  842. userDeptList: [],
  843. userDeptLoading: false,
  844. deptData: {
  845. site: '',
  846. buNo: '',
  847. departmentId: '',
  848. departmentName: '',
  849. active: '',
  850. username: ''
  851. },
  852. deptList1: [],
  853. deptList2: [],
  854. deptSelections1: [],
  855. deptSelections2: [],
  856. deptAddModal: false,
  857. selectBusinessRoleList: [],
  858. businessRoleList: [],
  859. businessRoleList1: [],
  860. businessRoleList2: [],
  861. businessRoleSelections1: [],
  862. businessRoleSelections2: [],
  863. businessRoleAddModal: false,
  864. businessRoleData: {
  865. site: '',
  866. buNo: '',
  867. roleNo: '',
  868. roleDesc: '',
  869. active: '',
  870. username: ''
  871. }
  872. }
  873. },
  874. components: {
  875. AddOrUpdate
  876. },
  877. activated () {
  878. this.getDataList()
  879. },
  880. mounted () {
  881. this.favoriteIsOk()
  882. this.$nextTick(() => {
  883. this.securityHeight = window.innerHeight - 300
  884. this.height = window.innerHeight - 200
  885. })
  886. },
  887. computed: {
  888. adminUser () {
  889. return this.$store.state.user.id === 1
  890. }
  891. },
  892. methods: {
  893. // 类型编码转中文展示
  894. typeLabel (val) {
  895. const item = this.typeOptions.find(t => t.value === val)
  896. return item ? item.label : ''
  897. },
  898. // 校验用户是否收藏
  899. favoriteIsOk () {
  900. let userFavorite = {
  901. userId: this.$store.state.user.id,
  902. languageCode: this.$i18n.locale
  903. }
  904. userFavoriteList(userFavorite).then(({data}) => {
  905. for (let i = 0; i < data.list.length; i++) {
  906. if (this.$route.meta.menuId == data.list[i].menuId) {
  907. this.favorite = true
  908. }
  909. }
  910. })
  911. },
  912. // 收藏 OR 取消收藏
  913. favoriteFunction () {
  914. let userFavorite = {
  915. userId: this.$store.state.user.id,
  916. functionId: this.$route.meta.menuId
  917. }
  918. if (this.favorite) {
  919. // 取消收藏
  920. this.$confirm(`确定取消收藏`, '提示', {
  921. confirmButtonText: '确定',
  922. cancelButtonText: '取消',
  923. type: 'warning'
  924. }).then(() => {
  925. removeUserFavorite(userFavorite).then(({data}) => {
  926. this.$message.success(data.msg)
  927. this.favorite = false
  928. })
  929. })
  930. } else {
  931. // 收藏
  932. saveUserFavorite(userFavorite).then(({data}) => {
  933. this.$message.success(data.msg)
  934. this.favorite = true
  935. })
  936. }
  937. },
  938. // 获取button的词典
  939. getFunctionButtonList () {
  940. let queryButton = {
  941. functionId: this.$route.meta.menuId,
  942. tableId: '*',
  943. languageCode: this.$i18n.locale,
  944. objectType: 'button'
  945. }
  946. searchFunctionButtonList(queryButton).then(({data}) => {
  947. if (data.code == 0 && data.data) {
  948. this.buttons = data.data
  949. }
  950. })
  951. },
  952. // 打开特殊权限
  953. specialAuthorize () {
  954. if (!this.selectUser || !this.selectUser.username) {
  955. this.$message.warning('请先在列表中选中用户')
  956. return
  957. }
  958. this.dataListLoading = true
  959. getUserSpecialSecurity(encodeURIComponent(this.selectUser.username)).then(({ data }) => {
  960. this.dataListLoading = false
  961. if (data && data.code === 0) {
  962. const list = data.list || []
  963. this.securityList = list.map(row => ({
  964. ...row,
  965. itemvalue: row.itemvalue === true || row.itemvalue === 'Y'
  966. }))
  967. this.specialVisible = true
  968. } else {
  969. this.$message.error((data && data.msg) || '加载失败')
  970. }
  971. }).catch(() => {
  972. this.dataListLoading = false
  973. })
  974. },
  975. // 保存用户权限
  976. saveUserSecurity () {
  977. if (!this.selectUser || !this.selectUser.username) {
  978. this.$message.warning('未选中用户')
  979. return
  980. }
  981. const items = this.securityList.map(item => ({
  982. permissionCode: item.permissionCode,
  983. itemvalue: item.itemvalue === true ? 'Y' : 'N'
  984. }))
  985. updateUserSpecialSecurity({
  986. username: this.selectUser.username,
  987. items
  988. }).then(({data}) => {
  989. if (data.code === 0) {
  990. this.$message.success(data.msg)
  991. this.specialVisible = false
  992. } else {
  993. this.$message.error(data.msg || '保存失败')
  994. }
  995. })
  996. },
  997. // 授权工厂
  998. siteAuthorize () {
  999. this.siteData = {
  1000. siteid: '',
  1001. sitename: '',
  1002. active: ''
  1003. }
  1004. this.siteSelections1 = null
  1005. this.siteSelections2 = null
  1006. getSiteList(this.selectUser).then(({data}) => {
  1007. this.siteList1 = data.row1
  1008. this.siteList2 = data.row2
  1009. })
  1010. this.siteAddModal = true
  1011. // this.searchSiteList()
  1012. },
  1013. /**
  1014. * 查询可用site
  1015. */
  1016. getSite () {
  1017. this.siteData.username = this.selectUser.username
  1018. getSite(this.siteData).then(({data}) => {
  1019. if (data.code === 0) {
  1020. this.siteList1 = data.rows
  1021. }
  1022. })
  1023. },
  1024. selectFlag () {
  1025. return true
  1026. },
  1027. // 可选site
  1028. siteClickRow1 (row) {
  1029. this.$refs.siteTable1.toggleRowSelection(row)
  1030. },
  1031. // 已有site
  1032. siteClickRow2 (row) {
  1033. this.$refs.siteTable2.toggleRowSelection(row)
  1034. },
  1035. selectionSite1 (val) {
  1036. this.siteSelections1 = val
  1037. },
  1038. selectionSite2 (val) {
  1039. this.siteSelections2 = val
  1040. },
  1041. // 添加site
  1042. addSite () {
  1043. if (this.siteSelections1 == null || this.siteSelections1.length === 0) {
  1044. this.$message.warning('请选择可选工厂!')
  1045. return
  1046. }
  1047. let inData = {
  1048. username: this.selectUser.username,
  1049. siteList: this.siteSelections1
  1050. }
  1051. addUserSite(inData).then(({data}) => {
  1052. if (data && data.code === 0) {
  1053. getSiteList(this.selectUser).then(({data}) => {
  1054. this.siteList1 = data.row1
  1055. this.siteList2 = data.row2
  1056. })
  1057. this.siteSelections1 = []
  1058. } else {
  1059. this.$alert(data.msg, '错误', {
  1060. confirmButtonText: '确定'
  1061. })
  1062. }
  1063. })
  1064. },
  1065. // 删除site
  1066. deleteSite () {
  1067. if (this.siteSelections2 == null || this.siteSelections2.length === 0) {
  1068. this.$message.warning('请选择已有工厂!')
  1069. return
  1070. }
  1071. let inData = {
  1072. username: this.selectUser.username,
  1073. siteList: this.siteSelections2
  1074. }
  1075. delUserSite(inData).then(({data}) => {
  1076. if (data && data.code === 0) {
  1077. getSiteList(this.selectUser).then(({data}) => {
  1078. this.siteList1 = data.row1
  1079. this.siteList2 = data.row2
  1080. })
  1081. this.siteSelections2 = []
  1082. } else {
  1083. this.$alert(data.msg, '错误', {
  1084. confirmButtonText: '确定'
  1085. })
  1086. }
  1087. })
  1088. },
  1089. // // 关闭后刷新列表
  1090. // refreshDetailList(){
  1091. // this.getDataList()
  1092. // },
  1093. // 授权BU
  1094. buAuthorize () {
  1095. this.buData = {
  1096. site: '',
  1097. buNo: '',
  1098. buDesc: '',
  1099. active: '',
  1100. username: ''
  1101. }
  1102. this.buSelections1 = null
  1103. this.buSelections2 = null
  1104. getBuList(this.selectUser).then(({data}) => {
  1105. this.buList1 = data.row1
  1106. this.buList2 = data.row2
  1107. })
  1108. this.buAddModal = true
  1109. // this.buVisible = true
  1110. // this.searchBuList()
  1111. },
  1112. /**
  1113. * 查询可用bu
  1114. */
  1115. getBu () {
  1116. this.buData.username = this.selectUser.username
  1117. getBu(this.buData).then(({data}) => {
  1118. if (data.code === 0) {
  1119. this.buList1 = data.rows
  1120. }
  1121. })
  1122. },
  1123. // 可选bu
  1124. buClickRow1 (row) {
  1125. this.$refs.buTable1.toggleRowSelection(row)
  1126. },
  1127. // 已有bu
  1128. buClickRow2 (row) {
  1129. this.$refs.buTable2.toggleRowSelection(row)
  1130. },
  1131. selectionBu1 (val) {
  1132. this.buSelections1 = val
  1133. },
  1134. selectionBu2 (val) {
  1135. this.buSelections2 = val
  1136. },
  1137. // 添加bu
  1138. addBu () {
  1139. if (this.buSelections1 == null || this.buSelections1.length === 0) {
  1140. this.$message.warning('请选择可选BU!')
  1141. return
  1142. }
  1143. let inData = {
  1144. username: this.selectUser.username,
  1145. buList: this.buSelections1
  1146. }
  1147. addUserBu(inData).then(({data}) => {
  1148. if (data && data.code === 0) {
  1149. getBuList(this.selectUser).then(({data}) => {
  1150. this.buList1 = data.row1
  1151. this.buList2 = data.row2
  1152. })
  1153. this.buSelections1 = []
  1154. } else {
  1155. this.$alert(data.msg, '错误', {
  1156. confirmButtonText: '确定'
  1157. })
  1158. }
  1159. })
  1160. },
  1161. // 删除bu
  1162. deleteBu () {
  1163. if (this.buSelections2 == null || this.buSelections2.length === 0) {
  1164. this.$message.warning('请选择已有BU!')
  1165. return
  1166. }
  1167. let inData = {
  1168. username: this.selectUser.username,
  1169. buList: this.buSelections2
  1170. }
  1171. delUserBu(inData).then(({data}) => {
  1172. if (data && data.code === 0) {
  1173. getBuList(this.selectUser).then(({data}) => {
  1174. this.buList1 = data.row1
  1175. this.buList2 = data.row2
  1176. })
  1177. this.buSelections2 = []
  1178. } else {
  1179. this.$alert(data.msg, '错误', {
  1180. confirmButtonText: '确定'
  1181. })
  1182. }
  1183. })
  1184. },
  1185. viewUserDept () {
  1186. if (!this.selectUser || !this.selectUser.username) {
  1187. this.$message.warning('请先在列表中选中用户')
  1188. return
  1189. }
  1190. this.userDeptLoading = true
  1191. this.userDeptList = []
  1192. this.userDeptModalVisible = true
  1193. listAccessDeptByUsername({ username: this.selectUser.username }).then(({ data }) => {
  1194. this.userDeptLoading = false
  1195. if (data && data.code === 0) {
  1196. this.userDeptList = data.list || []
  1197. } else {
  1198. this.userDeptList = []
  1199. if (data && data.msg) {
  1200. this.$message.error(data.msg)
  1201. }
  1202. }
  1203. }).catch(() => {
  1204. this.userDeptLoading = false
  1205. this.userDeptList = []
  1206. })
  1207. },
  1208. // 授权部门
  1209. deptAuthorize () {
  1210. this.deptData = {
  1211. site: '',
  1212. buNo: '',
  1213. departmentId: '',
  1214. departmentName: '',
  1215. active: '',
  1216. username: ''
  1217. }
  1218. this.deptSelections1 = null
  1219. this.deptSelections2 = null
  1220. getDeptList(this.selectUser).then(({data}) => {
  1221. this.deptList1 = data.row1
  1222. this.deptList2 = data.row2
  1223. })
  1224. this.deptAddModal = true
  1225. },
  1226. /**
  1227. * 查询可用部门
  1228. */
  1229. getDept () {
  1230. this.deptData.username = this.selectUser.username
  1231. getDept(this.deptData).then(({data}) => {
  1232. if (data.code === 0) {
  1233. this.deptList1 = data.rows
  1234. }
  1235. })
  1236. },
  1237. // 可选部门
  1238. deptClickRow1 (row) {
  1239. this.$refs.deptTable1.toggleRowSelection(row)
  1240. },
  1241. // 已有部门
  1242. deptClickRow2 (row) {
  1243. this.$refs.deptTable2.toggleRowSelection(row)
  1244. },
  1245. selectionDept1 (val) {
  1246. this.deptSelections1 = val
  1247. },
  1248. selectionDept2 (val) {
  1249. this.deptSelections2 = val
  1250. },
  1251. // 添加部门
  1252. addDept () {
  1253. if (this.deptSelections1 == null || this.deptSelections1.length === 0) {
  1254. this.$message.warning('请选择可选部门!')
  1255. return
  1256. }
  1257. let inData = {
  1258. username: this.selectUser.username,
  1259. deptList: this.deptSelections1
  1260. }
  1261. addUserDept(inData).then(({data}) => {
  1262. if (data && data.code === 0) {
  1263. getDeptList(this.selectUser).then(({data}) => {
  1264. this.deptList1 = data.row1
  1265. this.deptList2 = data.row2
  1266. })
  1267. this.deptSelections1 = []
  1268. } else {
  1269. this.$alert(data.msg, '错误', {
  1270. confirmButtonText: '确定'
  1271. })
  1272. }
  1273. })
  1274. },
  1275. // 删除部门
  1276. deleteDept () {
  1277. if (this.deptSelections2 == null || this.deptSelections2.length === 0) {
  1278. this.$message.warning('请选择已有部门!')
  1279. return
  1280. }
  1281. let inData = {
  1282. username: this.selectUser.username,
  1283. deptList: this.deptSelections2
  1284. }
  1285. delUserDept(inData).then(({data}) => {
  1286. if (data && data.code === 0) {
  1287. getDeptList(this.selectUser).then(({data}) => {
  1288. this.deptList1 = data.row1
  1289. this.deptList2 = data.row2
  1290. })
  1291. this.deptSelections2 = []
  1292. } else {
  1293. this.$alert(data.msg, '错误', {
  1294. confirmButtonText: '确定'
  1295. })
  1296. }
  1297. })
  1298. },
  1299. // 岗位
  1300. businessRoleAuthorize () {
  1301. const currentSite = this.$store.state.user.site
  1302. this.businessRoleData = {
  1303. site: currentSite,
  1304. roleNo: '',
  1305. roleDesc: '',
  1306. active: '',
  1307. username: ''
  1308. }
  1309. this.businessRoleSelections1 = null
  1310. this.businessRoleSelections2 = null
  1311. const roleQuery = {
  1312. username: this.selectUser.username,
  1313. site: currentSite
  1314. }
  1315. getBusinessRoleList(roleQuery).then(({data}) => {
  1316. this.businessRoleList1 = data.row1
  1317. this.businessRoleList2 = data.row2
  1318. })
  1319. this.businessRoleAddModal = true
  1320. },
  1321. /**
  1322. * 查询可用角色
  1323. */
  1324. getBusinessRole () {
  1325. this.businessRoleData.username = this.selectUser.username
  1326. this.businessRoleData.site = this.$store.state.user.site
  1327. getBusinessRole(this.businessRoleData).then(({data}) => {
  1328. if (data.code === 0) {
  1329. this.businessRoleList1 = data.rows
  1330. }
  1331. })
  1332. },
  1333. // 可选角色
  1334. businessRoleClickRow1 (row) {
  1335. this.$refs.businessRoleTable1.toggleRowSelection(row)
  1336. },
  1337. // 已有角色
  1338. businessRoleClickRow2 (row) {
  1339. this.$refs.businessRoleTable2.toggleRowSelection(row)
  1340. },
  1341. selectionBusinessRole1 (val) {
  1342. this.businessRoleSelections1 = val
  1343. },
  1344. selectionBusinessRole2 (val) {
  1345. this.businessRoleSelections2 = val
  1346. },
  1347. // 添加角色
  1348. addBusinessRole () {
  1349. if (this.businessRoleSelections1 == null || this.businessRoleSelections1.length === 0) {
  1350. this.$message.warning('请选择可选角色!')
  1351. return
  1352. }
  1353. const currentSite = this.$store.state.user.site
  1354. let inData = {
  1355. site: currentSite,
  1356. username: this.selectUser.username,
  1357. businessRoleList: this.businessRoleSelections1.map(item => ({
  1358. roleNo: item.roleNo,
  1359. roleDesc: item.roleDesc,
  1360. site: currentSite
  1361. }))
  1362. }
  1363. addUserBusinessRole(inData).then(({data}) => {
  1364. if (data && data.code === 0) {
  1365. getBusinessRoleList({
  1366. username: this.selectUser.username,
  1367. site: currentSite
  1368. }).then(({data}) => {
  1369. this.businessRoleList1 = data.row1
  1370. this.businessRoleList2 = data.row2
  1371. })
  1372. this.businessRoleSelections1 = []
  1373. } else {
  1374. this.$alert(data.msg, '错误', {
  1375. confirmButtonText: '确定'
  1376. })
  1377. }
  1378. })
  1379. },
  1380. // 删除角色
  1381. deleteBusinessRole () {
  1382. if (this.businessRoleSelections2 == null || this.businessRoleSelections2.length === 0) {
  1383. this.$message.warning('请选择已有角色!')
  1384. return
  1385. }
  1386. const currentSite = this.$store.state.user.site
  1387. let inData = {
  1388. site: currentSite,
  1389. username: this.selectUser.username,
  1390. businessRoleList: this.businessRoleSelections2.map(item => ({
  1391. roleNo: item.roleNo,
  1392. roleDesc: item.roleDesc,
  1393. site: currentSite
  1394. }))
  1395. }
  1396. delUserBusinessRole(inData).then(({data}) => {
  1397. if (data && data.code === 0) {
  1398. getBusinessRoleList({
  1399. username: this.selectUser.username,
  1400. site: currentSite
  1401. }).then(({data}) => {
  1402. this.businessRoleList1 = data.row1
  1403. this.businessRoleList2 = data.row2
  1404. })
  1405. this.businessRoleSelections2 = []
  1406. } else {
  1407. this.$alert(data.msg, '错误', {
  1408. confirmButtonText: '确定'
  1409. })
  1410. }
  1411. })
  1412. },
  1413. saveBuAssessSite () {
  1414. if (this.selectBUList.length == 0) {
  1415. this.$message.warning('请选择BU')
  1416. return false
  1417. }
  1418. let inList = []
  1419. for (let i = 0; i < this.selectBUList.length; i++) {
  1420. let inData = {
  1421. site: this.$store.state.user.site,
  1422. username: this.selectUser.username,
  1423. buNo: this.selectBUList[i]
  1424. }
  1425. inList.push(inData)
  1426. }
  1427. saveAccessBU(inList).then(({data}) => {
  1428. if (data && data.code === 0) {
  1429. this.$message.success('操作成功')
  1430. this.buVisible = false
  1431. } else {
  1432. this.$message.error(data.msg)
  1433. }
  1434. })
  1435. },
  1436. // 保存选中的授权角色
  1437. saveBusinessRoleSite () {
  1438. if (this.selectBusinessRoleList.length == 0) {
  1439. this.$message.warning('请选择角色')
  1440. return false
  1441. }
  1442. let businessRole = []
  1443. for (let i = 0; i < this.selectBusinessRoleList.length; i++) {
  1444. let inData = {
  1445. site: this.$store.state.user.site,
  1446. username: this.selectUser.username,
  1447. roleNo: this.selectBusinessRoleList[i]
  1448. }
  1449. businessRole.push(inData)
  1450. }
  1451. saveBusinessRole(businessRole).then(({data}) => {
  1452. if (data && data.code === 0) {
  1453. this.$message.success('操作成功')
  1454. this.roleVisible = false
  1455. } else {
  1456. this.$message.error(data.msg)
  1457. }
  1458. })
  1459. },
  1460. // 选中行
  1461. handleCurrentChange (val) {
  1462. this.selectUser = val
  1463. this.showButton = false
  1464. },
  1465. saveUserRoleFlag () {
  1466. let saveList = []
  1467. let currentList = this.checked
  1468. // 当前未选择记录
  1469. if (currentList.length == 0) {
  1470. this.$confirm('当前未选择记录,是否继续?', '删除提示', {
  1471. confirmButtonText: '确定',
  1472. cancelButtonText: '取消'
  1473. }).then(() => {
  1474. let data = {
  1475. userId: this.currentData.userId
  1476. }
  1477. saveList.push(data)
  1478. this.saveUserBusinessRole(saveList)
  1479. }).catch(() => {
  1480. })
  1481. } else {
  1482. for (let i = 0; i < currentList.length; i++) {
  1483. let data = {
  1484. userId: this.currentData.userId,
  1485. roleItemNo: currentList[i],
  1486. selectFlag: 'Y'
  1487. }
  1488. saveList.push(data)
  1489. }
  1490. this.saveUserBusinessRole(saveList)
  1491. }
  1492. },
  1493. saveUserBusinessRole (saveList) {
  1494. saveUserBusinessRole(saveList).then(({data}) => {
  1495. this.$alert(data.msg, '操作提示', {
  1496. confirmButtonText: '确定',
  1497. callback: action => {
  1498. if (data.code == 0) {
  1499. this.setUp.reviewFlag = false
  1500. }
  1501. this.setUp.saveButton = false
  1502. }
  1503. })
  1504. })
  1505. },
  1506. // 获取数据列表
  1507. getDataList: throttle(function () {
  1508. this.dataListLoading = true
  1509. this.$http({
  1510. url: this.$http.adornUrl('/sys/user/list'),
  1511. method: 'get',
  1512. params: this.$http.adornParams({
  1513. 'page': this.pageIndex,
  1514. 'limit': this.pageSize,
  1515. 'username': this.dataForm.userName,
  1516. 'userDisplay': this.dataForm.userDisplay,
  1517. 'type': this.dataForm.type
  1518. })
  1519. }).then(({data}) => {
  1520. if (data && data.code === 0) {
  1521. this.dataList = data.page.list
  1522. this.totalPage = data.page.totalCount
  1523. } else {
  1524. this.dataList = []
  1525. this.totalPage = 0
  1526. }
  1527. this.dataListLoading = false
  1528. })
  1529. }, 1000),
  1530. // 每页数
  1531. sizeChangeHandle (val) {
  1532. this.pageSize = val
  1533. this.pageIndex = 1
  1534. this.getDataList()
  1535. },
  1536. // 当前页
  1537. currentChangeHandle (val) {
  1538. this.pageIndex = val
  1539. this.getDataList()
  1540. },
  1541. // 多选
  1542. selectionChangeHandle (val) {
  1543. this.dataListSelections = val
  1544. },
  1545. // 新增 / 修改
  1546. addOrUpdateHandle (id) {
  1547. this.addOrUpdateVisible = true
  1548. this.$nextTick(() => {
  1549. this.$refs.addOrUpdate.init(id)
  1550. })
  1551. },
  1552. // 删除
  1553. deleteHandle (id) {
  1554. let userIds = id ? [id] : this.dataListSelections.map(item => {
  1555. return item.userId
  1556. })
  1557. this.$confirm(`确定对[id=${userIds.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  1558. confirmButtonText: '确定',
  1559. cancelButtonText: '取消',
  1560. type: 'warning'
  1561. }).then(() => {
  1562. this.$http({
  1563. url: this.$http.adornUrl('/sys/user/delete'),
  1564. method: 'post',
  1565. data: this.$http.adornData(userIds, false)
  1566. }).then(({data}) => {
  1567. if (data && data.code === 0) {
  1568. this.$message.success('操作成功')
  1569. this.getDataList()
  1570. } else {
  1571. this.$message.error(data.msg)
  1572. }
  1573. })
  1574. }).catch(() => {
  1575. })
  1576. },
  1577. test () {
  1578. let dto = {
  1579. qty: 100,
  1580. name: '张三'
  1581. }
  1582. this.$http({
  1583. url: this.$http.adornUrl('/pms/test/getTdo1'),
  1584. method: 'get'
  1585. }).then(({data}) => {
  1586. if (data && data.code === 0) {
  1587. } else {
  1588. this.$message.error(data.msg)
  1589. }
  1590. })
  1591. this.$http({
  1592. url: this.$http.adornUrl('/qm/test/list'),
  1593. method: 'get'
  1594. }).then(({data}) => {
  1595. if (data && data.code === 0) {
  1596. } else {
  1597. this.$message.error(data.msg)
  1598. }
  1599. })
  1600. },
  1601. closeDialog () {
  1602. this.$refs.addOrUpdate.closeDialog()
  1603. }
  1604. },
  1605. created () {
  1606. this.getFunctionButtonList()
  1607. }
  1608. }
  1609. </script>
  1610. <style>
  1611. .el-transfer-panel {
  1612. border: 2px solid #17b3a3;
  1613. border-radius: 4px;
  1614. overflow: hidden;
  1615. background: #fff;
  1616. display: inline-block;
  1617. vertical-align: middle;
  1618. width: 200px;
  1619. max-height: 100%;
  1620. -webkit-box-sizing: border-box;
  1621. box-sizing: border-box;
  1622. position: relative;
  1623. }
  1624. .el-transfer-panel .el-transfer-panel__header {
  1625. height: 40px;
  1626. line-height: 40px;
  1627. background: #17b3a3;
  1628. margin: 0;
  1629. padding-left: 15px;
  1630. border-bottom: 1px solid #17b3a3;
  1631. -webkit-box-sizing: border-box;
  1632. box-sizing: border-box;
  1633. color: #000;
  1634. }
  1635. .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
  1636. font-size: 14px;
  1637. color: #303133;
  1638. font-weight: 400;
  1639. }
  1640. .el-dialog__title {
  1641. line-height: 24px;
  1642. font-size: 16px;
  1643. color: #303133;
  1644. }
  1645. </style>