task-details.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <HcCard scrollbar actionUi="text-center">
  3. <HcCardItem>
  4. <div class="hac-task-name-box">
  5. <div class="label">任务名称</div>
  6. <div class="name">{{ taskBasicsInfo?.taskName }}</div>
  7. </div>
  8. <div class="hac-task-text-box">
  9. <span>上报类型:{{ taskBasicsInfo?.ReportTypeName }}</span>
  10. <span class="ml-10">上报人:{{ taskBasicsInfo?.reportUser }}</span>
  11. <span class="ml-10">上报时间:{{ taskBasicsInfo?.reportDate }}</span>
  12. </div>
  13. </HcCardItem>
  14. <HcCardItem title="任务详情" class="mt-4" v-if="dataType=='任务审批'||dataType=='财务报销'||dataType=='出差申请'||dataType=='流转财务审核'||dataType=='报销审批'">
  15. <div class="h-52">
  16. <HcTable :isIndex="false" :column="tableColumn" :datas="tableData"/>
  17. </div>
  18. </HcCardItem>
  19. <HcCardItem title="操作任务" class="mt-4" v-if="dataType === '任务审批'">
  20. <el-form ref="formRef" :model="otherInfo" label-width="" disabled>
  21. <el-form-item label="变更类别:" prop="updateType" size="large">
  22. <el-radio-group v-model="otherInfo.updateType" size="large">
  23. <el-radio :label="1">已完成</el-radio>
  24. <el-radio :label="2" class="ml-8">任务转移</el-radio>
  25. </el-radio-group>
  26. </el-form-item>
  27. <el-form-item label="完成时间:" prop="completionTime" class="w-72" v-if="otherInfo.updateType === 1">
  28. <el-date-picker class="block" v-model="otherInfo.completionTime" format="YYYY-MM-DD HH:mm:ss" type="date" value-format="YYYY-MM-DD HH:mm:ss"/>
  29. </el-form-item>
  30. <template v-if="otherInfo.updateType === 2">
  31. <el-form-item label="转移时间:" prop="transfer" class="w-72">
  32. <el-date-picker class="block" v-model="otherInfo.completionTime" format="YYYY-MM-DD HH:mm:ss" type="date" value-format="YYYY-MM-DD HH:mm:ss"/>
  33. </el-form-item>
  34. <el-form-item label="转移对象:" prop="type" size="large">
  35. <el-select class="block" v-model="otherInfo.transferObject" filterable allow-create default-first-option :reserve-keyword="false">
  36. <el-option v-for="item in userList" :label="item.name" :value="item.id"/>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item label="转移原因:" prop="textContent">
  40. <el-input v-model="otherInfo.transferReason" :autosize="{ minRows: 3, maxRows: 5 }" placeholder="请输入文字说明" type="textarea"/>
  41. </el-form-item>
  42. </template>
  43. </el-form>
  44. </HcCardItem>
  45. <HcCardItem title="数据详情" class="mt-4" v-if="dataType!=='任务审批'">
  46. <!-- 报销 -->
  47. <div class="hc-info-list" v-if="dataType=='报销审批'">
  48. <HcListItem title="报销金额:" :content="otherInfo?.frMoney"/>
  49. <HcListItem title="发生日期:" :content="otherInfo?.frDate"/>
  50. <HcListItem title="费用类型:" :content="otherInfo?.frTypeName"/>
  51. <HcListItem title="费用说明:" :content="otherInfo?.frDesc"/>
  52. <HcListItem title="电子发票:" >
  53. <HcImg ui="img" :index="0"
  54. v-if="otherInfo?.frElectronicInvoiceUrl"
  55. :src="otherInfo?.frElectronicInvoiceUrl"
  56. :srcs="[otherInfo?.frElectronicInvoiceUrl]"
  57. />
  58. </HcListItem>
  59. <HcListItem title="附件文件:" >
  60. <HcImg ui="img" :index="0"
  61. v-if="otherInfo?.frElectronicInvoiceUrl"
  62. :src="otherInfo?.frAttachmentUrl"
  63. :srcs="[otherInfo?.frAttachmentUrl]"
  64. />
  65. </HcListItem>
  66. <HcListItem title="归属人:" :content="otherInfo?.userNameVesting"/>
  67. <HcListItem title="备注信息:" content="备注数据"/>
  68. </div>
  69. <!-- 出差审批 -->
  70. <div class="hc-info-list" v-if="dataType==='出差审批'">
  71. <tripInfo :other-info="otherInfo"/>
  72. </div>
  73. <!-- 支付申请 -->
  74. <div class="hc-info-list" v-if="dataType==='支付审批'">
  75. <paymentRequest :other-info="otherInfo"/>
  76. </div>
  77. <!-- 借款申请 -->
  78. <div class="hc-info-list" v-if="dataType==='借款审批'">
  79. <loanRequest :other-info="otherInfo"/>
  80. </div>
  81. <!-- 采购申请 -->
  82. <div class="hc-info-list" v-if="dataType==='采购审批'">
  83. <purchaseRequest :other-info="otherInfo"/>
  84. </div>
  85. <!-- 用车申请 -->
  86. <div class="hc-info-list" v-if="dataType==='用车审批'">
  87. <vehicleRequest :other-info="otherInfo"/>
  88. </div>
  89. <!-- 开票申请 -->
  90. <div class="hc-info-list" v-if="dataType==='发票审批'">
  91. <invoiceRequest :other-info="otherInfo"/>
  92. </div>
  93. <!-- 外包支付 -->
  94. <div class="hc-info-list" v-if="dataType==='外包支付'">
  95. <outsourcing :other-info="otherInfo"/>
  96. </div>
  97. <!-- 成本测算 -->
  98. <div class="hc-info-list" v-if="dataType==='成本测算'">
  99. <costBudget :other-info="otherInfo"/>
  100. </div>
  101. </HcCardItem>
  102. <HcCardItem title="操作任务" class="mt-4" v-if="dataType !== '1' && authType">
  103. <HcListItem ui="items-center" title="支付状态:">
  104. <el-radio-group v-model="taskBasicsInfo.payStatus" size="large">
  105. <el-radio label="1">已支付</el-radio>
  106. <el-radio label="0" class="ml-4">待支付</el-radio>
  107. </el-radio-group>
  108. </HcListItem>
  109. </HcCardItem>
  110. <template #action>
  111. <el-button size="large" type="info" hc-btn @click="goBackClick">
  112. <HcIcon name="arrow-go-back"/>
  113. <span v-if="tabsKey === 'to-do'">取消并返回</span>
  114. <span v-else>返回</span>
  115. </el-button>
  116. <el-button size="large" type="danger" hc-btn @click="groundsShow" v-if="tabsKey === '1'">
  117. <HcIcon name="arrow-go-forward"/>
  118. <span>驳回申请</span>
  119. </el-button>
  120. <el-button size="large" type="primary" hc-btn @click="doubleClick" v-if="tabsKey === '1'">
  121. <HcIcon name="check-double"/>
  122. <span>审核通过</span>
  123. </el-button>
  124. <!--模拟效果-->
  125. <!-- <div class="w-36 mx-6 inline-block">
  126. <el-select v-model="dataType" block placeholder="选择模拟类型" size="large">
  127. <el-option label="任务详情" value="任务审批"/>
  128. <el-option label="财务报销" value="报销审批"/>
  129. <el-option label="采购审批" value="采购审批"/>
  130. <el-option label="外包支付" value="外包支付"/>
  131. <el-option label="借款审批" value="借款审批"/>
  132. <el-option label="出差审批" value="出差审批"/>
  133. <el-option label="支付申请" value="支付审批"/>
  134. <el-option label="用车审批" value="用车审批"/>
  135. <el-option label="发票审批" value="发票审批"/>
  136. <el-option label="成本测算" value="成本测算"/>
  137. </el-select>
  138. </div> -->
  139. <!-- <el-button hc-btn @click="authTypeClick">模拟财务审核</el-button> -->
  140. </template>
  141. <HcDialog bgColor="#ffffff" isToBody :loading="groundsLoading" :show="groundsModal" title="请填写驳回理由" widths="600px" @close="closeGroundsClick" @save="saveGroundsClick">
  142. <el-form ref="formGroundsRef" :model="formGroundsModel" :rules="formGroundsRules" label-width="0" size="large">
  143. <el-form-item prop="rejectDesc">
  144. <el-input v-model="formGroundsModel.rejectDesc" :autosize="{ minRows: 6, maxRows: 10 }" placeholder="请输入驳回理由" type="textarea"/>
  145. </el-form-item>
  146. </el-form>
  147. </HcDialog>
  148. </HcCard>
  149. </template>
  150. <script setup>
  151. import {onActivated, ref} from "vue";
  152. import {useRouter, useRoute} from 'vue-router'
  153. import taskApi from '~api/home/task.js';
  154. import {getArrValue,getObjValue,formValidate} from "js-fast-way"
  155. import tripInfo from './components/trip-info.vue'//出差申请
  156. import paymentRequest from './components/pay-request.vue'
  157. import loanRequest from './components/loan-request.vue'
  158. import purchaseRequest from './components/purch-request.vue'//采购
  159. import vehicleRequest from './components/vehicle-request.vue'
  160. import invoiceRequest from './components/invoice-request.vue'
  161. import outsourcing from './components/outsourcing.vue'
  162. import costBudget from './components/cost-budget.vue'
  163. import {useAppStore} from "~src/store";
  164. import { getdepartmentList,getuserList} from "~api/other";
  165. const useAppState = useAppStore();
  166. //初始变量
  167. const router = useRouter()
  168. const useRoutes = useRoute()
  169. const tabsKey = ref(useRoutes?.query?.tabsKey ?? '')
  170. const dataType = ref(useRoutes?.query?.type ?? '')
  171. const dataId = ref(useRoutes?.query?.id ?? '')
  172. const authType = ref(false)//是否是财务人员
  173. //缓存页面被激活时
  174. onActivated(() => {
  175. tabsKey.value = useRoutes?.query?.tabsKey ?? ''
  176. console.log( tabsKey.value,' tabsKey.value');
  177. dataType.value = useRoutes?.query?.type ?? ''
  178. dataId.value = useRoutes?.query?.id ?? ''
  179. getUserDict()
  180. getTaskDatail()
  181. })
  182. //获取所有员工
  183. const userList=ref([])
  184. const getUserDict=async()=>{
  185. const {error, code, data} = await getuserList({tenantId:useAppState.tenantId})
  186. if (!error && code === 200) {
  187. userList.value = getArrValue(data)
  188. } else {
  189. userList.value = []
  190. }
  191. }
  192. const authTypeClick = () => {
  193. authType.value = !authType.value
  194. }
  195. const taskDetail=ref({})
  196. const taskBasicsInfo=ref({})//基础信息
  197. const otherInfo=ref({})
  198. const getTaskDatail=async()=>{
  199. const {error, code, data} = await taskApi.getDetail({id: dataId.value})
  200. if (!error && code === 200) {
  201. taskDetail.value=getObjValue(data)
  202. tableData.value=data['planTaskInfoList']
  203. taskBasicsInfo.value=data['basicsInfo']
  204. otherInfo.value=data['otherInfo']
  205. let isFinancialPersonnel=data['basicsInfo'].isFinancialPersonnel
  206. if(isFinancialPersonnel==1){//1 是财务审核
  207. authType.value=true
  208. }else{
  209. authType.value=false
  210. }
  211. } else {
  212. taskDetail.value={}
  213. }
  214. }
  215. //部门
  216. const departMent = ref([])
  217. //任务表格
  218. const tableColumn = [
  219. {key: 'projectName', name: '所属项目'},
  220. {key: 'taskDesc', name: '任务描述'}
  221. ]
  222. const tableData = ref([])
  223. //任务操作数据
  224. const formRef = ref(null)
  225. const formModel = ref({
  226. type: '1',
  227. })
  228. const formRules = {
  229. title: {
  230. required: true,
  231. trigger: 'blur',
  232. message: "请输入节点名称"
  233. },
  234. }
  235. const formPay = ref('1')
  236. const groundsShow = () => {
  237. groundsLoading.value = false
  238. groundsModal.value = true
  239. }
  240. //驳回弹窗
  241. const groundsLoading = ref(false)
  242. const groundsModal = ref(false)
  243. //驳回表单
  244. const formGroundsRef = ref(null)
  245. const formGroundsModel = ref({rejectDesc: ''})
  246. const formGroundsRules = {
  247. rejectDesc: {
  248. required: true,
  249. trigger: 'blur',
  250. message: "请输入驳回理由"
  251. },
  252. }
  253. //确认驳回
  254. const saveGroundsClick = async() => {
  255. const res = await formValidate(formGroundsRef.value)
  256. if(res){
  257. const {error, code, data} = await taskApi.rejectTask(
  258. {
  259. id: taskDetail.value.basicsInfo.taskId,
  260. rejectDesc:formGroundsModel.value?.rejectDesc
  261. }
  262. )
  263. if (!error && code === 200) {
  264. window?.$message.warning('驳回成功!')
  265. }
  266. closeGroundsClick()
  267. }
  268. }
  269. //取消驳回
  270. const closeGroundsClick = async() => {
  271. groundsModal.value = false
  272. groundsLoading.value = false
  273. console.log(formGroundsModel.value,'formGroundsModel');
  274. console.log(taskDetail.value,'renwu');
  275. }
  276. //审核通过
  277. const doubleClick = async() => {
  278. console.log(formGroundsModel.value,'formGroundsModel');
  279. console.log(taskDetail.value,'renwu');
  280. const {error, code, data} = await taskApi.submitTask(
  281. {
  282. id: taskDetail.value.basicsInfo.taskId,
  283. payStatus:taskBasicsInfo.value?.payStatus
  284. }
  285. )
  286. if (!error && code === 200) {
  287. window?.$message.success('审核通过!')
  288. }
  289. }
  290. //返回
  291. const goBackClick = () => {
  292. router.back()
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. .hac-task-name-box {
  297. position: relative;
  298. display: flex;
  299. align-items: center;
  300. border: 1px solid #c5d7ff;
  301. border-radius: 3px;
  302. .label {
  303. position: relative;
  304. padding: 12px;
  305. background: #cddcff;
  306. }
  307. .name {
  308. position: relative;
  309. padding: 12px;
  310. border-left: 1px solid #c5d7ff;
  311. }
  312. }
  313. .hac-task-text-box {
  314. position: relative;
  315. font-size: 14px;
  316. margin-top: 14px;
  317. }
  318. </style>