123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <sd-webflow
- ref="webflow"
- @afterDispatch="afterDispatch"
- @saveproject="save"
- @sdFormReady="initData"
- @actionBtnClick="actionBtnClick"
- >
- <template v-slot:form="{ model, FlowData }">
- <amount-watcher :model="model" @amoutChange="amoutChange" />
- <amount-host-watcher :model="model" @amoutHostChange="amoutHostChange" />
- <sd-form-by-builder ref="builderform" :form-data="FlowData.processFormData" />
- </template>
- </sd-webflow>
- </template>
- <script>
- import axios from '@/common/services/axios-instance'
- import CaseMixins from '../case-mixins'
- import components from './_import-components/case-execute-zxjz-form-import'
- export default {
- name: 'CaseExecuteZxjzForm',
- metaInfo: {
- title: '执行程序-执行进展详情',
- },
- components: {
- // EXECUTE_AMOUNT 监听
- amountWatcher: {
- props: ['model'],
- created() {
- this.$watch('model.EXECUTE_AMOUNT', (val) => {
- this.$emit('amoutChange', val)
- })
- },
- render: () => {},
- },
- // EXECUTE_AMOUNT_HOST 监听
- amountHostWatcher: {
- props: ['model'],
- created() {
- this.$watch('model.EXECUTE_AMOUNT_HOST', (val) => {
- this.$emit('amoutHostChange', val)
- })
- },
- render: () => {},
- },
- ...components,
- },
- mixins: [CaseMixins],
- data() {
- return {
- ACCUMULATED_EXECUTE_AMOUNT: null,
- }
- },
- created() {
- this.type = 'execute'
- this.$nextTick(() => {
- axios({
- method: 'post',
- url:
- 'api/framework/v1/lawexecuteamounthost/findExecuteAmountByCaseId?caseId=' +
- this.$route.query.id,
- }).then((res) => {
- if (this.$refs.webflow.getFieldValue('EXECUTE_AMOUNT_HOST') !== undefined) {
- return
- }
- // 累计执行金额
- if (res.data.ACCUMULATED_EXECUTE_AMOUNT !== null) {
- this.$refs.webflow.setFieldValue(
- 'ACCUMULATED_EXECUTE_AMOUNT',
- res.data.ACCUMULATED_EXECUTE_AMOUNT
- )
- this.ACCUMULATED_EXECUTE_AMOUNT = res.data.ACCUMULATED_EXECUTE_AMOUNT
- } else {
- this.$refs.webflow.setFieldValue('ACCUMULATED_EXECUTE_AMOUNT', 0)
- this.ACCUMULATED_EXECUTE_AMOUNT = 0
- }
- // 执行余额
- if (res.data.EXECUTE_BALANCE !== null) {
- this.$refs.webflow.setFieldValue('EXECUTE_BALANCE', res.data.EXECUTE_BALANCE)
- } else {
- this.$refs.webflow.setFieldValue('EXECUTE_BALANCE', 0)
- }
- // 总执行金额
- if (res.data.EXECUTE_AMOUNT_HOST !== null) {
- this.$refs.webflow.setFieldValue('EXECUTE_AMOUNT_HOST', res.data.EXECUTE_AMOUNT_HOST)
- this.$refs.webflow.FlowData.processFormData.processFormPropertyValues.find(
- (item) => item.name === 'EXECUTE_AMOUNT_HOST'
- ).readonly = true
- }
- })
- })
- },
- mounted() {
- this.type = 'execute'
- },
- methods: {
- // 执行金额变化时
- amoutChange(val) {
- // 计算累计执行金额
- const amount = (this.ACCUMULATED_EXECUTE_AMOUNT + val).toFixed(2)
- this.$refs.webflow.setFieldValue('ACCUMULATED_EXECUTE_AMOUNT', amount)
- // 计算执行余额
- const allAmount = this.$refs.webflow.getFieldValue('EXECUTE_AMOUNT_HOST')
- const executeAmount = this.$refs.webflow.getFieldValue('ACCUMULATED_EXECUTE_AMOUNT')
- this.$refs.webflow.setFieldValue('EXECUTE_BALANCE', allAmount - executeAmount)
- },
- // 总执行金额监听
- amoutHostChange(val) {
- // 计算执行余额
- const ACCUMULATED_EXECUTE_AMOUNT = this.$refs.webflow.getFieldValue(
- 'ACCUMULATED_EXECUTE_AMOUNT'
- )
- const amount = val - ACCUMULATED_EXECUTE_AMOUNT
- this.$refs.webflow.setFieldValue('EXECUTE_BALANCE', amount)
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- </style>
|