فهرست منبع

Merge branch 'master' of https://git.steerinfo.com/XTEMS/xt-ems-front

lirl 3 سال پیش
والد
کامیت
171d2f76aa

+ 10 - 2
src/views/basicInformation/components/configurationRelationship/processAndMaterial.vue

@@ -116,7 +116,7 @@
                                 <el-form-item label="物料编码">
                                     <el-input clearable
                                         v-model="filterForm.data.materialCode"
-                                        placeholder="MES物料编码"
+                                        placeholder="NC物料编码"
                                         style="width: 100%;"
                                     ></el-input>
                                 </el-form-item>
@@ -159,6 +159,14 @@
                                 v-privilege="activeMenu + 'QUERY'"
                                 @click="getTableData(1)"
                             >查询</el-button>
+                            <el-button
+                                class="button"
+                                type="primary"
+                                size="mini"
+                                icon="el-icon-refresh"
+                                v-privilege="activeMenu + 'QUERY'"
+                                @click="tableDataCancel();"
+                            >重置</el-button>
                             <el-button
                                 size="mini"
                                 :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
@@ -298,7 +306,7 @@
                             <el-table-column
                                 sortable
                                 prop="mes_materialcode"
-                                label="MES物料编码"
+                                label="NC物料编码"
                                 min-width="100px"
                                 :show-overflow-tooltip="true"
                             ></el-table-column>

+ 2 - 0
src/views/energyOperationSupport/components/securitys/SecurityFile.vue

@@ -866,6 +866,8 @@ export default {
                     message: '上传成功',
                     type: 'success'
                 });
