1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096 |
- <template>
- <div class="processApproval" ref="processApprovalDom">
- <div class="left-card">
- <div class="top">
- <div class="commons-title title">
- {{ getFlowName() }}
- </div>
- <div class="line"></div>
- <!-- 报价单 -->
- <template v-if="flowForm.flowKey == 'sale_quotation_flow'">
- <PriceSheetEHSD ref="makeDom" :queryData="queryData.data"></PriceSheetEHSD>
- </template>
- <!-- 样品单 -->
- <template v-else-if="flowForm.flowKey == 'sample_flow'">
- <SampleEHSD ref="makeDom" :queryData="queryData.data"></SampleEHSD>
- </template>
- <!-- 样品单变更 -->
- <template v-else-if="flowForm.flowKey == 'sample_update_flow'">
- <SampleChangeEHSD ref="makeDom" :queryData="queryData.data"></SampleChangeEHSD>
- </template>
- <!-- 销售合同 -->
- <template v-else-if="flowForm.flowKey == 'contract_flow'">
- <ContractEHSD ref="makeDom" :queryData="queryData.data" @auxiliaryChange="(e) => getAuxiliaryData(e)"></ContractEHSD>
- </template>
- <!-- 售后 -->
- <AfterSales ref="makeDom" :queryData="queryData.data" v-else-if="flowForm.flowKey == 'after_sales_flow'">
- </AfterSales>
- <!-- 销售合同变更 -->
- <template v-else-if="flowForm.flowKey == 'contract_update_flow'">
- <ContractChangeEHSD ref="makeDom" :queryData="queryData.data" @auxiliaryChange="(e) => getAuxiliaryData(e)"></ContractChangeEHSD>
- </template>
- <!-- 申购 -->
- <SendSubscribe ref="makeDom" @auxiliaryChange="(e) => getAuxiliaryData(e)" v-else-if="flowForm.flowKey == 'subscribe_flow'"
- :queryData="queryData.data"></SendSubscribe>
- <!-- 样品单采购、交接单采购 -->
- <template v-else-if="flowForm.flowKey == 'ehsd_purchase_flow'">
- <PurchaseEHSD ref="makeDom" :queryData="queryData.data" v-if="flowForm.submitType === '10'" @auxiliaryChange="(e) => getAuxiliaryData(e)">
- </PurchaseEHSD>
- <!-- <SendPurchase
- ref="makeDom"
- :queryData="queryData.data"
- v-else
- @auxiliaryChange="(e) => getAuxiliaryData(e)"
- ></SendPurchase> -->
- </template>
- <template v-else-if="flowForm.flowKey == 'purchase_flow'">
- <SendPurchase ref="makeDom" :queryData="queryData.data" @auxiliaryChange="(e) => getAuxiliaryData(e)"></SendPurchase>
- </template>
- <PurchaseChangeEHSD ref="makeDom" :queryData="queryData.data" v-else-if="flowForm.flowKey == 'ehsd_purchase_update_flow'"
- @auxiliaryChange="(e) => getAuxiliaryData(e)"></PurchaseChangeEHSD>
- <!-- 采购付款 -->
- <PurchasePayment ref="makeDom" @auxiliaryChange="(e) => getAuxiliaryData(e)" v-else-if="flowForm.flowKey == 'pay_flow'"
- :queryData="queryData.data"></PurchasePayment>
- <!-- 请款 -->
- <SendFunds ref="makeDom" v-else-if="flowForm.flowKey == 'account_request_funds_flow'" :queryData="queryData.data"></SendFunds>
- <!-- 取消到账认领 -->
- <CancelClaim ref="makeDom" v-else-if="flowForm.flowKey == 'claim_del_flow'" :queryData="queryData.data"></CancelClaim>
- </div>
- <!-- <div class="bottom" v-if="isShowSubmitDom">
- <div class="commons-title title">处理意见</div>
- <el-form :model="flowForm" :rules="flowRules" ref="flowFormDom">
- <el-form-item prop="remark" label-width="0px" label="">
- <el-input
- type="textarea"
- placeholder="请输入"
- v-model="flowForm.remark"
- >
- </el-input>
- </el-form-item>
- <el-form-item prop="remark" label-width="80px" label="附件上传">
- <el-upload
- v-model:fileList="flowForm.fileList"
- :action="uploadUrl"
- :data="uploadData"
- multiple
- :before-upload="uploadFile"
- :on-success="handleSuccess"
- :on-preview="onPreviewFile"
- >
- <el-button>选择</el-button>
- </el-upload>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- v-if="approvalRecordData.buttonInfoList.length == 0"
- @click="handleSubmit"
- :loading="btnLoading"
- >提交</el-button
- >
- <el-button
- type="primary"
- v-else
- v-for="i in approvalRecordData.buttonInfoList"
- :key="i.type"
- :loading="btnLoading"
- @click="handleSubmit(i.type)"
- >{{ i.name }}</el-button
- >
- </el-form-item>
- </el-form>
- </div> -->
- </div>
- <div class="right-card">
- <el-tabs v-model="activeName" class="demo-tabs">
- <el-tab-pane label="处理意见" name="first" v-if="isShowSubmitDom">
- <div style="overflow: auto; height: calc(100vh - 200px)">
- <div style="padding-bottom:50px" v-if="showChart">
- <div style="margin-bottom:10px;">
- <TitleInfo :content="'利润走势图'"></TitleInfo>
- </div>
- <div ref="chartDom" style="height:150px"></div>
- </div>
- <div style="margin-bottom:10px">
- <TitleInfo :content="'办理'"></TitleInfo>
- </div>
- <el-form :model="flowForm" :rules="flowRules" ref="flowFormDom">
- <el-form-item prop="remark" label-width="0px" label="">
- <el-input type="textarea" placeholder="请输入" :rows="3" v-model="flowForm.remark">
- </el-input>
- </el-form-item>
- <el-form-item prop="remark" label-width="80px" label="附件上传">
- <div style="width:100%">
- <el-upload v-model:fileList="flowForm.fileList" :action="uploadUrl" :data="uploadData" multiple :before-upload="uploadFile"
- :on-success="handleSuccess" :on-preview="onPreviewFile">
- <el-button>选择</el-button>
- </el-upload>
- </div>
- </el-form-item>
- <el-form-item>
- <div v-if="approvalRecordData.buttonInfoList.length == 0">
- <el-button type="primary" @click="handleSubmit" :loading="btnLoading">提交</el-button>
- <el-button type="primary" v-if="StagFlowKey.includes(flowForm.flowKey)" @click="handleSubmitStag"
- :loading="btnLoading">暂存</el-button>
- </div>
- <el-button type="primary" v-else v-for="i in approvalRecordData.buttonInfoList" :key="i.type" :loading="btnLoading"
- @click="handleSubmit(i.type)" style="margin-bottom:10px">{{ i.name }}</el-button>
- </el-form-item>
- </el-form>
- </div>
- </el-tab-pane>
- <el-tab-pane label="审批记录" name="second">
- <ul class="flow-chart" ref="flowChartDom">
- <li v-for="item in recordList" :key="item.id" :class="
- !route.query.id
- ? ''
- : item.status == 2
- ? 'flow-orange'
- : item.status == 3 && !route.query.id
- ? 'flow-orange'
- : item.status == 3 && route.query.id
- ? 'flow-grey'
- : ''
- ">
- <div class="left-icon">
- <i class="iconfont icon-iconm_daick"></i>
- <i class="iconfont icon-icomx_quertj1 right-btm-status"></i>
- </div>
- <div class="right-conetnt">
- <div class="name">{{ item.nodeName }}</div>
- <div class="remark">
- <div class="label">
- <span v-if="item.status != 3">办理人:</span>{{ item.processedUser
- }}<span class="time">{{ item.processedDate }}</span>
- </div>
- {{ item.remark }}
- <div v-for="j in fileObj[item.flowExampleDetailId]" v-if="fileObj[item.flowExampleDetailId]">
- <a @click="proxy.download(j.fileUrl, j.fileName)" style="color: #409eff; line-height: 30px">{{ j.fileName }}</a>
- </div>
- </div>
- </div>
- <div class="line"></div>
- </li>
- </ul>
- </el-tab-pane>
- <!-- <el-tab-pane label="决策辅助" name="three" v-if="auxiliaryData.length > 0">
- <div style="overflow: auto; height: calc(100vh - 200px)">
- <auxiliary :data="auxiliaryData"></auxiliary>
- </div>
- </el-tab-pane> -->
- </el-tabs>
- </div>
- <el-dialog title="下一处理人" width="400" v-model="dialogVisible" v-if="dialogVisible" :show-close="false" :close-on-click-modal="false"
- :close-on-press-escape="false">
- <el-form :model="flowForm">
- <el-form-item prop="remark" label="处理人">
- <el-select v-model="flowForm.handleUserId" placeholder="请选择" filterable style="width: 100%">
- <el-option v-for="item in nextHandleUser" :label="item.nickName" :value="item.userId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <div style="width: 100%; text-align: center">
- <el-button type="primary" @click="handleSelectUser">提交</el-button>
- </div>
- </el-form-item>
- </el-form>
- </el-dialog>
- </div>
- </template>
- <script setup name="ProcessApproval">
- import useTagsViewStore from "@/store/modules/tagsView.js";
- import { useRouter, useRoute } from "vue-router";
- // 消息提示
- import { ElMessage, ElMessageBox } from "element-plus";
- //决策辅助
- import auxiliary from "./auxiliary";
- // 报价单-EHSD
- import PriceSheetEHSD from "@/components/process/EHSD/PriceSheet";
- // 销售合同-EHSD
- import ContractEHSD from "@/components/process/EHSD/Contract";
- // 销售合同变更-EHSD
- import ContractChangeEHSD from "@/components/process/EHSD/ContractChange";
- // 样品单-EHSD
- import SampleEHSD from "@/components/process/EHSD/Sample";
- // 样品单变更-EHSD
- import SampleChangeEHSD from "@/components/process/EHSD/SampleChange";
- // 采购交接单-EHSD
- import PurchaseEHSD from "@/components/process/EHSD/Purchase";
- // 采购交接单-EHSD
- import PurchaseChangeEHSD from "@/components/process/EHSD/PurchaseChange";
- // 取消认领-EHSD
- import CancelClaim from "@/components/process/EHSD/CancelClaim";
- // 售后管理-EHSD
- import AfterSales from "@/components/process/EHSD/AfterSales";
- //申购发起
- import SendSubscribe from "@/components/process/SendSubscribe";
- //采购发起
- import SendPurchase from "@/components/process/SendPurchase";
- //请款发起
- import SendFunds from "@/components/process/SendFunds";
- // 采购付款
- import PurchasePayment from "@/components/process/PurchasePayment";
- import { computed, nextTick, ref, watch } from "vue";
- import useUserStore from "@/store/modules/user";
- const userInfo = useUserStore();
- import $bus from "@/bus/index.js";
- import * as echarts from "echarts";
- import TitleInfo from "@/components/TitleInfo/index.vue";
- const router = useRouter();
- const route = useRoute();
- // 传参
- const props = defineProps({
- query: Object,
- });
- // tab切换逻辑
- const activeName = ref("first");
- let auxiliaryData = ref([]);
- const getAuxiliaryData = (data) => {
- auxiliaryData.value = data;
- };
- const btnLoading = ref(false);
- // 意见表单
- const flowForm = reactive({
- flowKey: "",
- tenantType: "",
- handleUserId: "",
- remark: "",
- data: {},
- fileList: [],
- });
- const uploadData = ref({});
- const flowRules = reactive({
- // remark: [{ required: true, message: "请输入处理意见", trigger: "blur" }],
- });
- //组件实例
- const { proxy } = getCurrentInstance();
- const makeDom = ref(null);
- const flowFormDom = ref(null);
- let dialogVisible = ref(false);
- const nextHandleUser = ref([]);
- const handleType = ref(null);
- const handleSelectUser = () => {
- if (!flowForm.handleUserId) {
- return ElMessage({
- message: "请选择下一节点处理人!",
- type: "info",
- });
- }
- handleSubmit(handleType.value);
- };
- const handleResult = (res) => {
- if (res.userList == null && res.success) {
- skipPage();
- } else if (res.userList && res.userList.length > 0) {
- dialogVisible.value = true;
- nextHandleUser.value = res.userList;
- } else {
- return ElMessage({
- message: "请联系管理员!",
- type: "info",
- });
- }
- };
- const uploadFile = async (file) => {
- const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
- uploadData.value = res.uploadBody;
- file.id = res.id;
- file.fileName = res.fileName;
- file.fileUrl = res.fileUrl;
- file.uploadState = true;
- return true;
- };
- const handleSuccess = (any, UploadFile) => {
- UploadFile.raw.uploadState = false;
- };
- const onPreviewFile = (file) => {
- window.open(file.raw.fileUrl, "_blank");
- };
- const StagFlowKey = ref(["after_sales_flow"]);
- // 暂存
- const handleSubmitStag = async (_type) => {
- try {
- // 调用发起组件的提交事件
- const flag = await makeDom.value.handleSubmit(true);
- if (flag) {
- flowFormDom.value.validate((valid) => {
- btnLoading.value = true;
- if (valid) {
- const data = { ...makeDom.value.getFormData() };
- flowForm.fileList = flowForm.fileList.map((item) => {
- return {
- ...item,
- ...item.raw,
- };
- });
- if (flowForm.flowKey == "after_sales_flow") {
- proxy.post("/afterSales/add", data).then(
- (res) => {
- skipPage();
- },
- (err) => {
- btnLoading.value = false;
- }
- );
- }
- }
- });
- }
- } catch (err) {
- console.log("数据未填完整!", err);
- }
- };
- // 提交逻辑
- const handleSubmit = async (_type) => {
- handleType.value = _type ? _type : undefined;
- try {
- // 调用发起组件的提交事件
- const flag = await makeDom.value.handleSubmit();
- if (flag) {
- flowFormDom.value.validate((valid) => {
- btnLoading.value = true;
- if (valid) {
- const data = { ...makeDom.value.getFormData() };
- if (flowForm.flowKey == "subscribe_flow") {
- } else if (flowForm.flowKey == "account_request_funds_flow") {
- } else if (flowForm.flowKey == "sale_quotation_flow") {
- if (flowForm.tenantType === "EHSD") {
- data.ehsdJson = JSON.stringify({
- deliveryTime: data.deliveryTime,
- });
- data.quotationProductList = data.quotationProductList.map(
- (item) => {
- let ehsdJson = JSON.stringify({
- packMethod: item.packMethod,
- tradeMethods: item.tradeMethods,
- });
- return {
- ...item,
- ehsdJson: ehsdJson,
- };
- }
- );
- }
- } else if (flowForm.flowKey == "contract_flow") {
- // data.dataJson = JSON.stringify(proxy.deepClone(data));
- if (data.fileList && data.fileList.length > 0) {
- data.fileList = data.fileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.fileList = [];
- }
- if (data.packageFileList && data.packageFileList.length > 0) {
- data.packageFileList = data.packageFileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.packageFileList = [];
- }
- data.ehsdJson = JSON.stringify({
- deliveryTime: data.deliveryTime,
- });
- data.contractProductList = data.contractProductList.map((item) => {
- let ehsdJson = JSON.stringify({
- packMethod: item.packMethod,
- tradeMethods: item.tradeMethods,
- });
- return {
- ...item,
- ehsdJson: ehsdJson,
- };
- });
- } else if (flowForm.flowKey == "contract_update_flow") {
- // data.dataJson = JSON.stringify(proxy.deepClone(data));
- if (data.fileList && data.fileList.length > 0) {
- data.fileList = data.fileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.fileList = [];
- }
- if (data.packageFileList && data.packageFileList.length > 0) {
- data.packageFileList = data.packageFileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.packageFileList = [];
- }
- data.ehsdJson = JSON.stringify({
- deliveryTime: data.deliveryTime,
- });
- data.contractProductList = data.contractProductList.map((item) => {
- let ehsdJson = JSON.stringify({
- packMethod: item.packMethod,
- tradeMethods: item.tradeMethods,
- });
- return {
- ...item,
- ehsdJson: ehsdJson,
- };
- });
- } else if (flowForm.flowKey == "sample_flow") {
- // data.dataJson = JSON.stringify(proxy.deepClone(data));
- if (data.fileList && data.fileList.length > 0) {
- data.fileList = data.fileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.fileList = [];
- }
- if (data.packageFileList && data.packageFileList.length > 0) {
- data.packageFileList = data.packageFileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.packageFileList = [];
- }
- data.ehsdJson = JSON.stringify({
- deliveryTime: data.deliveryTime,
- });
- data.sampleProductList = data.sampleProductList.map((item) => {
- let ehsdJson = JSON.stringify({
- packMethod: item.packMethod,
- tradeMethods: item.tradeMethods,
- });
- return {
- ...item,
- ehsdJson: ehsdJson,
- };
- });
- } else if (flowForm.flowKey == "sample_update_flow") {
- // data.dataJson = JSON.stringify(proxy.deepClone(data));
- if (data.fileList && data.fileList.length > 0) {
- data.fileList = data.fileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.fileList = [];
- }
- if (data.packageFileList && data.packageFileList.length > 0) {
- data.packageFileList = data.packageFileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- };
- });
- } else {
- data.packageFileList = [];
- }
- data.ehsdJson = JSON.stringify({
- deliveryTime: data.deliveryTime,
- });
- data.sampleProductList = data.sampleProductList.map((item) => {
- let ehsdJson = JSON.stringify({
- packMethod: item.packMethod,
- tradeMethods: item.tradeMethods,
- });
- return {
- ...item,
- ehsdJson: ehsdJson,
- };
- });
- }
- flowForm.fileList = flowForm.fileList.map((item) => {
- return {
- ...item,
- ...item.raw,
- };
- });
- if (route.query.processType == 10 || route.query.processType == 30) {
- // if (_type && _type == 1) {
- // proxy
- // .post("/flowExample/setStartData", {
- // exampleId: route.query.id,
- // startData: data,
- // })
- // .then();
- // }
- proxy
- .post("/flowProcess/jump", {
- ...flowForm,
- data,
- handleType: _type,
- version: route.query.version,
- flowId: route.query.id,
- skipSetData: true,
- })
- .then(
- (res) => {
- handleResult(res);
- },
- (err) => {
- btnLoading.value = false;
- }
- );
- return;
- } else {
- proxy
- .post("/flowProcess/initiate", {
- ...flowForm,
- data,
- skipSetData: true,
- })
- .then(
- (res) => {
- handleResult(res);
- },
- (err) => {
- btnLoading.value = false;
- }
- );
- }
- }
- });
- }
- } catch (err) {
- console.log("数据未填完整!", err);
- setTimeout(() => {
- const errorDiv = document.getElementsByClassName("is-error");
- errorDiv[0].scrollIntoView({
- behavior: "smooth",
- block: "center",
- inline: "nearest",
- });
- }, 0);
- }
- };
- // 页面跳转
- const skipPage = () => {
- const useTagsStore = useTagsViewStore();
- useTagsStore.delVisitedView(router.currentRoute.value);
- if (route.query.processType) {
- router.replace({
- path: "/oa/1/backlog",
- });
- } else {
- ElMessage({
- message: "操作成功!",
- type: "success",
- });
- if (flowForm.flowKey == "subscribe_flow") {
- router.replace({
- path: "/ehsd/procurement/subscribe",
- });
- } else if (flowForm.flowKey == "purchase_flow") {
- router.replace({
- name: "Purchase",
- });
- } else if (flowForm.flowKey == "account_request_funds_flow") {
- router.replace({
- path: "/ehsd/fundManage/funds",
- });
- } else if (flowForm.flowKey == "pay_flow") {
- router.replace({
- path: "/ehsd/purchasePayment/payment",
- });
- } else if (flowForm.flowKey == "sale_quotation_flow") {
- if (flowForm.tenantType === "EHSD") {
- router.replace({
- path: "/ehsd/saleContract/quotation",
- });
- }
- } else if (
- flowForm.flowKey == "contract_flow" ||
- flowForm.flowKey == "contract_update_flow"
- ) {
- router.replace({
- path: "/ehsd/saleContract/contract",
- });
- } else if (
- flowForm.flowKey == "sample_flow" ||
- flowForm.flowKey == "sample_update_flow"
- ) {
- router.replace({
- path: "/ehsd/saleContract/sample",
- });
- } else if (
- flowForm.flowKey == "ehsd_purchase_flow" ||
- flowForm.flowKey == "ehsd_purchase_update_flow"
- ) {
- router.replace({
- path: "/ehsd/procurement/purchased",
- });
- } else if (flowForm.flowKey == "claim_del_flow") {
- router.replace({
- name: "Claim",
- });
- } else if (flowForm.flowKey == "after_sales_flow") {
- router.replace({
- name: "C_afterSales",
- });
- }
- }
- $bus.emit("refreshTableData");
- };
- let queryData = reactive({
- data: {},
- });
- // 记录
- const recordList = ref([]);
- const fileIds = ref([]);
- const fileObj = ref({});
- const approvalRecordData = ref({
- buttonInfoList: [],
- });
- const getRecords = (_id) => {
- if (_id) {
- proxy
- .post("/flowExample/getApprovalRecord", {
- id: _id,
- })
- .then((res) => {
- recordList.value = res.recordList;
- queryData.data.recordList = res.recordList;
- approvalRecordData.value = res;
- fileIds.value = res.recordList.map((item) => {
- return item.flowExampleDetailId;
- });
- proxy
- .post("fileInfo/getList", { businessIdList: fileIds.value })
- .then((res2) => {
- console.log(res2);
- fileObj.value = res2;
- });
- console.log(fileObj.value);
- });
- } else {
- proxy
- .post("/flowExample/getFlowNode", {
- flowKey: flowForm.flowKey,
- })
- .then((res) => {
- recordList.value = res;
- });
- }
- };
- const isShowSubmitDom = ref(true);
- const chartDom = ref(null);
- const chartData = ref([]);
- let myChart = null;
- const optionTwo = reactive({
- data: {
- tooltip: {
- trigger: "axis",
- },
- // legend: {
- // data: ["价格"],
- // },
- grid: {
- left: "3%",
- right: "6%",
- top: "10%",
- bottom: "3%",
- containLabel: true,
- },
- tooltip: {
- show: true,
- trigger: "axis",
- // 格式化函数
- // valueFormatter: (val) => {
- // return val + "aaa";
- // },
- formatter: (params, ticket, callback) => {
- return `
- ${params[0].axisValue}
- <br/>
- ${params[0].seriesName}:${params[0].data}
- <br/> 毛利率:${chartData.value[params[0].dataIndex].grossRate}%
- <br/> 对比上一版本利润:CNY ${
- chartData.value[params[0].dataIndex].compareLastGross
- }
- <br/> 销售合同金额:${
- chartData.value[params[0].dataIndex].contractCurrency
- } ${chartData.value[params[0].dataIndex].contractAmount}
- <br/> 采购合同金额:CNY ${
- chartData.value[params[0].dataIndex].purchaseAmount
- }`;
- },
- textStyle: {
- fontSize: 12,
- },
- },
- // toolbox: {
- // feature: {
- // saveAsImage: {},
- // },
- // },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: [],
- },
- yAxis: {
- type: "value",
- },
- series: [
- {
- name: "毛利",
- type: "line",
- data: [],
- },
- ],
- },
- });
- const showChart = ref(false);
- onMounted(async () => {
- if (
- (userInfo.roles.includes("ceo") ||
- userInfo.roles.includes("salesDirector") ||
- userInfo.roles.includes("financeOfficer") ||
- userInfo.roles.includes("approve_ accountant")) &&
- (route.query.processType == 10 || route.query.processType == 30) &&
- [
- "contract_flow",
- "contract_update_flow",
- "sample_flow",
- "sample_update_flow",
- "ehsd_purchase_flow",
- "ehsd_purchase_update_flow",
- ].includes(route.query.flowKey)
- ) {
- showChart.value = true;
- }
- // 路由进入
- if (route.query && route.query.flowKey) {
- //processType 10 为修改 20为查看 30回退发起
- if (route.query.processType == 20) {
- activeName.value = "second";
- isShowSubmitDom.value = false;
- }
- 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;
- flowForm.tenantType = route.query.tenantType;
- flowForm.submitType = route.query.submitType;
- getRecords(route.query.id);
- }
- $bus.on("getGrossData", (data) => {
- nextTick(() => {
- if (data && data.length > 1 && showChart.value) {
- myChart = echarts.init(chartDom.value);
- window.addEventListener("resize", () => {
- myChart.resize();
- });
- chartData.value = data;
- // chartData.value = data.slice(1, data.length);
- optionTwo.data.xAxis.data = chartData.value.map((item) => {
- return item.createTime.slice(0, 10);
- });
- optionTwo.data.series[0].data = chartData.value.map((item) => {
- return item.gross;
- });
- myChart.setOption(optionTwo.data);
- myChart.resize();
- } else {
- return;
- }
- });
- });
- });
- onBeforeUnmount(() => {
- // 取消订阅特定事件
- $bus.off("getGrossData");
- });
- watch(
- () => props.query,
- () => {
- if (props.query) {
- if (props.query.processType == 20) {
- isShowSubmitDom.value = false;
- activeName.value = "second";
- }
- if (
- props.query.processType == 10 ||
- props.query.processType == 20 ||
- props.query.processType == 30
- ) {
- // await proxy
- // .post("/flowProcess/getStartData", { flowId: props.query.id })
- // .then((res) => {
- // queryData.data = { ...res };
- // });
- queryData.data = { ...props.query };
- } else {
- queryData.data = { ...props.query };
- }
- flowForm.flowKey = props.query.flowKey;
- flowForm.tenantType = props.query.tenantType;
- flowForm.submitType = props.query.submitType;
- getRecords(props.query.id);
- }
- },
- {
- deep: true,
- immediate: true,
- }
- );
- const getFlowName = () => {
- let name = "流程(审批)";
- if (route.query && route.query.flowName) {
- name = route.query.flowName;
- } else if (props.query && props.query.flowName) {
- name = props.query.flowName;
- }
- return name;
- };
- // 动态计算高度
- const processApprovalDom = ref(null);
- const flowChartDom = ref(null);
- const getTableHeight = () => {
- if (route.query.currentContractId) {
- processApprovalDom.value.style.height = window.innerHeight - 180 + "px";
- flowChartDom.value.style.height = window.innerHeight - 250 + "px";
- } else {
- processApprovalDom.value.style.height = window.innerHeight - 130 + "px";
- flowChartDom.value.style.height = window.innerHeight - 200 + "px";
- }
- };
- nextTick(() => {
- getTableHeight();
- });
- window.addEventListener("resize", () => {
- getTableHeight();
- });
- </script>
- <style>
- /* .el-upload-list {
- float: left;
- margin: 0 !important;
- }
- .el-upload-list li {
- width: 200px;
- margin-left: 10px;
- }
- .el-upload--text {
- float: left;
- } */
- </style>
- <style lang="scss" scoped>
- .processApproval {
- display: flex;
- justify-content: space-between;
- margin-top: 20px;
- padding: 0 20px;
- height: calc(100vh - 130px);
- .left-card {
- // background: #fff;
- border-radius: 4px;
- // padding: 20px;
- // flex: 1;
- width: calc(100% - 350px - 10px);
- margin-right: 10px;
- display: flex;
- flex-direction: column;
- .top {
- /* 宽度和高度 */
- flex: 1;
- overflow-y: auto;
- background: #fff;
- padding: 20px 20px 0px 20px;
- .line {
- border-bottom: 1px solid #ddd;
- margin-bottom: 20px;
- }
- }
- .bottom {
- margin-top: 10px;
- height: 220px;
- background: #fff;
- padding: 20px 20px 0px 20px;
- overflow: auto;
- }
- }
- .right-card {
- background: #fff;
- border-radius: 4px;
- // padding: 0 20px 20px;
- padding: 0 20px 5px;
- width: 350px;
- box-sizing: border-box;
- .flow-chart {
- overflow: auto;
- height: calc(100vh - 200px);
- padding: 0;
- margin: 0;
- li {
- margin: 0;
- padding: 0 0 20px;
- list-style: none;
- display: flex;
- justify-content: space-between;
- position: relative;
- .right-conetnt {
- flex: 1;
- .name {
- font-size: 12px;
- color: #39c55a;
- margin-bottom: 10px;
- span {
- color: #999;
- }
- }
- .time {
- float: right;
- }
- .remark {
- padding: 10px;
- color: #666666;
- font-size: 12px;
- background: #f1f1f1;
- border-radius: 2px;
- .label {
- color: #999;
- margin-bottom: 10px;
- }
- }
- }
- .left-icon {
- width: 40px;
- height: 40px;
- text-align: center;
- line-height: 40px;
- background: #0084ff;
- border-radius: 10px;
- color: #fff;
- font-size: 20px;
- position: relative;
- margin-right: 27px;
- z-index: 2;
- .right-btm-status {
- position: absolute;
- bottom: 0px;
- right: -10px;
- height: 20px;
- width: 20px;
- line-height: 16px;
- border-radius: 10px;
- background: #39c55a;
- border: 2px solid #fff;
- font-size: 12px;
- box-sizing: border-box;
- }
- }
- }
- li::before {
- content: "";
- position: absolute;
- top: 0;
- left: 20px;
- width: 2px;
- height: 100%;
- background: #ddd;
- z-index: 1;
- }
- li:last-child::before {
- display: none;
- }
- .flow-orange {
- .right-btm-status {
- background: #ff9a00 !important;
- }
- .name {
- color: #ff9a00 !important;
- }
- .left-icon {
- background: #ff9a00 !important;
- }
- }
- .flow-grey {
- .right-btm-status {
- background: #999 !important;
- }
- .name {
- color: #999 !important;
- }
- .left-icon {
- background: #999 !important;
- }
- }
- .flow-red {
- .right-btm-status {
- background: #ff4d4f !important;
- }
- .name {
- color: #ff4d4f !important;
- }
- .left-icon {
- background: #ff4d4f !important;
- }
- }
- }
- }
- }
- </style>
|