戴艳蓉 3 years ago
parent
commit
8b58c37884

+ 6 - 0
src/components/globalComponents/file-upload-pdf/main.vue

@@ -7,6 +7,7 @@
       class="fileUp"
       type="file"
       name="file"
+      :disabled="disabled"
       @change="handleChange($event)"
     />
   </div>
@@ -30,6 +31,11 @@ export default {
       default: false,
     },
     size: "mini",
+    disabled: {
+      //是否禁用
+      type: Boolean,
+      default: false,
+    },
     uploadcondition: {
       type: Function,
       default: null,

+ 1 - 1
src/components/globalComponents/file-upload/main.vue

@@ -31,7 +31,7 @@ export default {
       default: false,
     },
     disabled: {
-      //是否可以上传多张图片
+      //是否禁用
       type: Boolean,
       default: false,
     },

+ 93 - 72
src/views/sellOut/stockApply/components/addEdit.vue

@@ -11,7 +11,7 @@
     >
       <el-row>
         <el-col :span="12">
-          <el-form-item label="商品名称" prop="goods_name">
+          <el-form-item label="商品名称" prop="good_name">
             <el-input
               :disabled="
                 !(
@@ -19,7 +19,7 @@
                   (status === '0' && powers.some((item) => item == '005'))
                 )
               "
-              v-model="ruleForm.goods_name"
+              v-model="ruleForm.good_name"
               readonly="true"
               :placeholder="'商品名称'"
               @focus="showGoodsModel = true"
@@ -29,16 +29,25 @@
         <!-- 采购数量 -->
         <el-col :span="5">
           <el-form-item label="采购数量" prop="goods_num">
-            <el-input
+            <digital-input
+              :values="ruleForm.goods_num"
+              :name="'ruleForm.goods_num'"
+              :placeholder="'采购数量'"
+              :min="0"
               :disabled="
                 !(
                   id === 'add' ||
                   (status === '0' && powers.some((item) => item == '005'))
                 )
               "
-              v-model="ruleForm.goods_num"
-              placeholder="采购数量"
-            ></el-input>
+              :max="100000000000"
+              :position="'right'"
+              :precision="0"
+              :size="'mini'"
+              :controls="false"
+              :append="''"
+              @reschange="number_change($event, 'goods_num')"
+            />
           </el-form-item>
         </el-col>
         <!-- 最晚入库时间 -->
@@ -50,9 +59,9 @@
           >
             <el-date-picker
               v-model="ruleForm.lasttime"
-              type="datetime"
+              type="date"
               style="width: 100%"
-              value-format="yyyy-MM-dd HH:mm:ss"
+              value-format="yyyy-MM-dd"
               placeholder="最晚入库时间"
               :picker-options="pickerOptions"
               :disabled="
@@ -77,24 +86,32 @@
               }"
             >
               <p v-if="ruleForm.file_url">
-                {{ ruleForm.file_url_name }}
+                <el-link :underline="false" :href="ruleForm.file_url" target="_blank">{{
+                  ruleForm.file_url_name
+                }}</el-link>
+                <el-link class="fr" type="info" :underline="false"
+                  ><i
+                    class="el-icon-circle-close"
+                    @click="close_url"
+                    :size="'mini'"
+                  ></i
+                ></el-link>
               </p>
               <p v-else class="no">附件</p>
-              <file-upload-pdf
-                v-if="
-                  id === 'add' ||
-                  (status === '0' && powers.some((item) => item == '005'))
-                "
-                class="Upload"
-                :accept="'.pdf'"
-                :multiple="false"
-                :size="'mini'"
-                :uploadcondition="beforeAvatarUpload"
-                @UploadErrorEvent="UploadErrorEvent"
-                @UploadSuccessEvent="UploadSuccessEvent"
-              />
-              <div class="yulan" v-if="ruleForm.file_url" @click="PDFModelShow">
-                查看
+              <div v-if="ruleForm.file_url === ''">
+                <file-upload-pdf
+                  v-if="
+                    id === 'add' ||
+                    (status === '0' && powers.some((item) => item == '005'))
+                  "
+                  class="Upload"
+                  :accept="'.pdf'"
+                  :multiple="false"
+                  :size="'mini'"
+                  :uploadcondition="beforeAvatarUpload"
+                  @UploadErrorEvent="UploadErrorEvent"
+                  @UploadSuccessEvent="UploadSuccessEvent"
+                />
               </div>
             </div>
           </el-form-item>
@@ -105,7 +122,7 @@
               type="textarea"
               :rows="2"
               placeholder="备注"
-              v-model="remark"
+              v-model="ruleForm.remark"
             >
             </el-input>
           </el-form-item>
@@ -130,14 +147,13 @@
       :cat_id="cat_id"
       :show-model="showGoodsModel"
       @cancel="showGoodsModel = false"