+                that.$refs.upload.clearFiles();
+                that.$refs.upload1.clearFiles();
                 that.getTableData(1);
                 that.dialog.editorBox.show = false;
                 } else {

+ 903 - 0
src/views/energyScheduling/components/investAndProduce/investAndProduceManage.vue

@@ -0,0 +1,903 @@
+<template>
+    <!-- 实际投入产出人工录入 -->
+    <div class="measuringManualEntry">
+        <div class="box">
+            <div class="box-top">
+                <el-form
+                    style="overflow: hidden;"
+                    :style="filterForm.show ? null : { height: '0px' }"
+                    size="mini"
+                    label-width="80px"
+                >
+                    <el-row>
+                        <el-col :span="5">
+                            <el-form-item label="日期">
+                                <zj-timegran-date
+                                    v-model="filterForm.data.prodate"
+                                    style="width: 100%;"
+                                    :type="'daterange'"
+                                    :timegranId="'DAY'"
+                                    :oneFoo="getTableData"
+                                    :defaultOffset="-1"
+                                    :custom="custom"
+                                ></zj-timegran-date>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="5">
+                            <el-form-item label="工序">
+                                <el-select
+                                    filterable clearable
+                                    v-model="filterForm.data.workproc"
+                                    placeholder="工序"
+                                    multiple
+                                    collapse-tags
+                                    style="width: 100%;"
+                                >
+                                    <el-option
+                                        v-for="item of nameObj.workproc.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="5">
+                            <el-form-item label="物料名称">
+                                <el-input clearable
+                                    v-model.trim="filterForm.data.materialname"
+                                    placeholder="物料名称"
+                                    style="width: 100%;"
+                                    @keyup.enter.native="getTableData(1)"
+                                ></el-input>
+                            </el-form-item>
+                        </el-col>
+                         <el-col :span="4">
+                            <el-form-item label="物料编码">
+                                <el-input clearable
+                                    v-model.trim="filterForm.data.materialcode"
+                                    placeholder="物料编码"
+                                    style="width: 100%;"
+                                    @keyup.enter.native="getTableData(1)"
+                                ></el-input>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="4">
+                            <el-form-item label="数据类型">
+                                <el-select
+                                    filterable clearable
+                                    v-model="filterForm.data.type"
+                                    placeholder="数据类型"
+                                    multiple
+                                    collapse-tags
+                                    style="width: 100%;"
+                                >
+                                    <el-option
+                                        v-for="item of nameObj.type.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                </el-form>
+                <div class="box-top-gjl">
+                    <el-button
+                        class="button"
+                        type="primary"
+                        size="mini"
+                        icon="el-icon-edit-outline"
+                        @click="but_edit_plural()"
+                        :loading="loading"
+                    >保存</el-button>
+                    <div style="float:right; text-align: right;">
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            icon="el-icon-search"
+                            @click="getTableData(1)"
+                        >查询</el-button>
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            icon="el-icon-refresh"
+                            @click="tableDataCancel();"
+                        >重置</el-button>
+                        <el-button
+                            size="mini"
+                            :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
+                            :title="filterForm.show ? '收起搜索区' : '展开搜索区'"
+                            @click="filterForm.show = !filterForm.show;
+                                $nextTick(() => {
+                                    singleTableHeight = getRoleHeight($refs['singleTable'].$el) - 45;
+                                }
+                            );"
+                        >{{ filterForm.show ? '收起' : '展开' }}</el-button>
+                    </div>
+                </div>
+            </div>
+            <div class="box-bottom">
+                <el-form
+                    size="mini"
+                    ref="dialog_form_arr"
+                    label-width="0px"
+                    :model="tableFormDataObj"
+                >
+                    <el-table stripe
+                        id="singleTable"
+                        ref="singleTable"
+                        :data="tableData"
+                        v-loading="tableLoading"
+                        style="width: 100%;"
+                        :height="singleTableHeight"
+                        border
+                        size="mini"
+                        highlight-current-row
+                        @selection-change="handleSelectionChange"
+                        show-summary
+                        :summary-method="getSummaries"
+                        :row-class-name="tableRowClassName"
+                        @cell-click="cellClick">
+                        <el-table-column
+                            type="selection"
+                            width="40"
+                            align="center"
+                            :selectable='checkboxT'
+                            fixed="left"
+                            class-name="cnspicuous"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="prodate"
+                            label="时间"
+                            width="90px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="timegranid"
+                            label="粒度"
+                            width="55px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        >日</el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="type"
+                            label="数据类型"
+                            width="80px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        ><template slot-scope="scope">
+                            <span>{{ nameObj.type.obj[scope.row.type] ? nameObj.type.obj[scope.row.type] : scope.row.type }}</span>
+                        </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="unit"
+                            label="计量单位"
+                            width="75px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <span>{{ nameObj.unitid.obj[scope.row.unit] ? nameObj.unitid.obj[scope.row.unit] : scope.row.unit }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="prodline"
+                            label="产线"
+                            width="100px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="workproc"
+                            label="工序"
+                            width="100px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <span>{{ nameObj.workproc.obj[scope.row.workproc] ? nameObj.workproc.obj[scope.row.workproc] : scope.row.workproc }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="materialname"
+                            label="物料名称"
+                            width="160px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="materialcode"
+                            label="物料编码"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="qty"
+                            label="最终值"
+                            width="135px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <el-form-item
+                                    v-if="scope.row.isSelection && (scope.row.index === 1 || loginName === 'admin')"
+                                    :prop="scope.row.id + '-' + scope.row.prodate + '.qty'"
+                                    :rules="tableFormRules.qty"
+                                >
+                                    <el-input clearable
+                                        style="width: 100%;"
+                                        @keydown.native="keyDown" :id="scope.$index + scope.column.id"
+                                        v-model="tableFormDataObj[scope.row.id + '-' + scope.row.prodate].qty"
+                                        refcous="true"
+                                    ></el-input>
+                                    <template slot="error" slot-scope="scope">
+                                        <p class="error" :title="scope.error">{{ scope.error }}</p>
+                                    </template>
+                                </el-form-item>
+                                <span v-else>{{scope.row.qty}}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="createtime"
+                            label="创建时间"
+                            width="160px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="status"
+                            label="状态"
+                            width="100px"
+                            :show-overflow-tooltip="true"
+                        ><template slot-scope="scope">
+                            <span>{{ nameObj.status.obj[scope.row.status] ? nameObj.status.obj[scope.row.status] : scope.row.status }}</span>
+                         </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="sendtime"
+                            label="读取时间"
+                            width="160px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="memo"
+                            label="备注"
+                            min-width="150px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <el-form-item
+                                    v-if="scope.row.isSelection && (scope.row.ed === 1 || loginName === 'admin')"
+                                    :prop="scope.row.id + '-' + scope.row.prodate + '.memo'"
+                                    :rules="tableFormRules.memo"
+                                >
+                                    <el-input clearable
+                                        style="width: 100%;"
+                                        @keydown.native="keyDown" :id="scope.$index + scope.column.id"
+                                        v-model="tableFormDataObj[scope.row.id + '-' + scope.row.prodate].memo"
+                                        refcous="true"
+                                    ></el-input>
+                                    <template slot="error" slot-scope="scope">
+                                        <p class="error" :title="scope.error">{{ scope.error }}</p>
+                                    </template>
+                                </el-form-item>
+                                <span v-else>{{scope.row.memo}}</span>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </el-form>
+                <el-pagination
+                    layout="total, sizes, prev, pager, next, jumper"
+                    :total="total"
+                    :page-sizes="[10, 20, 50, 100, 500, 1000]"
+                    :page-size="pageSize"
+                    :current-page.sync="pageNum"
+                    @size-change="tableSizeChange"
+                    @current-change="getTableData()"
+                    style="text-align: right;margin-top: 10px;"
+                ></el-pagination>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+import { zCheckNumber1, checkInteger } from '@/utils/validator.js'
+import timegranDate from '@/components/zg/timegranDate.vue'
+import {formatDate, commonSummaries, getCookie} from '@/utils/util.js';
+export default {
+    name: 'measuringManualEntry',
+    components: {
+        'zj-timegran-date': timegranDate
+    },
+    data () {
+        return {
+            custom: 1,
+            filterForm: {
+                show: true,
+                data: {
+                    prodate: '',
+                    workproc: '',
+                    workprocid: '',
+                    prodline: '',
+                    state: '',
+                    materialname: '',
+                    materialcode: '',
+                    type: ''
+                },
+                rules: {
+                }
+            },
+            pageNum: 1,
+            pageSize: 20,
+            total: 0,
+            singleTableHeight: 100,
+            tableData: [],
+            loading: false,
+            tableLoading: false,
+            multipleSelection: [],
+            tableFormDataObj: {},
+            tableFormRules: {
+                mintvalue: [
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                mendvalue: [
+                    { required: true, message: '该项不能为空', trigger: 'change' },
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                qty: [
+                    { required: true, message: '该项不能为空', trigger: 'change' },
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                memo: [],
+                xh: [
+                    { validator: checkInteger, trigger: 'change' }
+                ]
+            },
+            nameObj: {
+                status: {
+                    obj: {
+                        '0': '已创建',
+                        '1': '已读取'
+                    },
+                    arr: [
+                        {
+                            id: '0',
+                            name: '已创建'
+                        },
+                        {
+                            id: '1',
+                            name: '已读取'
+                        }
+                    ]
+                },
+                type: {
+                    obj: {
+                        '1': '投入',
+                        '2': '产出'
+                    },
+                    arr: [
+                        {
+                            id: '1',
+                            name: '投入'
+                        },
+                        {
+                            id: '2',
+                            name: '产出'
+                        }
+                    ]
+                },
+                energyid: {
+                    obj: {},
+                    arr: []
+                },
+                location: {
+                    obj: {},
+                    arr: []
+                },
+                unitid: {
+                    obj: {},
+                    arr: []
+                },
+                timegranid: {
+                    obj: {
+                        'DAY': '日',
+                        'MONTH': '月',
+                        'YEAR': '年'
+                    }
+                },
+                prodline: {
+                    obj: {},
+                    arr: []
+                },
+                workproc: {
+                    obj: {},
+                    arr: []
+                }
+            },
+            rowIndex: '',
+            columnId: '',
+            focusTarget: null,
+            seqArr: [],
+            editSetFlag: '',
+            loginName: 'admin' // getCookie('loginName')
+        }
+    },
+    created () {
+        // 获取按钮权限
+        this.activeMenu = window.localStorage.getItem('activeMenu');
+    },
+    mounted () {
+        let that = this;
+        window.PEDataObj = {
+            // 将数据绑定到window上,供main页面使用
+            vm: that,
+            // tableArr:用于导出成Excel的表格的信息
+            tableArr: [
+                {
+                    name: '',
+                    id: 'singleTable'
+                }
+            ]
+        };
+        that.$nextTick(() => {
+            // 立即获取的height有一定偏差,通过setTimeout延迟来解决
+            setTimeout(() => {
+                that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
+            }, 1);
+        });
+        // 接收路由参数
+        if (that.$route.query.workprocid) {
+            that.filterForm.data.workprocid = that.$route.query.workprocid;
+            let its = that.filterForm.data.workprocid.split(',');
+            if (its && its.length > 10) {
+                that.pageSize = 50;
+                that.custom = 0;
+            }
+        }
+        that.getNodeData();
+        that.getEnergyIdData();
+        that.getLocateIdData();
+        that.getUnitIdData();
+        // that.getTableData();
+    },
+    methods: {
+        //  计算树区域高度
+        getRoleHeight (dom) {
+            return window.innerHeight - dom.offsetTop;
+        },
+        // 自定义的表格合计方法:只给指定列进行合计
+        getSummaries (param) {
+            const prop = ['qty']; // 合计列绑定的prop
+            return commonSummaries(param, prop);
+        },
+        // 获取能介
+        getEnergyIdData () {
+            let that = this;
+            let url = 'pass/ems/v1/trmenergys/selectNameAndId/';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name,
+                                energytypeid: item.energytypeid,
+                                unitid: item.unitid
+                            })
+                            obj[item.id] = {
+                                name: item.name,
+                                unitid: item.unitid
+                            }
+                        }
+                        that.nameObj.energyid.arr = arr;
+                        that.nameObj.energyid.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取位置
+        getLocateIdData () {
+            let that = this
+            let url = 'pass/ems/v1/trmlocations/getidandname/';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                        }
+                        that.nameObj.location.arr = arr;
+                        that.nameObj.location.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取工序列表
+        getNodeData () {
+            let that = this
+            let url = 'pass/ems/v1/trmworkprocs/getIdAndName?issettle=1';
+            console.log('工序呢');
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                        }
+                        that.nameObj.workproc.arr = arr;
+                        that.nameObj.workproc.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取标准计量单位
+        getUnitIdData () {
+            let that = this
+            let url = 'pass/ems/v1/trmunits/getIdAndName';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                            if (item.name === '吨') {
+                                that.nameObj.unitid.defaults = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : item.id;
+                            }
+                        }
+                        that.nameObj.unitid.arr = arr;
+                        that.nameObj.unitid.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取表格中的数据
+        getTableData (pageNum) {
+            let that = this,
+                params = {
+                    prodate: that.filterForm.data.prodate[0],
+                    prodate2: that.filterForm.data.prodate[1],
+                    prodline: that.filterForm.data.prodline,
+                    workprocid: that.filterForm.data.workprocid,
+                    workproc: that.filterForm.data.workproc.join(','),
+                    materialcode: that.filterForm.data.materialcode,
+                    materialname: that.filterForm.data.materialname,
+                    type: that.filterForm.data.type.join(',')
+                };
+            that.pageNum = pageNum || that.pageNum;
+            that.tableLoading = true;
+            let url = 'pass/ems/v1/ifmesemsswapfile/queryList/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize;
+            that.axios.get(url, {
+                params: params
+            })
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        for (let i = 0; i < res.data.list.length; i++) {
+                            let item = res.data.list[i];
+                            item.PRODATE = item.PRODATE.substr(0, 10);
+                            arr.push({
+                                seq: i,
+                                createtime: item.CREATETIME,
+                                id: item.FID,
+                                materialcode: item.MATERIALCODE,
+                                materialname: item.MATERIALNAME,
+                                orderno: item.ORDERNO,
+                                prodate: item.PRODATE,
+                                prodline: item.PRODLINE,
+                                qty: item.QTY,
+                                sendtime: item.SENDTIME,
+                                status: item.STATUS,
+                                type: item.TYPE,
+                                unit: item.UNIT,
+                                works: item.WORKS,
+                                workproc: item.WORKPROCID,
+                                memo: item.MEMO
+                            })
+                        }
+                        that.tableData = arr;
+                        that.total = res.data.total;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                    that.$nextTick(() => {
+                        setTimeout(() => {
+                            that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
+                        }, 1);
+                    });
+                    that.tableLoading = false;
+                }).catch(function () {
+                    that.tableLoading = false;
+                });
+        },
+        // 改变表格显示条数
+        tableSizeChange (val) {
+            let that = this;
+            that.pageSize = val;
+            that.getTableData(1);
+        },
+        // 重置搜索
+        tableDataCancel () {
+            let that = this;
+            for (let key in that.filterForm.data) {
+                if (!that.filterForm.disabled || !that.filterForm.disabled[key]) {
+                    if (that.filterForm.data[key] instanceof Array) {
+                        that.filterForm.data[key] = [];
+                    } else {
+                        that.filterForm.data[key] = '';
+                    }
+                }
+            }
+            that.getTableData(1);
+        },
+        keyDown (event1, disabledFlag) {
+            let tdTarget = event1.target;
+            let _this = this;
+            while (tdTarget.tagName !== 'TD') {
+                tdTarget = tdTarget.parentElement;
+            }
+            if (event.keyCode) {
+                _this.codeT = event.keyCode;
+            }
+            // 如果按下键盘下键或者回车键
+            if (event.keyCode === 40 || event.keyCode === 13) {
+                let index = parseInt(this.rowIndex);
+                if (index !== this.seqArr[this.seqArr.length - 1]) {
+                    for (let i = 0; i < this.seqArr.length; i++) {
+                        if (index === this.seqArr[i]) {
+                        index = this.seqArr[i + 1];
+                        break;
+                        }
+                    }
+                }
+                this.editSetFlag = index + this.columnId;
+                let id = '#' + this.editSetFlag;
+                this.$nextTick(() => {
+                    $(id).click();
+                });
+            } else if (event.keyCode === 38) { // 键盘上键
+                let index = parseInt(this.rowIndex);
+                if (index !== this.seqArr[0]) {
+                    for (let i = 0; i < this.seqArr.length; i++) {
+                        if (index === this.seqArr[i]) {
+                        index = this.seqArr[i - 1];
+                        break;
+                        }
+                    }
+                }
+                this.editSetFlag = index + this.columnId;
+                let id = '#' + this.editSetFlag;
+                this.$nextTick(() => {
+                    $(id).click();
+                });
+            } else if (event.keyCode === 37) { // 键盘左键
+                $(tdTarget).prev().click();
+                $(tdTarget).prev().find('input').select();
+            } else if (event.keyCode === 39) { // 键盘右键
+                $(tdTarget).next().click();
+                $(tdTarget).next().find('input').select();
+            }
+        },
+        tableRowClassName ({row, rowIndex}) {
+            // 把每一行的索引放进row
+            row.index = rowIndex;
+        },
+        cellClick (row, column, cell, event) {
+            let _this = this;
+            this.rowIndex = row.index;
+            this.columnId = column.id;
+            let disabledFlag = false;
+            // if (!row[column.property] && row[column.property] !== null && row[column.property] !== '') {
+            //     _this.keyDown(event, true);
+            // }
+            _this.editSetFlag = row.index + column.id;
+            _this.focusTarget = event.target;
+            while (_this.focusTarget.tagName !== 'TD') {
+                _this.focusTarget = _this.focusTarget.parentElement;
+            }
+            _this.$nextTick(() => {
+                let target = this.focusTarget;
+                $(target).find('input').focus();
+            });
+        },
+        // 只允许对可编辑数据进行操作
+        checkboxT (row, index) {
+            let _this = this;
+            if (row.ed === 1 || _this.loginName === 'admin') {
+                return true;
+            } else {
+                return false;
+            }
+        },
+        handleSelectionChange (val) {
+            let that = this;
+            let tableFormDataObj = {};
+            let arr = [];
+            for (let item of val) {
+                arr.push(item.seq);
+            }
+            this.seqArr = arr.sort(sortNumber);
+            for (let item of that.tableData) {
+                item.isSelection = false;
+            }
+            for (let item of val) {
+                let obj = {};
+                let xId = item.id + '-' + item.prodate;
+                if (that.tableFormDataObj[xId]) {
+                    // 如果已存在该数据则使用该数据
+                    tableFormDataObj[xId] = that.tableFormDataObj[xId];
+                } else {
+                    // 负责则从对应行中获取行内原数据
+                    for (let key in item) {
+                        obj[key] = item[key];
+                    }
+                    tableFormDataObj[xId] = obj;
+                }
+                item.isSelection = true;
+            }
+            that.tableFormDataObj = tableFormDataObj;
+            that.multipleSelection = val;
+        },
+        // 当上月底码发生改变时计算最终值
+        getApportValue (xid, value, rowIndex, event) {
+            let that = this;
+            if (!isNaN(Number(value))) {
+                if (!isNaN(Number(that.tableFormDataObj[xid].MINTVALUE)) && !isNaN(Number(that.tableFormDataObj[xid].MENDVALUE)) && that.tableFormDataObj[xid].MINTVALUE !== null && that.tableFormDataObj[xid].MENDVALUE !== null) {
+                    let poor = that.floatComputed(Number(that.tableFormDataObj[xid].MENDVALUE), Number(that.tableFormDataObj[xid].MINTVALUE), '-');
+                    that.tableFormDataObj[xid].APPORTVALUE = poor;
+                    // that.tableFormDataObj[xid].APPORTVALUE = that.floatComputed(poor, Number(that.tableFormDataObj[xid].mods), '*');
+                    // that.showRealValue(rowIndex, that.tableFormDataObj[xid].APPORTVALUE);
+                }
+            }
+        },
+        // 展示最终值
+        showRealValue (rowIndex, value) {
+            let that = this;
+            for (let i = 0; i < that.tableData.length; i++) {
+                if (i === rowIndex) {
+                    that.tableData[i].APPORTVALUE = value;
+                }
+            }
+        },
+        // 批量修改
+        but_edit_plural () {
+            let that = this;
+            if (that.multipleSelection.length > 0) {
+                that.$refs['dialog_form_arr'].validate((valid, msg) => {
+                    if (valid) {
+                        let SubmitData = [];
+                        for (let key in that.tableFormDataObj) {
+                            SubmitData.push({
+                                clock: that.tableFormDataObj[key].CLOCK,
+                                itemid: that.tableFormDataObj[key].ITEMID,
+                                itemname: that.tableFormDataObj[key].ITEMNAME,
+                                itemdesc: that.tableFormDataObj[key].ITEMDESC,
+                                locateid: that.tableFormDataObj[key].LOCATEID,
+                                energyid: that.tableFormDataObj[key].ENERGYID,
+                                tagModulus: that.tableFormDataObj[key].TAG_MODULUS,
+                                apportvalue: that.tableFormDataObj[key].APPORTVALUE,
+                                mintvalue: that.tableFormDataObj[key].MINTVALUE,
+                                mendvalue: that.tableFormDataObj[key].MENDVALUE,
+                                bz: that.tableFormDataObj[key].bz,
+                                timegranid: that.tableFormDataObj[key].timegranid,
+                                unitid: that.tableFormDataObj[key].unitid,
+                                xh: that.tableFormDataObj[key].xh
+                            });
+                        }
+                        that.loading = true;
+                        that.axios.put('pass/ems/v1/emscalpointvalues/batchupdate', SubmitData)
+                            .then(function (res) {
+                                if (res.code === '0') {
+                                    that.$message({
+                                        message: '保存成功',
+                                        type: 'success'
+                                    });
+                                    that.getTableData();
+                                    that.dialog.editorBox.show = false;
+                                } else {
+                                    that.$message.error(res.message);
+                                }
+                                that.loading = false;
+                            }).catch(function () {
+                                that.loading = false;
+                            });
+                        } else {
+                            let col = Object.keys(msg)[0].split('.')[1];
+                            if (col && col === 'MENDVALUE') {
+                                this.$message.error('请填写正确的仪表期末值');
+                            } else if (col && col === 'APPORTVALUE') {
+                                this.$message.error('请填写正确的最终值');
+                            } else if (col && col === 'xh') {
+                                this.$message.error('请填写正确的序号:0以上的整数');
+                            } else {
+                                this.$message.error('数据不完整或者格式错误');
+                            }
+                        }
+                });
+            } else {
+                this.$message.error('至少要选择一条数据');
+            }
+        }
+    }
+}
+function sortNumber (a, b) {
+  return a - b
+}
+</script>
+
+<style lang="less">
+.measuringManualEntry{
+    min-width: 700px;
+    height: 100%;
+    .box {
+        height: 100%;
+        padding: 15px 15px 0 15px;
+        .box-top {
+            .el-form-item {
+                margin-bottom: 7px;
+            }
+            .box-top-gjl {
+                overflow: hidden;
+                padding: 7px 0;
+                border-top: 1px solid #ccc;
+            }
+        }
+        .rowDisable td {
+            color: #6bb025 !important;
+        }
+        .el-table .el-table__row {
+            height: 35px;
+        }
+        .el-table__body .el-form-item--mini.el-form-item {
+            margin: 0px;
+            .error {
+                overflow: hidden;
+                color: #f56c6c;
+                font-size: 12px;
+                line-height: 1;
+            }
+        }
+    }
+    .cnspicuous .el-checkbox__input.is-disabled .el-checkbox__inner {
+        background-color: #dcdfe6;
+        border-color: #babbbf;
+    }
+}
+</style>

