details.vue 77 KB

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