mushencc 3 gadi atpakaļ
vecāks
revīzija
3233ad3ed6
1 mainītis faili ar 140 papildinājumiem un 198 dzēšanām
  1. 140 198
      src/views/BidSystem/ProductDeOrder/infoDetail.vue

+ 140 - 198
src/views/BidSystem/ProductDeOrder/infoDetail.vue

@@ -28,27 +28,15 @@
       <div class="form">
         <Form class="form_content" :label-width="100">
           <FormItem label="项目编号:">
-            <Input
-              v-if="type == 6"
-              v-model="saveData.order_no"
-              placeholder="请输入项目编码"
-            />
+            <Input v-if="type == 6" v-model="saveData.order_no" placeholder="请输入项目编码"/>
             <span style="width: 120px" v-else>{{ formData.order_no }}</span>
           </FormItem>
           <FormItem label="项目名称:">
-            <Input
-              v-if="type == 6"
-              v-model="saveData.residential_name"
-              placeholder="请输入项目名称"
-            />
+            <Input v-if="type == 6" v-model="saveData.residential_name" placeholder="请输入项目名称"/>
             <span v-else>{{ formData.residential_name }}</span>
           </FormItem>
           <FormItem label="项目简称:">
-            <Input
-              v-if="type == 6"
-              v-model="saveData.abbreviation"
-              placeholder="请输入项目简称"
-            />
+            <Input v-if="type == 6" v-model="saveData.abbreviation" placeholder="请输入项目简称"/>
             <span v-else>{{ formData.abbreviation }}</span>
           </FormItem>
           <FormItem label="客户名称:">
@@ -68,7 +56,11 @@
             <span v-else>{{ formData.custom_title }}</span>
           </FormItem>
           <FormItem label="紧急程度:">
-            <Select clearable v-model="saveData.warning_state" v-if="type == 6">
+            <Select
+              clearable
+              v-model="saveData.warning_state"
+              v-if="type == 6"
+            >
               <Option
                 v-for="(item, index) in warning_state_list"
                 :key="index"
@@ -79,27 +71,15 @@
             <span v-else>{{ formData.warning_state }}</span>
           </FormItem>
           <FormItem label="项目定金:">
-            <Input
-              v-if="type == 6"
-              v-model="saveData.front_money"
-              placeholder="请输入项目定金"
-            />
+            <Input v-if="type == 6" v-model="saveData.front_money" placeholder="请输入项目定金"/>
             <span v-else>{{ formData.front_money }}</span>
           </FormItem>
           <FormItem label="详细地址:">
-            <Input
-              v-if="type == 6"
-              v-model="saveData.address"
-              placeholder="请输入详细地址"
-            />
+            <Input v-if="type == 6" v-model="saveData.address" placeholder="请输入详细地址"/>
             <span v-else>{{ formData.address }}</span>
           </FormItem>
           <FormItem label="手机号:">
-            <Input
-              v-if="type == 6"
-              v-model="saveData.mobile"
-              placeholder="请输入手机号"
-            />
+            <Input v-if="type == 6" v-model="saveData.mobile" placeholder="请输入手机号"/>
             <span v-else>{{ formData.mobile }}</span>
           </FormItem>
           <FormItem label="开始日期:">
@@ -139,12 +119,7 @@
             <span v-else>{{ formData.nickname }}</span>
           </FormItem>
           <FormItem label="备注:">
-            <Input
-              v-if="type == 6"
-              v-model="saveData.remark"
-              type="textarea"
-              placeholder="请输入备注"
-            />
+            <Input v-if="type == 6" v-model="saveData.remark" type="textarea" placeholder="请输入备注"/>
             <span v-else>{{ formData.remark }}</span>
           </FormItem>
         </Form>
@@ -425,7 +400,7 @@
             </FormItem>
           </Form>
         </div>
-        <Tabs type="card" @on-click="handleTabsChange">
+        <Tabs type="card" @on-click="getData">
           <TabPane
             v-for="tab in tabs"
             :key="tab"