+ 991 - 0
src/views/energyScheduling/components/investAndProduce/productMaterialsInOut.vue

@@ -0,0 +1,991 @@
+<template>
+    <!-- 实际产出人工录入 -->
+    <div class="measuringManualEntry">
+        <div class="box">
+            <div class="box-top">
+                <el-form
+                    style="overflow: hidden;"
+                    :style="filterForm.show ? null : { height: '0px' }"
+                    size="mini"
+                    label-width="80px"
+                >
+                    <el-row>
+                        <el-col :span="4">
+                            <el-form-item label="时间粒度">
+                                <el-select
+                                    filterable clearable
+                                    v-model="filterForm.data.timegranid"
+                                    placeholder=""
+                                    style="width: 100%;"
+                                >
+                                    <el-option
+                                        v-for="item of nameObj.timegranid.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="5">
+                            <el-form-item label="日期">
+                                <zj-timegran-date
+                                    v-model="filterForm.data.clock"
+                                    style="width: 100%;"
+                                    :type="'daterange'"
+                                    :timegranId="filterForm.data.timegranid"
+                                    :oneFoo="getTableData"
+                                    :defaultOffset="-1"
+                                    :custom="custom"
+                                ></zj-timegran-date>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="5">
+                            <el-form-item label="工序">
+                                <el-select
+                                    filterable clearable
+                                    v-model="filterForm.data.workproc"
+                                    placeholder="工序"
+                                    multiple
+                                    collapse-tags
+                                    style="width: 100%;"
+                                >
+                                    <el-option
+                                        v-for="item of nameObj.workproc.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="5">
+                            <el-form-item label="物料名称">
+                                <el-select
+                                    filterable
+                                    clearable
+                                    v-model="filterForm.data.materialname"
+                                    placeholder="物料名称"
+                                    style="width: 100%;"
+                                ><template v-if="filterForm.data.type==='1'">
+                                    <el-option
+                                        v-for="item of nameObj.materialid.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </template>
+                                <template v-if="filterForm.data.type==='2'">
+                                    <el-option
+                                        v-for="item of nameObj.productid.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </template>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                         <el-col :span="4">
+                            <el-form-item label="物料编码">
+                                <el-input clearable
+                                    v-model.trim="filterForm.data.materialcode"
+                                    placeholder="物料编码"
+                                    style="width: 100%;"
+                                    @keyup.enter.native="getTableData(1)"
+                                ></el-input>
+                            </el-form-item>
+                        </el-col>
+                    </el-row><!-- <el-row>
+                        <el-col :span="4">
+                            <el-form-item label="数据类型">
+                                <el-select
+                                    filterable
+                                    v-model="filterForm.data.type"
+                                    placeholder="数据类型"
+                                    collapse-tags
+                                    style="width: 100%;"
+                                >
+                                    <el-option
+                                        v-for="item of nameObj.type.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                    </el-row> -->
+                </el-form>
+                <div class="box-top-gjl">
+                    <el-button
+                        class="button"
+                        type="primary"
+                        size="mini"
+                        icon="el-icon-edit-outline"
+                        v-privilege="activeMenu + 'PUT'"
+                        @click="but_edit_plural()"
+                        :loading="loading"
+                    >保存</el-button>
+                    <div style="float:right; text-align: right;">
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            icon="el-icon-search"
+                            v-privilege="activeMenu + 'QUERY'"
+                            @click="getTableData(1)"
+                        >查询</el-button>
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            icon="el-icon-refresh"
+                            v-privilege="activeMenu + 'QUERY'"
+                            @click="tableDataCancel();"
+                        >重置</el-button>
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            icon="el-icon-refresh"
+                            v-privilege="activeMenu + 'QUERY'"
+                            @click="getwaterData();"
+                        >生成</el-button>
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            @click="but_redata()"
+                            :loading="loading"
+                        >生成数据</el-button>
+                        <el-button
+                            size="mini"
+                            :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
+                            :title="filterForm.show ? '收起搜索区' : '展开搜索区'"
+                            @click="filterForm.show = !filterForm.show;
+                                $nextTick(() => {
+                                    singleTableHeight = getRoleHeight($refs['singleTable'].$el) - 45;
+                                }
+                            );"
+                        >{{ filterForm.show ? '收起' : '展开' }}</el-button>
+                    </div>
+                </div>
+            </div>
+            <div class="box-bottom">
+                <el-form
+                    size="mini"
+                    ref="dialog_form_arr"
+                    label-width="0px"
+                    :model="tableFormDataObj"
+                >
+                    <el-table stripe
+                        id="singleTable"
+                        ref="singleTable"
+                        :data="tableData"
+                        v-loading="tableLoading"
+                        style="width: 100%;"
+                        :height="singleTableHeight"
+                        border
+                        size="mini"
+                        highlight-current-row
+                        @selection-change="handleSelectionChange"
+                        show-summary
+                        :summary-method="getSummaries"
+                        :row-class-name="tableRowClassName"
+                        @cell-click="cellClick">
+                        <el-table-column
+                            type="selection"
+                            width="40"
+                            align="center"
+                            :selectable='checkboxT'
+                            fixed="left"
+                            class-name="cnspicuous"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="clock"
+                            label="时间"
+                            width="90px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="timegranId"
+                            label="时间粒度"
+                            min-width="100px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <span>{{ nameObj.timegranid.obj[scope.row.timegranId] ? nameObj.timegranid.obj[scope.row.timegranId] : scope.row.timegranId }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="unit"
+                            label="计量单位"
+                            width="75px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <span>{{ nameObj.unitid.obj[scope.row.unit] ? nameObj.unitid.obj[scope.row.unit] : scope.row.unit }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="workproc"
+                            label="工序"
+                            width="100px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <span>{{ nameObj.workproc.obj[scope.row.workproc] ? nameObj.workproc.obj[scope.row.workproc] : scope.row.workproc }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="materialname"
+                            label="物料名称"
+                            width="120px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        ><template slot-scope="scope">
+                            <span v-if="filterForm.data.type==='2'">
+                            {{ nameObj.productid.obj[scope.row.materialname] ? nameObj.productid.obj[scope.row.materialname] : scope.row.materialname }}
+                            </span>
+                            <span v-if="filterForm.data.type==='1'">
+                            {{ nameObj.materialid.obj[scope.row.materialname] ? nameObj.materialid.obj[scope.row.materialname] : scope.row.materialname }}
+                            </span>
+                        </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="actualValue"
+                            label="计算值"
+                            width="120px"
+                            v-show="false"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="correctValue"
+                            label="修正值"
+                            width="120px"
+                            v-show="false"
+                            :show-overflow-tooltip="true"
+                        ><template slot-scope="scope">
+                            <span v-if="scope.row.isSelection && scope.row.state !== '2'">{{ rowSum(scope.row) }}</span>
+                            <span v-else>{{ scope.row.correctValue }}</span>
+                        </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="apportValue"
+                            label="最终值"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <el-form-item
+                                    v-if="scope.row.isSelection"
+                                    :prop="scope.row.itemId + '-' + scope.row.clock + '.apportValue'"
+                                    :rules="tableFormRules.apportValue"
+                                >
+                                    <el-input clearable
+                                        style="width: 100%;"
+                                        @keydown.native="keyDown" :id="scope.$index + scope.column.id"
+                                        v-model="tableFormDataObj[scope.row.itemId + '-' + scope.row.clock].apportValue"
+                                        refcous="true"
+                                    ></el-input>
+                                    <template slot="error" slot-scope="scope">
+                                        <p class="error" :title="scope.error">{{ scope.error }}</p>
+                                    </template>
+                                </el-form-item>
+                                <span v-else>{{scope.row.apportValue}}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="materialcode"
+                            label="物料编码"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="userId"
+                            label="创建人"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="createtime"
+                            label="创建时间"
+                            width="160px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="upMan"
+                            label="修改人"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="upTime"
+                            label="修改时间"
+                            width="160px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="bz"
+                            label="备注"
+                            width="180px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <el-form-item
+                                    v-if="scope.row.isSelection && (scope.row.ed === 1 || loginName === 'admin')"
+                                    :prop="scope.row.itemId + '-' + scope.row.clock + '.BZ'"
+                                    :rules="tableFormRules.bz"
+                                >
+                                    <el-input clearable
+                                        style="width: 100%;"
+                                        @keydown.native="keyDown" :id="scope.$index + scope.column.id"
+                                        v-model="tableFormDataObj[scope.row.itemId + '-' + scope.row.clock].bz"
+                                        refcous="true"
+                                    ></el-input>
+                                    <template slot="error" slot-scope="scope">
+                                        <p class="error" :title="scope.error">{{ scope.error }}</p>
+                                    </template>
+                                </el-form-item>
+                                <span v-else>{{scope.row.bz}}</span>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </el-form>
+                <el-pagination
+                    layout="total, sizes, prev, pager, next, jumper"
+                    :total="total"
+                    :page-sizes="[10, 20, 50, 100, 500, 1000]"
+                    :page-size="pageSize"
+                    :current-page.sync="pageNum"
+                    @size-change="tableSizeChange"
+                    @current-change="getTableData()"
+                    style="text-align: right;margin-top: 10px;"
+                ></el-pagination>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+import { zCheckNumber1, checkInteger } from '@/utils/validator.js'
+import timegranDate from '@/components/zg/timegranDate.vue'
+import {formatDate, commonSummaries, getCookie} from '@/utils/util.js';
+export default {
+    name: 'measuringManualEntry',
+    components: {
+        'zj-timegran-date': timegranDate
+    },
+    data () {
+        return {
+            custom: 1,
+            filterForm: {
+                show: true,
+                data: {
+                    clock: '',
+                    workproc: '',
+                    workprocid: '',
+                    prodline: '',
+                    state: '',
+                    materialname: '',
+                    materialcode: '',
+                    type: '2'
+                },
+                rules: {
+                }
+            },
+            pageNum: 1,
+            pageSize: 20,
+            total: 0,
+            singleTableHeight: 100,
+            tableData: [],
+            loading: false,
+            tableLoading: false,
+            multipleSelection: [],
+            tableFormDataObj: {},
+            tableFormRules: {
+                mintvalue: [
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                mendvalue: [
+                    { required: true, message: '该项不能为空', trigger: 'change' },
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                apportValue: [
+                    { required: true, message: '该项不能为空', trigger: 'change' },
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                correctValue: [
+                    { required: true, message: '该项不能为空', trigger: 'change' },
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                bz: [],
+                xh: [
+                    { validator: checkInteger, trigger: 'change' }
+                ]
+            },
+            nameObj: {
+                type: {
+                    obj: {
+                        '1': '投入',
+                        '2': '产出'
+                    },
+                    arr: [
+                        {
+                            id: '1',
+                            name: '投入'
+                        },
+                        {
+                            id: '2',
+                            name: '产出'
+                        }
+                    ]
+                },
+                unitid: {
+                    obj: {},
+                    arr: []
+                },
+                timegranid: {
+                    obj: {
+                        'DAY': '日',
+                        'MONTH': '月',
+                        'YEAR': '年'
+                    },
+                    arr: [
+                        {
+                        id: 'DAY',
+                        name: '日'
+                        },
+                        {
+                        id: 'MONTH',
+                        name: '月'
+                        },
+                        {
+                          id: 'YEAR',
+                          name: '年'
+                        }
+                    ]
+                },
+                materialid: {
+                    obj: {},
+                    arr: []
+                },
+                workproc: {
+                    obj: {},
+                    arr: []
+                },
+                materialcode: {
+                    obj: {},
+                    arr: []
+                },
+                productid: {
+                    obj: {},
+                    arr: []
+                }
+            },
+            rowIndex: '',
+            columnId: '',
+            focusTarget: null,
+            seqArr: [],
+            editSetFlag: '',
+            loginName: 'admin' // getCookie('loginName')
+        }
+    },
+    created () {
+        // 获取按钮权限
+        this.activeMenu = window.localStorage.getItem('activeMenu');
+    },
+    mounted () {
+        let that = this;
+        window.PEDataObj = {
+            // 将数据绑定到window上,供main页面使用
+            vm: that,
+            // tableArr:用于导出成Excel的表格的信息
+            tableArr: [
+                {
+                    name: '',
+                    id: 'singleTable'
+                }
+            ]
+        };
+        that.$nextTick(() => {
+            // 立即获取的height有一定偏差,通过setTimeout延迟来解决
+            setTimeout(() => {
+                that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
+            }, 1);
+        });
+        // 接收路由参数
+        if (that.$route.query.workprocid) {
+            that.filterForm.data.workprocid = that.$route.query.workprocid;
+            let its = that.filterForm.data.workprocid.split(',');
+            if (its && its.length > 10) {
+                that.pageSize = 50;
+                that.custom = 0;
+            }
+        }
+        that.getNodeData();
+        that.getUnitIdData();
+        that.getProductIdData();
+        that.getMaterialIdData();
+        // that.getTableData();
+    },
+    methods: {
+        //  计算树区域高度
+        getRoleHeight (dom) {
+            return window.innerHeight - dom.offsetTop;
+        },
+        // 自定义的表格合计方法:只给指定列进行合计
+        getSummaries (param) {
+            const prop = ['actualValue', 'correctValue', 'apportValue']; // 合计列绑定的prop
+            return commonSummaries(param, prop);
+        },
+        // 获取原材料
+        getMaterialIdData () {
+            let that = this
+            let url = 'pass/ems/v1/trmmaterials/getIdAndName';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                        }
+                        that.nameObj.materialid.arr = arr;
+                        that.nameObj.materialid.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取产品
+        getProductIdData () {
+            let that = this
+            let url = 'pass/ems/v1/trmproducts/?pageSize=1000000';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data.list) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                        }
+                        that.nameObj.productid.arr = arr;
+                        that.nameObj.productid.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取工序列表
+        getNodeData () {
+            let that = this
+            let url = 'pass/ems/v1/trmworkprocs/getIdAndName?issettle=1';
+            console.log('工序呢');
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                        }
+                        that.nameObj.workproc.arr = arr;
+                        that.nameObj.workproc.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取标准计量单位
+        getUnitIdData () {
+            let that = this
+            let url = 'pass/ems/v1/trmunits/getIdAndName';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                            if (item.name === '吨') {
+                                that.nameObj.unitid.defaults = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : item.id;
+                            }
+                        }
+                        that.nameObj.unitid.arr = arr;
+                        that.nameObj.unitid.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 计算修正值
+        rowSum: function (item, event) {
+            let result = 0;
+            let that = this;
+            result = Number(that.tableFormDataObj[item.itemId + '-' + item.clock].apportValue) - Number(that.tableFormDataObj[item.itemId + '-' + item.clock].actualValue);
+            return result;
+        },
+        // 获取表格中的数据
+        getwaterData () {
+            let that = this;
+            let url = 'pass/ems/v1/emswaterrealtimes/water';
+            that.axios.get(url)
+                .then(function (res) {
+                    that.tableLoading = false;
+                }).catch(function () {
+                    that.tableLoading = false;
+                });
+        },
+        // 获取表格中的数据
+        getTableData (pageNum) {
+            let that = this,
+                params = {
+                    clock: that.filterForm.data.clock[0],
+                    clock2: that.filterForm.data.clock[1],
+                    prodline: that.filterForm.data.prodline,
+                    workprocid: that.filterForm.data.workprocid,
+                    workproc: that.filterForm.data.workproc.join(','),
+                    materialcode: that.filterForm.data.materialcode,
+                    materialname: that.filterForm.data.materialname,
+                    type: that.filterForm.data.type
+                };
+            that.pageNum = pageNum || that.pageNum;
+            that.tableLoading = true;
+            let url = 'pass/ems/v1/ifmesemsswapfile/queryProductAndMaterial/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize + '&itemtype=R';
+            that.axios.get(url, {
+                params: params
+            })
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        for (let i = 0; i < res.data.list.length; i++) {
+                            let item = res.data.list[i];
+                            arr.push({
+                                seq: i,
+                                clock: item.CLOCK,
+                                itemId: item.ITEMID,
+                                actualValue: item.ACTUALVALUE,
+                                correctValue: item.CORRECTVALUE,
+                                apportValue: item.APPORTVALUE,
+                                materialcode: item.MES_MATERIALCODE,
+                                materialname: item.MATERIALNAME,
+                                timegranId: item.TIMEGRANID,
+                                userId: item.USERID,
+                                createtime: item.UPDATETIME,
+                                upMan: item.UPMAN,
+                                upTime: item.UPTIME,
+                                unit: item.UNITID,
+                                workproc: item.WORKPROCID,
+                                bz: item.BZ
+                            })
+                        }
+                        that.tableData = arr;
+                        that.total = res.data.total;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                    that.$nextTick(() => {
+                        setTimeout(() => {
+                            that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
+                        }, 1);
+                    });
+                    that.tableLoading = false;
+                }).catch(function () {
+                    that.tableLoading = false;
+                });
+        },
+        // 改变表格显示条数
+        tableSizeChange (val) {
+            let that = this;
+            that.pageSize = val;
+            that.getTableData(1);
+        },
+        // 重置搜索
+        tableDataCancel () {
+            let that = this;
+            for (let key in that.filterForm.data) {
+                if (!that.filterForm.disabled || !that.filterForm.disabled[key]) {
+                    if (that.filterForm.data[key] instanceof Array) {
+                        that.filterForm.data[key] = [];
+                    } else {
+                        that.filterForm.data[key] = '';
+                    }
+                }
+            }
+            // 接收路由参数
+            if (that.$route.query.workprocid) {
+                that.filterForm.data.workprocid = that.$route.query.workprocid;
+                let its = that.filterForm.data.workprocid.split(',');
+                if (its && its.length > 10) {
+                    that.pageSize = 50;
+                    that.custom = 0;
+                }
+            }
+            that.filterForm.data.type = '1';
+            that.getTableData(1);
+        },
+        keyDown (event1, disabledFlag) {
+            let tdTarget = event1.target;
+            let _this = this;
+            while (tdTarget.tagName !== 'TD') {
+                tdTarget = tdTarget.parentElement;
+            }
+            if (event.keyCode) {
+                _this.codeT = event.keyCode;
+            }
+            // 如果按下键盘下键或者回车键
+            if (event.keyCode === 40 || event.keyCode === 13) {
+                let index = parseInt(this.rowIndex);
+                if (index !== this.seqArr[this.seqArr.length - 1]) {
+                    for (let i = 0; i < this.seqArr.length; i++) {
+                        if (index === this.seqArr[i]) {
+                        index = this.seqArr[i + 1];
+                        break;
+                        }
+                    }
+                }
+                this.editSetFlag = index + this.columnId;
+                let id = '#' + this.editSetFlag;
+                this.$nextTick(() => {
+                    $(id).click();
+                });
+            } else if (event.keyCode === 38) { // 键盘上键
+                let index = parseInt(this.rowIndex);
+                if (index !== this.seqArr[0]) {
+                    for (let i = 0; i < this.seqArr.length; i++) {
+                        if (index === this.seqArr[i]) {
+                        index = this.seqArr[i - 1];
+                        break;
+                        }
+                    }
+                }
+                this.editSetFlag = index + this.columnId;
+                let id = '#' + this.editSetFlag;
+                this.$nextTick(() => {
+                    $(id).click();
+                });
+            } else if (event.keyCode === 37) { // 键盘左键
+                $(tdTarget).prev().click();
+                $(tdTarget).prev().find('input').select();
+            } else if (event.keyCode === 39) { // 键盘右键
+                $(tdTarget).next().click();
+                $(tdTarget).next().find('input').select();
+            }
+        },
+        tableRowClassName ({row, rowIndex}) {
+            // 把每一行的索引放进row
+            row.index = rowIndex;
+        },
+        cellClick (row, column, cell, event) {
+            let _this = this;
+            this.rowIndex = row.index;
+            this.columnId = column.id;
+            let disabledFlag = false;
+            // if (!row[column.property] && row[column.property] !== null && row[column.property] !== '') {
+            //     _this.keyDown(event, true);
+            // }
+            _this.editSetFlag = row.index + column.id;
+            _this.focusTarget = event.target;
+            while (_this.focusTarget.tagName !== 'TD') {
+                _this.focusTarget = _this.focusTarget.parentElement;
+            }
+            _this.$nextTick(() => {
+                let target = this.focusTarget;
+                $(target).find('input').focus();
+            });
+        },
+        // 只允许对可编辑数据进行操作
+        checkboxT (row, index) {
+            let _this = this;
+            if (row.ed === 1 || _this.loginName === 'admin') {
+                return true;
+            } else {
+                return false;
+            }
+        },
+        handleSelectionChange (val) {
+            let that = this;
+            let tableFormDataObj = {};
+            let arr = [];
+            for (let item of val) {
+                arr.push(item.seq);
+            }
+            this.seqArr = arr.sort(sortNumber);
+            for (let item of that.tableData) {
+                item.isSelection = false;
+            }
+            for (let item of val) {
+                let obj = {};
+                let xId = item.itemId + '-' + item.clock;
+                if (that.tableFormDataObj[xId]) {
+                    // 如果已存在该数据则使用该数据
+                    tableFormDataObj[xId] = that.tableFormDataObj[xId];
+                } else {
+                    // 负责则从对应行中获取行内原数据
+                    for (let key in item) {
+                        obj[key] = item[key];
+                    }
+                    tableFormDataObj[xId] = obj;
+                }
+                item.isSelection = true;
+            }
+            that.tableFormDataObj = tableFormDataObj;
+            that.multipleSelection = val;
+        },
+        // 批量修改
+        but_edit_plural () {
+            let that = this;
+            if (that.multipleSelection.length > 0) {
+                that.$refs['dialog_form_arr'].validate((valid, msg) => {
+                    if (valid) {
+                        let SubmitData = [];
+                        for (let key in that.tableFormDataObj) {
+                            let correctvalue = Number(that.tableFormDataObj[key].apportValue) - Number(that.tableFormDataObj[key].actualValue);
+                            SubmitData.push({
+                                type: that.filterForm.data.type,
+                                itemid: that.tableFormDataObj[key].itemId,
+                                clock: that.tableFormDataObj[key].clock,
+                                timegranid: that.tableFormDataObj[key].timegranId,
+                                actualvalue: that.tableFormDataObj[key].actualValue,
+                                correctvalue: correctvalue,
+                                apportvalue: that.tableFormDataObj[key].apportValue,
+                                bz: that.tableFormDataObj[key].bz
+                            });
+                        }
+                        that.loading = true;
+                        that.axios.put('pass/ems/v1/ifmesemsswapfile/updateProductAndMaterial', SubmitData)
+                            .then(function (res) {
+                                if (res.code === '0') {
+                                    that.$message({
+                                        message: '保存成功',
+                                        type: 'success'
+                                    });
+                                    that.getTableData();
+                                    that.dialog.editorBox.show = false;
+                                } else {
+                                    that.$message.error(res.message);
+                                }
+                                that.loading = false;
+                            }).catch(function () {
+                                that.loading = false;
+                            });
+                        } else {
+                           this.$message.error('修改失败');
+                        }
+                });
+            } else {
+                this.$message.error('至少要选择一条数据');
+            }
+        },
+        // 重新生成数据
+        but_redata () {
+            let that = this;
+            that.$confirm('是否生成数据?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                state: 'warning'
+            }).then(() => {
+                that.loading = true;
+                let url = 'pass/ems/v1/ifmesemsswapfile/generateProductAndMaterial'
+                that.axios.get(url)
+                    .then(function (res) {
+                        if (res.code === '0') {
+                            if (res.message && res.message !== '操作成功') {
+                                that.$message.warning('重新生成数据成功, 其中【' + res.message + '】');
+                            } else {
+                                that.$message({
+                                    message: res.data,
+                                    type: 'success'
+                                });
+                            }
+                            that.getTableData();
+                        } else {
+                            that.$message.error(res.message);
+                        }
+                        that.loading = false;
+                    }).catch(function () {
+                        that.loading = false;
+                    });
+            }).catch(() => {
+            });
+        }
+    }
+}
+function sortNumber (a, b) {
+  return a - b
+}
+</script>
+
+<style lang="less">
+.measuringManualEntry{
+    min-width: 700px;
+    height: 100%;
+    .box {
+        height: 100%;
+        padding: 15px 15px 0 15px;
+        .box-top {
+            .el-form-item {
+                margin-bottom: 7px;
+            }
+            .box-top-gjl {
+                overflow: hidden;
+                padding: 7px 0;
+                border-top: 1px solid #ccc;
+            }
+        }
+        .rowDisable td {
+            color: #6bb025 !important;
+        }
+        .el-table .el-table__row {
+            height: 35px;
+        }
+        .el-table__body .el-form-item--mini.el-form-item {
+            margin: 0px;
+            .error {
+                overflow: hidden;
+                color: #f56c6c;
+                font-size: 12px;
+                line-height: 1;
+            }
+        }
+    }
+    .cnspicuous .el-checkbox__input.is-disabled .el-checkbox__inner {
+        background-color: #dcdfe6;
+        border-color: #babbbf;
+    }
+}
+</style>

