UserList.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <a-row :gutter="24">
  3. <a-col :md="24">
  4. <a-card :style="cardStyle" :bordered="false">
  5. <!-- 查询区域 -->
  6. <div class="table-page-search-wrapper">
  7. <a-form layout="inline" @keyup.enter.native="searchQuery">
  8. <a-row :gutter="24">
  9. <a-col :md="6" :sm="24">
  10. <a-form-item label="登录名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
  11. <a-input placeholder="输入登录名称模糊查询" v-model="queryParam.loginName"></a-input>
  12. </a-form-item>
  13. </a-col>
  14. <a-col :md="6" :sm="24">
  15. <a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
  16. <a-input placeholder="输入用户姓名模糊查询" v-model="queryParam.userName"></a-input>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  21. <a-button type="primary" @click="searchQuery">查询</a-button>
  22. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  23. </span>
  24. </a-col>
  25. </a-row>
  26. </a-form>
  27. </div>
  28. <!-- 操作按钮区域 -->
  29. <div class="table-operator" style="border-top: 5px">
  30. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="handleAdd" type="primary" icon="plus">新增</a-button>
  31. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="batchDel" icon="delete">删除</a-button>
  32. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="batchSetStatus(0)" icon="check-square">启用</a-button>
  33. <a-button v-if="btnEnableList.indexOf(1) > -1" @click="batchSetStatus(2)" icon="close-square">禁用</a-button>
  34. </div>
  35. <!-- table区域-begin -->
  36. <div>
  37. <a-table
  38. ref="table"
  39. bordered
  40. size="middle"
  41. rowKey="id"
  42. :columns="columns"
  43. :dataSource="dataSource"
  44. :pagination="ipagination"
  45. :scroll="scroll"
  46. :loading="loading"
  47. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  48. @change="handleTableChange"
  49. >
  50. <span slot="action" slot-scope="text, record">
  51. <a v-if="btnEnableList.indexOf(1) > -1 && depotFlag === '1'" @click="btnSetDepot(record)">分配仓库</a>
  52. <a-divider v-if="btnEnableList.indexOf(1) > -1 && depotFlag === '1'" type="vertical" />
  53. <a v-if="btnEnableList.indexOf(1) > -1 && customerFlag === '1'" @click="btnSetCustomer(record)"
  54. >分配客户</a
  55. >
  56. <a-divider v-if="btnEnableList.indexOf(1) > -1 && depotFlag === '1'" type="vertical" />
  57. <a v-if="btnEnableList.indexOf(1) > -1 && customerFlag === '1' && record.roleName === '供应商'" @click="btnSetSupplier(record)"
  58. >分配供应商</a
  59. >
  60. <a-divider v-if="btnEnableList.indexOf(1) > -1 && customerFlag === '1'" type="vertical" />
  61. <a @click="handleEdit(record)">编辑</a>
  62. <a-divider v-if="btnEnableList.indexOf(1) > -1" type="vertical" />
  63. <a-popconfirm
  64. v-if="btnEnableList.indexOf(1) > -1"
  65. title="确定删除吗?"
  66. @confirm="() => handleDelete(record.id)"
  67. >
  68. <a>删除</a>
  69. </a-popconfirm>
  70. <a-divider type="vertical" />
  71. <a-popconfirm title="确定重置密码为123456吗?" @confirm="() => handleReset(record.id)">
  72. <a>重置密码</a>
  73. </a-popconfirm>
  74. </span>
  75. <!-- 状态渲染模板 -->
  76. <template slot="customRenderFlag" slot-scope="status">
  77. <a-tag v-if="status === 0" color="green">启用</a-tag>
  78. <a-tag v-if="status === 2" color="orange">禁用</a-tag>
  79. </template>
  80. </a-table>
  81. </div>
  82. <!-- table区域-end -->
  83. <user-modal ref="modalForm" @ok="modalFormOk"></user-modal>
  84. <user-depot-modal ref="userDepotModal" @ok="modalFormOk"></user-depot-modal>
  85. <user-customer-modal ref="userCustomerModal" @ok="modalFormOk"></user-customer-modal>
  86. <user-supplier-modal ref="userSupplierModal" @ok="modalFormOk"></user-supplier-modal>
  87. </a-card>
  88. </a-col>
  89. </a-row>
  90. </template>
  91. <!-- b y 7 5 2 7 1 8 9 2 0 -->
  92. <script>
  93. import UserModal from './modules/UserModal'
  94. import UserDepotModal from './modules/UserDepotModal'
  95. import UserCustomerModal from './modules/UserCustomerModal'
  96. import { postAction } from '@/api/manage'
  97. import { getCurrentSystemConfig } from '@/api/api'
  98. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  99. import JInput from '@/components/jeecg/JInput'
  100. import UserSupplierModal from './modules/userSupplierModal.vue'
  101. export default {
  102. name: 'UserList',
  103. mixins: [JeecgListMixin],
  104. components: {
  105. UserModal,
  106. UserDepotModal,
  107. UserCustomerModal,
  108. JInput,
  109. UserSupplierModal,
  110. },
  111. data() {
  112. return {
  113. labelCol: {
  114. span: 5,
  115. },
  116. wrapperCol: {
  117. span: 18,
  118. offset: 1,
  119. },
  120. queryParam: {},
  121. depotFlag: '0',
  122. customerFlag: '0',
  123. columns: [
  124. {
  125. title: '#',
  126. dataIndex: '',
  127. key: 'rowIndex',
  128. width: 40,
  129. align: 'center',
  130. customRender: function (t, r, index) {
  131. return parseInt(index) + 1
  132. },
  133. },
  134. {
  135. title: '操作',
  136. dataIndex: 'action',
  137. scopedSlots: { customRender: 'action' },
  138. align: 'center',
  139. width: 260,
  140. },
  141. { title: '登录名称', dataIndex: 'loginName', width: 100, align: 'left' },
  142. { title: '用户姓名', dataIndex: 'username', width: 100, align: 'left' },
  143. { title: '用户类型', dataIndex: 'userType', width: 80, align: 'left' },
  144. { title: '角色', dataIndex: 'roleName', width: 100, align: 'left' },
  145. { title: '机构', dataIndex: 'orgAbr', width: 100, align: 'left' },
  146. { title: '是否经理', dataIndex: 'leaderFlagStr', width: 60, align: 'left' },
  147. { title: '电话号码', dataIndex: 'phonenum', width: 80, align: 'left' },
  148. { title: '排序', dataIndex: 'userBlngOrgaDsplSeq', width: 40, align: 'left' },
  149. {
  150. title: '状态',
  151. dataIndex: 'status',
  152. width: 60,
  153. align: 'center',
  154. scopedSlots: { customRender: 'customRenderFlag' },
  155. },
  156. ],
  157. url: {
  158. list: '/user/list',
  159. delete: '/user/delete',
  160. deleteBatch: '/user/deleteBatch',
  161. resetPwd: '/user/resetPwd',
  162. batchSetStatusUrl: '/user/batchSetStatus',
  163. },
  164. }
  165. },
  166. created() {
  167. this.getSystemConfig()
  168. },
  169. methods: {
  170. getSystemConfig() {
  171. getCurrentSystemConfig().then((res) => {
  172. if (res.code === 200 && res.data) {
  173. this.depotFlag = res.data.depotFlag
  174. this.customerFlag = res.data.customerFlag
  175. }
  176. })
  177. },
  178. searchQuery() {
  179. this.loadData(1)
  180. this.getSystemConfig()
  181. },
  182. searchReset() {
  183. this.queryParam = {}
  184. this.loadData(1)
  185. this.getSystemConfig()
  186. },
  187. handleEdit: function (record) {
  188. this.$refs.modalForm.edit(record)
  189. this.$refs.modalForm.title = '编辑'
  190. this.$refs.modalForm.disableSubmit = false
  191. if (this.btnEnableList.indexOf(1) === -1) {
  192. this.$refs.modalForm.isReadOnly = true
  193. }
  194. },
  195. handleReset(id) {
  196. let that = this
  197. postAction(that.url.resetPwd, { id: id }).then((res) => {
  198. if (res.code === 200) {
  199. that.$message.info('重置密码成功!')
  200. that.loadData()
  201. } else {
  202. that.$message.warning(res.data.message)
  203. }
  204. })
  205. },
  206. btnSetDepot(record) {
  207. this.$refs.userDepotModal.edit(record)
  208. this.$refs.userDepotModal.title = '分配仓库给:' + record.username
  209. this.$refs.userDepotModal.disableSubmit = false
  210. },
  211. btnSetCustomer(record) {
  212. this.$refs.userCustomerModal.edit(record)
  213. this.$refs.userCustomerModal.title = '分配客户给:' + record.username
  214. this.$refs.userCustomerModal.disableSubmit = false
  215. },
  216. btnSetSupplier(record) {
  217. this.$refs.userSupplierModal.edit(record)
  218. this.$refs.userSupplierModal.title = '分配供应商给:' + record.username
  219. this.$refs.userSupplierModal.disableSubmit = false
  220. },
  221. },
  222. }
  223. </script>
  224. <style scoped>
  225. @import '~@assets/less/common.less';
  226. </style>