details.vue 77 KB

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