+ 970 - 0
src/views/energyScheduling/components/investAndProduce/productMaterialsInput.vue

@@ -0,0 +1,970 @@
+<template>
+    <!-- 实际投入人工录入 -->
+    <div class="measuringManualEntry">
+        <div class="box">
+            <div class="box-top">
+                <el-form
+                    style="overflow: hidden;"
+                    :style="filterForm.show ? null : { height: '0px' }"
+                    size="mini"
+                    label-width="80px"
+                >
+                    <el-row>
+                        <el-col :span="4">
+                            <el-form-item label="时间粒度">
+                                <el-select
+                                    filterable clearable
+                                    v-model="filterForm.data.timegranid"
+                                    placeholder=""
+                                    style="width: 100%;"
+                                >
+                                    <el-option
+                                        v-for="item of nameObj.timegranid.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="5">
+                            <el-form-item label="日期">
+                                <zj-timegran-date
+                                    v-model="filterForm.data.clock"
+                                    style="width: 100%;"
+                                    :type="'daterange'"
+                                    :timegranId="filterForm.data.timegranid"
+                                    :oneFoo="getTableData"
+                                    :defaultOffset="-1"
+                                    :custom="custom"
+                                ></zj-timegran-date>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="5">
+                            <el-form-item label="工序">
+                                <el-select
+                                    filterable clearable
+                                    v-model="filterForm.data.workproc"
+                                    placeholder="工序"
+                                    multiple
+                                    collapse-tags
+                                    style="width: 100%;"
+                                >
+                                    <el-option
+                                        v-for="item of nameObj.workproc.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                        <el-col :span="5">
+                            <el-form-item label="物料名称">
+                                <el-select
+                                    filterable
+                                    clearable
+                                    v-model="filterForm.data.materialname"
+                                    placeholder="物料名称"
+                                    style="width: 100%;"
+                                ><template v-if="filterForm.data.type==='1'">
+                                    <el-option
+                                        v-for="item of nameObj.materialid.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </template>
+                                <template v-if="filterForm.data.type==='2'">
+                                    <el-option
+                                        v-for="item of nameObj.productid.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </template>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                         <el-col :span="4">
+                            <el-form-item label="物料编码">
+                                <el-input clearable
+                                    v-model.trim="filterForm.data.materialcode"
+                                    placeholder="物料编码"
+                                    style="width: 100%;"
+                                    @keyup.enter.native="getTableData(1)"
+                                ></el-input>
+                            </el-form-item>
+                        </el-col>
+                    </el-row><el-row>
+                        <el-col :span="4">
+                            <el-form-item label="数据类型">
+                                <el-select
+                                    filterable
+                                    v-model="filterForm.data.type"
+                                    placeholder="数据类型"
+                                    collapse-tags
+                                    style="width: 100%;"
+                                >
+                                    <el-option
+                                        v-for="item of nameObj.type.arr"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.name"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                </el-form>
+                <div class="box-top-gjl">
+                    <el-button
+                        class="button"
+                        type="primary"
+                        size="mini"
+                        icon="el-icon-edit-outline"
+                        v-privilege="activeMenu + 'PUT'"
+                        @click="but_edit_plural()"
+                        :loading="loading"
+                    >保存</el-button>
+                    <div style="float:right; text-align: right;">
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            icon="el-icon-search"
+                            v-privilege="activeMenu + 'QUERY'"
+                            @click="getTableData(1)"
+                        >查询</el-button>
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            icon="el-icon-refresh"
+                            v-privilege="activeMenu + 'QUERY'"
+                            @click="tableDataCancel();"
+                        >重置</el-button>
+                        <el-button
+                            class="button"
+                            type="primary"
+                            size="mini"
+                            @click="but_redata()"
+                            :loading="loading"
+                        >生成数据</el-button>
+                        <el-button
+                            size="mini"
+                            :icon="filterForm.show ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"
+                            :title="filterForm.show ? '收起搜索区' : '展开搜索区'"
+                            @click="filterForm.show = !filterForm.show;
+                                $nextTick(() => {
+                                    singleTableHeight = getRoleHeight($refs['singleTable'].$el) - 45;
+                                }
+                            );"
+                        >{{ filterForm.show ? '收起' : '展开' }}</el-button>
+                    </div>
+                </div>
+            </div>
+            <div class="box-bottom">
+                <el-form
+                    size="mini"
+                    ref="dialog_form_arr"
+                    label-width="0px"
+                    :model="tableFormDataObj"
+                >
+                    <el-table stripe
+                        id="singleTable"
+                        ref="singleTable"
+                        :data="tableData"
+                        v-loading="tableLoading"
+                        style="width: 100%;"
+                        :height="singleTableHeight"
+                        border
+                        size="mini"
+                        highlight-current-row
+                        @selection-change="handleSelectionChange"
+                        show-summary
+                        :summary-method="getSummaries"
+                        :row-class-name="tableRowClassName"
+                        @cell-click="cellClick">
+                        <el-table-column
+                            type="selection"
+                            width="40"
+                            align="center"
+                            :selectable='checkboxT'
+                            fixed="left"
+                            class-name="cnspicuous"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="clock"
+                            label="时间"
+                            width="90px"
+                            fixed="left"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="timegranId"
+                            label="时间粒度"
+                            width="80px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <span>{{ nameObj.timegranid.obj[scope.row.timegranId] ? nameObj.timegranid.obj[scope.row.timegranId] : scope.row.timegranId }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="unit"
+                            label="计量单位"
+                            width="80px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <span>{{ nameObj.unitid.obj[scope.row.unit] ? nameObj.unitid.obj[scope.row.unit] : scope.row.unit }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="workproc"
+                            label="工序"
+                            width="100px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <span>{{ nameObj.workproc.obj[scope.row.workproc] ? nameObj.workproc.obj[scope.row.workproc] : scope.row.workproc }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="materialname"
+                            label="物料名称"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        ><template slot-scope="scope">
+                            <span v-if="filterForm.data.type==='2'">
+                            {{ nameObj.productid.obj[scope.row.materialname] ? nameObj.productid.obj[scope.row.materialname] : scope.row.materialname }}
+                            </span>
+                            <span v-if="filterForm.data.type==='1'">
+                            {{ nameObj.materialid.obj[scope.row.materialname] ? nameObj.materialid.obj[scope.row.materialname] : scope.row.materialname }}
+                            </span>
+                        </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="actualValue"
+                            label="计算值"
+                            width="120px"
+                            v-show="false"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="correctValue"
+                            label="修正值"
+                            width="120px"
+                            v-show="false"
+                            :show-overflow-tooltip="true"
+                        ><template slot-scope="scope">
+                            <span v-if="scope.row.isSelection && scope.row.state !== '2'">{{ rowSum(scope.row) }}</span>
+                            <span v-else>{{ scope.row.correctValue }}</span>
+                        </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="apportValue"
+                            label="最终值"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <el-form-item
+                                    v-if="scope.row.isSelection"
+                                    :prop="scope.row.itemId + '-' + scope.row.clock + '.apportValue'"
+                                    :rules="tableFormRules.apportValue"
+                                >
+                                    <el-input clearable
+                                        style="width: 100%;"
+                                        @keydown.native="keyDown" :id="scope.$index + scope.column.id"
+                                        v-model="tableFormDataObj[scope.row.itemId + '-' + scope.row.clock].apportValue"
+                                        refcous="true"
+                                    ></el-input>
+                                    <template slot="error" slot-scope="scope">
+                                        <p class="error" :title="scope.error">{{ scope.error }}</p>
+                                    </template>
+                                </el-form-item>
+                                <span v-else>{{scope.row.apportValue}}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="materialcode"
+                            label="物料编码"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="userId"
+                            label="创建人"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="createtime"
+                            label="创建时间"
+                            width="160px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="upMan"
+                            label="修改人"
+                            width="120px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="upTime"
+                            label="修改时间"
+                            width="160px"
+                            :show-overflow-tooltip="true"
+                        ></el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="bz"
+                            label="备注"
+                            width="180px"
+                            :show-overflow-tooltip="true"
+                        >
+                            <template slot-scope="scope">
+                                <el-form-item
+                                    v-if="scope.row.isSelection && (scope.row.ed === 1 || loginName === 'admin')"
+                                    :prop="scope.row.itemId + '-' + scope.row.clock + '.BZ'"
+                                    :rules="tableFormRules.bz"
+                                >
+                                    <el-input clearable
+                                        style="width: 100%;"
+                                        @keydown.native="keyDown" :id="scope.$index + scope.column.id"
+                                        v-model="tableFormDataObj[scope.row.itemId + '-' + scope.row.clock].bz"
+                                        refcous="true"
+                                    ></el-input>
+                                    <template slot="error" slot-scope="scope">
+                                        <p class="error" :title="scope.error">{{ scope.error }}</p>
+                                    </template>
+                                </el-form-item>
+                                <span v-else>{{scope.row.bz}}</span>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </el-form>
+                <el-pagination
+                    layout="total, sizes, prev, pager, next, jumper"
+                    :total="total"
+                    :page-sizes="[10, 20, 50, 100, 500, 1000]"
+                    :page-size="pageSize"
+                    :current-page.sync="pageNum"
+                    @size-change="tableSizeChange"
+                    @current-change="getTableData()"
+                    style="text-align: right;margin-top: 10px;"
+                ></el-pagination>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+import { zCheckNumber1, checkInteger } from '@/utils/validator.js'
+import timegranDate from '@/components/zg/timegranDate.vue'
+import {formatDate, commonSummaries, getCookie} from '@/utils/util.js';
+export default {
+    name: 'measuringManualEntry',
+    components: {
+        'zj-timegran-date': timegranDate
+    },
+    data () {
+        return {
+            custom: 1,
+            filterForm: {
+                show: true,
+                data: {
+                    clock: '',
+                    workproc: '',
+                    workprocid: '',
+                    prodline: '',
+                    state: '',
+                    materialname: '',
+                    materialcode: '',
+                    type: '1'
+                },
+                rules: {
+                }
+            },
+            pageNum: 1,
+            pageSize: 20,
+            total: 0,
+            singleTableHeight: 100,
+            tableData: [],
+            loading: false,
+            tableLoading: false,
+            multipleSelection: [],
+            tableFormDataObj: {},
+            tableFormRules: {
+                mintvalue: [
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                mendvalue: [
+                    { required: true, message: '该项不能为空', trigger: 'change' },
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                apportValue: [
+                    { required: true, message: '该项不能为空', trigger: 'change' },
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                correctValue: [
+                    { required: true, message: '该项不能为空', trigger: 'change' },
+                    { validator: zCheckNumber1, trigger: 'change' }
+                ],
+                bz: [],
+                xh: [
+                    { validator: checkInteger, trigger: 'change' }
+                ]
+            },
+            nameObj: {
+                type: {
+                    obj: {
+                        '1': '投入',
+                        '2': '产出'
+                    },
+                    arr: [
+                        {
+                            id: '1',
+                            name: '投入'
+                        },
+                        {
+                            id: '2',
+                            name: '产出'
+                        }
+                    ]
+                },
+                unitid: {
+                    obj: {},
+                    arr: []
+                },
+                timegranid: {
+                    obj: {
+                        'DAY': '日',
+                        'MONTH': '月',
+                        'YEAR': '年'
+                    },
+                    arr: [
+                        {
+                        id: 'DAY',
+                        name: '日'
+                        },
+                        {
+                        id: 'MONTH',
+                        name: '月'
+                        },
+                        {
+                          id: 'YEAR',
+                          name: '年'
+                        }
+                    ]
+                },
+                materialid: {
+                    obj: {},
+                    arr: []
+                },
+                workproc: {
+                    obj: {},
+                    arr: []
+                },
+                materialcode: {
+                    obj: {},
+                    arr: []
+                },
+                productid: {
+                    obj: {},
+                    arr: []
+                }
+            },
+            rowIndex: '',
+            columnId: '',
+            focusTarget: null,
+            seqArr: [],
+            editSetFlag: '',
+            loginName: 'admin' // getCookie('loginName')
+        }
+    },
+    created () {
+        // 获取按钮权限
+        this.activeMenu = window.localStorage.getItem('activeMenu');
+    },
+    mounted () {
+        let that = this;
+        window.PEDataObj = {
+            // 将数据绑定到window上,供main页面使用
+            vm: that,
+            // tableArr:用于导出成Excel的表格的信息
+            tableArr: [
+                {
+                    name: '',
+                    id: 'singleTable'
+                }
+            ]
+        };
+        that.$nextTick(() => {
+            // 立即获取的height有一定偏差,通过setTimeout延迟来解决
+            setTimeout(() => {
+                that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 45;
+            }, 1);
+        });
+        // 接收路由参数
+        if (that.$route.query.workprocid) {
+            that.filterForm.data.workprocid = that.$route.query.workprocid;
+            let its = that.filterForm.data.workprocid.split(',');
+            if (its && its.length > 10) {
+                that.pageSize = 50;
+                that.custom = 0;
+            }
+        }
+        that.getNodeData();
+        that.getUnitIdData();
+        that.getProductIdData();
+        that.getMaterialIdData();
+        // that.getTableData();
+    },
+    methods: {
+        //  计算树区域高度
+        getRoleHeight (dom) {
+            return window.innerHeight - dom.offsetTop;
+        },
+        // 自定义的表格合计方法:只给指定列进行合计
+        getSummaries (param) {
+            const prop = ['actualValue', 'correctValue', 'apportValue']; // 合计列绑定的prop
+            return commonSummaries(param, prop);
+        },
+        // 获取原材料
+        getMaterialIdData () {
+            let that = this
+            let url = 'pass/ems/v1/trmmaterials/getIdAndName';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                        }
+                        that.nameObj.materialid.arr = arr;
+                        that.nameObj.materialid.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取产品
+        getProductIdData () {
+            let that = this
+            let url = 'pass/ems/v1/trmproducts/?pageSize=1000000';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data.list) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                        }
+                        that.nameObj.productid.arr = arr;
+                        that.nameObj.productid.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取工序列表
+        getNodeData () {
+            let that = this
+            let url = 'pass/ems/v1/trmworkprocs/getIdAndName?issettle=1';
+            console.log('工序呢');
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                        }
+                        that.nameObj.workproc.arr = arr;
+                        that.nameObj.workproc.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 获取标准计量单位
+        getUnitIdData () {
+            let that = this
+            let url = 'pass/ems/v1/trmunits/getIdAndName';
+            that.axios.get(url)
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        let obj = {};
+                        for (let item of res.data) {
+                            arr.push({
+                                id: item.id,
+                                name: item.name
+                            })
+                            obj[item.id] = item.name;
+                            if (item.name === '吨') {
+                                that.nameObj.unitid.defaults = that.nameObj.unitid.defaults ? that.nameObj.unitid.defaults : item.id;
+                            }
+                        }
+                        that.nameObj.unitid.arr = arr;
+                        that.nameObj.unitid.obj = obj;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                });
+        },
+        // 计算修正值
+        rowSum: function (item, event) {
+            let result = 0;
+            let that = this;
+            result = Number(that.tableFormDataObj[item.itemId + '-' + item.clock].apportValue) - Number(that.tableFormDataObj[item.itemId + '-' + item.clock].actualValue);
+            return result;
+        },
+        // 获取表格中的数据
+        getTableData (pageNum) {
+            let that = this,
+                params = {
+                    clock: that.filterForm.data.clock[0],
+                    clock2: that.filterForm.data.clock[1],
+                    prodline: that.filterForm.data.prodline,
+                    workprocid: that.filterForm.data.workprocid,
+                    workproc: that.filterForm.data.workproc.join(','),
+                    materialcode: that.filterForm.data.materialcode,
+                    materialname: that.filterForm.data.materialname,
+                    type: that.filterForm.data.type
+                };
+            that.pageNum = pageNum || that.pageNum;
+            that.tableLoading = true;
+            let url = 'pass/ems/v1/ifmesemsswapfile/queryProductAndMaterial/?pageNum=' + that.pageNum + '&pageSize=' + that.pageSize + '&itemtype=R';
+            that.axios.get(url, {
+                params: params
+            })
+                .then(function (res) {
+                    if (res.code === '0') {
+                        let arr = [];
+                        for (let i = 0; i < res.data.list.length; i++) {
+                            let item = res.data.list[i];
+                            arr.push({
+                                seq: i,
+                                clock: item.CLOCK,
+                                itemId: item.ITEMID,
+                                actualValue: item.ACTUALVALUE,
+                                correctValue: item.CORRECTVALUE,
+                                apportValue: item.APPORTVALUE,
+                                materialcode: item.MES_MATERIALCODE,
+                                materialname: item.MATERIALNAME,
+                                timegranId: item.TIMEGRANID,
+                                userId: item.USERID,
+                                createtime: item.UPDATETIME,
+                                upMan: item.UPMAN,
+                                upTime: item.UPTIME,
+                                unit: item.UNITID,
+                                workproc: item.WORKPROCID,
+                                bz: item.BZ
+                            })
+                        }
+                        that.tableData = arr;
+                        that.total = res.data.total;
+                    } else {
+                        that.$message.error(res.message);
+                    }
+                    that.$nextTick(() => {
+                        setTimeout(() => {
+                            that.singleTableHeight = that.getRoleHeight(that.$refs['singleTable'].$el) - 46;
+                        }, 1);
+                    });
+                    that.tableLoading = false;
+                }).catch(function () {
+                    that.tableLoading = false;
+                });
+        },
+        // 改变表格显示条数
+        tableSizeChange (val) {
+            let that = this;
+            that.pageSize = val;
+            that.getTableData(1);
+        },
+        // 重置搜索
+        tableDataCancel () {
+            let that = this;
+            for (let key in that.filterForm.data) {
+                if (!that.filterForm.disabled || !that.filterForm.disabled[key]) {
+                    if (that.filterForm.data[key] instanceof Array) {
+                        that.filterForm.data[key] = [];
+                    } else {
+                        that.filterForm.data[key] = '';
+                    }
+                }
+            }
+            // 接收路由参数
+            if (that.$route.query.workprocid) {
+                that.filterForm.data.workprocid = that.$route.query.workprocid;
+                let its = that.filterForm.data.workprocid.split(',');
+                if (its && its.length > 10) {
+                    that.pageSize = 50;
+                    that.custom = 0;
+                }
+            }
+            that.filterForm.data.type = '1';
+            that.getTableData(1);
+        },
+        keyDown (event1, disabledFlag) {
+            let tdTarget = event1.target;
+            let _this = this;
+            while (tdTarget.tagName !== 'TD') {
+                tdTarget = tdTarget.parentElement;
+            }
+            if (event.keyCode) {
+                _this.codeT = event.keyCode;
+            }
+            // 如果按下键盘下键或者回车键
+            if (event.keyCode === 40 || event.keyCode === 13) {
+                let index = parseInt(this.rowIndex);
+                if (index !== this.seqArr[this.seqArr.length - 1]) {
+                    for (let i = 0; i < this.seqArr.length; i++) {
+                        if (index === this.seqArr[i]) {
+                        index = this.seqArr[i + 1];
+                        break;
+                        }
+                    }
+                }
+                this.editSetFlag = index + this.columnId;
+                let id = '#' + this.editSetFlag;
+                this.$nextTick(() => {
+                    $(id).click();
+                });
+            } else if (event.keyCode === 38) { // 键盘上键
+                let index = parseInt(this.rowIndex);
+                if (index !== this.seqArr[0]) {
+                    for (let i = 0; i < this.seqArr.length; i++) {
+                        if (index === this.seqArr[i]) {
+                        index = this.seqArr[i - 1];
+                        break;
+                        }
+                    }
+                }
+                this.editSetFlag = index + this.columnId;
+                let id = '#' + this.editSetFlag;
+                this.$nextTick(() => {
+                    $(id).click();
+                });
+            } else if (event.keyCode === 37) { // 键盘左键
+                $(tdTarget).prev().click();
+                $(tdTarget).prev().find('input').select();
+            } else if (event.keyCode === 39) { // 键盘右键
+                $(tdTarget).next().click();
+                $(tdTarget).next().find('input').select();
+            }
+        },
+        tableRowClassName ({row, rowIndex}) {
+            // 把每一行的索引放进row
+            row.index = rowIndex;
+        },
+        cellClick (row, column, cell, event) {
+            let _this = this;
+            this.rowIndex = row.index;
+            this.columnId = column.id;
+            let disabledFlag = false;
+            // if (!row[column.property] && row[column.property] !== null && row[column.property] !== '') {
+            //     _this.keyDown(event, true);
+            // }
+            _this.editSetFlag = row.index + column.id;
+            _this.focusTarget = event.target;
+            while (_this.focusTarget.tagName !== 'TD') {
+                _this.focusTarget = _this.focusTarget.parentElement;
+            }
+            _this.$nextTick(() => {
+                let target = this.focusTarget;
+                $(target).find('input').focus();
+            });
+        },
+        // 只允许对可编辑数据进行操作
+        checkboxT (row, index) {
+            let _this = this;
+            if (row.ed === 1 || _this.loginName === 'admin') {
+                return true;
+            } else {
+                return false;
+            }
+        },
+        handleSelectionChange (val) {
+            let that = this;
+            let tableFormDataObj = {};
+            let arr = [];
+            for (let item of val) {
+                arr.push(item.seq);
+            }
+            this.seqArr = arr.sort(sortNumber);
+            for (let item of that.tableData) {
+                item.isSelection = false;
+            }
+            for (let item of val) {
+                let obj = {};
+                let xId = item.itemId + '-' + item.clock;
+                if (that.tableFormDataObj[xId]) {
+                    // 如果已存在该数据则使用该数据
+                    tableFormDataObj[xId] = that.tableFormDataObj[xId];
+                } else {
+                    // 负责则从对应行中获取行内原数据
+                    for (let key in item) {
+                        obj[key] = item[key];
+                    }
+                    tableFormDataObj[xId] = obj;
+                }
+                item.isSelection = true;
+            }
+            that.tableFormDataObj = tableFormDataObj;
+            that.multipleSelection = val;
+        },
+        // 批量修改
+        but_edit_plural () {
+            let that = this;
+            if (that.multipleSelection.length > 0) {
+                that.$refs['dialog_form_arr'].validate((valid, msg) => {
+                    if (valid) {
+                        let SubmitData = [];
+                        for (let key in that.tableFormDataObj) {
+                            let correctvalue = Number(that.tableFormDataObj[key].apportValue) - Number(that.tableFormDataObj[key].actualValue);
+                            SubmitData.push({
+                                type: that.filterForm.data.type,
+                                itemid: that.tableFormDataObj[key].itemId,
+                                clock: that.tableFormDataObj[key].clock,
+                                timegranid: that.tableFormDataObj[key].timegranId,
+                                actualvalue: that.tableFormDataObj[key].actualValue,
+                                correctvalue: correctvalue,
+                                apportvalue: that.tableFormDataObj[key].apportValue,
+                                bz: that.tableFormDataObj[key].bz
+                            });
+                        }
+                        that.loading = true;
+                        that.axios.put('pass/ems/v1/ifmesemsswapfile/updateProductAndMaterial', SubmitData)
+                            .then(function (res) {
+                                if (res.code === '0') {
+                                    that.$message({
+                                        message: '保存成功',
+                                        type: 'success'
+                                    });
+                                    that.getTableData();
+                                    that.dialog.editorBox.show = false;
+                                } else {
+                                    that.$message.error(res.message);
+                                }
+                                that.loading = false;
+                            }).catch(function () {
+                                that.loading = false;
+                            });
+                        } else {
+                           this.$message.error('修改失败');
+                        }
+                });
+            } else {
+                this.$message.error('至少要选择一条数据');
+            }
+        },
+        // 重新生成数据
+        but_redata () {
+            let that = this;
+            that.$confirm('是否生成数据?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                state: 'warning'
+            }).then(() => {
+                that.loading = true;
+                let url = 'pass/ems/v1/ifmesemsswapfile/generateProductAndMaterial'
+                that.axios.get(url)
+                    .then(function (res) {
+                        if (res.code === '0') {
+                            if (res.message && res.message !== '操作成功') {
+                                that.$message.warning('重新生成数据成功, 其中【' + res.message + '】');
+                            } else {
+                                that.$message({
+                                    message: res.data,
+                                    type: 'success'
+                                });
+                            }
+                            that.getTableData();
+                        } else {
+                            that.$message.error(res.message);
+                        }
+                        that.loading = false;
+                    }).catch(function () {
+                        that.loading = false;
+                    });
+            }).catch(() => {
+            });
+        }
+    }
+}
+function sortNumber (a, b) {
+  return a - b
+}
+</script>
+
+<style lang="less">
+.measuringManualEntry{
+    min-width: 700px;
+    height: 100%;
+    .box {
+        height: 100%;
+        padding: 15px 15px 0 15px;
+        .box-top {
+            .el-form-item {
+                margin-bottom: 7px;
+            }
+            .box-top-gjl {
+                overflow: hidden;
+                padding: 7px 0;
+                border-top: 1px solid #ccc;
+            }
+        }
+        .rowDisable td {
+            color: #6bb025 !important;
+        }
+        .el-table .el-table__row {
+            height: 35px;
+        }
+        .el-table__body .el-form-item--mini.el-form-item {
+            margin: 0px;
+            .error {
+                overflow: hidden;
+                color: #f56c6c;
+                font-size: 12px;
+                line-height: 1;
+            }
+        }
+    }
+    .cnspicuous .el-checkbox__input.is-disabled .el-checkbox__inner {
+        background-color: #dcdfe6;
+        border-color: #babbbf;
+    }
+}
+</style>

