task-review.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <hc-new-dialog v-model="isShow" is-table widths="96%" title="任务审核" @close="cancelClick">
  3. <template #header="{ titleId, titleClass }">
  4. <div class="hc-card-header flex items-center">
  5. <div :id="titleId" :class="titleClass">任务审核 【已开启电签】</div>
  6. </div>
  7. </template>
  8. <div class="relative h-full">
  9. <div class="hc-task-name relative">【{{ taskInfo.taskName }}】2019-10-17 中间计量申请 【第1期】 审批信息</div>
  10. <div class="hc-task-body relative flex">
  11. <div class="hc-task-time">
  12. <hc-body class="hc-task-body-card" padding="10px" scrollbar>
  13. <el-timeline class="hc-time-line">
  14. <template v-for="(item, index) in flowList" :key="index">
  15. <el-timeline-item :class="item.currentBol ? 'success' : item.current ? 'primary' : ''" size="large">
  16. <div class="timeline-item-icon">
  17. <hc-icon v-if="item.currentBol" class="check-icon" name="check" />
  18. </div>
  19. <div class="reply-name">{{ item.name }}</div>
  20. <div class="reply-time">{{ item.time }}</div>
  21. <div class="reply-content" v-html="item.content" />
  22. </el-timeline-item>
  23. </template>
  24. </el-timeline>
  25. </hc-body>
  26. </div>
  27. <div :id="`hc_task_table_${uuid}`" class="hc-task-table">
  28. <hc-body class="hc-task-body-card" padding="10px">
  29. <hc-table
  30. ref="tableRef" :column="tableColumn" :datas="tableData"
  31. :loading="tableLoading" :is-stripe="false" is-new :index-style="{ width: 60 }" is-current-row
  32. @row-click="tableRowClick"
  33. >
  34. <template #action="{ row }">
  35. <div class="hc-task-table-action" :class="row.isRemark ? 'is-cur' : ''" @click="rowRemarkClick(row)">
  36. <i class="i-iconoir-star-solid" />
  37. </div>
  38. </template>
  39. <template #state="{ row }">
  40. <div class="hc-task-table-state">
  41. <i v-if="row.state === 1" class="i-iconoir-xmark-circle-solid is-danger" />
  42. <i v-else-if="row.state === 2" class="i-iconoir-check-circle-solid is-success" />
  43. <span v-else-if="row.state === 3">审批结束</span>
  44. <i v-else class="i-iconoir-help-circle-solid" />
  45. </div>
  46. </template>
  47. </hc-table>
  48. </hc-body>
  49. </div>
  50. <div :id="`hc_task_form_${uuid}`" class="hc-task-form">
  51. <hc-body class="hc-task-body-card" padding="10px" scrollbar>
  52. <HcTaskForm v-model="tableInfo" :is-edit="tabsKey === 1" :type="rowInfo.type" />
  53. </hc-body>
  54. </div>
  55. </div>
  56. </div>
  57. <template #footer>
  58. <div class="hc-task-dialog-footer">
  59. <el-button :loading="rejectionLoading" @click="rejectionClick">驳回审批</el-button>
  60. <el-button type="primary" :loading="confirmLoading" @click="confirmClick">同意审批</el-button>
  61. </div>
  62. </template>
  63. </hc-new-dialog>
  64. </template>
  65. <script setup>
  66. import { nextTick, ref, watch } from 'vue'
  67. import { getArrValue, getRandom } from 'js-fast-way'
  68. import HcTaskForm from './task-form.vue'
  69. const props = defineProps({
  70. tabs: {
  71. type: [String, Number],
  72. default: '',
  73. },
  74. row: {
  75. type: Object,
  76. default: () => ({}),
  77. },
  78. })
  79. //事件
  80. const emit = defineEmits(['finish', 'close'])
  81. const uuid = getRandom(4)
  82. //双向绑定
  83. // eslint-disable-next-line no-undef
  84. const isShow = defineModel('modelValue', {
  85. default: false,
  86. })
  87. //监听
  88. const tableRef = ref(null)
  89. const tabsKey = ref(props.tabs)
  90. const rowInfo = ref(props.row)
  91. const taskInfo = ref({})
  92. watch(() => [
  93. props.tabs,
  94. props.row,
  95. ], ([key, row]) => {
  96. tabsKey.value = key
  97. rowInfo.value = row
  98. }, {
  99. immediate: true,
  100. deep: true,
  101. })
  102. //监听显示
  103. watch(isShow, (val) => {
  104. if (val) {
  105. setTaskInfo()
  106. setSplitRef()
  107. }
  108. })
  109. //初始化设置拖动分割线
  110. const setSplitRef = () => {
  111. //配置参考: https://split.js.org/#/?direction=vertical&snapOffset=0
  112. nextTick(() => {
  113. window.$split(['#hc_task_table_' + uuid, '#hc_task_form_' + uuid], {
  114. sizes: [50, 50],
  115. snapOffset: 0,
  116. minSize: [50, 500],
  117. })
  118. })
  119. }
  120. //设置任务信息
  121. const setTaskInfo = async () => {
  122. const { taskName, type } = rowInfo.value
  123. taskInfo.value.taskName = taskName
  124. taskInfo.value.type = type
  125. if (type === 1) {
  126. tableColumn.value = middlepayTableColumn.value
  127. } else if (type === 2) {
  128. tableColumn.value = startWorkTableColumn.value
  129. } else if (type === 3) {
  130. tableColumn.value = alterTableColumn.value
  131. } else if (type === 4) {
  132. tableColumn.value = materialTableColumn.value
  133. } else {
  134. tableColumn.value = []
  135. }
  136. getTableData().then()
  137. }
  138. //流程信息
  139. const flowList = ref([
  140. { currentBol: true, current: false, name: '张三', time: '2023-10-17 10:00:21', content: '上报' },
  141. { currentBol: false, current: true, name: '李四', time: '2023-11-01 09:00:21', content: '结束流程</br>同意' },
  142. ])
  143. //中间计量单的表格数据
  144. const middlepayTableColumn = ref([
  145. { key: 'action', name: '批注', width: 45, align: 'center' },
  146. { key: 'key1', name: '计量单编号' },
  147. { key: 'key2', name: '计量金额', width: 100 },
  148. { key: 'key3', name: '工程划分' },
  149. { key: 'state', name: '审批状态', fixed: 'right', width: 70, align: 'center' },
  150. ])
  151. //开工预付款计量单的表格数据
  152. const startWorkTableColumn = ref([
  153. { key: 'action', name: '批注', width: 45, align: 'center' },
  154. { key: 'key1', name: '计量期', minWidth: 100, align: 'center' },
  155. { key: 'key2', name: '业务日期', width: 160, align: 'center' },
  156. { key: 'key3', name: '计量金额', width: 100, align: 'center' },
  157. { key: 'state', name: '审批状态', fixed: 'right', width: 70, align: 'center' },
  158. ])
  159. //变更令的表格数据
  160. const alterTableColumn = ref([
  161. { key: 'action', name: '批注', width: 45, align: 'center' },
  162. { key: 'key1', name: '变更编号', minWidth: 120, align: 'center' },
  163. { key: 'key2', name: '变更名称', minWidth: 120, align: 'center' },
  164. { key: 'key3', name: '变更金额', width: 100, align: 'center' },
  165. { key: 'key4', name: '变更批复日期', width: 160, align: 'center' },
  166. { key: 'state', name: '审批状态', fixed: 'right', width: 70, align: 'center' },
  167. ])
  168. //材料计量单的表格数据
  169. const materialTableColumn = ref([
  170. { key: 'action', name: '批注', width: 45, align: 'center' },
  171. { key: 'key1', name: '计量期', minWidth: 100, align: 'center' },
  172. { key: 'key2', name: '合同材料', minWidth: 120, align: 'center' },
  173. { key: 'key3', name: '材料到场编号', width: 120, align: 'center' },
  174. { key: 'key4', name: '计量金额', width: 100, align: 'center' },
  175. { key: 'state', name: '审批状态', fixed: 'right', width: 70, align: 'center' },
  176. ])
  177. //表格数据
  178. const tableLoading = ref(false)
  179. const tableColumn = ref([])
  180. const tableData = ref([
  181. { isRemark: false, key1: '你猜1', key2: '猜猜1', state: 1 },
  182. { isRemark: false, key1: '你猜2', key2: '猜猜2', state: 1 },
  183. { isRemark: true, key1: '你猜3', key2: '猜猜3', state: 2 },
  184. { isRemark: true, key1: '你猜4', key2: '猜猜4', state: 2 },
  185. ])
  186. const getTableData = async () => {
  187. //tableData.value = []
  188. tableLoading.value = true
  189. /*const { data } = await mainApi.getPage({
  190. ...searchForm.value,
  191. projectId: projectId.value,
  192. contractId: contractId.value,
  193. })
  194. tableData.value = getArrValue(data)*/
  195. tableLoading.value = false
  196. //默认选中第一行
  197. let info = {}
  198. if (tableData.value.length > 0) {
  199. info = tableData.value[0]
  200. }
  201. await nextTick(() => {
  202. tableInfo.value = info
  203. tableRef.value?.tableRef?.setCurrentRow(info)
  204. })
  205. //getTableDetail(info).then()
  206. }
  207. //表格行被点击
  208. const tableInfo = ref({})
  209. const tableRowClick = ({ row }) => {
  210. tableInfo.value = row
  211. }
  212. //批注
  213. const rowRemarkClick = (row) => {
  214. }
  215. //确认审批
  216. const confirmLoading = ref(false)
  217. const confirmClick = () => {
  218. //emit('finish')
  219. }
  220. //驳回审批
  221. const rejectionLoading = ref(false)
  222. const rejectionClick = () => {
  223. }
  224. //取消审批
  225. const cancelClick = () => {
  226. isShow.value = false
  227. taskInfo.value = {}
  228. rowInfo.value = {}
  229. tabsKey.value = ''
  230. tableLoading.value = false
  231. tableColumn.value = []
  232. //tableData.value = []
  233. emit('close')
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. .hc-task-name {
  238. font-weight: bold;
  239. color: #1A1a1a;
  240. padding-bottom: 10px;
  241. border-bottom: 1px solid #f5f5f5;
  242. }
  243. .hc-task-body {
  244. height: calc(100% - 27px);
  245. .hc-task-time {
  246. position: relative;
  247. height: 100%;
  248. flex-shrink: 0;
  249. width: 170px;
  250. }
  251. .hc-task-table, .hc-task-form {
  252. position: relative;
  253. height: 100%;
  254. flex: 1;
  255. flex-basis: auto;
  256. }
  257. .hc-task-table {
  258. border-left: 1px solid #e5e5e5;
  259. }
  260. }
  261. //表格图标
  262. .hc-task-table-action, .hc-task-table-state {
  263. position: relative;
  264. display: flex;
  265. justify-content: center;
  266. align-items: center;
  267. cursor: pointer;
  268. font-size: 20px;
  269. color: #929293;
  270. i {
  271. display: inline-flex;
  272. }
  273. }
  274. //表格批注
  275. .hc-task-table-action.is-cur {
  276. color: #F2B90B;
  277. }
  278. //表格状态
  279. .hc-task-table-state {
  280. .is-success {
  281. color: #25a62d;
  282. }
  283. .is-danger {
  284. color: #F5221D;
  285. }
  286. span {
  287. color: #1A1a1a;
  288. }
  289. }
  290. //弹窗底部
  291. .hc-task-dialog-footer {
  292. position: relative;
  293. text-align: center;
  294. }
  295. </style>
  296. <style lang="scss">
  297. .hc-task-body-card {
  298. background: #f7f7f7;
  299. .el-scrollbar__bar.is-vertical {
  300. right: -8px;
  301. }
  302. }
  303. </style>