AttendanceInformation.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template xmlns:background-color="http://www.w3.org/1999/xhtml">
  2. <a-row :gutter="10">
  3. <a-col :md="6" :sm="12">
  4. <a-card :bordered="false">
  5. <div style="background: #fff;padding-left:16px;height: 100%; margin-top: 5px">
  6. <a-alert type="info" :showIcon="true">
  7. <div slot="message">
  8. 当前选择:<span v-if="this.currSelected.title">{{ getCurrSelectedTitle() }}</span>
  9. </div>
  10. </a-alert>
  11. <a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="请输入部门名称"/>
  12. <!-- 树-->
  13. <a-col :md="10" :sm="24">
  14. <template>
  15. <a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus">
  16. <span style="user-select: none">
  17. <a-tree
  18. multiple
  19. @select="onSelect"
  20. @check="onCheck"
  21. @rightClick="rightHandle"
  22. :selectedKeys="selectedKeys"
  23. :checkedKeys="checkedKeys"
  24. :treeData="departTree"
  25. :checkStrictly="checkStrictly"
  26. :expandedKeys="iExpandedKeys"
  27. :autoExpandParent="autoExpandParent"
  28. @expand="onExpand"/>
  29. </span>
  30. <!--新增右键点击事件,和增加添加和删除功能-->
  31. <!-- <a-menu slot="overlay">
  32. <a-menu-item @click="handleAdd(3)" key="1">添加</a-menu-item>
  33. <a-menu-item @click="handleDelete" key="2">删除</a-menu-item>
  34. <a-menu-item @click="closeDrop" key="3">取消</a-menu-item>
  35. </a-menu> -->
  36. </a-dropdown>
  37. </template>
  38. </a-col>
  39. </div>
  40. </a-card>
  41. <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
  42. <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
  43. </a-col>
  44. <a-col :md="18" :sm="24">
  45. <a-tabs defaultActiveKey="1">
  46. <a-tab-pane tab="基本信息" key="1" >
  47. <!-- <a-card :bordered="false" v-if="selectedKeys.length>0"> -->
  48. <a-table class="j-table-force-nowrap" ref="table" size="middle" bordered rowKey="id" :columns="columns"
  49. :dataSource="dataSource" :pagination="ipagination" :loading="loading"
  50. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  51. @change="handleTableChange" >
  52. </a-table>
  53. <!-- </a-card>
  54. <a-card v-else >
  55. <a-empty>
  56. <span slot="description"> 请先选择一个人员! </span>
  57. </a-empty>
  58. </a-card> -->
  59. </a-tab-pane>
  60. </a-tabs>
  61. </a-col>
  62. <!-- <depart-modal ref="departModal" @ok="loadTree"></depart-modal> -->
  63. </a-row>
  64. </template>
  65. <script>
  66. import DepartModal from '../modules/DepartModal'
  67. import pick from 'lodash.pick'
  68. import {queryTreeList2, searchByKeywords, deleteByDepartId} from '@/api/api'
  69. import moment from 'moment'
  70. import {httpAction, deleteAction} from '@/api/manage'
  71. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  72. import DepartAuthModal from '../modules/DepartAuthModal'
  73. // 表头
  74. const columns = [
  75. {
  76. title: '日期',
  77. align: 'center',
  78. dataIndex: 'viewDate', width: 100
  79. },
  80. {
  81. title: '人员',
  82. align: 'center',
  83. dataIndex: 'realname', width: 100
  84. }
  85. ]
  86. export default {
  87. name: 'DepartList',
  88. mixins: [JeecgListMixin],
  89. components: {
  90. // DepartAuthModal,
  91. // DepartModal
  92. },
  93. data() {
  94. return {
  95. iExpandedKeys: [],
  96. loading: false,
  97. autoExpandParent: true,
  98. currFlowId: '',
  99. currFlowName: '',
  100. disable: true,
  101. treeData: [],
  102. visible: false,
  103. departTree: [],
  104. rightClickSelectedKey: '',
  105. rightClickSelectedOrgCode: '',
  106. hiding: true,
  107. model: {},
  108. dropTrigger: '',
  109. depart: {},
  110. columns: columns,
  111. disableSubmit: false,
  112. checkedKeys: [],
  113. selectedKeys: [],
  114. autoIncr: 1,
  115. currSelected: {},
  116. allTreeKeys:[],
  117. checkStrictly: true,
  118. // form: this.$form.createForm(this),
  119. labelCol: {
  120. xs: {span: 24},
  121. sm: {span: 5}
  122. },
  123. wrapperCol: {
  124. xs: {span: 24},
  125. sm: {span: 16}
  126. },
  127. graphDatasource: {
  128. nodes: [],
  129. edges: []
  130. },
  131. url: {
  132. list: '/viewClockIn/viewClockIn/list',
  133. delete: '/sys/sysDepart/delete',
  134. edit: '/sys/sysDepart/edit',
  135. deleteBatch: '/sys/sysDepart/deleteBatch',
  136. exportXlsUrl: "sys/sysDepart/exportXls",
  137. importExcelUrl: "sys/sysDepart/importExcel",
  138. },
  139. orgCategoryDisabled:false,
  140. }
  141. },
  142. computed: {
  143. importExcelUrl: function () {
  144. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  145. }
  146. },
  147. methods: {
  148. loadData() {
  149. this.refresh();
  150. },
  151. loadTree() {
  152. var that = this
  153. that.treeData = []
  154. that.departTree = []
  155. queryTreeList2().then((res) => {
  156. if (res.success) {
  157. //部门全选后,再添加部门,选中数量增多
  158. this.allTreeKeys = [];
  159. for (let i = 0; i < res.result.length; i++) {
  160. let temp = res.result[i]
  161. that.treeData.push(temp)
  162. that.departTree.push(temp)
  163. that.setThisExpandedKeys(temp)
  164. that.getAllKeys(temp);
  165. // console.log(temp.id)
  166. }
  167. this.loading = false
  168. }
  169. })
  170. },
  171. setThisExpandedKeys(node) {
  172. if (node.children && node.children.length > 0) {
  173. this.iExpandedKeys.push(node.key)
  174. for (let a = 0; a < node.children.length; a++) {
  175. this.setThisExpandedKeys(node.children[a])
  176. }
  177. }
  178. },
  179. refresh() {
  180. this.loading = true
  181. this.loadTree()
  182. },
  183. // 右键操作方法
  184. rightHandle(node) {
  185. this.dropTrigger = 'contextmenu'
  186. console.log(node.node.eventKey)
  187. this.rightClickSelectedKey = node.node.eventKey
  188. this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
  189. },
  190. onExpand(expandedKeys) {
  191. console.log('onExpand', expandedKeys)
  192. // if not set autoExpandParent to false, if children expanded, parent can not collapse.
  193. // or, you can remove all expanded children keys.
  194. this.iExpandedKeys = expandedKeys
  195. this.autoExpandParent = false
  196. },
  197. backFlowList() {
  198. this.$router.back(-1)
  199. },
  200. // 右键点击下拉框改变事件
  201. dropStatus(visible) {
  202. if (visible == false) {
  203. this.dropTrigger = ''
  204. }
  205. },
  206. // 右键店家下拉关闭下拉框
  207. closeDrop() {
  208. this.dropTrigger = ''
  209. },
  210. addRootNode() {
  211. this.$refs.nodeModal.add(this.currFlowId, '')
  212. },
  213. batchDel: function () {
  214. console.log(this.checkedKeys)
  215. if (this.checkedKeys.length <= 0) {
  216. this.$message.warning('请选择一条记录!')
  217. } else {
  218. var ids = ''
  219. for (var a = 0; a < this.checkedKeys.length; a++) {
  220. ids += this.checkedKeys[a] + ','
  221. }
  222. var that = this
  223. this.$confirm({
  224. title: '确认删除',
  225. content: '确定要删除所选中的 ' + this.checkedKeys.length + ' 条数据,以及子节点数据吗?',
  226. onOk: function () {
  227. deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
  228. if (res.success) {
  229. that.$message.success(res.message)
  230. that.loadTree()
  231. that.onClearSelected()
  232. } else {
  233. that.$message.warning(res.message)
  234. }
  235. })
  236. }
  237. })
  238. }
  239. },
  240. onSearch(value) {
  241. let that = this
  242. if (value) {
  243. searchByKeywords({keyWord: value}).then((res) => {
  244. if (res.success) {
  245. that.departTree = []
  246. for (let i = 0; i < res.result.length; i++) {
  247. let temp = res.result[i]
  248. that.departTree.push(temp)
  249. }
  250. } else {
  251. that.$message.warning(res.message)
  252. }
  253. })
  254. } else {
  255. that.loadTree()
  256. }
  257. },
  258. nodeModalOk() {
  259. this.loadTree()
  260. },
  261. nodeModalClose() {
  262. },
  263. hide() {
  264. console.log(111)
  265. this.visible = false
  266. },
  267. onCheck(checkedKeys, info) {
  268. console.log('onCheck', checkedKeys, info)
  269. this.hiding = false
  270. //this.checkedKeys = checkedKeys.checked
  271. // <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
  272. if(this.checkStrictly){
  273. this.checkedKeys = checkedKeys.checked;
  274. }else{
  275. this.checkedKeys = checkedKeys
  276. }
  277. // <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
  278. },
  279. onSelect(selectedKeys, e) {
  280. console.log('selected', selectedKeys, e)
  281. // this.hiding = false
  282. // let record = e.node.dataRef
  283. // console.log('onSelect-record', record)
  284. // this.currSelected = Object.assign({}, record)
  285. // this.model = this.currSelected
  286. // this.selectedKeys = [record.key]
  287. // this.model.parentId = record.parentId
  288. // this.setValuesToForm(record)
  289. // this.$refs.departAuth.show(record.id);
  290. },
  291. // 触发onSelect事件时,为部门树右侧的form表单赋值
  292. setValuesToForm(record) {
  293. if(record.orgCategory == '1'){
  294. this.orgCategoryDisabled = true;
  295. }else{
  296. this.orgCategoryDisabled = false;
  297. }
  298. this.$nextTick(() => {
  299. this.form.getFieldDecorator('fax', {initialValue: ''})
  300. this.form.setFieldsValue(pick(record, 'departName','orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
  301. })
  302. },
  303. getCurrSelectedTitle() {
  304. return !this.currSelected.title ? '' : this.currSelected.title
  305. },
  306. onClearSelected() {
  307. this.hiding = true
  308. this.checkedKeys = []
  309. this.currSelected = {}
  310. this.form.resetFields()
  311. this.selectedKeys = []
  312. this.$refs.departAuth.departId = ''
  313. },
  314. handleNodeTypeChange(val) {
  315. this.currSelected.nodeType = val
  316. },
  317. notifyTriggerTypeChange(value) {
  318. this.currSelected.notifyTriggerType = value
  319. },
  320. receiptTriggerTypeChange(value) {
  321. this.currSelected.receiptTriggerType = value
  322. },
  323. submitCurrForm() {
  324. this.form.validateFields((err, values) => {
  325. if (!err) {
  326. if (!this.currSelected.id) {
  327. this.$message.warning('请点击选择要修改部门!')
  328. return
  329. }
  330. let formData = Object.assign(this.currSelected, values)
  331. console.log('Received values of form: ', formData)
  332. httpAction(this.url.edit, formData, 'put').then((res) => {
  333. if (res.success) {
  334. this.$message.success('保存成功!')
  335. this.loadTree()
  336. } else {
  337. this.$message.error(res.message)
  338. }
  339. })
  340. }
  341. })
  342. },
  343. emptyCurrForm() {
  344. this.form.resetFields()
  345. },
  346. nodeSettingFormSubmit() {
  347. this.form.validateFields((err, values) => {
  348. if (!err) {
  349. console.log('Received values of form: ', values)
  350. }
  351. })
  352. },
  353. openSelect() {
  354. this.$refs.sysDirectiveModal.show()
  355. },
  356. selectDirectiveOk(record) {
  357. console.log('选中指令数据', record)
  358. this.nodeSettingForm.setFieldsValue({directiveCode: record.directiveCode})
  359. this.currSelected.sysCode = record.sysCode
  360. },
  361. getFlowGraphData(node) {
  362. this.graphDatasource.nodes.push({
  363. id: node.id,
  364. text: node.flowNodeName
  365. })
  366. if (node.children.length > 0) {
  367. for (let a = 0; a < node.children.length; a++) {
  368. let temp = node.children[a]
  369. this.graphDatasource.edges.push({
  370. source: node.id,
  371. target: temp.id
  372. })
  373. this.getFlowGraphData(temp)
  374. }
  375. }
  376. },
  377. // <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
  378. expandAll () {
  379. this.iExpandedKeys = this.allTreeKeys
  380. },
  381. closeAll () {
  382. this.iExpandedKeys = []
  383. },
  384. checkALL () {
  385. this.checkStriccheckStrictlytly = false
  386. this.checkedKeys = this.allTreeKeys
  387. },
  388. cancelCheckALL () {
  389. //this.checkedKeys = this.defaultCheckedKeys
  390. this.checkedKeys = []
  391. },
  392. switchCheckStrictly (v) {
  393. if(v==1){
  394. this.checkStrictly = false
  395. }else if(v==2){
  396. this.checkStrictly = true
  397. }
  398. },
  399. getAllKeys(node) {
  400. // console.log('node',node);
  401. this.allTreeKeys.push(node.key)
  402. if (node.children && node.children.length > 0) {
  403. for (let a = 0; a < node.children.length; a++) {
  404. this.getAllKeys(node.children[a])
  405. }
  406. }
  407. }
  408. // <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
  409. },
  410. created() {
  411. this.currFlowId = this.$route.params.id
  412. this.currFlowName = this.$route.params.name
  413. // this.loadTree()
  414. },
  415. }
  416. </script>
  417. <style scoped>
  418. @import '~@assets/less/common.less'
  419. .ant-card-body .table-operator {
  420. margin: 15px;
  421. }
  422. .anty-form-btn {
  423. width: 100%;
  424. text-align: center;
  425. }
  426. .anty-form-btn button {
  427. margin: 0 5px;
  428. }
  429. .anty-node-layout .ant-layout-header {
  430. padding-right: 0
  431. }
  432. .header {
  433. padding: 0 8px;
  434. }
  435. .header button {
  436. margin: 0 3px
  437. }
  438. .ant-modal-cust-warp {
  439. height: 100%
  440. }
  441. .ant-modal-cust-warp .ant-modal-body {
  442. height: calc(100% - 110px) !important;
  443. overflow-y: auto
  444. }
  445. .ant-modal-cust-warp .ant-modal-content {
  446. height: 90% !important;
  447. overflow-y: hidden
  448. }
  449. #app .desktop {
  450. height: auto !important;
  451. }
  452. /** Button按钮间距 */
  453. .ant-btn {
  454. margin-left: 3px
  455. }
  456. .drawer-bootom-button {
  457. /*position: absolute;*/
  458. bottom: 0;
  459. width: 100%;
  460. border-top: 1px solid #e8e8e8;
  461. padding: 10px 16px;
  462. text-align: left;
  463. left: 0;
  464. background: #fff;
  465. border-radius: 0 0 2px 2px;
  466. }
  467. </style>