hetong.vue 7.08 KB
<template>
  <a-modal
    title="合同详情"
    :width="1000"
    :centered="true"
    :visible="visible"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: { disabled: disableSubmit } }"
    @cancel="handleCancel"
    cancelText="关闭"
    style="top: 20px"
    :maskClosable="false"
  >
    <a-spin :spinning="confirmLoading">
      <a-button
        style="margin-bottom: 10px; float: right; position: relative; z-index: 10"
        @click="handleAddModal(titleModal)"
        type="primary"
        icon="plus"
        >新增</a-button
      >
      <a-table
        ref="table"
        size="middle"
        bordered
        :columns="bankData"
        :dataSource="model"
        :pagination="false"
        :loading="loading"
        :rowKey="(record, index) => index"
        @change="handleTableChange"
      >
        <!-- 字符串超长截取省略号显示-->
        <span slot="esContent" slot-scope="text">
          <j-ellipsis :value="text" :length="10" />
        </span>
        <span slot="actionOpen" slot-scope="text, record">
          <a-switch size="small" :checked="record.status == 1 ? true : false" @change="onChange(record)" />
        </span>
        <span slot="contractCode" slot-scope="text, record">
          <a-button type="link" size="small" @click="contractCode(record, 2)" icon="search" style="font-size: 12px">
            查看</a-button
          >
        </span>
        <span slot="action" slot-scope="text, record">
          <!-- <a @click="handleAddModalEdit(title, record)">修改</a> -->
          <!-- <a-divider type="vertical" /> -->
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record)">
            <a-button type="link" size="small" icon="delete" style="font-size: 12px">删除</a-button>
          </a-popconfirm>
        </span>
      </a-table>
    </a-spin>
    <hetong-modal
      ref="commonBankAccountModal"
      :recordOrderNo.sync="recordOrderNo"
      :customerType.sync="customerType"
      :orderNo.sync="orderNo"
      :modelList.sync="modelList"
      @ok="load"
    ></hetong-modal>
    <template slot="footer">
      <a-button @click="handleCancel">关闭</a-button>
    </template>
  </a-modal>
</template>

<script>
import { changPassword } from '@/api/api'
import { deleteContractManagement, listIContractManagement } from '@/api/insys'
import { ossDownloadFile, listFileUrl } from '@/api/configApi'
import hetongModal from './hetongModal.vue'
export default {
  name: 'hetong',
  components: { hetongModal },
  data() {
    return {
      visible: false,
      confirmLoading: false,
      confirmDirty: false,
      bankData: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          width: 60,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '合同名称',
          align: 'center',
          dataIndex: 'contractName',
        },
        {
          title: '合同编号',
          align: 'center',
          dataIndex: 'contractNo',
        },
        {
          title: '合同签约日期',
          align: 'center',
          dataIndex: 'contractSigningTime',
        },
        {
          title: '合同文件',
          align: 'center',
          dataIndex: 'contractCode',
          scopedSlots: { customRender: 'contractCode' },
        },
        {
          title: '合同签署标识',
          align: 'center',
          dataIndex: 'contractSignMark',
          customRender: function (t, r, index) {
            if (t == 1) {
              return '线上'
            } else {
              return '线下'
            }
          },
        },
        {
          title: '操作',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 120,
          fixed: 'right',
        },
      ],
      disableMixinCreated: true,
      title: '',
      type: 'add',
      dbList: [],
      onlyread: false,
      disableSubmit: true,
      model: [],
      modelList: [],
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      form: this.$form.createForm(this),
      id: '',
      bao: '1',
      recordOrderNo: '',
      customerType: '',
      orderNo: '',
    }
  },
  created() {
    console.log('created')
  },
  methods: {
    edit(username, orderNo, record, customerType) {
      console.log(record)
      this.orderNo = record.orderNo
      this.recordOrderNo = orderNo
      this.type = 'edit'
      this.form.resetFields()
      this.customerType = customerType
      this.visible = true
      this.modelList = record
      this.model = username.records
      this.$nextTick(() => {
        this.form.setFieldsValue(username)
      })
    },
    add(username) {
      // alert("111111")
      this.type = 'add'
      this.form.resetFields()
      this.model = []
      this.model2 = []
      this.model3 = []
      this.modelList = []
      this.visible = true
      this.$nextTick(() => {
        this.form.setFieldsValue()
      })
    },
    onChange() {
      this.close()
    },
    close() {
      this.$emit('close')
      this.visible = false
      this.disableSubmit = false
      this.selectedRole = []
    },
    handleAddModal(title) {
      this.$refs.commonBankAccountModal.add(this.applyNo)
      this.$refs.commonBankAccountModal.title = title ? title : '新增'
      this.$refs.commonBankAccountModal.disableSubmit = false
      this.$emit('success')
      // alert(this.addList)
    },
    handleAddModalEdit(title, record) {
      this.$refs.commonBankAccountModal.edit(record)
      this.$refs.commonBankAccountModal.title = title ? title : '修改'
      this.$refs.commonBankAccountModal.disableSubmit = false
      this.$emit('success')
    },
    load() {
      let _p = {
        params: {
          // customerNo: this.recordOrderNo,
          orderNo:this.orderNo
        },
      }
      listIContractManagement(_p).then((res) => {
        if (res.status.statusCode == 0) {
          this.model = res.result.records
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
    },
    handleDelete(record) {
      console.log(record)
      let _p = { id: record.id }
      deleteContractManagement(_p).then((res) => {
        if (res.status.statusCode == 0) {
          this.load()
          this.$message.success(res.status.statusReason)
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
    },
    contractCode(record, type) {
      if (record.contractCode) {
        let a = {
          fileIdentifyingCode: record.contractCode,
          expire: 10000,
        }
        ossDownloadFile(a).then((res) => {
          if (res.status.statusCode == 0) {
            window.open(res.result.url)
          } else {
            this.$message.warning(res.status.statusReason)
          }
        })
      }else{
        this.$message.warning("亲上传合同模板")
      }
    },
    handleCancel() {
      this.close()
    },
  },
}
</script>