@@ -462,31 +437,33 @@
               />
             </div>
           </TabPane>
-          <div slot="extra" class="upload">
-            <Button
-              @click="handleTabsAdd"
-              size="small"
-              style="margin-right: 10px"
-              type="primary"
-              ghost
-              v-if="type == 6"
-              >新增</Button
-            >
-            <Upload
-              :headers="headers"
-              name="your_file"
-              :data="uploadData"
-              :show-upload-list="false"
-              :on-error="uploadError"
-              :on-success="uploadSuccess"
-              :before-upload="handleBeforeUpload"
-              :action="$store.state.ip + '/api/explode_save_import_new'"
-              v-if="type == 6"
-              style="margin-right: 10px"
-            >
-              <Button size="small" type="primary" ghost>导入</Button>
-            </Upload>
-          </div>
+          <div  slot="extra" class="upload">
+          <Button
+            @click="handleTabsAdd"
+            size="small"
+            style="margin-right: 10px"
+            type="primary"
+            ghost
+            v-if="type == 6"
+            >新增</Button
+          >
+           <Upload
+           :headers="headers"
+          :show-upload-list="false"
+          :on-error="uploadError"
+          :on-success="uploadSuccess"
+          :action="$store.state.ip + '/api/explode_save_import_new'" 
+          v-if="type == 6"
+          style="margin-right: 10px"
+        >
+          <Button
+            size="small"
+            type="primary"
+            ghost
+            >导入</Button
+          >
+           </Upload>
+           </div>
         </Tabs>
       </Card>
     </div>
