|
@@ -0,0 +1,328 @@
|
|
|
+<template>
|
|
|
+ <div class="process">
|
|
|
+ <van-nav-bar
|
|
|
+ title="流程审批"
|
|
|
+ left-text=""
|
|
|
+ left-arrow
|
|
|
+ @click-left="onClickLeft"
|
|
|
+ >
|
|
|
+ </van-nav-bar>
|
|
|
+ <component ref="makeDom" :is='componentObj[route.query.flowKey].component'></component>
|
|
|
+ <div class="card">
|
|
|
+ <div class="common-title border-btm">申购信息</div>
|
|
|
+ <div class="common-form-text">
|
|
|
+ <div class="common-form-text-item">
|
|
|
+ <div class="common-form-text-item-label">申购单号</div>
|
|
|
+ <div class="common-form-text-item-value">
|
|
|
+ PR-221101-170404-296
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="common-form-text-item">
|
|
|
+ <div class="common-form-text-item-label">申购时间</div>
|
|
|
+ <div class="common-form-text-item-value">
|
|
|
+ 2022-11-01 17:04:04
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="common-form-text-item">
|
|
|
+ <div class="common-form-text-item-label">申购部门</div>
|
|
|
+ <div class="common-form-text-item-value">仓库</div>
|
|
|
+ </div>
|
|
|
+ <div class="common-form-text-item">
|
|
|
+ <div class="common-form-text-item-label">申购人</div>
|
|
|
+ <div class="common-form-text-item-value">阮平芳</div>
|
|
|
+ </div>
|
|
|
+ <div class="common-form-text-item">
|
|
|
+ <div class="common-form-text-item-label">申购类型</div>
|
|
|
+ <div class="common-form-text-item-value">物料</div>
|
|
|
+ </div>
|
|
|
+ <div class="common-form-text-item textarea">
|
|
|
+ <div class="common-form-text-item-label">申购说明</div>
|
|
|
+ <van-field
|
|
|
+ v-model="message"
|
|
|
+ rows="3"
|
|
|
+ autosize
|
|
|
+ type="textarea"
|
|
|
+ maxlength="400"
|
|
|
+ placeholder="请输入申购说明"
|
|
|
+ show-word-limit
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="card">
|
|
|
+ <div class="common-title">申购明细</div>
|
|
|
+ <div class="common-mobile-table">
|
|
|
+ <table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>物料编码</th>
|
|
|
+ <th>物料名称</th>
|
|
|
+ <th>规格型号</th>
|
|
|
+ <th>规格型号</th>
|
|
|
+ <th>规格型号</th>
|
|
|
+ <th>规格型号</th>
|
|
|
+ <th>规格型号</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td>1000000001</td>
|
|
|
+ <td>电脑</td>
|
|
|
+ <td>台</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>1000000002</td>
|
|
|
+ <td>显示器</td>
|
|
|
+ <td>台</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class="more-btn">查看更多</div>
|
|
|
+ </div>
|
|
|
+ <div class="card">
|
|
|
+ <div class="common-title">审批流程</div>
|
|
|
+ <van-steps
|
|
|
+ direction="vertical"
|
|
|
+ :active="stepsNum"
|
|
|
+ class="common-steps"
|
|
|
+ >
|
|
|
+ <van-step v-for="(i, index) in recordList" :key="i.nodeId">
|
|
|
+ <div class="label">
|
|
|
+ <span class="name">{{ i.processedUser }}</span>
|
|
|
+ <span class="tip">{{ i.nodeName }}</span>
|
|
|
+ <span
|
|
|
+ class="state"
|
|
|
+ :class="
|
|
|
+ index == stepsNum
|
|
|
+ ? 'cl-yl'
|
|
|
+ : index < stepsNum
|
|
|
+ ? 'cl-blue'
|
|
|
+ : ''
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ i.nodeName }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="content">审批意见:{{ i.remark }}</div>
|
|
|
+ <p>{{ i.processedDate }}</p>
|
|
|
+ </van-step>
|
|
|
+ </van-steps>
|
|
|
+ <div class="common-form-text">
|
|
|
+ <div class="common-form-text-item textarea">
|
|
|
+ <van-field
|
|
|
+ v-model="message"
|
|
|
+ rows="3"
|
|
|
+ autosize
|
|
|
+ type="textarea"
|
|
|
+ maxlength="400"
|
|
|
+ placeholder="请输入审批意见"
|
|
|
+ show-word-limit
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="btn-warp">
|
|
|
+ <van-button
|
|
|
+ type="primary"
|
|
|
+ v-if="approvalRecordData.buttonInfoList.length == 0"
|
|
|
+ >同意</van-button
|
|
|
+ >
|
|
|
+ <van-button
|
|
|
+ type="primary"
|
|
|
+ v-else
|
|
|
+ v-for="i in approvalRecordData.buttonInfoList"
|
|
|
+ :key="i.type"
|
|
|
+ >{{ i.name }}</van-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+import { ref, getCurrentInstance, onMounted, reactive } from 'vue'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+import SendSubscribe from './components/SendSubscribe'
|
|
|
+const route = useRoute()
|
|
|
+const proxy = getCurrentInstance().proxy
|
|
|
+const onClickLeft = () => proxy.$router.push('/main/working')
|
|
|
+const message = ref('')
|
|
|
+const onClickRight = () => {
|
|
|
+ proxy.$router.push('/main/working')
|
|
|
+}
|
|
|
+let stepsNum = ref(0)
|
|
|
+let queryData = reactive({
|
|
|
+ data: {},
|
|
|
+})
|
|
|
+const flowForm = reactive({
|
|
|
+ flowKey: '',
|
|
|
+ tenantType: '',
|
|
|
+ handleUserId: '',
|
|
|
+ remark: '',
|
|
|
+ data: {},
|
|
|
+})
|
|
|
+let recordList = ref([])
|
|
|
+const approvalRecordData = ref({
|
|
|
+ buttonInfoList: [],
|
|
|
+})
|
|
|
+
|
|
|
+const getAuxiliaryData = (data)=>{
|
|
|
+ auxiliaryData.value=data
|
|
|
+}
|
|
|
+
|
|
|
+let componentObj = ref({
|
|
|
+ subscribe_flow: {
|
|
|
+ title: '申购',
|
|
|
+ component: SendSubscribe,
|
|
|
+ backUrl: '/main/subscribe',
|
|
|
+ },
|
|
|
+})
|
|
|
+
|
|
|
+let dialogVisible = ref(false);
|
|
|
+//判断是否有下一节点处理人
|
|
|
+const handleResult = (res) => {
|
|
|
+ if (res !== null && res.success) {
|
|
|
+ skipPage();
|
|
|
+ } else {
|
|
|
+ dialogVisible.value = true;
|
|
|
+ nextHandleUser.value = res.userList;
|
|
|
+ }
|
|
|
+};
|
|
|
+const skipPage = () => {
|
|
|
+ router.replace({
|
|
|
+ path: route.query.processType === 10 ? "/main/processApproval" : componentObj[route.query.flowKey].backUrl,
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleSelectUser = () => {
|
|
|
+ if (!flowForm.handleUserId) {
|
|
|
+ return ElMessage({
|
|
|
+ message: '请选择下一节点处理人!',
|
|
|
+ type: 'info',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ handleSubmit()
|
|
|
+}
|
|
|
+const handleSubmit = async (_type) => {
|
|
|
+ const flag = await makeDom.value.handleSubmit()
|
|
|
+ if (flag) {
|
|
|
+ flowFormDom.value.validate((valid) => {
|
|
|
+ if (
|
|
|
+ route.query.processType == 10 ||
|
|
|
+ route.query.processType == 30
|
|
|
+ ) {
|
|
|
+ proxy
|
|
|
+ .post('/flowProcess/jump', {
|
|
|
+ ...flowForm,
|
|
|
+ data,
|
|
|
+ handleType: _type,
|
|
|
+ version: route.query.version,
|
|
|
+ flowId: route.query.id,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ handleResult(res)
|
|
|
+ })
|
|
|
+ if (_type && _type == 1) {
|
|
|
+ proxy
|
|
|
+ .post('/flowExample/setStartData', {
|
|
|
+ exampleId: route.query.id,
|
|
|
+ startDate: data,
|
|
|
+ })
|
|
|
+ .then()
|
|
|
+ }
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ proxy
|
|
|
+ .post('/flowProcess/initiate', {
|
|
|
+ ...flowForm,
|
|
|
+ data,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ handleResult(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const getRecords = (_id) => {
|
|
|
+ if (_id) {
|
|
|
+ proxy
|
|
|
+ .post('/flowExample/getApprovalRecord', {
|
|
|
+ id: _id,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ for (let i = 0; i < res.data.recordList.length; i++) {
|
|
|
+ const element = res.data.recordList[i]
|
|
|
+ if (element.status === 2) {
|
|
|
+ stepsNum.value = i
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ recordList.value = res.data.recordList
|
|
|
+ queryData.data.recordList = res.data.recordList
|
|
|
+ approvalRecordData.value = res.data
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ proxy
|
|
|
+ .post('/flowExample/getFlowNode', {
|
|
|
+ flowKey: flowForm.flowKey,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ recordList.value = res.data
|
|
|
+ stepsNum.value = 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+onMounted(async () => {
|
|
|
+ //processType 10 为修改 20为查看 30回退发起 无为发起
|
|
|
+ if (
|
|
|
+ route.query.processType == 10 ||
|
|
|
+ route.query.processType == 20 ||
|
|
|
+ route.query.processType == 30
|
|
|
+ ) {
|
|
|
+ await proxy
|
|
|
+ .post('/flowProcess/getStartData', { flowId: route.query.id })
|
|
|
+ .then((res) => {
|
|
|
+ queryData.data = { ...res }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ queryData.data = { ...route.query }
|
|
|
+ }
|
|
|
+ flowForm.flowKey = route.query.flowKey
|
|
|
+ getRecords(route.query.id)
|
|
|
+})
|
|
|
+</script>
|
|
|
+<style lang="scss">
|
|
|
+.process {
|
|
|
+ padding-bottom: 60px;
|
|
|
+ .btn-warp {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ margin: 20px 0 10px;
|
|
|
+ button {
|
|
|
+ width: 48%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .card {
|
|
|
+ background: #fff;
|
|
|
+ padding: 0 12px;
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+ .textarea {
|
|
|
+ .van-field {
|
|
|
+ border: none;
|
|
|
+ background: #f1f1f1;
|
|
|
+ border-radius: 5px;
|
|
|
+ padding: 5px 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .more-btn {
|
|
|
+ height: 60px;
|
|
|
+ line-height: 60px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #0084ff;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|