yangfeng
2023-07-19 23d80c1b64f23ede237ab8e89ebc2ee2aaf43f26
src/views/service/serviceContract/AddServiceContractDialog.vue
@@ -164,8 +164,21 @@
            <el-row>
              <el-col :span="12">
                <el-form-item label="附件" prop="">
                  <template slot="label">
                    <div style="display: flex; float: right">
                      <div style="font-size: 16px">
                        <i class="el-icon-warning-outline" title="最多上传20个附件,最大限制5MB"></i>
                      </div>
                      <span style="margin-left: 5px">附件</span>
                    </div>
                  </template>
                  <div class="annex-view">
                    <div @click="addAnnexClick">添加</div>
                    <div @click="addAnnexClick">
                      <div style="display: flex; float: right">
                        <div style="font-size: 16px"><i class="el-icon-paperclip"></i></div>
                        <span>添加</span>
                      </div>
                    </div>
                    <div class="setFormat" @click="setFormatClick">设置允许上传的文件格式</div>
                  </div>
                </el-form-item>
@@ -184,7 +197,7 @@
            </div>
          </div>
          <div class="product-view">
            <CommonFormTableView :product-table-list="productTableList" />
            <CommonFormTableView :show-summary="showSummary" :product-table-list="productTableList" />
          </div>
          <!-- 选择审批流程 -->
          <div class="basic-info-title">选择审批流程</div>
@@ -241,6 +254,8 @@
<script>
import CommonSelectView from "@/components/makepager/CommonSelectView"
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
import { getAllData } from "@/api/client/client"
import { getAddSubOrder, getUpdateSubOrder } from "@/api/sales/subOrder"
export default {
  name: "AddServiceContractDialog",
  props: {
@@ -250,27 +265,7 @@
        return {
          visible: false,
          title: "新建",
          infomation: {
            customName: "",
            serviceContractNumber: "AC6521",
            owner: "5",
            contactName: "",
            salesOpportunity: "",
            contractOrder: "",
            quotation: "",
            contractType: "",
            signDate: "",
            startDate: "",
            endDate: "",
            contractStatus: "",
            serviceNumber: "",
            termsTreaty: "",
            notes: "",
            approvalWorkflow: "",
            approvalSteps: "",
            approvalPerson: "",
            approvalOpinion: ""
          }
          infomation: {}
        }
      }
    }
@@ -288,8 +283,7 @@
      rules: {
        serviceContractNumber: [{ required: true, message: "请输入服务合同编号", trigger: "blur" }],
        signDate: [{ required: true, message: "请选择", trigger: "change" }],
        owner: [{ required: true, message: "请选择负责人", trigger: "change" }],
        approvalOpinion: [{ required: true, message: "请输入审批意见", trigger: "blur" }]
        owner: [{ required: true, message: "请选择负责人", trigger: "change" }]
      },
      ownerOptions: [
        // 负责人
@@ -309,30 +303,137 @@
        { value: "3", label: "欧元(€)" }
      ], // 币种
      approvalWorkflowOptions: [], // 审批流程
      productTableList: {
        tableData: [
          {
            id: "1",
            productNumber: "123",
            productName: "",
            startDate: "",
            endDate: "2016-05-02",
            number: "",
            address: ""
          }
        ]
      productTableList: {},
      showSummary: {
        show: true,
        total: true,
        sumProp: ["other1", "other2", "other3", "other4"],
        mergeNumber: 3
      }
    }
  },
  created() {},
  created() {
    this.setTableForm()
    this.getCommonData()
  },
  methods: {
    getCommonData() {
      getAllData()
        .then((res) => {
          this.memberOptions = res.data.member
        })
        .catch((err) => {
          console.log(err)
        })
    },
    // 保存
    saveClick(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log(this.editConfig.infomation)
          const params = this.saveParams()
          console.log(params)
          if (this.editConfig.title === "新建") {
            getAddSubOrder(params)
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
                    message: "添加成功",
                    type: "success"
                  })
                  this.$parent.getData()
                }
              })
              .catch((err) => {
                console.log(err)
              })
          } else {
            getUpdateSubOrder(params)
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
                    message: "编辑成功",
                    type: "success"
                  })
                  this.$parent.getData()
                }
              })
              .catch((err) => {
                console.log(err)
              })
          }
        } else {
          console.log("error submit")
          return false
        }
      })
    },
    saveParams() {
      let data = this.editConfig.infomation
      let params = {
        id: this.editConfig.title === "新建" ? 0 : data.id,
        clientId: data.clientId || 0,
        masterOrderId: data.masterOrderId || 0,
        memberId: data.memberId || 0,
        number: data.number || "",
        product: [
          {
            amount: 0,
            desc: "",
            id: 0,
            name: "",
            number: "",
            price: 0,
            total: 0
          }
        ]
      }
      return params
    },
    handleClose() {
      this.editConfig.visible = false
    },
    // 添加附件
    addAnnexClick() {},
    // 设置允许上传文件格式
    setFormatClick() {}
    setFormatClick() {},
    setTableForm() {
      this.productTableList = {
        tableData: [
          {
            id: "1",
            productName: "上海有限公司",
            other0: "ZDYBD03-1",
            other1: "12",
            other2: "5.00",
            other4: "3.00",
            other3: "2.00"
          }
        ],
        tableColumn: [
          { label: "#", prop: "id", width: 40 },
          { label: "产品名称", prop: "productName", input: true, isRequird: true },
          { label: "产品编号", prop: "other0" },
          { label: "服务开始日", prop: "other5", date: true, isRequird: true, min: 100 },
          { label: "服务到期日", prop: "other6", date: true, isRequird: true, min: 100 },
          { label: "数量", prop: "other1", input: true, isRequird: true },
          { label: "含税单价", prop: "other9", input: true },
          { label: "不含税单价", prop: "other7", input: true },
          { label: "折扣率(%)", prop: "other6", input: true },
          { label: "折扣额", prop: "other2" },
          { label: "税(销售)", prop: "other7", input: true },
          { label: "实际含税单价", prop: "other3" },
          { label: "不含税金额", prop: "other4" },
          { label: "价税合计", prop: "other3", input: true },
          { label: "描述", prop: "other8" }
        ]
      }
    }
  }
}
</script>
@@ -384,31 +485,6 @@
    background-color: #f5f5f5;
    height: 55px;
    line-height: 55px;
  }
}
::v-deep {
  .el-dialog__header {
    padding: 12.5px 10px;
    border-bottom: 1px solid #e5e5e5;
    .el-dialog__title {
      font-size: 15px;
      color: #323232;
      font-weight: bold;
    }
  }
  .el-dialog__body {
    padding: 0px;
  }
  .el-dialog__footer {
    padding: 0px;
    text-align: center;
    box-sizing: border-box;
    border-top: 1px solid #dadee5;
  }
  .product-view {
    .el-form-item__label {
      padding: 0;
    }
  }
}
</style>