reallocation.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <!--
  2. * @Descripttion:待数据输入列表-重新分配
  3. * @version: 1.0
  4. * @Author: Liu_jiaYin
  5. -->
  6. <!-- 样品接收确认 -->
  7. <template>
  8. <div class="sample-scan">
  9. <el-dialog
  10. width="20%"
  11. top="25vh"
  12. :modal-append-to-body="false"
  13. title="检测员重新分配"
  14. :before-close="handleClose"
  15. :visible.sync="visible"
  16. @close="closeDialog"
  17. >
  18. <!--自定义对话框-->
  19. <ibps-custom-dialog
  20. v-model="jianCeYuan"
  21. size="mini"
  22. :disabled="false"
  23. template-key="xzjcy"
  24. style="width: 150px;margin:auto;"
  25. :multiple="false"
  26. type="dialog"
  27. />
  28. <span slot="footer" class="dialog-footer">
  29. <el-button @click="visible = false">取 消</el-button>
  30. <el-button type="primary" @click="submitData('确认')">确认</el-button>
  31. </span>
  32. </el-dialog>
  33. </div>
  34. </template>
  35. <script>
  36. import IbpsLinkData from '@/business/platform/data/templaterender/link-data'
  37. import IbpsCustomDialog from '@/business/platform/data/templaterender/custom-dialog'
  38. import { formatDate } from '@/utils/date'
  39. import ActionUtils from '@/utils/action'
  40. export default {
  41. components: {
  42. IbpsLinkData,
  43. IbpsCustomDialog
  44. },
  45. props: {
  46. scanVisible: Boolean,
  47. obj: {
  48. // eslint-disable-next-line vue/require-valid-default-prop
  49. default: [],
  50. type: Array
  51. }},
  52. data () {
  53. return {
  54. visible: false,
  55. jianCeYuan: ''
  56. }
  57. },
  58. watch: {
  59. scanVisible: {
  60. handler (val, oldName) {
  61. if (val) {
  62. this.visible = true
  63. }
  64. },
  65. deep: true,
  66. immediate: true
  67. }
  68. },
  69. created () {
  70. },
  71. methods: {
  72. submitData (v) {
  73. this.handleUp()
  74. },
  75. handleClose () {
  76. this.$confirm('确认要取消重新分配吗').then((t) => {
  77. this.closeDialog()
  78. }).catch((e) => {
  79. })
  80. },
  81. closeDialog () {
  82. this.visible = false
  83. this.$emit('scanOff', false)
  84. },
  85. handleUp () {
  86. const { projectIds, template, this_ } = this.obj[0]
  87. const updLists = []
  88. for (const i of projectIds) {
  89. const dataWhere = {}
  90. const where = {
  91. id_: i
  92. }
  93. const param = {
  94. jian_ce_yuan_: this.jianCeYuan
  95. }
  96. dataWhere['where'] = where
  97. dataWhere['param'] = param
  98. updLists.push(dataWhere)
  99. }
  100. const param = { tableName: 't_lhjczb', updList: updLists }
  101. this.reassign(this_, template, projectIds, this.jianCeYuan)
  102. this_.$curdPost('updatesByWhere', JSON.stringify(param)).then(() => {
  103. template.$message.success('重新分配成功。')
  104. template.search()
  105. this.closeDialog()
  106. }).catch(() => {
  107. template.$message.error('分配失败,请重新再试。')
  108. this.closeDialog()
  109. })
  110. },
  111. getTaskData (this_, businessKey) {
  112. const order = businessKey.replace(/,/g, "','")
  113. const sql = `select a.businesskey_ as businessKey, b.task_id_ as taskId,b.proc_inst_id_ as procInstId, b.node_id_ as nodeId from ibps_bpm_bus_rel a left join ibps_bpm_tasks b on a.proc_inst_id_ = b.proc_inst_id_ where find_in_set(a.businesskey_, '${businessKey}') order by field(a.businesskey_, '${order}')`
  114. return new Promise((resolve, reject) => {
  115. this_.$curdPost('sql', sql).then(res => {
  116. const { data = [] } = res.variables || {}
  117. const taskIds = data.filter(i => i && i.taskId)
  118. resolve(taskIds)
  119. }).catch(error => {
  120. reject(error)
  121. })
  122. })
  123. },
  124. async reassign (this_, template, idList, targetId) {
  125. const { name, userList } = template.$store.getters
  126. const ids = idList.join(',')
  127. const taskIds = await this.getTaskData(this_, ids)
  128. const currentDate = new Date()
  129. // updateAssignParams = []
  130. // updateProjectParams = []
  131. // 转派人,写死金通
  132. // const targetId = '702117247933480960'
  133. if (taskIds.length) {
  134. for (const i of taskIds) {
  135. const executorName = userList.find(item => item.userId === targetId)?.userName
  136. this_.$request({
  137. url: '/business/v3/bpm/task/change/save',
  138. method: 'post',
  139. data: {
  140. pk: '',
  141. name: null,
  142. ip: null,
  143. createBy: null,
  144. createTime: formatDate(currentDate, 'yyyy-MM-dd HH:mm:ss'),
  145. updateBy: null,
  146. updateTime: null,
  147. tenantId: null,
  148. dataStatus: null,
  149. deleted: null,
  150. dbType: null,
  151. dsAlias: null,
  152. id: null,
  153. taskId: i.taskId,
  154. taskSubject: `用户:${name}于${formatDate(currentDate, 'yyyy-MM-dd')}重新分配检测员为:${executorName}`,
  155. taskName: '发起人',
  156. procInstId: i.procInstId,
  157. nodeId: i.nodeId,
  158. changeType: 'shift',
  159. status: 'running',
  160. ownerId: '1',
  161. executorId: null,
  162. comment: `用户:${name}于${formatDate(currentDate, 'yyyy-MM-dd')}重新分配检测员为:${executorName}`,
  163. completeTime: null,
  164. cancelTime: null,
  165. delBeforeSave: true,
  166. bpmTaskChangeAssignPoList: [
  167. {
  168. 'type': 'employee',
  169. 'executor': targetId,
  170. 'executorName': executorName
  171. }
  172. ],
  173. ownerName: '管理员',
  174. executorName: null,
  175. icon: null,
  176. iconBgColor: null
  177. }
  178. })
  179. }
  180. }
  181. // taskIds.forEach(item => {
  182. // updateAssignParams.push({
  183. // where: {
  184. // task_id_: item.taskId
  185. // },
  186. // param: {
  187. // executor_: targetId
  188. // }
  189. // })
  190. // updateProjectParams.push({
  191. // where: {
  192. // id_: item.businessKey
  193. // },
  194. // param: {
  195. // jian_ce_yuan_: targetId
  196. // }
  197. // })
  198. // })
  199. // const updateAssign = {
  200. // tableName: 'ibps_bpm_task_assign',
  201. // updList: updateAssignParams
  202. // }
  203. // const updateProject = {
  204. // tableName: 't_lhjczb',
  205. // updList: updateProjectParams
  206. // }
  207. // // 更新assign表执行人和检测表检测员,刷新列表数据
  208. // this.$curdPost('updatesByWhere', updateAssign).then(() => {
  209. // this.$curdPost('updatesByWhere', updateProject).then(() => {
  210. // this.$template.handleAction('search', {}, [], [], 0, {button_type: 'search'})
  211. // })
  212. // })
  213. }
  214. }
  215. }
  216. </script>
  217. <style lang="less" scoped>
  218. /deep/ .el-form-item__label,
  219. /deep/ .el-input__inner {
  220. color: none;
  221. }
  222. .dialog-body{
  223. }
  224. .sample-scan .popContainer {
  225. position: fixed;
  226. top: 0;
  227. left: 0;
  228. right: 0;
  229. bottom: 0;
  230. z-index: 9999999;
  231. background: rgba(0, 0, 0, 0.7);
  232. }
  233. // .dynamic-form-table__label:before {
  234. // content: '*';
  235. // color: #F56C6C;
  236. // }
  237. .dynamic-form-table__label {
  238. color: #F56C6C;
  239. font-size: 18px;
  240. line-height: 40px;
  241. font-weight: bold;
  242. }
  243. /**必须设置.el-form-item__label为none */
  244. /deep/.zzj .el-form-item__content .el-input__inner {
  245. color: #e60c14;
  246. }
  247. /deep/.el-form-item__content {
  248. display: inline-block;
  249. }
  250. /deep/.el-form-item__label {
  251. padding: 0;
  252. margin-right: 5px;
  253. width: 120px;
  254. // width: 101px;
  255. // margin-left:25px;
  256. }
  257. /deep/.el-input__inner {
  258. border-top: none !important;
  259. border-left: none !important;
  260. border-right: none !important;
  261. border-radius: 0;
  262. }
  263. /deep/.jiaji {
  264. // color: #F56C6C;
  265. // font-size: 18px;
  266. // line-height: 40px;
  267. // font-weight: bold;
  268. }
  269. /deep/.el-dialog__title {
  270. line-height: 24px;
  271. color: #e60c14;
  272. font-weight: 600;
  273. }
  274. </style>