details.vue 99 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191
  1. <!-- 物料信息基础档案——详情 -->
  2. <template>
  3. <div class="material-details" v-loading="loading">
  4. <!-- 操作栏 -->
  5. <el-card>
  6. <!-- 基本信息栏 -->
  7. <div style="display: flex; justify-content: end">
  8. <div v-if="activeMainTab == 'material'">
  9. <!-- 基本信息修改状态下—— 保存、保存新增、更新导入、取消 -->
  10. <el-row
  11. v-if="updateButtonGroup || maintainNewVersion"
  12. :gutter="10"
  13. class="mb10"
  14. type="flex"
  15. justify="end"
  16. >
  17. <el-col :span="1.5">
  18. <el-button-group>
  19. <el-button
  20. :size="size"
  21. @click="handleSave"
  22. v-hasPermi="[
  23. 'system:material:add',
  24. `${maintainNewVersion ? '' : 'system:material:versions'}`,
  25. ]"
  26. >
  27. 保存
  28. </el-button>
  29. </el-button-group>
  30. </el-col>
  31. <el-col :span="1.5">
  32. <el-button-group>
  33. <el-button :size="size" @click="handleCancel">取消</el-button>
  34. </el-button-group>
  35. </el-col>
  36. </el-row>
  37. <el-row v-else :gutter="10" class="mb10" type="flex" justify="end">
  38. <!-- 新增、修改、删除、复制 -->
  39. <el-col :span="1.5">
  40. <el-button-group>
  41. <!-- <el-button :size="size" @click="handleInster">新增</el-button> -->
  42. <el-button :size="size" @click="handleBasicEdit"
  43. >修改</el-button
  44. >
  45. <!-- <el-button :size="size" @click="handleDel">删除</el-button> -->
  46. <!-- <el-button :size="size" @click="handleCopy">复制</el-button> -->
  47. </el-button-group>
  48. </el-col>
  49. <!-- 查询、刷新、过滤 -->
  50. <el-col :span="1.5">
  51. <el-button-group>
  52. <el-button :size="size" @click="handleRefresh">刷新</el-button>
  53. </el-button-group>
  54. </el-col>
  55. <!-- 启用 -->
  56. <el-col :span="1.5">
  57. <el-button-group>
  58. <el-button :size="size" @click="handleMaterialType"
  59. >维护物料类别</el-button
  60. >
  61. <el-button
  62. :size="size"
  63. @click="handleIsInvoke"
  64. :key="count"
  65. v-hasPermi="['system:material:add']"
  66. >
  67. <!-- 0:启用 2:停用 -->
  68. {{ basicData.value.isEnable == "已启用" ? "停用" : "启用" }}
  69. </el-button>
  70. </el-button-group>
  71. </el-col>
  72. <!-- 维护新版本 -->
  73. <el-col :span="1.5">
  74. <el-button-group>
  75. <el-button
  76. :size="size"
  77. @click="handleNewVersion"
  78. v-hasPermi="['system:material:versions']"
  79. >维护新版本
  80. </el-button>
  81. </el-button-group>
  82. </el-col>
  83. </el-row>
  84. </div>
  85. <!-- 其他标签页操作 修改、删除 -->
  86. <el-row
  87. :gutter="10"
  88. class="mb10"
  89. v-show="activeMainTab != 'material'"
  90. type="flex"
  91. justify="end"
  92. >
  93. <el-col :span="1.5">
  94. <el-button-group>
  95. <el-button :size="size" @click="handleOtherEdit('table')"
  96. >修改</el-button
  97. >
  98. <el-button
  99. :size="size"
  100. v-show="activeMainTab != 'material_finance'"
  101. @click="handleOtherDel"
  102. >删除</el-button
  103. >
  104. </el-button-group>
  105. <el-button-group>
  106. <el-button :size="size" @click="handleOtherListRefresh"
  107. >刷新</el-button
  108. >
  109. </el-button-group>
  110. </el-col>
  111. </el-row>
  112. <!-- 返回 切换 附件管理 -->
  113. <el-row type="flex" justify="space-between">
  114. <el-col :span="6">
  115. <!-- :disabled="headerParam.isEdit" -->
  116. <el-button
  117. :size="size"
  118. @click="handleBack"
  119. :disabled="updateButtonGroup"
  120. >返回</el-button
  121. >
  122. </el-col>
  123. <el-col :span="6" style="text-align: right"> </el-col>
  124. </el-row>
  125. </div>
  126. <div class="md-content" :key="basicData.value.id">
  127. <el-form :inline="true" label-position="right" :model="basicData.value">
  128. <!-- <el-form-item label="所属组织"></el-form-item> -->
  129. <el-form-item label="物料编码">
  130. <el-input
  131. v-model="basicData.value.code"
  132. readonly
  133. size="mini"
  134. ></el-input>
  135. </el-form-item>
  136. <el-form-item label="物料名称">
  137. <el-input
  138. v-model="basicData.value.name"
  139. readonly
  140. size="mini"
  141. ></el-input>
  142. </el-form-item>
  143. <el-form-item label="英文名称">
  144. <el-input
  145. v-model="basicData.value.enName"
  146. readonly
  147. size="mini"
  148. ></el-input>
  149. </el-form-item>
  150. <!-- <el-form-item label="版本号"></el-form-item> -->
  151. </el-form>
  152. <dr-tabs :tabList="detailsTabs" :handleTabClick="handleMainTabClick">
  153. <template #tabContent>
  154. <div class="md-basic" :key="count">
  155. <!-- 主信息 -->
  156. <div class="md-main">
  157. <!-- 基本信息展示表单 -->
  158. <el-form
  159. v-if="activeMainTab == 'material'"
  160. :inline="true"
  161. label-position="right"
  162. :model="basicData.value"
  163. :key="basicData.value.id"
  164. ref="basicMessageRef"
  165. :rules="rules"
  166. >
  167. <el-row :gutter="10">
  168. <el-col
  169. :span="6"
  170. v-for="f in basicData.form"
  171. style="text-align: right"
  172. >
  173. <template v-if="f.show">
  174. <!-- 多选框 -->
  175. <el-form-item
  176. v-if="f.attribute == 'checkbox'"
  177. style="text-align: left"
  178. :prop="f.prop"
  179. :key="f.required"
  180. >
  181. <el-checkbox
  182. :label="f.name"
  183. name="type"
  184. v-model="basicData.value[f.prop]"
  185. true-label="0"
  186. false-label="2"
  187. :disabled="handleJudge(f)"
  188. size="mini"
  189. >
  190. </el-checkbox>
  191. </el-form-item>
  192. <!-- 下拉框 -->
  193. <el-form-item
  194. v-else-if="f.attribute == 'select'"
  195. :id="updateButtonGroup && f.apiUrl ? 'selected' : ''"
  196. :prop="f.apiUrl ? `${f.prop}Name` : f.prop"
  197. :key="f.required"
  198. :rules="[
  199. {
  200. required: f.required,
  201. message: `请选择${f.name}`,
  202. trigger: 'change',
  203. },
  204. ]"
  205. >
  206. <template slot="label">
  207. <el-tooltip
  208. class="item"
  209. effect="dark"
  210. placement="top-start"
  211. :disabled="f.name.length < 10"
  212. >
  213. <!-- <span :class="(f.apiUrl && f.required) ? 'redSpan': ''">{{ f.name }}</span> -->
  214. <span>{{ f.name }}</span>
  215. <div slot="content">
  216. <p>{{ f.name }}</p>
  217. </div>
  218. </el-tooltip>
  219. </template>
  220. <!-- 参照 -->
  221. <el-select
  222. v-if="f.apiUrl"
  223. v-model="basicData.value[`${f.prop}Name`]"
  224. placeholder="请选择"
  225. size="mini"
  226. :key="basicData.value[f.prop]"
  227. :disabled="handleJudge(f)"
  228. @focus="
  229. f.apiUrl &&
  230. handleQueryMore(f, '', {
  231. name: 'basicData',
  232. prop: f.prop,
  233. })
  234. "
  235. >
  236. <div slot="empty"></div>
  237. </el-select>
  238. <!-- 字典 -->
  239. <el-select
  240. v-if="f.dictId"
  241. v-model="basicData.value[f.prop]"
  242. placeholder="请选择"
  243. size="mini"
  244. :key="basicData.value[f.prop]"
  245. :disabled="handleJudge(f)"
  246. >
  247. <el-option
  248. v-if="f.dictId"
  249. v-for="d in f.dictValue"
  250. :key="d.dictValue"
  251. :label="d.dictLabel"
  252. :value="d.dictValue"
  253. >
  254. </el-option>
  255. </el-select>
  256. </el-form-item>
  257. <!-- 图片 -->
  258. <el-form-item
  259. v-else-if="f.attribute == 'image'"
  260. :label="f.name"
  261. @clicks="handleUpImage"
  262. >
  263. <el-image
  264. :src="basicData.value[f.prop]"
  265. fit="contain"
  266. ></el-image>
  267. <!-- <img :src="basicData.value[f.prop]" @clicks="handleUpImage" alt="加载失败"> -->
  268. </el-form-item>
  269. <!--attribute 文本 数字 文本域 为null -->
  270. <el-form-item v-else :prop="f.prop" :key="f.required">
  271. <template slot="label">
  272. <el-tooltip
  273. class="item"
  274. effect="dark"
  275. placement="top-start"
  276. :disabled="f.name.length < 10"
  277. >
  278. <span>{{ f.name }}</span>
  279. <div slot="content">
  280. <p>{{ f.name }}</p>
  281. </div>
  282. </el-tooltip>
  283. </template>
  284. <el-input
  285. size="mini"
  286. v-model="basicData.value[f.prop]"
  287. :type="f.attribute || 'text'"
  288. :readonly="handleJudge(f)"
  289. :rows="1"
  290. :maxlength="judgeMaxLength(f.prop)"
  291. ></el-input>
  292. </el-form-item>
  293. </template>
  294. </el-col>
  295. </el-row>
  296. </el-form>
  297. <!-- 其他展示为列表 -->
  298. <el-table
  299. v-else
  300. border
  301. :data="mainMsg.value"
  302. @cell-dblclick="handleMaindbClick"
  303. @selection-change="handleMainChange"
  304. >
  305. <el-table-column type="selection" width="55" />
  306. <el-table-column
  307. type="index"
  308. v-if="mainMsg.form.length"
  309. label="序号"
  310. width="55"
  311. align="center"
  312. />
  313. <el-table-column
  314. v-for="m in mainMsg.form"
  315. v-if="m.show"
  316. :label="m.name"
  317. align="center"
  318. :prop="m.attribute == 'select' ? `${m.prop}Name` : m.prop"
  319. show-overflow-tooltip
  320. >
  321. <template slot-scope="scope">
  322. {{
  323. m.attribute == "select"
  324. ? scope.row[`${m.prop}Name`]
  325. : m.attribute == "checkbox"
  326. ? scope.row[m.prop] == "0"
  327. ? "√"
  328. : ""
  329. : scope.row[m.prop]
  330. }}
  331. </template>
  332. </el-table-column>
  333. </el-table>
  334. </div>
  335. <!-- 副信息 -->
  336. <div class="md-vice">
  337. <dr-tabs
  338. v-if="activeMainTab == 'material'"
  339. :tabList="basicMessage"
  340. :handleTabClick="handleViceTabClick"
  341. >
  342. <template #tabContent>
  343. <el-form
  344. v-if="activeViceTab == 'material_medcine'"
  345. :inline="true"
  346. label-position="right"
  347. ref="medcineRef"
  348. :model="medcineData.value"
  349. class="md-vice-content"
  350. :rules="medcineRules"
  351. :key="medcineData.value.id"
  352. >
  353. <el-row :gutter="10">
  354. <el-col
  355. :span="6"
  356. v-for="m in medcineData.form"
  357. style="text-align: right"
  358. >
  359. <!-- 需要根据基本信息中的是否医药物料字段判断是否可以填写 -->
  360. <template v-if="m.show">
  361. <!-- 多选框 -->
  362. <el-form-item
  363. v-if="m.attribute == 'checkbox'"
  364. :prop="m.prop"
  365. >
  366. <el-checkbox
  367. :label="m.name"
  368. name="type"
  369. v-model="medcineData.value[m.prop]"
  370. size="mini"
  371. :disabled="
  372. !(
  373. updateButtonGroup &&
  374. m.edit &&
  375. basicData.value.isMedicine == '0'
  376. )
  377. "
  378. true-label="0"
  379. false-label="2"
  380. >
  381. </el-checkbox>
  382. </el-form-item>
  383. <!-- 下拉框 -->
  384. <el-form-item
  385. v-else-if="m.attribute == 'select'"
  386. :label="m.name"
  387. :prop="m.apiUrl ? `${m.prop}Name` : m.prop"
  388. :rules="[
  389. {
  390. required: m.required,
  391. message: `请选择${m.name}`,
  392. trigger: 'change',
  393. },
  394. ]"
  395. >
  396. <!-- 参照弹窗 -->
  397. <el-select
  398. v-if="m.apiUrl"
  399. v-model="medcineData.value[`${m.prop}Name`]"
  400. placeholder="请选择"
  401. :key="medcineData.value[m.prop]"
  402. size="mini"
  403. :disabled="
  404. !(
  405. updateButtonGroup &&
  406. m.edit &&
  407. basicData.value.isMedicine == '0'
  408. )
  409. "
  410. @focus="
  411. m.apiUrl &&
  412. handleQueryMore(m, '', {
  413. name: 'medcineData',
  414. prop: m.prop,
  415. })
  416. "
  417. >
  418. <div slot="empty"></div>
  419. </el-select>
  420. <!-- 下拉选择 -->
  421. <el-select
  422. v-if="m.dictId"
  423. v-model="medcineData.value[m.prop]"
  424. placeholder="请选择"
  425. :key="medcineData.value[m.prop]"
  426. size="mini"
  427. :disabled="
  428. !(
  429. updateButtonGroup &&
  430. m.edit &&
  431. basicData.value.isMedicine == '0'
  432. )
  433. "
  434. @focus="
  435. m.apiUrl &&
  436. handleQueryMore(m, '', {
  437. name: 'medcineData',
  438. prop: m.prop,
  439. })
  440. "
  441. >
  442. <el-option
  443. v-if="m.dictId"
  444. v-for="d in m.dictValue"
  445. :key="d.dictValue"
  446. :label="d.dictLabel"
  447. :value="d.dictValue"
  448. >
  449. </el-option>
  450. </el-select>
  451. </el-form-item>
  452. <!-- 图片 -->
  453. <el-form-item
  454. v-else-if="m.attribute == 'image'"
  455. :label="m.name"
  456. >
  457. <el-image
  458. :src="medcineData.value[m.prop]"
  459. fit="contain"
  460. >
  461. </el-image>
  462. </el-form-item>
  463. <!-- 文本、数字、textarae -->
  464. <el-form-item v-else :label="m.name">
  465. <el-input
  466. size="mini"
  467. v-model="medcineData.value[m.prop]"
  468. :type="m.attribute || 'text'"
  469. :rows="1"
  470. :readonly="
  471. !(
  472. updateButtonGroup &&
  473. m.edit &&
  474. basicData.value.isMedicine == '0'
  475. )
  476. "
  477. >
  478. </el-input>
  479. </el-form-item>
  480. </template>
  481. </el-col>
  482. </el-row>
  483. </el-form>
  484. <!-- 其他展示为列表 -->
  485. <!-- 辅计量 -->
  486. <el-table
  487. border
  488. v-else-if="activeViceTab == 'material_unit'"
  489. :data="unitDetails.value"
  490. class="material-table"
  491. >
  492. <el-table-column
  493. type="index"
  494. v-if="unitDetails.form.length"
  495. label="序号"
  496. width="55"
  497. align="center"
  498. />
  499. <el-table-column
  500. v-for="v in unitDetails.form"
  501. v-if="v.show"
  502. :label="v.name"
  503. align="center"
  504. :prop="
  505. v.attribute == 'select' ? `${v.prop}Name` : v.prop
  506. "
  507. show-overflow-tooltip
  508. >
  509. <template slot-scope="scope">
  510. {{
  511. v.attribute == "select"
  512. ? scope.row[`${v.prop}Name`]
  513. : v.attribute == "checkbox"
  514. ? scope.row[v.prop] == "0"
  515. ? "√"
  516. : ""
  517. : scope.row[v.prop]
  518. }}
  519. </template>
  520. </el-table-column>
  521. </el-table>
  522. <!-- 辅助属性 -->
  523. <el-table
  524. border
  525. v-else-if="activeViceTab == 'material_property'"
  526. :data="propertyDetail.value"
  527. class="material-table"
  528. >
  529. <el-table-column
  530. type="index"
  531. v-if="propertyDetail.form.length"
  532. label="序号"
  533. width="55"
  534. align="center"
  535. />
  536. <el-table-column
  537. v-for="v in propertyDetail.form"
  538. v-if="v.show"
  539. :label="v.name"
  540. align="center"
  541. :prop="
  542. v.attribute == 'select' ? `${v.prop}Name` : v.prop
  543. "
  544. show-overflow-tooltip
  545. >
  546. <template slot-scope="scope">
  547. {{
  548. v.attribute == "select"
  549. ? scope.row[`${v.prop}Name`]
  550. : v.attribute == "checkbox"
  551. ? scope.row[v.prop] == "0"
  552. ? "√"
  553. : ""
  554. : scope.row[v.prop]
  555. }}
  556. </template>
  557. </el-table-column>
  558. </el-table>
  559. </template>
  560. </dr-tabs>
  561. </div>
  562. <!-- 基本信息 - 审计信息 -->
  563. <div class="md-auditInfo" v-if="activeMainTab == 'material'">
  564. <el-divider content-position="left">审计信息</el-divider>
  565. <el-form
  566. :inline="true"
  567. label-position="right"
  568. :model="basicData.value"
  569. >
  570. <el-form-item label="创建人">
  571. <el-input
  572. v-model="basicData.value.createByName"
  573. size="mini"
  574. readonly
  575. ></el-input>
  576. </el-form-item>
  577. <el-form-item label="创建时间">
  578. <el-input
  579. v-model="basicData.value.createTime"
  580. size="mini"
  581. readonly
  582. ></el-input>
  583. </el-form-item>
  584. <el-form-item label="最后修改人">
  585. <el-input
  586. v-model="basicData.value.updateByName"
  587. size="mini"
  588. readonly
  589. ></el-input>
  590. </el-form-item>
  591. <el-form-item label="最后修改时间">
  592. <el-input
  593. v-model="basicData.value.updateTime"
  594. size="mini"
  595. readonly
  596. ></el-input>
  597. </el-form-item>
  598. </el-form>
  599. </div>
  600. </div>
  601. </template>
  602. </dr-tabs>
  603. </div>
  604. </el-card>
  605. <!-- 维护物料类别弹窗 -->
  606. <el-dialog
  607. title="物料类别维护"
  608. :visible.sync="materialType.show"
  609. :before-close="handleCloseTypeDetails"
  610. :close-on-press-escape="false"
  611. :close-on-click-modal="false"
  612. width="80%"
  613. center
  614. class="materialType"
  615. >
  616. <!-- 操作按钮 -->
  617. <el-row :gutter="10" class="mb10" type="flex" justify="end">
  618. <el-col :span="1.5">
  619. <el-button-group>
  620. <el-button
  621. :size="size"
  622. :disabled="!materialType.isEdit"
  623. @click="handleMaterialTypeRow('add')"
  624. >增行
  625. </el-button>
  626. <el-button
  627. :size="size"
  628. :disabled="!materialType.isEdit"
  629. @click="handleMaterialTypeRow('del')"
  630. >删行
  631. </el-button>
  632. </el-button-group>
  633. <el-button-group>
  634. <el-button
  635. :size="size"
  636. @click="handleMaterialTypeRow('edit')"
  637. v-hasPermi="['system:material:add']"
  638. >{{ materialType.isEdit ? "保存" : "修改" }}
  639. </el-button>
  640. <el-button
  641. :size="size"
  642. v-if="materialType.isEdit"
  643. @click="handleMaterialTypeRow('cancal')"
  644. >取消</el-button
  645. >
  646. <el-button :size="size" @click="handleMaterialTypeRow"
  647. >刷新</el-button
  648. >
  649. </el-button-group>
  650. </el-col>
  651. </el-row>
  652. <!-- 表格数据 -->
  653. <el-table
  654. border
  655. :data="materialType.value"
  656. stripe
  657. style="width: 100%"
  658. max-height="350"
  659. v-loading="materialType.loading"
  660. :key="refer"
  661. @selection-change="handleSelectionType"
  662. >
  663. <el-table-column type="selection" width="30" />
  664. <el-table-column type="index" width="50" label="序号" />
  665. <el-table-column
  666. v-for="mt in materialType.form"
  667. v-if="mt.show"
  668. :label="mt.name"
  669. width="180"
  670. >
  671. <template slot-scope="scope">
  672. <!-- :prop="mt.prop" -->
  673. <!-- 多选框 -->
  674. <el-checkbox
  675. size="mini"
  676. v-if="mt.attribute == 'checkbox'"
  677. :disabled="!(materialType.isEdit && mt.edit)"
  678. true-label="0"
  679. false-label="2"
  680. v-model="scope.row[mt.prop]"
  681. />
  682. <!-- 下拉框 / 参照弹窗---- 药品类别编码 scope.row[`${mt.prop}Name`] -->
  683. <el-select
  684. size="mini"
  685. v-else-if="mt.attribute == 'select' && mt.apiUrl"
  686. placeholder="请选择"
  687. :disabled="!(materialType.isEdit && mt.edit)"
  688. v-model="scope.row[mt.prop]"
  689. :key="scope.row[mt.prop]"
  690. @focus="
  691. mt.apiUrl &&
  692. handleQueryMore(mt, '', {
  693. name: 'materialType',
  694. prop: scope.row,
  695. })
  696. "
  697. >
  698. <div slot="empty"></div>
  699. </el-select>
  700. <!-- <el-select size="mini" v-else-if="mt.attribute == 'select' && mt.dictId" placeholder="请选择"
  701. :disabled="!(materialType.isEdit && mt.edit)" v-model="scope.row[mt.prop]" :key="scope.row[mt.prop]">
  702. <el-option v-if="mt.dictId" v-for="d in mt.dictId" :key="d.dictValue" :label="d.dictLabel"
  703. :value="d.dictValue"></el-option></el-select> -->
  704. <!-- 其他类型 -->
  705. <el-input
  706. v-else
  707. size="mini"
  708. v-model="scope.row[mt.prop]"
  709. :readonly="!(materialType.isEdit && mt.edit)"
  710. />
  711. </template>
  712. </el-table-column>
  713. </el-table>
  714. </el-dialog>
  715. <!-- 操作提示弹窗 -->
  716. <el-dialog
  717. title="操作提示"
  718. :visible.sync="optionDialog.show"
  719. width="30%"
  720. center
  721. >
  722. <span>是否确认{{ optionDialog.op }}?</span>
  723. <span slot="footer">
  724. <el-button type="primary" @click="handleComfirmOption('cancal')"
  725. >确 定</el-button
  726. >
  727. <el-button @click="handleOptionCancal">取 消</el-button>
  728. </span>
  729. </el-dialog>
  730. <!-- 其他页签的操作 -->
  731. <el-dialog
  732. :title="otherDeatils.title"
  733. :visible.sync="otherDeatils.show"
  734. show-close
  735. width="70%"
  736. :before-close="handleCloseOtherDetails"
  737. :close-on-press-escape="false"
  738. :close-on-click-modal="false"
  739. class="otherDialog"
  740. >
  741. <div v-loading="otherDeatils.loading">
  742. <!-- 其他标签页操作 修改、删除 -->
  743. <el-row :gutter="10" class="mb10" type="flex" justify="end">
  744. <el-col :span="1.5" v-if="!otherDeatils.isEdit">
  745. <el-button-group>
  746. <el-button :size="size" @click="handleOtherEdit('form')"
  747. >修改</el-button
  748. >
  749. <!-- <el-button :size="size" @click="handleOtherDel">删除</el-button> -->
  750. </el-button-group>
  751. <el-button-group>
  752. <el-button :size="size" @click="handleOtherRefresh"
  753. >刷新</el-button
  754. >
  755. </el-button-group>
  756. </el-col>
  757. <el-col :span="1.5" v-else>
  758. <el-button-group>
  759. <el-button :size="size" @click="handleOtherSave">保存</el-button>
  760. <el-button :size="size" @click="handleOtherCancel"
  761. >取消</el-button
  762. >
  763. </el-button-group>
  764. </el-col>
  765. </el-row>
  766. <el-collapse v-model="collapseActive" @change="handleCollapseChange">
  767. <el-collapse-item title="物料基本信息" name="basic">
  768. <el-form
  769. :inline="true"
  770. label-position="right"
  771. :model="basicData.value"
  772. >
  773. <el-form-item label="物料编码">
  774. <el-input
  775. v-model="basicData.value.code"
  776. :size="size"
  777. readonly
  778. ></el-input>
  779. </el-form-item>
  780. <el-form-item label="物料名称">
  781. <el-input
  782. v-model="basicData.value.name"
  783. :size="size"
  784. readonly
  785. ></el-input>
  786. </el-form-item>
  787. <el-form-item label="英文名称">
  788. <el-input
  789. v-model="basicData.value.enName"
  790. :size="size"
  791. readonly
  792. ></el-input>
  793. </el-form-item>
  794. </el-form>
  795. </el-collapse-item>
  796. <el-collapse-item :title="otherDeatils.title" :name="activeMainTab">
  797. <div class="od-msg">
  798. <!-- 展示表单 -->
  799. <el-form
  800. :inline="true"
  801. label-position="right"
  802. :key="refer"
  803. :hide-required-asterisk="true"
  804. :model="otherDeatils.value"
  805. >
  806. <el-row :gutter="10">
  807. <el-col
  808. :span="8"
  809. v-for="f in otherDeatils.form"
  810. style="text-align: right"
  811. >
  812. <template v-if="f.show">
  813. <!-- 多选框 -->
  814. <el-form-item
  815. v-if="f.attribute == 'checkbox'"
  816. style="text-align: left"
  817. class="od-msg-checkedbx"
  818. >
  819. <el-checkbox
  820. :label="f.name"
  821. name="type"
  822. v-model="otherDeatils.value[f.prop]"
  823. true-label="0"
  824. false-label="2"
  825. :disabled="!(otherDeatils.isEdit && f.edit)"
  826. >
  827. </el-checkbox>
  828. </el-form-item>
  829. <!-- 下拉框 - 弹窗参照 -->
  830. <el-form-item
  831. v-else-if="f.attribute == 'select'"
  832. :label="f.name"
  833. >
  834. <el-select
  835. v-if="f.apiUrl"
  836. v-model="otherDeatils.value[`${f.prop}Name`]"
  837. placeholder="请选择"
  838. :key="otherDeatils.value[f.prop]"
  839. :disabled="!(otherDeatils.isEdit && f.edit)"
  840. @focus="
  841. f.apiUrl &&
  842. handleQueryMore(f, '', {
  843. name: 'otherDeatils',
  844. prop: f.prop,
  845. })
  846. "
  847. >
  848. <div slot="empty"></div>
  849. </el-select>
  850. <!-- 字典-下拉 -->
  851. <el-select
  852. v-if="f.dictId"
  853. v-model="otherDeatils.value[f.prop]"
  854. placeholder="请选择"
  855. :key="otherDeatils.value[f.prop]"
  856. :disabled="!(otherDeatils.isEdit && f.edit)"
  857. >
  858. <el-option
  859. v-if="f.dictId"
  860. v-for="d in f.dictValue"
  861. :key="d.dictValue"
  862. :label="d.dictLabel"
  863. :value="d.dictValue"
  864. >
  865. </el-option>
  866. </el-select>
  867. </el-form-item>
  868. <el-form-item
  869. v-else-if="f.attribute == 'image'"
  870. :label="f.name"
  871. >
  872. <el-image
  873. :src="otherDeatils.value[f.prop]"
  874. fit="contain"
  875. >
  876. </el-image>
  877. </el-form-item>
  878. <!--attribute 文本 数字 文本域 为null -->
  879. <el-form-item v-else :label="f.name">
  880. <el-input
  881. :size="size"
  882. v-model="otherDeatils.value[f.prop]"
  883. :type="f.attribute || 'text'"
  884. :readonly="!(otherDeatils.isEdit && f.edit)"
  885. >
  886. </el-input>
  887. </el-form-item>
  888. </template>
  889. </el-col>
  890. </el-row>
  891. </el-form>
  892. </div>
  893. </el-collapse-item>
  894. <el-collapse-item title="审计信息" name="auditInfo">
  895. <!-- 基本信息 - 审计信息 -->
  896. <div class="md-auditInfo">
  897. <el-form
  898. :inline="true"
  899. label-position="right"
  900. :model="basicData.value"
  901. >
  902. <el-form-item label="创建人">
  903. <el-input
  904. v-model="basicData.value.createByName"
  905. :size="size"
  906. readonly
  907. ></el-input>
  908. </el-form-item>
  909. <el-form-item label="创建时间">
  910. <el-input
  911. v-model="basicData.value.createTime"
  912. :size="size"
  913. readonly
  914. ></el-input>
  915. </el-form-item>
  916. <el-form-item label="最后修改人">
  917. <el-input
  918. v-model="basicData.value.updateByName"
  919. :size="size"
  920. readonly
  921. ></el-input>
  922. </el-form-item>
  923. <el-form-item label="最后修改时间">
  924. <el-input
  925. v-model="basicData.value.updateTime"
  926. :size="size"
  927. readonly
  928. ></el-input>
  929. </el-form-item>
  930. </el-form>
  931. </div>
  932. </el-collapse-item>
  933. </el-collapse>
  934. </div>
  935. </el-dialog>
  936. <!-- 参照弹窗 -->
  937. <el-dialog
  938. :title="MoreDataDialog.msg.name"
  939. :visible.sync="MoreDataDialog.show"
  940. width="70%"
  941. class="MoreDataDialog"
  942. :close-on-press-escape="false"
  943. :close-on-click-modal="false"
  944. :before-close="handleCloseRefer"
  945. >
  946. <div>
  947. <el-row :gutter="20">
  948. <el-col :span="6">
  949. <el-input
  950. v-model="MoreDataDialog.key"
  951. placeholder="过滤"
  952. :size="size"
  953. clearable
  954. @clear="handleClear"
  955. @keyup.enter.native="handleFilterRefer"
  956. />
  957. </el-col>
  958. <el-col :span="6">
  959. <el-button
  960. type="primary"
  961. :size="size"
  962. @click.stop="handleFilterRefer"
  963. >搜索</el-button
  964. >
  965. </el-col>
  966. </el-row>
  967. <!-- 树形 -->
  968. <el-tree
  969. v-if="MoreDataDialog.type == 'tree'"
  970. v-loading="MoreDataDialog.loading"
  971. :key="refer"
  972. node-key="id"
  973. class="referTree"
  974. :data="MoreDataDialog.list"
  975. @node-click="handleNodeClick"
  976. :props="
  977. MoreDataDialog.msg.apiUrl == 'queryMedcineItemDrug' ||
  978. MoreDataDialog.msg.apiUrl == 'queryMaterialClassify'
  979. ? drugProps
  980. : defaultProps
  981. "
  982. >
  983. </el-tree>
  984. <!-- queryMedcineItemDrug -->
  985. <!-- 列表 -->
  986. <div v-else>
  987. <el-table
  988. :data="MoreDataDialog.list"
  989. v-loading="MoreDataDialog.loading"
  990. style="width: 100%"
  991. @row-click="handleCurentRow"
  992. @row-dblclick="handleDbClick"
  993. highlight-current-row
  994. >
  995. <el-table-column
  996. type="index"
  997. label="序号"
  998. width="55"
  999. align="center"
  1000. />
  1001. <el-table-column
  1002. v-for="m in MoreDataDialog.form"
  1003. v-if="m.show"
  1004. :prop="m.prop"
  1005. :label="m.name"
  1006. />
  1007. </el-table>
  1008. <el-pagination
  1009. @size-change="handleSizeChange"
  1010. @current-change="handleCurrentChange"
  1011. :current-page="queryParams.pageNum"
  1012. :page-sizes="[10, 20, 50, 100]"
  1013. layout="total, sizes, prev, pager, next, jumper"
  1014. :total="queryParams.total"
  1015. >
  1016. </el-pagination>
  1017. </div>
  1018. <!-- 按钮 -->
  1019. <el-row class="more-button">
  1020. <el-button
  1021. round
  1022. :size="size"
  1023. type="primary"
  1024. @click="handleConfirmRefer"
  1025. >确认</el-button
  1026. >
  1027. <el-button round :size="size" @click="handleConcalRefer"
  1028. >取消</el-button
  1029. >
  1030. </el-row>
  1031. </div>
  1032. </el-dialog>
  1033. </div>
  1034. </template>
  1035. <script>
  1036. import drTabs from "../components/dr-tabs.vue";
  1037. import detailsTabs from "../config/detailsTabs";
  1038. import materialApi from "@/api/material/basic";
  1039. import { getDicts as getDicts } from "@/api/system/dict/data";
  1040. import arrayUtils from "../tools/arrayUtils";
  1041. import { initRules, initParams } from "./init/index";
  1042. import { getDetail } from "@/api/classify/basic";
  1043. export default {
  1044. name: "material-details",
  1045. // dicts: [],
  1046. components: {
  1047. drTabs,
  1048. },
  1049. data() {
  1050. return {
  1051. size: "mini",
  1052. count: 1,
  1053. refer: 1,
  1054. loading: false,
  1055. rules: {},
  1056. medcineRules: {},
  1057. // 维护新版本
  1058. maintainNewVersion: false,
  1059. // 详情固定标签页
  1060. detailsTabs,
  1061. defaultProps: {
  1062. children: "childrens",
  1063. label: "name",
  1064. },
  1065. drugProps: {
  1066. children: "childrens",
  1067. label: function (data, node) {
  1068. return data.code + " " + data.name;
  1069. },
  1070. // 'name'
  1071. },
  1072. // 标签页当前激活状态
  1073. activeMainTab: "material",
  1074. activeViceTab: "material_medcine",
  1075. materialId: this.$route.params.id,
  1076. collapseActive: ["basic", ""],
  1077. // 修改按钮 是否激活
  1078. updateButtonGroup: false,
  1079. // 基本信息下的页签
  1080. basicMessage: [
  1081. {
  1082. label: "医药行业",
  1083. code: "material_medcine",
  1084. isShow: true,
  1085. },
  1086. {
  1087. label: "辅计量管理",
  1088. code: "material_unit",
  1089. isShow: true,
  1090. },
  1091. {
  1092. label: "辅助属性",
  1093. code: "material_property",
  1094. isShow: true,
  1095. },
  1096. ],
  1097. // 基本信息
  1098. basicData: {
  1099. value: {},
  1100. form: [],
  1101. },
  1102. // 物料类别
  1103. materialType: {
  1104. show: false,
  1105. value: [],
  1106. form: [],
  1107. loading: false,
  1108. checkedList: [],
  1109. isEdit: false,
  1110. },
  1111. // 医药行业
  1112. medcineData: {
  1113. value: {},
  1114. form: [],
  1115. },
  1116. // 辅助属性
  1117. propertyDetail: {
  1118. value: [],
  1119. form: [],
  1120. },
  1121. // 辅计量管理
  1122. unitDetails: {
  1123. value: [],
  1124. form: [],
  1125. },
  1126. // 主标签信息
  1127. mainMsg: {
  1128. form: [],
  1129. value: [],
  1130. checkedList: [],
  1131. },
  1132. // 副信息
  1133. viceMsg: {
  1134. form: [],
  1135. value: [],
  1136. },
  1137. // 操作弹窗
  1138. optionDialog: {
  1139. show: false,
  1140. op: "",
  1141. },
  1142. // 其他页签操作弹窗
  1143. otherDeatils: {
  1144. loading: false,
  1145. show: false,
  1146. title: "",
  1147. // 查询关键字-物料id
  1148. queryKey: "",
  1149. isEdit: false,
  1150. // 详情表头
  1151. from: [],
  1152. // 详情值
  1153. value: {},
  1154. },
  1155. // 编辑-更多数据展示弹窗_ 参照
  1156. MoreDataDialog: {
  1157. loading: false,
  1158. show: false,
  1159. // 查询关键字
  1160. key: "",
  1161. // 需要查看参照的表单头信息
  1162. msg: "",
  1163. type: "table",
  1164. // 查询出的参照数据
  1165. list: [],
  1166. // 查询出的参照表头
  1167. form: [],
  1168. // 选中的参照数据
  1169. value: "",
  1170. // 参照最后应该赋值的地方
  1171. target: {
  1172. name: "",
  1173. prop: "",
  1174. },
  1175. },
  1176. // 参照分页参数
  1177. queryParams: {
  1178. pageNum: 1,
  1179. total: 0,
  1180. pageSize: 10,
  1181. },
  1182. };
  1183. },
  1184. methods: {
  1185. judgeMaxLength(prop) {
  1186. // 规格
  1187. if (prop === "specification") {
  1188. return 150;
  1189. }
  1190. return Infinity;
  1191. },
  1192. // 判断效期管理
  1193. handleJudge(attribute) {
  1194. // 维护新版本才能修改:批号及库存状态管理(isInventoryStatus)、
  1195. if (attribute.prop == "isInventoryStatus") {
  1196. return !(this.maintainNewVersion && attribute.edit);
  1197. }
  1198. // 序列号管理(serialNoManager):维护新版本 && 批号及库存状态管理
  1199. else if (attribute.prop == "serialNoManager") {
  1200. if (this.basicData.value["isInventoryStatus"] == "2")
  1201. this.basicData.value["serialNoManager"] = "2";
  1202. return !(
  1203. this.maintainNewVersion &&
  1204. attribute.edit &&
  1205. this.basicData.value["isInventoryStatus"] == "0"
  1206. );
  1207. }
  1208. // 批号及库存状态管理(isInventoryStatus) 控制 效期管理是否展示(expiryDateManagerment)
  1209. else if (attribute.prop == "expiryDateManagerment") {
  1210. if (this.basicData.value["isInventoryStatus"] == "2")
  1211. this.basicData.value["expiryDateManagerment"] = "2";
  1212. return !(
  1213. this.updateButtonGroup &&
  1214. attribute.edit &&
  1215. this.basicData.value["isInventoryStatus"] == "0"
  1216. );
  1217. }
  1218. // 效期管理(expiryDateManagerment):控制一下几个是否可编辑
  1219. // expiryUnitId 效期单位 usefulLife 有效期 usefulLifeUnitId 有效期至单位
  1220. else if (
  1221. attribute.prop == "expiryUnitId" ||
  1222. attribute.prop == "usefulLife" ||
  1223. attribute.prop == "usefulLifeUnitId" ||
  1224. attribute.prop == "recentWarningPeriod"
  1225. ) {
  1226. if (this.basicData.value["expiryDateManagerment"] == "2") {
  1227. this.basicData.value["expiryUnitId"] = "";
  1228. this.basicData.value["usefulLife"] = "";
  1229. this.basicData.value["usefulLifeUnitId"] = "";
  1230. this.basicData.value["recentWarningPeriod"] = "";
  1231. }
  1232. return !(
  1233. this.updateButtonGroup &&
  1234. attribute.edit &&
  1235. this.basicData.value["expiryDateManagerment"] == "0"
  1236. );
  1237. }
  1238. // 默认采购组织:purchasingOrganization 业务部门:businessDepartment
  1239. else if (attribute.prop == "businessDepartment") {
  1240. return !(
  1241. this.updateButtonGroup &&
  1242. attribute.edit &&
  1243. this.basicData.value["purchasingOrganization"]
  1244. );
  1245. } else {
  1246. // 其他属性是否可编辑
  1247. return !(this.updateButtonGroup && attribute.edit);
  1248. }
  1249. },
  1250. // 返回
  1251. handleBack() {
  1252. this.$store.dispatch("tagsView/delView", this.$route);
  1253. this.$router.go(-1);
  1254. // this.$router.push({
  1255. // path: `/basic/material/basicFile`,
  1256. // });
  1257. },
  1258. // 附件按钮
  1259. handleFile() {
  1260. console.log("附件按钮");
  1261. },
  1262. // 改变分页情况
  1263. handleChangePage(type) {
  1264. switch (type) {
  1265. case "first":
  1266. console.log("第一页");
  1267. break;
  1268. case "pre":
  1269. console.log("上一页");
  1270. break;
  1271. case "next":
  1272. console.log("下一页");
  1273. break;
  1274. case "end":
  1275. console.log("最后页");
  1276. break;
  1277. }
  1278. },
  1279. // 切换主信息标签
  1280. handleMainTabClick(e) {
  1281. this.activeMainTab = detailsTabs[e.index].code;
  1282. this.collapseActive.splice(1, 1, this.activeMainTab);
  1283. console.log(this.collapseActive, "this.collapseActive");
  1284. this.handleOtherListRefresh();
  1285. },
  1286. // 切换副表信息
  1287. handleViceTabClick(e) {
  1288. // console.log(this.basicMessage[e.index], '切换标签');
  1289. this.activeViceTab = this.basicMessage[e.index].code;
  1290. switch (this.activeViceTab) {
  1291. // 医药行业
  1292. case "material_medcine":
  1293. this.getTagList("material_medcine", (form) => {
  1294. this.medcineData.form = [...form];
  1295. this.medcineData.value = initParams(this.medcineData.form, "prop");
  1296. this.medcineRules = initRules(form);
  1297. this.getMedcineDetails(this.materialId, "material_medcine");
  1298. });
  1299. break;
  1300. // 辅计量管理
  1301. case "material_unit":
  1302. this.getTagList("material_unit", (form) => {
  1303. console.log(form, "form");
  1304. this.unitDetails.form = form;
  1305. this.getUnitList(this.materialId);
  1306. });
  1307. break;
  1308. // 辅助属性
  1309. case "material_property":
  1310. this.getTagList("material_property", (form) => {
  1311. this.propertyDetail.form = form;
  1312. this.getPropertyList(this.materialId);
  1313. });
  1314. break;
  1315. default:
  1316. break;
  1317. }
  1318. },
  1319. // 主标签页 列表双击
  1320. handleMaindbClick(e) {
  1321. this.otherDeatils.queryKey = e.id;
  1322. this.otherDeatils.show = true;
  1323. let activeTab = this.detailsTabs.filter(
  1324. (item) => item.code == this.activeMainTab
  1325. )[0];
  1326. console.log(activeTab, "activeTab");
  1327. this.otherDeatils.title = activeTab.label;
  1328. this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
  1329. },
  1330. // 主页签 列表数据选择
  1331. handleMainChange(e) {
  1332. this.mainMsg.checkedList = e;
  1333. },
  1334. // 上传图片
  1335. handleUpImage() {},
  1336. // 编辑状态下,参照弹窗显示查询数据
  1337. handleQueryMore(msg, val, target) {
  1338. this.MoreDataDialog.loading = true;
  1339. let _this = this;
  1340. console.log("编辑状态下,弹窗显示查询数据", msg, "val", val, target);
  1341. this.MoreDataDialog.show = true;
  1342. this.MoreDataDialog.msg = msg;
  1343. this.MoreDataDialog.target = target;
  1344. let par = { param: this.MoreDataDialog.key };
  1345. this[target.name].form.map((t) => {
  1346. if (t.relevance && t.relevance != "") {
  1347. let reList = t.relevance.split(",");
  1348. console.log(reList, "reList-------------------");
  1349. reList.forEach((i) => {
  1350. par[i] = this.basicData.value[i];
  1351. });
  1352. console.log(par, "par/////////////////////////");
  1353. }
  1354. });
  1355. this.getExecuteMethods(msg.apiUrl, par, (data) => {
  1356. _this.MoreDataDialog.type = data.type;
  1357. if (data.type == "tree") {
  1358. _this.MoreDataDialog.list = arrayUtils.filterTreeData(data.tableBody);
  1359. } else {
  1360. _this.MoreDataDialog.list = data.tableBody;
  1361. _this.MoreDataDialog.form = data.tableHeader;
  1362. }
  1363. this.refer++;
  1364. // this.count++;
  1365. });
  1366. },
  1367. // 参照改变分页大小
  1368. handleSizeChange(e) {
  1369. this.queryParams.pageSize = e;
  1370. this.handleQueryMore(
  1371. this.MoreDataDialog.msg,
  1372. this.MoreDataDialog.key,
  1373. this.MoreDataDialog.target
  1374. );
  1375. },
  1376. // 参照改变当前页
  1377. handleCurrentChange(e) {
  1378. this.queryParams.pageNum = e;
  1379. this.handleQueryMore(
  1380. this.MoreDataDialog.msg,
  1381. this.MoreDataDialog.key,
  1382. this.MoreDataDialog.target
  1383. );
  1384. },
  1385. // 根据apiUrl获取对应参照的值
  1386. getExecuteMethods(methodName, param, cb) {
  1387. let page = {
  1388. pageSize: this.queryParams.pageSize,
  1389. pageNum: this.queryParams.pageNum,
  1390. };
  1391. let params = { ...param };
  1392. // 业务部门需要 依据默认采购组组织查询
  1393. if (methodName == "queryOperatingDepptTree") {
  1394. params["puOrgId"] = this.basicData.value["purchasingOrganization"];
  1395. }
  1396. materialApi.executeMethods(methodName, params, page).then((res) => {
  1397. this.MoreDataDialog.loading = false;
  1398. if (res.code == 200) {
  1399. this.queryParams.total = res.data.total;
  1400. cb(res.data);
  1401. }
  1402. });
  1403. },
  1404. // 获取物料基本信息详细信息
  1405. async getMaterialDetails(id, templateCode) {
  1406. let _this = this;
  1407. await materialApi.materialDetails(id, templateCode).then((res) => {
  1408. this.loading = false;
  1409. console.log(res, "物料基本信息");
  1410. let { code, data } = res;
  1411. if (code == 200) {
  1412. _this.basicData.value = { ..._this.basicData.value, ...data.data };
  1413. for (const key in data.data) {
  1414. _this.basicData.value[key] =
  1415. typeof data.data[key] === "number"
  1416. ? String(data.data[key])
  1417. : data.data[key];
  1418. }
  1419. // _this.handleAddReferLabel('basicData');
  1420. this.count++;
  1421. }
  1422. });
  1423. },
  1424. // 添加参照中的label
  1425. // handleAddReferLabel(dataName) {
  1426. // let _this = this;
  1427. // this[dataName].form.map(item => {
  1428. // // 查参照
  1429. // if (item.apiUrl && item.apiUrl != '') {
  1430. // let param = {};
  1431. // if (item.relevance && item.relevance != '') {
  1432. // let reList = item.relevance.split(',');
  1433. // console.log(reList, 'reList-------------------');
  1434. // reList.forEach(i => {
  1435. // param[i] = this.basicData.value[i]
  1436. // })
  1437. // console.log(param, 'param/////////////////////////');
  1438. // }
  1439. // _this.getExecuteMethods(item.apiUrl, param, (data) => {
  1440. // let { tableBody } = data;
  1441. // // 维护物料类别 --- 属于列表中获取label
  1442. // if (dataName == 'materialType') {
  1443. // _this[dataName].value.length && (_this[dataName].value = _this[dataName].value.map(d => {
  1444. // let Blabel = tableBody.filter((t) => t.id == d[item.prop])[0];
  1445. // console.log(Blabel, 'Blabel``````````````````````````');
  1446. // d[`${item.prop}Label`] = (Blabel && Blabel.name) || Blabel || '';
  1447. // return d;
  1448. // }))
  1449. // } else {
  1450. // let Blabel = tableBody.filter((t) => t.id == _this[dataName].value[item.prop])[0];
  1451. // console.log(Blabel, 'Blabel``````````````````````````');
  1452. // _this[dataName].value[`${item.prop}Label`] = (Blabel && Blabel.name) || Blabel || '';
  1453. // }
  1454. // // this.count++;
  1455. // this.loading = false;
  1456. // console.log(_this[dataName].value, `${dataName}//////////////////////`);
  1457. // })
  1458. // }
  1459. // })
  1460. // this.materialType.loading = false;
  1461. // },
  1462. // 查询财务信息列表
  1463. async getFinanceList(materialId) {
  1464. try {
  1465. this.loading = true;
  1466. let { code, data } = await materialApi.financeList({ materialId });
  1467. if (code == 200) {
  1468. this.mainMsg.value = data.tableBody.rows;
  1469. }
  1470. } catch (error) {
  1471. } finally {
  1472. this.loading = false;
  1473. }
  1474. },
  1475. // 查询计划信息列表
  1476. async getPlanList(materialId) {
  1477. try {
  1478. this.loading = true;
  1479. let { code, data } = await materialApi.planList({ materialId });
  1480. if (code == 200) {
  1481. this.mainMsg.value = data.tableBody.rows;
  1482. }
  1483. } catch (error) {
  1484. } finally {
  1485. this.loading = false;
  1486. }
  1487. },
  1488. // 查询成本信息列表
  1489. async getCostList(materialId) {
  1490. try {
  1491. this.loading = true;
  1492. let { code, data } = await materialApi.costList({ materialId });
  1493. if (code == 200) {
  1494. this.mainMsg.value = data.tableBody.rows;
  1495. }
  1496. } catch (error) {
  1497. } finally {
  1498. this.loading = false;
  1499. }
  1500. },
  1501. // 查询利润中心列表
  1502. async getCenterList(materialId) {
  1503. try {
  1504. this.loading = true;
  1505. let { code, data } = await materialApi.centerList({ materialId });
  1506. if (code == 200) {
  1507. this.mainMsg.value = data.tableBody.rows;
  1508. }
  1509. } catch (error) {
  1510. } finally {
  1511. this.loading = false;
  1512. }
  1513. },
  1514. // 查询采购中心列表
  1515. async getPurchaseList(materialId) {
  1516. try {
  1517. this.loading = true;
  1518. let { code, data } = await materialApi.purchaseList({ materialId });
  1519. if (code == 200) {
  1520. this.mainMsg.value = data.tableBody.rows;
  1521. }
  1522. } catch (error) {
  1523. } finally {
  1524. this.loading = false;
  1525. }
  1526. },
  1527. // 获取库存信息列表
  1528. async getInventoryList(materialId) {
  1529. try {
  1530. this.loading = true;
  1531. let { code, data } = await materialApi.inventoryList({ materialId });
  1532. if (code == 200) {
  1533. this.mainMsg.value = data.tableBody.rows;
  1534. }
  1535. } catch (error) {
  1536. } finally {
  1537. this.loading = false;
  1538. }
  1539. },
  1540. // 查询其他标签页列表详情
  1541. getOtherListDetails(type, id) {
  1542. console.log(type, id, "查询其他标签页列表详情");
  1543. this.otherDeatils.form = this.mainMsg.form;
  1544. console.log(this.otherDeatils.form, "this.otherDeatils.form");
  1545. switch (type) {
  1546. // 财物信息
  1547. case "material_finance":
  1548. this.getFinanceDetails(id);
  1549. break;
  1550. // 利润中心信息
  1551. case "profit_center":
  1552. this.getCenterDetails(id);
  1553. break;
  1554. // 采购信息
  1555. case "material_purchase":
  1556. this.getPurchaseDetails(id);
  1557. break;
  1558. // 库存信息
  1559. case "material_inventory":
  1560. this.getInventoryDetails(id);
  1561. break;
  1562. // 计划信息
  1563. case "material_plan":
  1564. this.getPlanDetails(id);
  1565. break;
  1566. // 成本信息
  1567. case "material_cost":
  1568. this.getCostDetails(id);
  1569. break;
  1570. default:
  1571. break;
  1572. }
  1573. },
  1574. // 查询财务信息详情
  1575. async getFinanceDetails(id) {
  1576. try {
  1577. this.otherDeatils.loading = true;
  1578. let { code, data } = await materialApi.financeDetails(id);
  1579. if (code == 200) {
  1580. this.otherDeatils.value = data.data;
  1581. }
  1582. } catch (error) {
  1583. } finally {
  1584. setTimeout(() => {
  1585. this.otherDeatils.loading = false;
  1586. }, 200);
  1587. }
  1588. },
  1589. // 获取利润中心详情
  1590. async getCenterDetails(id) {
  1591. try {
  1592. this.otherDeatils.loading = true;
  1593. let { code, data } = await materialApi.centerDetails(id);
  1594. if (code == 200) {
  1595. this.otherDeatils.value = data.data;
  1596. }
  1597. } catch (error) {
  1598. } finally {
  1599. setTimeout(() => {
  1600. this.otherDeatils.loading = false;
  1601. }, 200);
  1602. }
  1603. },
  1604. // 获取采购详细信息详情
  1605. async getPurchaseDetails(id) {
  1606. try {
  1607. this.otherDeatils.loading = true;
  1608. let { code, data } = await materialApi.purchaseDetails(id);
  1609. if (code == 200) {
  1610. this.otherDeatils.value = data.data;
  1611. }
  1612. } catch (error) {
  1613. } finally {
  1614. setTimeout(() => {
  1615. this.otherDeatils.loading = false;
  1616. }, 200);
  1617. }
  1618. },
  1619. // 获取成本信息详情
  1620. async getCostDetails(id) {
  1621. try {
  1622. this.otherDeatils.loading = true;
  1623. let { code, data } = await materialApi.costDetails(id);
  1624. if (code == 200) {
  1625. this.otherDeatils.value = data.data;
  1626. }
  1627. } catch (error) {
  1628. } finally {
  1629. setTimeout(() => {
  1630. this.otherDeatils.loading = false;
  1631. }, 200);
  1632. }
  1633. },
  1634. // 获取计划信息详情
  1635. async getPlanDetails(id) {
  1636. try {
  1637. this.otherDeatils.loading = true;
  1638. let { code, data } = await materialApi.planDetails(id);
  1639. if (code == 200) {
  1640. this.otherDeatils.value = data.data;
  1641. }
  1642. } catch (error) {
  1643. } finally {
  1644. setTimeout(() => {
  1645. this.otherDeatils.loading = false;
  1646. }, 200);
  1647. }
  1648. },
  1649. //
  1650. async getInventoryDetails(id) {
  1651. try {
  1652. this.otherDeatils.loading = true;
  1653. let { code, data } = await materialApi.inventoryDetails(id);
  1654. if (code == 200) {
  1655. this.otherDeatils.value = data.data;
  1656. }
  1657. } catch (error) {
  1658. } finally {
  1659. setTimeout(() => {
  1660. this.otherDeatils.loading = false;
  1661. }, 200);
  1662. }
  1663. },
  1664. /* 二级标签页 */
  1665. // 根据物料id获取医药行业信息详细信息
  1666. async getMedcineDetails(id) {
  1667. let _this = this;
  1668. console.log(id);
  1669. await materialApi.medcineDetailsInfo(id).then((res) => {
  1670. this.loading = false;
  1671. console.log(res, "医药行业");
  1672. let { code, data } = res;
  1673. if (code == 200) {
  1674. _this.medcineData.value = data.data || {};
  1675. // this.medcineData.form = data.form;
  1676. // _this.handleAddReferLabel('medcineData');
  1677. console.log(" _this.medcineData", _this.medcineData, res);
  1678. this.count++;
  1679. }
  1680. });
  1681. },
  1682. // 获取物料辅助属性详细信息+表单列段属性
  1683. getPropertyDetails(id) {
  1684. materialApi.propertyDetails(id).then((res) => {
  1685. console.log(res, "物料辅助属性详细信息");
  1686. if (res.code == 200) {
  1687. this.propertyDetail.value = res.data.data || [];
  1688. }
  1689. });
  1690. },
  1691. // 查询物料辅助属性列表+表头字段
  1692. getPropertyList(materialId) {
  1693. materialApi.propertyList({ materialId }).then((res) => {
  1694. console.log(res, "料辅助属性列表");
  1695. if (res.code == 200) {
  1696. this.propertyDetail.value = res.data.data || [];
  1697. }
  1698. });
  1699. },
  1700. //获取辅助计量单位基本信息+表单列段属性
  1701. getUnitDetails(materialId) {
  1702. materialApi.unitDetails(materialId).then((res) => {
  1703. console.log(res, "辅助计量单位基本信息");
  1704. if (res.code == 200) {
  1705. this.unitDetails.value = res.data.tableBody.rows || [];
  1706. }
  1707. });
  1708. },
  1709. //获取辅计量管理列表信息
  1710. getUnitList(materialId) {
  1711. materialApi.unitList({ materialId }).then((res) => {
  1712. console.log(res, "辅计量管理列表信息");
  1713. if (res.code == 200) {
  1714. this.unitDetails.value = res.data.tableBody.rows || [];
  1715. }
  1716. });
  1717. },
  1718. // 获取物料列表表头
  1719. async getTagList(templateCode, cb) {
  1720. let _this = this;
  1721. await materialApi.tagList({ templateCode }).then(async (res) => {
  1722. console.log(res, `获取${templateCode}表头`);
  1723. let dictIdList = [];
  1724. if (res.code == 200) {
  1725. res.data.map(async (item) => {
  1726. // 查字典
  1727. if (item.dictId && item.dictId != "") {
  1728. // 通过接口获取有dict的对应的数据
  1729. await getDicts(item.dictId).then((dict) => {
  1730. if (dict.data) {
  1731. item["dictValue"] = dict.data;
  1732. }
  1733. });
  1734. }
  1735. });
  1736. return cb(res.data);
  1737. // 动态更改dict
  1738. // res.data.forEach(item => {
  1739. // if (item.dictId) {
  1740. // // 请求接口
  1741. // dictIdList.push(item.dictId);
  1742. // }
  1743. // })
  1744. // console.log(dictIdList, 'dictIdList');
  1745. // _this.dict = [..._this.dict, ...dictIdList];
  1746. // _this.dict = Array.from(new Set([..._this.dict, ...dictIdList]));
  1747. // console.log(_this.dict, 'dicts');
  1748. // return cb(res.data);
  1749. }
  1750. });
  1751. },
  1752. // 根据物料id获取物料类别维护列表
  1753. getMedcineitemList(materialId) {
  1754. let _this = this;
  1755. materialApi.medcineitemList({ materialId }).then((res) => {
  1756. this.materialType.loading = false;
  1757. console.log(res, "根据物料id获取物料类别维护列表");
  1758. if (res.code == 200) {
  1759. _this.materialType.value = res.data.tableBody.rows;
  1760. // _this.handleAddReferLabel('materialType');
  1761. }
  1762. });
  1763. },
  1764. // 新增
  1765. handleInster() {
  1766. this.$notify({
  1767. title: "警告",
  1768. message: "物料只能通过申请审批增加,不能在节点直接录入!",
  1769. type: "warning",
  1770. });
  1771. },
  1772. // 除基本信息之后的修改
  1773. handleOtherEdit(type) {
  1774. // debugger
  1775. console.log("除基本信息之后的修改", type);
  1776. if ("table" === type) {
  1777. if (this.mainMsg.checkedList.length == 1) {
  1778. this.otherDeatils.show = true;
  1779. this.otherDeatils.isEdit = true;
  1780. let activeTab = this.detailsTabs.filter(
  1781. (item) => item.code == this.activeMainTab
  1782. )[0];
  1783. this.otherDeatils.title = activeTab.label;
  1784. this.otherDeatils.queryKey = this.mainMsg.checkedList[0].id;
  1785. console.log(this.otherDeatils, "this.otherDeatils");
  1786. // 查询其他标签页列表详情
  1787. this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
  1788. } else {
  1789. this.$notify({
  1790. title: "警告",
  1791. message: "修改请选择单个数据!",
  1792. type: "warning",
  1793. });
  1794. }
  1795. } else if ("form" === type) {
  1796. if (this.otherDeatils.queryKey) {
  1797. this.otherDeatils.show = true;
  1798. this.otherDeatils.isEdit = true;
  1799. let activeTab = this.detailsTabs.filter(
  1800. (item) => item.code == this.activeMainTab
  1801. )[0];
  1802. this.otherDeatils.title = activeTab.label;
  1803. // 查询其他标签页列表详情
  1804. this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
  1805. }
  1806. }
  1807. },
  1808. // 其他标签详情弹窗-刷新
  1809. handleOtherRefresh() {
  1810. this.getOtherListDetails(this.activeMainTab, this.otherDeatils.queryKey);
  1811. },
  1812. // 其他标签详情弹窗-删除
  1813. handleOtherDel() {
  1814. let ids = this.mainMsg.checkedList.map((i) => i.id);
  1815. console.log(`${this.activeMainTab}其他标签详情弹窗-删除---id合集`, ids);
  1816. if (ids.length) {
  1817. switch (this.activeMainTab) {
  1818. // 财物信息
  1819. case "material_finance":
  1820. this.handleDelFinance(ids);
  1821. break;
  1822. // 利润中心信息
  1823. case "profit_center":
  1824. this.handledDelCenter(ids);
  1825. break;
  1826. // 采购信息
  1827. case "material_purchase":
  1828. this.handledelPurchase(ids);
  1829. break;
  1830. // 库存信息
  1831. case "material_inventory":
  1832. this.handleDelInventory(ids);
  1833. break;
  1834. // 计划信息
  1835. case "material_plan":
  1836. this.handleDelPlan(ids);
  1837. break;
  1838. // 成本信息
  1839. case "material_cost":
  1840. this.handleDelCost(ids);
  1841. default:
  1842. break;
  1843. }
  1844. } else {
  1845. this.$notify({
  1846. title: "警告",
  1847. message: "请选择需要删除的数据!",
  1848. type: "warning",
  1849. });
  1850. }
  1851. },
  1852. // 其他标签页刷新
  1853. async handleOtherListRefresh() {
  1854. switch (this.activeMainTab) {
  1855. // 基本信息
  1856. case "material":
  1857. await this.getTagList("material", async (form) => {
  1858. // this.basicData.form = [...form];
  1859. this.basicData.form = [...form];
  1860. this.rules = initRules(form);
  1861. this.basicData.value = initParams(this.basicData.form, "prop");
  1862. await this.getMaterialDetails(this.materialId, "material");
  1863. });
  1864. break;
  1865. // 财物信息
  1866. case "material_finance":
  1867. await this.getTagList("material_finance", async (form) => {
  1868. this.mainMsg.form = [...form];
  1869. await this.getFinanceList(this.materialId);
  1870. });
  1871. break;
  1872. // 利润中心信息
  1873. case "profit_center":
  1874. await this.getTagList("profit_center", async (form) => {
  1875. this.mainMsg.form = [...form];
  1876. await this.getCenterList(this.materialId);
  1877. });
  1878. break;
  1879. // 采购信息
  1880. case "material_purchase":
  1881. await this.getTagList("material_purchase", async (form) => {
  1882. this.mainMsg.form = [...form];
  1883. await this.getPurchaseList(this.materialId);
  1884. });
  1885. break;
  1886. // 库存信息
  1887. case "material_inventory":
  1888. await this.getTagList("material_inventory", async (form) => {
  1889. this.mainMsg.form = [...form];
  1890. await this.getInventoryList(this.materialId);
  1891. });
  1892. break;
  1893. // 计划信息
  1894. case "material_plan":
  1895. await this.getTagList("material_plan", async (form) => {
  1896. this.mainMsg.form = [...form];
  1897. await this.getPlanList(this.materialId);
  1898. });
  1899. break;
  1900. // 成本信息
  1901. case "material_cost":
  1902. await this.getTagList("material_cost", async (form) => {
  1903. this.mainMsg.form = [...form];
  1904. await this.getCostList(this.materialId);
  1905. });
  1906. break;
  1907. default:
  1908. break;
  1909. }
  1910. },
  1911. // 修改
  1912. handleBasicEdit() {
  1913. console.log("修改基本信息");
  1914. this.updateButtonGroup = true;
  1915. // this.count++;
  1916. //需要禁止点击其他标签
  1917. // this.detailsTabs = this.detailsTabs.map(item => {
  1918. // item['disabled'] = true;
  1919. // return item
  1920. // })
  1921. console.log(this.detailsTabs, "this.detailsTabs ");
  1922. },
  1923. // 删除
  1924. handleDel() {
  1925. console.log("删除----基本信息");
  1926. },
  1927. // 复制
  1928. handleCopy() {
  1929. console.log("复制");
  1930. },
  1931. //查询
  1932. handleQuery() {},
  1933. // 刷新
  1934. handleRefresh() {
  1935. console.log("刷新");
  1936. this.$refs.basicMessageRef.clearValidate();
  1937. this.$refs.medcineRef.clearValidate();
  1938. this.handleRest();
  1939. },
  1940. // 过滤
  1941. handleFilter(e) {
  1942. console.log(e, "过滤");
  1943. },
  1944. filterCondition(type) {
  1945. return {
  1946. type,
  1947. };
  1948. },
  1949. // 维护物料类别
  1950. handleMaterialType() {
  1951. console.log("维护物料类别");
  1952. this.materialType.show = true;
  1953. this.materialType.loading = true;
  1954. this.getTagList("material_medcine_item", (form) => {
  1955. this.materialType.form = form;
  1956. this.getMedcineitemList(this.materialId);
  1957. });
  1958. },
  1959. // 启用
  1960. handleIsInvoke(e) {
  1961. console.log("启用", this.basicData.value.isEnable);
  1962. let param = {
  1963. isEnable: this.basicData.value.isEnable == "已启用" ? "2" : "0",
  1964. id: this.basicData.value.id,
  1965. };
  1966. console.log(param, "启用/停用param");
  1967. materialApi.updateEnableMaterial(param).then((res) => {
  1968. console.log(res, "启用/停用");
  1969. if (res.code == 200) this.handleRefresh();
  1970. });
  1971. },
  1972. // 维护新版本
  1973. handleNewVersion() {
  1974. let _this = this;
  1975. let data = {
  1976. // 物料编码
  1977. code: this.basicData.value.code,
  1978. };
  1979. materialApi.versions(data).then((res) => {
  1980. console.log(res, "维护新版本");
  1981. if (res.code == 200) {
  1982. _this.maintainNewVersion = res.data.result;
  1983. // 维护版本消息展示 by shiy 2023/05/31
  1984. if (!res.data.result) {
  1985. this.$notify({
  1986. title: "警告",
  1987. message: res.data.msg,
  1988. type: "warning",
  1989. });
  1990. }
  1991. }
  1992. });
  1993. },
  1994. // 维护物料保存
  1995. handleSaveNewVersion(cb) {
  1996. let data = {
  1997. // 物料编码
  1998. materialCode: this.basicData.value.code,
  1999. //序列号管理; 2= 否,0= 是
  2000. serialNoManager: this.basicData.value.serialNoManager,
  2001. // 批号及库存状态管理;2=否,0=是
  2002. isInventoryStatus: this.basicData.value.isInventoryStatus,
  2003. };
  2004. materialApi
  2005. .saveVersions(data)
  2006. .then((res) => {
  2007. console.log(res, "维护物料保存");
  2008. if (res.code == 200) {
  2009. cb();
  2010. }
  2011. })
  2012. .catch((error) => {
  2013. this.loading = false;
  2014. });
  2015. },
  2016. // 取消保存
  2017. handleCancel() {
  2018. console.log("取消保存");
  2019. this.optionDialog.op = "取消";
  2020. this.optionDialog.show = true;
  2021. },
  2022. // 保存修改
  2023. handleSave() {
  2024. console.log("保存修改");
  2025. // this.$refs['basicMessageRef'].validate(async (valid) => {
  2026. // if (valid) {
  2027. this.loading = true;
  2028. // 普通保存修改
  2029. this.updateButtonGroup &&
  2030. this.handleSaveMaterial(() => {
  2031. this.updateButtonGroup = false;
  2032. this.handleRefresh();
  2033. });
  2034. // 维护新版本保存修改
  2035. this.maintainNewVersion &&
  2036. this.handleSaveNewVersion(() => {
  2037. this.maintainNewVersion = false;
  2038. this.handleRefresh();
  2039. });
  2040. // } else {
  2041. // this.$notify.error({
  2042. // title: '错误',
  2043. // message: '存在必填项未填写!'
  2044. // });
  2045. // console.log('error submit!!');
  2046. // return false;
  2047. // }
  2048. // })
  2049. },
  2050. // 物料类别列表选中
  2051. handleSelectionType(list) {
  2052. console.log("物料类别列表选中", list);
  2053. this.materialType.checkedList = list;
  2054. },
  2055. // 物料类别增删行
  2056. handleMaterialTypeRow(op) {
  2057. let _this = this;
  2058. switch (op) {
  2059. // 增行
  2060. case "add":
  2061. let rowObj = {};
  2062. for (const key in _this.materialType.value[0]) {
  2063. if (Object.hasOwnProperty.call(_this.materialType.value[0], key)) {
  2064. rowObj[key] = "";
  2065. }
  2066. }
  2067. rowObj["insertId"] = new Date().getTime();
  2068. this.materialType.value.push(rowObj);
  2069. console.log(this.materialType.value, "物料类别增行rowObj后");
  2070. break;
  2071. // 删行
  2072. case "del":
  2073. console.log("物料类别删行", _this.materialType.checkedList);
  2074. if (_this.materialType.checkedList.length) {
  2075. _this.materialType.checkedList.map((c) => {
  2076. _this.materialType.value = _this.materialType.value.filter(
  2077. (m) => {
  2078. if (m.id && m.id != "" && m.id != c.id) {
  2079. return m;
  2080. } else if (
  2081. m.insertId &&
  2082. m.insertId != "" &&
  2083. m.insertId != c.insertId
  2084. ) {
  2085. return m;
  2086. }
  2087. }
  2088. );
  2089. });
  2090. } else {
  2091. this.$notify({
  2092. title: "警告",
  2093. message: "请选择需要删除的信息!",
  2094. type: "warning",
  2095. });
  2096. }
  2097. break;
  2098. // 取消
  2099. case "cancal":
  2100. this.materialType.isEdit = false;
  2101. this.handleMaterialTypeRow();
  2102. break;
  2103. // 保存、修改
  2104. case "edit":
  2105. if (_this.materialType.isEdit) {
  2106. // 编辑状态
  2107. let nullList = _this.materialType.value.filter(
  2108. (m) => !m.drugId || m.drugId == ""
  2109. );
  2110. console.log(nullList, "nullList");
  2111. if (!nullList.length && _this.materialType.value.length) {
  2112. console.log("物料类别保存", _this.materialType.value);
  2113. let params = {
  2114. materialId: _this.materialId,
  2115. medcineItems: _this.materialType.value,
  2116. };
  2117. materialApi.medcineitemBatchSave(params).then((res) => {
  2118. console.log(res, "保存物料类型");
  2119. if (res.code == 200) {
  2120. _this.materialType.isEdit = false;
  2121. _this.handleMaterialTypeRow();
  2122. }
  2123. });
  2124. // 保存
  2125. } else {
  2126. this.$notify({
  2127. title: "警告",
  2128. message: "不能保存空数据或存在数据为空!",
  2129. type: "warning",
  2130. });
  2131. }
  2132. } else {
  2133. // 非编辑状态
  2134. console.log("物料类别修改");
  2135. this.materialType.isEdit = true;
  2136. }
  2137. break;
  2138. // 刷新
  2139. default:
  2140. console.log("物料类别刷新");
  2141. if (this.materialType.isEdit) {
  2142. this.$notify({
  2143. title: "警告",
  2144. message: "请先保存数据!",
  2145. type: "warning",
  2146. });
  2147. } else {
  2148. this.materialType.loading = true;
  2149. this.getTagList("material_medcine_item", (form) => {
  2150. this.materialType.form = form;
  2151. this.getMedcineitemList(this.materialId);
  2152. });
  2153. }
  2154. break;
  2155. }
  2156. },
  2157. // 物料类别弹窗关闭前
  2158. handleCloseTypeDetails(done) {
  2159. console.log("物料类别弹窗关闭前");
  2160. this.materialType.isEdit
  2161. ? this.$notify({
  2162. title: "警告",
  2163. message: "请先保存数据!",
  2164. type: "warning",
  2165. })
  2166. : done();
  2167. },
  2168. // 保存修改并新增
  2169. handleSaveAdd() {
  2170. console.log("保存修改并新增");
  2171. },
  2172. // 其他标签页弹窗取消操作
  2173. handleOtherCancel() {
  2174. console.log("其他标签页弹窗取消操作");
  2175. this.optionDialog.show = true;
  2176. this.optionDialog.op = "修改";
  2177. },
  2178. // 其他标签页弹窗保存
  2179. async handleOtherSave() {
  2180. console.log("其他标签页弹窗保存", this.activeMainTab);
  2181. let data = this.otherDeatils.value;
  2182. console.log(data, "params");
  2183. switch (this.activeMainTab) {
  2184. // 财物信息
  2185. case "material_finance":
  2186. await this.handleSaveFinance(data);
  2187. break;
  2188. // 利润中心信息
  2189. case "profit_center":
  2190. await this.handleSaveCenter(data);
  2191. break;
  2192. // 采购信息
  2193. case "material_purchase":
  2194. await this.handleSavePurchase(data);
  2195. break;
  2196. // 库存信息
  2197. case "material_inventory":
  2198. await this.handleSaveInventoryEdit(data);
  2199. break;
  2200. // 计划信息
  2201. case "material_plan":
  2202. await this.handleSavePlan(data);
  2203. break;
  2204. // 成本信息
  2205. case "material_cost":
  2206. await this.handleSaveCost(data);
  2207. break;
  2208. default:
  2209. break;
  2210. }
  2211. // this.handleOtherRefresh();
  2212. },
  2213. // 其他页签详情弹窗关闭事件
  2214. handleCloseOtherDetails(done) {
  2215. console.log("其他页签详情弹窗关闭事件");
  2216. // 处于编辑状态
  2217. if (this.otherDeatils.isEdit) {
  2218. this.$notify({
  2219. title: "警告",
  2220. message: "请先退出编辑操作",
  2221. type: "warning",
  2222. });
  2223. } else {
  2224. this.handleOtherListRefresh();
  2225. done();
  2226. }
  2227. },
  2228. // 折叠菜单改变
  2229. handleCollapseChange(val) {
  2230. console.log(val, "折叠菜单改变");
  2231. },
  2232. // 更新导入
  2233. handleUpdateImport() {
  2234. console.log("更新导入");
  2235. },
  2236. // 确认弹窗操作
  2237. async handleComfirmOption() {
  2238. console.log("确认弹窗操作");
  2239. this.optionDialog.show = false;
  2240. // 取消基本信息修改
  2241. if (this.updateButtonGroup) {
  2242. this.updateButtonGroup = false;
  2243. // this.handleRest();
  2244. await this.getMaterialDetails(this.materialId, "material");
  2245. await this.getMedcineDetails(this.materialId, "material_medcine");
  2246. this.$refs.basicMessageRef.clearValidate();
  2247. this.$refs.medcineRef.clearValidate();
  2248. }
  2249. // 取消其他主页签详情弹窗修改
  2250. if (this.otherDeatils.isEdit) {
  2251. this.otherDeatils.isEdit = false;
  2252. this.handleOtherRefresh();
  2253. }
  2254. // 取消维护新版本修改
  2255. if (this.maintainNewVersion) {
  2256. console.log("取消维护新版本修改");
  2257. this.maintainNewVersion = false;
  2258. this.handleRefresh();
  2259. }
  2260. },
  2261. handleClear() {
  2262. this.MoreDataDialog.key = "";
  2263. this.handleFilterRefer();
  2264. },
  2265. // 参照弹窗过滤
  2266. handleFilterRefer() {
  2267. // this.MoreDataDialog.key =
  2268. console.log(
  2269. this.MoreDataDialog.key,
  2270. "查询关键字",
  2271. this.MoreDataDialog.target
  2272. );
  2273. this.handleQueryMore(
  2274. this.MoreDataDialog.msg,
  2275. this.MoreDataDialog.key,
  2276. this.MoreDataDialog.target
  2277. );
  2278. },
  2279. // 操作提示弹窗关闭
  2280. handleOptionCancal() {
  2281. this.optionDialog.show = false;
  2282. this.otherDeatils.isEdit = true;
  2283. },
  2284. // 树形节点选择
  2285. handleNodeClick(e) {
  2286. console.log(e, "树形节点选择", this.MoreDataDialog.target);
  2287. // let node = { ...e, name: e.label }
  2288. this.MoreDataDialog.value = e;
  2289. },
  2290. // 修改-更多数据表格——选择行
  2291. handleCurentRow(row) {
  2292. console.log(row, "修改-更多数据表格——选择行");
  2293. this.MoreDataDialog.value = row;
  2294. },
  2295. handleDbClick(row) {
  2296. this.MoreDataDialog.value = row;
  2297. this.handleConfirmRefer();
  2298. },
  2299. // 参照弹窗确认
  2300. handleConfirmRefer() {
  2301. let _this = this;
  2302. console.log(
  2303. "确认参照弹窗",
  2304. `{this.${this.MoreDataDialog.target.name}:${this.MoreDataDialog.value.id}}`
  2305. );
  2306. let confirm = true;
  2307. if (this.MoreDataDialog.target.name == "basicData") {
  2308. // 基本信息
  2309. this.basicData.value[this.MoreDataDialog.target.prop] =
  2310. this.MoreDataDialog.value.id;
  2311. this.basicData.value[`${this.MoreDataDialog.target.prop}Name`] =
  2312. this.MoreDataDialog.value.name;
  2313. console.log(
  2314. this.MoreDataDialog.target.prop,
  2315. "props-----------------",
  2316. this.MoreDataDialog.value
  2317. );
  2318. console.log(
  2319. this.basicData.value[`${this.MoreDataDialog.target.prop}`],
  2320. "值",
  2321. this.basicData.value[`${this.MoreDataDialog.target.prop}Name`],
  2322. "//////////基本信息///////////"
  2323. );
  2324. // 默认采购组织:purchasingOrganization 业务部门:businessDepartment
  2325. if (this.MoreDataDialog.target.prop == "purchasingOrganization") {
  2326. this.basicData.value["businessDepartment"] = "";
  2327. this.basicData.value["businessDepartmentName"] = "";
  2328. }
  2329. // 物料税类materialRate
  2330. if (this.MoreDataDialog.target.prop == "materialRate") {
  2331. this.basicData.value["rateCode"] = this.MoreDataDialog.value.code;
  2332. }
  2333. } else if (this.MoreDataDialog.target.name == "medcineData") {
  2334. // 医药信息
  2335. this.medcineData.value[this.MoreDataDialog.target.prop] =
  2336. this.MoreDataDialog.value.id;
  2337. this.medcineData.value[`${this.MoreDataDialog.target.prop}Name`] =
  2338. this.MoreDataDialog.value.name;
  2339. console.log(
  2340. this.MoreDataDialog.target.prop,
  2341. "props-----------------",
  2342. this.MoreDataDialog.value
  2343. );
  2344. console.log(
  2345. this.medcineData.value[`${this.MoreDataDialog.target.prop}Name`],
  2346. "//////医药信息//////////"
  2347. );
  2348. } else if (this.MoreDataDialog.target.name == "otherDeatils") {
  2349. // 其他页签
  2350. this.otherDeatils.value[this.MoreDataDialog.target.prop] =
  2351. this.MoreDataDialog.value.id;
  2352. this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Name`] =
  2353. this.MoreDataDialog.value.name;
  2354. console.log(
  2355. this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Name`],
  2356. "/////////其他页签///////"
  2357. );
  2358. } else if (this.MoreDataDialog.target.name == "materialType") {
  2359. // 物料类别
  2360. console.log("确认时选择的数据", this.MoreDataDialog.value);
  2361. this.materialType.value = this.materialType.value.map((m) => {
  2362. if (
  2363. (m.id &&
  2364. m.id != "" &&
  2365. m.id == _this.MoreDataDialog.target.prop["id"]) ||
  2366. (m.insertId &&
  2367. m.insertId == _this.MoreDataDialog.target.prop["insertId"])
  2368. ) {
  2369. let drug = _this.materialType.value.filter(
  2370. (d) => d.drugId == _this.MoreDataDialog.value["id"]
  2371. );
  2372. console.log(drug, "drug------------------------------------");
  2373. if (drug.length) {
  2374. _this.$notify({
  2375. title: "警告",
  2376. message: "不能维护相同的物料类别!",
  2377. type: "warning",
  2378. });
  2379. confirm = false;
  2380. } else {
  2381. m.drugId = _this.MoreDataDialog.value["id"];
  2382. m.drugCode = _this.MoreDataDialog.value["code"];
  2383. m.drugName = _this.MoreDataDialog.value["name"];
  2384. }
  2385. }
  2386. return m;
  2387. });
  2388. console.log(
  2389. this.materialType.value,
  2390. "修改之后-----this.materialType.value"
  2391. );
  2392. }
  2393. if (confirm) {
  2394. // this.count++;
  2395. this.refer++;
  2396. this.MoreDataDialog.show = false;
  2397. this.MoreDataDialog.key = "";
  2398. this.MoreDataDialog.value = {};
  2399. }
  2400. },
  2401. // 取消-关闭参照弹窗
  2402. handleConcalRefer() {
  2403. console.log("关闭参照弹窗");
  2404. this.MoreDataDialog.show = false;
  2405. this.MoreDataDialog.key = "";
  2406. },
  2407. // 关闭参照弹窗前
  2408. handleCloseRefer(done) {
  2409. this.MoreDataDialog.key = "";
  2410. done();
  2411. },
  2412. // 删除利润中心信息
  2413. handledDelCenter(ids) {
  2414. console.log("删除利润中心信息");
  2415. materialApi.delCenter(ids).then((res) => {
  2416. if (res.code == 200) {
  2417. this.handleOtherListRefresh();
  2418. }
  2419. });
  2420. },
  2421. // 删除库存信息
  2422. handleDelInventory(ids) {
  2423. console.log("删除库存信息");
  2424. materialApi.delInventory(ids).then((res) => {
  2425. if (res.code == 200) {
  2426. this.handleOtherListRefresh();
  2427. }
  2428. });
  2429. },
  2430. // 删除成本信息
  2431. handleDelCost(ids) {
  2432. console.log("删除成本信息");
  2433. materialApi.delCost(ids).then((res) => {
  2434. if (res.code == 200) {
  2435. this.handleOtherListRefresh();
  2436. }
  2437. });
  2438. },
  2439. // 删除计划信息
  2440. handleDelPlan(ids) {
  2441. console.log("删除计划信息");
  2442. materialApi.delPlan(ids).then((res) => {
  2443. if (res.code == 200) {
  2444. this.handleOtherListRefresh();
  2445. }
  2446. });
  2447. },
  2448. // 删除财物信息
  2449. handleDelFinance(ids) {
  2450. console.log("删除财物信息");
  2451. materialApi.delFinance(ids).then((res) => {
  2452. if (res.code == 200) {
  2453. this.handleOtherListRefresh();
  2454. }
  2455. });
  2456. },
  2457. // 删除采购信息
  2458. handledelPurchase(ids) {
  2459. console.log("删除采购信息");
  2460. materialApi.delPurchase(ids).then((res) => {
  2461. if (res.code == 200) {
  2462. this.handleOtherListRefresh();
  2463. }
  2464. });
  2465. },
  2466. // 保存物料以及相关页签
  2467. handleSaveMaterial(cb) {
  2468. let param = {
  2469. ...this.basicData.value,
  2470. materialMedcine: this.medcineData.value,
  2471. materialMedcineItem: {},
  2472. };
  2473. // diCode
  2474. param.diCode = param.diCode && param.diCode.replace(/ /g, "");
  2475. console.log(param, "保存物料以及相关页签param");
  2476. materialApi
  2477. .insertMaterialInfo(param)
  2478. .then((res) => {
  2479. console.log(res, "保存物料以及相关页签");
  2480. if (res.code == 200) cb();
  2481. })
  2482. .catch((error) => {
  2483. this.loading = false;
  2484. });
  2485. },
  2486. // 保存财务信息——单个数据
  2487. async handleSaveFinance(data) {
  2488. console.log(data, "保存财务信息——单个数据");
  2489. try {
  2490. this.otherDeatils.loading = true;
  2491. let { code, msg } = await materialApi.financeEdit(data);
  2492. if (code == 200) {
  2493. this.otherDeatils.isEdit = false;
  2494. this.handleOtherRefresh();
  2495. this.$notify({
  2496. title: "成功",
  2497. message: msg,
  2498. type: "success",
  2499. });
  2500. }
  2501. } catch (error) {
  2502. } finally {
  2503. this.otherDeatils.loading = false;
  2504. }
  2505. // this.otherDeatils.loading = true;
  2506. // materialApi.financeEdit(data).then(res => {
  2507. // if (res.code == 200) {
  2508. // this.otherDeatils.isEdit = false;
  2509. // this.handleOtherRefresh();
  2510. // }
  2511. // this.otherDeatils.loading = false;
  2512. // })
  2513. },
  2514. // 保存利润中心信息
  2515. async handleSaveCenter(data) {
  2516. console.log(data, "保存利润中心信息");
  2517. try {
  2518. this.otherDeatils.loading = true;
  2519. let { code, msg } = await materialApi.centerEdit(data);
  2520. if (code == 200) {
  2521. this.otherDeatils.isEdit = false;
  2522. this.handleOtherRefresh();
  2523. this.$notify({
  2524. title: "成功",
  2525. message: msg,
  2526. type: "success",
  2527. });
  2528. }
  2529. } catch (error) {
  2530. } finally {
  2531. this.otherDeatils.loading = false;
  2532. }
  2533. // materialApi.centerEdit(data).then(res => {
  2534. // if (res.code == 200) {
  2535. // this.otherDeatils.isEdit = false;
  2536. // this.handleOtherRefresh();
  2537. // }
  2538. // })
  2539. },
  2540. // 保存采购信息
  2541. async handleSavePurchase(data) {
  2542. console.log(data, "保存采购信息");
  2543. try {
  2544. this.otherDeatils.loading = true;
  2545. let { code, msg } = await materialApi.purchaseEdit(data);
  2546. if (code == 200) {
  2547. this.otherDeatils.isEdit = false;
  2548. this.handleOtherRefresh();
  2549. this.$notify({
  2550. title: "成功",
  2551. message: msg,
  2552. type: "success",
  2553. });
  2554. }
  2555. } catch (error) {
  2556. } finally {
  2557. this.otherDeatils.loading = false;
  2558. }
  2559. // materialApi.purchaseEdit(data).then(res => {
  2560. // if (res.code == 200) {
  2561. // this.otherDeatils.isEdit = false;
  2562. // this.handleOtherRefresh();
  2563. // }
  2564. // })
  2565. },
  2566. // 保存库存信息
  2567. async handleSaveInventoryEdit(data) {
  2568. console.log(data, "保存库存信息");
  2569. try {
  2570. this.otherDeatils.loading = true;
  2571. let { code, msg } = await materialApi.inventoryEdit(data);
  2572. if (code == 200) {
  2573. this.otherDeatils.isEdit = false;
  2574. this.handleOtherRefresh();
  2575. this.$notify({
  2576. title: "成功",
  2577. message: msg,
  2578. type: "success",
  2579. });
  2580. }
  2581. } catch (error) {
  2582. } finally {
  2583. this.otherDeatils.loading = false;
  2584. }
  2585. // materialApi.inventoryEdit(data).then(res => {
  2586. // if (res.code == 200) {
  2587. // this.otherDeatils.isEdit = false;
  2588. // this.handleOtherRefresh();
  2589. // }
  2590. // })
  2591. },
  2592. // 保存计划信息
  2593. async handleSavePlan(data) {
  2594. console.log(data, "保存计划信息");
  2595. try {
  2596. this.otherDeatils.loading = true;
  2597. let { code, msg } = await materialApi.planEdit(data);
  2598. if (code == 200) {
  2599. this.otherDeatils.isEdit = false;
  2600. this.handleOtherRefresh();
  2601. this.$notify({
  2602. title: "成功",
  2603. message: msg,
  2604. type: "success",
  2605. });
  2606. }
  2607. } catch (error) {
  2608. } finally {
  2609. this.otherDeatils.loading = false;
  2610. }
  2611. // materialApi.planEdit(data).then(res => {
  2612. // if (res.code == 200) {
  2613. // this.otherDeatils.isEdit = false;
  2614. // this.handleOtherRefresh();
  2615. // }
  2616. // })
  2617. },
  2618. // 保存成本信息
  2619. async handleSaveCost(data) {
  2620. console.log(data, "保存成本信息");
  2621. try {
  2622. this.otherDeatils.loading = true;
  2623. let { code, msg } = await materialApi.costEdit(data);
  2624. if (code == 200) {
  2625. this.otherDeatils.isEdit = false;
  2626. this.handleOtherRefresh();
  2627. this.$notify({
  2628. title: "成功",
  2629. message: msg,
  2630. type: "success",
  2631. });
  2632. }
  2633. } catch (error) {
  2634. } finally {
  2635. this.otherDeatils.loading = false;
  2636. }
  2637. // materialApi.costEdit(data).then(res => {
  2638. // if (res.code == 200) {
  2639. // this.otherDeatils.isEdit = false;
  2640. // this.handleOtherRefresh();
  2641. // }
  2642. // })
  2643. },
  2644. judgeIsRequriedByProps(message) {
  2645. // condiition:条件,tergetNames:目标porps数组,formName:表单,formRef:表单ref名,
  2646. this[message.formName].form.forEach((formItem) => {
  2647. let target = message.tergetNames.filter((t) => t === formItem.prop);
  2648. if (target && target.length) {
  2649. formItem.required = message.condiition ? false : true;
  2650. }
  2651. });
  2652. this.rules = initRules(this[message.formName].form);
  2653. this.$nextTick(() => {
  2654. message.condiition &&
  2655. this.$refs[message.formRef].clearValidate(message.tergetNames);
  2656. });
  2657. },
  2658. // 重新加载
  2659. async handleRest() {
  2660. this.loading = true;
  2661. // 基本信息
  2662. await this.getTagList("material", async (form) => {
  2663. this.basicData.form = [...form];
  2664. this.rules = initRules(form);
  2665. this.basicData.value = initParams(this.basicData.form, "prop");
  2666. await this.getMaterialDetails(this.materialId, "material");
  2667. });
  2668. // 医疗行业
  2669. await this.getTagList("material_medcine", async (form) => {
  2670. // form.forEach((item) => {
  2671. // this.medcineData.value[item.prop] = ''
  2672. // })
  2673. this.medcineData.form = [...form];
  2674. this.medcineData.value = initParams(this.medcineData.form, "prop");
  2675. this.medcineRules = initRules(form);
  2676. await this.getMedcineDetails(this.materialId, "material_medcine");
  2677. });
  2678. },
  2679. },
  2680. watch: {
  2681. // 监听主标签修改标识,控制其他标签是否禁止点击
  2682. updateButtonGroup: function (nVal, oVal) {
  2683. console.log(nVal, "nVal", oVal, "oVal");
  2684. this.detailsTabs = this.detailsTabs.map((item) => {
  2685. item["disabled"] = nVal;
  2686. return item;
  2687. });
  2688. },
  2689. maintainNewVersion: function (nVal, oVal) {
  2690. console.log(nVal, "nVal", oVal, "oVal");
  2691. this.detailsTabs = this.detailsTabs.map((item) => {
  2692. item["disabled"] = nVal;
  2693. return item;
  2694. });
  2695. },
  2696. "basicData.value.isMedicine": {
  2697. handler(nVal, oVal) {
  2698. this.basicData.form = this.basicData.form.map((formItem) => {
  2699. if (formItem.prop === "productionPermit") {
  2700. formItem.required = nVal == "0" ? true : false;
  2701. }
  2702. return formItem;
  2703. });
  2704. },
  2705. deep: true,
  2706. },
  2707. // 通过一级分类判断业务线是否必填
  2708. // "basicData.value.oneClass": {
  2709. // handler(nVal, oVal) {
  2710. // this.basicData.form = this.basicData.form.map(formItem => {
  2711. // if (formItem.prop === "businessLine" && nVal) {
  2712. // if ( nVal.includes('介入耗材&5') || nVal.includes('骨科耗材&2') ||
  2713. // nVal.includes('普通耗材&3') || nVal.includes('医用设备&1') ||
  2714. // nVal.includes('体外诊断&4')) {
  2715. // formItem.required = true
  2716. // } else {
  2717. // formItem.required = false
  2718. // }
  2719. // }
  2720. // return formItem;
  2721. // })
  2722. // },
  2723. // deep: true,
  2724. // },
  2725. // 物料分类改变同时改变一二三级分类
  2726. "basicData.value.classifyId": {
  2727. async handler(nVal, oVal) {
  2728. if (nVal !== oVal) {
  2729. try {
  2730. let { code, data } = await getDetail(nVal);
  2731. if (code == 200) {
  2732. let { oneClass, twoClass, threeClass } = data;
  2733. this.basicData.value["oneClass"] = oneClass;
  2734. this.basicData.value["twoClass"] = twoClass;
  2735. this.basicData.value["threeClass"] = threeClass;
  2736. }
  2737. } catch (error) {}
  2738. }
  2739. },
  2740. deep: true,
  2741. },
  2742. // 效期管理 expiryDateManagerment 控制 expiryUnitId 效期单位 usefulLife 有效期 usefulLifeUnitId 有效期至单位 必填
  2743. "basicData.value.expiryDateManagerment": {
  2744. handler(nVal, oVal) {
  2745. this.judgeIsRequriedByProps({
  2746. condiition: nVal === "2",
  2747. tergetNames: [
  2748. "expiryUnitId",
  2749. "usefulLife",
  2750. "usefulLifeUnitId",
  2751. "recentWarningPeriod",
  2752. ],
  2753. formName: "basicData",
  2754. formRef: "basicMessageRef",
  2755. });
  2756. },
  2757. deep: true,
  2758. },
  2759. },
  2760. created() {
  2761. console.log(this, "created");
  2762. // 基本信息
  2763. this.handleRest();
  2764. if (window.name === "") {
  2765. this.$route.query.isEdit && this.handleBasicEdit();
  2766. } else {
  2767. console.log("页面被刷新");
  2768. }
  2769. },
  2770. };
  2771. </script>
  2772. <style lang="scss">
  2773. .material-details {
  2774. padding: 12px;
  2775. height: 100%;
  2776. // height: calc(100vh - 158px);
  2777. box-sizing: border-box;
  2778. .el-card__body {
  2779. height: calc(100vh - 40px);
  2780. // height: 100%;
  2781. box-sizing: border-box;
  2782. padding: 12px;
  2783. overflow-y: auto;
  2784. overflow-x: auto;
  2785. .el-select {
  2786. width: 100%;
  2787. }
  2788. }
  2789. .md-content {
  2790. // margin-top: 12px;
  2791. // height: calc(100vh - 260px);
  2792. // height: calc(100vh - 200px);
  2793. box-sizing: border-box;
  2794. .md-basic {
  2795. overflow: auto;
  2796. .md-main {
  2797. // height: calc(100vh - 625px);
  2798. margin-bottom: 10px;
  2799. .el-table__body {
  2800. // height: calc(100vh - 300px);
  2801. }
  2802. .el-form {
  2803. max-height: 430px;
  2804. overflow-y: auto;
  2805. overflow-x: hidden;
  2806. .redSpan::before {
  2807. content: "* ";
  2808. color: red;
  2809. }
  2810. .el-checkbox {
  2811. padding: 0 58%;
  2812. }
  2813. }
  2814. }
  2815. .md-vice-content {
  2816. height: 140px;
  2817. overflow-y: auto;
  2818. overflow-x: hidden;
  2819. }
  2820. }
  2821. .md-auditInfo {
  2822. .el-divider--horizontal {
  2823. margin: 20px 0px 15px;
  2824. }
  2825. }
  2826. }
  2827. // .md-content>.el-tabs {
  2828. // height: calc(100vh - 280px);
  2829. // }
  2830. .otherDialog {
  2831. .el-collapse-item__content {
  2832. padding-bottom: 12px;
  2833. }
  2834. .el-form {
  2835. .el-checkbox {
  2836. width: 100%;
  2837. padding: 0 10%;
  2838. }
  2839. }
  2840. .el-dialog__body {
  2841. padding: 12px 20px;
  2842. height: 80%;
  2843. overflow: auto;
  2844. }
  2845. .od-msg {
  2846. max-height: 220px;
  2847. box-sizing: border-box;
  2848. overflow-y: auto;
  2849. overflow-x: hidden;
  2850. }
  2851. // .el-dialog__header {
  2852. // background-color: rgb(244, 244, 244);
  2853. // }
  2854. }
  2855. .el-dialog__header {
  2856. background-color: rgb(244, 244, 244);
  2857. }
  2858. .MoreDataDialog {
  2859. .el-dialog__body {
  2860. height: 500px;
  2861. padding: 20px 15px;
  2862. .el-table {
  2863. margin-top: 10px;
  2864. .el-table__body-wrapper {
  2865. height: 300px;
  2866. overflow-y: auto;
  2867. overflow-x: hidden;
  2868. }
  2869. }
  2870. .el-pagination {
  2871. text-align: right;
  2872. margin-top: 5px;
  2873. }
  2874. .referTree {
  2875. height: 390px;
  2876. overflow-x: hidden;
  2877. overflow-y: auto;
  2878. }
  2879. }
  2880. .more-button {
  2881. margin-top: 10px;
  2882. text-align: right;
  2883. }
  2884. }
  2885. }
  2886. // 修改下拉框样式
  2887. #selected {
  2888. /*很关键:将默认的select选择框样式清除*/
  2889. // appearance: none;
  2890. // -moz-appearance: none;
  2891. // -webkit-appearance: none;
  2892. // /*为下拉小箭头留出一点位置,避免被文字覆盖*/
  2893. // padding-right: 14px;
  2894. // /*自定义图片*/
  2895. // background: url("../images/search@2x.png") no-repeat scroll right center transparent;
  2896. // /*自定义图片的大小*/
  2897. // background-size: 16px 16px;
  2898. // /*将小箭头的样式去去掉*/
  2899. // .el-icon-arrow-up:before {
  2900. // content: '';
  2901. // }
  2902. // }
  2903. }
  2904. </style>
  2905. <style scoped>
  2906. .md-content >>> .el-form-item,
  2907. .otherDialog >>> .el-form-item {
  2908. margin-bottom: 0px;
  2909. }
  2910. .md-content >>> .el-tabs--border-card > .el-tabs__content {
  2911. padding-bottom: 8px;
  2912. }
  2913. .md-content .md-auditInfo >>> .el-form-item {
  2914. margin-bottom: 0px;
  2915. }
  2916. .md-main >>> .el-form-item,
  2917. .md-vice >>> .el-form-item,
  2918. .od-msg >>> .el-form-item {
  2919. width: 100%;
  2920. box-sizing: border-box;
  2921. }
  2922. .md-main >>> .el-form-item__label,
  2923. .md-vice >>> .el-form-item__label,
  2924. .od-msg >>> .el-form-item__label {
  2925. width: 40%;
  2926. }
  2927. .od-msg >>> .el-checkbox__input {
  2928. width: 15%;
  2929. }
  2930. .md-main >>> .el-form-item__content,
  2931. .md-vice >>> .el-form-item__content,
  2932. .od-msg >>> .el-form-item__content {
  2933. width: 60%;
  2934. box-sizing: border-box;
  2935. height: 36px;
  2936. }
  2937. .od-msg >>> .el-checkbox__label {
  2938. width: 85%;
  2939. box-sizing: border-box;
  2940. }
  2941. .od-msg-checkedbx >>> .el-form-item__content {
  2942. width: 80%;
  2943. box-sizing: border-box;
  2944. }
  2945. .od-msg-checkedbx >>> .el-checkbox {
  2946. width: 75%;
  2947. box-sizing: border-box;
  2948. }
  2949. .md-content >>> .el-form-item__label,
  2950. .otherDialog >>> .el-form-item__label,
  2951. .od-msg >>> .el-form-item__label,
  2952. .od-msg >>> .el-checkbox__label {
  2953. font-weight: normal;
  2954. /* text-align: left;
  2955. width: 28%; */
  2956. white-space: nowrap;
  2957. /* IE6 需要定义宽度 */
  2958. overflow: hidden;
  2959. -o-text-overflow: ellipsis;
  2960. /* Opera */
  2961. text-overflow: ellipsis;
  2962. /* IE, Safari (WebKit) */
  2963. /* -moz-binding: url('ellipsis.xml#ellipsis'); */
  2964. /* Firefox */
  2965. }
  2966. .otherDialog >>> .el-form-item__label {
  2967. font-size: 12px;
  2968. }
  2969. .md-main >>> .material-table {
  2970. height: 100%;
  2971. }
  2972. .md-vice >>> .material-table {
  2973. height: 140px;
  2974. overflow-y: auto;
  2975. overflow-x: auto;
  2976. }
  2977. >>> .referTree {
  2978. margin-top: 10px;
  2979. }
  2980. /* .md-main>>>.el-table .el-table__body {
  2981. height: calc(100vh - 300px);
  2982. } */
  2983. /* .otherDialog>>>.el-collapse-item__content {
  2984. padding-bottom: 12px;
  2985. }
  2986. .otherDialog>>>.el-dialog__body {
  2987. padding: 12px 20px;
  2988. } */
  2989. </style>