Przeglądaj źródła

预销售单优化;

yijing 1 rok temu
rodzic
commit
cfb0933883

+ 16 - 2
src/main.js

@@ -5,7 +5,10 @@ import App from './App.vue';
 import store from './store';
 import router from './router';
 import permission from './utils/permission';
-import { MAP_KEY, LICENSE_CODE } from '@/config/setting';
+import {
+  MAP_KEY,
+  LICENSE_CODE
+} from '@/config/setting';
 import EleAdmin from 'ele-admin';
 import VueClipboard from 'vue-clipboard2';
 import i18n from './i18n';
@@ -29,6 +32,14 @@ import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';
 import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css';
 import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css';
 
+import {
+  handleInputPublicHasPoint,
+  handleInputPublic
+} from './utils/inputHandler';
+
+Vue.prototype.$handleInputPublicHasPoint = handleInputPublicHasPoint;
+Vue.prototype.$handleInputPublic = handleInputPublic;
+
 // // register globally
 import '@/icons';
 Vue.component('DictSelection', DictSelection);
@@ -47,7 +58,10 @@ Vue.use(VueClipboard);
 let instance = null;
 
 function render(props = {}) {
-  const { container, routerBase } = props;
+  const {
+    container,
+    routerBase
+  } = props;
   // const router = new VueRouter({
   //   base: window.__POWERED_BY_QIANKUN__ ? routerBase : process.env.BASE_URL,
   //   mode: 'history',

+ 28 - 0
src/utils/inputHandler.js

@@ -0,0 +1,28 @@
+/**
+ * 处理输入值,使其只包含数字和最多一个小数点,并且小数点后最多保留两位
+ * @param {string} value - 输入的值
+ * @returns {string} - 处理后的值
+ */
+
+//小数点后两位处理
+export const handleInputPublicHasPoint = (value) => {
+  // 过滤掉非数字和小数点的字符
+  const filteredValue = value.replace(/[^0-9.]/g, '');
+  // 限制只能有一个小数点
+  const singleDotValue = filteredValue.replace(/(\..*)\./g, '$1');
+
+  let finalValue = '';
+  const dotIndex = singleDotValue.indexOf('.');
+  if (dotIndex !== -1) {
+    // 截取小数点后最多两位
+    finalValue = singleDotValue.slice(0, dotIndex + 3);
+  } else {
+    finalValue = singleDotValue;
+  }
+  return finalValue;
+};
+//整数
+export const handleInputPublic = (value) => {
+  // 只能输入数字
+  return value.replace(/[^0-9]/g, '');
+};

+ 28 - 16
src/views/aps/capacity/index.vue

@@ -29,8 +29,8 @@
             @click="handleUpdate">修改</el-button>
           <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
             @click="handleDelete">删除</el-button>
-          <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-            :disabled="single">详情</el-button>
+          <!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+            :disabled="single">详情</el-button> -->
         </template>
         <template v-slot:plannedCapacity="{ row }">
           {{ row.plannedCapacity }}{{ row.plannedCapacityUnit ? row.plannedCapacityUnit : '' }}
@@ -39,6 +39,9 @@
           {{ row.averageDailyCapacity }}{{ row.plannedCapacityUnit ? row.plannedCapacityUnit : '' }}
         </template>
         <template v-slot:action="{ row }">
+          <el-link type="primary" :underline="false" @click="handleExport(row)">
+            详情
+          </el-link>
           <el-link type="primary" :underline="false" icon="el-icon-edit" @click="handleUpdate(row)">
             修改
           </el-link>
@@ -76,7 +79,8 @@
           </el-form-item>
           <el-form-item label="规划产能" prop="plannedCapacity">
             <div style="display: flex;align-items: center;justify-content: space-between;">
-              <el-input v-model="form.plannedCapacity" placeholder="请输入规划产能" style="width: calc(100% - 300px)" />
+              <el-input v-model="form.plannedCapacity" placeholder="请输入规划产能" style="width: calc(100% - 300px)"
+                @input="handleInput1" />
 
               <el-select v-model="form.measureType" placeholder="计量类型">
                 <el-option v-for="item in measureTypeList" :key="item.value" :label="item.label"
@@ -93,7 +97,7 @@
             </div>
           </el-form-item>
           <el-form-item label="工作日天数" prop="expandedCapacity">
-            <el-input v-model="form.expandedCapacity" placeholder="请输入工作日天数">
+            <el-input v-model="form.expandedCapacity" placeholder="请输入工作日天数" @input="handleInput2">
               <template v-slot:append>天</template>
             </el-input>
           </el-form-item>
@@ -105,17 +109,17 @@
           <el-button @click="cancel">取 消</el-button>
         </div>
       </el-dialog>
-      <el-dialog :title="titleDetail" :visible.sync="openDetail" width="75%" append-to-body>
-        <el-table v-loading="loading" :data="factory_capacity_detailList" @selection-change="handleSelectionChange">
-          <el-table-column type="selection" width="55" align="center" />
+      <el-dialog :title="titleDetail" :visible.sync="openDetail" width="65%" append-to-body>
+        <el-table v-loading="loading" :data="factory_capacity_detailList" height="550">
+
           <el-table-column label="序号" align="center" prop="id" />
           <el-table-column label="年份" align="center" prop="year" />
           <el-table-column label="月份" align="center" prop="month" />
           <el-table-column label="日期" align="center" prop="day" />
           <el-table-column label="规划产能" align="center" prop="plannedCapacity" />
           <el-table-column label="已排产产能" align="center" prop="plannedSumCapacity" />
-          <el-table-column label="已排产单号" align="center" prop="plannedOrder" />
-          <el-table-column label="已排产产能" align="center" prop="plannedOrderCapacity" />
+          <el-table-column label="已排产单号" align="center" prop="plannedOrder" width="120" show-overflow-tooltip />
+          <el-table-column label="已排产产能" align="center" prop="plannedOrderCapacity" width="120" show-overflow-tooltip />
         </el-table>
       </el-dialog>
     </el-card>
@@ -243,7 +247,7 @@ export default {
         {
           columnKey: 'action',
           label: '操作',
-          width: 150,
+          width: 200,
           align: 'center',
           resizable: false,
           slot: 'action',
@@ -314,7 +318,8 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
+      this.queryParams.year = null;
+      this.queryParams.month = null;
       this.handleQuery();
     },
     // 多选框选中数据
@@ -372,23 +377,30 @@ export default {
       }).catch(() => { });
     },
     /** 导出按钮操作 */
