12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191 |
- <!-- 物料信息基础档案——详情 -->
- <template>
- <div class="material-details" v-loading="loading">
- <!-- 操作栏 -->
- <el-card>
- <!-- 基本信息栏 -->
- <div style="display: flex; justify-content: end">
- <div v-if="activeMainTab == 'material'">
- <!-- 基本信息修改状态下—— 保存、保存新增、更新导入、取消 -->
- <el-row
- v-if="updateButtonGroup || maintainNewVersion"
- :gutter="10"
- class="mb10"
- type="flex"
- justify="end"
- >
- <el-col :span="1.5">
- <el-button-group>
- <el-button
- :size="size"
- @click="handleSave"
- v-hasPermi="[
- 'system:material:add',
- `${maintainNewVersion ? '' : 'system:material:versions'}`,
- ]"
- >
- 保存
- </el-button>
- </el-button-group>
- </el-col>
- <el-col :span="1.5">
- <el-button-group>
- <el-button :size="size" @click="handleCancel">取消</el-button>
- </el-button-group>
- </el-col>
- </el-row>
- <el-row v-else :gutter="10" class="mb10" type="flex" justify="end">
- <!-- 新增、修改、删除、复制 -->
- <el-col :span="1.5">
- <el-button-group>
- <!-- <el-button :size="size" @click="handleInster">新增</el-button> -->
- <el-button :size="size" @click="handleBasicEdit"
- >修改</el-button
- >
- <!-- <el-button :size="size" @click="handleDel">删除</el-button> -->
- <!-- <el-button :size="size" @click="handleCopy">复制</el-button> -->
- </el-button-group>
- </el-col>
- <!-- 查询、刷新、过滤 -->
- <el-col :span="1.5">
- <el-button-group>
- <el-button :size="size" @click="handleRefresh">刷新</el-button>
- </el-button-group>
- </el-col>
- <!-- 启用 -->
- <el-col :span="1.5">
- <el-button-group>
- <el-button :size="size" @click="handleMaterialType"
- >维护物料类别</el-button
- >
- <el-button
- :size="size"
- @click="handleIsInvoke"
- :key="count"
- v-hasPermi="['system:material:add']"
- >
- <!-- 0:启用 2:停用 -->
- {{ basicData.value.isEnable == "已启用" ? "停用" : "启用" }}
- </el-button>
- </el-button-group>
- </el-col>
- <!-- 维护新版本 -->
- <el-col :span="1.5">
- <el-button-group>
- <el-button
- :size="size"
- @click="handleNewVersion"
- v-hasPermi="['system:material:versions']"
- >维护新版本
- </el-button>
- </el-button-group>
- </el-col>
- </el-row>
- </div>
- <!-- 其他标签页操作 修改、删除 -->
- <el-row
- :gutter="10"
- class="mb10"
- v-show="activeMainTab != 'material'"
- type="flex"
- justify="end"
- >
- <el-col :span="1.5">
- <el-button-group>
- <el-button :size="size" @click="handleOtherEdit('table')"
- >修改</el-button
- >
- <el-button
- :size="size"
- v-show="activeMainTab != 'material_finance'"
- @click="handleOtherDel"
- >删除</el-button
- >
- </el-button-group>
- <el-button-group>
- <el-button :size="size" @click="handleOtherListRefresh"
- >刷新</el-button
- >
- </el-button-group>
- </el-col>
- </el-row>
- <!-- 返回 切换 附件管理 -->
- <el-row type="flex" justify="space-between">
- <el-col :span="6">
- <!-- :disabled="headerParam.isEdit" -->
- <el-button
- :size="size"
- @click="handleBack"
- :disabled="updateButtonGroup"
- >返回</el-button
- >
- </el-col>
- <el-col :span="6" style="text-align: right"> </el-col>
- </el-row>
- </div>
- <div class="md-content" :key="basicData.value.id">
- <el-form :inline="true" label-position="right" :model="basicData.value">
- <!-- <el-form-item label="所属组织"></el-form-item> -->
- <el-form-item label="物料编码">
- <el-input
- v-model="basicData.value.code"
- readonly
- size="mini"
- ></el-input>
- </el-form-item>
- <el-form-item label="物料名称">
- <el-input
- v-model="basicData.value.name"
- readonly
- size="mini"
- ></el-input>
- </el-form-item>
- <el-form-item label="英文名称">
- <el-input
- v-model="basicData.value.enName"
- readonly
- size="mini"
- ></el-input>
- </el-form-item>
- <!-- <el-form-item label="版本号"></el-form-item> -->
- </el-form>
- <dr-tabs :tabList="detailsTabs" :handleTabClick="handleMainTabClick">
- <template #tabContent>
- <div class="md-basic" :key="count">
- <!-- 主信息 -->
- <div class="md-main">
- <!-- 基本信息展示表单 -->
- <el-form
- v-if="activeMainTab == 'material'"
- :inline="true"
- label-position="right"
- :model="basicData.value"
- :key="basicData.value.id"
- ref="basicMessageRef"
- :rules="rules"
- >
- <el-row :gutter="10">
- <el-col
- :span="6"
- v-for="f in basicData.form"
- style="text-align: right"
- >
- <template v-if="f.show">
- <!-- 多选框 -->
- <el-form-item
- v-if="f.attribute == 'checkbox'"
- style="text-align: left"
- :prop="f.prop"
- :key="f.required"
- >
- <el-checkbox
- :label="f.name"
- name="type"
- v-model="basicData.value[f.prop]"
- true-label="0"
- false-label="2"
- :disabled="handleJudge(f)"
- size="mini"
- >
- </el-checkbox>
- </el-form-item>
- <!-- 下拉框 -->
- <el-form-item
- v-else-if="f.attribute == 'select'"
- :id="updateButtonGroup && f.apiUrl ? 'selected' : ''"
- :prop="f.apiUrl ? `${f.prop}Name` : f.prop"
- :key="f.required"
- :rules="[
- {
- required: f.required,
- message: `请选择${f.name}`,
- trigger: 'change',
- },
- ]"
- >
- <template slot="label">
- <el-tooltip
- class="item"
- effect="dark"
- placement="top-start"
- :disabled="f.name.length < 10"
- >
- <!-- <span :class="(f.apiUrl && f.required) ? 'redSpan': ''">{{ f.name }}</span> -->
- <span>{{ f.name }}</span>
- <div slot="content">
- <p>{{ f.name }}</p>
- </div>
- </el-tooltip>
- </template>
- <!-- 参照 -->
- <el-select
- v-if="f.apiUrl"
- v-model="basicData.value[`${f.prop}Name`]"
- placeholder="请选择"
- size="mini"
- :key="basicData.value[f.prop]"
- :disabled="handleJudge(f)"
- @focus="
- f.apiUrl &&
- handleQueryMore(f, '', {
- name: 'basicData',
- prop: f.prop,
- })
- "
- >
- <div slot="empty"></div>
- </el-select>
- <!-- 字典 -->
- <el-select
- v-if="f.dictId"
- v-model="basicData.value[f.prop]"
- placeholder="请选择"
- size="mini"
- :key="basicData.value[f.prop]"
- :disabled="handleJudge(f)"
- >
- <el-option
- v-if="f.dictId"
- v-for="d in f.dictValue"
- :key="d.dictValue"
- :label="d.dictLabel"
- :value="d.dictValue"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <!-- 图片 -->
- <el-form-item
- v-else-if="f.attribute == 'image'"
- :label="f.name"
- @clicks="handleUpImage"
- >
- <el-image
- :src="basicData.value[f.prop]"
- fit="contain"
- ></el-image>
- <!-- <img :src="basicData.value[f.prop]" @clicks="handleUpImage" alt="加载失败"> -->
- </el-form-item>
- <!--attribute 文本 数字 文本域 为null -->
- <el-form-item v-else :prop="f.prop" :key="f.required">
- <template slot="label">
- <el-tooltip
- class="item"
- effect="dark"
- placement="top-start"
- :disabled="f.name.length < 10"
- >
- <span>{{ f.name }}</span>
- <div slot="content">
- <p>{{ f.name }}</p>
- </div>
- </el-tooltip>
- </template>
- <el-input
- size="mini"
- v-model="basicData.value[f.prop]"
- :type="f.attribute || 'text'"
- :readonly="handleJudge(f)"
- :rows="1"
- :maxlength="judgeMaxLength(f.prop)"
- ></el-input>
- </el-form-item>
- </template>
- </el-col>
- </el-row>
- </el-form>
- <!-- 其他展示为列表 -->
- <el-table
- v-else
- border
- :data="mainMsg.value"
- @cell-dblclick="handleMaindbClick"
- @selection-change="handleMainChange"
- >
- <el-table-column type="selection" width="55" />
- <el-table-column
- type="index"
- v-if="mainMsg.form.length"
- label="序号"
- width="55"
- align="center"
- />
- <el-table-column
- v-for="m in mainMsg.form"
- v-if="m.show"
- :label="m.name"
- align="center"
- :prop="m.attribute == 'select' ? `${m.prop}Name` : m.prop"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{
- m.attribute == "select"
- ? scope.row[`${m.prop}Name`]
- : m.attribute == "checkbox"
- ? scope.row[m.prop] == "0"
- ? "√"
- : ""
- : scope.row[m.prop]
- }}
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 副信息 -->
- <div class="md-vice">
- <dr-tabs
- v-if="activeMainTab == 'material'"
- :tabList="basicMessage"
- :handleTabClick="handleViceTabClick"
- >
- <template #tabContent>
- <el-form
- v-if="activeViceTab == 'material_medcine'"
- :inline="true"
- label-position="right"
- ref="medcineRef"
- :model="medcineData.value"
- class="md-vice-content"
- :rules="medcineRules"
- :key="medcineData.value.id"
- >
- <el-row :gutter="10">
- <el-col
- :span="6"
- v-for="m in medcineData.form"
- style="text-align: right"
- >
- <!-- 需要根据基本信息中的是否医药物料字段判断是否可以填写 -->
- <template v-if="m.show">
- <!-- 多选框 -->
- <el-form-item
- v-if="m.attribute == 'checkbox'"
- :prop="m.prop"
- >
- <el-checkbox
- :label="m.name"
- name="type"
- v-model="medcineData.value[m.prop]"
- size="mini"
- :disabled="
- !(
- updateButtonGroup &&
- m.edit &&
- basicData.value.isMedicine == '0'
- )
- "
- true-label="0"
- false-label="2"
- >
- </el-checkbox>
- </el-form-item>
- <!-- 下拉框 -->
- <el-form-item
- v-else-if="m.attribute == 'select'"
- :label="m.name"
- :prop="m.apiUrl ? `${m.prop}Name` : m.prop"
- :rules="[
- {
- required: m.required,
- message: `请选择${m.name}`,
- trigger: 'change',
- },
- ]"
- >
- <!-- 参照弹窗 -->
- <el-select
- v-if="m.apiUrl"
- v-model="medcineData.value[`${m.prop}Name`]"
- placeholder="请选择"
- :key="medcineData.value[m.prop]"
- size="mini"
- :disabled="
- !(
- updateButtonGroup &&
- m.edit &&
- basicData.value.isMedicine == '0'
- )
- "
- @focus="
- m.apiUrl &&
- handleQueryMore(m, '', {
- name: 'medcineData',
- prop: m.prop,
- })
- "
- >
- <div slot="empty"></div>
- </el-select>
- <!-- 下拉选择 -->
- <el-select
- v-if="m.dictId"
- v-model="medcineData.value[m.prop]"
- placeholder="请选择"
- :key="medcineData.value[m.prop]"
- size="mini"
- :disabled="
- !(
- updateButtonGroup &&
- m.edit &&
- basicData.value.isMedicine == '0'
- )
- "
- @focus="
- m.apiUrl &&
- handleQueryMore(m, '', {
- name: 'medcineData',
- prop: m.prop,
- })
- "
- >
- <el-option
- v-if="m.dictId"
- v-for="d in m.dictValue"
- :key="d.dictValue"
- :label="d.dictLabel"
- :value="d.dictValue"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <!-- 图片 -->
- <el-form-item
- v-else-if="m.attribute == 'image'"
- :label="m.name"
- >
- <el-image
- :src="medcineData.value[m.prop]"
- fit="contain"
- >
- </el-image>
- </el-form-item>
- <!-- 文本、数字、textarae -->
- <el-form-item v-else :label="m.name">
- <el-input
- size="mini"
- v-model="medcineData.value[m.prop]"
- :type="m.attribute || 'text'"
- :rows="1"
- :readonly="
- !(
- updateButtonGroup &&
- m.edit &&
- basicData.value.isMedicine == '0'
- )
- "
- >
- </el-input>
- </el-form-item>
- </template>
- </el-col>
- </el-row>
- </el-form>
- <!-- 其他展示为列表 -->
- <!-- 辅计量 -->
- <el-table
- border
- v-else-if="activeViceTab == 'material_unit'"
- :data="unitDetails.value"
- class="material-table"
- >
- <el-table-column
- type="index"
- v-if="unitDetails.form.length"
- label="序号"
- width="55"
- align="center"
- />
- <el-table-column
- v-for="v in unitDetails.form"
- v-if="v.show"
- :label="v.name"
- align="center"
- :prop="
- v.attribute == 'select' ? `${v.prop}Name` : v.prop
- "
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{
- v.attribute == "select"
- ? scope.row[`${v.prop}Name`]
- : v.attribute == "checkbox"
- ? scope.row[v.prop] == "0"
- ? "√"
- : ""
- : scope.row[v.prop]
- }}
- </template>
- </el-table-column>
- </el-table>
- <!-- 辅助属性 -->
- <el-table
- border
- v-else-if="activeViceTab == 'material_property'"
- :data="propertyDetail.value"
- class="material-table"
- >
- <el-table-column
- type="index"
- v-if="propertyDetail.form.length"
- label="序号"
- width="55"
- align="center"
- />
- <el-table-column
- v-for="v in propertyDetail.form"
- v-if="v.show"
- :label="v.name"
- align="center"
- :prop="
- v.attribute == 'select' ? `${v.prop}Name` : v.prop
- "
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{
- v.attribute == "select"
- ? scope.row[`${v.prop}Name`]
- : v.attribute == "checkbox"
- ? scope.row[v.prop] == "0"
- ? "√"
- : ""
- : scope.row[v.prop]
- }}
- </template>
- </el-table-column>
- </el-table>
- </template>
- </dr-tabs>
- </div>
- <!-- 基本信息 - 审计信息 -->
- <div class="md-auditInfo" v-if="activeMainTab == 'material'">
- <el-divider content-position="left">审计信息</el-divider>
- <el-form
- :inline="true"
- label-position="right"
- :model="basicData.value"
- >
- <el-form-item label="创建人">
- <el-input
- v-model="basicData.value.createByName"
- size="mini"
- readonly
- ></el-input>
- </el-form-item>
- <el-form-item label="创建时间">
- <el-input
- v-model="basicData.value.createTime"
- size="mini"
- readonly
- ></el-input>
- </el-form-item>
- <el-form-item label="最后修改人">
- <el-input
- v-model="basicData.value.updateByName"
- size="mini"
- readonly
- ></el-input>
- </el-form-item>
- <el-form-item label="最后修改时间">
- <el-input
- v-model="basicData.value.updateTime"
- size="mini"
- readonly
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- </dr-tabs>
- </div>
- </el-card>
- <!-- 维护物料类别弹窗 -->
- <el-dialog
- title="物料类别维护"
- :visible.sync="materialType.show"
- :before-close="handleCloseTypeDetails"
- :close-on-press-escape="false"
- :close-on-click-modal="false"
- width="80%"
- center
- class="materialType"
- >
- <!-- 操作按钮 -->
- <el-row :gutter="10" class="mb10" type="flex" justify="end">
- <el-col :span="1.5">
- <el-button-group>
- <el-button
- :size="size"
- :disabled="!materialType.isEdit"
- @click="handleMaterialTypeRow('add')"
- >增行
- </el-button>
- <el-button
- :size="size"
- :disabled="!materialType.isEdit"
- @click="handleMaterialTypeRow('del')"
- >删行
- </el-button>
- </el-button-group>
- <el-button-group>
- <el-button
- :size="size"
- @click="handleMaterialTypeRow('edit')"
- v-hasPermi="['system:material:add']"
- >{{ materialType.isEdit ? "保存" : "修改" }}
- </el-button>
- <el-button
- :size="size"
- v-if="materialType.isEdit"
- @click="handleMaterialTypeRow('cancal')"
- >取消</el-button
- >
- <el-button :size="size" @click="handleMaterialTypeRow"
- >刷新</el-button
- >
- </el-button-group>
- </el-col>
- </el-row>
- <!-- 表格数据 -->
- <el-table
- border
- :data="materialType.value"
- stripe
- style="width: 100%"
- max-height="350"
- v-loading="materialType.loading"
- :key="refer"
- @selection-change="handleSelectionType"
- >
- <el-table-column type="selection" width="30" />
- <el-table-column type="index" width="50" label="序号" />
- <el-table-column
- v-for="mt in materialType.form"
- v-if="mt.show"
- :label="mt.name"
- width="180"
- >
- <template slot-scope="scope">
- <!-- :prop="mt.prop" -->
- <!-- 多选框 -->
- <el-checkbox
- size="mini"
- v-if="mt.attribute == 'checkbox'"
- :disabled="!(materialType.isEdit && mt.edit)"
- true-label="0"
- false-label="2"
- v-model="scope.row[mt.prop]"
- />
- <!-- 下拉框 / 参照弹窗---- 药品类别编码 scope.row[`${mt.prop}Name`] -->
- <el-select
- size="mini"
- v-else-if="mt.attribute == 'select' && mt.apiUrl"
- placeholder="请选择"
- :disabled="!(materialType.isEdit && mt.edit)"
- v-model="scope.row[mt.prop]"
- :key="scope.row[mt.prop]"
- @focus="
- mt.apiUrl &&
- handleQueryMore(mt, '', {
- name: 'materialType',
- prop: scope.row,
- })
- "
- >
- <div slot="empty"></div>
- </el-select>
- <!-- <el-select size="mini" v-else-if="mt.attribute == 'select' && mt.dictId" placeholder="请选择"
- :disabled="!(materialType.isEdit && mt.edit)" v-model="scope.row[mt.prop]" :key="scope.row[mt.prop]">
- <el-option v-if="mt.dictId" v-for="d in mt.dictId" :key="d.dictValue" :label="d.dictLabel"
- :value="d.dictValue"></el-option></el-select> -->
- <!-- 其他类型 -->
- <el-input
- v-else
- size="mini"
- v-model="scope.row[mt.prop]"
- :readonly="!(materialType.isEdit && mt.edit)"
- />
- </template>
- </el-table-column>
- </el-table>
- </el-dialog>
- <!-- 操作提示弹窗 -->
- <el-dialog
- title="操作提示"
- :visible.sync="optionDialog.show"
- width="30%"
- center
- >
- <span>是否确认{{ optionDialog.op }}?</span>
- <span slot="footer">
- <el-button type="primary" @click="handleComfirmOption('cancal')"
- >确 定</el-button
- >
- <el-button @click="handleOptionCancal">取 消</el-button>
- </span>
- </el-dialog>
- <!-- 其他页签的操作 -->
- <el-dialog
- :title="otherDeatils.title"
- :visible.sync="otherDeatils.show"
- show-close
- width="70%"
- :before-close="handleCloseOtherDetails"
- :close-on-press-escape="false"
- :close-on-click-modal="false"
- class="otherDialog"
- >
- <div v-loading="otherDeatils.loading">
- <!-- 其他标签页操作 修改、删除 -->
- <el-row :gutter="10" class="mb10" type="flex" justify="end">
- <el-col :span="1.5" v-if="!otherDeatils.isEdit">
- <el-button-group>
- <el-button :size="size" @click="handleOtherEdit('form')"
- >修改</el-button
- >
- <!-- <el-button :size="size" @click="handleOtherDel">删除</el-button> -->
- </el-button-group>
- <el-button-group>
- <el-button :size="size" @click="handleOtherRefresh"
- >刷新</el-button
- >
- </el-button-group>
- </el-col>
- <el-col :span="1.5" v-else>
- <el-button-group>
- <el-button :size="size" @click="handleOtherSave">保存</el-button>
- <el-button :size="size" @click="handleOtherCancel"
- >取消</el-button
- >
- </el-button-group>
- </el-col>
- </el-row>
- <el-collapse v-model="collapseActive" @change="handleCollapseChange">
- <el-collapse-item title="物料基本信息" name="basic">
- <el-form
- :inline="true"
- label-position="right"
- :model="basicData.value"
- >
- <el-form-item label="物料编码">
- <el-input
- v-model="basicData.value.code"
- :size="size"
- readonly
- ></el-input>
- </el-form-item>
- <el-form-item label="物料名称">
- <el-input
- v-model="basicData.value.name"
- :size="size"
- readonly
- ></el-input>
- </el-form-item>
- <el-form-item label="英文名称">
- <el-input
- v-model="basicData.value.enName"
- :size="size"
- readonly
- ></el-input>
- </el-form-item>
- </el-form>
- </el-collapse-item>
- <el-collapse-item :title="otherDeatils.title" :name="activeMainTab">
- <div class="od-msg">
- <!-- 展示表单 -->
- <el-form
- :inline="true"
- label-position="right"
- :key="refer"
- :hide-required-asterisk="true"
- :model="otherDeatils.value"
- >
- <el-row :gutter="10">
- <el-col
- :span="8"
- v-for="f in otherDeatils.form"
- style="text-align: right"
- >
- <template v-if="f.show">
- <!-- 多选框 -->
- <el-form-item
- v-if="f.attribute == 'checkbox'"
- style="text-align: left"
- class="od-msg-checkedbx"
- >
- <el-checkbox
- :label="f.name"
- name="type"
- v-model="otherDeatils.value[f.prop]"
- true-label="0"
- false-label="2"
- :disabled="!(otherDeatils.isEdit && f.edit)"
- >
- </el-checkbox>
- </el-form-item>
- <!-- 下拉框 - 弹窗参照 -->
- <el-form-item
- v-else-if="f.attribute == 'select'"
- :label="f.name"
- >
- <el-select
- v-if="f.apiUrl"
- v-model="otherDeatils.value[`${f.prop}Name`]"
- placeholder="请选择"
- :key="otherDeatils.value[f.prop]"
- :disabled="!(otherDeatils.isEdit && f.edit)"
- @focus="
- f.apiUrl &&
- handleQueryMore(f, '', {
- name: 'otherDeatils',
- prop: f.prop,
- })
- "
- >
- <div slot="empty"></div>
- </el-select>
- <!-- 字典-下拉 -->
- <el-select
- v-if="f.dictId"
- v-model="otherDeatils.value[f.prop]"
- placeholder="请选择"
- :key="otherDeatils.value[f.prop]"
- :disabled="!(otherDeatils.isEdit && f.edit)"
- >
- <el-option
- v-if="f.dictId"
- v-for="d in f.dictValue"
- :key="d.dictValue"
- :label="d.dictLabel"
- :value="d.dictValue"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- v-else-if="f.attribute == 'image'"
- :label="f.name"
- >
- <el-image
- :src="otherDeatils.value[f.prop]"
- fit="contain"
- >
- </el-image>
- </el-form-item>
- <!--attribute 文本 数字 文本域 为null -->
- <el-form-item v-else :label="f.name">
- <el-input
- :size="size"
- v-model="otherDeatils.value[f.prop]"
- :type="f.attribute || 'text'"
- :readonly="!(otherDeatils.isEdit && f.edit)"
- >
- </el-input>
- </el-form-item>
- </template>
- </el-col>
- </el-row>
- </el-form>
- </div>
- </el-collapse-item>
- <el-collapse-item title="审计信息" name="auditInfo">
- <!-- 基本信息 - 审计信息 -->
- <div class="md-auditInfo">
- <el-form
- :inline="true"
- label-position="right"
- :model="basicData.value"
- >
- <el-form-item label="创建人">
- <el-input
- v-model="basicData.value.createByName"
- :size="size"
- readonly
- ></el-input>
- </el-form-item>
- <el-form-item label="创建时间">
- <el-input
- v-model="basicData.value.createTime"
- :size="size"
- readonly
- ></el-input>
- </el-form-item>
- <el-form-item label="最后修改人">
- <el-input
- v-model="basicData.value.updateByName"
- :size="size"
- readonly
- ></el-input>
- </el-form-item>
- <el-form-item label="最后修改时间">
- <el-input
- v-model="basicData.value.updateTime"
- :size="size"
- readonly
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
- </el-collapse-item>
- </el-collapse>
- </div>
- </el-dialog>
- <!-- 参照弹窗 -->
- <el-dialog
- :title="MoreDataDialog.msg.name"
- :visible.sync="MoreDataDialog.show"
- width="70%"
- class="MoreDataDialog"
- :close-on-press-escape="false"
- :close-on-click-modal="false"
- :before-close="handleCloseRefer"
- >
- <div>
- <el-row :gutter="20">
- <el-col :span="6">
- <el-input
- v-model="MoreDataDialog.key"
- placeholder="过滤"
- :size="size"
- clearable
- @clear="handleClear"
- @keyup.enter.native="handleFilterRefer"
- />
- </el-col>
- <el-col :span="6">
- <el-button
- type="primary"
- :size="size"
- @click.stop="handleFilterRefer"
- >搜索</el-button
- >
- </el-col>
- </el-row>
- <!-- 树形 -->
- <el-tree
- v-if="MoreDataDialog.type == 'tree'"
- v-loading="MoreDataDialog.loading"
- :key="refer"
- node-key="id"
- class="referTree"
- :data="MoreDataDialog.list"
- @node-click="handleNodeClick"
- :props="
- MoreDataDialog.msg.apiUrl == 'queryMedcineItemDrug' ||
- MoreDataDialog.msg.apiUrl == 'queryMaterialClassify'
- ? drugProps
- : defaultProps
- "
- >
- </el-tree>
- <!-- queryMedcineItemDrug -->
- <!-- 列表 -->
- <div v-else>
- <el-table
- :data="MoreDataDialog.list"
- v-loading="MoreDataDialog.loading"
- style="width: 100%"
- @row-click="handleCurentRow"
- @row-dblclick="handleDbClick"
- highlight-current-row
- >
- <el-table-column
- type="index"
- label="序号"
- width="55"
- align="center"
- />
- <el-table-column
- v-for="m in MoreDataDialog.form"
- v-if="m.show"
- :prop="m.prop"
- :label="m.name"
- />
- </el-table>
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="queryParams.pageNum"
- :page-sizes="[10, 20, 50, 100]"
- layout="total, sizes, prev, pager, next, jumper"
- :total="queryParams.total"
- >
- </el-pagination>
- </div>
- <!-- 按钮 -->
- <el-row class="more-button">
- <el-button
- round
- :size="size"
- type="primary"
- @click="handleConfirmRefer"
- >确认</el-button
- >
- <el-button round :size="size" @click="handleConcalRefer"
- >取消</el-button
- >
- </el-row>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import drTabs from "../components/dr-tabs.vue";
- import detailsTabs from "../config/detailsTabs";
- import materialApi from "@/api/material/basic";
- import { getDicts as getDicts } from "@/api/system/dict/data";
- import arrayUtils from "../tools/arrayUtils";
- import { initRules, initParams } from "./init/index";
- import { getDetail } from "@/api/classify/basic";
- export default {
- name: "material-details",
- // dicts: [],
- components: {
- drTabs,
- },
- data() {
- return {
- size: "mini",
- count: 1,
- refer: 1,
- loading: false,
- rules: {},
- medcineRules: {},
- // 维护新版本
- maintainNewVersion: false,
- // 详情固定标签页
- detailsTabs,
- defaultProps: {
- children: "childrens",
- label: "name",
- },
- drugProps: {
- children: "childrens",
- label: function (data, node) {
- return data.code + " " + data.name;
- },
- // 'name'
- },
- // 标签页当前激活状态
- activeMainTab: "material",
- activeViceTab: "material_medcine",
- materialId: this.$route.params.id,
- collapseActive: ["basic", ""],
- // 修改按钮 是否激活
- updateButtonGroup: false,
- // 基本信息下的页签
- basicMessage: [
- {
- label: "医药行业",
- code: "material_medcine",
- isShow: true,
- },
- {
- label: "辅计量管理",
- code: "material_unit",
- isShow: true,
- },
- {
- label: "辅助属性",
- code: "material_property",
- isShow: true,
- },
- ],
- // 基本信息
- basicData: {
- value: {},
- form: [],
- },
- // 物料类别
- materialType: {
- show: false,
- value: [],
- form: [],
- loading: false,
- checkedList: [],
- isEdit: false,
- },
- // 医药行业
- medcineData: {
- value: {},
- form: [],
- },
- // 辅助属性
- propertyDetail: {
- value: [],
- form: [],
- },
- // 辅计量管理
- unitDetails: {
- value: [],
- form: [],
- },
- // 主标签信息
- mainMsg: {
- form: [],
- value: [],
- checkedList: [],
- },
- // 副信息
- viceMsg: {
- form: [],
- value: [],
- },
- // 操作弹窗
- optionDialog: {
- show: false,
- op: "",
- },
- // 其他页签操作弹窗
- otherDeatils: {
- loading: false,
- show: false,
- title: "",
- // 查询关键字-物料id
- queryKey: "",
- isEdit: false,
- // 详情表头
- from: [],
- // 详情值
- value: {},
- },
- // 编辑-更多数据展示弹窗_ 参照
- MoreDataDialog: {
- loading: false,
- show: false,
- // 查询关键字
- key: "",
- // 需要查看参照的表单头信息
- msg: "",
- type: "table",
- // 查询出的参照数据
- list: [],
- // 查询出的参照表头
- form: [],
- // 选中的参照数据
- value: "",
- // 参照最后应该赋值的地方
- target: {
- name: "",
- prop: "",
- },
- },
- // 参照分页参数
- queryParams: {
- pageNum: 1,
- total: 0,
- pageSize: 10,
- },
- };
- },
- methods: {
- judgeMaxLength(prop) {
- // 规格
- if (prop === "specification") {
- return 150;
- }
- return Infinity;
- },
- // 判断效期管理
- handleJudge(attribute) {
- // 维护新版本才能修改:批号及库存状态管理(isInventoryStatus)、
- if (attribute.prop == "isInventoryStatus") {
- return !(this.maintainNewVersion && attribute.edit);
- }
- // 序列号管理(serialNoManager):维护新版本 && 批号及库存状态管理
- else if (attribute.prop == "serialNoManager") {
- if (this.basicData.value["isInventoryStatus"] == "2")
- this.basicData.value["serialNoManager"] = "2";
- return !(
- this.maintainNewVersion &&
- attribute.edit &&
- this.basicData.value["isInventoryStatus"] == "0"
- );
- }
- // 批号及库存状态管理(isInventoryStatus) 控制 效期管理是否展示(expiryDateManagerment)
- else if (attribute.prop == "expiryDateManagerment") {
- if (this.basicData.value["isInventoryStatus"] == "2")
- this.basicData.value["expiryDateManagerment"] = "2";
- return !(
- this.updateButtonGroup &&
- attribute.edit &&
- this.basicData.value["isInventoryStatus"] == "0"
- );
- }
- // 效期管理(expiryDateManagerment):控制一下几个是否可编辑
- // expiryUnitId 效期单位 usefulLife 有效期 usefulLifeUnitId 有效期至单位
- else if (
- attribute.prop == "expiryUnitId" ||
- attribute.prop == "usefulLife" ||
- attribute.prop == "usefulLifeUnitId" ||
- attribute.prop == "recentWarningPeriod"
- ) {
- if (this.basicData.value["expiryDateManagerment"] == "2") {
- this.basicData.value["expiryUnitId"] = "";
- this.basicData.value["usefulLife"] = "";
- this.basicData.value["usefulLifeUnitId"] = "";
- this.basicData.value["recentWarningPeriod"] = "";
- }
- return !(
- this.updateButtonGroup &&
- attribute.edit &&
- this.basicData.value["expiryDateManagerment"] == "0"
- );
- }
- // 默认采购组织:purchasingOrganization 业务部门:businessDepartment
- else if (attribute.prop == "businessDepartment") {
- return !(
- this.updateButtonGroup &&
- attribute.edit &&
- this.basicData.value["purchasingOrganization"]
- );
- } else {
- // 其他属性是否可编辑
- return !(this.updateButtonGroup && attribute.edit);
- }
- },
- // 返回
- handleBack() {
- this.$store.dispatch("tagsView/delView", this.$route);
- this.$router.go(-1);
- // this.$router.push({
- // path: `/basic/material/basicFile`,
- // });
- },
- // 附件按钮
- handleFile() {
- console.log("附件按钮");
- },
- // 改变分页情况
- handleChangePage(type) {
- switch (type) {
- case "first":
- console.log("第一页");
- break;
- case "pre":
- console.log("上一页");
- break;
- case "next":
- console.log("下一页");
- break;
- case "end":
- console.log("最后页");
- break;
- }
- },
- // 切换主信息标签
- handleMainTabClick(e) {
- this.activeMainTab = detailsTabs[e.index].code;
- this.collapseActive.splice(1, 1, this.activeMainTab);
- console.log(this.collapseActive, "this.collapseActive");
- this.handleOtherListRefresh();
- },
- // 切换副表信息
- handleViceTabClick(e) {
- // console.log(this.basicMessage[e.index], '切换标签');
- this.activeViceTab = this.basicMessage[e.index].code;
- switch (this.activeViceTab) {
- // 医药行业
- case "material_medcine":
- this.getTagList("material_medcine", (form) => {
- this.medcineData.form = [...form];
- this.medcineData.value = initParams(this.medcineData.form, "prop");
- this.medcineRules = initRules(form);
- this.getMedcineDetails(this.materialId, "material_medcine");
- });
- break;
- // 辅计量管理
- case "material_unit":
- this.getTagList("material_unit", (form) => {
- console.log(form, "form");
- this.unitDetails.form = form;
- this.getUnitList(this.materialId);
- });
- break;
- // 辅助属性
- case "material_property":
- this.getTagList("material_property", (form) => {
- this.propertyDetail.form = form;
- this.getPropertyList(this.materialId);
- });
- break;
- default:
- break;
- }
- },
- // 主标签页 列表双击
- handleMaindbClick(e) {
- this.otherDeatils.queryKey = e.id;
- this.otherDeatils.show = true;
- let activeTab = this.detailsTabs.filter(
- (item) => item.code == this.activeMainTab
- )[0];
- console.log(activeTab, "activeTab");
- this.otherDeatils.title = activeTab.label;
- this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
- },
- // 主页签 列表数据选择
- handleMainChange(e) {
- this.mainMsg.checkedList = e;
- },
- // 上传图片
- handleUpImage() {},
- // 编辑状态下,参照弹窗显示查询数据
- handleQueryMore(msg, val, target) {
- this.MoreDataDialog.loading = true;
- let _this = this;
- console.log("编辑状态下,弹窗显示查询数据", msg, "val", val, target);
- this.MoreDataDialog.show = true;
- this.MoreDataDialog.msg = msg;
- this.MoreDataDialog.target = target;
- let par = { param: this.MoreDataDialog.key };
- this[target.name].form.map((t) => {
- if (t.relevance && t.relevance != "") {
- let reList = t.relevance.split(",");
- console.log(reList, "reList-------------------");
- reList.forEach((i) => {
- par[i] = this.basicData.value[i];
- });
- console.log(par, "par/////////////////////////");
- }
- });
- this.getExecuteMethods(msg.apiUrl, par, (data) => {
- _this.MoreDataDialog.type = data.type;
- if (data.type == "tree") {
- _this.MoreDataDialog.list = arrayUtils.filterTreeData(data.tableBody);
- } else {
- _this.MoreDataDialog.list = data.tableBody;
- _this.MoreDataDialog.form = data.tableHeader;
- }
- this.refer++;
- // this.count++;
- });
- },
- // 参照改变分页大小
- handleSizeChange(e) {
- this.queryParams.pageSize = e;
- this.handleQueryMore(
- this.MoreDataDialog.msg,
- this.MoreDataDialog.key,
- this.MoreDataDialog.target
- );
- },
- // 参照改变当前页
- handleCurrentChange(e) {
- this.queryParams.pageNum = e;
- this.handleQueryMore(
- this.MoreDataDialog.msg,
- this.MoreDataDialog.key,
- this.MoreDataDialog.target
- );
- },
- // 根据apiUrl获取对应参照的值
- getExecuteMethods(methodName, param, cb) {
- let page = {
- pageSize: this.queryParams.pageSize,
- pageNum: this.queryParams.pageNum,
- };
- let params = { ...param };
- // 业务部门需要 依据默认采购组组织查询
- if (methodName == "queryOperatingDepptTree") {
- params["puOrgId"] = this.basicData.value["purchasingOrganization"];
- }
- materialApi.executeMethods(methodName, params, page).then((res) => {
- this.MoreDataDialog.loading = false;
- if (res.code == 200) {
- this.queryParams.total = res.data.total;
- cb(res.data);
- }
- });
- },
- // 获取物料基本信息详细信息
- async getMaterialDetails(id, templateCode) {
- let _this = this;
- await materialApi.materialDetails(id, templateCode).then((res) => {
- this.loading = false;
- console.log(res, "物料基本信息");
- let { code, data } = res;
- if (code == 200) {
- _this.basicData.value = { ..._this.basicData.value, ...data.data };
- for (const key in data.data) {
- _this.basicData.value[key] =
- typeof data.data[key] === "number"
- ? String(data.data[key])
- : data.data[key];
- }
- // _this.handleAddReferLabel('basicData');
- this.count++;
- }
- });
- },
- // 添加参照中的label
- // handleAddReferLabel(dataName) {
- // let _this = this;
- // this[dataName].form.map(item => {
- // // 查参照
- // if (item.apiUrl && item.apiUrl != '') {
- // let param = {};
- // if (item.relevance && item.relevance != '') {
- // let reList = item.relevance.split(',');
- // console.log(reList, 'reList-------------------');
- // reList.forEach(i => {
- // param[i] = this.basicData.value[i]
- // })
- // console.log(param, 'param/////////////////////////');
- // }
- // _this.getExecuteMethods(item.apiUrl, param, (data) => {
- // let { tableBody } = data;
- // // 维护物料类别 --- 属于列表中获取label
- // if (dataName == 'materialType') {
- // _this[dataName].value.length && (_this[dataName].value = _this[dataName].value.map(d => {
- // let Blabel = tableBody.filter((t) => t.id == d[item.prop])[0];
- // console.log(Blabel, 'Blabel``````````````````````````');
- // d[`${item.prop}Label`] = (Blabel && Blabel.name) || Blabel || '';
- // return d;
- // }))
- // } else {
- // let Blabel = tableBody.filter((t) => t.id == _this[dataName].value[item.prop])[0];
- // console.log(Blabel, 'Blabel``````````````````````````');
- // _this[dataName].value[`${item.prop}Label`] = (Blabel && Blabel.name) || Blabel || '';
- // }
- // // this.count++;
- // this.loading = false;
- // console.log(_this[dataName].value, `${dataName}//////////////////////`);
- // })
- // }
- // })
- // this.materialType.loading = false;
- // },
- // 查询财务信息列表
- async getFinanceList(materialId) {
- try {
- this.loading = true;
- let { code, data } = await materialApi.financeList({ materialId });
- if (code == 200) {
- this.mainMsg.value = data.tableBody.rows;
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- // 查询计划信息列表
- async getPlanList(materialId) {
- try {
- this.loading = true;
- let { code, data } = await materialApi.planList({ materialId });
- if (code == 200) {
- this.mainMsg.value = data.tableBody.rows;
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- // 查询成本信息列表
- async getCostList(materialId) {
- try {
- this.loading = true;
- let { code, data } = await materialApi.costList({ materialId });
- if (code == 200) {
- this.mainMsg.value = data.tableBody.rows;
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- // 查询利润中心列表
- async getCenterList(materialId) {
- try {
- this.loading = true;
- let { code, data } = await materialApi.centerList({ materialId });
- if (code == 200) {
- this.mainMsg.value = data.tableBody.rows;
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- // 查询采购中心列表
- async getPurchaseList(materialId) {
- try {
- this.loading = true;
- let { code, data } = await materialApi.purchaseList({ materialId });
- if (code == 200) {
- this.mainMsg.value = data.tableBody.rows;
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- // 获取库存信息列表
- async getInventoryList(materialId) {
- try {
- this.loading = true;
- let { code, data } = await materialApi.inventoryList({ materialId });
- if (code == 200) {
- this.mainMsg.value = data.tableBody.rows;
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- // 查询其他标签页列表详情
- getOtherListDetails(type, id) {
- console.log(type, id, "查询其他标签页列表详情");
- this.otherDeatils.form = this.mainMsg.form;
- console.log(this.otherDeatils.form, "this.otherDeatils.form");
- switch (type) {
- // 财物信息
- case "material_finance":
- this.getFinanceDetails(id);
- break;
- // 利润中心信息
- case "profit_center":
- this.getCenterDetails(id);
- break;
- // 采购信息
- case "material_purchase":
- this.getPurchaseDetails(id);
- break;
- // 库存信息
- case "material_inventory":
- this.getInventoryDetails(id);
- break;
- // 计划信息
- case "material_plan":
- this.getPlanDetails(id);
- break;
- // 成本信息
- case "material_cost":
- this.getCostDetails(id);
- break;
- default:
- break;
- }
- },
- // 查询财务信息详情
- async getFinanceDetails(id) {
- try {
- this.otherDeatils.loading = true;
- let { code, data } = await materialApi.financeDetails(id);
- if (code == 200) {
- this.otherDeatils.value = data.data;
- }
- } catch (error) {
- } finally {
- setTimeout(() => {
- this.otherDeatils.loading = false;
- }, 200);
- }
- },
- // 获取利润中心详情
- async getCenterDetails(id) {
- try {
- this.otherDeatils.loading = true;
- let { code, data } = await materialApi.centerDetails(id);
- if (code == 200) {
- this.otherDeatils.value = data.data;
- }
- } catch (error) {
- } finally {
- setTimeout(() => {
- this.otherDeatils.loading = false;
- }, 200);
- }
- },
- // 获取采购详细信息详情
- async getPurchaseDetails(id) {
- try {
- this.otherDeatils.loading = true;
- let { code, data } = await materialApi.purchaseDetails(id);
- if (code == 200) {
- this.otherDeatils.value = data.data;
- }
- } catch (error) {
- } finally {
- setTimeout(() => {
- this.otherDeatils.loading = false;
- }, 200);
- }
- },
- // 获取成本信息详情
- async getCostDetails(id) {
- try {
- this.otherDeatils.loading = true;
- let { code, data } = await materialApi.costDetails(id);
- if (code == 200) {
- this.otherDeatils.value = data.data;
- }
- } catch (error) {
- } finally {
- setTimeout(() => {
- this.otherDeatils.loading = false;
- }, 200);
- }
- },
- // 获取计划信息详情
- async getPlanDetails(id) {
- try {
- this.otherDeatils.loading = true;
- let { code, data } = await materialApi.planDetails(id);
- if (code == 200) {
- this.otherDeatils.value = data.data;
- }
- } catch (error) {
- } finally {
- setTimeout(() => {
- this.otherDeatils.loading = false;
- }, 200);
- }
- },
- //
- async getInventoryDetails(id) {
- try {
- this.otherDeatils.loading = true;
- let { code, data } = await materialApi.inventoryDetails(id);
- if (code == 200) {
- this.otherDeatils.value = data.data;
- }
- } catch (error) {
- } finally {
- setTimeout(() => {
- this.otherDeatils.loading = false;
- }, 200);
- }
- },
- /* 二级标签页 */
- // 根据物料id获取医药行业信息详细信息
- async getMedcineDetails(id) {
- let _this = this;
- console.log(id);
- await materialApi.medcineDetailsInfo(id).then((res) => {
- this.loading = false;
- console.log(res, "医药行业");
- let { code, data } = res;
- if (code == 200) {
- _this.medcineData.value = data.data || {};
- // this.medcineData.form = data.form;
- // _this.handleAddReferLabel('medcineData');
- console.log(" _this.medcineData", _this.medcineData, res);
- this.count++;
- }
- });
- },
- // 获取物料辅助属性详细信息+表单列段属性
- getPropertyDetails(id) {
- materialApi.propertyDetails(id).then((res) => {
- console.log(res, "物料辅助属性详细信息");
- if (res.code == 200) {
- this.propertyDetail.value = res.data.data || [];
- }
- });
- },
- // 查询物料辅助属性列表+表头字段
- getPropertyList(materialId) {
- materialApi.propertyList({ materialId }).then((res) => {
- console.log(res, "料辅助属性列表");
- if (res.code == 200) {
- this.propertyDetail.value = res.data.data || [];
- }
- });
- },
- //获取辅助计量单位基本信息+表单列段属性
- getUnitDetails(materialId) {
- materialApi.unitDetails(materialId).then((res) => {
- console.log(res, "辅助计量单位基本信息");
- if (res.code == 200) {
- this.unitDetails.value = res.data.tableBody.rows || [];
- }
- });
- },
- //获取辅计量管理列表信息
- getUnitList(materialId) {
- materialApi.unitList({ materialId }).then((res) => {
- console.log(res, "辅计量管理列表信息");
- if (res.code == 200) {
- this.unitDetails.value = res.data.tableBody.rows || [];
- }
- });
- },
- // 获取物料列表表头
- async getTagList(templateCode, cb) {
- let _this = this;
- await materialApi.tagList({ templateCode }).then(async (res) => {
- console.log(res, `获取${templateCode}表头`);
- let dictIdList = [];
- if (res.code == 200) {
- res.data.map(async (item) => {
- // 查字典
- if (item.dictId && item.dictId != "") {
- // 通过接口获取有dict的对应的数据
- await getDicts(item.dictId).then((dict) => {
- if (dict.data) {
- item["dictValue"] = dict.data;
- }
- });
- }
- });
- return cb(res.data);
- // 动态更改dict
- // res.data.forEach(item => {
- // if (item.dictId) {
- // // 请求接口
- // dictIdList.push(item.dictId);
- // }
- // })
- // console.log(dictIdList, 'dictIdList');
- // _this.dict = [..._this.dict, ...dictIdList];
- // _this.dict = Array.from(new Set([..._this.dict, ...dictIdList]));
- // console.log(_this.dict, 'dicts');
- // return cb(res.data);
- }
- });
- },
- // 根据物料id获取物料类别维护列表
- getMedcineitemList(materialId) {
- let _this = this;
- materialApi.medcineitemList({ materialId }).then((res) => {
- this.materialType.loading = false;
- console.log(res, "根据物料id获取物料类别维护列表");
- if (res.code == 200) {
- _this.materialType.value = res.data.tableBody.rows;
- // _this.handleAddReferLabel('materialType');
- }
- });
- },
- // 新增
- handleInster() {
- this.$notify({
- title: "警告",
- message: "物料只能通过申请审批增加,不能在节点直接录入!",
- type: "warning",
- });
- },
- // 除基本信息之后的修改
- handleOtherEdit(type) {
- // debugger
- console.log("除基本信息之后的修改", type);
- if ("table" === type) {
- if (this.mainMsg.checkedList.length == 1) {
- this.otherDeatils.show = true;
- this.otherDeatils.isEdit = true;
- let activeTab = this.detailsTabs.filter(
- (item) => item.code == this.activeMainTab
- )[0];
- this.otherDeatils.title = activeTab.label;
- this.otherDeatils.queryKey = this.mainMsg.checkedList[0].id;
- console.log(this.otherDeatils, "this.otherDeatils");
- // 查询其他标签页列表详情
- this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
- } else {
- this.$notify({
- title: "警告",
- message: "修改请选择单个数据!",
- type: "warning",
- });
- }
- } else if ("form" === type) {
- if (this.otherDeatils.queryKey) {
- this.otherDeatils.show = true;
- this.otherDeatils.isEdit = true;
- let activeTab = this.detailsTabs.filter(
- (item) => item.code == this.activeMainTab
- )[0];
- this.otherDeatils.title = activeTab.label;
- // 查询其他标签页列表详情
- this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
- }
- }
- },
- // 其他标签详情弹窗-刷新
- handleOtherRefresh() {
- this.getOtherListDetails(this.activeMainTab, this.otherDeatils.queryKey);
- },
- // 其他标签详情弹窗-删除
- handleOtherDel() {
- let ids = this.mainMsg.checkedList.map((i) => i.id);
- console.log(`${this.activeMainTab}其他标签详情弹窗-删除---id合集`, ids);
- if (ids.length) {
- switch (this.activeMainTab) {
- // 财物信息
- case "material_finance":
- this.handleDelFinance(ids);
- break;
- // 利润中心信息
- case "profit_center":
- this.handledDelCenter(ids);
- break;
- // 采购信息
- case "material_purchase":
- this.handledelPurchase(ids);
- break;
- // 库存信息
- case "material_inventory":
- this.handleDelInventory(ids);
- break;
- // 计划信息
- case "material_plan":
- this.handleDelPlan(ids);
- break;
- // 成本信息
- case "material_cost":
- this.handleDelCost(ids);
- default:
- break;
- }
- } else {
- this.$notify({
- title: "警告",
- message: "请选择需要删除的数据!",
- type: "warning",
- });
- }
- },
- // 其他标签页刷新
- async handleOtherListRefresh() {
- switch (this.activeMainTab) {
- // 基本信息
- case "material":
- await this.getTagList("material", async (form) => {
- // this.basicData.form = [...form];
- this.basicData.form = [...form];
- this.rules = initRules(form);
- this.basicData.value = initParams(this.basicData.form, "prop");
- await this.getMaterialDetails(this.materialId, "material");
- });
- break;
- // 财物信息
- case "material_finance":
- await this.getTagList("material_finance", async (form) => {
- this.mainMsg.form = [...form];
- await this.getFinanceList(this.materialId);
- });
- break;
- // 利润中心信息
- case "profit_center":
- await this.getTagList("profit_center", async (form) => {
- this.mainMsg.form = [...form];
- await this.getCenterList(this.materialId);
- });
- break;
- // 采购信息
- case "material_purchase":
- await this.getTagList("material_purchase", async (form) => {
- this.mainMsg.form = [...form];
- await this.getPurchaseList(this.materialId);
- });
- break;
- // 库存信息
- case "material_inventory":
- await this.getTagList("material_inventory", async (form) => {
- this.mainMsg.form = [...form];
- await this.getInventoryList(this.materialId);
- });
- break;
- // 计划信息
- case "material_plan":
- await this.getTagList("material_plan", async (form) => {
- this.mainMsg.form = [...form];
- await this.getPlanList(this.materialId);
- });
- break;
- // 成本信息
- case "material_cost":
- await this.getTagList("material_cost", async (form) => {
- this.mainMsg.form = [...form];
- await this.getCostList(this.materialId);
- });
- break;
- default:
- break;
- }
- },
- // 修改
- handleBasicEdit() {
- console.log("修改基本信息");
- this.updateButtonGroup = true;
- // this.count++;
- //需要禁止点击其他标签
- // this.detailsTabs = this.detailsTabs.map(item => {
- // item['disabled'] = true;
- // return item
- // })
- console.log(this.detailsTabs, "this.detailsTabs ");
- },
- // 删除
- handleDel() {
- console.log("删除----基本信息");
- },
- // 复制
- handleCopy() {
- console.log("复制");
- },
- //查询
- handleQuery() {},
- // 刷新
- handleRefresh() {
- console.log("刷新");
- this.$refs.basicMessageRef.clearValidate();
- this.$refs.medcineRef.clearValidate();
- this.handleRest();
- },
- // 过滤
- handleFilter(e) {
- console.log(e, "过滤");
- },
- filterCondition(type) {
- return {
- type,
- };
- },
- // 维护物料类别
- handleMaterialType() {
- console.log("维护物料类别");
- this.materialType.show = true;
- this.materialType.loading = true;
- this.getTagList("material_medcine_item", (form) => {
- this.materialType.form = form;
- this.getMedcineitemList(this.materialId);
- });
- },
- // 启用
- handleIsInvoke(e) {
- console.log("启用", this.basicData.value.isEnable);
- let param = {
- isEnable: this.basicData.value.isEnable == "已启用" ? "2" : "0",
- id: this.basicData.value.id,
- };
- console.log(param, "启用/停用param");
- materialApi.updateEnableMaterial(param).then((res) => {
- console.log(res, "启用/停用");
- if (res.code == 200) this.handleRefresh();
- });
- },
- // 维护新版本
- handleNewVersion() {
- let _this = this;
- let data = {
- // 物料编码
- code: this.basicData.value.code,
- };
- materialApi.versions(data).then((res) => {
- console.log(res, "维护新版本");
- if (res.code == 200) {
- _this.maintainNewVersion = res.data.result;
- // 维护版本消息展示 by shiy 2023/05/31
- if (!res.data.result) {
- this.$notify({
- title: "警告",
- message: res.data.msg,
- type: "warning",
- });
- }
- }
- });
- },
- // 维护物料保存
- handleSaveNewVersion(cb) {
- let data = {
- // 物料编码
- materialCode: this.basicData.value.code,
- //序列号管理; 2= 否,0= 是
- serialNoManager: this.basicData.value.serialNoManager,
- // 批号及库存状态管理;2=否,0=是
- isInventoryStatus: this.basicData.value.isInventoryStatus,
- };
- materialApi
- .saveVersions(data)
- .then((res) => {
- console.log(res, "维护物料保存");
- if (res.code == 200) {
- cb();
- }
- })
- .catch((error) => {
- this.loading = false;
- });
- },
- // 取消保存
- handleCancel() {
- console.log("取消保存");
- this.optionDialog.op = "取消";
- this.optionDialog.show = true;
- },
- // 保存修改
- handleSave() {
- console.log("保存修改");
- // this.$refs['basicMessageRef'].validate(async (valid) => {
- // if (valid) {
- this.loading = true;
- // 普通保存修改
- this.updateButtonGroup &&
- this.handleSaveMaterial(() => {
- this.updateButtonGroup = false;
- this.handleRefresh();
- });
- // 维护新版本保存修改
- this.maintainNewVersion &&
- this.handleSaveNewVersion(() => {
- this.maintainNewVersion = false;
- this.handleRefresh();
- });
- // } else {
- // this.$notify.error({
- // title: '错误',
- // message: '存在必填项未填写!'
- // });
- // console.log('error submit!!');
- // return false;
- // }
- // })
- },
- // 物料类别列表选中
- handleSelectionType(list) {
- console.log("物料类别列表选中", list);
- this.materialType.checkedList = list;
- },
- // 物料类别增删行
- handleMaterialTypeRow(op) {
- let _this = this;
- switch (op) {
- // 增行
- case "add":
- let rowObj = {};
- for (const key in _this.materialType.value[0]) {
- if (Object.hasOwnProperty.call(_this.materialType.value[0], key)) {
- rowObj[key] = "";
- }
- }
- rowObj["insertId"] = new Date().getTime();
- this.materialType.value.push(rowObj);
- console.log(this.materialType.value, "物料类别增行rowObj后");
- break;
- // 删行
- case "del":
- console.log("物料类别删行", _this.materialType.checkedList);
- if (_this.materialType.checkedList.length) {
- _this.materialType.checkedList.map((c) => {
- _this.materialType.value = _this.materialType.value.filter(
- (m) => {
- if (m.id && m.id != "" && m.id != c.id) {
- return m;
- } else if (
- m.insertId &&
- m.insertId != "" &&
- m.insertId != c.insertId
- ) {
- return m;
- }
- }
- );
- });
- } else {
- this.$notify({
- title: "警告",
- message: "请选择需要删除的信息!",
- type: "warning",
- });
- }
- break;
- // 取消
- case "cancal":
- this.materialType.isEdit = false;
- this.handleMaterialTypeRow();
- break;
- // 保存、修改
- case "edit":
- if (_this.materialType.isEdit) {
- // 编辑状态
- let nullList = _this.materialType.value.filter(
- (m) => !m.drugId || m.drugId == ""
- );
- console.log(nullList, "nullList");
- if (!nullList.length && _this.materialType.value.length) {
- console.log("物料类别保存", _this.materialType.value);
- let params = {
- materialId: _this.materialId,
- medcineItems: _this.materialType.value,
- };
- materialApi.medcineitemBatchSave(params).then((res) => {
- console.log(res, "保存物料类型");
- if (res.code == 200) {
- _this.materialType.isEdit = false;
- _this.handleMaterialTypeRow();
- }
- });
- // 保存
- } else {
- this.$notify({
- title: "警告",
- message: "不能保存空数据或存在数据为空!",
- type: "warning",
- });
- }
- } else {
- // 非编辑状态
- console.log("物料类别修改");
- this.materialType.isEdit = true;
- }
- break;
- // 刷新
- default:
- console.log("物料类别刷新");
- if (this.materialType.isEdit) {
- this.$notify({
- title: "警告",
- message: "请先保存数据!",
- type: "warning",
- });
- } else {
- this.materialType.loading = true;
- this.getTagList("material_medcine_item", (form) => {
- this.materialType.form = form;
- this.getMedcineitemList(this.materialId);
- });
- }
- break;
- }
- },
- // 物料类别弹窗关闭前
- handleCloseTypeDetails(done) {
- console.log("物料类别弹窗关闭前");
- this.materialType.isEdit
- ? this.$notify({
- title: "警告",
- message: "请先保存数据!",
- type: "warning",
- })
- : done();
- },
- // 保存修改并新增
- handleSaveAdd() {
- console.log("保存修改并新增");
- },
- // 其他标签页弹窗取消操作
- handleOtherCancel() {
- console.log("其他标签页弹窗取消操作");
- this.optionDialog.show = true;
- this.optionDialog.op = "修改";
- },
- // 其他标签页弹窗保存
- async handleOtherSave() {
- console.log("其他标签页弹窗保存", this.activeMainTab);
- let data = this.otherDeatils.value;
- console.log(data, "params");
- switch (this.activeMainTab) {
- // 财物信息
- case "material_finance":
- await this.handleSaveFinance(data);
- break;
- // 利润中心信息
- case "profit_center":
- await this.handleSaveCenter(data);
- break;
- // 采购信息
- case "material_purchase":
- await this.handleSavePurchase(data);
- break;
- // 库存信息
- case "material_inventory":
- await this.handleSaveInventoryEdit(data);
- break;
- // 计划信息
- case "material_plan":
- await this.handleSavePlan(data);
- break;
- // 成本信息
- case "material_cost":
- await this.handleSaveCost(data);
- break;
- default:
- break;
- }
- // this.handleOtherRefresh();
- },
- // 其他页签详情弹窗关闭事件
- handleCloseOtherDetails(done) {
- console.log("其他页签详情弹窗关闭事件");
- // 处于编辑状态
- if (this.otherDeatils.isEdit) {
- this.$notify({
- title: "警告",
- message: "请先退出编辑操作",
- type: "warning",
- });
- } else {
- this.handleOtherListRefresh();
- done();
- }
- },
- // 折叠菜单改变
- handleCollapseChange(val) {
- console.log(val, "折叠菜单改变");
- },
- // 更新导入
- handleUpdateImport() {
- console.log("更新导入");
- },
- // 确认弹窗操作
- async handleComfirmOption() {
- console.log("确认弹窗操作");
- this.optionDialog.show = false;
- // 取消基本信息修改
- if (this.updateButtonGroup) {
- this.updateButtonGroup = false;
- // this.handleRest();
- await this.getMaterialDetails(this.materialId, "material");
- await this.getMedcineDetails(this.materialId, "material_medcine");
- this.$refs.basicMessageRef.clearValidate();
- this.$refs.medcineRef.clearValidate();
- }
- // 取消其他主页签详情弹窗修改
- if (this.otherDeatils.isEdit) {
- this.otherDeatils.isEdit = false;
- this.handleOtherRefresh();
- }
- // 取消维护新版本修改
- if (this.maintainNewVersion) {
- console.log("取消维护新版本修改");
- this.maintainNewVersion = false;
- this.handleRefresh();
- }
- },
- handleClear() {
- this.MoreDataDialog.key = "";
- this.handleFilterRefer();
- },
- // 参照弹窗过滤
- handleFilterRefer() {
- // this.MoreDataDialog.key =
- console.log(
- this.MoreDataDialog.key,
- "查询关键字",
- this.MoreDataDialog.target
- );
- this.handleQueryMore(
- this.MoreDataDialog.msg,
- this.MoreDataDialog.key,
- this.MoreDataDialog.target
- );
- },
- // 操作提示弹窗关闭
- handleOptionCancal() {
- this.optionDialog.show = false;
- this.otherDeatils.isEdit = true;
- },
- // 树形节点选择
- handleNodeClick(e) {
- console.log(e, "树形节点选择", this.MoreDataDialog.target);
- // let node = { ...e, name: e.label }
- this.MoreDataDialog.value = e;
- },
- // 修改-更多数据表格——选择行
- handleCurentRow(row) {
- console.log(row, "修改-更多数据表格——选择行");
- this.MoreDataDialog.value = row;
- },
- handleDbClick(row) {
- this.MoreDataDialog.value = row;
- this.handleConfirmRefer();
- },
- // 参照弹窗确认
- handleConfirmRefer() {
- let _this = this;
- console.log(
- "确认参照弹窗",
- `{this.${this.MoreDataDialog.target.name}:${this.MoreDataDialog.value.id}}`
- );
- let confirm = true;
- if (this.MoreDataDialog.target.name == "basicData") {
- // 基本信息
- this.basicData.value[this.MoreDataDialog.target.prop] =
- this.MoreDataDialog.value.id;
- this.basicData.value[`${this.MoreDataDialog.target.prop}Name`] =
- this.MoreDataDialog.value.name;
- console.log(
- this.MoreDataDialog.target.prop,
- "props-----------------",
- this.MoreDataDialog.value
- );
- console.log(
- this.basicData.value[`${this.MoreDataDialog.target.prop}`],
- "值",
- this.basicData.value[`${this.MoreDataDialog.target.prop}Name`],
- "//////////基本信息///////////"
- );
- // 默认采购组织:purchasingOrganization 业务部门:businessDepartment
- if (this.MoreDataDialog.target.prop == "purchasingOrganization") {
- this.basicData.value["businessDepartment"] = "";
- this.basicData.value["businessDepartmentName"] = "";
- }
- // 物料税类materialRate
- if (this.MoreDataDialog.target.prop == "materialRate") {
- this.basicData.value["rateCode"] = this.MoreDataDialog.value.code;
- }
- } else if (this.MoreDataDialog.target.name == "medcineData") {
- // 医药信息
- this.medcineData.value[this.MoreDataDialog.target.prop] =
- this.MoreDataDialog.value.id;
- this.medcineData.value[`${this.MoreDataDialog.target.prop}Name`] =
- this.MoreDataDialog.value.name;
- console.log(
- this.MoreDataDialog.target.prop,
- "props-----------------",
- this.MoreDataDialog.value
- );
- console.log(
- this.medcineData.value[`${this.MoreDataDialog.target.prop}Name`],
- "//////医药信息//////////"
- );
- } else if (this.MoreDataDialog.target.name == "otherDeatils") {
- // 其他页签
- this.otherDeatils.value[this.MoreDataDialog.target.prop] =
- this.MoreDataDialog.value.id;
- this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Name`] =
- this.MoreDataDialog.value.name;
- console.log(
- this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Name`],
- "/////////其他页签///////"
- );
- } else if (this.MoreDataDialog.target.name == "materialType") {
- // 物料类别
- console.log("确认时选择的数据", this.MoreDataDialog.value);
- this.materialType.value = this.materialType.value.map((m) => {
- if (
- (m.id &&
- m.id != "" &&
- m.id == _this.MoreDataDialog.target.prop["id"]) ||
- (m.insertId &&
- m.insertId == _this.MoreDataDialog.target.prop["insertId"])
- ) {
- let drug = _this.materialType.value.filter(
- (d) => d.drugId == _this.MoreDataDialog.value["id"]
- );
- console.log(drug, "drug------------------------------------");
- if (drug.length) {
- _this.$notify({
- title: "警告",
- message: "不能维护相同的物料类别!",
- type: "warning",
- });
- confirm = false;
- } else {
- m.drugId = _this.MoreDataDialog.value["id"];
- m.drugCode = _this.MoreDataDialog.value["code"];
- m.drugName = _this.MoreDataDialog.value["name"];
- }
- }
- return m;
- });
- console.log(
- this.materialType.value,
- "修改之后-----this.materialType.value"
- );
- }
- if (confirm) {
- // this.count++;
- this.refer++;
- this.MoreDataDialog.show = false;
- this.MoreDataDialog.key = "";
- this.MoreDataDialog.value = {};
- }
- },
- // 取消-关闭参照弹窗
- handleConcalRefer() {
- console.log("关闭参照弹窗");
- this.MoreDataDialog.show = false;
- this.MoreDataDialog.key = "";
- },
- // 关闭参照弹窗前
- handleCloseRefer(done) {
- this.MoreDataDialog.key = "";
- done();
- },
- // 删除利润中心信息
- handledDelCenter(ids) {
- console.log("删除利润中心信息");
- materialApi.delCenter(ids).then((res) => {
- if (res.code == 200) {
- this.handleOtherListRefresh();
- }
- });
- },
- // 删除库存信息
- handleDelInventory(ids) {
- console.log("删除库存信息");
- materialApi.delInventory(ids).then((res) => {
- if (res.code == 200) {
- this.handleOtherListRefresh();
- }
- });
- },
- // 删除成本信息
- handleDelCost(ids) {
- console.log("删除成本信息");
- materialApi.delCost(ids).then((res) => {
- if (res.code == 200) {
- this.handleOtherListRefresh();
- }
- });
- },
- // 删除计划信息
- handleDelPlan(ids) {
- console.log("删除计划信息");
- materialApi.delPlan(ids).then((res) => {
- if (res.code == 200) {
- this.handleOtherListRefresh();
- }
- });
- },
- // 删除财物信息
- handleDelFinance(ids) {
- console.log("删除财物信息");
- materialApi.delFinance(ids).then((res) => {
- if (res.code == 200) {
- this.handleOtherListRefresh();
- }
- });
- },
- // 删除采购信息
- handledelPurchase(ids) {
- console.log("删除采购信息");
- materialApi.delPurchase(ids).then((res) => {
- if (res.code == 200) {
- this.handleOtherListRefresh();
- }
- });
- },
- // 保存物料以及相关页签
- handleSaveMaterial(cb) {
- let param = {
- ...this.basicData.value,
- materialMedcine: this.medcineData.value,
- materialMedcineItem: {},
- };
- // diCode
- param.diCode = param.diCode && param.diCode.replace(/ /g, "");
- console.log(param, "保存物料以及相关页签param");
- materialApi
- .insertMaterialInfo(param)
- .then((res) => {
- console.log(res, "保存物料以及相关页签");
- if (res.code == 200) cb();
- })
- .catch((error) => {
- this.loading = false;
- });
- },
- // 保存财务信息——单个数据
- async handleSaveFinance(data) {
- console.log(data, "保存财务信息——单个数据");
- try {
- this.otherDeatils.loading = true;
- let { code, msg } = await materialApi.financeEdit(data);
- if (code == 200) {
- this.otherDeatils.isEdit = false;
- this.handleOtherRefresh();
- this.$notify({
- title: "成功",
- message: msg,
- type: "success",
- });
- }
- } catch (error) {
- } finally {
- this.otherDeatils.loading = false;
- }
- // this.otherDeatils.loading = true;
- // materialApi.financeEdit(data).then(res => {
- // if (res.code == 200) {
- // this.otherDeatils.isEdit = false;
- // this.handleOtherRefresh();
- // }
- // this.otherDeatils.loading = false;
- // })
- },
- // 保存利润中心信息
- async handleSaveCenter(data) {
- console.log(data, "保存利润中心信息");
- try {
- this.otherDeatils.loading = true;
- let { code, msg } = await materialApi.centerEdit(data);
- if (code == 200) {
- this.otherDeatils.isEdit = false;
- this.handleOtherRefresh();
- this.$notify({
- title: "成功",
- message: msg,
- type: "success",
- });
- }
- } catch (error) {
- } finally {
- this.otherDeatils.loading = false;
- }
- // materialApi.centerEdit(data).then(res => {
- // if (res.code == 200) {
- // this.otherDeatils.isEdit = false;
- // this.handleOtherRefresh();
- // }
- // })
- },
- // 保存采购信息
- async handleSavePurchase(data) {
- console.log(data, "保存采购信息");
- try {
- this.otherDeatils.loading = true;
- let { code, msg } = await materialApi.purchaseEdit(data);
- if (code == 200) {
- this.otherDeatils.isEdit = false;
- this.handleOtherRefresh();
- this.$notify({
- title: "成功",
- message: msg,
- type: "success",
- });
- }
- } catch (error) {
- } finally {
- this.otherDeatils.loading = false;
- }
- // materialApi.purchaseEdit(data).then(res => {
- // if (res.code == 200) {
- // this.otherDeatils.isEdit = false;
- // this.handleOtherRefresh();
- // }
- // })
- },
- // 保存库存信息
- async handleSaveInventoryEdit(data) {
- console.log(data, "保存库存信息");
- try {
- this.otherDeatils.loading = true;
- let { code, msg } = await materialApi.inventoryEdit(data);
- if (code == 200) {
- this.otherDeatils.isEdit = false;
- this.handleOtherRefresh();
- this.$notify({
- title: "成功",
- message: msg,
- type: "success",
- });
- }
- } catch (error) {
- } finally {
- this.otherDeatils.loading = false;
- }
- // materialApi.inventoryEdit(data).then(res => {
- // if (res.code == 200) {
- // this.otherDeatils.isEdit = false;
- // this.handleOtherRefresh();
- // }
- // })
- },
- // 保存计划信息
- async handleSavePlan(data) {
- console.log(data, "保存计划信息");
- try {
- this.otherDeatils.loading = true;
- let { code, msg } = await materialApi.planEdit(data);
- if (code == 200) {
- this.otherDeatils.isEdit = false;
- this.handleOtherRefresh();
- this.$notify({
- title: "成功",
- message: msg,
- type: "success",
- });
- }
- } catch (error) {
- } finally {
- this.otherDeatils.loading = false;
- }
- // materialApi.planEdit(data).then(res => {
- // if (res.code == 200) {
- // this.otherDeatils.isEdit = false;
- // this.handleOtherRefresh();
- // }
- // })
- },
- // 保存成本信息
- async handleSaveCost(data) {
- console.log(data, "保存成本信息");
- try {
- this.otherDeatils.loading = true;
- let { code, msg } = await materialApi.costEdit(data);
- if (code == 200) {
- this.otherDeatils.isEdit = false;
- this.handleOtherRefresh();
- this.$notify({
- title: "成功",
- message: msg,
- type: "success",
- });
- }
- } catch (error) {
- } finally {
- this.otherDeatils.loading = false;
- }
- // materialApi.costEdit(data).then(res => {
- // if (res.code == 200) {
- // this.otherDeatils.isEdit = false;
- // this.handleOtherRefresh();
- // }
- // })
- },
- judgeIsRequriedByProps(message) {
- // condiition:条件,tergetNames:目标porps数组,formName:表单,formRef:表单ref名,
- this[message.formName].form.forEach((formItem) => {
- let target = message.tergetNames.filter((t) => t === formItem.prop);
- if (target && target.length) {
- formItem.required = message.condiition ? false : true;
- }
- });
- this.rules = initRules(this[message.formName].form);
- this.$nextTick(() => {
- message.condiition &&
- this.$refs[message.formRef].clearValidate(message.tergetNames);
- });
- },
- // 重新加载
- async handleRest() {
- this.loading = true;
- // 基本信息
- await this.getTagList("material", async (form) => {
- this.basicData.form = [...form];
- this.rules = initRules(form);
- this.basicData.value = initParams(this.basicData.form, "prop");
- await this.getMaterialDetails(this.materialId, "material");
- });
- // 医疗行业
- await this.getTagList("material_medcine", async (form) => {
- // form.forEach((item) => {
- // this.medcineData.value[item.prop] = ''
- // })
- this.medcineData.form = [...form];
- this.medcineData.value = initParams(this.medcineData.form, "prop");
- this.medcineRules = initRules(form);
- await this.getMedcineDetails(this.materialId, "material_medcine");
- });
- },
- },
- watch: {
- // 监听主标签修改标识,控制其他标签是否禁止点击
- updateButtonGroup: function (nVal, oVal) {
- console.log(nVal, "nVal", oVal, "oVal");
- this.detailsTabs = this.detailsTabs.map((item) => {
- item["disabled"] = nVal;
- return item;
- });
- },
- maintainNewVersion: function (nVal, oVal) {
- console.log(nVal, "nVal", oVal, "oVal");
- this.detailsTabs = this.detailsTabs.map((item) => {
- item["disabled"] = nVal;
- return item;
- });
- },
- "basicData.value.isMedicine": {
- handler(nVal, oVal) {
- this.basicData.form = this.basicData.form.map((formItem) => {
- if (formItem.prop === "productionPermit") {
- formItem.required = nVal == "0" ? true : false;
- }
- return formItem;
- });
- },
- deep: true,
- },
- // 通过一级分类判断业务线是否必填
- // "basicData.value.oneClass": {
- // handler(nVal, oVal) {
- // this.basicData.form = this.basicData.form.map(formItem => {
- // if (formItem.prop === "businessLine" && nVal) {
- // if ( nVal.includes('介入耗材&5') || nVal.includes('骨科耗材&2') ||
- // nVal.includes('普通耗材&3') || nVal.includes('医用设备&1') ||
- // nVal.includes('体外诊断&4')) {
- // formItem.required = true
- // } else {
- // formItem.required = false
- // }
- // }
- // return formItem;
- // })
- // },
- // deep: true,
- // },
- // 物料分类改变同时改变一二三级分类
- "basicData.value.classifyId": {
- async handler(nVal, oVal) {
- if (nVal !== oVal) {
- try {
- let { code, data } = await getDetail(nVal);
- if (code == 200) {
- let { oneClass, twoClass, threeClass } = data;
- this.basicData.value["oneClass"] = oneClass;
- this.basicData.value["twoClass"] = twoClass;
- this.basicData.value["threeClass"] = threeClass;
- }
- } catch (error) {}
- }
- },
- deep: true,
- },
- // 效期管理 expiryDateManagerment 控制 expiryUnitId 效期单位 usefulLife 有效期 usefulLifeUnitId 有效期至单位 必填
- "basicData.value.expiryDateManagerment": {
- handler(nVal, oVal) {
- this.judgeIsRequriedByProps({
- condiition: nVal === "2",
- tergetNames: [
- "expiryUnitId",
- "usefulLife",
- "usefulLifeUnitId",
- "recentWarningPeriod",
- ],
- formName: "basicData",
- formRef: "basicMessageRef",
- });
- },
- deep: true,
- },
- },
- created() {
- console.log(this, "created");
- // 基本信息
- this.handleRest();
- if (window.name === "") {
- this.$route.query.isEdit && this.handleBasicEdit();
- } else {
- console.log("页面被刷新");
- }
- },
- };
- </script>
- <style lang="scss">
- .material-details {
- padding: 12px;
- height: 100%;
- // height: calc(100vh - 158px);
- box-sizing: border-box;
- .el-card__body {
- height: calc(100vh - 40px);
- // height: 100%;
- box-sizing: border-box;
- padding: 12px;
- overflow-y: auto;
- overflow-x: auto;
- .el-select {
- width: 100%;
- }
- }
- .md-content {
- // margin-top: 12px;
- // height: calc(100vh - 260px);
- // height: calc(100vh - 200px);
- box-sizing: border-box;
- .md-basic {
- overflow: auto;
- .md-main {
- // height: calc(100vh - 625px);
- margin-bottom: 10px;
- .el-table__body {
- // height: calc(100vh - 300px);
- }
- .el-form {
- max-height: 430px;
- overflow-y: auto;
- overflow-x: hidden;
- .redSpan::before {
- content: "* ";
- color: red;
- }
- .el-checkbox {
- padding: 0 58%;
- }
- }
- }
- .md-vice-content {
- height: 140px;
- overflow-y: auto;
- overflow-x: hidden;
- }
- }
- .md-auditInfo {
- .el-divider--horizontal {
- margin: 20px 0px 15px;
- }
- }
- }
- // .md-content>.el-tabs {
- // height: calc(100vh - 280px);
- // }
- .otherDialog {
- .el-collapse-item__content {
- padding-bottom: 12px;
- }
- .el-form {
- .el-checkbox {
- width: 100%;
- padding: 0 10%;
- }
- }
- .el-dialog__body {
- padding: 12px 20px;
- height: 80%;
- overflow: auto;
- }
- .od-msg {
- max-height: 220px;
- box-sizing: border-box;
- overflow-y: auto;
- overflow-x: hidden;
- }
- // .el-dialog__header {
- // background-color: rgb(244, 244, 244);
- // }
- }
- .el-dialog__header {
- background-color: rgb(244, 244, 244);
- }
- .MoreDataDialog {
- .el-dialog__body {
- height: 500px;
- padding: 20px 15px;
- .el-table {
- margin-top: 10px;
- .el-table__body-wrapper {
- height: 300px;
- overflow-y: auto;
- overflow-x: hidden;
- }
- }
- .el-pagination {
- text-align: right;
- margin-top: 5px;
- }
- .referTree {
- height: 390px;
- overflow-x: hidden;
- overflow-y: auto;
- }
- }
- .more-button {
- margin-top: 10px;
- text-align: right;
- }
- }
- }
- // 修改下拉框样式
- #selected {
- /*很关键:将默认的select选择框样式清除*/
- // appearance: none;
- // -moz-appearance: none;
- // -webkit-appearance: none;
- // /*为下拉小箭头留出一点位置,避免被文字覆盖*/
- // padding-right: 14px;
- // /*自定义图片*/
- // background: url("../images/search@2x.png") no-repeat scroll right center transparent;
- // /*自定义图片的大小*/
- // background-size: 16px 16px;
- // /*将小箭头的样式去去掉*/
- // .el-icon-arrow-up:before {
- // content: '';
- // }
- // }
- }
- </style>
- <style scoped>
- .md-content >>> .el-form-item,
- .otherDialog >>> .el-form-item {
- margin-bottom: 0px;
- }
- .md-content >>> .el-tabs--border-card > .el-tabs__content {
- padding-bottom: 8px;
- }
- .md-content .md-auditInfo >>> .el-form-item {
- margin-bottom: 0px;
- }
- .md-main >>> .el-form-item,
- .md-vice >>> .el-form-item,
- .od-msg >>> .el-form-item {
- width: 100%;
- box-sizing: border-box;
- }
- .md-main >>> .el-form-item__label,
- .md-vice >>> .el-form-item__label,
- .od-msg >>> .el-form-item__label {
- width: 40%;
- }
- .od-msg >>> .el-checkbox__input {
- width: 15%;
- }
- .md-main >>> .el-form-item__content,
- .md-vice >>> .el-form-item__content,
- .od-msg >>> .el-form-item__content {
- width: 60%;
- box-sizing: border-box;
- height: 36px;
- }
- .od-msg >>> .el-checkbox__label {
- width: 85%;
- box-sizing: border-box;
- }
- .od-msg-checkedbx >>> .el-form-item__content {
- width: 80%;
- box-sizing: border-box;
- }
- .od-msg-checkedbx >>> .el-checkbox {
- width: 75%;
- box-sizing: border-box;
- }
- .md-content >>> .el-form-item__label,
- .otherDialog >>> .el-form-item__label,
- .od-msg >>> .el-form-item__label,
- .od-msg >>> .el-checkbox__label {
- font-weight: normal;
- /* text-align: left;
- width: 28%; */
- white-space: nowrap;
- /* IE6 需要定义宽度 */
- overflow: hidden;
- -o-text-overflow: ellipsis;
- /* Opera */
- text-overflow: ellipsis;
- /* IE, Safari (WebKit) */
- /* -moz-binding: url('ellipsis.xml#ellipsis'); */
- /* Firefox */
- }
- .otherDialog >>> .el-form-item__label {
- font-size: 12px;
- }
- .md-main >>> .material-table {
- height: 100%;
- }
- .md-vice >>> .material-table {
- height: 140px;
- overflow-y: auto;
- overflow-x: auto;
- }
- >>> .referTree {
- margin-top: 10px;
- }
- /* .md-main>>>.el-table .el-table__body {
- height: calc(100vh - 300px);
- } */
- /* .otherDialog>>>.el-collapse-item__content {
- padding-bottom: 12px;
- }
- .otherDialog>>>.el-dialog__body {
- padding: 12px 20px;
- } */
- </style>
|