applyAddWorkDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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. </el-card>
  161. </el-tab-pane>
  162. <el-tab-pane label="流程图 " name="second">
  163. <add-work-canvas ref="AddWorkCanvas"/>
  164. </el-tab-pane>
  165. </el-tabs>
  166. </div>
  167. <div slot="footer">
  168. <el-button @click="dialogVisible=false">关闭</el-button>
  169. </div>
  170. </el-dialog>
  171. </template>
  172. <script>
  173. import { upload } from '@/static/utils/channel'
  174. import Base from '@/views/base/base'
  175. import BaseData from '@/views/base/baseData'
  176. import UserSelect from '@/views/components/UserSelect'
  177. import * as echarts from 'echarts'
  178. import AddWorkCanvas from '@/views/workflow/components/myProcess/addWorkCanvas.vue'
  179. const lineStyle = {
  180. color: '#00116a',
  181. width: 2
  182. }
  183. const redLinestyle = {
  184. color: 'red',
  185. width: 2
  186. }
  187. const applyAddWorkTime = { useTime: 0 }
  188. export default {
  189. name: 'ApplyPay',
  190. mixins: [Base, BaseData],
  191. components: {
  192. AddWorkCanvas,
  193. upload,
  194. UserSelect
  195. },
  196. data() {
  197. return {
  198. row: {},
  199. argeeBackStatus: false,
  200. argeeNoStatus: false,
  201. tableData: [],
  202. flowHistroy: [],
  203. confirmForm: {
  204. confirmContent: ''
  205. },
  206. dc_key: ['ORDER_STATUS', 'PAY_TYPE', 'BUDGET_FY', 'COMMON_PHRASES'],
  207. ProjectData: [],
  208. dialogVisible: false,
  209. applyAddWorkTime: [{ ...applyAddWorkTime }],
  210. formData: {
  211. proId: '',
  212. totalAddTime: 0,
  213. applyReasons: '',
  214. position: '',
  215. applyAddWorkTime: [
  216. {
  217. useTime: 0
  218. }
  219. ]
  220. },
  221. userinfo: {},
  222. activeName: 'first',
  223. rules: {
  224. proId: [{
  225. required: true,
  226. message: '请选择关联项目',
  227. trigger: 'change'
  228. }],
  229. applyReasons: [{
  230. required: true,
  231. message: '请输入加班事由',
  232. trigger: 'change'
  233. }],
  234. position: [{
  235. required: true,
  236. message: '加班位置不能为空',
  237. trigger: 'change'
  238. }]
  239. },
  240. positionOptions: [
  241. {
  242. 'label': '公司',
  243. 'value': 1
  244. },
  245. {
  246. 'label': '客户处',
  247. 'value': 2
  248. }, {
  249. 'label': '居家',
  250. 'value': 3
  251. }]
  252. }
  253. },
  254. computed: {},
  255. watch: {
  256. 'applyAddWorkTime': {
  257. deep: true,
  258. handler(newValue, oldValue) {
  259. let totalAddTime = 0
  260. for (let i = 0; i < this.applyAddWorkTime.length; i++) {
  261. if (this.applyAddWorkTime[i].useTime === 0 || this.applyAddWorkTime[i].useTime) {
  262. totalAddTime = totalAddTime + Number(this.applyAddWorkTime[i].useTime)
  263. }
  264. }
  265. console.log(totalAddTime)
  266. this.changeAddWorkTime(totalAddTime.toFixed(1))
  267. }
  268. }
  269. },
  270. created() {
  271. },
  272. mounted() {
  273. this.initDict(this.dc_key).then((res) => {
  274. })
  275. this.initProject({ /* signstatus: '2,3'*/ })
  276. },
  277. methods: {
  278. handleClick(tab, event) {
  279. if (this.activeName == 'second') this.$refs.AddWorkCanvas.createNodeCanvas(this.row)
  280. },
  281. async getIMGFlowHistroyByFlowMainId(row) {
  282. console.log(row)
  283. // return
  284. const { data } = await this.baseRequest1('FlowMainController', 'getIMGFlowHistroyByFlowMainId', { flowMainId: row.id })
  285. console.log(data)
  286. for (let i = 0; i < data.length; i++) {
  287. switch (data[i].nodeKey) {
  288. case 'curr_user':
  289. if (i == 0 && data[i].type == 1) {
  290. //审核人审核
  291. this.node[0].symbol = 'image://' + require('../asste/lanfangkuai.png')
  292. }
  293. break
  294. case 'dept_superior_1_0_1':
  295. if (i == 0 && data[i].type == 3) {
  296. this.node[0].symbol = 'image://' + require('../asste/huangfanmgkuai.png')
  297. }
  298. if (i == 0 && data[i].type == 1) {
  299. this.node[0].symbol = 'image://' + require('../asste/lanfangkuai.png')
  300. }
  301. break
  302. default:
  303. }
  304. }
  305. },
  306. createNodeCanvas() {
  307. this.$nextTick(() => {
  308. let chartDom = document.getElementById('containeraddworkdetail')
  309. var myCharts = echarts.init(chartDom)
  310. let charts = {
  311. nodes: this.node,
  312. linesData: this.linesData
  313. }
  314. let option = {
  315. xAxis: {
  316. min: 0,
  317. max: 600,
  318. padding: [0, 50, 0, 50],
  319. show: false,
  320. type: 'value'
  321. },
  322. yAxis: {
  323. min: 0,
  324. max: 450,
  325. show: false,
  326. type: 'value'
  327. },
  328. grid: {
  329. left: 50,
  330. right: 0,
  331. bottom: 0,
  332. top: 0
  333. },
  334. series: [
  335. {
  336. type: 'graph',
  337. coordinateSystem: 'cartesian2d',
  338. symbol: 'rect',
  339. symbolSize: [80, 40],
  340. itemStyle: {
  341. color: 'rgb(225,7,7)'
  342. },
  343. symbolOffset: [10, 0],
  344. // force: {
  345. // edgeLength: 100,//连线的长度
  346. // repulsion: 200 //子节点之间的间距
  347. // },
  348. label: {
  349. show: true,
  350. color: 'white' // 节点文字颜色
  351. },
  352. data: charts.nodes
  353. },
  354. {
  355. type: 'lines',
  356. polyline: false,
  357. coordinateSystem: 'cartesian2d',
  358. symbol: ['', 'arrow'],
  359. symbolSize: 10,
  360. data: charts.linesData
  361. }
  362. ]
  363. }
  364. myCharts.clear()
  365. myCharts.setOption(option)
  366. window.addEventListener('resize', () => {
  367. myCharts.resize()
  368. })
  369. })
  370. },
  371. selectCommonPhrases(e) {
  372. if (!this.confirmForm.confirmContent) this.confirmForm.confirmContent = ''
  373. this.confirmForm.confirmContent += e
  374. },
  375. changeAddWorkTime(totalAddTime) {
  376. this.formData.totalAddTime = totalAddTime
  377. },
  378. async getUserInfo(applyUser) {
  379. let { data: userinfo } = await this.baseRequest1('ApplyAddWorkController', 'getUserInfoByUserId', { userId: applyUser })
  380. this.userinfo = userinfo
  381. console.log(this.userinfo)
  382. },
  383. spliceListRow(index) {
  384. this.formData.workTimeList.splice(index, 1)
  385. },
  386. async setVisible(status, row) {
  387. this.row=row
  388. this.activeName='first'
  389. this.getUserInfo(row.applyUser)
  390. this.confirmForm.flowMainPushId = row.flowMainPushId
  391. let { data } = await this.baseRequest1('ApplyAddWorkController', 'getInfoByFlowMainId', { flowMainId: row.id })
  392. const { data: flowHistroy } = await this.baseRequest1('FlowMainController', 'getFlowHistroyByFlowMainId', { flowMainId: row.id })
  393. this.tableData = flowHistroy
  394. this.formData = data
  395. this.applyAddWorkTime = data.applyAddWorkTimeList.map((e) => {
  396. return {
  397. useTime: e.useTime,
  398. startDay: this.$common.transDate(e.startDay),
  399. timeRange: [this.$common.transMinute(e.startTime), this.$common.transMinute(e.endTime)]
  400. }
  401. })
  402. this.dialogVisible = status
  403. this.row = row
  404. },
  405. baseRequest1(prefix, opUrl, postData) {
  406. return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
  407. },
  408. async handelConfirm() {
  409. this.dialogVisible = false
  410. }
  411. }
  412. }
  413. </script>
  414. <style lang="scss">
  415. #containeraddworkdetail {
  416. height: 600px;
  417. width: 100%;
  418. background: #F5F5F5;
  419. }
  420. .cclist {
  421. .col-input {
  422. padding: 0;
  423. }
  424. }
  425. .pdr10px {
  426. padding-right: 10px;
  427. }
  428. .mgb10px {
  429. margin-bottom: 10px;
  430. }
  431. .mb25 {
  432. margin-bottom: 25px;
  433. }
  434. .pdtopbottom16 {
  435. padding: 0px 16px;
  436. }
  437. .pdtop16px {
  438. padding-top: 16px;
  439. }
  440. .cost_form {
  441. .col-input {
  442. font-weight: 400;
  443. }
  444. .el-form-item__label .moneydetails {
  445. text-align: right;
  446. font-size: 16px;
  447. font-family: 微软雅黑;
  448. padding-right: 10px;
  449. line-height: 40px;
  450. word-break: keep-all;
  451. white-space: nowrap;
  452. color: #606266;
  453. text-rendering: optimizeLegibility;
  454. font-weight: 400;
  455. }
  456. .moneydetails {
  457. text-align: right;
  458. font-size: 16px;
  459. font-family: 微软雅黑;
  460. padding-right: 10px;
  461. word-break: keep-all;
  462. white-space: nowrap;
  463. color: #606266;
  464. text-rendering: optimizeLegibility;
  465. font-weight: 400;
  466. }
  467. .moneydetails:before {
  468. content: "*";
  469. color: #ff4949;
  470. }
  471. }
  472. .txtc {
  473. text-align: center
  474. }
  475. .ml5 {
  476. margin-left: 5px;
  477. }
  478. .eltype {
  479. margin-bottom: 15px;
  480. }
  481. .tabsdom {
  482. .el-input {
  483. width: 100%;
  484. }
  485. .el-tabs__header {
  486. text-align: center !important;
  487. width: 139px !important;
  488. text-align: center !important;
  489. display: block !important;
  490. margin: auto !important;
  491. margin-bottom: 15px !important;
  492. }
  493. .el-tabs__nav-wrap::after {
  494. display: none;
  495. }
  496. .el-upload {
  497. width: 100%;
  498. }
  499. }
  500. .feeMoneyTotal {
  501. width: 100%;
  502. height: 14px;
  503. font-size: 14px;
  504. font-weight: 400;
  505. color: #1890FF;
  506. margin-top: 31px;
  507. margin-bottom: 13px;
  508. }
  509. </style>