123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437 |
- <template>
- <!-- 国贸计划审核 -->
- <div class="outElectricity">
- <div class="box">
- <div class="box-top">
- <el-form
- style="overflow: hidden;"
- :style="filterForm.show ? null : { height: '0px' }"
- size="mini"
- label-width="75px"
- >
- <el-row>
- <el-col :span="6">
- <el-form-item label="排产日期">
- <zj-timegran-date
- v-model="filterForm.data.time"
- style="width: 100%;"
- :type="'daterange'"
- :oneFoo="getTableData"
- :custom ="1"
- ></zj-timegran-date>
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label="编号">
- <el-input
- v-model="filterForm.data.id"
- style="width: 100%;"
- refcous="true"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label="工序">
- <el-select
- filterable clearable
- collapse-tags
- v-model="filterForm.data.workprocType"
- multiple
- placeholder=""
- style="width: 100%;"
- >
- <el-option
- v-for="item of nameObj.workprocid.arr"
- :key="item.id"
- :value="item.id"
- :label="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label="状态">
- <el-select
- filterable
- collapse-tags
- v-model="filterForm.data.state"
- multiple
- placeholder=""
- style="width: 100%;"
- >
- <el-option
- v-for="item of nameObj.state.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-form size="mini" label-width="75px">
- <el-row>
- <el-col :span="16">
- <el-button
- type="primary"
- size="mini"
- icon="el-icon-add-outline"
- @click="passaudits()"
- :loading="loading"
- >审核下发</el-button>
- <el-button
- size="mini"
- type="danger"
- icon="el-icon-add-outline"
- @click="turndown()"
- :loading="loading"
- >取消下发</el-button>
- </el-col>
- <el-col :span="8">
- <div style="float:right; text-align: right;">
- <el-button
- class="button"
- type="primary"
- size="mini"
- icon="el-icon-search"
- v-if="butPrivilege.QUERY"
- @click="getTableData()"
- >查询</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>
- </el-col>
- </el-row>
- </el-form>
- </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"
- :summary-method="getSummaries"
- :row-class-name="tableRowClassName"
- @cell-click="cellClick"
- @expand-change="rowClick"
- >
- <el-table-column
- type="selection"
- width="40"
- align="center"
- fixed="left"
- class-name="cnspicuous"
- ></el-table-column>
- <el-table-column
- sortable
- prop="id"
- label="编号"
- align="center"
- fixed="left"
- width="120px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="workprocType"
- label="工序"
- align="center"
- fixed="left"
- width="120px"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="scope">
- <span>{{ nameObj.workprocid.obj[scope.row.workprocType] ? nameObj.workprocid.obj[scope.row.workprocType].name : scope.row.workprocType }}</span>
- </template>
- </el-table-column>
- <el-table-column
- sortable
- prop="jhTime"
- label="排产日期"
- align="center"
- fixed="left"
- width="88px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="deliveryDate"
- label="交货日期"
- align="center"
- fixed="left"
- width="88px"
- :show-overflow-tooltip="true"
- ></el-table-column>
- <el-table-column
- sortable
- prop="state"
- label="状态"
- align="center"
- fixed="left"
- width="88px"
- :show-overflow-tooltip="true"
- >
- <template slot-scope="scope">
- <span
- :style="{color: nameObj.state.obj[scope.row.state] ? nameObj.state.obj[scope.row.state].color : ''}"
- >{{ nameObj.state.obj[scope.row.state] ? nameObj.state.obj[scope.row.state].name : scope.row.state }}</span>
- </template>
- </el-table-column>
- <el-table-column
- sortable
- prop="grades"
- label="钢种"
- align="center"
- fixed="left"
- width="106px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="specifications"
- label="规格"
- align="center"
- fixed="left"
- width="105px"
- :show-overflow-tooltip="true"
- v-if="filterForm.data.gx!='XG'"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="lengths"
- label="长度"
- align="center"
- width="80px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <!-- <el-table-column
- sortable
- prop="lengthTimesWidth"
- label="高度*宽度"
- align="center"
- width="120px"
- :show-overflow-tooltip="true"
- >
- </el-table-column> -->
- <el-table-column
- sortable
- prop="planWeight"
- label="计划量"
- align="center"
- width="60px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="transportType"
- label="运输方式"
- align="center"
- width="87px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="purpose"
- label="用途"
- align="center"
- width="87px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="gmReviewer"
- label="审核人"
- align="center"
- min-width="120px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="gmReviewerTime"
- label="审核时间"
- align="center"
- width="120px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="createMan"
- label="创建人"
- align="center"
- width="120px"
- :show-overflow-tooltip="true"
- >
- </el-table-column>
- <el-table-column
- sortable
- prop="createTime"
- label="创建时间"
- align="center"
- width="120px"
- :show-overflow-tooltip="true"
- >
- </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 } from '~/utils/validator.js';
- import timegranDate from '~/components/zg/timegranDate.vue';
- import {formatDate, commonSummaries, getCookie} from '@/utils/util.js';
- import store from '@/store/index.js';
- export default {
- name: 'outElectricity',
- components: {
- 'zj-timegran-date': timegranDate
- },
- data () {
- let setDate = new Date();
- setDate.setDate(15);
- setDate.setMonth((setDate.getMonth() - 1));
- return {
- rowIndex: '',
- columnId: '',
- focusTarget: null,
- seqArr: [],
- editSetFlag: '',
- isCheck: false, // 是否为审核人
- isClick: false,
- filterForm: {
- show: true,
- data: {
- show: false,
- id: '',
- workprocType: [],
- state: ['1'],
- time: [(new Date() - 3600 * 1000 * 24 * 7), (new Date() + 3600 * 1000 * 24 * 7)]
- },
- rules: {
- },
- disabled: {
- networkid: false
- }
- },
- pageNum: 1,
- pageSize: 100,
- total: 0,
- singleTableHeight: 100,
- tableData: [
- ],
- expands: {},
- loading: false,
- tableLoading: false,
- multipleSelection: [],
- tableFormDataObj: {},
- nameObj: {
- state: {
- obj: {
- '1': {
- name: '等待审核',
- color: '#7a7a7a'
- },
- '2': {
- name: '已下发',
- color: 'green'
- },
- '3': {
- name: '已接收',
- color: 'red'
- }
- },
- arr: [
- {
- id: '1',
- name: '等待审核',
- color: '#7a7a7a'
- },
- {
- id: '2',
- name: '已下发',
- color: 'green'
- },
- {
- id: '3',
- name: '已接收',
- color: 'red'
- }
- ]
- },
- roleList: {
- obj: {},
- arr: []
- },
- type: {
- obj: {
- '0': '否',
- '1': '是'
- },
- arr: [
- {
- id: '0',
- name: '否'
- },
- {
- id: '1',
- name: '是'
- }
- ]
- },
- transportType: {
- obj: {'0': {name: '火运'}, '1': {name: '汽运'}, '2': {name: '汽运或者火运'}},
- arr: [
- {
- id: '0',
- name: '火运'
- },
- {
- id: '1',
- name: '汽运'
- },
- {
- id: '2',
- name: '汽运或者火运'
- }
- ]
- },
- workprocid: {
- obj: {'AT2004': {name: '炼钢'}, 'AT2005': {name: '一高线'}, 'AT2006': {name: '二高线'}, 'AT2007': {name: '型钢'}},
- arr: [
- {
- id: 'AT2004',
- name: '炼钢'
- },
- {
- id: 'AT2005',
- name: '一高线'
- },
- {
- id: 'AT2006',
- name: '二高线'
- },
- {
- id: 'AT2007',
- name: '型钢'
- }
- ]
- },
- location: {
- obj: {},
- arr: [],
- showDataArr: []
- },
- purpose: {
- obj: {
- '0': {name: '标准件'},
- '1': {name: '铁丝'},
- '2': {name: '钢丝、弹簧'}
- },
- arr: [
- {
- id: '0',
- name: '标准件'
- },
- {
- id: '1',
- name: '铁丝'
- },
- {
- id: '2',
- name: '钢丝、弹簧'
- }
- ]
- },
- locateid: {
- obj: {},
- arr: []
- },
- networkid: {
- obj: {},
- arr: []
- },
- userId: {
- obj: {},
- arr: []
- },
- unitid: {
- obj: {},
- arr: [],
- defaults: ''
- },
- grades: {
- obj: {},
- arr: []
- },
- specifications: {
- obj: {},
- arr: []
- },
- lengthTimeswidth: {
- obj: {},
- arr: []
- },
- chemicalStandard: {
- obj: {},
- arr: []
- }
- },
- butPrivilege: {
- QUERY: false,
- PUT: false,
- CHECK: false,
- UNDOCHECK: false
- },
- loginName: getCookie('loginName'),
- userInfo: {},
- userRoles: {},
- qrRole: [],
- spread: false,
- store
- }
- },
- created () {
- // 获取按钮权限
- this.activeMenu = window.localStorage.getItem('activeMenu');
- for (let key in this.butPrivilege) {
- this.butPrivilege[key] = this.checkPrivilege(this.activeMenu + key);
- }
- },
- 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.workproc_type) {
- that.filterForm.data.workproc_type = that.$route.query.workproc_type;
- }
- // 当有审核与取消审核权限时,默认其为审核人,审核人无法修改数据
- if (that.butPrivilege.CHECK || that.butPrivilege.UNDOCHECK) {
- that.isCheck = true;
- }
- // 管理员在这里录入数据
- if (that.loginName === 'admin' && that.filterForm.disabled.networkid) {
- that.isCheck = false;
- }
- // 接收路由参数
- if (that.$route.query.gx) {
- that.filterForm.data.gx = that.$route.query.gx;
- let its = that.filterForm.data.gx.split(',');
- if (its && its.length > 10) {
- that.pageSize = 50;
- that.custom = 0;
- }
- }
- that.getUnitIdData();
- // that.getlengthTimesWidth();
- that.getRoles();
- },
- methods: {
- // 计算树区域高度
- getRoleHeight (dom) {
- return window.innerHeight - dom.offsetTop;
- },
- // 自定义的表格合计方法:只给指定列进行合计
- getSummaries (param) {
- const prop = ['planWeight']; // 合计列绑定的prop
- return commonSummaries(param, prop);
- },
- rowClick (row) {
- let that = this,
- params = {
- parentid: row.id
- };
- that.tableLoading = true;
- let url = 'pass/ems/v1/emsprodplanrounds/getRounds';
- that.axios.get(url, {
- params: params
- })
- .then(function (res) {
- if (res.code === '0') {
- let chirItem = Object.keys(res.data[0])[0];
- that.expands[chirItem] = res.data[0][chirItem];
- } else {
- that.$message.error(res.message);
- }
- that.tableLoading = false;
- }).catch(function () {
- that.tableLoading = false;
- });
- },
- // 获取高线钢种
- getGrades () {
- let that = this
- let type = '';
- if (that.filterForm.data.gx === 'GX') {
- type = '高线'
- }
- if (that.filterForm.data.gx === 'XG') {
- type = '型钢'
- }
- let url = 'pass/product/v1/emssteel/getGrades/?type=' + type;
- 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.steelName
- })
- obj[item.id] = {
- name: item.steelName,
- id: item.id
- }
- }
- that.nameObj.grades.arr = arr;
- that.nameObj.grades.obj = obj;
- } else {
- that.$message.error(res.message);
- }
- });
- },
- // 获取高线规格
- getSpecifications () {
- let that = this
- let url = 'pass/product/v1/emssteel/getSpecifications/?type=' + '高线';
- 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.specName
- })
- obj[item.id] = {
- name: item.specName,
- unitid: item.id
- }
- }
- that.nameObj.specifications.arr = arr;
- that.nameObj.specifications.obj = obj;
- } else {
- that.$message.error(res.message);
- }
- });
- },
- // 获取高线执行标准
- getStandards () {
- let that = this
- let url = 'pass/product/v1/emsstandard/getStandards';
- 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.basecode,
- name: item.basename
- })
- }
- that.nameObj.chemicalStandard.arr = arr;
- that.nameObj.chemicalStandard.obj = obj;
- } else {
- that.$message.error(res.message);
- }
- });
- },
- // 获取炼钢钢种
- getGradesASLg () {
- let that = this
- let url = 'pass/product/v1/emsvqcmbasesteel/getBase'
- 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] = {
- name: item.name,
- id: item.id
- }
- }
- that.nameObj.grades.arr = arr;
- that.nameObj.grades.obj = obj;
- } else {
- that.$message.error(res.message);
- }
- });
- },
- // 获取炼钢规格
- getSpecificationsAsLg () {
- let that = this
- let url = 'pass/product/v1/emsvqcmbasespecbillet/getbasespecbillet';
- 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] = {
- name: item.name,
- id: item.id
- }
- }
- that.nameObj.specifications.arr = arr;
- that.nameObj.specifications.obj = obj;
- } else {
- that.$message.error(res.message);
- }
- });
- },
- // 获取炼钢化学成分标准
- getStandardsAsLg () {
- let that = this
- let url = 'pass/product/v1/emsvqcmstdchem/getstdchem';
- 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.basecode,
- name: item.standardgb
- })
- }
- that.nameObj.chemicalStandard.arr = arr;
- that.nameObj.chemicalStandard.obj = obj;
- } else {
- that.$message.error(res.message);
- }
- });
- },
- // 获取型钢宽度*长度
- // getlengthTimesWidth () {
- // let that = this
- // let url = 'pass/ems/v1/emsprodplanrounds/getbasespecbillet';
- // 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.specifications
- // })
- // }
- // that.nameObj.specifications.arr = arr;
- // that.nameObj.specifications.obj = obj;
- // } else {
- // that.$message.error(res.message);
- // }
- // });
- // },
- connn () {
- let that = this;
- if (!that.filterForm.data.networkid || that.filterForm.data.networkid.length === 0) {
- that.nameObj.location.showDataArr = that.nameObj.workprocid.arr;
- } else {
- let url = 'pass/ems/v1/emsprodplanmonths/getWorkprocs'
- that.axios.get(url)
- .then(function (res) {
- if (res.code === '0') {
- let arr = [];
- for (let item of res.data) {
- arr.push({
- id: item.id,
- name: item.name
- })
- }
- that.nameObj.location.showDataArr = arr;
- } else {
- that.$message.error(res.message);
- }
- });
- }
- },
- // 保存数据
- dataSave () {
- let that = this;
- let SubmitData = {
- jhTime: that.dialog.editorBox.form.data.jhTime,
- grades: that.dialog.editorBox.form.data.grades,
- unitid: '008',
- chemicalStandard: that.dialog.editorBox.form.data.chemicalStandard,
- planWeight: that.dialog.editorBox.form.data.planWeight,
- specifications: that.dialog.editorBox.form.data.specifications,
- transportType: that.dialog.editorBox.form.data.transportType,
- memo: that.dialog.editorBox.form.data.memo,
- workprocType: that.filterForm.data.workproc_type,
- lengths: that.dialog.editorBox.form.data.lengths,
- purpose: that.dialog.editorBox.form.data.purpose,
- iateralArea: that.dialog.editorBox.form.data.iateralArea,
- deliveryDate: that.dialog.editorBox.form.data.deliveryDate,
- lengthTimesWidth: that.dialog.editorBox.form.data.lengthTimesWidth,
- dimension: that.dialog.editorBox.form.data.dimension,
- surfaceStandard: that.dialog.editorBox.form.data.surfaceStandard,
- state: '0'
- };
- that.$refs['dialog_form'].validate((valid) => {
- if (valid) {
- that.loading = true;
- that.axios.post('pass/ems/v1/emsgmpcjhs/', SubmitData, {
- contentType: 'application/json'
- })
- .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;
- });
- }
- });
- },
- // 获取表格中的数据
- getTableData (pageNum) {
- let that = this,
- params = {},
- pData = {
- startTime: that.filterForm.data.time[0],
- endTime: that.filterForm.data.time[1],
- id: that.filterForm.data.id,
- workprocType: that.filterForm.data.workprocType.toString(),
- state: that.filterForm.data.state.toString() === '' ? '1,2,3,4' : that.filterForm.data.state.toString()
- };
- for (let key in pData) {
- if (pData[key]) {
- params[key] = pData[key];
- }
- }
- that.pageNum = pageNum || that.pageNum;
- that.tableLoading = true;
- let url = 'pass/ems/v1/emsgmpcjhs/getShData/?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];
- arr.push({
- seq: i,
- id: item.id,
- jhTime: item.jhTime,
- deliveryDate: item.deliveryDate,
- state: item.state,
- unitid: item.unitid,
- grades: item.grades,
- specifications: item.specifications,
- lengths: item.lengths,
- lengthTimesWidth: item.lengthTimesWidth,
- transportType: item.transportType,
- purpose: item.purpose,
- workprocType: item.workprocType,
- createMan: item.createMan,
- createTime: item.createTime,
- planWeight: item.planWeight,
- gmReviewer: item.gmReviewer,
- gmReviewerTime: item.gmReviewerTime
- });
- }
- that.total = res.data.total;
- that.tableData = arr;
- that.getAdds();
- } 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);
- },
- keyDown (event1, disabledFlag) {
- let tdTarget = event1.target;
- let _this = this;
- while (tdTarget.tagName !== 'TD') {
- tdTarget = tdTarget.parentElement;
- }
- // 如果按下键盘下键或者回车键
- if (event.keyCode === 40 || event.keyCode === 13) {
- let index = parseInt(this.rowIndex);
- // index++;
- 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).prevAll().find('input:text').last().click();
- } else if (event.keyCode === 39) { // 键盘右键
- $(tdTarget).nextAll().find('input').eq(0).click();
- }
- },
- // 只允许对未接受的数据进行操作
- checkboxT (row, index) {
- if (row.state === '3' && !this.isCheck) {
- return false;
- } else {
- return true;
- }
- },
- // 获取标准计量单位
- 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);
- }
- });
- },
- 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.seq;
- if (that.tableFormDataObj[xId]) {
- // 如果已存在该数据则使用该数据
- tableFormDataObj[xId] = that.tableFormDataObj[xId];
- } else {
- // 负责则从对应行中获取行内原数据
- for (let key in item) {
- obj[key] = item[key];
- }
- item.realvalue = (!isNaN(Number(item.apportvalue)) && !isNaN(Number(item.wastage))) ? Number(item.apportvalue) + Number(item.wastage) - Number(item.secondVal) : item.realvalue;
- tableFormDataObj[xId] = obj;
- }
- item.isSelection = true;
- }
- for (let item of that.tableData) {
- if (item.isSelection === false) {
- item.realvalue = (!isNaN(Number(item.apportvalue)) && !isNaN(Number(item.wastage))) ? Number(item.apportvalue) + Number(item.wastage) - Number(item.secondVal) : item.realvalue;
- }
- }
- that.tableFormDataObj = tableFormDataObj;
- that.multipleSelection = val;
- this.getAdds();
- },
- handleclickChange (row, column, cell, event) {
- let that = this;
- if (column.label === '计划量' && !this.isClick) {
- that.isClick = true;
- } else {
- that.isClick = false;
- }
- },
- getApportValue (seq, value, rowIndex, event) {
- let that = this;
- if (!isNaN(Number(value))) {
- if (!isNaN(Number(that.tableFormDataObj[seq].mintvalue)) && !isNaN(Number(that.tableFormDataObj[seq].mendvalue)) && that.tableFormDataObj[seq].mintvalue !== null && that.tableFormDataObj[seq].mendvalue !== null) {
- let poor = that.floatComputed(Number(that.tableFormDataObj[seq].mendvalue), Number(that.tableFormDataObj[seq].mintvalue), '-');
- that.tableFormDataObj[seq].apportvalue = that.floatComputed(poor, Number(that.tableFormDataObj[seq].mods), '*').toFixed(0);
- let rv1 = that.floatComputed(Number(that.tableFormDataObj[seq].apportvalue), Number(that.tableFormDataObj[seq].wastage), '+');
- that.tableFormDataObj[seq].realvalue = that.floatComputed(rv1, Number(that.tableFormDataObj[seq].secondVal), '-').toFixed(0);
- that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
- }
- }
- },
- // 手动修改抄度后计算实际电量
- chnageApportvalue (seq, value, rowIndex) {
- let that = this;
- if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].wastage))) {
- that.tableFormDataObj[seq].realvalue = that.floatComputed(Number(value), Number(that.tableFormDataObj[seq].wastage), '+').toFixed(0);
- }
- that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
- },
- // 手动修改损耗后计算实际电量
- chnageWastage (seq, value, rowIndex) {
- let that = this;
- if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].apportvalue)) && that.tableFormDataObj[seq].apportvalue !== null) {
- let rv1 = that.floatComputed(Number(value), Number(that.tableFormDataObj[seq].apportvalue), '+');
- that.tableFormDataObj[seq].realvalue = that.floatComputed(rv1, Number(that.tableFormDataObj[seq].secondVal), '-').toFixed(0);
- that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
- }
- },
- // 手动修改二次转供电后计算实际电量
- chnageSecondVal (seq, value, rowIndex) {
- let that = this;
- if (!isNaN(Number(value)) && !isNaN(Number(that.tableFormDataObj[seq].apportvalue)) && that.tableFormDataObj[seq].apportvalue !== null) {
- let val1 = that.floatComputed(Number(that.tableFormDataObj[seq].apportvalue), Number(that.tableFormDataObj[seq].wastage), '+');
- that.tableFormDataObj[seq].realvalue = that.floatComputed(val1, Number(value), '-').toFixed(0);
- that.showRealValue(rowIndex, that.tableFormDataObj[seq].realvalue);
- }
- },
- // 统计合计值
- getAdds () {
- let that = this;
- let wlarr = [];
- for (var i = 0; i < that.tableData.length; i++) {
- wlarr.push(that.tableData[i].workprocid + '-' + that.tableData[i].location + '-' + that.tableData[i].workshop + '-' + that.tableData[i].clock + '-' + that.tableData[i].clocke);
- }
- let wls = [...new Set(wlarr)]
- let arrs = [];
- for (let wl of wls) {
- let rxj = 0;
- let yhj = 0;
- for (let item of that.tableData) {
- if (wl === item.workprocid + '-' + item.location + '-' + item.workshop + '-' + item.clock + '-' + item.clocke) {
- rxj = that.floatComputed(Number(item.weightDay), rxj, '+');
- yhj = that.floatComputed(Number(item.weightMonth), yhj, '+');
- }
- }
- for (let i = 0; i < that.tableData.length; i++) {
- if (wl === that.tableData[i].workprocid + '-' + that.tableData[i].location + '-' + that.tableData[i].workshop + '-' + that.tableData[i].clock + '-' + that.tableData[i].clocke) {
- that.tableData[i].rxj = rxj;
- that.tableData[i].yhj = yhj;
- }
- }
- }
- },
- // 展示实际电量
- showRealValue (rowIndex, value) {
- let that = this;
- for (let i = 0; i < that.tableData.length; i++) {
- if (i === rowIndex) {
- that.tableData[i].realvalue = value;
- }
- }
- this.getAdds();
- },
- // 批量修改
- but_edit_plural () {
- let that = this;
- if (that.multipleSelection.length > 0) {
- that.$refs['dialog_form_arr'].validate((valid, obj) => {
- if (valid) {
- let SubmitData = [];
- for (let key in that.tableFormDataObj) {
- SubmitData.push({
- id: that.tableFormDataObj[key].id,
- jhTime: that.tableFormDataObj[key].jhTime,
- grades: that.tableFormDataObj[key].grades,
- transportType: that.tableFormDataObj[key].transportType,
- specifications: that.tableFormDataObj[key].specifications,
- unitid: that.tableFormDataObj[key].unitid,
- memo: that.tableFormDataObj[key].memo,
- workprocType: that.filterForm.data.workproc_type,
- chemicalStandard: that.tableFormDataObj[key].chemicalStandard,
- planWeight: that.tableFormDataObj[key].planweight,
- createTime: that.tableFormDataObj[key].createtime,
- purpose: that.tableFormDataObj[key].purpose,
- createMan: that.tableFormDataObj[key].createman,
- updateTime: that.tableFormDataObj[key].updatetime,
- updateMan: that.tableFormDataObj[key].updateman,
- state: that.tableFormDataObj[key].state,
- lengths: that.tableFormDataObj[key].lengths,
- surfaceStandard: that.tableFormDataObj[key].surfacestandard,
- deliveryDate: that.tableFormDataObj[key].deliveryDate,
- dimension: that.tableFormDataObj[key].dimension,
- iateralArea: that.tableFormDataObj[key].iateralarea,
- lengthTimesWidth: that.tableFormDataObj[key].lengthtimeswidth
- });
- }
- that.loading = true;
- that.axios.put('pass/ems/v1/emsgmpcjhs/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 {
- this.$message.error('至少要选择一条数据');
- }
- },
- getRoles () {
- let that = this;
- // 获取用户信息
- this.store.dispatch('getUserInfo').then((res) => {
- this.userInfo = res.data;
- that.axios.get('pass/v1/sysuserroles/?userId=' + res.data.userId + '&pageNum=1&pageSize=100').then(rest => {
- if (rest) {
- for (let i = 0; i < rest.data.list.length; i++) {
- that.qrRole.push(rest.data.list[i].roleId)
- }
- that.userRoles = rest.data.list; // 获取用户角色关联信息
- }
- let roleId = this.nameObj.roleList.obj['生产部-生产处'].id;
- if (this.qrRole.includes(roleId)) {
- this.spread = true;
- }
- })
- });
- // 获取角色信息
- this.store.dispatch('system/rolesManage/list').then(res => {
- if (res.code === '0') {
- this.nameObj.roleList.arr = res.data;
- for (let obj of res.data) {
- this.nameObj.roleList.obj[obj.roleName] = {
- name: obj.roleName,
- id: obj.id
- };
- }
- } else {
- this.$message.error(res.message);
- }
- });
- },
- turndown () {
- let that = this;
- if (that.multipleSelection.length > 0) {
- that.$refs['dialog_form_arr'].validate((valid, obj) => {
- if (valid) {
- let SubmitData = [];
- for (let key in that.tableFormDataObj) {
- SubmitData.push({
- id: that.tableFormDataObj[key].id,
- workprocType: that.filterForm.data.workproc_type,
- state: '0'
- });
- }
- that.loading = true;
- that.axios.put('pass/ems/v1/emsgmpcjhs/turndown', 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('至少要选择一条数据');
- }
- },
- passaudits () {
- let that = this;
- if (that.multipleSelection.length > 0) {
- that.$refs['dialog_form_arr'].validate((valid, obj) => {
- if (valid) {
- let SubmitData = [];
- for (let key in that.tableFormDataObj) {
- SubmitData.push({
- id: that.tableFormDataObj[key].id,
- workprocType: that.filterForm.data.workproc_type,
- state: '2'
- });
- }
- that.loading = true;
- that.axios.put('pass/ems/v1/emsgmpcjhs/passaudits', 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('至少要选择一条数据');
- }
- },
- // 下发
- issue (state) {
- let that = this;
- if (that.multipleSelection.length > 0) {
- that.$refs['dialog_form_arr'].validate((valid, obj) => {
- if (valid) {
- let SubmitData = [];
- for (let key in that.tableFormDataObj) {
- SubmitData.push({
- id: that.tableFormDataObj[key].id,
- workprocType: that.filterForm.data.workproc_type,
- state: state
- });
- }
- that.loading = true;
- that.axios.put('pass/ems/v1/emsgmpcjhs/updatestate', 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('至少要选择一条数据');
- }
- },
- // 批量删除
- but_del_plural () {
- let that = this;
- if (that.multipleSelection.length > 0) {
- let SubmitData = [];
- for (let item of that.multipleSelection) {
- SubmitData.push({
- id: item.id,
- state: item.state,
- sqno: item.sqno
- });
- }
- that.$confirm('是否删除已选数据?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- state: 'warning'
- }).then(() => {
- that.axios.delete('pass/ems/v1/emsgmpcjhs/delete', {
- data: SubmitData,
- contentType: 'application/json;charset=UTF-8'
- })
- .then(function (res) {
- if (res.code === '0') {
- that.$message({
- message: '删除成功',
- type: 'success'
- });
- that.getTableData();
- } else {
- that.$message.error(res.message);
- }
- }).catch(function () {
- });
- }).catch(() => {
- });
- } else {
- this.$message.error('至少要选择一条数据');
- }
- },
- tableRowClassName ({row, rowIndex}) {
- // 把每一行的索引放进row
- row.index = rowIndex;
- },
- cellClick (row, column, cell, event) {
- let _this = this;
- this.rowIndex = row.index;
- this.columnId = column.id;
- _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();
- });
- }
- }
- }
- function sortNumber (a, b) {
- return a - b
- }
- </script>
- <style lang="less">
- .outElectricity{
- 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;
- }
- }
- }
- .color_no {
- color: #7a7a7a;
- }
- .color_yes {
- color: #1a9f17;
- }
- .cnspicuous .el-checkbox__input.is-disabled .el-checkbox__inner {
- background-color: #dcdfe6;
- border-color: #babbbf;
- }
- }
- </style>
|