details.vue 83 KB

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