|
@@ -0,0 +1,177 @@
|
|
|
+<template>
|
|
|
+ <div class="hui-flex hui-dialog">
|
|
|
+ <div class="hui-flex-box hui-dialog-content">
|
|
|
+ <el-form ref="form" label-position="top" :model="form">
|
|
|
+ <el-form-item label="工单名称" prop="name" :rules="[{required: true, message: '请输入工单名称'}]">
|
|
|
+ <el-input type="text" v-model="form.name" placeholder="请输入工单名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="相关房源">
|
|
|
+ <select-house ref="selectHouse" :ids="form.projectItemTargetRoomIds"></select-house>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="租客类型">
|
|
|
+ <el-select v-model="form.tenantType" placeholder="请选择租客类型" @change="changeTenantType">
|
|
|
+ <el-option label="企业" :value="1"></el-option>
|
|
|
+ <el-option label="客户" :value="2"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="企业" v-if="form.tenantType === 1" prop="merchantId"
|
|
|
+ :rules="[{required: true, message: '请选择企业'}]">
|
|
|
+ <el-select v-model="form.merchantId" placeholder="请选择企业">
|
|
|
+ <el-option :label="item.name" :value="item.id" v-for="(item,index) in merchantList"
|
|
|
+ :key="index">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="客户" v-else-if="form.tenantType === 2" prop="clientId"
|
|
|
+ :rules="[{required: true, message: '请选择客户'}]">
|
|
|
+ <el-select v-model="form.clientId" placeholder="请选择客户">
|
|
|
+ <el-option :label="item.name" :value="item.id" v-for="(item,index) in clientList" :key="index">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="跟进人" prop="followUpPerson" :rules="[{required: true, message: '请输入跟进人'}]">
|
|
|
+ <el-input type="text" v-model="form.followUpPerson" placeholder="请输入跟进人"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="联系方式" prop="followUpPersonPhone">
|
|
|
+ <el-input type="number" v-model="form.followUpPersonPhone" placeholder="请输入联系方式"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="服务方式" prop="workWay" :rules="[{required: true, message: '请选择服务方式'}]">
|
|
|
+ <el-select v-model="form.workWay" placeholder="请选择服务方式">
|
|
|
+ <el-option :label="item.name" :value="item.id" v-for="(item,index) in $field.field.workWay"
|
|
|
+ :key="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="摘要" class="hui-textarea">
|
|
|
+ <el-input type="textarea" v-model="form.compendious" placeholder="请输入摘要" resize="none">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上传图片" class="hui-textarea">
|
|
|
+ <upload ref="upload" :list="responsibility" type="insert"></upload>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="自定义字段" class="hui-textarea">
|
|
|
+ <custom-data ref="customData" :list="customList"></custom-data>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="hui-dialog-submit">
|
|
|
+ <el-button size="medium" @click="$emit('callback')">取 消</el-button>
|
|
|
+ <el-button size="medium" type="primary" @click="submit">保 存</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ insertOrder,
|
|
|
+ updateOrder,
|
|
|
+ getOrderDetailById
|
|
|
+ } from '@/httpApi/order'
|
|
|
+ import {
|
|
|
+ getOrganizationList,
|
|
|
+ } from '@/httpApi/business'
|
|
|
+ import {
|
|
|
+ getCustomerListByPage
|
|
|
+ } from '@/httpApi/crm'
|
|
|
+ import upload from '@/components/common/upload'
|
|
|
+ import selectHouse from '@/components/common/selectHouse';
|
|
|
+ import customData from '@/components/common/customData'
|
|
|
+ export default {
|
|
|
+ props: ['isUpdate', 'detailId', 'type'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ form: {
|
|
|
+ name: '',
|
|
|
+ projectItemTargetRoomIds: '',
|
|
|
+ tenantType: 1,
|
|
|
+ merchantId: '',
|
|
|
+ clientId: '',
|
|
|
+ followUpPerson: '',
|
|
|
+ followUpPersonPhone: '',
|
|
|
+ workWay: ''
|
|
|
+ },
|
|
|
+ responsibility: [],
|
|
|
+ merchantList: [],
|
|
|
+ clientList: [],
|
|
|
+ customList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.form['userId'] = this.$store.getters.user.userId;
|
|
|
+ if (!this.isUpdate) {
|
|
|
+ this.form['organizationId'] = this.$store.getters.organization.id;
|
|
|
+ this.form['projectId'] = this.$store.getters.project.id;
|
|
|
+ this.form['userId'] = this.$store.getters.user.userId;
|
|
|
+ this.form['type'] = this.type;
|
|
|
+ } else {
|
|
|
+ getOrderDetailById(this.detailId).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.form = res.data;
|
|
|
+ if (this.form.attachment) this.responsibility = JSON.parse(this.form.attachment);
|
|
|
+ if (this.form.data) this.customList = JSON.parse(this.form.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.merchant();
|
|
|
+ this.client();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ changeTenantType() {
|
|
|
+ this.form.merchantId = '';
|
|
|
+ this.form.clientId = '';
|
|
|
+ },
|
|
|
+ merchant() {
|
|
|
+ getOrganizationList({
|
|
|
+ organizationId: this.$store.getters.organization.id,
|
|
|
+ status: 1
|
|
|
+ }).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.merchantList = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ client() {
|
|
|
+ getCustomerListByPage({
|
|
|
+ currPage: 1,
|
|
|
+ pageSize: 100,
|
|
|
+ organizationId: this.$store.getters.organization.id,
|
|
|
+ status: 2
|
|
|
+ }).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.clientList = res.data.dataList;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let postData = JSON.parse(JSON.stringify(this.form));
|
|
|
+ postData['attachment'] = JSON.stringify(this.$refs.upload.fileList);
|
|
|
+ postData['data'] = JSON.stringify(this.$refs.customData.listData);
|
|
|
+ postData['projectItemTargetRoomIds'] = this.$refs.selectHouse.selectNodeId;
|
|
|
+ if (this.isUpdate) {
|
|
|
+ updateOrder(postData).then(this.successFunc);
|
|
|
+ } else {
|
|
|
+ insertOrder(postData).then(this.successFunc);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ successFunc(res) {
|
|
|
+ if (res.state) {
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ this.$emit('callback', 'init');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ upload,
|
|
|
+ selectHouse,
|
|
|
+ customData
|
|
|
+ },
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss"></style>
|