details.vue 83 KB

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