details.vue 83 KB

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