details.vue 81 KB

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