personnelDialog.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <ele-modal
  3. title="选择业务员"
  4. custom-class="ele-dialog-form long-dialog-form"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. top="5vh"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. width="70%"
  12. :maxable="true"
  13. >
  14. <el-card shadow="never">
  15. <contentSearch @search="reload"></contentSearch>
  16. <ele-pro-table
  17. ref="table"
  18. :columns="columns"
  19. :datasource="datasource"
  20. row-key="id"
  21. class="dict-table"
  22. @cell-click="cellClick"
  23. >
  24. <!-- 表头工具栏 -->
  25. <template v-slot:action="{ row }">
  26. <el-radio class="radio" v-model="radio" :label="row.id"
  27. ><i></i
  28. ></el-radio>
  29. </template>
  30. </ele-pro-table>
  31. </el-card>
  32. <div slot="footer">
  33. <el-button type="primary" size="small" @click="selected">选择</el-button>
  34. <el-button size="small" @click="handleClose">关闭</el-button>
  35. </div>
  36. </ele-modal>
  37. </template>
  38. <script>
  39. import { getUserPage } from '@/api/system/organization';
  40. import contentSearch from './contentSearch.vue';
  41. export default {
  42. components: { contentSearch },
  43. props: {
  44. classType: {
  45. type: Number | String,
  46. default: 1
  47. }
  48. },
  49. data() {
  50. return {
  51. visible: false,
  52. statusOptions: [
  53. { value: 1, label: '全职' },
  54. { value: 2, label: '兼职' },
  55. { value: 3, label: '实习' },
  56. { value: 4, label: '正式' },
  57. { value: 5, label: '试用' },
  58. { value: 6, label: '离职' }
  59. ],
  60. columns: [
  61. {
  62. action: 'action',
  63. slot: 'action',
  64. align: 'center',
  65. label: '选择',
  66. width: 60
  67. },
  68. {
  69. columnKey: 'index',
  70. type: 'index',
  71. width: 60,
  72. align: 'center',
  73. showOverflowTooltip: true,
  74. fixed: 'left',
  75. label: '序号'
  76. },
  77. {
  78. prop: 'name',
  79. label: '姓名',
  80. slot: 'name',
  81. align: 'center',
  82. showOverflowTooltip: true,
  83. minWidth: 110
  84. },
  85. {
  86. prop: 'jobNumber',
  87. label: '工号',
  88. align: 'center',
  89. showOverflowTooltip: true,
  90. minWidth: 110
  91. },
  92. {
  93. prop: 'postName',
  94. label: '岗位',
  95. align: 'center',
  96. showOverflowTooltip: true,
  97. minWidth: 110
  98. },
  99. // {
  100. // prop: 'factoryId',
  101. // label: '所属工厂',
  102. // sortable: 'custom',
  103. // showOverflowTooltip: true,
  104. // minWidth: 110,
  105. // formatter: (_row, _column, cellValue) => {
  106. // return this.factoryList.find((item) => item.id == cellValue)
  107. // ?.name;
  108. // }
  109. // },
  110. {
  111. prop: 'loginName',
  112. label: '用户账号',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. minWidth: 110
  116. },
  117. {
  118. prop: 'sex',
  119. label: '性别',
  120. align: 'center',
  121. showOverflowTooltip: true,
  122. minWidth: 80,
  123. formatter: (_row, _column, cellValue) => {
  124. return cellValue == 1 ? '男' : cellValue == 2 ? '女' : '';
  125. }
  126. },
  127. {
  128. prop: 'status',
  129. label: '状态',
  130. align: 'center',
  131. width: 80,
  132. formatter: (_row, _column, cellValue) => {
  133. const dom = this.statusOptions.find((item) => {
  134. return item.value == cellValue;
  135. });
  136. return dom ? dom.label : '';
  137. }
  138. },
  139. {
  140. prop: 'isEnabled',
  141. align: 'center',
  142. label: '是否启用',
  143. showOverflowTooltip: true,
  144. formatter: (row, column) => {
  145. return row.isEnabled === 0
  146. ? '停用'
  147. : row.isEnabled === 1
  148. ? '启用'
  149. : '';
  150. }
  151. },
  152. {
  153. prop: 'createTime',
  154. label: '创建时间',
  155. align: 'center',
  156. showOverflowTooltip: true,
  157. minWidth: 110,
  158. formatter: (_row, _column, cellValue) => {
  159. return this.$util.toDateString(cellValue);
  160. }
  161. }
  162. ],
  163. radio: null
  164. };
  165. },
  166. watch: {},
  167. methods: {
  168. open(item) {
  169. if (item) {
  170. this.radio = item.id;
  171. }
  172. this.visible = true;
  173. },
  174. // /* 表格数据源 */
  175. // datasource({ page, limit, where, order }) {
  176. // return contactPageUsages({
  177. // pageNum: page,
  178. // size: limit,
  179. // ...where,
  180. // status: '1'
  181. // });
  182. // },
  183. /* 表格数据源 */
  184. datasource({ page, limit, where, order }) {
  185. return getUserPage({
  186. ...where,
  187. pageNum: page,
  188. size: limit,
  189. // groupId: this.organizationId,
  190. isQueryLZ: 0
  191. });
  192. },
  193. /* 刷新表格 */
  194. reload(where) {
  195. this.$refs.table.reload({ page: 1, where });
  196. },
  197. // 单击获取id
  198. cellClick(row) {
  199. this.current = row;
  200. this.radio = row.id;
  201. },
  202. handleClose() {
  203. this.visible = false;
  204. this.current = null;
  205. this.radio = '';
  206. },
  207. selected() {
  208. if (!this.current) {
  209. return this.$message.warning('请选择业务员');
  210. }
  211. this.$emit('changePersonnel', this.current);
  212. this.handleClose();
  213. }
  214. }
  215. };
  216. </script>
  217. <style lang="scss" scoped></style>