Browse Source

提交研发动力和研发燃料页面

ljb 9 months ago
parent
commit
a6562d7b17

+ 15 - 3
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/components/common-list.vue

@@ -12,12 +12,23 @@
 <script>
 export default {
   props: {
+    type: String,
     data: {
       type: Array,
       default: () => []
     }
   },
   data() {
+    console.log(this.type)
+    let codeLabel = '材料编号';
+    let nameLabel = '材料名称';
+    if (this.type === '动力') {
+      codeLabel = '动力编号';
+      nameLabel = '动力名称';
+    } else if (this.type === '燃料') {
+      codeLabel = '燃料编号';
+      nameLabel = '燃料名称';
+    }
     return {
       options: {
         tip: false,
@@ -49,14 +60,14 @@ export default {
             showOverflowTooltip: true,
           },
           {
-            label: "材料编号",
+            label: codeLabel,
             prop: "code",
             width: 120,
             align: "center",
             showOverflowTooltip: true,
           },
           {
-            label: "材料名称",
+            label: nameLabel,
             prop: "name",
             minWidth: 140,
             showOverflowTooltip: true,
@@ -67,6 +78,7 @@ export default {
             width: 120,
             align: "center",
             showOverflowTooltip: true,
+            hide: this.type === '材料' ? false : true,
           },
           {
             label: "单位",
@@ -83,7 +95,7 @@ export default {
             showOverflowTooltip: true,
           },
           {
-            label: "领用数量",
+            label: this.type === "动力" ? "数量" : "领用数量",
             prop: "useQuantity",
             width: 120,
             align: "center",

+ 144 - 0
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/components/common-page.vue

@@ -0,0 +1,144 @@
+<template>
+  <basic-container v-loading="loading">
+    <avue-form ref="searchForm" v-model="params" :option="searchOption" class="cl-search-form">
+      <template slot="useDate">
+        <span>日期:</span>
+        <el-date-picker
+          v-model="params.useDateRange"
+          type="daterange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          value-format="yyyy-MM-dd"
+          style="width: 220px !important;"
+        >
+        </el-date-picker>
+      </template>
+      <template slot-scope="{size}" slot="menuForm">
+        <el-button type="primary" :size="size" icon="el-icon-search" @click="handleSearchBtn">查询</el-button>
+        <el-button :size="size" icon="el-icon-delete" @click="handleResetBtn">清空</el-button>
+      </template>
+    </avue-form>
+    <div style="display: flex; align-items: center;">
+      <year-month-select v-model="yearAndMonth" :showAllYear="false" style="margin: 6px 0 20px;"></year-month-select>
+    </div>
+    <template v-if="listData.length">
+      <common-list v-for="(item, index) of listData" :data="item" :type="type" :key="index" style="margin-bottom: 25px;"></common-list>
+    </template>
+    <el-empty v-else description="暂无数据"></el-empty>
+  </basic-container>
+</template>
+
+<script>
+import YearMonthSelect from "@/components/year-month-select";
+import commonList from "./common-list.vue";
+import { getList } from "@/api/yfCostManage/yfCostStatistics/clCost"
+import moment from "moment";
+
+export default {
+  props: {
+    type: {
+      type: String,
+      // 材料、动力、燃料
+      default: "材料"
+    }, 
+  },
+  components: {
+    YearMonthSelect,
+    commonList
+  },
+  data() {
+    return {
+      loading: false,
+      searchOption: {
+        submitBtn:false,
+        emptyBtn:false,
+        column: [{
+          label: '项目名称',
+          prop: 'xmmc',
+          type: 'input',
+        }, {
+          label: '材料名称',
+          prop: 'name',
+        }, {
+          label: '型号规格',
+          prop: 'model',
+          display: this.type === '材料' ? true : false,
+        }, {
+          label: '日期',
+          prop: 'useDate',
+          type: 'date',
+        }]
+      },
+      listData: [],
+
+      yearAndMonth: moment(new Date()).format('YYYYMM'),
+      params: {},
+    }
+  },
+  watch: {
+    yearAndMonth() {
+      this.loadData();
+    }
+  },
+  mounted() {
+    this.loadData();
+  },
+  methods: {
+    loadData() {
+      let params = { ...this.params };
+      if (params.useDateRange && params.useDateRange.length) {
+        params.dateMin = params.useDateRange[0];
+        params.dateMax = params.useDateRange[1];
+      }
+      delete params.useDateRange;
+      this.loading = true;
+      getList({
+        ...params,
+        yearAndMonth: this.yearAndMonth,
+        type: this.type,
+      }).then(({ data }) => {
+        this.loading = false;
+        if (data.code == 200) {
+          let allList = [];
+          data.data.map(item => {
+            Object.keys(item).map(key => {
+              allList.push(item[key]);
+            });
+          });
+
+          this.listData = allList;
+        }
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+    handleSearchBtn() {
+      this.loadData();
+    },
+    handleResetBtn() {
+      this.params = {};
+      this.$refs.searchForm.resetForm();
+      this.loadData();
+    },
+  },
+}
+</script>
+
+<style lang="scss">
+.cl-search-form {
+  .el-form-item--small .el-form-item__label {
+    display: none;
+  }
+  .el-form-item--small .el-form-item__content {
+    margin-left: 8px !important;
+  }
+  .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item  {
+    margin-bottom: 6px;
+  }
+  .avue-form__group .el-col {
+    width: auto !important;
+    padding-top: 0 !important;
+  }
+}
+</style>

+ 13 - 0
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/power-use-list.vue

@@ -0,0 +1,13 @@
+<template>
+  <common-page type="动力"></common-page>
+</template>
+
+<script>
+import commonPage from './components/common-page.vue';
+
+export default {
+  components: {
+    commonPage
+  }
+}
+</script>

+ 13 - 0
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/yf-fuel-use-list.vue

@@ -0,0 +1,13 @@
+<template>
+  <common-page type="燃料"></common-page>
+</template>
+
+<script>
+import commonPage from './components/common-page.vue';
+
+export default {
+  components: {
+    commonPage
+  }
+}
+</script>

+ 0 - 0
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/yf-material-use-details.vue


+ 4 - 124
src/views/yf-cost-manage/yf-cost-statistics/zjtl-cost-statistics/cl-cost/yf-picking-list.vue

@@ -1,133 +1,13 @@
 <template>
-  <basic-container v-loading="loading">
-    <avue-form ref="searchForm" v-model="params" :option="searchOption" class="cl-search-form">
-      <template slot="useDate">
-        <span>日期:</span>
-        <el-date-picker
-          v-model="params.useDateRange"
-          type="daterange"
-          range-separator="至"
-          start-placeholder="开始日期"
-          end-placeholder="结束日期"
-          value-format="yyyy-MM-dd"
-          style="width: 220px !important;"
-        >
-        </el-date-picker>
-      </template>
-      <template slot-scope="{size}" slot="menuForm">
-        <el-button type="primary" :size="size" icon="el-icon-search" @click="handleSearchBtn">查询</el-button>
-        <el-button :size="size" icon="el-icon-delete" @click="handleResetBtn">清空</el-button>
-      </template>
-    </avue-form>
-    <div style="display: flex; align-items: center;">
-      <year-month-select v-model="yearAndMonth" :showAllYear="false" style="margin: 6px 0 20px;"></year-month-select>
-    </div>
-    <common-list v-for="(item, index) of listData" :data="item" :key="index" style="margin-bottom: 25px;"></common-list>
-  </basic-container>
+  <common-page type="材料"></common-page>
 </template>
 
 <script>
-import YearMonthSelect from "@/components/year-month-select";
-import commonList from "./components/common-list.vue";
-import { getList } from "@/api/yfCostManage/yfCostStatistics/clCost"
+import commonPage from './components/common-page.vue';
 
 export default {
   components: {
-    YearMonthSelect,
-    commonList
-  },
-  data() {
-    return {
-      loading: false,
-      searchOption: {
-        submitBtn:false,
-        emptyBtn:false,
-        column: [{
-          label: '项目名称',
-          prop: 'xmmc',
-          type: 'input',
-        }, {
-          label: '材料名称',
-          prop: 'name',
-        }, {
-          label: '型号规格',
-          prop: 'model',
-        }, {
-          label: '日期',
-          prop: 'useDate',
-          type: 'date',
-        }]
-      },
-      listData: [],
-
-      yearAndMonth: '202507',
-      type: '材料',
-      params: {},
-    }
-  },
-  watch: {
-    yearAndMonth() {
-      this.loadData();
-    }
-  },
-  mounted() {
-    this.loadData();
-  },
-  methods: {
-    loadData() {
-      let params = { ...this.params };
-      if (params.useDateRange && params.useDateRange.length) {
-        params.dateMin = params.useDateRange[0];
-        params.dateMax = params.useDateRange[1];
-      }
-      delete params.useDateRange;
-      this.loading = true;
-      getList({
-        ...params,
-        yearAndMonth: this.yearAndMonth,
-        type: this.type,
-      }).then(({ data }) => {
-        this.loading = false;
-        if (data.code == 200) {
-          let allList = [];
-          data.data.map(item => {
-            Object.keys(item).map(key => {
-              allList.push(item[key]);
-            });
-          });
-
-          this.listData = allList;
-        }
-      }).catch(() => {
-        this.loading = false;
-      });
-    },
-    handleSearchBtn() {
-      this.loadData();
-    },
-    handleResetBtn() {
-      this.params = {};
-      this.$refs.searchForm.resetForm();
-      this.loadData();
-    },
-  },
-}
-</script>
-
-<style lang="scss">
-.cl-search-form {
-  .el-form-item--small .el-form-item__label {
-    display: none;
-  }
-  .el-form-item--small .el-form-item__content {
-    margin-left: 8px !important;
-  }
-  .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item  {
-    margin-bottom: 6px;
-  }
-  .avue-form__group .el-col {
-    width: auto !important;
-    padding-top: 0 !important;
+    commonPage
   }
 }
-</style>
+</script>