yangfeng
2023-07-21 51ce81df657be1e2eb5cfd8f21ebe731d8d3444b
src/views/service/orderManage/AddOrderManageDialog.vue
@@ -22,54 +22,70 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="12">
                <el-form-item label="客户名称" prop="customName">
                <el-form-item label="客户名称" prop="clientId">
                  <div class="custom-name">
                    <el-input v-model="editConfig.infomation.customName"></el-input>
                    <el-input v-model="editConfig.infomation.clientId"></el-input>
                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="选择"></i></div>
                    <div class="common-select-btn"><i class="el-icon-edit" title="编辑"></i></div>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="工单编号" prop="orderNumber">
                  <el-input v-model="editConfig.infomation.orderNumber"></el-input>
                <el-form-item label="工单编号" prop="number">
                  <el-input v-model="editConfig.infomation.number"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="工单名称" prop="orderName">
                  <el-input v-model="editConfig.infomation.orderName"></el-input>
                <el-form-item label="工单名称" prop="name">
                  <el-input v-model="editConfig.infomation.name"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="工单类型" prop="orderType">
                  <CommonSelectView
                    :common-value="editConfig.infomation.orderType"
                    :common-options="orderTypeOptions"
                  />
                  <div class="common-select">
                    <el-select
                      v-model="editConfig.infomation.orderType"
                      placeholder="请选择"
                      class="common-select-sel"
                      size="mini"
                    >
                      <el-option v-for="item in orderTypeOptions" :key="item.id" :label="item.name" :value="item.id">
                      </el-option>
                    </el-select>
                    <div class="common-select-btn"><i class="el-icon-setting"></i></div>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系人姓名" prop="contactName">
                <el-form-item label="联系人姓名" prop="contactId">
                  <div class="custom-name">
                    <el-input v-model="editConfig.infomation.contactName"></el-input>
                    <el-input v-model="editConfig.infomation.contactId"></el-input>
                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="选择"></i></div>
                    <div class="common-select-btn"><i class="el-icon-edit" title="编辑"></i></div>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="报修来源" prop="repairSource">
                  <CommonSelectView
                    :common-value="editConfig.infomation.repairSource"
                    :common-options="repairSourceOptions"
                  />
                <el-form-item label="报修来源" prop="reportSourceId">
                  <div class="common-select">
                    <el-select
                      v-model="editConfig.infomation.reportSourceId"
                      placeholder="请选择"
                      class="common-select-sel"
                      size="mini"
                    >
                      <el-option v-for="item in reportSourceOptions" :key="item.id" :label="item.name" :value="item.id">
                      </el-option>
                    </el-select>
                    <div class="common-select-btn"><i class="el-icon-setting"></i></div>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="选择源单" prop="selSourceOrder">
                  <el-select v-model="editConfig.infomation.selSourceOrder" size="mini">
              <!-- <el-col :span="12">
                <el-form-item label="选择源单" prop="sourceSheet">
                  <el-select v-model="editConfig.infomation.sourceSheet" size="mini">
                    <el-option
                      v-for="item in selSourceOrderOptions"
                      v-for="item in sourceSheetOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
@@ -77,7 +93,7 @@
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              </el-col> -->
            </el-row>
          </div>
          <!-- 问题描述 -->
@@ -85,12 +101,12 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="24">
                <el-form-item label="问题描述" prop="problemDesc">
                <el-form-item label="问题描述" prop="problemDescription">
                  <el-input
                    type="textarea"
                    :autosize="{ minRows: 2, maxRows: 4 }"
                    placeholder="请输入内容"
                    v-model="editConfig.infomation.problemDesc"
                    v-model="editConfig.infomation.problemDescription"
                  ></el-input>
                </el-form-item>
              </el-col>
@@ -124,7 +140,7 @@
            </el-row>
          </div>
          <!-- 选择审批流程 -->
          <div class="basic-info-title">选择审批流程</div>
          <!-- <div class="basic-info-title">选择审批流程</div>
          <div class="basic-info-view">
            <el-row>
              <el-col :span="20">
@@ -162,13 +178,13 @@
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          </div> -->
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" size="small" @click="editConfig.visible = false">保并提交审批</el-button>
        <el-button type="primary" size="small" @click="editConfig.visible = false">保存</el-button>
        <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">保并提交审批</el-button> -->
        <el-button type="primary" size="small" @click="saveClick('form')">保存</el-button>
        <el-button size="small" @click="editConfig.visible = false">取消</el-button>
      </div>
    </el-dialog>
@@ -176,7 +192,8 @@
</template>
<script>
import CommonSelectView from "@/components/makepager/CommonSelectView"
import { getAllData } from "@/api/client/client"
import { getAddOrderManage, getUpdateOrderManage } from "@/api/serviceManage/orderManage"
export default {
  name: "AddOrderManageDialog",
  props: {
@@ -186,25 +203,12 @@
        return {
          visible: false,
          title: "新建",
          infomation: {
            customName: "",
            orderNumber: "AC6521",
            orderName: "",
            orderType: "",
            contactName: "",
            repairSource: "",
            selSourceOrder: "",
            problemDesc: "",
            approvalWorkflow: "",
            approvalSteps: "",
            approvalPerson: "",
            approvalOpinion: ""
          }
          infomation: {}
        }
      }
    }
  },
  components: { CommonSelectView },
  components: {},
  computed: {
    searchCommonHeight() {
      return this.$refs.searchCommonView.offsetHeight
@@ -215,22 +219,95 @@
      dialogWidth: "80%",
      editConfig: this.editCommonConfig,
      rules: {
        customName: [{ required: true, message: "请输入客户名称", trigger: "blur" }],
        orderNumber: [{ required: true, message: "请输入工单编号", trigger: "blur" }],
        clientId: [{ required: true, message: "请输入客户名称", trigger: "blur" }],
        number: [{ required: true, message: "请输入工单编号", trigger: "blur" }],
        orderType: [{ required: true, message: "请选择", trigger: "change" }],
        problemDesc: [{ required: true, message: "请输入问题描述", trigger: "blur" }]
        problemDescription: [{ required: true, message: "请输入问题描述", trigger: "blur" }]
      },
      orderTypeOptions: [], // 工单类型
      repairSourceOptions: [], // 报修来源
      selSourceOrderOptions: [
      orderTypeOptions: [{ id: 1, name: "类型1" }], // 工单类型
      reportSourceOptions: [], // 报修来源
      sourceSheetOptions: [
        { value: "1", label: "销售明细单" },
        { value: "2", label: "服务合同" }
      ],
      approvalWorkflowOptions: [] // 审批流程
    }
  },
  created() {},
  created() {
    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 === "新建") {
            getAddOrderManage(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 {
            getUpdateOrderManage(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: parseInt(data.clientId) || 0,
        contactId: data.contactId || 0,
        file: data.file || "",
        name: data.name || "",
        number: data.number || "",
        orderType: data.orderType || 0,
        problemDescription: data.problemDescription || "",
        reportSourceId: data.reportSourceId || 0,
        sourceSheet: data.sourceSheet || 0
      }
      return params
    },
    handleClose() {
      this.editConfig.visible = false
    },
@@ -265,6 +342,17 @@
          font-size: 18px;
        }
      }
      .common-select {
        display: flex;
        .common-select-sel {
          width: 270px;
        }
        .common-select-btn {
          margin-left: 5px;
          font-size: 16px;
          cursor: pointer;
        }
      }
    }
    .annex-view {
      display: flex;
@@ -278,26 +366,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;
  }
}
</style>