applyAddWorkConfirm.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <template>
  2. <el-dialog
  3. :close-on-click-modal="false"
  4. :close-on-press-escape="false"
  5. :visible.sync="dialogVisible"
  6. title="加班申请单-审核"
  7. top="50px"
  8. width="75%"
  9. >
  10. <div class="tabsdom">
  11. <el-tabs v-model="activeName" @tab-click="handleClick">
  12. <el-tab-pane label="加班申请" name="first">
  13. <el-card shadow="always" style="padding: 15px 5px 5px 15px">
  14. <el-row :gutter="15">
  15. <el-form ref="elForm" :model="formData" :rules="rules" label-width="100px">
  16. <el-col :span="24">
  17. <el-form-item label="姓名">
  18. <el-input v-model="userinfo.truename" placeholder="请输入加班申请" readonly>
  19. </el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="12">
  23. <el-form-item label="所在部门">
  24. <el-input v-model="userinfo.deptName" placeholder="请输入所在部门" readonly>
  25. </el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="12">
  29. <el-form-item label="岗位">
  30. <el-input v-model="userinfo.postName" placeholder="暂无岗位" readonly>
  31. </el-input>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="24">
  35. <el-form-item label="关联项目" prop="proId">
  36. <el-select v-model="formData.proId" disabled filterable placeholder="关联项目名称">
  37. <el-option
  38. v-for="item in ProjectData"
  39. :key="item.value"
  40. :label="item.label"
  41. :value="item.value"
  42. >
  43. <span style="float: left">{{ item.label }}</span>
  44. <span style="float: right; color: #8492a6; font-size: 13px">{{
  45. item.custname
  46. }}</span>
  47. </el-option>
  48. </el-select>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="24">
  52. <el-form-item label="加班事由" prop="applyReasons">
  53. <el-input v-model="formData.applyReasons" :autosize="{minRows: 4, maxRows: 4}"
  54. placeholder="请输入加班事由" readonly
  55. type="textarea"
  56. ></el-input>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="24">
  60. <el-form-item label="加班位置" prop="position">
  61. <el-radio-group v-model="formData.position" disabled size="medium">
  62. <el-radio
  63. v-for="(item, index) in positionOptions"
  64. :key="index" :disabled="item.disabled"
  65. :label="item.value"
  66. >
  67. {{ item.label }}
  68. </el-radio>
  69. </el-radio-group>
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="24">
  73. <el-form-item label="加班时间">
  74. <el-row v-for="(item,index) in applyAddWorkTime">
  75. <el-col :span="10">
  76. <el-date-picker
  77. v-model="item.startDay"
  78. class="pdr10px "
  79. disabled
  80. placeholder="选择日期"
  81. type="date"
  82. value-format="yyyy-MM-dd"
  83. >
  84. </el-date-picker>
  85. </el-col>
  86. <el-col :span="10">
  87. <el-time-picker
  88. v-model="item.timeRange"
  89. class="el-input "
  90. clearable
  91. disabled
  92. end-placeholder="结束时间" format="HH:mm"
  93. is-range
  94. range-separator="至"
  95. start-placeholder="开始时间"
  96. style="margin: 0"
  97. value-format="HH:mm"
  98. />
  99. </el-col>
  100. <el-col :span="4">
  101. <div style="text-align: center">小计{{ item.useTime }}(h)</div>
  102. </el-col>
  103. </el-row>
  104. <div class="totalApplyTime" style="margin: 0">共计加班时长{{ formData.totalAddTime }}(h)</div>
  105. </el-form-item>
  106. </el-col>
  107. <el-col :span="24">
  108. <el-form-item label="备注">
  109. <el-input
  110. v-model="formData.remark"
  111. :autosize="{minRows: 4, maxRows: 4}"
  112. :style="{width: '100%'}"
  113. placeholder="请输入备注"
  114. type="textarea"
  115. ></el-input>
  116. </el-form-item>
  117. </el-col>
  118. </el-form>
  119. </el-row>
  120. <h3>流程历史</h3>
  121. <div class="tableDom">
  122. <el-table
  123. :data="tableData"
  124. :header-cell-style="{
  125. background:'#1890FF !important',
  126. color:'white'
  127. }"
  128. border
  129. style="width: 100%"
  130. >
  131. <el-table-column fixed label="序号" type="index" width="60"/>
  132. <el-table-column
  133. label="节点名称"
  134. prop="nodeName"
  135. width="180"
  136. />
  137. <el-table-column
  138. label="处理人"
  139. prop="auditUserName"
  140. width="180"
  141. />
  142. <el-table-column
  143. label="审核结果"
  144. prop="auditResultString"
  145. />
  146. <el-table-column
  147. label="审核意见"
  148. prop="auditContent"
  149. />
  150. <el-table-column
  151. label="发起/审核时间"
  152. prop="createdAt"
  153. >
  154. <template slot-scope="scope">
  155. {{ $common.transTime(scope.row.createdAt) }}
  156. </template>
  157. </el-table-column>
  158. </el-table>
  159. </div>
  160. <h3>处理</h3>
  161. <el-card shadow="always" style="padding: 0px 5px 5px 15px">
  162. <el-form
  163. ref="confirmForm"
  164. :model="confirmForm"
  165. class="cost_form"
  166. label-width="100px"
  167. style="width: 100%;padding: 5px"
  168. >
  169. <el-row :gutter="10">
  170. <el-col :span="24">
  171. <el-form-item label="处理结果" style="margin-bottom: 15px">
  172. <el-radio-group v-model="confirmForm.confirmResult">
  173. <el-radio :label="1">同意</el-radio>
  174. <el-radio v-if="argeeNoStatus" :label="2">退回发起人</el-radio>
  175. <el-radio v-if="argeeBackStatus" :label="3">退回上节点</el-radio>
  176. <!-- c<el-radio :label="4">结束流程</el-radio>-->
  177. </el-radio-group>
  178. </el-form-item>
  179. </el-col>
  180. <el-col :span="24">
  181. <el-form-item label="处理意见">
  182. <el-input v-model="confirmForm.confirmContent" style="margin-top:10px" type="textarea"/>
  183. <el-dropdown size="mini" split-button trigger="hover" type="primary">
  184. 常用语选择
  185. <el-dropdown-menu slot="dropdown">
  186. <el-dropdown-item
  187. v-for="item in dc_data.COMMON_PHRASES"
  188. @click.native="selectCommonPhrases(item.label)"
  189. >
  190. {{ item.label }}
  191. </el-dropdown-item>
  192. </el-dropdown-menu>
  193. </el-dropdown>
  194. </el-form-item>
  195. </el-col>
  196. </el-row>
  197. <el-col :span="24">
  198. <el-form-item label="审核人抄送">
  199. <user-select
  200. :default-select="confirmList"
  201. :multiple="true"
  202. class="cclist"
  203. @selectValue="parentMethod"
  204. />
  205. </el-form-item>
  206. </el-col>
  207. </el-form>
  208. </el-card>
  209. </el-card>
  210. </el-tab-pane>
  211. <el-tab-pane label="流程图 " name="second">
  212. <add-work-canvas ref="addWorkCanvas"/>
  213. </el-tab-pane>
  214. </el-tabs>
  215. </div>
  216. <div slot="footer">
  217. <el-button @click="dialogVisible=false">取消</el-button>
  218. <el-button type="primary" @click="handelConfirm">确定</el-button>
  219. </div>
  220. </el-dialog>
  221. </template>
  222. <script>
  223. import { upload } from '@/static/utils/channel'
  224. import Base from '@/views/base/base'
  225. import BaseData from '@/views/base/baseData'
  226. import UserSelect from '@/views/components/UserSelect'
  227. import addWorkCanvas from '@/views/workflow/components/myProcess/addWorkCanvas.vue'
  228. const applyAddWorkTime = { useTime: 0 }
  229. export default {
  230. name: 'ApplyPay',
  231. mixins: [Base, BaseData],
  232. components: {
  233. upload,
  234. UserSelect, addWorkCanvas
  235. },
  236. data() {
  237. return {
  238. row: {},
  239. confirmList: [],
  240. selectList: [],
  241. argeeBackStatus: false,
  242. argeeNoStatus: false,
  243. tableData: [],
  244. flowHistroy: [],
  245. confirmForm: {
  246. confirmContent: '',
  247. confirmResult: 1
  248. },
  249. dc_key: ['ORDER_STATUS', 'PAY_TYPE', 'BUDGET_FY', 'COMMON_PHRASES'],
  250. ProjectData: [],
  251. dialogVisible: false,
  252. applyAddWorkTime: [{ ...applyAddWorkTime }],
  253. formData: {
  254. proId: '',
  255. totalAddTime: 0,
  256. applyReasons: '',
  257. position: '',
  258. applyAddWorkTime: [
  259. {
  260. useTime: 0
  261. }
  262. ]
  263. },
  264. userinfo: {},
  265. activeName: 'first',
  266. rules: {
  267. proId: [{
  268. required: true,
  269. message: '请选择关联项目',
  270. trigger: 'change'
  271. }],
  272. applyReasons: [{
  273. required: true,
  274. message: '请输入加班事由',
  275. trigger: 'change'
  276. }],
  277. position: [{
  278. required: true,
  279. message: '加班位置不能为空',
  280. trigger: 'change'
  281. }]
  282. },
  283. positionOptions: [
  284. {
  285. 'label': '公司',
  286. 'value': 1
  287. },
  288. {
  289. 'label': '客户处',
  290. 'value': 2
  291. }, {
  292. 'label': '居家',
  293. 'value': 3
  294. }]
  295. }
  296. },
  297. computed: {},
  298. watch: {
  299. 'applyAddWorkTime': {
  300. deep: true,
  301. handler(newValue, oldValue) {
  302. let totalAddTime = 0
  303. for (let i = 0; i < this.applyAddWorkTime.length; i++) {
  304. if (this.applyAddWorkTime[i].useTime === 0 || this.applyAddWorkTime[i].useTime) {
  305. totalAddTime = totalAddTime + Number(this.applyAddWorkTime[i].useTime)
  306. }
  307. }
  308. console.log(totalAddTime)
  309. this.changeAddWorkTime(totalAddTime.toFixed(1))
  310. }
  311. }
  312. },
  313. created() {
  314. },
  315. mounted() {
  316. this.initDict(this.dc_key).then((res) => {
  317. this.initProject({ /* signstatus: '2,3'*/ })
  318. })
  319. },
  320. methods: {
  321. handleClick(tab, event) {
  322. this.canVasStatus = false
  323. if (this.activeName == 'second') {
  324. this.canVasStatus = true
  325. this.$nextTick(() => {
  326. this.$refs.addWorkCanvas.createNodeCanvas(this.row)
  327. })
  328. }
  329. },
  330. parentMethod(val) {
  331. if (val.length > 0) {
  332. this.confirmForm.ccList = val.join(',')
  333. }
  334. },
  335. selectCommonPhrases(e) {
  336. if (!this.confirmForm.confirmContent) this.confirmForm.confirmContent = ''
  337. },
  338. changeAddWorkTime(totalAddTime) {
  339. this.formData.totalAddTime = totalAddTime
  340. },
  341. async getUserInfo(applyUser) {
  342. let { data: userinfo } = await this.baseRequest1('ApplyAddWorkController', 'getUserInfoByUserId', { userId: applyUser })
  343. this.userinfo = userinfo
  344. console.log(this.userinfo)
  345. },
  346. spliceListRow(index) {
  347. this.formData.workTimeList.splice(index, 1)
  348. },
  349. async setVisible(status, row) {
  350. this.activeName = 'first'
  351. this.row = row
  352. this.getUserInfo(row.applyUser)
  353. this.confirmForm.flowMainPushId = row.flowMainPushId
  354. let { data } = await this.baseRequest1('ApplyAddWorkController', 'getInfoByFlowMainPushId', { flowMainPushId: row.flowMainPushId })
  355. const { data: flowHistroy } = await this.baseRequest1('FlowMainController', 'getFlowHistroyByFlowMainId', { flowMainId: row.id })
  356. const noAndbackstatus = await this.baseRequest1('FlowMainController', 'getOutgoingFlowsByFlowMainPushId', { flowMainPushId: row.flowMainPushId })
  357. for (let i = 0; i < noAndbackstatus.data.length; i++) {
  358. if (noAndbackstatus.data[i].conditionExpression == '${agree==\'no\'}') this.argeeNoStatus = true
  359. if (noAndbackstatus.data[i].conditionExpression == '${agree==\'back\'}') this.argeeBackStatus = true
  360. }
  361. this.tableData = flowHistroy
  362. this.formData = data
  363. this.applyAddWorkTime = data.applyAddWorkTimeList.map((e) => {
  364. return {
  365. useTime: e.useTime,
  366. startDay: this.$common.transDate(e.startDay),
  367. timeRange: [this.$common.transMinute(e.startTime), this.$common.transMinute(e.endTime)]
  368. }
  369. })
  370. console.log(this.applyAddWorkTime)
  371. // flowMainPushId
  372. this.dialogVisible = status
  373. },
  374. baseRequest1(prefix, opUrl, postData) {
  375. return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
  376. },
  377. async handelConfirm() {
  378. this.$refs['elForm'].validate(async valid => {
  379. // if (!valid) return
  380. // ApplyAddWorkController/AddConfirmResultAddWork
  381. console.log(this.confirmForm)
  382. const { data } = await this.baseRequest1('ApplyAddWorkController', 'AddConfirmResultAddWork', { ...this.confirmForm })
  383. if (data.code == 200) {
  384. this.$message.success('处理成功')
  385. this.form = {}
  386. this.confirmForm = { confirmContent: '' }
  387. this.dialogVisible = false
  388. this.$emit('getData')
  389. }
  390. })
  391. }
  392. }
  393. }
  394. </script>
  395. <style lang="scss">
  396. .cclist {
  397. .col-input {
  398. padding: 0;
  399. }
  400. }
  401. .pdr10px {
  402. padding-right: 10px;
  403. }
  404. .mgb10px {
  405. margin-bottom: 10px;
  406. }
  407. .mb25 {
  408. margin-bottom: 25px;
  409. }
  410. .pdtopbottom16 {
  411. padding: 0px 16px;
  412. }
  413. .pdtop16px {
  414. padding-top: 16px;
  415. }
  416. .cost_form {
  417. .col-input {
  418. font-weight: 400;
  419. }
  420. .el-form-item__label .moneydetails {
  421. text-align: right;
  422. font-size: 16px;
  423. font-family: 微软雅黑;
  424. padding-right: 10px;
  425. line-height: 40px;
  426. word-break: keep-all;
  427. white-space: nowrap;
  428. color: #606266;
  429. text-rendering: optimizeLegibility;
  430. font-weight: 400;
  431. }
  432. .moneydetails {
  433. text-align: right;
  434. font-size: 16px;
  435. font-family: 微软雅黑;
  436. padding-right: 10px;
  437. word-break: keep-all;
  438. white-space: nowrap;
  439. color: #606266;
  440. text-rendering: optimizeLegibility;
  441. font-weight: 400;
  442. }
  443. .moneydetails:before {
  444. content: "*";
  445. color: #ff4949;
  446. }
  447. }
  448. .txtc {
  449. text-align: center
  450. }
  451. .ml5 {
  452. margin-left: 5px;
  453. }
  454. .eltype {
  455. margin-bottom: 15px;
  456. }
  457. .tabsdom {
  458. .el-input {
  459. width: 100%;
  460. }
  461. .el-tabs__header {
  462. text-align: center !important;
  463. width: 139px !important;
  464. text-align: center !important;
  465. display: block !important;
  466. margin: auto !important;
  467. margin-bottom: 15px !important;
  468. }
  469. .el-tabs__nav-wrap::after {
  470. display: none;
  471. }
  472. .el-upload {
  473. width: 100%;
  474. }
  475. }
  476. .feeMoneyTotal {
  477. width: 100%;
  478. height: 14px;
  479. font-size: 14px;
  480. font-weight: 400;
  481. color: #1890FF;
  482. margin-top: 31px;
  483. margin-bottom: 13px;
  484. }
  485. </style>