-    handleExport() {
+    handleExport(row) {
       this.openDetail = true;
-      this.getDetailList();
+      this.getDetailList(row);
       // this.download('aps/capacity/export', {
       //   ...this.queryParams
       // }, `capacity_${new Date().getTime()}.xlsx`)
     },
     /** 查询工厂月产能定义列表 */
-    getDetailList() {
-      const ids = this.ids;
+    getDetailList(row) {
+      // const ids = this.ids;
+      console.log(row.id, 'dddd');
       this.loading = true;
-      listFactory_capacity_detail(this.queryParams).then(response => {
+      listFactory_capacity_detail({ factoriesId: row.factoriesId, year: row.year, month: row.month }).then(response => {
         this.factory_capacity_detailList = response.data;
         this.total = response.total;
         this.loading = false;
       });
     },
+    handleInput1(val) {
+      this.form.plannedCapacity = this.$handleInputPublicHasPoint(val);
+    },
+    handleInput2(val) {
+      this.form.expandedCapacity = this.$handleInputPublicHasPoint(val);
+    },
   }
 };
 </script>

+ 3 - 2
src/views/aps/presalesorder/index.vue

@@ -278,7 +278,7 @@ export default {
         },
         {
           prop: 'preSalesOrderNumber',
-          label: '销售订单',
+          label: '销售订单',
           showOverflowTooltip: true,
           align: 'center',
           width: 140,
@@ -460,7 +460,7 @@ export default {
       } else {
         ids = this.ids
       }
-      this.$confirm(`是否确认删除销售订单编号为"${ids}"的数据项?`, '提示')
+      this.$confirm(`是否确认删除该数据?`, '提示')
         .then(() => {
           delSalesorder({ ids: ids })
             .then(() => {
@@ -610,6 +610,7 @@ export default {
           this.$refs.uploadFile.clearFiles();
 
           this.upload.open = false;
+          this.reload();
         })
         .catch((data) => {
           if (data.code != -1) {