Browse Source

成本设置完成

谢杰标 2 years ago
parent
commit
178ee89a73

+ 10 - 2
src/api/financed/index.js

@@ -236,14 +236,22 @@ export function supplierBatchCost(data) {
   });
 }
 
-// 成本分类
-export function categoryList(query) {
+// 供应商成本分类
+export function instCategoryList(query) {
   return request({
     url: "/top/inst/category/list",
     method: "get",
     params: query,
   });
 }
+// 机构成本分类
+export function categoryList(query) {
+  return request({
+    url: "/top/category/list",
+    method: "get",
+    params: query,
+  });
+}
 // 供应商状态
 export function instDefaultStatus(data) {
   return request({

+ 1 - 3
src/components/BaseDialog.vue

@@ -103,12 +103,10 @@ export default {
 
   watch: {
     visible(val) {
-      // 在此做显示与隐藏的交互
       if (val === false) {
         this.fullscreen = false
-        // 重置操作
       } else {
-        // 展示时操作
+        this.$emit("open");
       }
     },
   },

+ 2 - 2
src/utils/request.js

@@ -7,9 +7,9 @@ import { paramMate } from "@/utils/common";
 
 axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
 // 创建axios实例
-export const baseURL = process.env.VUE_APP_BASE_API
+// export const baseURL = process.env.VUE_APP_BASE_API
 // export const baseURL = 'https://ptapi.gdzzkj.net/'
-// export const baseURL = "http://192.168.1.7:7077/";
+export const baseURL = "http://192.168.1.24:7077/";
 export const BASE_IMG_URL = process.env.VUE_APP_IMG_API;
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分

+ 22 - 6
src/views/financed/costSet/dislogOrganSet.vue

@@ -6,6 +6,7 @@
       :title="title"
       @close="close"
       @submit="submitForm"
+      @open="init"
     >
       <div class="bop-tip">
         <div><i class="el-icon-warning-outline"></i>说明</div>
@@ -125,8 +126,12 @@
             :rules="rules['itemType']"
           >
             <el-select v-model="item.itemType" placeholder="请选择成本类型">
-              <el-option label="百分比成本" :value="1"></el-option>
-              <el-option label="固定成本" :value="2"></el-option>
+              <el-option
+                :label="item.categoryName"
+                :value="item.categoryId"
+                v-for="item in categoryList"
+                :key="item.categoryId"
+              ></el-option>
             </el-select>
           </el-form-item>
           <el-form-item
@@ -246,7 +251,13 @@
 </template>
 
 <script>
-import { eduList, addCost, costDetail, editCost } from "@/api/financed/index";
+import {
+  eduList,
+  addCost,
+  costDetail,
+  editCost,
+  categoryList,
+} from "@/api/financed/index";
 export default {
   name: "DislogSet",
   props: {
@@ -367,6 +378,7 @@ export default {
       },
       tenantList: [],
       eduList: [],
+      categoryList: [],
     };
   },
   methods: {
@@ -378,9 +390,16 @@ export default {
       } else {
         this.tpId && this.getCostDetail();
       }
+      this.getCategoryList();
       this.getTenantList();
       this.getEduList();
     },
+    getCategoryList() {
+      categoryList().then((res) => {
+        this.categoryList = res.rows;
+        console.log(this.categoryList, "this.categoryList");
+      });
+    },
     getOrderCostDetail() {
       this.$api.systemtopordercost(this.tpId).then((res) => {
         Object.keys(this.form).map((key) => {
@@ -551,9 +570,6 @@ export default {
   computed: {
     isShow: {
       get() {
-        if (this.dialogVisible) {
-          this.init();
-        }
         return this.dialogVisible;
       },
       set(val) {

+ 8 - 81
src/views/financed/costSet/dislogSupplierSet.vue

@@ -1,11 +1,12 @@
 <template>
   <div>
     <BaseDialog
-      width="1200px"
+      width="1100px"
       :isShow.sync="isShow"
       :title="title"
       @close="close"
       @submit="submitForm"
+      @open="init"
     >
       <div class="bop-tip">
         <div>
@@ -171,7 +172,7 @@ import {
   addInstCost,
   costInstDetail,
   editInstCost,
-  categoryList,
+  instCategoryList,
 } from "@/api/financed/index";
 export default {
   name: "DislogSet",
@@ -246,43 +247,21 @@ export default {
   methods: {
     init() {
       this.resetForm();
-      if (this.type === 3) {
-        this.getOrdercostInstDetail();
-      } else if (this.type === 4) {
-      } else {
-        this.tpId && this.getcostInstDetail();
-      }
+      this.tpId && this.getcostInstDetail();
       this.getEduList();
       this.getCategoryList();
     },
     getCategoryList() {
-      categoryList().then((res) => {
+      instCategoryList().then((res) => {
         this.categoryList = res.rows;
       });
     },
-    getOrdercostInstDetail() {
-      this.$api.systemtopordercost(this.tpId).then((res) => {
-        Object.keys(this.form).map((key) => {
-          this.form[key] = res.data[key];
-        });
-        this.form.itemList.forEach((ele) => {
-          if (ele.maxValue == -1) {
-            ele.maxValue = "*";
-          }
-        });
-      });
-    },
     getcostInstDetail() {
       costInstDetail(this.tpId).then((res) => {
         if (this.type == 2) delete this.form["tpId"];
         Object.keys(this.form).map((key) => {
           this.form[key] = res.data[key];
         });
-        this.form.itemList.forEach((ele) => {
-          if (ele.maxValue == -1) {
-            ele.maxValue = "*";
-          }
-        });
       });
     },
     getEduList() {
@@ -346,70 +325,20 @@ export default {
     submitForm() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          if (this.type === 3 || this.type === 4) {
-            this.$api
-              .systemtoporderupdatecost({
-                costTpVo: form,
-                orderSnList:
-                  this.type === 3 ? [this.tpId] : this.tpId?.split(","),
-              })
-              .then(this.cb);
-          } else if (this.type !== 1) {
+          if (this.type !== 1) {
             addInstCost(this.form).then(this.cb);
           } else {
-            editInstCost(form).then(this.cb);
+            editInstCost(this.form).then(this.cb);
           }
         } else {
           return false;
         }
       });
     },
-    changeMaxValue(prop) {
-      this.$refs.form.validateField(prop);
-    },
-    // 阶梯校验
-    isHaveIntersect(list) {
-      const isEmpty = list.some((e) => !e.minValue && !e.maxValue);
-      if (isEmpty) {
-        return "非阶梯计价只能存在一个";
-      }
-      let maxList = list.filter((e) => e.maxValue === "*");
-      if (maxList.length > 1) {
-        return "阶梯计价存在范围冲突";
-      }
-      list.sort((a, b) => {
-        if (a.maxValue == "*") {
-          return Number.MAX_VALUE;
-        }
-        if (b.maxValue == "*") {
-          return -Number.MAX_VALUE;
-        }
-        return a.minValue - b.minValue;
-      });
-      for (let i = 0, len = list.length - 1; i < len; i++) {
-        if (list[i].maxValue >= list[i + 1].minValue) {
-          return "阶梯计价存在范围冲突";
-        }
-      }
-      return;
-    },
-    regValue(data) {
-      let { maxValue } = data;
-      let val;
-      if (maxValue.includes("*")) {
-        val = "*";
-      } else {
-        val = maxValue.replace(/[^0-9]/g, "");
-      }
-      data.maxValue = val;
-    },
   },
   computed: {
     isShow: {
       get() {
-        if (this.dialogVisible) {
-          this.init();
-        }
         return this.dialogVisible;
       },
       set(val) {
@@ -417,9 +346,7 @@ export default {
       },
     },
     title() {
-      return ["新增", "修改", "复制", "订单成本设置", "批量成本设置"][
-        this.type
-      ];
+      return ["新增", "修改", "复制"][this.type];
     },
     itemList() {
       return this.form.itemList;

+ 5 - 1
src/views/financed/costSet/supplier.vue

@@ -36,7 +36,10 @@
         <el-button type="text" @click="handelClick(1, props.scope.row.tpId)"
           >修改</el-button
         >
-        <el-button type="text" @click="handelDel(props.scope.row.tpId)"
+        <el-button
+          style="color: #ffba00"
+          type="text"
+          @click="handelDel(props.scope.row.tpId)"
           >删除</el-button
         >
       </template>
@@ -84,6 +87,7 @@ export default {
         addHide: true,
         openCheckMore: true,
         custom: false,
+        changeWidth: "300px",
       },
       formList: [
         {