-      @searchChange="addGoodsRes"
+      @resultList="addGoodsRes"
     />
   </div>
 </template>
    <script>
 import resToken from "@/mixins/resToken";
 import asyncRequest from "@/apis/service/sellOut/stockApply";
-import { isnumber } from "@/utils/validate";
 import searchGoodModal from "@/components/search-good-modal";
 export default {
   name: "stockApply",
@@ -167,15 +183,21 @@ export default {
     },
   },
   data() {
-    const validateWeight = (rule, value, callback) => {
-      if (value === "") {
-        callback(new Error("不能为空!"));
+    const validate_num_0 = (rule, value, callback) => {
+      const { required } = rule;
+      if (required && value === "") {
+        callback(new Error("不能为空!"));
+      } else if (
+        required &&
+        (value === "0" ||
+          value === "0." ||
+          value === "0.0" ||
+          value === "0.00" ||
+          value === "0.000")
+      ) {
+        callback(new Error("不能为零!"));
       } else {
-        if (!isnumber(value)) {
-          callback(new Error("仅支持整数!"));
-        } else {
-          callback();
-        }
+        callback();
       }
     };
     return {
@@ -194,8 +216,7 @@ export default {
       ruleForm: {
         id: "",
         good_code: "",
-        good_type_code: "",
-        goods_name: "",
+        good_name: "",
         goods_num: "",
         file_url: "",
         file_url_name: "",
@@ -207,7 +228,7 @@ export default {
       },
       rulesThis: this.rules,
       rules: {
-        goods_name: [
+        good_name: [
           {
             required: true,
             message: "商品名称不能为空!",
@@ -217,14 +238,14 @@ export default {
         goods_num: [
           {
             required: true,
-            validator: validateWeight,
+            validator: validate_num_0,
             trigger: "blur",
           },
         ],
         lasttime: [
           {
             required: true,
-            message: "请输入入库最晚时间!",
+            message: "请输入最晚入库时间!",
             trigger: "change",
           },
         ],
@@ -261,16 +282,24 @@ export default {
 
     // 执行点击商品名称的抛出事件
     addGoodsRes(e) {
-      let { spuCode, type_code, good_name } = e[0];
-      this.ruleForm.goods_name = good_name;
-      this.ruleForm.good_type_code = type_code;
+      console.log(e);
+      let { spuCode, good_name } = e[0];
+      this.ruleForm.good_name = good_name;
       this.ruleForm.good_code = spuCode;
-      this.$refs.ruleForm.validateField("goods_name");
+      this.$refs.ruleForm.validateField("good_name");
+    },
+    number_change(e, key) {
+      this.ruleForm[key] = e + "" || "0";
+      this.$refs.ruleForm.validateField(key);
     },
-
     closeModel() {
       this.$emit("closeModel");
     },
+    close_url() {
+      this.ruleForm.file_url_name = "";
+      this.ruleForm.file_url = "";
+      this.$refs.ruleForm.validateField("file_url");
+    },
     // 重置
     async resetForm() {
       // 重置
@@ -282,28 +311,23 @@ export default {
             const {
               id,
               good_code,
-              good_type_code,
               good_name, //商品名
               good_num, //采购数量
               lasttime, //最晚入库时间
               file_url,
               file_name,
-              // wsm_code, //仓库名
               status,
-              // 缺供应商
             } = this.sitem;
 
             this.ruleForm = {
-              id,
-              good_code,
-              good_type_code,
-              goods_name: good_name,
-              goods_num: good_num,
-              lasttime: lasttime,
+              id: id || "",
+              good_code: good_code || "",
+              good_name: good_name || "",
+              goods_num: good_num || "0",
+              lasttime: lasttime || "",
               file_url: file_url || "",
               file_url_name: file_name || "",
-
-              status,
+              status: status || "",
             };
           }
         }
@@ -320,7 +344,7 @@ export default {
             good_type_code,
             goods_num,
             file_url,
-            file_name,
+            // file_name,
             // stock_code,
             lasttime,
           } = this.ruleForm;
@@ -330,10 +354,7 @@ export default {
             good_type_code,
             good_num: goods_num || "",
             file_url: file_url || "",
-            file_url_name: file_name || "",
-            // wsm_code:
-            //   this.id == "add" ? stock_code.toString() : stock_code.toString(),
-
+            // file_url_name: file_name || "",
             lastime: lasttime || "",
           };
           let res = {};
@@ -363,26 +384,26 @@ export default {
         }
       });
     },
-    //图片上传失败
+    //附件上传失败
     async UploadErrorEvent(e) {
-      if (e) {
+      if (e !== "break") {
         this.$message.error("附件上传失败!");
         this.$refs.ruleForm.validateField("file_url");
-      } else {
-        await this.logout();
       }
     },
-    //图片上传成功
-    UploadSuccessEvent(data) {
-      if (data && data.url && data.url !== "break") {
-        const { url, name } = data.url;
+    //附件上传成功
+    async UploadSuccessEvent(data) {
+      const { url, name } = data;
+      if (url === "noToken") {
+        await this.logout();
+      } else {
         this.ruleForm.file_url_name = name;
         this.ruleForm.file_url = url;
         this.$message.success("附件上传成功!");
         this.$refs.ruleForm.validateField("file_url");
       }
     },
-    //判断图片规格
+    //判断附件规格
     beforeAvatarUpload(file) {
       let isJPG = false,
         isLt2M = false;
@@ -392,10 +413,10 @@ export default {
         }
         isLt2M = file.size / 1024 / 1024 < 1;
         if (!isJPG) {
-          this.$message.error("图片格式不正确!");
+          this.$message.error("附件格式不正确!");
         }
         if (!isLt2M) {
-          this.$message.error("图片大小不能超过 1MB!");
+          this.$message.error("附件大小不能超过 1MB!");
         }
       }
 

+ 15 - 87
src/views/sellOut/zixunOrder/index.vue

@@ -49,7 +49,7 @@
               </el-col>
               <el-col :span="4" style="width: 380px; padding: 0px 0 0 10px">
                 <search-customer
-                  :value="customerCode"
+                  :value="parmValue.khNo"
                   :size="searchSize"
                   :placeholder="'企业客户'"
                   @searchChange="customerChange"
@@ -110,15 +110,6 @@
                     <el-option label="商品名称" value="2" />
                     <el-option label="申请人" value="3" />
                   </el-select>
-                  <el-button
-                    slot="append"
-                    icon="el-icon-search"
-                    @click="
-                      pageInfo.curr = 1;
-                      parmValue.page = 1;
-                      searchList();
-                    "
-                  ></el-button>
                 </el-input>
               </el-col>
 
@@ -250,7 +241,6 @@ export default {
     return {
       select: "1",
       s_input: "",
-      customerCode: [], //客户公司code
       options: [
         { id: "0", label: "待发布竞标" },
         { id: "1", label: "招标进行中" },
@@ -281,7 +271,7 @@ export default {
       isDetail: false,
       modelId: 0,
       parmValue: {
-        khNo: "",
+        khNo: [],
         zxNo: "",
         salesman: "",
         cpName: "",
@@ -315,11 +305,10 @@ export default {
 
   methods: {
     restSearch() {
-      this.customerCode = [];
       this.select = "1";
       this.s_input = "";
       this.parmValue = {
-        khNo: "",
+        khNo: [],
         zxNo: "",
         salesman: "",
         cpName: "",
@@ -344,34 +333,7 @@ export default {
       this.isDetail = isDetail;
       this.sitem = sitem;
     },
-    async deleteById(id, status) {
-      await this.$confirm("确定要删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          const model = {
-            id: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.$notify.success({
-              title: "删除成功",
-              message: "",
-            });
-            this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
+
     // 列表搜索
     async searchList() {
       if (this.parmValue.start !== "" && this.parmValue.end === "") {
@@ -383,13 +345,14 @@ export default {
         return;
       }
       this.loading = true;
-      this.parmValue.returnCode = this.select === "1" ? this.s_input : "";
-      this.parmValue.orderCode = this.select === "2" ? this.s_input : "";
-      this.parmValue.outCode = this.select === "3" ? this.s_input : "";
-      this.parmValue.good_code = this.select === "4" ? this.s_input : "";
-      this.parmValue.good_name = this.select === "5" ? this.s_input : "";
-      this.parmValue.apply_name = this.select === "6" ? this.s_input : "";
-      const res = await asyncRequest.list(this.parmValue);
+      let model = JSON.parse(JSON.stringify(this.parmValue));
+      model.khNo =
+        model.khNo.length > 0 ? model.khNo[model.khNo.length - 1] : "";
+      model.zxNo = this.select === "1" ? this.s_input : "";
+      model.cpName = this.select === "2" ? this.s_input : "";
+      model.salesman = this.select === "3" ? this.s_input : "";
+
+      const res = await asyncRequest.list(model);
       if (res && res.code === 0 && res.data) {
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
@@ -402,37 +365,7 @@ export default {
       this.loading = false;
     },
 
-    async statusConfirm(id, status) {
-      let str = status === "1" ? "禁用" : "启用";
-      await this.$confirm("确定要改为" + str + "?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          this.loading = true;
-          const model = {
-            id: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.loading = false;
-            this.$notify.success({
-              title: "状态修改成功!",
-              message: "",
-            });
-            await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
+   
     // 时间选择事件
     async handleTime(e) {
       if (e.startTime !== "") {
@@ -452,13 +385,8 @@ export default {
       }
     },
     async customerChange(e) {
-      if (e && e.id) {
-        this.customerCode = [e.code];
-        this.parmValue.customer_code = e.code;
-      } else {
-        this.customerCode = [];
-        this.parmValue.customer_code = "";
-      }
+      const { code } = e;
+      this.parmValue.khNo = code ? [code] : [];
       this.pageInfo.curr = 1;
       this.parmValue.page = 1;
       await this.searchList();