new-home.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  1. <template>
  2. <div class="app-container">
  3. <el-tabs v-model="activeTab" @tab-click="changeTab">
  4. <el-tab-pane v-for="item in tabList" :key="item.key" :name="item.key">
  5. <span slot="label"><i :class="item.icon"></i> {{ item.label }}</span>
  6. <div class="tab-container">
  7. <div class="table-container">
  8. <div class="search-container">
  9. <div class="search-box">
  10. <span class="label">事务名称</span>
  11. <el-input
  12. v-model="searchParams.subject"
  13. class="input"
  14. placeholder="请输入内容"
  15. clearable
  16. @keyup.enter.native="search"
  17. ></el-input>
  18. </div>
  19. <div class="search-box">
  20. <span class="label">{{ item.time }}时间</span>
  21. <el-date-picker
  22. v-model="searchParams.createTime"
  23. type="daterange"
  24. class="input"
  25. start-placeholder="请选择"
  26. end-placeholder="请选择"
  27. size="mini"
  28. clearable
  29. @keyup.enter.native="search"
  30. ></el-date-picker>
  31. </div>
  32. <el-button class="btn" type="primary" @click="search">
  33. <i class="ibps-icon-search"></i>查询
  34. </el-button>
  35. </div>
  36. <el-table
  37. v-loading="loading"
  38. :data="dataList"
  39. style="color: #000"
  40. align="center"
  41. size="mini"
  42. border
  43. class="jbd-home-task"
  44. @row-click="handleLinkClick"
  45. :row-class-name="tableRowClassName"
  46. >
  47. <el-table-column
  48. prop="subject"
  49. label="事务名称"
  50. width="250"
  51. show-overflow-tooltip
  52. >
  53. <template slot-scope="scope">{{ scope.row.subject | getWorkInfo('name') }}</template>
  54. </el-table-column>
  55. <el-table-column label="事务说明" show-overflow-tooltip>
  56. <template slot-scope="scope">{{ scope.row.subject | getWorkInfo('desc') }}</template>
  57. </el-table-column>
  58. <template v-if="['wait'].includes(activeTab)">
  59. <el-table-column
  60. show-overflow-tooltip
  61. width="120"
  62. label="事务状态"
  63. >
  64. <template slot-scope="scope">{{ '待' + scope.row.name }}</template>
  65. </el-table-column>
  66. <el-table-column show-overflow-tooltip width="100">
  67. <template slot="header" slot-scope="scope">
  68. <span>办理进度</span>
  69. <el-tooltip effect="dark" placement="top">
  70. <div slot="content">
  71. 普通事务:接收三天之内为待办理,三天之后为已超时
  72. <br/>
  73. 计划事务:月底前七天内为即将超时,超过接收当月月底为已超时,其余为待办理
  74. </div>
  75. <i class="el-icon-info"></i>
  76. </el-tooltip>
  77. </template>
  78. <template slot-scope="scope">
  79. <el-tag :type="scope.row.state ? stateOption[scope.row.state].type : ''">{{ scope.row.state ? stateOption[scope.row.state].label : '待办理' }}</el-tag>
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. prop="startDept"
  84. show-overflow-tooltip
  85. width="120"
  86. label="发起部门"
  87. />
  88. <el-table-column
  89. :key="Date.now() + Math.random()"
  90. prop="submitBy"
  91. show-overflow-tooltip
  92. width="100"
  93. >
  94. <template slot="header" slot-scope="scope">
  95. <span>发起人</span>
  96. <el-tooltip effect="dark" placement="top">
  97. <div slot="content">
  98. 该事务对应流程的发起人
  99. </div>
  100. <i class="el-icon-info"></i>
  101. </el-tooltip>
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. :key="Date.now() + Math.random()"
  106. prop="forwardBy"
  107. show-overflow-tooltip
  108. width="100"
  109. >
  110. <template slot="header" slot-scope="scope">
  111. <span>提交人</span>
  112. <el-tooltip effect="dark" placement="top">
  113. <div slot="content">
  114. 该事务对应流程上一节点的提交人
  115. </div>
  116. <i class="el-icon-info"></i>
  117. </el-tooltip>
  118. </template>
  119. </el-table-column>
  120. </template>
  121. <template v-else-if="['over', 'finish'].includes(activeTab)">
  122. <el-table-column
  123. show-overflow-tooltip
  124. label="事务状态"
  125. width="100"
  126. >
  127. <template slot-scope="scope">{{ scope.row.curNode ? scope.row.status == 'running' ? '已发起' : '已' + scope.row.curNode : contOfValue(scope.row.status) }}</template>
  128. </el-table-column>
  129. <el-table-column
  130. show-overflow-tooltip
  131. label="发起部门"
  132. width="100"
  133. >
  134. <template slot-scope="scope">{{ getParenthesesStr(scope.row.subject)[1] }}</template>
  135. </el-table-column>
  136. <el-table-column
  137. show-overflow-tooltip
  138. label="发起人"
  139. width="100"
  140. >
  141. <template slot-scope="scope">{{ scope.row.createBy | getUserName(userList)}}</template>
  142. </el-table-column>
  143. <el-table-column
  144. show-overflow-tooltip
  145. label="提交人"
  146. width="100"
  147. >
  148. <template slot-scope="scope">{{ getName(scope.row) }}</template>
  149. </el-table-column>
  150. </template>
  151. <el-table-column
  152. show-overflow-tooltip
  153. width="160"
  154. :label="item.time + '时间'"
  155. >
  156. <template slot-scope="scope">{{ scope.row[item.field] ? scope.row[item.field].slice(0, 16) : scope.row.createTime.slice(0, 16) }}</template>
  157. </el-table-column>
  158. </el-table>
  159. <div v-if="dataList.length">
  160. <el-pagination
  161. @current-change="changePage"
  162. :current-page.sync="paginate.page"
  163. :page-size="paginate.limit"
  164. layout="total, prev, pager, next"
  165. :total="paginate.totalCount"
  166. >
  167. </el-pagination>
  168. </div>
  169. </div>
  170. </div>
  171. </el-tab-pane>
  172. </el-tabs>
  173. <bpmn-formrender
  174. :visible="dialogFormVisible"
  175. :task-id="activeTab === 'wait' ? taskId : null"
  176. :waiJian="activeTab === 'wait' ? waiJian : null"
  177. :instance-id="['over', 'finish'].includes(activeTab) ? instanceId : null"
  178. :def-id="activeTab === 'save' ? defId : null"
  179. :pro-inst-id="activeTab === 'save' ? proInstId : null"
  180. :title="['wait', 'save'].includes(activeTab) ? FlowName : null"
  181. :processName="processName"
  182. @callback="getData(activeTab)"
  183. @close="visible => (dialogFormVisible = visible)"
  184. />
  185. </div>
  186. </template>
  187. <script>
  188. import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
  189. import homeCalendar from './home-calendar'
  190. import { pending, handledTask } from '@/api/platform/office/bpmReceived'
  191. import { myDraft, removeDraft } from '@/api/platform/office/bpmInitiated'
  192. import { queryOrgManager } from '@/api/platform/org/employee'
  193. import { save } from '@/api/platform/message/innerMessage'
  194. import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
  195. import ActionUtils from '@/utils/action'
  196. import { dateFormat } from '../../../../filters'
  197. const tabList = [
  198. {
  199. label: '待办事宜',
  200. key: 'wait',
  201. icon: 'el-icon-edit',
  202. time: '提交',
  203. field: 'createTime'
  204. },
  205. {
  206. label: '已办事宜',
  207. key: 'over',
  208. icon: 'el-icon-document-remove',
  209. time: '办理',
  210. field: 'updateTime'
  211. },
  212. {
  213. label: '办结事宜',
  214. key: 'finish',
  215. icon: 'el-icon-paperclip',
  216. time: '结束',
  217. field: 'updateTime'
  218. },
  219. {
  220. label: '暂存事宜',
  221. key: 'save',
  222. icon: 'el-icon-receiving',
  223. time: '暂存',
  224. field: 'createTime'
  225. }
  226. ]
  227. const taskState = {
  228. running: '已发起',
  229. end: '已结束',
  230. manualend: '人工结束'
  231. }
  232. const paramsType = {
  233. wait: 'temp.',
  234. over: '',
  235. finish: 'inst.',
  236. save: ''
  237. }
  238. const stateOption = {
  239. wait: {
  240. label: '待办理',
  241. type: ''
  242. },
  243. soon: {
  244. label: '即将超时',
  245. type: 'warning'
  246. },
  247. overtime: {
  248. label: '已超时',
  249. type: 'danger'
  250. }
  251. }
  252. const operate = {
  253. wait: pending,
  254. over: handledTask,
  255. finish: handledTask,
  256. save: myDraft
  257. }
  258. export default {
  259. components: { BpmnFormrender, homeCalendar },
  260. name: 'calendar',
  261. filters: {
  262. getWorkInfo (v, type) {
  263. let hasDesc = v.includes('#')
  264. let res = {
  265. name: {
  266. '0': v.includes('{') ? v.split('{')[0] : v.includes('(') ? v.split('(')[0] : v,
  267. '1': v.split('#')[0]
  268. },
  269. // 无#返回空,有#返回(左边的字符串,
  270. desc: {
  271. '0': '',
  272. '1': v.split('#')[1]
  273. }
  274. }
  275. if (!hasDesc) {
  276. return res[type]['0']
  277. }
  278. return res[type]['1']
  279. },
  280. getUserName (v, list) {
  281. let user = list.find(i => i.userId === v)
  282. return user ? user.userName : ''
  283. }
  284. },
  285. data() {
  286. return {
  287. tabList,
  288. stateOption,
  289. dataList: [],
  290. paginate: {},
  291. searchParams: {
  292. typeId: '',
  293. subject: '',
  294. createTime: ''
  295. },
  296. taskId: '', // 编辑dialog需要使用
  297. waiJian: '', // 编辑dialog需要使用
  298. instanceId: '',
  299. defId: '',
  300. proInstId: '',
  301. loading: false,
  302. drawer: false,
  303. dialogFormVisible: false,
  304. orgName: '',
  305. roleName: '',
  306. FlowName: '',
  307. posName: '',
  308. defaultPagination: { page: 1, limit: 15 },
  309. sorts: { CREATE_TIME_: 'DESC' },
  310. timer: null,
  311. processName: '',
  312. userList: [],
  313. orgInfo: {},
  314. activeTab: 'wait'
  315. }
  316. },
  317. mounted: function () {
  318. this.loadData()
  319. this.getUserList()
  320. this.getOrgInfo()
  321. if (this.timer) {
  322. clearInterval(this.timer)
  323. }
  324. // 轮询刷新公告数据和任务数据
  325. this.timer = setInterval(() => {
  326. // this.getMessage()
  327. this.getData(this.activeTab)
  328. }, 30 * 1000)
  329. },
  330. beforeDestroy() {
  331. clearInterval(this.timer)
  332. },
  333. // 路由离开时
  334. beforeRouteLeave(to, from, next) {
  335. clearInterval(this.timer)
  336. },
  337. methods: {
  338. loadData() {
  339. // let user = this.$store.getters.userInfo
  340. // let pos, role
  341. // this.orgName = user.employee.orgName
  342. // for (let i in user.positions) {
  343. // if (i == 0) pos = user.positions[0].name
  344. // else pos = pos + ',' + user.positions[i].name
  345. // }
  346. // let contRole = this.unique(user.role) //去重
  347. // for (let i in contRole) {
  348. // if (i == 0) role = contRole[0].name
  349. // else role = role + ',' + contRole[i].name
  350. // }
  351. // this.posName = pos
  352. // this.roleName = role
  353. // this.getMessage()
  354. // 获取任务数据
  355. this.getData(this.activeTab)
  356. },
  357. // 获取系统用户信息
  358. getUserList() {
  359. const { userList } = this.$store.getters
  360. // store中有则无需请求
  361. if (userList && userList.length) {
  362. this.userList = userList
  363. return
  364. }
  365. let sql = 'select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee'
  366. curdPost('sql', sql).then(res => {
  367. this.userList = res.variables && res.variables.data
  368. })
  369. },
  370. // 获取用户部门信息
  371. getOrgInfo() {
  372. const { org = {} } = this.$store.getters
  373. if (!org || !org.id) {
  374. return
  375. }
  376. let params = {
  377. parameters: [{key: 'Q^MANAGER_ORG_ID_^S', value: org.id}]
  378. }
  379. queryOrgManager(params).then(res => {
  380. this.orgInfo = {}
  381. const data = res.data.dataResult
  382. if (data && data.length) {
  383. const { id, name, mobile, account, gender, groupID } = data[0]
  384. this.orgInfo = { id, name, mobile, account, gender, groupID, orgName: org.name }
  385. }
  386. })
  387. },
  388. getName ({createBy, updateBy}) {
  389. const id = updateBy ? updateBy : createBy
  390. const { name = '' } = this.$store.getters
  391. if (this.activeTab === 'finish') {
  392. let t = this.userList.find(i => i.userId === id)
  393. return t ? t.userName : ''
  394. }
  395. return name
  396. },
  397. tableRowClassName({ row, rowIndex }) {
  398. if (rowIndex % 2 === 1) return 'warning-row'
  399. return 'success-row'
  400. },
  401. // 获取表格数据
  402. getData(type) {
  403. this.loading = true
  404. operate[this.activeTab](this.getFormatParams(null, this.defaultPagination)).then(response => {
  405. let {dataResult, pageResult} = response.data
  406. if (dataResult && dataResult.length) {
  407. // 待办事宜对任务发起人做额外处理
  408. if (type === 'wait') {
  409. let instList = []
  410. dataResult.forEach(item => {
  411. instList.push(item.bpmnInstId)
  412. })
  413. let sql = `select b.bpmn_inst_id_, b.create_by_, a.name_ from ibps_bpm_inst b left join ibps_party_employee a on a.id_ = b.create_by_ where b.bpmn_inst_id_ in (${instList.join(',')}) order by find_in_set(b.bpmn_inst_id_,'${instList.join(',')}')`
  414. let currentTime = Date.now()
  415. curdPost('sql', sql).then(res => {
  416. const data = res.variables && res.variables.data
  417. data.forEach((item, index) => {
  418. dataResult[index].submitBy = item.name_
  419. dataResult[index].workName = dataResult[index].subject.includes('#') ? dataResult[index].subject.split('#')[0] : dataResult[index].subject.split('(')[0]
  420. dataResult[index].workType = dataResult[index].workName.includes('计划') ? 'plan' : 'normal'
  421. dataResult[index].state = this.judgeExpire(dataResult[index].createTime, currentTime, dataResult[index].workType, '1')
  422. })
  423. this.dataList = dataResult.sort((a, b) => b.createTime.localeCompare(a.createTime))
  424. this.paginate = pageResult
  425. })
  426. this.urgeToManager()
  427. } else {
  428. this.dataList = dataResult
  429. this.paginate = pageResult
  430. }
  431. }
  432. this.loading = false
  433. }).catch(() => {
  434. this.loading = false
  435. })
  436. },
  437. // 查询
  438. search() {
  439. this.dataList = []
  440. this.paginate = {}
  441. this.getData(this.activeTab)
  442. },
  443. // 切换tab
  444. changeTab() {
  445. // 数据、筛选条件初始化
  446. this.dataList = []
  447. this.paginate = {}
  448. this.typeId = ''
  449. this.defaultPagination.page = 1
  450. this.getData(this.activeTab)
  451. },
  452. // 数组去重
  453. unique(arr) {
  454. const res = new Map()
  455. return arr.filter(arr => !res.has(arr.id) && res.set(arr.id, 1))
  456. },
  457. // 分页
  458. changePage(val) {
  459. this.dataList = []
  460. this.paginate = {}
  461. this.defaultPagination.page = val
  462. this.getData(this.activeTab)
  463. },
  464. // 转换状态码
  465. contOfValue(cont) {
  466. let s = taskState[cont]
  467. return s ? s : '暂停'
  468. },
  469. getFormatParams(v, pagination) {
  470. const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
  471. if (this.$utils.isNotEmpty(this.searchParams.typeId)) {
  472. params[`Q^${paramsType[this.activeTab]}TYPE_ID_^S`] = this.searchParams.typeId
  473. }
  474. if (this.$utils.isNotEmpty(this.searchParams.subject)) {
  475. params[`Q^${paramsType[this.activeTab]}subject_^SL`] = this.searchParams.subject
  476. }
  477. if (this.searchParams.createTime && this.searchParams.createTime.length) {
  478. params[`Q^${paramsType[this.activeTab]}create_time_^DL`] = dateFormat(this.searchParams.createTime[0]).slice(0, 10)
  479. params[`Q^${paramsType[this.activeTab]}create_time_^DG`] = dateFormat(this.searchParams.createTime[1]).slice(0, 10)
  480. }
  481. if (this.activeTab === 'finish') {
  482. params.end = '1'
  483. }
  484. return ActionUtils.formatParams(params, pagination, this.sorts)
  485. },
  486. // 处理表格点击事件
  487. handleLinkClick(data) {
  488. this.taskId = data.id || ''
  489. this.waiJian = data.waiJian || ''
  490. this.instanceId = data.id || ''
  491. this.defId = data.procDefId || ''
  492. this.proInstId = data.id || ''
  493. this.FlowName = data.name
  494. this.processName = this.getProjectName(data.procDefKey, data.subject)
  495. this.dialogFormVisible = true
  496. },
  497. // 开关右侧栏抽屉
  498. handleClose() {
  499. this.drawer = !this.drawer
  500. },
  501. // 文字替换,兼容旧数据
  502. getParenthesesStr(text) {
  503. let result = ''
  504. if (!text) return result
  505. let regex1 = /\{(.+?)\}/g
  506. let regex2 = /\((.+?)\)/g
  507. let options1 = text.match(regex1)
  508. let options2 = text.match(regex2)
  509. let options = options1 && options1.length ? options1 : options2
  510. if (options) {
  511. let option = options[0]
  512. if (option) {
  513. result = option.substring(1, option.length - 1)
  514. }
  515. if (options[1]) {
  516. let yersOption = options[1]
  517. if (yersOption) {
  518. result = result + '/' + yersOption.substring(1, yersOption.length - 1)
  519. }
  520. }
  521. }
  522. return result.split('/')
  523. },
  524. // 判断是否为检测项目流程,是则截取流程标题为表单名称
  525. getProjectName(key, subject) {
  526. // 从store中获取保存的检测流程信息数组
  527. const { testingList = [] } = this.$store.getters
  528. let res = testingList.includes(key)
  529. return res ? subject.includes('#') ? subject.split('#')[0] : '' : ''
  530. },
  531. /**
  532. * 主管提醒
  533. * 数据处理,将所有待办数据根据是否过期处理为两个数组
  534. * 过期判断依据:普通事务-创建时间到当前时间超过三天即为过期;计划事务【事务名称中含计划】-创建当月月末前七天
  535. * 逻辑说明:过期数组中不存于在主管提醒表中的数据插入主管提醒表,并发送内部通知,主管提醒表删除不存在于未过期数组中的数据
  536. */
  537. urgeToManager() {
  538. const { userId } = this.$store.getters
  539. let params = {
  540. parameters: [],
  541. sorts: []
  542. }
  543. let sql = `select id_, shi_wu_id_ as taskId from t_gqswbs where position('${userId}' in chu_li_ren_id_)`
  544. Promise.all([pending(params), curdPost('sql', sql)]).then(([res1, res2]) => {
  545. let workData = res1.data && res1.data.dataResult
  546. let noticeData = res2.variables && res2.variables.data
  547. if (!workData || !workData.length) {
  548. return
  549. }
  550. this.dealData(workData, noticeData)
  551. })
  552. },
  553. // 处理数据
  554. dealData(workList, noticeList) {
  555. let result = {
  556. expire: [],
  557. unexpire: [],
  558. all: []
  559. }
  560. let currentTime = Date.now()
  561. // 筛选已过期数据
  562. workList.forEach(item => {
  563. // 截取流程名
  564. item.workName = item.subject.includes('#') ? item.subject.split('#')[0] : item.subject.split('(')[0]
  565. item.workType = item.workName.includes('计划') ? 'plan' : 'normal'
  566. let isExpire = this.judgeExpire(item.createTime, currentTime, item.workType)
  567. if (isExpire) {
  568. result.expire.push(item)
  569. } else {
  570. result.unexpire.push(item)
  571. }
  572. result.all.push(item)
  573. })
  574. // 有过期数据才执行过期数据处理
  575. if (result.expire.length) {
  576. this.dealExpile(result.expire, noticeList)
  577. }
  578. // 主管提醒表中有数据才执行数据删除
  579. if (noticeList && noticeList.length) {
  580. this.dealUnexpile(result.all, noticeList)
  581. }
  582. },
  583. // 判断是否过期、获取办理状态
  584. judgeExpire(time, current, type, isState) {
  585. let D = new Date(time)
  586. let a = new Date(time).getTime()
  587. let b = new Date(current).getTime()
  588. // 创建时间当月最后一天的时间戳
  589. let c = new Date(D.getFullYear(), D.getMonth() + 1, 0).getTime() + 86400000
  590. // 返回办理状态
  591. if (isState) {
  592. let state = ''
  593. if (type === 'plan') {
  594. state = b >= c ? 'overtime' : b + (86400000 * 7) > c ? 'soon' : 'wait'
  595. } else {
  596. state = a + (86400000 * 3) < b ? 'overtime' : 'wait'
  597. }
  598. return state
  599. }
  600. // 返回是否过期
  601. if (type === 'plan') {
  602. return b + (86400000 * 7) > c
  603. } else {
  604. return a + (86400000 * 3) < b
  605. }
  606. },
  607. // 处理已过期数据
  608. dealExpile(data, noticeList) {
  609. const { userId } = this.$store.getters
  610. let addList = []
  611. let sendList = []
  612. const msgContent = {
  613. plan: '距离过期还剩七天,请及时处理!',
  614. normal: '至今三天未处理,已超时,请及时处理!'
  615. }
  616. const msgTitle = {
  617. plan: '计划事务即将到期提醒',
  618. normal: '事务超时提醒'
  619. }
  620. const nowTime = new Date(new Date().getTime() + 28800000).toJSON().slice(0, 16).replace('T', ' ')
  621. data.forEach(item => {
  622. let isExist = !!noticeList.find(i => i.taskId === item.taskId)
  623. // 筛选出不存在于主管提醒表的过期数据
  624. if (!isExist) {
  625. // 无部门信息的用户不往过期事务表加数据
  626. if (this.orgInfo.groupID) {
  627. let obj = {
  628. // 事务ID
  629. shi_wu_id_: item.taskId,
  630. // 完整名称
  631. wan_zheng_ming_ch: item.subject,
  632. // 事务说明
  633. shi_wu_shuo_ming_: item.subject.includes('#') ? item.subject.split('#')[1] : '',
  634. // 事务名称
  635. shi_wu_ming_cheng: item.workName,
  636. // 事务状态
  637. shi_wu_zhuang_tai: `待${item.name}`,
  638. // 事务类型
  639. shi_wu_lei_xing_: item.workType,
  640. chu_li_ren_ming_: item.ownerName,
  641. chu_li_ren_id_: this.getInfoByName(item.ownerName, 'id'),
  642. chu_li_ren_dian_h: this.getInfoByName(item.ownerName, 'phone'),
  643. bu_men_: this.orgInfo.orgName,
  644. bu_men_id_: this.orgInfo.groupID,
  645. // 主管ID与当前用户id相等时将主管ID设置为主任【】的ID,主管电话设为空
  646. zhu_guan_id_: this.orgInfo.id === userId ? '990927120278487040' : this.orgInfo.id,
  647. zhu_guan_dian_hua: this.orgInfo.id === userId ? '' : this.orgInfo.mobile,
  648. bian_zhi_shi_jian: item.createTime,
  649. ti_xing_ci_shu_: 1,
  650. duan_xin_ci_shu_: 0,
  651. ti_xing_shi_jian_: nowTime
  652. }
  653. addList.push(obj)
  654. }
  655. let msg = {
  656. subject: msgTitle[item.workType],
  657. content: `<p>事务【${item.workName}】${msgContent[item.workType]}<p>`,
  658. receiverId: userId,
  659. canreply: '0'
  660. }
  661. sendList.push(msg)
  662. }
  663. })
  664. let addParams = {
  665. tableName: 't_gqswbs',
  666. paramWhere: addList
  667. }
  668. console.log(addList, sendList)
  669. if (addList.length) {
  670. curdPost('add', JSON.stringify(addParams))
  671. }
  672. if (sendList.length) {
  673. this.sendMsg(sendList)
  674. }
  675. },
  676. // 删除已办的提醒表数据
  677. dealUnexpile(data, noticeList) {
  678. // 清除存在于主管提醒表中【处理人含我】,但是不存在于待办中的数据
  679. let deleteList = []
  680. noticeList.forEach(item => {
  681. let isExist = !!data.find(i => i.taskId === item.taskId)
  682. if (!isExist) {
  683. deleteList.push(item.id_)
  684. }
  685. })
  686. if (!deleteList.length) {
  687. return
  688. }
  689. let params = `{"tableName": "t_gqswbs","paramWhere":"{id_:'${deleteList.join(',')}'}"}`
  690. curdPost('batchDelete', params).then(() => {}).catch(err => {
  691. console.log(err)
  692. })
  693. },
  694. // 发送站内消息
  695. sendMsg(data) {
  696. data.forEach(item => {
  697. save(item).then(() => {}).catch(err => {
  698. console.log(err)
  699. })
  700. })
  701. },
  702. // 通过名字获取id/电话
  703. getInfoByName(names, type) {
  704. let res = {
  705. id: [],
  706. phone: []
  707. }
  708. let temp = names.split(',')
  709. temp.forEach(item => {
  710. let t = this.userList.find(i => i.userName === item)
  711. if (t) {
  712. res.id.push(t.userId)
  713. res.phone.push(t.phone)
  714. }
  715. })
  716. return res[type].filter(i => i).join(',')
  717. }
  718. }
  719. }
  720. </script>
  721. <style lang="scss" scoped>
  722. .el-completing {
  723. background: #409eff !important;
  724. }
  725. .el-col {
  726. min-height: 1px;
  727. }
  728. .firstcol {
  729. padding-right: 10px;
  730. }
  731. .el-nothing {
  732. font-size: 13px;
  733. }
  734. .calendar-day {
  735. text-align: center;
  736. color: #202535;
  737. line-height: 30px;
  738. font-size: 12px;
  739. }
  740. .is-selected {
  741. color: #f8a535;
  742. font-size: 10px;
  743. margin-top: 5px;
  744. }
  745. #calendar .el-button-group > .el-button:not(:first-child):not(:last-child):after {
  746. content: '当月';
  747. }
  748. #calendar .item {
  749. position: relative;
  750. margin: 0;
  751. padding: 0;
  752. height: auto;
  753. border-radius: 4px;
  754. -webkit-box-sizing: border-box;
  755. box-sizing: border-box;
  756. overflow: hidden;
  757. color: #f8a535;
  758. }
  759. .ibps-list-split .ibps-list-item {
  760. border-bottom: 1px solid #dcdfe6;
  761. padding: 6px 0;
  762. }
  763. .jbd-font-style {
  764. font-weight: bold;
  765. }
  766. .home-text-border {
  767. color: #999999;
  768. box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.1), 0 0 0 0 rgba(0, 0, 0, 0.1), 0 0 0 0 rgba(0, 0, 0, 0.1), 0 1px 0px 0 rgba(0, 0, 0, 0.1);
  769. min-height: 20px;
  770. font-size: 14px;
  771. margin-left: 60px;
  772. margin-bottom: 5px;
  773. }
  774. .jbd-home-card {
  775. overflow: auto;
  776. }
  777. .jbd-home-task {
  778. width: 100%;
  779. padding: 10px;
  780. cursor: pointer;
  781. font-size: 12px;
  782. margin-bottom: 35px;
  783. }
  784. .jbd-home-card::-webkit-scrollbar {
  785. display: none;
  786. }
  787. .jbd-control-cont {
  788. text-align: center;
  789. position: absolute;
  790. z-index: 10;
  791. right: 0px;
  792. top: 50%;
  793. }
  794. .tab-container {
  795. >div {
  796. display: inline-block;
  797. }
  798. .table-container {
  799. width: 100%;
  800. vertical-align: top;
  801. .search-container {
  802. display: flex;
  803. margin-bottom: 10px;
  804. .search-box {
  805. display: flex;
  806. align-items: center;
  807. height: 30px;
  808. margin-right: 20px;
  809. .label {
  810. margin: 0 6px 0 6px;
  811. color: #606266;
  812. font-size: 12px;
  813. }
  814. .input {
  815. width: 200px;
  816. font-size: 12px;
  817. height: 28px !important;
  818. line-height: 28px;
  819. color: #606266;
  820. ::v-deep .el-input__inner {
  821. height: 28px;
  822. line-height: 28px;
  823. }
  824. }
  825. }
  826. .btn {
  827. height: 30px;
  828. margin-left: 10px;
  829. background-color: #409eff;
  830. border-color: #409eff;
  831. font-size: 12px;
  832. border-radius: 3px;
  833. padding: 7px 15px;
  834. }
  835. }
  836. }
  837. }
  838. </style>
  839. <style>
  840. .app-container .el-drawer.rtl {
  841. overflow: scroll;
  842. }
  843. .app-container .el-table th {
  844. background-color: #a7d6f8 !important;
  845. font-size: 14px;
  846. font-weight: bold;
  847. color: #000000;
  848. border: 0px;
  849. }
  850. .app-container .el-table td {
  851. padding: 4px;
  852. }
  853. .app-container .el-table .warning-row {
  854. background: #d3ebfc;
  855. color: #000000;
  856. }
  857. .app-container .el-table .success-row {
  858. background: #f9ffff;
  859. color: #000000;
  860. }
  861. </style>