Selaa lähdekoodia

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_vue

ezhizao_zx 11 kuukautta sitten
vanhempi
commit
d12616a91f

+ 44 - 0
src/api/business/conversion.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+const baseUrl = import.meta.env.VITE_APP_BASE_API
+// 查询产品电子化率记录列表
+export function listConversion(query) {
+  return request({
+    url: baseUrl +'/business/conversion/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询产品电子化率记录详细
+export function getConversion(id) {
+  return request({
+    url: baseUrl +'/business/conversion/' + id,
+    method: 'get'
+  })
+}
+
+// 新增产品电子化率记录
+export function addConversion(data) {
+  return request({
+    url: baseUrl +'/business/conversion',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改产品电子化率记录
+export function updateConversion(data) {
+  return request({
+    url: baseUrl +'/business/conversion',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除产品电子化率记录
+export function delConversion(id) {
+  return request({
+    url: baseUrl +'/business/conversion/' + id,
+    method: 'delete'
+  })
+}

+ 173 - 0
src/views/business/conversion/form.vue

@@ -0,0 +1,173 @@
+<template>
+    <!-- 添加或修改项目信息对话框 -->
+    <div class="el-drawer__wrapper">
+        <el-drawer :title="title" v-model="visible" direction="rtl" size="100%">
+            <div class="page-container form-container">
+            <div class="form-btns-container">
+                    <span class="title-label"><el-icon>
+                            <Document />
+                        </el-icon> 项目信息</span>
+                <el-button-group>
+                    <el-button v-if="editStatus" type="primary" size="small" icon="Finished"
+                               @click="submitForm">保存</el-button>
+                    <el-button v-else type="warning" size="small" icon="Edit" @click="editStatus = true">编辑</el-button>
+                    <el-button v-if="form.id && editStatus" type="info" size="small" icon="Close"
+                               @click="editStatus = false">取消编辑</el-button>
+                    <el-button v-if="form.id" type="success" size="small" @click="getForm">
+                        <i class="fa fa-refresh" aria-hidden="true" /> 刷新
+                    </el-button>
+                </el-button-group>
+                <div class="screen-btn" @click="handleScreen">
+                    <template v-if="!isFullscreen">
+                        <i class="fa fa-window-maximize" aria-hidden="true" />
+                        <!-- <span>全屏</span> -->
+                    </template>
+                    <template v-else>
+                        <i class="fa fa-window-restore" aria-hidden="true" />
+                        <!-- <span>还原</span> -->
+                    </template>
+                </div>
+                <div class="close-btn" @click="cancel">
+                    <i class="fa fa-times" aria-hidden="true" />
+                    <!-- <span>关闭</span> -->
+                </div>
+            </div>
+            <div class="Y-scrollbar" style="position: absolute; top: 32px; bottom: 0; width: 100%; overflow: auto">
+            </div>
+            <el-form ref="conversionRef" class="master-container" :model="form" :rules="rules" label-width="120px">
+                <el-row :gutter="30">
+                                    <el-col :span="6">
+                                        <el-form-item label="日期" prop="date">
+                                            <el-date-picker v-if="editStatus" clearable
+                                                            v-model="form.date"
+                                                            type="date"
+                                                            value-format="YYYY-MM-DD"
+                                                            placeholder="请选择日期">
+                                            </el-date-picker>
+                                            <span v--else>{{ form.date }}</span>
+                                        </el-form-item>
+                                    </el-col>
+                                    <el-col :span="6">
+                                        <el-form-item label="电子化率基数" prop="number">
+                                            <el-input  v-if="editStatus" v-model="form.number" placeholder="请输入电子化率基数" />
+                                            <span v-else>{{ form.number }}</span>
+                                        </el-form-item>
+                                    </el-col>
+                </el-row>
+            </el-form>
+            </div>
+        </el-drawer>
+    </div>
+</template>
+<script setup>
+    import {getConversion,addConversion,updateConversion} from "@/api/business/conversion";
+    const { proxy } = getCurrentInstance()
+    /** 父组件传参 */
+    const props = defineProps({
+        getList: {
+            type: Function,
+            default: () => { }
+        }
+    })
+    const { getList } = toRefs(props)
+    /** 字典数组区 */
+    /** 表单抽屉 页变量 */
+    const title = ref("")
+    const loading = ref(false)
+    const multiple = ref(true)
+    const visible = ref(false)
+    const editStatus = ref(false)
+    const isFullscreen = ref(false)
+    const webHost = import.meta.env.VITE_APP_BASE_API
+    const data = reactive({
+        form: {},
+        rules: {
+                        number: [
+                        { required: true, message: "电子化率基数不能为空", trigger: "blur" }
+                    ]
+        }
+    });
+    const { form, rules } = toRefs(data);
+/***********************  方法区  ****************************/
+    /** 打开抽屉 */
+    function open(id) {
+        reset();
+        visible.value = true;
+        if (id) {
+            getConversion(id).then(response => {
+                form.value = response.data;
+                editStatus.value = false
+                title.value = "修改项目信息"
+            })
+        } else {
+            editStatus.value = true
+            title.value = "添加项目信息"
+        }
+    }
+
+    /** 取消按钮 */
+    function cancel() {
+        visible.value = false;
+        reset();
+    }
+
+    /** 表单重置 */
+    function reset() {
+        form.value = {
+                        id: null,
+                        tenantId: null,
+                        createTime: null,
+                        creatorId: null,
+                        updateTime: null,
+                        updaterId: null,
+                        deleted: null,
+                        version: null,
+                        date: null,
+                        number: null
+        };
+        proxy.resetForm("conversionRef");
+    }
+
+    /** 全屏缩放 */
+    function handleScreen() {
+    const dom = document.querySelector('.list-container > .el-drawer__wrapper > .el-overlay')
+    isFullscreen.value = !isFullscreen.value
+    dom.style.position = isFullscreen.value ? 'fixed' : 'absolute'
+    }
+
+
+/** 提交按钮 */
+function submitForm() {
+  proxy.$refs["conversionRef"].validate(valid => {
+    if (valid) {
+      if (form.value.id != null) {
+        updateConversion(form.value).then(response => {
+          proxy.$modal.msgSuccess("修改成功");
+          visible.value = false;
+          getList.value()
+        });
+      } else {
+        addConversion(form.value).then(response => {
+          proxy.$modal.msgSuccess("新增成功");
+          visible.value = false;
+          getList.value()
+        });
+      }
+    }
+  });
+}
+
+    /** 查询表单信息  */
+    function getForm() {
+    loading.value = true
+    getConversion(form.value.id).then(response => {
+        loading.value = false
+        form.value = response.data
+    })
+    }
+
+    /** 暴露给父组件的方法 */
+    defineExpose({
+        open
+    })
+</script>

+ 189 - 0
src/views/business/conversion/index.vue

@@ -0,0 +1,189 @@
+<template>
+    <div class="page-container row-container">
+        <section class="list-part-container" style="flex: 2">
+            <!-- 搜索区 -->
+            <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+                <el-form-item label="年份:" prop="year">
+                    <el-date-picker v-model="queryParams.year" type="year" value-format="YYYY" :editable="false"
+                        :clearable="false" placeholder="请选择时间" @change="handleYearChange" style="width: 130px" />
+                </el-form-item>
+                <el-form-item label="工艺图纸电子化基数:" v-hasPermi="['business:conversion:query']" prop="number">
+                    <span v-if="!disabled">{{ number }}</span>
+                    <el-input v-if="disabled" v-model.trim="number"  style="width: 220px; margin-left: 0px" />
+                </el-form-item>
+                <el-form-item>
+                    <el-button v-if="!disabled" type="primary" v-hasPermi="['business:conversion:add']" @click="handleEdit">编辑</el-button>
+                    <el-button v-if="disabled" type="success" @click="handleSave" >保存</el-button>
+                    <el-button v-if="disabled" type="info" @click="handleCancel">取消</el-button>
+                </el-form-item>
+            </el-form>
+            <!-- 列表区 -->
+            <div ref="echartDom" style="width: 100%; height: 100%;"></div>
+
+            <!-- 表单 -->
+
+        </section>
+    </div>
+</template>
+
+<script setup name="Conversion">
+import { listConversion,addConversion } from '@/api/business/conversion'
+import { ref, onMounted, nextTick, reactive, computed } from 'vue'
+import * as echarts from 'echarts'
+import { getProcuctDrawing } from '@/api/business/drawing'
+const { proxy } = getCurrentInstance();
+const disabled = ref(false)
+const echartInstance = ref(null)
+const echartDom = ref(null)
+const procuctDrawing = ref(0)
+const number = ref(0)
+const rawData = ref([])
+const months = ref(['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'])
+const currentMonthIndex = computed(() => new Date().getMonth())
+const data = reactive({
+    queryParams: {
+        year: new Date().getFullYear().toString()
+    }
+})
+
+const { queryParams } = toRefs(data)
+function processChartData(rawData, selectedYear) {
+    // 初始化每月数据为null
+    const monthlyData = new Array(12).fill(null);
+
+    rawData.forEach(record => {
+        const recordDate = new Date(record.date);
+        const recordYear = recordDate.getFullYear();
+        const monthIndex = recordDate.getMonth(); // 获取月份索引
+
+        // 检查年份是否匹配,并设置数据
+        if (recordYear === selectedYear) {
+            monthlyData[monthIndex] = (procuctDrawing.value / parseInt(record.number) * 100).toFixed(2);
+        }
+    });
+
+    // 根据选择的年份和月份设置默认值
+    // 如果是2024年7月之后,且在所选年份之内的月份没有数据,则赋予默认值100
+    for (let i = 0; i < 12; i++) {
+        const isAfterJuly2024 = (selectedYear === 2024 && i >= 6) || (selectedYear > 2024);
+        if (monthlyData[i] === null && isAfterJuly2024) {
+            monthlyData[i] = parseInt((procuctDrawing.value / 100 * 100).toFixed(2));
+        }
+    }
+
+    // 如果有数据则使用实际数据,否则使用默认值
+    return monthlyData.map(value => value || 0);
+}
+function handleEdit(){
+    disabled.value = !disabled.value
+}
+
+function handleCancel(){
+    disabled.value = !disabled.value
+    getList()
+}
+
+function handleSave(){
+    console.log(number.value)
+    addConversion({number:number.value}).then(res=>{
+        if(res.code ==200){
+            proxy.$modal.msgSuccess("操作成功");
+            disabled.value = !disabled.value
+            getList()
+        }
+    })
+}
+function updateChart(monthlyData, displayMonths) {
+    echartInstance.value.setOption({
+        title: { text: '工艺图纸电子化率' },
+        tooltip: {
+            trigger: 'axis',
+            axisPointer: {
+                type: 'cross',
+                crossStyle: {
+                    color: '#999'
+                }
+            }
+        },
+        xAxis: {
+            type: 'category',
+            data: displayMonths,
+            axisPointer: {
+                type: 'shadow'
+            }
+        },
+        yAxis: {
+            type: 'value'
+        },
+        series: [{
+            name: '数量',
+            type: 'line',
+            data: displayMonths.map((month, index) => monthlyData[index] || 0), // 如果没有数据则显示0
+            label: {
+                show: true,
+                position: 'top',
+                formatter: function (param) {
+                    return (param.value) + "%";
+                }
+            }
+        }]
+    });
+}
+
+function initChart() {
+    echartInstance.value = echarts.init(echartDom.value);
+    updateChart([], months.value); // 使用空数据初始化图表
+}
+
+function handleQuery() {
+    getList();
+}
+
+function handleYearChange(year) {
+    // 获取当前年份
+    const currentYear = new Date().getFullYear();
+    // 如果选择的年份大于当前年份,则重置为当前年份
+    if (parseInt(year) > currentYear) {
+        queryParams.value.year = currentYear.toString();
+    } else {
+        // 否则,更新 queryParams 的年份
+        queryParams.value.year = year;
+    }
+    // 根据新的年份获取数据
+    getList();
+}
+
+function resetQuery() {
+    queryParams.value.year = new Date().getFullYear().toString();
+    getList();
+}
+
+function getList() {
+
+    listConversion(queryParams.value.year).then(res => {
+        rawData.value = res.data;
+        number.value = res.data[0].number
+        getProcuctDrawing().then(res => {
+            procuctDrawing.value = res.data
+            const selectedYear = parseInt(queryParams.value.year);
+            const currentYear = new Date().getFullYear();
+
+            // 处理图表数据
+            const monthlyData = processChartData(rawData.value, selectedYear);
+
+            // 根据选择的年份确定要显示的月份
+            const displayMonths = selectedYear === currentYear ?
+                months.value.slice(0, currentMonthIndex.value + 1) :
+                months.value;
+
+            // 更新图表
+            updateChart(monthlyData, displayMonths);
+        })
+
+    });
+}
+onMounted(() => {
+    initChart();
+    getList();
+});
+</script>

+ 8 - 4
src/views/business/daywork/index.vue

@@ -8,18 +8,22 @@
         <el-form-item class="section-title" label="生产批次" />
         <el-form-item label="生产计划单号:">
           <el-input placeholder="请输入生产计划单号/批次号" v-model.trim="queryDayworkParams.productionPlanNo"
-            @keydown.enter.prevent clearable style="width: 200px" />
+            @keydown.enter.prevent clearable style="width: 100px" />
         </el-form-item>
         <el-form-item label="产品描述:">
           <el-input placeholder="请输入产品描述" v-model.trim="queryDayworkParams.productDescription" @keydown.enter.prevent
-            clearable style="width: 130px" />
+            clearable style="width: 100px" />
         </el-form-item>
         <el-form-item class="section-title" label="请选择当前工段:">
-          <el-select-v2 v-model="queryDayworkParams.deptId" :options="deptList" placeholder="请选择工段" style="width: 140px"
+          <el-select-v2 v-model="queryDayworkParams.deptId" :options="deptList" placeholder="请选择工段" style="width: 100px"
             @change="handleDeptChange" />
         </el-form-item>
+        <el-form-item class="section-title" label="查询设备:" prop="equipmentDetailCode">
+          <el-input placeholder="请输入设备名称" v-model.trim="queryDayworkParams.equipmentDetailCode" @keydown.enter.prevent
+            clearable style="width: 100px" />
+        </el-form-item>
         <el-form-item style="margin-left: 0">
-          <el-button type="info" icon="Search" :disabled="deptList.length === 0" @click="handleQuery">搜索
+          <el-button type="info" icon="Search"  :disabled="deptList.length === 0" @click="handleQuery">搜索
           </el-button>
         </el-form-item>
       </el-form>

+ 1 - 1
src/views/business/drawingAuditing/index.vue

@@ -171,7 +171,7 @@ function handleNGdrawingDetail(row) {
         })
         .then(() => {
             reset()
-            getList();
+            getDrawingList();
             open.value = false
             proxy.$modal.msgSuccess("废弃成功");
         })

+ 0 - 1
src/views/business/drawingRatify/index.vue

@@ -172,7 +172,6 @@ function handleNGdrawingDetail(row) {
         })
         .then(() => {
             reset()
-            getList();
             open.value = false
             proxy.$modal.msgSuccess("废弃成功");
         })

+ 1 - 0
src/views/business/product/drawingForm.vue

@@ -264,6 +264,7 @@ function saveDrawing() {
   form.value.drawingName = coverName.value
   addDrawing(form.value).then(res => {
     if (res.code == 200) {
+      proxy.$modal.msgSuccess('上传成功!')
       reset();
       open(processDetail.value)
       formLoading.value = false

+ 5 - 5
src/views/business/product/index.vue

@@ -81,15 +81,15 @@
 				</div>
 			</div>
 		</section>
-		<div class="relative-container" style="background-color: #ececec;">
+		<!-- <div class="relative-container" style="background-color: #ececec;">
 			<div class="drawing-info" style="margin-left: 20px;">
 			工艺图纸电子化率:<span style="color: blue;font-size: 22px;">{{ drawingRatio }}%</span>
-			</div>
+			</div> -->
 			<!-- 分页 -->
-			<div class="pagination-container">
+			<!-- <div class="pagination-container"> -->
 			<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
-			</div>
-		</div>
+			<!-- </div>
+		</div> -->
 
 		<section class="list-part-container row-container" style="flex: 1">
 			<section class="list-part-container" style="flex: 1">

+ 19 - 23
src/views/business/reviseBath/multiSingleChangeDialog.vue

@@ -16,18 +16,15 @@
           @click="handleAdd"
           >在此工序前添加新工序</el-button
         >
-        <el-button
-          type="danger"
-          @click="handleDel"
-          :disabled="click"
-          icon="delete"
+        <el-button type="danger" @click="handleDel" icon="delete"
           >删除</el-button
         >
       </el-form-item>
     </el-form>
     <div class="el-table-inner-container">
       <el-table
-        style="height: 600px"
+        ref="processTable"
+        style="height: 500px"
         v-loading="loading"
         @selection-change="handleSelectionChange"
         :data="processList"
@@ -142,6 +139,7 @@ const loading = ref(false);
 const haveModified = ref(false); //是否已经修改
 const addProcess = ref(false); //新增工序弹窗
 const total = ref(0);
+const processTable = ref(null);
 const emit = defineEmits(["handleSaveSuccess"]);
 const ids = ref([]); //多选框选中数据
 const click = ref(true); //按钮不可点
@@ -190,29 +188,27 @@ function handleSelectionChange(selection) {
 
 /** 删除按钮操作 */
 function handleDel() {
-  if (haveModified.value) {
-    proxy.$modal.msgError("只能修改一次工序数据");
-    return;
-  }
-
-  //查询选中工序位置
-  let id = ids.value[0];
-  let index = processList.value.findIndex((item) => item.id === id);
+  //查询选中数据
+  const delRows = processTable.value.getSelectionRows();
 
   proxy.$modal.confirm("是否确认删除该条数据?").then(() => {
-    processList.value.splice(index, 1);
-    haveModified.value = true;
+    processList.value = processList.value.filter(
+      (item) => !delRows.includes(item)
+    );
   });
 }
 
 /** 新增工序确认按钮 操作*/
 function handleProcess(row) {
   //查询选中工序位置
-  let id = ids.value[0];
-  let indexNum = processList.value.findIndex((item) => item.id === id);
+  const clickProcess = processTable.value.getSelectionRows();
+  let indexNum = processList.value.findIndex((item) =>
+    Object.is(item, clickProcess[0])
+  );
+  console.log("indexNum", indexNum);
 
   //获取新增工序上一条排序
-  let num = processList.value[indexNum - 1].processStepNumber; //
+  let num = processList.value[indexNum - 1].processStepNumber;
 
   //复制选中数据
   let process = { ...processList.value[indexNum] };
@@ -247,10 +243,10 @@ function checkSelectable(row) {
 
 /** 添加新工序按钮操作 */
 function handleAdd() {
-  if (haveModified.value) {
-    proxy.$modal.msgError("只能修改一次工序数据");
-    return;
-  }
+  // if (haveModified.value) {
+  //   proxy.$modal.msgError("只能修改一次工序数据");
+  //   return;
+  // }
   handleSelect();
   addProcess.value = true;
 }

+ 18 - 22
src/views/business/reviseBath/onceSingleChangeDialog.vue

@@ -16,18 +16,15 @@
           @click="handleAdd"
           >在此工序前添加新工序</el-button
         >
-        <el-button
-          type="danger"
-          @click="handleDel"
-          :disabled="click"
-          icon="delete"
+        <el-button type="danger" @click="handleDel" icon="delete"
           >删除</el-button
         >
       </el-form-item>
     </el-form>
     <div class="el-table-inner-container">
       <el-table
-        style="height: 600px"
+        ref="processTable"
+        style="height: 500px"
         v-loading="loading"
         @selection-change="handleSelectionChange"
         :data="processList"
@@ -138,6 +135,7 @@ const visible = ref(false);
 const loading = ref(false);
 const haveModified = ref(false); //是否已经修改
 const addProcess = ref(false); //新增工序弹窗
+const processTable = ref(null);
 const total = ref(0);
 const emit = defineEmits(["handleSaveSuccess"]);
 const ids = ref([]); //多选框选中数据
@@ -185,26 +183,24 @@ function handleSelectionChange(selection) {
 
 /** 删除按钮操作 */
 function handleDel() {
-  if (haveModified.value) {
-    proxy.$modal.msgError("只能修改一次工序数据");
-    return;
-  }
-
-  //查询选中工序位置
-  let id = ids.value[0];
-  let index = processList.value.findIndex((item) => item.id === id);
+  //查询选中数据
+  const delRows = processTable.value.getSelectionRows();
 
   proxy.$modal.confirm("是否确认删除该条数据?").then(() => {
-    processList.value.splice(index, 1);
-    haveModified.value = true;
+    processList.value = processList.value.filter(
+      (item) => !delRows.includes(item)
+    );
   });
 }
 
 /** 新增工序确认按钮 操作*/
 function handleProcess(row) {
   //查询选中工序位置
-  let id = ids.value[0];
-  let indexNum = processList.value.findIndex((item) => item.id === id);
+  const clickProcess = processTable.value.getSelectionRows();
+  let indexNum = processList.value.findIndex((item) =>
+    Object.is(item, clickProcess[0])
+  );
+  console.log("indexNum", indexNum);
 
   //获取新增工序上一条排序
   let num = processList.value[indexNum - 1].processStepNumber; //
@@ -244,10 +240,10 @@ function checkSelectable(row) {
 
 /** 添加新工序按钮操作 */
 function handleAdd() {
-  if (haveModified.value) {
-    proxy.$modal.msgError("只能修改一次工序数据");
-    return;
-  }
+  // if (haveModified.value) {
+  //   proxy.$modal.msgError("只能修改一次工序数据");
+  //   return;
+  // }
   handleSelect();
   addProcess.value = true;
 }