+ 21 - 0
src/views/energyScheduling/router/index.js

@@ -26,6 +26,12 @@ import energyDispatch from '@/views/energyScheduling/components/dispatchingLog/e
 import measuringManualEntry from '@/views/energyScheduling/components/meterManage/measuringManualEntry.vue'
 // 计量点数据录入十分钟
 import measuringLocationQueryTiming from '@/views/energyScheduling/components/measuringLocationData/measuringLocationQueryTiming.vue'
+// 投入产出实际
+import investAndProduceManage from '@/views/energyScheduling/components/investAndProduce/investAndProduceManage.vue'
+// 产出实际
+import productMaterialsInOut from '@/views/energyScheduling/components/investAndProduce/productMaterialsInOut.vue'
+// 投入实际
+import productMaterialsInput from '@/views/energyScheduling/components/investAndProduce/productMaterialsInput.vue'
 
 Vue.use(Router)
 
@@ -92,6 +98,21 @@ export default new Router({
                 path: 'measuringLocationQueryTiming',
                 name: 'measuringLocationQueryTiming',
                 component: measuringLocationQueryTiming
+            },
+            {
+                path: 'investAndProduceManage',
+                name: 'investAndProduceManage',
+                component: investAndProduceManage
+            },
+            {
+                path: 'productMaterialsInOut',
+                name: 'productMaterialsInOut',
+                component: productMaterialsInOut
+            },
+            {
+                path: 'productMaterialsInput',
+                name: 'productMaterialsInput',
+                component: productMaterialsInput
             }
         ]
     }]