123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <template>
- <audit-form-top-banner :handel-save-form="saveForm" @handelSaveForm="saveForm">
- <sd-detail-form
- ref="docform"
- :page-id="this.$route.query.pageId ? this.$route.query.pageId : null"
- :record-id="this.id"
- :read-only="false"
- :class="[$style.form]"
- @close="close(true)"
- @saved="saved"
- >
- <template v-slot="{ formData, model, fields }">
- <table :class="$style.detailForm">
- <tr>
- <td colspan="4" style="border:none">
- <sd-form-by-builder :form-data="initDaF(formData.pageFormData)"></sd-form-by-builder>
- </td>
- </tr>
- </table>
- </template>
- </sd-detail-form>
- </audit-form-top-banner>
- </template>
- <script>
- import axios from '@/common/services/axios-instance'
- import { message } from '@/common/one-ui'
- import auditFormTopBanner from '@product/iam/components/audit-form-top-banner'
- // 注意此处,需要将-import之前,修改为与文件同名
- import components from './_import-components/contract-edit-import'
- export default {
- name: 'ContractEdit',
- metaInfo: {
- title: '合同签订',
- },
- components: {
- ...components,
- auditFormTopBanner,
- },
- data() {
- return {
- initialled: false,
- id: this.$route.query.id ? this.$route.query.id : '',
- flag: true,
- }
- },
- methods: {
- saved(t) {
- // 保存后执行
- const idobj = t.pageFormData.pageFieldInfos.find((i) => i.name === 'id').value
- this.id = idobj
- const id = this.$route.params.id ? this.$route.params.id : this.$route.query.id
- if (id === null || id === undefined || id === '') {
- let path = this.$route.fullPath
- path = path.replace('?id=&pageId', '?id=' + this.id + '&pageId')
- window.location.href = '#' + path
- }
- },
- // 保存
- saveForm() {
- // this.wjsdRuleCheck();
- this.droolsRuleCheck()
- },
- droolsRuleCheck() {
- var ruleServiceUrl = 'http://localhost:8082/applyContractRules'
- const contractData = this.getContractData()
- axios({
- method: 'post',
- url: ruleServiceUrl,
- data: contractData,
- }).then((res) => {
- if (res.status === 200) {
- if (res.data.status === '提醒') {
- message.warning('提醒:' + res.data.message)
- }
- if (res.data.status === '阻断') {
- message.error('阻断:' + res.data.message)
- }
- if (res.data.status == null) {
- this.$refs.docform.saveBtnClick()
- return true
- }
- }
- })
- return false
- },
- getContractData() {
- const companyList = [
- '北京东方联合投资管理有限公司',
- '网信集团有限公司',
- '普信资产管理有限公司',
- '北京经讯时代科技有限公司',
- '太极股份',
- '河南**燃气管道有限公司',
- '新乡**发电有限公司',
- ]
- var contractData = {
- companyName:
- companyList[this.$refs.docform.getFieldValue('childTableInline0')[0].xdfmc - 1],
- contractAmount: this.$refs.docform.getFieldValue('htje'),
- netCapital: this.$refs.docform.getFieldValue('szk'),
- }
- return contractData
- },
- wjsdRuleCheck() {
- var ruleServiceUrl = 'http://172.20.98.64:9999/rule/callRule/service'
- var ruleData = {
- user: 'admin',
- password: '1',
- request: {
- ruleName: 'POC-001',
- ruleVersion: '1',
- ruleFact: [],
- },
- }
- const contractData = this.getContractData()
- ruleData.request.ruleFact = [contractData]
- console.log(ruleData)
- console.log(JSON.stringify(ruleData))
- const fd = new FormData()
- fd.append('req', JSON.stringify(ruleData))
- axios({
- method: 'post',
- url: ruleServiceUrl,
- data: fd,
- }).then((res) => {
- console.log(res)
- const data = res.data
- if (data.response.ruleCode === '0000') {
- if (data.response.ruleFact.status === '提醒') {
- message.warning('提醒:' + data.response.ruleFact.message)
- }
- if (data.response.ruleFact.status === '阻断') {
- message.error('阻断:' + data.response.ruleFact.message)
- }
- if (data.response.ruleFact.status === 'OK') {
- this.$refs.docform.saveBtnClick()
- return true
- }
- } else {
- message.error('数据请求错误:' + data.response.ruleMsg)
- }
- })
- return false
- },
- close(flag) {
- window.close()
- },
- initDaF(array) {
- if (array) {
- array.attrFD.keepHiddenCell = false
- }
- if (this.flag) {
- setTimeout(() => {
- this.$refs.docform.setFieldValue('BASE_INFO', 'true')
- this.$refs.docform.setFieldValue('SUPPORT_LIST', 'true')
- }, 1000)
- this.flag = false
- }
- return array
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- @import '@/webflow/sd-flow-form.scss';
- .detailForm {
- width: 100% !important;
- margin: 0;
- :global(.sd-form-table) {
- // width: 100% !important;
- }
- }
- </style>
|