details.vue 87 KB

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