| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792 |
- <template>
- <div>
- <!-- 左侧树形结构 -->
- <el-container>
- <!-- <el-aside width="250px">
- <div class="JKWTree-tree">
- <h3>手工检验计件单据维护</h3>
- <el-tree :data="treeData" :props="defaultProps" highlight-current="true"
- @node-click="handleNodeClick"></el-tree>
- </div>
- </el-aside> -->
-
-
- <layout-sider
- :resize-directions="['right']"
- :width="220"
- style="margin-right: 10px;"
- >
- <div
- class="JKWTree-tree"
- style="height: 70vh;"
- >
- <h3>手工检验计件单据维护</h3>
- <el-tree
- :data="treeData"
- highlight-current
- @node-click="handleNodeClick"
- />
- </div>
- </layout-sider>
-
- <el-container>
- <el-main>
- <!-- 按钮区域 -->
- <div class="gva-table-box">
- <el-form-item>
- <el-input v-model="positionvalue" placeholder="输入工单编号或产品名称" style="width: 180px;" />
- <el-button type="primary" class="search" icon="search" @click="onSearch"></el-button>
- <el-button type="primary" class="bt" icon="plus" @click="onAdd">新增</el-button>
- <el-button type="primary" class="bt" icon="copy-document" @click="onCountByGdbh">切换显示方式</el-button>
- <el-button type="primary" class="bt" icon="refresh" @click="onRefresh">刷新质检系数</el-button>
- <el-button type="primary" class="bt" icon="delete" @click="onDel">删除</el-button>
- <div style="margin-left: auto;">
- <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
- </div>
- </el-form-item>
- <!-- 数据展示 -->
- <el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
- highlight-current-row="true" border @selection-change="handleSelectionChange" @row-click="Click"
- :show-overflow-tooltip="true" @row-dblclick="doubleClick">
- <el-table-column type="selection" width="55" />
- <el-table-column align="left" sortable label="工单印件" prop="combinedProp" width="340"/>
- <el-table-column align="left" sortable label="印件工序" prop="combinedProp2" width="150"/>
- <el-table-column align="left" sortable label="日期" prop="sczl_rq" width="120" />
- <el-table-column align="left" sortable label="产量" prop="sczl_cl" width="77" />
- <el-table-column align="left" sortable label="千件工价" prop="千件工价" width="105" />
- <el-table-column align="left" sortable label="检验类别" prop="sczl_检验类别" width="105" />
- <el-table-column align="left" sortable label="废品率系数" prop="sczl_废品率系数" width="120" />
- <el-table-column align="left" sortable label="日定额" prop="日定额" width="91" />
- <el-table-column align="left" sortable label="组长编号" prop="sczl_bh0" width="105" />
- <el-table-column align="left" sortable label="组长姓名" prop="员工姓名" width="105" />
- <el-table-column align="left" sortable label="流程单备注" prop="qczl_NumDesc" width="120" />
- <el-table-column align="left" sortable label="创建用户" prop="sys_id" width="120" />
- <el-table-column align="left" sortable label="创建时间" prop="sys_rq" width="160" />
- <el-table-column align="left" sortable label="修改时间" prop="mod_rq" width="160" />
- <el-table-column align="left" sortable label="UNIQID" prop="UniqId" width="120" />
- </el-table>
- <!-- 分页 -->
- <div class="gva-pagination">
- <el-pagination layout="total, sizes, prev, pager, next, jumper" v-model:current-page="page"
- v-model:page-size="limit"
- :page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
- @size-change="handleSizeChange" />
- </div>
- </div>
- <!-- 弹出框 -->
- <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type === 'create' ? '添加' : '修改'"
- destroy-on-close width="1000px">
- <el-form :model="formData" label-position="right" ref="elFormRef" :rules="rule" label-width="70px" >
- <el-row :gutter="24">
- <el-col :span="4">
- <el-form-item label="日期" prop="id" class="mab">
- <el-input type="date" max="9999-12-31" v-model="formData.sczl_rq" id="日期" @focus="rqHandleFocus()" @keydown="ent1($event)" style="width: 120px; " />
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label="组别" prop="name" label-width="90px" class="mab">
- <el-input v-model="formData.sczl_bzdh" id="组别" @keydown="ent1($event)" @blur="getBzsubmit()" style="width: 80px; "/>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="组长" prop="name" class="mab" label-width="50px">
- <el-input v-model="formData.sczl_bh0" id="bh0" @keydown="ent1($event)" @blur="getygsubmit($event, '0')" style="width: 100px; margin-right: 5px;" />
- <el-input v-model="formData.sczl_bh0_name" id="name0" :readonly=true @keydown="ent1($event)" style="width: 100px; " />
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label="箱数" prop="name" class="mab" label-width="50px">
- <el-input v-model="formData.sczl_cl0" id="箱数" @keydown="ent1($event)" style="width: 100px; " />
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label="每箱数" prop="name" class="mab" label-width="55px">
- <el-input v-model="formData.sczl_fp0" id="每箱数" @keydown="ent1($event)" style="width: 100px;" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="24">
- <el-col :span="24">
- <el-form-item label="工单编号" prop="id" class="mab">
- <el-input v-model="formData.sczl_gdbh" id="工单编号" @keydown="ent1($event)" @blur="getGxMcsubmit" style="width: 118px; margin-right: 5px;"/>
- <el-input v-model="formData.sczl_yjgx" id="yjgx" :readonly="true" @keydown="ent1($event)" style="width: 80px; margin-right: 5px;"/>
- <el-input v-model="formData.sczl_gxmc" id="gxmc" :readonly="true" @keydown="ent1($event)" style="width: 135px; margin-right: 5px;"/>
- <el-input v-model="formData.yj_yjmc" id="yjmc" :readonly="true" @keydown="ent1($event)" style="width: 542px;"/>
- </el-form-item>
- </el-col>
- </el-row>
-
- <el-row :gutter="24">
- <el-col :span="6">
- <el-form-item label="产量合计" prop="id" class="mab">
- <el-input v-model="formData.sczl_cl" id="产量合计" @keydown="ent1($event)" style="width: 150px;" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="定额代号" prop="id" label-width="100px" class="mab">
- <el-input v-model="formData.sczl_dedh" id="定额代号" @keydown="ent1($event)" @blur="getDedhsubmit" style="width: 150px;" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="检验类别" prop="name" class="mab">
- <el-input v-model="formData.sczl_检验类别" id="检验类别" @keydown="ent1($event)" @blur="getLbsubmit" style="width: 150px;"/>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="废品率系数" prop="name" label-width="100px" class="mab">
- <el-input v-model="formData.sczl_废品率系数" id="废品率系数" @keydown="ent1($event)" style="width: 150px;"/>
- </el-form-item>
- </el-col>
- </el-row>
-
- <el-row :gutter="24">
- <el-col :span="6">
- <el-form-item label="计时时数" prop="id" class="mab">
- <el-input v-model="formData.sczl_jsss" id="计时时数" @keydown="ent1($event)" style="width: 100px;"/>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="冲月定额" prop="id" class="mab" label-width="100px">
- <el-input v-model="formData.sczl_冲定额" id="冲月定额" @keydown="ent1($event)" style="width: 100px;"/>
- </el-form-item>
- </el-col>
- </el-row>
-
-
- <el-row :gutter="24">
- <el-col :span="17">
- <el-form-item label="流程单号" prop="id" class="mab">
- <el-input v-model="formData.流程单号1" id="流程单号1" @keydown="ent1($event)" style="width: 60px; margin-right: 5px;"/>
- <el-input v-model="formData.流程单号2" id="流程单号2" @keydown="ent1($event)" style="width: 60px; margin-right: 5px;"/>
- <el-input v-model="formData.流程单号3" id="流程单号3" @keydown="ent1($event)" style="width: 60px; margin-right: 5px;"/>
- <el-input v-model="formData.流程单号4" id="流程单号4" @keydown="ent1($event)" style="width: 60px; margin-right: 5px;"/>
- <el-input v-model="formData.流程单号5" id="流程单号5" @keydown="ent1($event)" style="width: 60px; margin-right: 5px;"/>
- <el-input v-model="formData.流程单号6" id="流程单号6" @keydown="ent1($event)" style="width: 60px; margin-right: 5px;"/>
- <el-input v-model="formData.流程单号7" id="流程单号7" @keydown="ent1($event)" style="width: 60px; margin-right: 5px;"/>
- <el-input v-model="formData.流程单号8" id="流程单号8" @keydown="ent1($event)" style="width: 60px; margin-right: 5px;"/>
- <el-input v-model="formData.流程单号9" id="流程单号9" @keydown="ent1($event)" style="width: 60px;"/>
- </el-form-item>
- </el-col>
- <el-col :span="7">
- <el-form-item label="备注" prop="id" label-width="50px">
- <el-input v-model="formData.qczl_NumDesc" id="备注" @keydown="ent1($event)" />
- </el-form-item>
- </el-col>
- </el-row>
-
- <el-row :gutter="19" style="margin-bottom: 5px; margin-left: 30px;">
- <span style="margin-left: 25px; margin-right: 50px;">员工编号</span>
- <span style="margin-right: 50px;">员工姓名</span>
- <span style="margin-right: 50px;"> 箱数 </span>
- <span style="margin-right: 120px;">每箱数量</span>
- <span style="margin-right: 50px;">员工编号</span>
- <span style="margin-right: 50px;">员工姓名</span>
- <span style="margin-right: 50px;"> 箱数 </span>
- <span>每箱数量</span>
- </el-row>
- <el-row :gutter="24" style="margin-bottom: 5px; margin-left: 30px;">
- <div style="width: 450px;margin-right: 30px;">
- <div v-for="index in 6" :key="index">
- <el-input style="width: 100px; margin-right: 5px;" v-model="formData['sczl_bh' + index]" :id="'bh' + index" @keydown="ent($event, index.toString())" />
- <el-input style="width: 100px; margin-right: 5px; color: red;" :readonly="true" :value="formData['sczl_bh' + index + '_name']" :id="'name' + index" @keydown="ent1($event)"/>
- <el-input style="width: 100px; margin-right: 5px;" v-model="formData['sczl_cl' + index]" :id="'cl' + index" @keydown="ent1($event)"/>
- <el-input style="width: 100px;" v-model="formData['sczl_fp' + index]" :id="'fp' + index" @keydown="ent1($event)"/>
- </div>
- </div>
- <div style="width: 450px;">
- <div v-for="index in 6" :key="index + 6">
- <el-input style="width: 100px; margin-right: 5px;" v-model="formData['sczl_bh' + (index + 6)]" :id="'bh' + (index + 6)" @keydown="ent($event, (index + 6).toString())" />
- <el-input style="width: 100px; margin-right: 5px; color: red;" :readonly="true" :value="formData['sczl_bh' + (index + 6) + '_name']" :id="'name' + (index + 6)" @keydown="ent1($event)"/>
- <el-input style="width: 100px; margin-right: 5px;" :value="formData['sczl_cl' + (index + 6)]" :id="'cl' + (index + 6)" @keydown="ent1($event)"/>
- <el-input style="width: 100px;" :value="formData['sczl_fp' + (index + 6)]" :id="'fp' + (index + 6)" @keydown="ent1($event)"/>
- </div>
- </div>
- </el-row>
- <el-row :gutter="24">
- <el-col :span="24">
- <el-form-item label="其他备注" prop="id" class="mab">
- <el-input v-model="formData.sczl_desc" id="其他备注" @keydown="ent1($event)" />
- </el-form-item>
- </el-col>
- </el-row>
-
- </el-form>
-
- <el-dialog v-model="BzVisible" title="选择" destroy-on-close width="200px" @keydown="selectBZ($event)">
- <el-table tooltip-effect="dark" :data="selectDataBz" row-key="ID"
- highlight-current-row="true" border style="width:100%"
- @row-dblclick="SelectClickBz" @row-click="SelectClick" ref="table"
- >
- <el-table-column prop="sczl_bzdh" label="班组" width="150"/>
- </el-table>
- </el-dialog>
-
- <el-dialog v-model="dialogSelectVisible" title="选择"
- destroy-on-close width="800px" @keydown="selectGX($event)">
- <el-table tooltip-effect="dark" :data="selectData" row-key="ID"
- highlight-current-row="true" border style="width:100%"
- @row-dblclick="handleSelectClick" ref="table2" >
- <el-table-column prop="Gd_cpmc" label="印件名称" width="450" />
- <el-table-column prop="jyGx" label="检验工序" width="85" />
- <el-table-column prop="Gy0_gxmc" label="工序名称" width="225" />
- </el-table>
- </el-dialog>
- <template #footer>
- <div class="dialog-footer">
- <el-button @click="closeDialog">取 消</el-button>
- <el-button type="primary" @click="enterDialog">确 定</el-button>
- </div>
- </template>
- </el-dialog>
- <el-dialog
- v-model="GetDedhVisible"
- title="选择"
- destroy-on-close
- width="600px"
- >
- <el-aside width="250px">
- <div class="JKWTree-tree">
- <el-tree :data="GetDedhtreeData" :props="defaultProps" highlight-current="true"
- @node-click="GetDedhhandleNodeClick" @node-dblclick="handleNodeDoubleClick"></el-tree>
- </div>
- </el-aside>
- </el-dialog>
-
-
- <el-dialog v-model="LbVisible" title="选择" destroy-on-close width="200px" @keydown="selectJY($event)" >
- <el-table tooltip-effect="dark" :data="selectDataLb" row-key="ID"
- highlight-current-row="true" border style="width:100%"
- :row-style="{ height: '30px' }"
- @row-dblclick="SelectClickLb"
- ref="table3"
- >
- <el-table-column prop="sczl_检验类别" label="可选名称" width="150" />
- </el-table>
- </el-dialog>
-
- </el-main>
- </el-container>
- </el-container>
- </div>
- </template>
- <script setup>
- import {
- getDateList,
- getInspectCount,
- shougonglocate,
- shougonggetInfo,
- shougonggetGxMc,
- shougonggetDedh,
- shougonggetScrapFactor,
- shougongedit,
- shougongdel,
- getYg,
- getInspectCountByGdbh,
- inspectadd
- } from '@/api/jixiaoguanli/jitairibaobiao'
- // 全量引入格式化工具 请按需保留
- import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
- import { ElMessage, ElMessageBox } from 'element-plus'
- import { Search, Refresh, Download } from '@element-plus/icons-vue'
- import { ref, reactive, nextTick, onMounted, onBeforeMount } from 'vue'
- import { getPackingSideTable, getPackingTable } from '@/api/mes_api_gty/myapi'
- import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
- import { useUserStore } from '@/pinia/modules/user'
- const userStore = useUserStore()
- const sys_id='['+userStore.userInfo.userName+'/'+userStore.userInfo.nickName+']'
- defineOptions({
- name: '06-packingDocuments'
- })
- // 侧边栏数据请求
- const treeData = reactive([]);
- const getTabdata = async () => {
- //接口调用函数
- const response = await getInspectCount();
-
- const transformedData = response.data.map(item => ({
- label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
- children: item.sys.map(sysItem => ({
- label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
- params: {
- date: item.date.replace(/-/g, '.'),
- sys_id: sysItem.sys_id,
- total: sysItem.count,
- },
- })),
- }));
- treeData.splice(0, treeData.length, ...transformedData);
- displayMod.value = 'date'
- }
- getTabdata();
- // 自动化生成的字典(可能为空)以及字段
- const formData = ref({
- sczl_rq: '',
- sczl_bzdh: '',
- sczl_bh0: '',
- sczl_bh0_name: '',
- sczl_cl0: '',
- sczl_fp0: '',
- sczl_gdbh: '',
- sczl_yjgx: '',
- sczl_gxmc: '',
- yj_yjmc: '',
- sczl_cl: '',
- sczl_dedh: '',
- sczl_检验类别: '',
- sczl_废品率系数: '',
- sczl_jsss: '',
- sczl_冲定额: '',
- 流程单号1: '',
- 流程单号2: '',
- 流程单号3: '',
- 流程单号4: '',
- 流程单号5: '',
- 流程单号6: '',
- 流程单号7: '',
- 流程单号8: '',
- 流程单号9: '',
- qczl_NumDesc: '',
- sczl_desc: '',
- sczl_bh1: '',
- sczl_bh2: '',
- sczl_bh3:'',
- sczl_bh4: '',
- sczl_bh5: '',
- sczl_bh6: '',
- sczl_bh7: '',
- sczl_bh8: '',
- sczl_bh9: '',
- sczl_bh10: '',
- sczl_bh11: '',
- sczl_bh12: '',
- sczl_bh1_name: '',
- sczl_bh2_name: '',
- sczl_bh3_name: '',
- sczl_bh4_name: '',
- sczl_bh5_name: '',
- sczl_bh6_name: '',
- sczl_bh7_name: '',
- sczl_bh8_name: '',
- sczl_bh9_name: '',
- sczl_bh10_name: '',
- sczl_bh11_name: '',
- sczl_bh12_name: '',
- sczl_cl1: '',
- sczl_cl2: '',
- sczl_cl3: '',
- sczl_cl4: '',
- sczl_cl5: '',
- sczl_cl6: '',
- sczl_cl7: '',
- sczl_cl8: '',
- sczl_cl9: '',
- sczl_cl10: '',
- sczl_cl11:'',
- sczl_cl12: '',
- sczl_fp1: '',
- sczl_fp2: '',
- sczl_fp3: '',
- sczl_fp4: '',
- sczl_fp5: '',
- sczl_fp6: '',
- sczl_fp7: '',
- sczl_fp8: '',
- sczl_fp9: '',
- sczl_fp10: '',
- sczl_fp11: '',
- sczl_fp12: '',
- })
- const initFormData = () => {
- formData.value = {
- sczl_rq: '',
- sczl_bzdh: '',
- sczl_bh0: '',
- sczl_bh0_name: '',
- sczl_cl0: '0.00',
- sczl_fp0: '0',
- sczl_gdbh: '',
- sczl_yjgx: '',
- sczl_gxmc: '',
- yj_yjmc: '',
- sczl_cl: '0',
- sczl_dedh: '',
- sczl_检验类别: '',
- sczl_废品率系数: '0.000',
- sczl_jsss: '0.00',
- sczl_冲定额: '',
- 流程单号1: '',
- 流程单号2: '',
- 流程单号3: '',
- 流程单号4: '',
- 流程单号5: '',
- 流程单号6: '',
- 流程单号7: '',
- 流程单号8: '',
- 流程单号9: '',
- qczl_NumDesc: '',
- sczl_desc: '',
- sczl_bh1: '',
- sczl_bh2: '',
- sczl_bh3:'',
- sczl_bh4: '',
- sczl_bh5: '',
- sczl_bh6: '',
- sczl_bh7: '',
- sczl_bh8: '',
- sczl_bh9: '',
- sczl_bh10: '',
- sczl_bh11: '',
- sczl_bh12: '',
- sczl_bh1_name: '',
- sczl_bh2_name: '',
- sczl_bh3_name: '',
- sczl_bh4_name: '',
- sczl_bh5_name: '',
- sczl_bh6_name: '',
- sczl_bh7_name: '',
- sczl_bh8_name: '',
- sczl_bh9_name: '',
- sczl_bh10_name: '',
- sczl_bh11_name: '',
- sczl_bh12_name: '',
- sczl_cl1: '0',
- sczl_cl2: '0',
- sczl_cl3: '0',
- sczl_cl4: '0',
- sczl_cl5: '0',
- sczl_cl6: '0',
- sczl_cl7: '0',
- sczl_cl8: '0',
- sczl_cl9: '0',
- sczl_cl10: '0',
- sczl_cl11:'0',
- sczl_cl12: '0',
- sczl_fp1: '0',
- sczl_fp2: '0',
- sczl_fp3: '0',
- sczl_fp4: '0',
- sczl_fp5: '0',
- sczl_fp6: '0',
- sczl_fp7: '0',
- sczl_fp8: '0',
- sczl_fp9: '0',
- sczl_fp10: '0',
- sczl_fp11: '0',
- sczl_fp12: '0',
- };
- }
- // 验证规则
- const rule = reactive({
- })
- const elFormRef = ref()
- const elSearchFormRef = ref()
- // =========== 表格控制部分 ===========
- const tableData = reactive([])
- const detailData = reactive([])
- const total = ref(0)
- const page = ref(1)
- const limit = ref(10)
- const searchInfo = ref('')
- const params = {
- type: '',
- date: '',
- sys_id: '',
- gdbh: '',
- }
- // 分页设置
- const handleSizeChange = (val) => {
- switch (params.type) {
- case 'getTableData':
- getTableData()
- break
- case 'getLocateTable':
- GetLocate()
- break
- default:
- break
- }
- }
- // 页面跳转
- const handleCurrentChange = (val) => {
- switch (params.type) {
- case 'getTableData':
- getTableData()
- break
- case 'getLocateTable':
- GetLocate()
- break
- default:
- break
- }
- console.log(params.type)
- }
- const getTableData = async() => {
- // const response = await getDateList(params);
- // console.log(response)
- // if (response.code === 0) {
- // const processedData = response.data.data.map(item => {
- // return {
- // ...item,
- // combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
- // combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
- // };
- // });
- // tableData.splice(0, tableData.length, ...processedData);
- // }
-
- const response = await getDateList({
- date: params.date, sys_id: params.sys_id,
- page: page.value.toString(), limit: limit.value.toString(),
- })
- if (response.code === 0) {
- const processedData = response.data.data.map(item => {
- return {
- ...item,
- combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
- combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
- };
- });
- tableData.splice(0, tableData.length, ...processedData);
- }
- }
- const handleNodeClick = (node,check) => {
- //存放当前节点的nodeId
- if (node.params) {
- params.date = node.params.date.replace(/\./g, '-');
- params.sys_id = node.params.sys_id;
- params.type = 'getTableData'
- total.value = node.params.total;
- page.value = 1
- getTableData();
- }
- }
- //定位
- const GetLocate = async () => {
- const response = await shougonglocate({
- gdbh: params.gdbh,
- page: page.value.toString(), limit: limit.value.toString(),
- })
- if (response.code === 0) {
- const processedData = response.data.rows.map(item => {
- return {
- ...item,
- combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
- combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
- };
- });
- total.value = response.data.total
- tableData.splice(0, tableData.length, ...processedData);
- }
- }
- let positionvalue=ref()
- // 搜索
- function onSearch() {
- params.gdbh = positionvalue.value
- params.type = 'getLocateTable'
- page.value = 1
- GetLocate()
- }
- //获取详细信息
- const GetInfo = async (value) => {
- const response = await shougonggetInfo({UniqId:value});
- if (response.code === 0) {
- formData.value=response.data;
- }
- }
- //键盘 input框跳转
- const ent1 = (event) => {
- const inputs = document.getElementsByTagName('input');
- const currentIndex = Array.from(inputs).indexOf(event.target);
- if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
- if(event.target.id=='其他备注'){
- ElMessageBox.confirm('数据存盘?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- enterDialog()
- })
- }
- for (let i = currentIndex + 1; i < inputs.length; i++) {
- if (!inputs[i].readOnly) {
- nextTick(()=>{
- inputs[i].focus();
- inputs[i].select();
- })
- break;
- }
- }
- if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
- ent_sum()
- }
- } else if (event.keyCode === 38) { // 向上箭头
- for (let i = currentIndex - 1; i >= 0; i--) {
- if (!inputs[i].readOnly) {
- nextTick(()=>{
- inputs[i].focus();
- inputs[i].select();
- })
- break;
- }
- }
- if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
- ent_sum()
- }
- } else if (event.keyCode === 8) { // 删除箭头
- if (event.target.selectionStart === 0) {
- for (let i = currentIndex - 1; i >= 0; i--) {
- if (!inputs[i].readOnly) {
- nextTick(()=>{
- inputs[i].focus();
- inputs[i].setSelectionRange(0, 0);
- })
- break;
- }
- }
- if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
- ent_sum()
- }
- }
- } else if (event.keyCode === 37) { // 向左箭头
- if (event.target.selectionStart === 0) {
- for (let i = currentIndex - 1; i >= 0; i--) {
- if (!inputs[i].readOnly) {
- nextTick(()=>{
- inputs[i].focus();
- inputs[i].select();
- })
- break;
- }
- }
- if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
- ent_sum()
- }
- }
- } else if (event.keyCode === 39) { // 向右箭头
- if(event.target.id=='其他备注'){
- ElMessageBox.confirm('数据存盘?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- enterDialog()
- })
- }
- if (event.target.selectionStart === event.target.value.length) {
- for (let i = currentIndex + 1; i < inputs.length; i++) {
- if (!inputs[i].readOnly) {
- nextTick(()=>{
- inputs[i].focus();
- inputs[i].select();
- })
- break;
- }
- }
- }
- if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
- ent_sum()
- }
- }
- }
- //追加字体颜色和不可输入
- const setColorReadonly = (id) => {
- const newInput = document.getElementById(id)
- newInput.style.color = 'red';
- newInput.setAttribute('readonly', true);
- }
- //追加字体颜色和可输入
- const unsetColorReadonly = (id) => {
- const newInput = document.getElementById(id)
- newInput.style.color = 'black';
- newInput.removeAttribute('readonly');
- }
- //日期获得焦点事件
- const rqHandleFocus = () =>{
- if(formData.value.sczl_rq==''){
- formData.value.sczl_rq = new Date().toISOString().split('T')[0]
- }
- }
- const num=ref(0)
- //班组失去焦点事件
- const getBzsubmit = () => {
- //弹出选择
- const data = [{'sczl_bzdh':'A班'},{'sczl_bzdh':'B班'}]
- selectDataBz.splice(0, selectDataBz.length, ...data)
- BzVisible.value=true
- setCurrent(data[0])
- }
- const table = ref()
- const setCurrent = (row) => {
- setTimeout(()=>{
- table.value?.setCurrentRow(row)
- // SelectClick(row)
- // console.log(row)
- // console.log(table)
- const {sczl_bzdh } = row
- formData.value.sczl_bzdh=row.sczl_bzdh
- console.log(row)
- })
- }
- //班组选择
- const selectDataBz = reactive([])
- const BzVisible = ref(false)
- const SelectClickBz = (row, column, event) => {
- const {sczl_bzdh } = row
- formData.value.sczl_bzdh=row.sczl_bzdh
- console.log(row)
- BzVisible.value = false
- // removeEventListener('keyup', keyUp.bind(this));
- }
- const selectBZ = (event) => {
- // console.log(selectDataBz.length);
- if (event.keyCode === 40) { // Enter 或向下箭头
- setCurrent(selectDataBz[1]);
- // console.log(num.value+1)
- // if (parseInt(num.value+ 1) > selectDataBz.length||parseInt(num.value+ 1) ===selectDataBz.length) {
- // // setCurrent(selectDataBz[0]);
- // console.log('123')
- // } else {
- // // setCurrent(selectDataBz[num.value + 1]);
- // console.log("3333")
- // }
- } else if (event.keyCode === 38) {
- setCurrent(selectDataBz[0]);
- // if (num.value - 1 < 0) {
- // setCurrent(selectDataBz[selectDataBz.length - 1]);
- // } else {
- // setCurrent(selectDataBz[num.value - 1]);
- // }
- } else if (event.keyCode === 13) {
- BzVisible.value = false
- }
- }
- //员工编号失去焦点事件
- const getygsubmit = async (event, inputName) => {
- let combinedString = 'sczl_bh' + inputName;
- let value = eval('formData.value.' + combinedString);
- if(value){
- const response = await getYg({sczl_bh:value});
- console.log(response)
- if (response.code === 0) {
- let Bname = 'sczl_bh' + inputName+'_name';
- formData.value[Bname]=response.data.ygxm;
- //设置姓名样式
-
- if(inputName>0){
- unsetColorReadonly('cl'+inputName)
- unsetColorReadonly('fp'+inputName)
- }
- }
- }
- }
- const ent_sum = () =>{
- let sum = 0;
- for(var i=1;i<=12;i++){
- sum += formData.value['sczl_cl'+i] * formData.value['sczl_fp'+i]
- }
- formData.value.sczl_cl = sum
- }
- //员工编号键盘事件
- const ent = (event, inputName) => {
- let combinedString = 'sczl_bh' + inputName;
- let value = eval('formData.value.' + combinedString);
-
- if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
- if(value){
- getYg({sczl_bh:value}).then(response => {
- if (response.code == 0) {
- let Bname = 'sczl_bh' + inputName+'_name';
- formData.value[Bname]=response.data.ygxm;
- //设置姓名样式
- unsetColorReadonly('cl'+inputName)
- unsetColorReadonly('fp'+inputName)
-
- document.getElementById('cl'+inputName).focus()
- document.getElementById('cl'+inputName).select()
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
-
- if(inputName!=12){
- document.getElementById('bh'+(parseInt(inputName)+1)).focus()
- document.getElementById('bh'+(parseInt(inputName)+1)).select()
- }else{
- document.getElementById('其他备注').focus()
- document.getElementById('其他备注').select()
- }
- }
- });
-
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
- if(inputName!=12){
- document.getElementById('bh'+(parseInt(inputName)+1)).focus()
- document.getElementById('bh'+(parseInt(inputName)+1)).select()
- }else{
- document.getElementById('其他备注').focus()
- document.getElementById('其他备注').select()
- }
-
- }
- ent_sum()
- } else if (event.keyCode === 38) { // 向上箭头
- if(value){
- getYg({sczl_bh:value}).then(response => {
- if (response.code == 0) {
- let Bname = 'sczl_bh' + inputName+'_name';
- formData.value[Bname]=response.data.ygxm;
- //设置姓名样式
- unsetColorReadonly('cl'+inputName)
- unsetColorReadonly('fp'+inputName)
-
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).select()
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).select()
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').select()
- }
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
-
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).select()
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).select()
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').select()
- }
- }
- });
-
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).select()
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).select()
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').select()
- }
- }
- ent_sum()
- } else if (event.keyCode === 8) { // 删除箭头
- if (event.target.selectionStart === 0) {
- if(value){
- getYg({sczl_bh:value}).then(response => {
- if (response.code == 0) {
- let Bname = 'sczl_bh' + inputName+'_name';
- formData.value[Bname]=response.data.ygxm;
- //设置姓名样式
- unsetColorReadonly('cl'+inputName)
- unsetColorReadonly('fp'+inputName)
-
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').setSelectionRange(0, 0)
- }
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
-
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').setSelectionRange(0, 0)
- }
- }
- });
-
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').setSelectionRange(0, 0)
- }
- }
- ent_sum()
- }
- } else if (event.keyCode === 37) { // 向左箭头
- if (event.target.selectionStart === 0) {
- if(value){
- getYg({sczl_bh:value}).then(response => {
- if (response.code == 0) {
- let Bname = 'sczl_bh' + inputName+'_name';
- formData.value[Bname]=response.data.ygxm;
- //设置姓名样式
- unsetColorReadonly('cl'+inputName)
- unsetColorReadonly('fp'+inputName)
-
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).select()
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).select()
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').select()
- }
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
-
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).select()
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).select()
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').select()
- }
- }
- });
-
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
- if(inputName!=1){
- if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
- document.getElementById('bh'+(parseInt(inputName)-1)).focus()
- document.getElementById('bh'+(parseInt(inputName)-1)).select()
- }else{
- document.getElementById('fp'+(parseInt(inputName)-1)).focus()
- document.getElementById('fp'+(parseInt(inputName)-1)).select()
- }
- }else{
- document.getElementById('备注').focus()
- document.getElementById('备注').select()
- }
- }
- ent_sum()
- }
- } else if (event.keyCode === 39) { // 向右箭头
- if (event.target.selectionStart === event.target.value.length) {
- if(value){
- getYg({sczl_bh:value}).then(response => {
- if (response.code == 0) {
- let Bname = 'sczl_bh' + inputName+'_name';
- formData.value[Bname]=response.data.ygxm;
- //设置姓名样式
- unsetColorReadonly('cl'+inputName)
- unsetColorReadonly('fp'+inputName)
-
- document.getElementById('cl'+inputName).focus()
- document.getElementById('cl'+inputName).select()
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
-
- if(inputName!=12){
- document.getElementById('bh'+(parseInt(inputName)+1)).focus()
- document.getElementById('bh'+(parseInt(inputName)+1)).select()
- }else{
- document.getElementById('其他备注').focus()
- document.getElementById('其他备注').select()
- }
- }
- });
-
- }else{
- formData.value['sczl_bh' + inputName+'_name']='';
- formData.value['sczl_cl' + inputName]='0';
- formData.value['sczl_fp' + inputName]='0';
-
- //设置姓名样式
- setColorReadonly('cl'+inputName);
- setColorReadonly('fp'+inputName);
- if(inputName!=12){
- document.getElementById('bh'+(parseInt(inputName)+1)).focus()
- document.getElementById('bh'+(parseInt(inputName)+1)).select()
- }else{
- document.getElementById('其他备注').focus()
- document.getElementById('其他备注').select()
- }
- }
- ent_sum()
- }
- }
- }
- const getGxMcsubmit = async() => {
- if(formData.value.sczl_gdbh!=''){
- const response = await shougonggetGxMc({gdbh:formData.value.sczl_gdbh});
-
- if (response.code === 0) {
- if(response.data.length==0){
- ElMessage({
- type: 'error',
- message: '查无此编号的工单,请仔细检查后重新输入'
- })
- //设置输入框的值为空
- formData.value.sczl_gdbh = ''
- formData.value.sczl_yjgx = ''
- formData.value.sczl_gxmc = ''
- formData.value.yj_yjmc = ''
- }else if(response.data.length==1){
- const { Gd_cpmc, Gy0_yjno, Gy0_gxh, Gy0_gxmc,jyGx} = response.data[0]
- formData.value.yj_yjmc=Gd_cpmc
- formData.value.sczl_gxmc=Gy0_gxmc
- formData.value.sczl_yjgx=jyGx
- setColorReadonly('yjgx');
- setColorReadonly('gxmc');
- setColorReadonly('yjmc');
- }else{
- if(GetDedhVisible.value){
- return false
- }
- selectData.splice(0, selectData.length, ...response.data)
- dialogSelectVisible.value=true
- setGXCurrent(selectData[0])
- }
- }
- }else{
- ElMessage({
- type: 'error',
- message: '请注意, 工单编号输入空置, 除非有特殊需要!'
- })
-
- formData.value.sczl_yjgx = ''
- formData.value.sczl_gxmc = ''
- formData.value.yj_yjmc = ''
- }
-
-
- }
- const dialogSelectVisible = ref(false)
- const selectData = reactive([])
- // 工单选择框
- const handleSelectClick = (row, column, event) => {
- const { Gd_cpmc, Gy0_yjno, Gy0_gxh, Gy0_gxmc,jyGx } = row
- formData.value.yj_yjmc=Gd_cpmc
- formData.value.sczl_gxmc=Gy0_gxmc
- formData.value.sczl_yjgx=jyGx
- setColorReadonly('yjgx');
- setColorReadonly('gxmc');
- setColorReadonly('yjmc');
- dialogSelectVisible.value = false
- }
- const currentIndex = ref(0);
- const GXCurrent = ref(0);
- const selectGX = (event) => {
- if (event.keyCode === 40) { // 向下箭头
- if (currentIndex.value < selectData.length - 1) {
- currentIndex.value++;
- setGXCurrent(selectData[currentIndex.value]);
- } else {
- currentIndex.value = 0;
- setGXCurrent(selectData[currentIndex.value]); // 到达最后一行时回到第一行
- }
- } else if (event.keyCode === 38) { // 向上箭头
- if (currentIndex.value > 0) {
- currentIndex.value--;
- setGXCurrent(selectData[currentIndex.value]);
- } else {
- currentIndex.value = selectData.length - 1;
- setGXCurrent(selectData[currentIndex.value]); // 到达第一行时回到最后一行
- }
- } else if (event.keyCode === 13) { // 回车键
- dialogSelectVisible.value = false;
- }
- }
- const table2 = ref()
- const setGXCurrent = (row) => {
- setTimeout(()=>{
- table2.value?.setCurrentRow(row)
- const { Gd_cpmc, Gy0_yjno, Gy0_gxh, Gy0_gxmc,jyGx } = row
- formData.value.yj_yjmc=Gd_cpmc
- formData.value.sczl_gxmc=Gy0_gxmc
- formData.value.sczl_yjgx=jyGx
- })
- }
- //定额代号回车事件
- const getDedhsubmit = () => {
- if(dialogSelectVisible.value){
- return false
- }
- if(LbVisible.value){
- return false
- }
- GetDedh()
- }
- let GetDedhtreeData = reactive([]);
- const GetDedhVisible = ref(false)
- //获取定额代号
- const GetDedh = async (value) => {
- const response = await shougonggetDedh();
- const treeData = {};
- // const data = [];
- // data[0] = response.data;
- // //判断值是否在选项中存在
- // const buildTree1 = (node) => {
- // const arr = [];
-
- // // 如果存在子节点,递归地添加它们
- // if (node.bh_mc && Array.isArray(node.bh_mc)) {
- // node.bh_mc.forEach(childNode => {
- // arr.push(...buildTree1(childNode)); // 递归调用
- // });
- // }else{
- // arr.push(node.sys_bh)
- // }
-
- // return arr;
- // };
- // // 构建树形结构的根节点
- // const Data = data.map(buildTree1);
-
- if(response.code==0){
- const data = [];
- data[0] = response.data;
- // 递归函数来构建树形结构
- const buildTree = (node) => {
- const treeNode = {
- label: node.sys_bh + '【' + node.sys_mc+'】',
- children: []
- };
-
- // 如果存在子节点,递归地添加它们
- if (node.bh_mc && Array.isArray(node.bh_mc)) {
- node.bh_mc.forEach(childNode => {
- treeNode.children.push(buildTree(childNode)); // 递归调用
- });
- }
-
- return treeNode;
- };
-
- // 构建树形结构的根节点
- const treeData = data.map(buildTree);
-
- GetDedhtreeData = treeData;
- GetDedhVisible.value=true
- }
- }
- //定额代号树形结构单机
- const GetDedhhandleNodeClick = (nodeData, node, component) => {
- //存放当前节点的nodeId
- if (!nodeData.children || nodeData.children.length === 0) {
- // 点击的是子节点
- formData.value.sczl_dedh=nodeData.label.split("【")[0]
- GetDedhVisible.value=false
- }
- // 执行相应的父节点单击事件处理逻辑
- }
- //检验类别失去焦点事件
- const getLbsubmit = () => {
- if(GetDedhVisible.value){
- return false
- }
- //弹出选择
- const data = [{'sczl_检验类别':''},{'sczl_检验类别':'正品板'},{'sczl_检验类别':'次品板'},{'sczl_检验类别':'废品板'}]
- selectDataLb.splice(0, selectDataLb.length, ...data)
- setJYCurrent(selectDataLb[0])
- LbVisible.value=true
- }
- //检验类别选择
- const selectDataLb = reactive([])
- const LbVisible = ref(false)
- const SelectClickLb = (row, column, event) => {
- const {sczl_检验类别 } = row
- formData.value.sczl_检验类别=row.sczl_检验类别
-
- //查询废品系数
- if(row.sczl_检验类别!=''){
- var value = {
- 'gdbh':formData.value.sczl_gdbh,
- 'yjno':parseInt(formData.value.sczl_yjgx.split('-')[0]),
- 'gxh':parseInt(formData.value.sczl_yjgx.split('-')[1]),
- 'type':formData.value.sczl_检验类别
- }
- shougonggetScrapFactor(value).then(response=>{
- if(response.code==0){
- if(response.data!=null){
- formData.value.sczl_废品率系数 = response.data.num;
- }
- setColorReadonly('废品率系数')
- }
- });
-
- }else{
- unsetColorReadonly('废品率系数')
- }
- LbVisible.value = false
- }
- const table3=ref()
- const setJYCurrent = (row) => {
- setTimeout(()=>{
- table3.value?.setCurrentRow(row)
- const {sczl_检验类别 } = row
- formData.value.sczl_检验类别=row.sczl_检验类别
-
- //查询废品系数
- if(row.sczl_检验类别!=''){
- var value = {
- 'gdbh':formData.value.sczl_gdbh,
- 'yjno':parseInt(formData.value.sczl_yjgx.split('-')[0]),
- 'gxh':parseInt(formData.value.sczl_yjgx.split('-')[1]),
- 'type':formData.value.sczl_检验类别
- }
- shougonggetScrapFactor(value).then(response=>{
- if(response.code==0){
- if(response.data!=null){
- formData.value.sczl_废品率系数 = response.data.num;
- }
- setColorReadonly('废品率系数')
- }
- });
-
- }else{
- unsetColorReadonly('废品率系数')
- }
- })
- }
- const JYIndex = ref(0);
- const JYCurrent = ref(0);
- const selectJY = (event) => {
- if (event.keyCode === 40) { // 向下箭头
- if (JYIndex.value < selectDataLb.length - 1) {
- JYIndex.value++;
- setJYCurrent(selectDataLb[JYIndex.value]);
- } else {
- JYIndex.value = 0;
- setJYCurrent(selectDataLb[JYIndex.value]); // 到达最后一行时回到第一行
- }
- } else if (event.keyCode === 38) { // 向上箭头
- if (JYIndex.value > 0) {
- JYIndex.value--;
- setJYCurrent(selectDataLb[JYIndex.value]);
- } else {
- JYIndex.value = selectDataLb.length - 1;
- setJYCurrent(selectDataLb[JYIndex.value]); // 到达第一行时回到最后一行
- }
- } else if (event.keyCode === 13) { // 回车键
- LbVisible.value = false
- }
- }
- //刷新废品率系数
- const GetScrapFactor = async (value) => {
- const response = await shougonggetScrapFactor(value);
- if(response.code==0){
- console.log(response.data.num)
- const rowIndex = tableData.findIndex(row => row.UniqId === lastCellValue);
- console.log(rowIndex)
- tableData[rowIndex].sczl_废品率系数 = response.data.num;
- }
- // console.log(response)
- // const rowIndex = tableData.findIndex(row => row.UniqId === 123);
- }
- const ADD=ref('0')
- //新增
- function onAdd() {
- ADD.value='新增'
- type.value = 'create'
- if(typeof(lastCellValue)=='number'){
- GetInfo(lastCellValue)
- }
- initFormData()
- dialogFormVisible.value = true
- // Productionadd()
- }
- const ScrapFactor={
- gdbh:'',
- yjno:'',
- gxh:'',
- type:'',
- }
- // 刷新废品率系数
- function onRefresh() {
- GetScrapFactor(ScrapFactor)
- }
- // 更新数据
- const updateDetailData = async() => {
- const restoredData = {
- UniqId: lastCellValue,
- sczl_rq: formData.value.sczl_rq,
- sczl_bzdh: formData.value.sczl_bzdh,
- sczl_bh0: formData.value.sczl_bh0,
- sczl_cl0: formData.value.sczl_cl0,
- sczl_fp0: formData.value.sczl_fp0,
- sczl_gdbh: formData.value.sczl_gdbh,
- sczl_yjgx: formData.value.sczl_yjgx,
- sczl_gxmc: formData.value.sczl_gxmc,
- sczl_cl:formData.value.sczl_cl,
- sczl_dedh: formData.value.sczl_dedh,
- sczl_检验类别: formData.value.sczl_检验类别,
- sczl_废品率系数: formData.value.sczl_废品率系数,
- sczl_jsss: formData.value.sczl_jsss,
- sczl_冲定额: formData.value.sczl_冲定额,
- qczl_Num:formData.value.qczl_NumDesc,
- qczl_NumDesc:formData.value.流程单号1,
- qczl_NumDesc1: formData.value.流程单号2,
- qczl_NumDesc2: formData.value.流程单号3,
- qczl_NumDesc3: formData.value.流程单号4,
- qczl_NumDesc4: formData.value.流程单号5,
- qczl_NumDesc5: formData.value.流程单号6,
- qczl_NumDesc6: formData.value.流程单号7,
- qczl_NumDesc7: formData.value.流程单号8,
- qczl_NumDesc8: formData.value.流程单号9,
- sczl_desc: formData.value.sczl_desc,
- sczl_bh1: formData.value.sczl_bh1,
- sczl_bh2: formData.value.sczl_bh2,
- sczl_bh3:formData.value.sczl_bh3,
- sczl_bh4: formData.value.sczl_bh4,
- sczl_bh5: formData.value.sczl_bh5,
- sczl_bh6: formData.value.sczl_bh6,
- sczl_bh7: formData.value.sczl_bh7,
- sczl_bh8: formData.value.sczl_bh8,
- sczl_bh9: formData.value.sczl_bh9,
- sczl_bh10: formData.value.sczl_bh10,
- sczl_bh11: formData.value.sczl_bh11,
- sczl_bh12: formData.value.sczl_bh12,
- sczl_cl1: formData.value.sczl_cl1,
- sczl_cl2: formData.value.sczl_cl2,
- sczl_cl3: formData.value.sczl_cl3,
- sczl_cl4: formData.value.sczl_cl4,
- sczl_cl5: formData.value.sczl_cl5,
- sczl_cl6: formData.value.sczl_cl6,
- sczl_cl7: formData.value.sczl_cl7,
- sczl_cl8: formData.value.sczl_cl8,
- sczl_cl9: formData.value.sczl_cl9,
- sczl_cl10: formData.value.sczl_cl10,
- sczl_cl11:formData.value.sczl_cl11,
- sczl_cl12: formData.value.sczl_cl12,
- sczl_fp1: formData.value.sczl_fp1,
- sczl_fp2: formData.value.sczl_fp2,
- sczl_fp3: formData.value.sczl_fp3,
- sczl_fp4: formData.value.sczl_fp4,
- sczl_fp5: formData.value.sczl_fp5,
- sczl_fp6: formData.value.sczl_fp6,
- sczl_fp7: formData.value.sczl_fp7,
- sczl_fp8: formData.value.sczl_fp8,
- sczl_fp9: formData.value.sczl_fp9,
- sczl_fp10: formData.value.sczl_fp10,
- sczl_fp11: formData.value.sczl_fp11,
- sczl_fp12: formData.value.sczl_fp12,
- sys_id:sys_id,
- }
- if(ADD.value=='新增'){
- const response = await inspectadd(restoredData);
- // ADD.value='1'
- // console.log(ADD.value)
- ADD.value='0'
- console.log(response)
- if(response.code==0){
- ElMessage({
- type: 'success',
- message: '新增成功',
- })
- }
- dialogFormVisible.value = false
- }else{
- const response = await shougongedit(restoredData);
- if(response.code==0){
- ElMessage({
- type: 'success',
- message: '更新成功',
- })
- }
- dialogFormVisible.value = false
- }
- }
- // 删除
- function onDel() {
- Del()
- }
- //删除
- const Del = async () => {
- const response = await shougongdel({UniqId:lastCellValue});
- if (response.code === 0) {
- ElMessage({
- type: 'success',
- message: '删除成功',
- })
- }
- getTableData()
- }
- const displayMod = ref('')
- // 按工单显示
- function onCountByGdbh() {
- console.log(displayMod.value)
- if (displayMod.value === 'date') {
- displayMod.value = 'gd'
- CountByGdbh()
- console.log(displayMod.value)
- } else {
- getTabdata()
- }
-
- // CountByGdbh()
- }
- //按工单显示
- const CountByGdbh = async () => {
- const response = await getInspectCountByGdbh();
- // console.log(response)
- if (response.code === 0) {
- console.log(response)
-
- const transformedData = response.data.map(item => ({
- label: `${item.sczl_gdbh+item.cpmc}`,
- children: item.sys.map(sysItem => ({
- label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
- params: {
- date: item.sczl_gdbh,
- sys_id: sysItem.sys_id,
- total: sysItem.count,
- },
- })),
- }));
- treeData.splice(0, treeData.length, ...transformedData);
-
- }
- // getTableData()
- }
- // ============== 表格控制部分结束 ===============
- // 获取需要的字典 可能为空 按需保留
- const setOptions = async () => {
- }
- // 获取需要的字典 可能为空 按需保留
- setOptions()
- // 多选数据
- const multipleSelection = ref([])
- // 多选
- const handleSelectionChange = (val) => {
- if(val.length>0){
- multipleSelection.value = val
- const lenth=val.length
- ScrapFactor.gdbh=val[lenth-1].combinedProp.split('-')[0];
- const parts = val[lenth-1].combinedProp2.split('-')
- ScrapFactor.yjno=parts[0];
- ScrapFactor.gxh=parts[1];
- // ScrapFactor.type=val[lenth-1].sczl_检验类别
- ScrapFactor.type='正品板'
- console.log(ScrapFactor)
- lastCellValue=val[lenth-1].UniqId
- console.log(ScrapFactor)
- val.splice(0, val.length); // 清空 val 数组
- console.log(lastCellValue)
- }
- }
- // 批量删除控制标记
- const deleteVisible = ref(false)
- // 多选删除
- const onDelete = async () => {
- const ids = []
- if (multipleSelection.value.length === 0) {
- ElMessage({
- type: 'warning',
- message: '请选择要删除的数据'
- })
- return
- }
- multipleSelection.value &&
- multipleSelection.value.map(item => {
- ids.push(item.ID)
- })
- const res = await deleteCompanyByIds({ ids })
- if (res.code === 0) {
- ElMessage({
- type: 'success',
- message: '删除成功'
- })
- if (tableData.value.length === ids.length && page.value > 1) {
- page.value--
- }
- deleteVisible.value = false
- getTableData()
- }
- }
- // 行为控制标记(弹窗内部需要增还是改)
- const type = ref('')
- // 更新行
- const updateCompanyFunc = async (row) => {
- const res = await findCompany({ ID: row.ID })
- type.value = 'update'
- if (res.code === 0) {
- formData.value = res.data.recompany
- dialogFormVisible.value = true
- }
- }
- // 弹窗控制标记
- const dialogFormVisible = ref(false)
- // 打开弹窗
- const openDialog = () => {
- type.value = 'create'
- dialogFormVisible.value = true
- }
- // 关闭弹窗
- const closeDialog = () => {
- dialogFormVisible.value = false
- formData.value = {
- address: '',
- image: '',
- name: '',
- }
- }
- // 弹窗确定
- const enterDialog = async () => {
- ElMessageBox.confirm('数据存盘?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
-
- if(formData.value.sczl_rq==''){
- ElMessage({
- type: 'error',
- message: '请填写日期'
- });
- document.getElementById('日期').focus()
- document.getElementById('日期').select()
- return;
- }
- if(formData.value.sczl_gdbh==''){
- ElMessage({
- type: 'error',
- message: '请填写工单编号'
- });
- document.getElementById('工单编号').focus()
- document.getElementById('工单编号').select()
- return;
- }
- if(formData.value.sczl_bzdh==''){
- ElMessage({
- type: 'error',
- message: '请选择班组'
- });
- document.getElementById('组别').focus()
- document.getElementById('组别').select()
- return;
- }
- if(formData.value.sczl_dedh==''){
- ElMessage({
- type: 'error',
- message: '请选择定额代号'
- });
- document.getElementById('定额代号').focus()
- document.getElementById('定额代号').select()
- return;
- }
- updateDetailData()
- });
- }
- let tables=ref(5);
- let lastCellValue=ref()
- // 双击表格操作
- function doubleClick(row, column, event) {
- type.value = 'update';
- lastCellValue= row['UniqId'];
- tables.value=lastCellValue
- dialogFormVisible.value = true
- GetInfo(tables.value)
- }
- // 单击表格操作
- function Click(row, column, event) {
- lastCellValue= row['UniqId'];
- console.log(lastCellValue)
- }
- // 导出excel
- function exportExcel() {
- console.log('导出到excel');
- }
- // 生命周期钩子
- onMounted(async () => {
- });
- </script>
- <style>
- .JKWTree-container {
- display: flex;
- }
- .JKWTree-tree {
- width: 300px;
- background-color: #fff;
- padding: 10px;
- margin-right: 20px;
- }
- .JKWTree-tree h3 {
- font-size: 15px;
- font-weight: 700;
- margin: 10px 0;
- }
- .JKWTree-content {
- flex: 1;
- }
- /* 选中某行时的背景色*/
- .el-table__body tr.current-row>td {
- background: #ff80ff !important;
- /* 背景颜色 */
- }
- </style>
- <style scoped>
- :deep(.el-table td .cell) {
- line-height: 20px !important;
- }
- :deep(.el-tabs__header){
- margin-bottom: 0;
- }
- .search{
- margin-left: 0px !important;
- margin-right: 10px !important;
- }
- .bt{
- margin-left: 2px !important;
- padding: 3px !important;
- font-size: 12px;
- }
- .el-tabs__header{
- margin: 0px !important;
- }
- .gva-table-box{
- padding: 0px !important;
- }
- .mab{
- margin-bottom: 5px;
- }
- </style>
|