@@ -496,15 +473,10 @@
 export default {
   data() {
     return {
-      ruleValidate: {
-        name: [
-          {
-            required: true,
-            message: "The name cannot be empty",
-            trigger: "blur",
-          },
-        ],
-      },
+        ruleValidate: {
+                    name: [
+                        { required: true, message: 'The name cannot be empty', trigger: 'blur' }
+                    ]},
       totalColumns: [
         { type: "selection", align: "center", width: 60 },
         { title: "序号", align: "center", type: "index", minWidth: 200 },
@@ -595,10 +567,10 @@ export default {
         start_time: "",
         warning_state: "",
       },
-      formData: {},
-      custom_title_list: [],
-      warning_state_list: [],
-      nickname_list: [],
+      formData:{},
+      custom_title_list:[],
+      warning_state_list:[],
+      nickname_list:[],
       searchData: {
         area_code: [],
         area_title: [],
@@ -636,13 +608,12 @@ export default {
       search_state: false,
       copy_form: [],
       type: this.$route.query.type,
+      formData: {},
       tabs: 2,
       total: 0,
       page_index: 1,
       page_size: 10,
-      save_state: false,
-      uploadData: {},
-      currency_tag: 1,
+      save_state:false,
     };
   },
   created() {
@@ -652,26 +623,16 @@ export default {
           params: { order_no: this.$route.query.order_no },
         })
         .then((res) => {
-          this.formData = res.data;
+          this.formData = res.msg;
         });
       this.getData();
-    } else {
-      this.axios.get("/api/custom_list").then((res) => {
-        this.custom_title_list = res.data.data;
-      });
-      this.axios.get("/api/warning_list").then((res) => {
-        this.warning_state_list = res.data.data;
-      });
-      this.axios.get("/api/employee_list").then((res) => {
-        this.nickname_list = res.data;
-      });
+    }else{
+        this.axios.get('/api/custom_list').then(res=>{ this.custom_title_list = res.data.data});
+        this.axios.get('/api/warning_list').then(res=>{ this.warning_state_list = res.data.data });
+        this.axios.get('/api/employee_list').then(res=>{ this.nickname_list = res.data });
     }
   },
   methods: {
-    handleTabsChange(name) {
-      this.currency_tag = name;
-      this.getData(name);
-    },
     changeTotalSize(e) {
       this.page_size = e;
       this.getData();
@@ -691,70 +652,34 @@ export default {
     getData(type) {
       if (type === 1) {
         if (this.search_state) {
-          console.log("1 :>> ", 1);
           this.page_index = 1;
           this.page_size = 10;
           this.axios
             .post("/api/order_area_details", {
-              order_no: this.$route.query.order_no || this.saveData.order_no,
+              order_no: this.$route.query.order_no,
               page_index: this.page_index,
               page_size: this.page_size,
               ...this.searchData,
             })
             .then((res) => {
               console.log(res);
-              this.detailData = res.data.data;
-              this.total = res.data.total;
-              this.area_code = res.data.area_code;
-              this.area_title = res.data.area_title;
-              this.color = res.data.color;
-              this.fashion = res.data.fashion;
-              this.house = res.data.house;
-              this.house_type = res.data.house_type;
-              this.layer = res.data.layer;
-              this.material = res.data.material;
-              this.number = res.data.number;
-              this.position = res.data.position;
-              this.product_title = res.data.product_title;
-              this.product_type = res.data.product_type;
-              this.state = res.data.state;
-              this.unit = res.data.unit;
-              this.url_number = res.data.url_number;
-              this.work = res.data.work;
-              this.copy_form = this.searchData;
+              this.detailData = res.msg.data;
+              this.total = res.msg.total;
             });
         } else {
           this.page_index = 1;
           this.page_size = 10;
-          this.$route.query.order_no &&
-            this.axios
-              .post("/api/order_area_details", {
-                order_no: this.$route.query.order_no || this.saveData.order_no,
-                page_index: this.page_index,
-                page_size: this.page_size,
-              })
-              .then((res) => {
-                console.log(res);
-                this.detailData = res.data.data;
-                this.total = res.data.total;
-                this.area_code = res.data.area_code;
-                this.area_title = res.data.area_title;
-                this.color = res.data.color;
-                this.fashion = res.data.fashion;
-                this.house = res.data.house;
-                this.house_type = res.data.house_type;
-                this.layer = res.data.layer;
-                this.material = res.data.material;
-                this.number = res.data.number;
-                this.position = res.data.position;
-                this.product_title = res.data.product_title;
-                this.product_type = res.data.product_type;
-                this.state = res.data.state;
-                this.unit = res.data.unit;
-                this.url_number = res.data.url_number;
-                this.work = res.data.work;
-                this.copy_form = this.searchData;
-              });
+          this.axios
+            .post("/api/order_area_details", {
+              order_no: this.$route.query.order_no,
+              page_index: this.page_index,
+              page_size: this.page_size,
+            })
+            .then((res) => {
+              console.log(res);
+              this.detailData = res.msg.data;
+              this.total = res.msg.total;
+            });
         }
       } else if (type === 0) {
         //             this.page_index= 1;
@@ -768,8 +693,8 @@ export default {
         //       },
         //     )
         //     .then((res) => {
-        //         this.totalData = res.data.data;
-        //            this.total = res.data.total;
+        //         this.totalData = res.msg.data;
+        //            this.total = res.msg.total;
         //     })
       } else {
         this.page_index = 1;
@@ -781,64 +706,81 @@ export default {
             ...this.searchData,
           })
           .then((res) => {
-            console.log(res.data.house_type, this.house_type);
-            this.totalData = res.data.data;
-            this.total = res.data.total;
-            this.area_code = res.data.area_code;
-            this.area_title = res.data.area_title;
-            this.color = res.data.color;
-            this.fashion = res.data.fashion;
-            this.house = res.data.house;
-            this.house_type = res.data.house_type;
-            this.layer = res.data.layer;
-            this.material = res.data.material;
-            this.number = res.data.number;
-            this.position = res.data.position;
-            this.product_title = res.data.product_title;
-            this.product_type = res.data.product_type;
-            this.state = res.data.state;
-            this.unit = res.data.unit;
-            this.url_number = res.data.url_number;
-            this.work = res.data.work;
+              console.log(res.msg.house_type,this.house_type)
+            this.totalData = res.msg.data;
+            this.total = res.msg.total;
+            this.area_code = res.msg.area_code;
+            this.area_title = res.msg.area_title;
+            this.color = res.msg.color;
+            this.fashion = res.msg.fashion;
+            this.house = res.msg.house;
+            this.house_type = res.msg.house_type;
+            this.layer = res.msg.layer;
+            this.material = res.msg.material;
+            this.number = res.msg.number;
+            this.position = res.msg.position;
+            this.product_title = res.msg.product_title;
+            this.product_type = res.msg.product_type;
+            this.state = res.msg.state;
+            this.unit = res.msg.unit;
+            this.url_number = res.msg.url_number;
+            this.work = res.msg.work;
             this.copy_form = this.searchData;
           });
       }
     },
-    uploadError(err) {
+     uploadError(err) {
       this.$Message.error(err.msg || "上传失败");
     },
     uploadSuccess(res) {
+        
       if (res.code == 200) {
-        this.$Message.success(res.data || "上传成功");
-        this.search_state = true;
-        this.getData(this.currency_tag);
+        this.$Message.success(res.msg || "上传成功");
       } else {
-        this.$Message.warning(res.data || "上传失败");
+        this.$Message.warning(res.msg || "上传失败");
       }
-    },
-    async handleBeforeUpload() {
-      this.uploadData.order_no = this.saveData.order_no;
-      return true;
-    },
-    save() {
-      if (
-        this.saveData.order_no &&
-        this.saveData.residential_name &&
-        this.saveData.abbreviation &&
-        this.saveData.custom_title &&
-        this.saveData.warning_state
-      ) {
+      this.page_index = 1;
+        this.page_size = 10;
         this.axios
-          .post("/api/order_area_save", { ...this.saveData })
+          .post("/api/order_area_details", {
+            ...this.$route.query,
+            ...{ page_index: this.page_index, page_size: this.page_size },
+            order_no:this.saveData.order_no
+          })
           .then((res) => {
-            if (res.code == 200) {
-              this.$Message.success(res.msg);
-              this.save_state = true;
-            }
+              console.log(res)
+            this.totalData = res.msg.data;
+            this.total = res.msg.total;
+            this.area_code = res.msg.area_code;
+            this.area_title = res.msg.area_title;
+            this.color = res.msg.color;
+            this.fashion = res.msg.fashion;
+            this.house = res.msg.house;
+            this.house_type = res.msg.house_type;
+            this.layer = res.msg.layer;
+            this.material = res.msg.material;
+            this.number = res.msg.number;
+            this.position = res.msg.position;
+            this.product_title = res.msg.product_title;
+            this.product_type = res.msg.product_type;
+            this.state = res.msg.state;
+            this.unit = res.msg.unit;
+            this.url_number = res.msg.url_number;
+            this.work = res.msg.work;
+            this.copy_form = this.searchData;
           });
-      } else {
-        this.$Message.error("请填写必要信息!");
-      }
+    },
+    save() {
+        if(!this.saveData.order_no&&!this.saveData.residential_name&&!this.saveData.abbreviation&&!this.saveData.custom_title&&!this.saveData.warning_state){
+            this.$message.error('请填写必要信息!');
+        }else{ 
+            this.axios.post('/api/order_area_save',{...this.saveData}).then(res=>{
+           this.$message.success(res.msg)
+           this.save_state = true;
+      })
+
+        }
+     
     },
     goback() {
       this.$router.go(-1);
@@ -853,7 +795,7 @@ export default {
   },
 };
 </script>
-<style scoped lang="scss">
+<style scoped lang='scss'>
 .changeDetail {
   .content {
     overflow: auto;
@@ -872,11 +814,11 @@ export default {
     }
   }
 }
-.ivu-form-item {
-  width: 250px;
+.ivu-form-item{
+    width: 250px;
 }
-.upload {
-  display: flex;
-  justify-content: space-around;
+.upload{
+    display: flex;
+    justify-content: space-around;
 }
-</style>
+</style>