Преглед изворни кода

feat:项目经理字段添加

snow пре 1 година
родитељ
комит
66c0b93d13

+ 5 - 3
src/components/globalComponents/project-manager/main.vue

@@ -25,7 +25,7 @@
         :disabled="item.status + '' !== '1'"
       />
     </el-select>
-    <el-button :size="size || 'medium'" class="p-btn" @click="changeMe" :disabled="loading">选当前账号</el-button>
+    <el-button :size="size || 'medium'" class="p-btn" @click="changeMe" :disabled="loading || disabled">选当前账号</el-button>
   </div>
 </template>
 
@@ -167,9 +167,12 @@ export default {
 <style lang="scss" scoped>
 .project-manager {
   width: 100%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+
   .p-btn {
     width: 80px;
-    float: left;
 
     padding-left: 0;
     padding-right: 0;
@@ -180,7 +183,6 @@ export default {
     border-left-width: 0;
   }
   .p-slesct {
-    float: left;
     width: calc(100% - 80px);
   }
 }

+ 17 - 7
src/views/netOrderEntry/netOrderEnter/addEdit.vue

@@ -128,11 +128,13 @@
                 </el-form-item>
               </el-col>
 
-              <el-col :span="24">
-                <el-form-item label="项目经理" prop="manager">
+              <el-col :span="12">
+                <el-form-item label="项目经理" prop="managerid">
                   <project-manager
                     size="mini"
-                    :value="ruleForm.manager"
+                    :value="ruleForm.managerid"
+                    :names="ruleForm.manager"
+                    :is-detail="true"
                     placeholder="项目经理"
                     @searchChange="managerChange"
                     style="width:100%"
@@ -380,7 +382,8 @@ const defaultData = {
   addr_code: [],
   cgd_total: "",
   cgdPrice: "",
-  manager: [],
+  managerid: [],
+  manager: "",
   // buyerid: "",
   // buyer_name: "",
   platform_id: "",
@@ -444,7 +447,7 @@ export default {
             trigger: "blur"
           }
         ],
-        manager: [
+        managerid: [
           {
             type: "array",
             required: true,
@@ -642,8 +645,9 @@ export default {
   },
   methods: {
     managerChange(e) {
-      const { id } = e;
-      this.ruleForm.manager = id ? [id] : [];
+      const { id , label} = e;
+      this.ruleForm.managerid = id ? [id] : [];
+      this.ruleForm.manager = label
       this.$refs.ruleForm.validateField("manager");
     },
     async handleHandoverName(e) {
@@ -780,11 +784,15 @@ export default {
         tax,
         addr_code,
         unitName,
+        manager,
+        managerid,
         ...rest
       } = data;
 
       this.ruleForm = {
         ...rest,
+        manager:manager || "",
+        managerid:managerid ? [managerid] : managerid,
         buyerid: buyerid ? [buyerid] : [],
         addr_code: addr_code ? addr_code.split(",") : [],
         cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],
@@ -837,6 +845,8 @@ export default {
             ? model.goodUnit[0]
             : model.goodUnit;
 
+          model.managerid = Array.isArray(model.managerid) ? model.managerid[0] : model.managerid
+
           let res = {};
           if (this.id === "003") {
             delete model["id"];

+ 21 - 0
src/views/netOrderEntry/prestoreRecordingOrders/addEdit.vue

@@ -119,6 +119,21 @@
                   />
                 </el-form-item>
               </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="项目经理" prop="managerid">
+                  <project-manager
+                    size="mini"
+                    disabled
+                    :value="ruleForm.managerid"
+                    :names="ruleForm.manager"
+                    :is-detail="true"
+                    placeholder="项目经理"
+                    @searchChange="managerChange"
+                    style="width:100%"
+                  />
+                </el-form-item>
+              </el-col>
             </el-row>
 
             <el-divider>
@@ -354,6 +369,8 @@ import { accMul, accDiv, accSub, isPhone, isMobile } from "@/utils/validate";
 import resToken from "@/mixins/resToken";
 
 const defaultData = {
+  manager:"",
+  managerid:[],
   addr_code: [],
   cgd_total: "",
   cgdPrice: "",
@@ -729,11 +746,15 @@ export default {
         tax,
         addr_code,
         unitName,
+        manager,
+        managerid,
         ...rest
       } = data;
 
       this.ruleForm = {
         ...rest,
+        manager:manager || "",
+        managerid:managerid ? [managerid] : [],
         buyerid: buyerid ? [buyerid] : [],
         addr_code: addr_code ? addr_code.split(",") : [],
         cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],

+ 71 - 48
src/views/netOrderEntry/prestoreRecordingOrders/importTemplateModal.vue

@@ -1,32 +1,30 @@
 <template>
-  <el-dialog
-    center
-    width="1024px"
-    title="导入采销订单补录"
-    :visible="innerVisible"
-    :close-on-click-modal="false"
-    @close="innerVisible = false; tableData = []"
-  >
+  <el-dialog center width="1024px" title="导入采销订单补录" :visible="innerVisible" :close-on-click-modal="false"
+    @close="innerVisible = false; tableData = []">
     <!-- <div style="margin-bottom:20px;display:flex;align-items:center">
       <span style="color:red">*</span>
       <p style="width:80px">项目经理:</p>
 
     </div> -->
 
-    <div v-if="tableData && tableData.length > 0" class="tr" style="padding: 10px 0 0 0">
+    <div v-if="tableData && tableData.length > 0" style="width:100%;display: flex;align-items: center;">
 
-    <el-form>
-      <project-manager
-        size="mini"
-        :isDetail="true"
-        :value="ruleForm.manager"
-        @searchChange="managerChange"
-      />
-      </el-form-item>
-    </el-form>
+      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="80px" style="width:100%">
+        <el-row>
+          <el-col :span="10">
+            <el-form-item label="项目经理" prop="managerid">
+              <project-manager size="mini" :isDetail="true" :value="ruleForm.managerid" @searchChange="managerChange" />
+            </el-form-item>
+          </el-col>
 
-      <el-button :size="'mini'" @click="() => tableData = []">取消</el-button>
-      <el-button type="primary" :size="'mini'" :loading="loading" @click="onSubmit">提交</el-button>
+          <el-col :span="14">
+            <el-form-item class="fr">
+              <el-button :size="'mini'" @click="() => tableData = []">取消</el-button>
+              <el-button type="primary" :size="'mini'" :loading="loading" @click="onSubmit">提交</el-button>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
     </div>
 
     <div v-else>
@@ -65,7 +63,17 @@ export default {
       loading: false,
       tableData: [],
       ruleForm: {
-        manager: ""
+        manager: "",
+        managerid: []
+      },
+      rules: {
+        managerid: [
+          {
+            type: 'array',
+            required: true,
+            message: '请选择项目经理'
+          }
+        ]
       },
       table: {
         stripe: true,
@@ -86,8 +94,10 @@ export default {
   },
   methods: {
     managerChange(e) {
-      const { id } = e;
-      this.ruleForm.manager = id ? [id] : [];
+      const { id, label } = e;
+      this.ruleForm.managerid = id ? [id] : [];
+      this.ruleForm.manager = label
+      this.$refs.ruleForm.validateFields("managerid")
     },
     validateTableHeader(header, importHeader) {
       let isHeaderOk = true;
@@ -391,34 +401,47 @@ export default {
       this.validateFields(this.tableData);
     },
     async onSubmit() {
-      if (!this.validateFields(this.tableData)) return;
+      try {
+        await this.$refs.ruleForm.validate()
+        if (!this.validateFields(this.tableData)) return;
+        const list = this.tableData.map(tableItem =>
+          requsetFields.reduce(
+            (prev, currentKey) => ({
+              ...prev,
+              workCode: "",
+              [currentKey]: tableItem[currentKey]
+            }),
+            {}
+          )
+        );
 
-      const list = this.tableData.map(tableItem =>
-        requsetFields.reduce(
-          (prev, currentKey) => ({
-            ...prev,
-            workCode: "",
-            [currentKey]: tableItem[currentKey]
-          }),
-          {}
-        )
-      );
+        this.loading = true;
+        
+        const result = await asyncRequest.importOrder({
+          list:list.map((item) => ({
+            ...item,
+            ...this.ruleForm,
+             managerid:Array.isArray(this.ruleForm.managerid) ? this.ruleForm.managerid[0] : this.ruleForm.managerid
+          })),
+          ...this.ruleForm,
+          managerid:Array.isArray(this.ruleForm.managerid) ? this.ruleForm.managerid[0] : this.ruleForm.managerid
+        });
 
-      this.loading = true;
-      const result = await asyncRequest.importOrder({
-        list
-      });
-      this.loading = false;
+        this.loading = false;
 
-      switch (String(result.code)) {
-        case "0":
-          this.$message.success("导入成功");
-          this.innerVisible = false;
-          this.$emit("refresh");
-          break;
-        default:
-          this.$message.warning(result.message);
-          break;
+        switch (String(result.code)) {
+          case "0":
+            this.$message.success("导入成功");
+            this.innerVisible = false;
+            this.$emit("refresh");
+            break;
+          default:
+            this.$message.warning(result.message);
+            break;
+        }
+
+      } catch (e) {
+        console.log(e)
       }
     }
   }

+ 31 - 11
src/views/sellOut/project/components/buyGoodModal.vue

@@ -28,7 +28,7 @@
           />
         </el-col>
 
-        <el-col span="24" style="margin-top:20px">
+        <!-- <el-col span="24" style="margin-top:20px">
           <div style="display:flex;align-items:center">
             <span style="color:red">*</span>
             <p style="width:80px">项目经理:</p>
@@ -39,7 +39,7 @@
               @searchChange="managerChange"
             />
           </div>
-        </el-col>
+        </el-col> -->
 
         <el-col :span="24" style="padding: 10px 0 0 0">
           <span style="line-height: 30px">商品下单:</span>
@@ -71,15 +71,31 @@
               <i class="el-icon-arrow-right el-icon--right" :size="'mini'" />
             </el-button>
           </el-button-group>
-          <project-manager
+          <div style="display:inline-flex">
+            <project-manager
             :size="'mini'"
             v-if="index + 1 === total"
-            v-model.value="manager"
+            v-model.value="managerid"
             @searchChange="managerChange"
             class="fr"
             style="width: 300px; margin: 0 50px 0 0"
           />
+          </div>
         </el-col>
+
+        <!-- <el-col :span="24">
+          <el-form :model="ruleForm" :rules="rules" label-width="80px">
+            <el-form-item label="项目经理" prop="managerid">
+              <project-manager
+                size="mini"
+                :isDetail="true"
+                :value="ruleForm.managerid"
+                @searchChange="managerChange"
+              />
+            </el-form-item>
+          </el-form>
+        </el-col> -->
+
         <el-col :span="24">
           <el-table :data="order_good" border :size="'mini'" style="width: 100%" row-key="key">
             <el-table-column prop="good_img" label="商品图片" min-width="242px" show-overflow-tooltip>
@@ -405,9 +421,8 @@ export default {
       planNo: "",
       arrtime: "",
       project_list: [],
-      ruleForm: {
-        manager: ""
-      },
+      manager: "",
+      managerid:[],
       options: [
         {
           value: "1",
@@ -489,8 +504,8 @@ export default {
     },
     managerChange(e) {
       const { id, label } = e;
-      this.manager = id ? [id] : [];
-      this.manager_name = label ?? "";
+      this.managerid = id ? [id] : [];
+      this.manager = label ?? "";
     },
     async initForm() {
       this.loading = true;
@@ -560,7 +575,7 @@ export default {
           ? []
           : JSON.parse(JSON.stringify(this.addrForm.order_addr));
       if (this.index + 1 === this.total) {
-        if (this.manager.length === 0) {
+        if (this.managerid.length === 0) {
           this.$message.warning("请选择项目经理");
           return;
         }
@@ -715,7 +730,12 @@ export default {
         }
       });
 
-      const res = await asyncRequest.project_place_order(model);
+      const res = await asyncRequest.project_place_order({
+        ...model,
+        managerid: Array.isArray(this.managerid) ? this.managerid[0] : this.managerid,
+        manager: this.manager
+      });
+      
       this.loading = false;
       if (res && res.code === 0) {
         this.$notify.success({

+ 2 - 2
src/views/sellOut/project/components/costFormAddEdit.vue

@@ -11,7 +11,7 @@
     element-loading-text="拼命加载中"
     element-loading-spinner="el-icon-loading"
     element-loading-background="rgba(0, 0, 0, 0.8)"
-    @close="showModelThis = false"
+    @close="showModel = false"
   >
     <el-card style="margin: -20px 0 0 0">
       <el-row :gutter="10">
@@ -308,7 +308,7 @@ export default {
       // 重置
       await this.$nextTick(async() => {
         if (this.$refs.ruleForm) {
-          this.$refs.ruleForm.resetFields()
+          this.$refs.ruleForm.resetForm()
           this.$refs.ruleForm.clearValidate()
           await this.resetFormData()
         }

+ 1 - 1
src/views/sellOut/project/components/setPlan.vue

@@ -126,10 +126,10 @@
             icon="el-icon-circle-plus-outline"
             :size="'mini'"
           >添加方案</el-button>
+          <!-- v-if=" (plan_show.status + '' === '1' && ppowers.some((i) => i == '5') && status == '5') && !isSupertube" -->
           <el-button
             type="primary"
             class="fr"
-            v-if=" (plan_show.status + '' === '1' && ppowers.some((i) => i == '5') && status == '5') && !isSupertube"
             @click="place_order"
             :size="'mini'"
           >

+ 11 - 11
src/views/sellOut/salesOrder/components/addForm.vue

@@ -298,6 +298,17 @@
               </el-row>
             </el-col>
 
+            <el-col :span="12">
+              <el-form-item label="项目经理" prop="managerid">
+                <project-manager
+                  size="mini"
+                  :isDetail="true"
+                  :value="ruleForm.managerid"
+                  @searchChange="manageridChange"
+                />
+              </el-form-item>
+            </el-col>
+
             <el-col :span="6">
               <el-form-item label="到货时间" prop="arrtime">
                 <el-date-picker
@@ -325,17 +336,6 @@
               </el-form-item>
             </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="项目经理" prop="managerid">
-                <project-manager
-                  size="mini"
-                  :isDetail="true"
-                  :value="ruleForm.managerid"
-                  @searchChange="manageridChange"
-                />
-              </el-form-item>
-            </el-col>
-
             <el-col :span="ruleForm.good_code ? 12 : 24">
               <el-form-item label="订单备注" prop="remark">
                 <el-input