| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247 |
- <template>
- <div>
- <!-- 左侧树形结构 -->
- <el-container>
- <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" @keyup="moveFocus">
- <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,'组别','bh0','name0')"
- @blur="getygsubmit($event, '0')" style="width: 100px; margin-right: 5px;" /> -->
- <el-input v-model="formData.sczl_bh0" id="bh0" @keydown="ent1($event,'组别','bh0','name0')"
- style="width: 100px; margin-right: 5px;" />
- <el-input v-model="formData.sczl_bh0_name" id="name0" disabled
- @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="工单编号" placeholder="Enter回车"
- @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,index,row,'定额代号')" 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="检验类别" placeholder="Enter回车"
- @keydown="ent1($event,index,row,'检验类别')"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="冲月定额" placeholder="Enter回车"
- @keydown="ent1($event,index,row,'冲月定额')" 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,index,row,'流程单号')"
- style="width: 60px; margin-right: 5px;" />
- <el-input v-model="formData.流程单号2" id="流程单号2" @keydown="ent1($event,index,row,'流程单号')"
- style="width: 60px; margin-right: 5px;" />
- <el-input v-model="formData.流程单号3" id="流程单号3" @keydown="ent1($event,index,row,'流程单号')"
- style="width: 60px; margin-right: 5px;" />
- <el-input v-model="formData.流程单号4" id="流程单号4" @keydown="ent1($event,index,row,'流程单号')"
- style="width: 60px; margin-right: 5px;" />
- <el-input v-model="formData.流程单号5" id="流程单号5" @keydown="ent1($event,index,row,'流程单号')"
- style="width: 60px; margin-right: 5px;" />
- <el-input v-model="formData.流程单号6" id="流程单号6" @keydown="ent1($event,index,row,'流程单号')"
- style="width: 60px; margin-right: 5px;" />
- <el-input v-model="formData.流程单号7" id="流程单号7" @keydown="ent1($event,index,row,'流程单号')"
- style="width: 60px; margin-right: 5px;" />
- <el-input v-model="formData.流程单号8" id="流程单号8" @keydown="ent1($event,index,row,'流程单号')"
- style="width: 60px; margin-right: 5px;" />
- <el-input v-model="formData.流程单号9" id="流程单号9" @keydown="ent1($event,index,row,'流程单号')"
- 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;" placeholder="Enter回车"
- 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"
- v-model="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"
- v-model="formData['sczl_bh' + (index + 6) + '_name']"
- :id="'name' + (index + 6)" @keydown="ent1($event)" />
- <el-input style="width: 100px; margin-right: 5px;"
- v-model="formData['sczl_cl' + (index + 6)]" :id="'cl' + (index + 6)"
- @keydown="ent1($event)" />
- <el-input style="width: 100px;" v-model="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="blModel" title="选择" destroy-on-close width="300px" @keydown="selectygbh($event)">
- <el-table :data="employeeData" ref="tableygbh" border :show-overflow-tooltip="true"
- :cell-class-name="blplanUsageCellClass"
- highlight-current-row="true"
- @row-dblclick="SelectClickygbh">
- <el-table-column prop="员工编号" label="员工编号"></el-table-column>
- <el-table-column prop="ygxm" label="员工姓名"></el-table-column>
- </el-table>
- </el-dialog>
- <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"
- ref="table">
- <el-table-column prop="sczl_bzdh" label="班组" width="150" />
- </el-table>
- </el-dialog>
- <el-dialog v-model="CdeVisible" title="选择" destroy-on-close width="200px"
- @keydown="selectCde($event)">
- <el-table tooltip-effect="dark" :data="selectDataCde" row-key="ID"
- highlight-current-row="true" border style="width:100%" :row-style="{ height: '30px' }"
- @row-dblclick="SelectClickCde" ref="tableCde">
- <el-table-column prop="sczl_冲定额" 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="GetDedhVisible"
- title="定额代号"
- id="tableFplb"
- @keydown="entdedh($event)"
- style="margin-top: 5%;"
- >
- <el-form>
- <el-form-item label="定额代号" class="mab" prop="keyOrder"></el-form-item>
- <div style="border:1px solid #eee; width:100%; height: 600px; overflow-y: auto;">
- <el-tree
- :data="GetDedhtreeData"
- ref="table_fplb"
- @keydown="handleTreeKeydown"
- :props="{ children: 'children', label: 'label' }"
- node-key="id"
- @node-click="GetDedhhandleNodeClick"
- ></el-tree>
- </div>
- </el-form>
- </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-dialog v-model="dialogSelectVisible_Yg" title="选择" destroy-on-close width="300px"
- @keydown="selectGX_Yg($event)">
- <el-table tooltip-effect="dark" :data="selectData_Yg" row-key="ID" highlight-current-row="true"
- border style="width:100%" @row-dblclick="handleSelectClick_Yg" ref="table_Yg">
- <el-table-column prop="员工编号" label="员工编号" width="100" />
- <el-table-column prop="ygxm" label="员工姓名" width="200" />
- </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 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;
- }
- }
- //员工弹窗
- const blModel = ref(false)
- const employeeData = ref('')
- const maxygnum = ref('')
- //员工列表接口
- const getyglist = async ()=>{
- if(formData.value.sczl_bh0 === ''){
- ElMessage.warning('请输入员工编号')
- return;
- }
- const response = await getYg({sczl_bh: formData.value.sczl_bh0});
- if (response.code === 0) {
- if(response.data.length === 1){
- formData.value.sczl_bh0 = response.data[0].员工编号; ;
- formData.value.sczl_bh0_name = response.data[0].ygxm;
- }else{
- blModel.value = true;
- employeeData.value = response.data
- tableygbh_setCurrent(employeeData.value[0])
- maxygnum.value = response.data.length-1
- }
- }
- }
- //默认高亮
- const tableygbh = ref()
- const tableygbh_setCurrent = (row) => {
- setTimeout(() => {
- tableygbh.value?.setCurrentRow(row)
- const {
- ygxm,
- 员工编号
- } = row
- formData.value.sczl_bh0 = row.员工编号
- formData.value.sczl_bh0_name = row.ygxm
- })
- }
- let ygnum = 0
- const selectygbh = (event) => {
- if (event.keyCode === 40) { // 向下箭头
- ygnum = Math.min(ygnum + 1, maxygnum.value); // 增加 ygnum,但不超过 maxygnum
- tableygbh_setCurrent(employeeData.value[ygnum]);
- } else if (event.keyCode === 38) { // 向上箭头
- ygnum = Math.max(ygnum - 1, 0); // 减少 ygnum,但不小于 0
- tableygbh_setCurrent(employeeData.value[ygnum]);
- } else if (event.keyCode === 13) { // Enter
- blModel.value = false;
- setTimeout(() => {
- const inputElement = document.getElementById('箱数');
- if (inputElement) {
- inputElement.focus();
- }
- }, 100);
- }
- }
- //员工选择
- const SelectClickgdbh = reactive([])
- const SelectClickygbh = (row, column, event) => {
- const {
- ygxm,
- 员工编号
- } = row
- formData.value.sczl_bh0 = row.员工编号
- formData.value.sczl_bh0_name = row.ygxm
- blModel.value = false
- setTimeout(() => {
- const inputElement = document.getElementById('箱数');
- if (inputElement) {
- inputElement.focus();
- }
- }, 100);
- }
-
- let isProcessing = false; // 标志位
- let lastFpSl = null; // 记录上一次输入的数量
- const dialogbutton = ref(false); // 控制对话框显示
- let enterCount = 0; // 记录回车键按下的次数
-
- //键盘 input框跳转
- const ent1 = (event,id1,id2,id3) => {
- const inputs = document.getElementsByTagName('input');
- const currentIndex = Array.from(inputs).indexOf(event.target);
- console.log(id3)
-
- if (event.keyCode === 13 && id3 === '流程单号') {
- console.log(id3);
- // 获取所有相关的输入框值
- const allValues = [
- formData.value.流程单号1,
- formData.value.流程单号2,
- formData.value.流程单号3,
- formData.value.流程单号4,
- formData.value.流程单号5,
- formData.value.流程单号6,
- formData.value.流程单号7,
- formData.value.流程单号8,
- formData.value.流程单号9,
- formData.value.流程单号10,
- ];
- // 获取当前输入框的值
- const currentValue = event.target.value;
- // 如果当前值为 0,不进行校验,直接跳转到下一个输入框
- if (currentValue === "0") {
- console.log("输入值为 0,无需校验");
- // 跳转到下一个输入框
- let nextIndex = currentIndex + 1;
- let foundNext = false; // 标记是否找到下一个可用输入框
- while (nextIndex < inputs.length) {
- if (inputs[nextIndex].disabled) {
- console.log("当前输入框为 disabled,跳过");
- nextIndex++; // 跳过 disabled 的输入框
- continue;
- }
- if (!inputs[nextIndex].readOnly) {
- nextTick(() => {
- inputs[nextIndex].focus();
- inputs[nextIndex].select();
- });
- foundNext = true; // 找到下一个可用输入框
- break;
- }
- nextIndex++;
- }
- if (!foundNext) {
- console.log("没有更多可用的输入框");
- }
- return;
- }
- // 检查是否有重复的值
- const isDuplicate = allValues.filter((val) => val === currentValue).length > 1;
- if (isDuplicate) {
- // 如果有重复值,提示用户并清空当前输入框
- event.target.value = 0;
- ElMessage({
- type: 'error',
- message: '输入的值已存在,请重新输入'
- });
- } else {
- console.log('输入值无重复');
- // 跳转到下一个输入框
- let nextIndex = currentIndex + 1;
- let foundNext = false; // 标记是否找到下一个可用输入框
- while (nextIndex < inputs.length) {
- if (inputs[nextIndex].disabled) {
- console.log("当前输入框为 disabled,跳过");
- nextIndex++; // 跳过 disabled 的输入框
- continue;
- }
- if (!inputs[nextIndex].readOnly) {
- nextTick(() => {
- inputs[nextIndex].focus();
- inputs[nextIndex].select();
- });
- foundNext = true; // 找到下一个可用输入框
- break;
- }
- nextIndex++;
- }
- if (!foundNext) {
- console.log("没有更多可用的输入框");
- }
- }
- }else if (event.keyCode === 13 && id3 === '定额代号') {
- console.log("定额代号");
- GetDedh()
- // getDedhsubmit(event,id1,id2,id3)
- let nextIndex = currentIndex + 1;
- let foundNext = false; // 标记是否找到下一个可用的输入框
- while (nextIndex < inputs.length) {
- if (inputs[nextIndex].disabled) {
- console.log("当前输入框为disabled,跳过");
- nextIndex++; // 跳过disabled的输入框
- continue;
- }
- if (!inputs[nextIndex].readOnly) {
- nextTick(() => {
- inputs[nextIndex].focus();
- inputs[nextIndex].select();
- });
- foundNext = true; // 找到下一个可用输入框
- break;
- }
- nextIndex++;
- }
- }else if(id2 === 'bh0' && event.keyCode === 13){
- getyglist()
- }else if (event.keyCode === 13 && id3 === '检验类别') {
- console.log("检验类别");
- getLbsubmit()
- let nextIndex = currentIndex + 1;
- let foundNext = false; // 标记是否找到下一个可用的输入框
- while (nextIndex < inputs.length) {
- if (inputs[nextIndex].disabled) {
- nextIndex++; // 跳过disabled的输入框
- continue;
- }
- if (!inputs[nextIndex].readOnly) {
- nextTick(() => {
- inputs[nextIndex].focus();
- inputs[nextIndex].select();
- });
- foundNext = true; // 找到下一个可用输入框
- break;
- }
- nextIndex++;
- }
- }else if (event.keyCode === 13 && id3 === '冲月定额') {
- getCdesubmit()
- let nextIndex = currentIndex + 1;
- let foundNext = false; // 标记是否找到下一个可用的输入框
- while (nextIndex < inputs.length) {
- if (inputs[nextIndex].disabled) {
- nextIndex++; // 跳过disabled的输入框
- continue;
- }
- if (!inputs[nextIndex].readOnly) {
- nextTick(() => {
- inputs[nextIndex].focus();
- inputs[nextIndex].select();
- });
- foundNext = true; // 找到下一个可用输入框
- break;
- }
- nextIndex++;
- }
- }else if (event.keyCode === 13 || event.keyCode === 40) {
- console.log('其他')
- let nextIndex = currentIndex + 1;
- let foundNext = false; // 标记是否找到下一个可用的输入框
- while (nextIndex < inputs.length) {
- if (inputs[nextIndex].disabled) {
- nextIndex++; // 跳过disabled的输入框
- continue;
- }
- if (!inputs[nextIndex].readOnly) {
- nextTick(() => {
- inputs[nextIndex].focus();
- inputs[nextIndex].select();
- });
- foundNext = true; // 找到下一个可用输入框
- break;
- }
- nextIndex++;
- }
- // 如果没有找到下一个可用输入框,提示用户
- if (!foundNext) {
- console.log("已经是最后一个输入框");
- ElMessageBox.confirm('数据存盘?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- enterDialog()
- })
- }
- }else if (event.keyCode === 13 || event.keyCode === 40) {
- 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 === 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)
- const {
- sczl_bzdh
- } = row
- formData.value.sczl_bzdh = row.sczl_bzdh
- })
- }
- //班组选择
- const selectDataBz = reactive([])
- const BzVisible = ref(false)
- const SelectClickBz = (row, column, event) => {
- const {
- sczl_bzdh
- } = row
- formData.value.sczl_bzdh = row.sczl_bzdh
- BzVisible.value = false
- }
- const selectBZ = (event) => {
- if (event.keyCode === 40) { // Enter 或向下箭头
- setCurrent(selectDataBz[1]);
- } else if (event.keyCode === 38) {
- setCurrent(selectDataBz[0]);
- } else if (event.keyCode === 13) {
- BzVisible.value = false
- }
- }
- //冲定额失去焦点事件
- const getCdesubmit = () => {
- //弹出选择
- const data = [{
- 'sczl_冲定额': ''
- }, {
- 'sczl_冲定额': '是'
- }]
- selectDataCde.splice(0, selectDataCde.length, ...data)
- CdeVisible.value = true
- setCdeCurrent(data[0])
- }
- const tableCde = ref()
- const setCdeCurrent = (row) => {
- setTimeout(() => {
- tableCde.value?.setCurrentRow(row)
- const {
- sczl_冲定额
- } = row
- formData.value.sczl_冲定额 = row.sczl_冲定额
- })
- }
- //冲定额选择
- const selectDataCde = reactive([])
- const CdeVisible = ref(false)
- const SelectClickCde = (row, column, event) => {
- const {
- sczl_冲定额
- } = row
- formData.value.sczl_冲定额 = row.sczl_冲定额
- CdeVisible.value = false
- }
- const selectCde = (event) => {
- if (event.keyCode === 40) { // Enter 或向下箭头
- setCdeCurrent(selectDataCde[1]);
- } else if (event.keyCode === 38) {
- setCdeCurrent(selectDataCde[0]);
- } else if (event.keyCode === 13) {
- CdeVisible.value = false
- }
- }
- 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
- }
-
- let Bname = '';
- let Bbh = '';
- let input_name = '';
- //员工编号键盘事件
- const ent = (event, inputName) => {
- input_name = 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) {
- Bname = 'sczl_bh' + inputName + '_name';
- Bbh = 'sczl_bh' + inputName;
- if (response.data.length == 1) {
- formData.value[Bname] = response.data[0].ygxm
- formData.value[Bbh] = response.data[0].员工编号
- //设置姓名样式
- unsetColorReadonly('cl' + inputName)
- unsetColorReadonly('fp' + inputName)
-
- document.getElementById('cl' + inputName).focus()
- document.getElementById('cl' + inputName).select()
- } else if (response.data.length > 1) {
- selectData_Yg.splice(0, selectData_Yg.length, ...response.data)
- setGXCurrent_Yg(selectData_Yg[0])
- dialogSelectVisible_Yg.value = true
- } else {
- ElMessage({
- type: 'warning',
- message: '未查询到该员工'
- })
- 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()
- }
- }
-
-
-
- // formData.value[Bname] = response.data[0].ygxm;
- // formData.value[Bbh] = response.data[0].员工编号;
- // //设置姓名样式
- // 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 (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 (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 (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 (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 dialogSelectVisible_Yg = ref(false)
- const selectData_Yg = reactive([])
- // 处理选择框
- const handleSelectClick_Yg = (row, column, event) => {
- formData.value[Bname] = row.ygxm
- formData.value[Bbh] = row.员工编号
- //设置姓名样式
- unsetColorReadonly('cl' + input_name)
- unsetColorReadonly('fp' + input_name)
-
- document.getElementById('cl' + input_name).focus()
- document.getElementById('cl' + input_name).select()
- ent_sum()
- dialogSelectVisible_Yg.value = false
- }
- const currentIndex_Yg = ref(0);
- const GXCurrent_Yg = ref(0);
- const selectGX_Yg = (event) => {
- if (event.keyCode === 40) { // 向下箭头
- if (currentIndex_Yg.value < selectData_Yg.length - 1) {
- currentIndex_Yg.value++;
- setGXCurrent_Yg(selectData_Yg[currentIndex_Yg.value]);
- } else {
- currentIndex_Yg.value = 0;
- setGXCurrent_Yg(selectData_Yg[currentIndex_Yg.value]); // 到达最后一行时回到第一行
- }
- } else if (event.keyCode === 38) { // 向上箭头
- if (currentIndex_Yg.value > 0) {
- currentIndex_Yg.value--;
- setGXCurrent_Yg(selectData_Yg[currentIndex_Yg.value]);
- } else {
- currentIndex_Yg.value = selectData_Yg.length - 1;
- setGXCurrent_Yg(selectData_Yg[currentIndex_Yg.value]); // 到达第一行时回到最后一行
- }
- } else if (event.keyCode === 13) { // 回车键
- dialogSelectVisible_Yg.value = false;
-
- }
- }
- const table_Yg = ref()
- const setGXCurrent_Yg = (row) => {
- setTimeout(() => {
- table_Yg.value?.setCurrentRow(row)
- formData.value[Bname] = row.ygxm
- formData.value[Bbh] = row.员工编号
- //设置姓名样式
- unsetColorReadonly('cl' + input_name)
- unsetColorReadonly('fp' + input_name)
-
- document.getElementById('cl' + input_name).focus()
- document.getElementById('cl' + input_name).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
- })
- }
- // 定义状态
- let GetDedhtreeData = reactive([]); // 树形数据
- const GetDedhVisible = ref(false); // 弹窗显隐状态
- const activeNodeKey = ref(null); // 当前选中节点的 key
- const table_fplb = ref(null); // el-tree 的 ref
- const defaultExpandedKey = ref(null); // 默认展开的节点 key
- const selectIndex = ref(0); // 当前选中的索引
- // 获取定额代号并构建树形结构
- const GetDedh = async () => {
- const response = await shougonggetDedh();
- if (response.code === 0) {
- // 封装数据为数组,便于递归处理根节点
- const data = [];
- data[0] = response.data;
- // 递归构建树形结构
- const buildTree = (node) => {
- return {
- label: `${node.sys_bh}【${node.sys_mc}】`,
- id: node.sys_bh,
- children: Array.isArray(node.bh_mc) ? node.bh_mc.map(buildTree) : []
- };
- };
- // 构建树形结构并赋值给响应变量
- GetDedhtreeData = data.map(buildTree);
- GetDedhVisible.value = true; // 显示弹窗
- }
- };
- // 节点点击事件
- const GetDedhhandleNodeClick = (nodeData) => {
- console.log("单击节点:", nodeData);
- if (!nodeData.children || nodeData.children.length === 0) {
- // 如果点击的是子节点,则关闭弹窗并更新数据
- formData.value.sczl_dedh = nodeData.label.split("【")[0]; // 提取定额代号
- GetDedhVisible.value = false; // 关闭弹窗
- }
- };
- // 树组件键盘事件
- const handleTreeKeydown = (event) => {
- const tree = table_fplb.value; // 获取树实例
- if (!tree) {
- console.error("树组件未加载");
- return;
- }
- const focusedElement = document.activeElement;
- const focusedNodeId = focusedElement?.getAttribute("data-key"); // 获取 DOM 的 data-key 属性
- // 回车键
- if (event.keyCode === 13 && focusedNodeId) {
- tree.setCurrentKey(focusedNodeId); // 设置当前节点为选中
- tree.$nextTick(() => {
- const currentNode = tree.getCurrentNode(); // 获取当前选中的节点
- if (!currentNode) {
- console.warn("没有选中的节点");
- return;
- }
- // 展开当前节点并收起其他节点
- Object.keys(tree.store.nodesMap).forEach((key) => {
- tree.store.nodesMap[key].expanded = false; // 收起所有节点
- });
- tree.store.nodesMap[currentNode.id].expanded = true; // 展开当前节点
- // 如果有子节点,选中第一个子节点
- if (currentNode.children && currentNode.children.length > 0) {
- const firstChild = currentNode.children[0];
- const firstChildKey = firstChild.id.toString();
- tree.setCurrentKey(firstChildKey); // 选中第一个子节点
- setTimeout(() => {
- const firstChildDom = tree.$el.querySelector(`[data-key="${firstChildKey}"]`);
- if (firstChildDom) {
- firstChildDom.focus();
- firstChildDom.scrollIntoView({ block: "nearest" });
- }
- });
- } else {
- // 如果没有子节点,执行确认操作
- console.log("当前子节点:", currentNode.label);
- formData.value.sczl_dedh = currentNode.label.split("【")[0]
- GetDedhVisible.value = false; // 关闭弹窗
- }
- });
- }
- // 上下箭头键
- else if (event.keyCode === 38 || event.keyCode === 40) {
- const currentNode = tree.getCurrentNode();
- if (currentNode) {
- const currentNodeDom = tree.$el.querySelector(`[data-key="${currentNode.id}"]`);
- if (currentNodeDom) {
- currentNodeDom.focus();
- }
- }
- }
- };
- // 弹窗键盘事件处理(绑定在弹窗上)
- const entdedh = (event) => {
- console.log("键盘事件触发"); // 用于调试
- event.preventDefault(); // 阻止浏览器默认行为(如滚动页面)
- event.stopPropagation(); // 阻止事件冒泡
- const tree = table_fplb.value?.$el;
- if (!tree) return;
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
- // 上下箭头键:切换选中的兄弟节点
- const focusedElement = document.activeElement;
- const focusedNodeId = focusedElement?.getAttribute("data-key");
- const currentNode = table_fplb.value?.store.nodesMap[focusedNodeId];
- if (currentNode) {
- let nextNode;
- if (event.key === "ArrowDown") {
- nextNode = table_fplb.value?.getNextSibling(currentNode);
- } else if (event.key === "ArrowUp") {
- nextNode = table_fplb.value?.getPreviousSibling(currentNode);
- }
- if (nextNode) {
- const nextNodeKey = nextNode.data.id.toString();
- table_fplb.value?.setCurrentKey(nextNodeKey); // 设置选中下一个节点
- focusAndScrollToNode(nextNodeKey); // 聚焦到下一个节点并滚动到视图中
- }
- }
- } else {
- // 默认行为:展开所有节点并选中第一个节点
- const firstNodeDom = tree.querySelector("[data-key]");
- if (firstNodeDom) {
- firstNodeDom.focus();
- firstNodeDom.scrollIntoView({ block: "nearest" });
-
- // 设置第一个节点为当前选中节点
- const firstNodeId = firstNodeDom.getAttribute("data-key");
- table_fplb.value?.setCurrentKey(firstNodeId);
-
- // 获取第一个节点对象并展开所有子节点
- const firstNode = table_fplb.value?.store.nodesMap[firstNodeId];
- if (firstNode) {
- table_fplb.value?.store.expandNode(firstNode, true);
- expandAllNodes(firstNode); // 递归展开第一个节点的所有子节点
- }
- }
- }
- };
-
- // let GetDedhtreeData = reactive([]);
- // const GetDedhVisible = ref(false)
-
- // //获取定额代号
- // const GetDedh = async (value) => {
- // const response = await shougonggetDedh();
- // const treeData = {};
- // 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) {
- const rowIndex = tableData.findIndex(row => row.UniqId === lastCellValue);
- tableData[rowIndex].sczl_废品率系数 = response.data.num;
- ElMessage({
- type: 'success',
- message: '刷新成功',
- })
- } else {
- ElMessage({
- type: 'error',
- message: '刷新失败',
- })
- }
- // console.log(response)
- // const rowIndex = tableData.findIndex(row => row.UniqId === 123);
- }
- const ADD = ref('0')
- //新增
- function onAdd() {
- dialogFormVisible.value = true
- setTimeout(() => {
- const inputElement = document.getElementById('日期');
- if (inputElement) {
- inputElement.focus();
- }
- }, 100);
- ADD.value = '新增'
- type.value = 'create'
- if (typeof(lastCellValue) == 'number') {
- shougonggetInfo({ UniqId: lastCellValue }).then(response=>{
- if (response.code === 0) {
- formData.value = response.data;
- formData.value.sczl_废品率系数 = ''
- formData.value.sczl_cl1 = 0
- formData.value.sczl_cl2 = 0
- formData.value.sczl_cl3 = 0
- formData.value.sczl_cl4 = 0
- formData.value.sczl_cl5 = 0
- formData.value.sczl_cl6 = 0
- formData.value.sczl_cl7 = 0
- formData.value.sczl_cl8 = 0
- formData.value.sczl_cl9 = 0
- formData.value.sczl_cl10 = 0
- formData.value.sczl_cl11 = 0
- formData.value.sczl_cl12 = 0
- formData.value.sczl_fp1 = 0
- formData.value.sczl_fp2 = 0
- formData.value.sczl_fp3 = 0
- formData.value.sczl_fp4 = 0
- formData.value.sczl_fp5 = 0
- formData.value.sczl_fp6 = 0
- formData.value.sczl_fp7 = 0
- formData.value.sczl_fp8 = 0
- formData.value.sczl_fp9 = 0
- formData.value.sczl_fp10 = 0
- formData.value.sczl_fp11 = 0
- formData.value.sczl_fp12 = 0
- formData.value.流程单号1 = 0
- formData.value.流程单号2 = 0
- formData.value.流程单号3 = 0
- formData.value.流程单号4 = 0
- formData.value.流程单号5 = 0
- formData.value.流程单号6 = 0
- formData.value.流程单号7 = 0
- formData.value.流程单号8 = 0
- formData.value.流程单号9 = 0
- formData.value.流程单号10 = 0
- }
- });
- }
- }
- const ScrapFactor = {
- gdbh: '',
- yjno: '',
- gxh: '',
- type: '',
- }
- // 刷新废品率系数
- function onRefresh() {
- if (params.date == '' || ScrapFactor.gdbh == '') {
- ElMessage({
- type: 'warning',
- message: '未选中记录',
- })
- return
- }
- if (ScrapFactor.type == '') {
- ElMessage({
- type: 'warning',
- message: '该记录检验类别为空',
- })
- return
- }
- 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.流程单号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,
- qczl_NumDesc: formData.value.qczl_NumDesc,
- 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 == '新增') {
- console.log(restoredData)
- return;
- 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: '新增成功',
- })
- //刷新侧边栏
- getTabdata()
- if (params.date != '') {
- //刷新页面
- getTableData()
- }
- }
- } else {
- const response = await shougongedit(restoredData);
- if (response.code == 0) {
- ElMessage({
- type: 'success',
- message: '更新成功',
- })
- }
- dialogFormVisible.value = false
- }
- }
- // 删除
- function onDel() {
- Del()
- }
- //删除
- const Del = () => {
- if (typeof(lastCellValue) == 'object') {
- ElMessage({
- type: 'warning',
- message: '未选中记录',
- })
- return
- }
- ElMessageBox.confirm(
- `确认删除这条数据么?`,
- '警告', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- }
- ).then(async () => {
- const response = await shougongdel({
- UniqId: lastCellValue
- });
- if (response.code === 0) {
- ElMessage({
- type: 'success',
- message: '删除成功',
- })
- //刷新侧边栏
- getTabdata()
- //刷新页面
- 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()
- for (let i = 1; i < 10; i++) {
- formData.value[`流程单号${i}`]=0;
- }
- for (let i = 0; i < 12; i++) {
- formData.value[`sczl_bh${i}`] = '';
- formData.value[`sczl_bh${i}_name`] = '';
- formData.value[`sczl_cl${i}`] = 0;
- formData.value[`sczl_fp${i}`] = 0;
- }
- });
- }
- 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(row)
- const parts = row['sczl_yjgx'].split('-')
- ScrapFactor.yjno = parts[0]
- ScrapFactor.gdbh = row['sczl_gdbh']
- ScrapFactor.type = row['sczl_检验类别']
- ScrapFactor.gxh = parts[1]
- 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>
|