aproveWin.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <el-dialog title="审核业务" :close-on-click-modal="true" v-if="visible" :visible.sync="visible" :before-close="handleDialogClose">
  3. <el-form :model="model" ref="form1" label-width="120px">
  4. <el-row :gutter="26">
  5. <el-col :span="16" v-if="isLast">
  6. <el-form-item label="审核角色" prop="data1" class="is-required">
  7. <el-select filterable v-model="model.data1" :multiple="ismultiple" @remove-tag="removeTag" placeholder="请选择..." @change="role">
  8. <el-option v-for="item in options1" :key="item.id" :label="item.name" :value="item.id"></el-option>
  9. </el-select>
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="16" v-if="isLast">
  13. <el-form-item label="审核人" verify prop="nextDealMan" class="is-required">
  14. <el-select filterable v-model="model.nextDealMan" :multiple="ismultiple" placeholder="请选择...">
  15. <el-option v-for="item in options2" :key="item.id" :label="item.name" :value="item.id"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="16" v-if="type==2">
  20. <el-form-item label="审核意见" prop="content" verify :maxLength="100" class="is-required">
  21. <el-input type="textarea" v-model="model.content"></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="16" v-if="type==2">
  25. <el-form-item label="常用意见" prop="nextDealMan1">
  26. <el-select filterable v-model="model.nextDealMan1" @change="changeContent" placeholder="请选择...">
  27. <el-option v-for="item in options3" :key="item.adviceId" :label="item.adviceInfo" :value="item.adviceId"></el-option>
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="16" v-if="isLast || type === 2">
  32. <el-form-item>
  33. <el-checkbox v-model="checked" @change="changeIsQRCodeTrack">同时短信通知</el-checkbox>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="16" v-if="!isLast && checked">
  37. <el-form-item label="短信接收人名单">
  38. <div class="textarea" :disabled="false">
  39. <el-tag :key="tag.id" style="margin-left:6px;" v-for="tag in messageReceiveList">
  40. {{tag.name}}
  41. </el-tag>
  42. </div>
  43. </el-form-item>
  44. </el-col>
  45. </el-row>
  46. </el-form>
  47. <span slot="footer" class="dialog-footer">
  48. <el-button type="primary" v-if="type==2" @click="addSer()">添加到常用意见</el-button>
  49. <el-button v-if="type==1||type==3" @click="visible = false">关闭</el-button>
  50. <el-button v-if="type==2" @click="dataFormSubmit('no')">不同意</el-button>
  51. <el-button type="primary" @click="dataFormSubmit('yes')">{{btn}}</el-button>
  52. </span>
  53. </el-dialog>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. checked: false,
  60. messageReceiveList: [],
  61. formAction: 0, //0 add,//1,edit
  62. visible: false,
  63. title: '添加',
  64. disabled: false,
  65. btn: '提交',
  66. ismultiple: false,
  67. type: 1,
  68. aproveVisible: false,
  69. isLast: true,
  70. taskId: '',
  71. model: {
  72. content: '',
  73. nextDealMan: -1,
  74. isAccount: 1,
  75. isQRCodeTrack:'',
  76. },
  77. options1: [],
  78. options2: [],
  79. options3: [],
  80. value5: [],
  81. }
  82. },
  83. mounted() {
  84. // this.model.data2 = this.$store.getters.getLogin("username");
  85. // this.model.data4 = this.$store.getters.getLogin("userId")
  86. },
  87. activated() {},
  88. methods: {
  89. init(type, procdefkey, procinstid, resolution, taskId) {
  90. //type1 申请 2 中间环节 3.驳回
  91. console.log(arguments)
  92. this.type = type
  93. console.log(99, this.type)
  94. this.model = {
  95. content: '',
  96. nextDealMan: -1,
  97. isAccount: 1,
  98. }
  99. this.taskId = taskId
  100. this.options1 = []
  101. this.options2 = []
  102. this.options3 = []
  103. this.value5 = []
  104. if (type == 1 || resolution != undefined || type == 3) {
  105. this.btn = '提交'
  106. } else {
  107. this.btn = '同意'
  108. }
  109. this.procdefkey = procdefkey
  110. this.procinstid = procinstid
  111. this.resolution = resolution
  112. this.visible = true
  113. if (this.$refs.form1) {
  114. this.$refs.form1.resetFields()
  115. }
  116. this.doSelect()
  117. this.doserSelect()
  118. if (procinstid !== null && procinstid !== undefined) {
  119. this.doSelectMessageReceiveList()
  120. }
  121. },
  122. dataFormSubmit(type) {
  123. console.log(120, type)
  124. if ((this.isLast && !this.model.data1) || (this.model.data1 && this.model.nextDealMan==-1)) return this.$message.error('审核角色或审核人不能为空!')
  125. let self = this
  126. // console.log(122,this.ismultiple)
  127. var model = JSON.parse(JSON.stringify(this.model))
  128. if (this.ismultiple) {
  129. model.nextDealManList = model.nextDealMan.join(',')
  130. model.nextDealMan = -1
  131. }
  132. console.log(128, model)
  133. if (type == 'no') {
  134. if (!model.content) {
  135. this.$message('请填写驳回原因')
  136. return false
  137. }
  138. model.approve = type
  139. self.$parent.dataFormSubmit(model)
  140. self.visible = false
  141. } else {
  142. self.$refs['form1'].validate((valid) => {
  143. if (valid) {
  144. model.approve = type
  145. if(!self.isLast) {
  146. model.nextDealMan = -1
  147. }
  148. self.$parent.dataFormSubmit(model)
  149. self.visible = false
  150. } else {
  151. return false
  152. }
  153. })
  154. }
  155. },
  156. handleDialogClose() {
  157. // console.log(self.$parent)
  158. this.$parent.visible = false
  159. this.visible = false
  160. },
  161. doserSelect() {
  162. let self = this
  163. this.common.selectInit(this.$url.findAdvice.getList, success, { pageNum: 1, pageSize: 20 }, 'options3')
  164. function success(data, str) {
  165. self[str] = data.rows
  166. }
  167. },
  168. doSelect() {
  169. let self = this
  170. let obj = {}
  171. if (this.type == 1) {
  172. obj = { procdefkey: this.procdefkey }
  173. } else {
  174. obj = { procinstid: this.procinstid, approve: 'yes' }
  175. if (this.resolution || this.resolution == 0) {
  176. obj.resolution = this.resolution
  177. }
  178. if (this.taskId) {
  179. obj.taskId = this.taskId
  180. }
  181. }
  182. console.log(186, obj)
  183. this.common.selectInit(this.$url.activeti.getRole, success, obj, 'options1', error)
  184. function error(data) {
  185. // self.$parent.aproveVisible = false
  186. // self.$message.error('错误,请重新审批!')
  187. }
  188. function success(data, str) {
  189. // multiple
  190. console.log(190, data)
  191. if (data) {
  192. if (data.tasktype != 4) {
  193. self.isLast = false
  194. } else {
  195. // data.activitybehavior = 'SequentialMultiInstanceBehavior'
  196. if (data.activitybehavior == 'SequentialMultiInstanceBehavior' || data.activitybehavior == 'ParallelMultiInstanceBehavior') {
  197. self.ismultiple = true
  198. // console.log(199);
  199. // console.log(200,data.rows[0].id)
  200. self.model.data1 = [data.rows[0].id]
  201. self.role([data.rows[0].id])
  202. } else {
  203. // console.log(200,data.rows[0].id)
  204. // 如果返回审核角色和审核人 没有 加这层判断 解决前端报id为undefined的问题
  205. if (data.rows.length != 0) {
  206. self.ismultiple = false
  207. self.model.data1 = data.rows[0].id
  208. self.role(data.rows[0].id)
  209. }
  210. // self.ismultiple = false;
  211. // self.model.data1 = data.rows[0].id;
  212. // self.role(data.rows[0].id)
  213. }
  214. self[str] = data.rows
  215. self.isLast = true
  216. }
  217. } else {
  218. self.isLast = false
  219. self.ismultiple = false
  220. }
  221. }
  222. },
  223. role(row) {
  224. var str = ''
  225. if (typeof row == 'object') {
  226. if (row.length == 0) {
  227. return false
  228. }
  229. str = row.join(',')
  230. } else {
  231. if (!row) {
  232. return false
  233. }
  234. str = String(row)
  235. }
  236. let self = this
  237. let obj = {
  238. roleId: str,
  239. excludeMeWhenSelectNextHandler: self.common.excludeMeWhenSelectNextHandler,
  240. excludeFormerHanlder: self.common.excludeMeWhenSelectNextHandler,
  241. procinstid: self.procinstid,
  242. }
  243. this.common.selectInit(this.$url.activeti.getUsersByRoleIds, success, obj, 'options2')
  244. function success(data, str) {
  245. if (data.length != 0) {
  246. if (self.ismultiple) {
  247. self.nextDeal(data[0].id)
  248. } else {
  249. self.model.nextDealMan = data[0].id
  250. }
  251. self[str] = data
  252. } else {
  253. self.model.nextDealMan = []
  254. self.$message('该角色下审核人为空')
  255. }
  256. // if( self.ismultiple){
  257. // self.nextDeal(data[0].id);
  258. // }else{
  259. // self.model.nextDealMan = data[0].id;
  260. // }
  261. // self[str] = data;
  262. }
  263. },
  264. removeTag() {
  265. this.model.nextDealMan = -1
  266. },
  267. nextDeal(id) {
  268. if (typeof this.model.nextDealMan != 'object') {
  269. this.model.nextDealMan = []
  270. }
  271. var tag = this.model.nextDealMan.find((i) => {
  272. return i == id
  273. })
  274. if (!tag) {
  275. this.model.nextDealMan.push(id)
  276. }
  277. },
  278. addSer() {
  279. let self = this
  280. if (!this.model.content) {
  281. this.$message('审核意见为空')
  282. return false
  283. }
  284. let urls = null
  285. urls = this.$url.findAdvice.add
  286. var obj = {
  287. url: urls,
  288. data: {
  289. adviceInfo: this.model.content,
  290. },
  291. }
  292. this.common.httpPost(obj, success)
  293. function success(data) {
  294. self.$message.success('已添加')
  295. self.doserSelect()
  296. }
  297. },
  298. changeContent(value) {
  299. let obj = this.options3.find((element) => {
  300. return element.adviceId == value
  301. })
  302. this.model.content = obj.adviceInfo
  303. },
  304. changeIsQRCodeTrack(checked) {
  305. if(checked){
  306. this.model.isQRCodeTrack = 1;
  307. } else {
  308. this.model.isQRCodeTrack = 0;
  309. }
  310. },
  311. doSelectMessageReceiveList(){
  312. let self = this;
  313. var obj = {
  314. url: self.$url.activeti.getMessageReceiveList,
  315. data: {
  316. procinstid: self.procinstid,
  317. },
  318. }
  319. self.common.httpPost(obj, success)
  320. function success(data) {
  321. console.log("获取短信接收人",data);
  322. self.messageReceiveList = data.list;
  323. }
  324. },
  325. },
  326. }
  327. </script>
  328. <style>
  329. .el-textarea__inner {
  330. height: 100px;
  331. }
  332. .textarea {
  333. padding: 4px;
  334. min-height: 100px;
  335. width: 100%;
  336. color: #606266;
  337. background-color: #fff;
  338. background-image: none;
  339. border: 1px solid #dcdfe6;
  340. border-radius: 4px;
  341. transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
  342. box-sizing: border-box;
  343. }
  344. </style>