details.vue 85 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709
  1. <!-- 物料信息基础档案——详情 -->
  2. <template>
  3. <el-drawer
  4. :show-close="false"
  5. size="100%"
  6. :visible.sync="visible"
  7. append-to-body
  8. destroy-on-close
  9. @close="onHide"
  10. @open="onOpen"
  11. >
  12. <div class="material-details" v-loading="loading">
  13. <!-- 操作栏 -->
  14. <el-card>
  15. <!-- 基本信息栏 -->
  16. <div style="display: flex; justify-content: end">
  17. <div v-if="activeMainTab == 'material'">
  18. <!-- 基本信息修改状态下—— 保存、保存新增、更新导入、取消 -->
  19. <el-row
  20. v-if="updateButtonGroup || maintainNewVersion"
  21. :gutter="10"
  22. class="mb10"
  23. type="flex"
  24. justify="end"
  25. >
  26. <el-col :span="1.5">
  27. <el-button-group>
  28. <el-button
  29. :size="size"
  30. @click="handleSave"
  31. v-hasPermi="[
  32. 'system:material:add',
  33. `${maintainNewVersion ? '' : 'system:material:versions'}`,
  34. ]"
  35. >
  36. 保存
  37. </el-button>
  38. </el-button-group>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button-group>
  42. <el-button :size="size" @click="handleCancel">取消</el-button>
  43. </el-button-group>
  44. </el-col>
  45. </el-row>
  46. <el-row v-else :gutter="10" class="mb10" type="flex" justify="end">
  47. <!-- 新增、修改、删除、复制 -->
  48. <el-col :span="1.5">
  49. <el-button-group>
  50. <el-button :size="size" @click="handleBasicEdit"
  51. >修改</el-button
  52. >
  53. </el-button-group>
  54. </el-col>
  55. <!-- 查询、刷新、过滤 -->
  56. <el-col :span="1.5">
  57. <el-button-group>
  58. <el-button :size="size" @click="handleRefresh"
  59. >刷新</el-button
  60. >
  61. </el-button-group>
  62. </el-col>
  63. <!-- 维护物料类别 -->
  64. <el-col :span="1.5">
  65. <whlbButton :data="selectData" :size="size"></whlbButton>
  66. </el-col>
  67. <!-- 启用 -->
  68. <el-col :span="1.5">
  69. <is-using
  70. :size="size"
  71. :select-data="basicData.value"
  72. @success="handleRefresh"
  73. ></is-using>
  74. </el-col>
  75. <!-- 维护新版本 -->
  76. <!-- <el-col :span="1.5">
  77. <el-button-group>
  78. <el-button
  79. :size="size"
  80. @click="handleNewVersion"
  81. v-hasPermi="['system:material:versions']"
  82. >维护新版本
  83. </el-button>
  84. </el-button-group>
  85. </el-col> -->
  86. </el-row>
  87. </div>
  88. <!-- 其他标签页操作 修改、删除 -->
  89. <el-row
  90. :gutter="10"
  91. class="mb10"
  92. v-show="activeMainTab != 'material'"
  93. type="flex"
  94. justify="end"
  95. >
  96. <el-col :span="1.5">
  97. <el-button-group>
  98. <el-button :size="size" @click="handleOtherEdit('table')"
  99. >修改</el-button
  100. >
  101. <el-button
  102. :size="size"
  103. v-show="activeMainTab != 'material_finance'"
  104. @click="handleOtherDel"
  105. >删除</el-button
  106. >
  107. </el-button-group>
  108. <el-button-group>
  109. <el-button :size="size" @click="handleOtherListRefresh"
  110. >刷新</el-button
  111. >
  112. </el-button-group>
  113. </el-col>
  114. </el-row>
  115. <!-- 返回 切换 附件管理 -->
  116. <el-row type="flex" justify="space-between">
  117. <el-col :span="6">
  118. <!-- :disabled="headerParam.isEdit" -->
  119. <el-button
  120. :size="size"
  121. @click="handleBack"
  122. :disabled="updateButtonGroup"
  123. >返回</el-button
  124. >
  125. </el-col>
  126. <el-col :span="6" style="text-align: right"> </el-col>
  127. </el-row>
  128. </div>
  129. <div class="md-content" :key="basicData.value.id">
  130. <el-form
  131. :inline="true"
  132. label-position="right"
  133. :model="basicData.value"
  134. >
  135. <el-form-item label="物料编码">
  136. <el-input
  137. v-model="basicData.value.code"
  138. readonly
  139. size="mini"
  140. ></el-input>
  141. </el-form-item>
  142. <el-form-item label="物料名称">
  143. <el-input
  144. v-model="basicData.value.name"
  145. readonly
  146. size="mini"
  147. ></el-input>
  148. </el-form-item>
  149. <el-form-item label="英文名称">
  150. <el-input
  151. v-model="basicData.value.enName"
  152. readonly
  153. size="mini"
  154. ></el-input>
  155. </el-form-item>
  156. </el-form>
  157. <dr-tabs :tabList="detailsTabs" :handleTabClick="handleMainTabClick">
  158. <template #tabContent>
  159. <div class="md-basic" :key="count">
  160. <!-- 主信息 -->
  161. <div class="md-main">
  162. <!-- 基本信息展示表单 -->
  163. <el-form
  164. v-if="activeMainTab == 'material'"
  165. :inline="true"
  166. label-position="right"
  167. :model="basicData.value"
  168. :key="basicData.value.id"
  169. ref="basicMessageRef"
  170. :rules="rules"
  171. >
  172. <el-row :gutter="10">
  173. <el-col
  174. :span="6"
  175. v-for="f in basicData.form"
  176. style="text-align: right"
  177. >
  178. <template v-if="f.show">
  179. <!-- 多选框 -->
  180. <el-form-item
  181. v-if="f.attribute == 'checkbox'"
  182. style="text-align: left"
  183. :prop="f.prop"
  184. :key="f.required"
  185. >
  186. <el-checkbox
  187. :label="f.name"
  188. name="type"
  189. v-model="basicData.value[f.prop]"
  190. true-label="0"
  191. false-label="2"
  192. :disabled="handleJudge(f)"
  193. size="mini"
  194. >
  195. </el-checkbox>
  196. </el-form-item>
  197. <!-- 下拉框 -->
  198. <el-form-item
  199. v-else-if="f.attribute == 'select'"
  200. :id="
  201. updateButtonGroup && f.apiUrl ? 'selected' : ''
  202. "
  203. :prop="f.apiUrl ? `${f.prop}Name` : f.prop"
  204. :key="f.required"
  205. :rules="[
  206. {
  207. required: f.required,
  208. message: `请选择${f.name}`,
  209. trigger: 'change',
  210. },
  211. ]"
  212. >
  213. <template slot="label">
  214. <el-tooltip
  215. class="item"
  216. effect="dark"
  217. placement="top-start"
  218. :disabled="f.name.length < 10"
  219. >
  220. <!-- <span :class="(f.apiUrl && f.required) ? 'redSpan': ''">{{ f.name }}</span> -->
  221. <span>{{ f.name }}</span>
  222. <div slot="content">
  223. <p>{{ f.name }}</p>
  224. </div>
  225. </el-tooltip>
  226. </template>
  227. <!-- 参照 -->
  228. <el-select
  229. v-if="f.apiUrl"
  230. v-model="basicData.value[`${f.prop}Name`]"
  231. placeholder="请选择"
  232. size="mini"
  233. :key="basicData.value[f.prop]"
  234. :disabled="handleJudge(f)"
  235. @focus="
  236. f.apiUrl &&
  237. handleQueryMore(f, '', {
  238. name: 'basicData',
  239. prop: f.prop,
  240. })
  241. "
  242. >
  243. <div slot="empty"></div>
  244. </el-select>
  245. <!-- 字典 -->
  246. <el-select
  247. v-if="f.dictId"
  248. v-model="basicData.value[f.prop]"
  249. placeholder="请选择"
  250. size="mini"
  251. :key="basicData.value[f.prop]"
  252. :disabled="handleJudge(f)"
  253. >
  254. <el-option
  255. v-if="f.dictId"
  256. v-for="d in f.dictValue"
  257. :key="d.dictValue"
  258. :label="d.dictLabel"
  259. :value="d.dictValue"
  260. >
  261. </el-option>
  262. </el-select>
  263. </el-form-item>
  264. <!-- 图片 -->
  265. <el-form-item
  266. v-else-if="f.attribute == 'image'"
  267. :label="f.name"
  268. @clicks="handleUpImage"
  269. >
  270. <el-image
  271. :src="basicData.value[f.prop]"
  272. fit="contain"
  273. ></el-image>
  274. <!-- <img :src="basicData.value[f.prop]" @clicks="handleUpImage" alt="加载失败"> -->
  275. </el-form-item>
  276. <!--attribute 文本 数字 文本域 为null -->
  277. <el-form-item v-else :prop="f.prop" :key="f.required">
  278. <template slot="label">
  279. <el-tooltip
  280. class="item"
  281. effect="dark"
  282. placement="top-start"
  283. :disabled="f.name.length < 10"
  284. >
  285. <span>{{ f.name }}</span>
  286. <div slot="content">
  287. <p>{{ f.name }}</p>
  288. </div>
  289. </el-tooltip>
  290. </template>
  291. <el-input
  292. size="mini"
  293. v-model="basicData.value[f.prop]"
  294. :type="f.attribute || 'text'"
  295. :readonly="handleJudge(f)"
  296. :rows="1"
  297. :maxlength="judgeMaxLength(f.prop)"
  298. ></el-input>
  299. </el-form-item>
  300. </template>
  301. </el-col>
  302. </el-row>
  303. </el-form>
  304. <!-- 其他展示为列表 -->
  305. <el-table
  306. v-else
  307. border
  308. :data="mainMsg.value"
  309. @cell-dblclick="handleMaindbClick"
  310. @selection-change="handleMainChange"
  311. >
  312. <el-table-column type="selection" width="55" />
  313. <el-table-column
  314. type="index"
  315. v-if="mainMsg.form.length"
  316. label="序号"
  317. width="55"
  318. align="center"
  319. />
  320. <el-table-column
  321. v-for="m in mainMsg.form"
  322. v-if="m.show"
  323. :label="m.name"
  324. align="center"
  325. :prop="m.attribute == 'select' ? `${m.prop}Name` : m.prop"
  326. show-overflow-tooltip
  327. >
  328. <template slot-scope="scope">
  329. {{
  330. m.attribute == "select"
  331. ? scope.row[`${m.prop}Name`]
  332. : m.attribute == "checkbox"
  333. ? scope.row[m.prop] == "0"
  334. ? "√"
  335. : ""
  336. : scope.row[m.prop]
  337. }}
  338. </template>
  339. </el-table-column>
  340. </el-table>
  341. </div>
  342. <!-- 副信息 -->
  343. <div class="md-vice">
  344. <dr-tabs
  345. v-if="activeMainTab == 'material'"
  346. :tabList="basicMessage"
  347. :handleTabClick="handleViceTabClick"
  348. >
  349. <template #tabContent>
  350. <el-form
  351. v-if="activeViceTab == 'material_medcine'"
  352. :inline="true"
  353. label-position="right"
  354. ref="medcineRef"
  355. :model="medcineData.value"
  356. class="md-vice-content"
  357. :rules="medcineRules"
  358. :key="medcineData.value.id"
  359. >
  360. <el-row :gutter="10">
  361. <el-col
  362. :span="6"
  363. v-for="m in medcineData.form"
  364. style="text-align: right"
  365. >
  366. <!-- 需要根据基本信息中的是否医药物料字段判断是否可以填写 -->
  367. <template v-if="m.show">
  368. <!-- 多选框 -->
  369. <el-form-item
  370. v-if="m.attribute == 'checkbox'"
  371. :prop="m.prop"
  372. >
  373. <el-checkbox
  374. :label="m.name"
  375. name="type"
  376. v-model="medcineData.value[m.prop]"
  377. size="mini"
  378. :disabled="
  379. !(
  380. updateButtonGroup &&
  381. m.edit &&
  382. basicData.value.isMedicine == '0'
  383. )
  384. "
  385. true-label="0"
  386. false-label="2"
  387. >
  388. </el-checkbox>
  389. </el-form-item>
  390. <!-- 下拉框 -->
  391. <el-form-item
  392. v-else-if="m.attribute == 'select'"
  393. :label="m.name"
  394. :prop="m.apiUrl ? `${m.prop}Name` : m.prop"
  395. :rules="[
  396. {
  397. required: m.required,
  398. message: `请选择${m.name}`,
  399. trigger: 'change',
  400. },
  401. ]"
  402. >
  403. <!-- 参照弹窗 -->
  404. <el-select
  405. v-if="m.apiUrl"
  406. v-model="medcineData.value[`${m.prop}Name`]"
  407. placeholder="请选择"
  408. :key="medcineData.value[m.prop]"
  409. size="mini"
  410. :disabled="
  411. !(
  412. updateButtonGroup &&
  413. m.edit &&
  414. basicData.value.isMedicine == '0'
  415. )
  416. "
  417. @focus="
  418. m.apiUrl &&
  419. handleQueryMore(m, '', {
  420. name: 'medcineData',
  421. prop: m.prop,
  422. })
  423. "
  424. >
  425. <div slot="empty"></div>
  426. </el-select>
  427. <!-- 下拉选择 -->
  428. <el-select
  429. v-if="m.dictId"
  430. v-model="medcineData.value[m.prop]"
  431. placeholder="请选择"
  432. :key="medcineData.value[m.prop]"
  433. size="mini"
  434. :disabled="
  435. !(
  436. updateButtonGroup &&
  437. m.edit &&
  438. basicData.value.isMedicine == '0'
  439. )
  440. "
  441. @focus="
  442. m.apiUrl &&
  443. handleQueryMore(m, '', {
  444. name: 'medcineData',
  445. prop: m.prop,
  446. })
  447. "
  448. >
  449. <el-option
  450. v-if="m.dictId"
  451. v-for="d in m.dictValue"
  452. :key="d.dictValue"
  453. :label="d.dictLabel"
  454. :value="d.dictValue"
  455. >
  456. </el-option>
  457. </el-select>
  458. </el-form-item>
  459. <!-- 图片 -->
  460. <el-form-item
  461. v-else-if="m.attribute == 'image'"
  462. :label="m.name"
  463. >
  464. <el-image
  465. :src="medcineData.value[m.prop]"
  466. fit="contain"
  467. >
  468. </el-image>
  469. </el-form-item>
  470. <!-- 文本、数字、textarae -->
  471. <el-form-item v-else :label="m.name">
  472. <el-input
  473. size="mini"
  474. v-model="medcineData.value[m.prop]"
  475. :type="m.attribute || 'text'"
  476. :rows="1"
  477. :readonly="
  478. !(
  479. updateButtonGroup &&
  480. m.edit &&
  481. basicData.value.isMedicine == '0'
  482. )
  483. "
  484. >
  485. </el-input>
  486. </el-form-item>
  487. </template>
  488. </el-col>
  489. </el-row>
  490. </el-form>
  491. <!-- 其他展示为列表 -->
  492. <!-- 辅计量 -->
  493. <el-table
  494. border
  495. v-else-if="activeViceTab == 'material_unit'"
  496. :data="unitDetails.value"
  497. class="material-table"
  498. >
  499. <el-table-column
  500. type="index"
  501. v-if="unitDetails.form.length"
  502. label="序号"
  503. width="55"
  504. align="center"
  505. />
  506. <el-table-column
  507. v-for="v in unitDetails.form"
  508. v-if="v.show"
  509. :label="v.name"
  510. align="center"
  511. :prop="
  512. v.attribute == 'select' ? `${v.prop}Name` : v.prop
  513. "
  514. show-overflow-tooltip
  515. >
  516. <template slot-scope="scope">
  517. {{
  518. v.attribute == "select"
  519. ? scope.row[`${v.prop}Name`]
  520. : v.attribute == "checkbox"
  521. ? scope.row[v.prop] == "0"
  522. ? "√"
  523. : ""
  524. : scope.row[v.prop]
  525. }}
  526. </template>
  527. </el-table-column>
  528. </el-table>
  529. <!-- 辅助属性 -->
  530. <el-table
  531. border
  532. v-else-if="activeViceTab == 'material_property'"
  533. :data="propertyDetail.value"
  534. class="material-table"
  535. >
  536. <el-table-column
  537. type="index"
  538. v-if="propertyDetail.form.length"
  539. label="序号"
  540. width="55"
  541. align="center"
  542. />
  543. <el-table-column
  544. v-for="v in propertyDetail.form"
  545. v-if="v.show"
  546. :label="v.name"
  547. align="center"
  548. :prop="
  549. v.attribute == 'select' ? `${v.prop}Name` : v.prop
  550. "
  551. show-overflow-tooltip
  552. >
  553. <template slot-scope="scope">
  554. {{
  555. v.attribute == "select"
  556. ? scope.row[`${v.prop}Name`]
  557. : v.attribute == "checkbox"
  558. ? scope.row[v.prop] == "0"
  559. ? "√"
  560. : ""
  561. : scope.row[v.prop]
  562. }}
  563. </template>
  564. </el-table-column>
  565. </el-table>
  566. </template>
  567. </dr-tabs>
  568. </div>
  569. <!-- 基本信息 - 审计信息 -->
  570. <div class="md-auditInfo" v-if="activeMainTab == 'material'">
  571. <el-divider content-position="left">审计信息</el-divider>
  572. <el-form
  573. :inline="true"
  574. label-position="right"
  575. :model="basicData.value"
  576. >
  577. <el-form-item label="创建人">
  578. <el-input
  579. v-model="basicData.value.createByName"
  580. size="mini"
  581. readonly
  582. ></el-input>
  583. </el-form-item>
  584. <el-form-item label="创建时间">
  585. <el-input
  586. v-model="basicData.value.createTime"
  587. size="mini"
  588. readonly
  589. ></el-input>
  590. </el-form-item>
  591. <el-form-item label="最后修改人">
  592. <el-input
  593. v-model="basicData.value.updateByName"
  594. size="mini"
  595. readonly
  596. ></el-input>
  597. </el-form-item>
  598. <el-form-item label="最后修改时间">
  599. <el-input
  600. v-model="basicData.value.updateTime"
  601. size="mini"
  602. readonly
  603. ></el-input>
  604. </el-form-item>
  605. </el-form>
  606. </div>
  607. </div>
  608. </template>
  609. </dr-tabs>
  610. </div>
  611. </el-card>
  612. <!-- 操作提示弹窗 -->
  613. <el-dialog
  614. title="操作提示"
  615. :visible.sync="optionDialog.show"
  616. width="30%"
  617. center
  618. append-to-body
  619. >
  620. <span>是否确认{{ optionDialog.op }}?</span>
  621. <span slot="footer">
  622. <el-button type="primary" @click="handleComfirmOption('cancal')"
  623. >确 定</el-button
  624. >
  625. <el-button @click="handleOptionCancal">取 消</el-button>
  626. </span>
  627. </el-dialog>
  628. <!-- 其他页签的操作 -->
  629. <el-dialog
  630. :title="otherDeatils.title"
  631. :visible.sync="otherDeatils.show"
  632. show-close
  633. width="70%"
  634. :before-close="handleCloseOtherDetails"
  635. :close-on-press-escape="false"
  636. :close-on-click-modal="false"
  637. class="otherDialog"
  638. append-to-body
  639. >
  640. <div v-loading="otherDeatils.loading">
  641. <!-- 其他标签页操作 修改、删除 -->
  642. <el-row :gutter="10" class="mb10" type="flex" justify="end">
  643. <el-col :span="1.5" v-if="!otherDeatils.isEdit">
  644. <el-button-group>
  645. <el-button :size="size" @click="handleOtherEdit('form')"
  646. >修改</el-button
  647. >
  648. </el-button-group>
  649. <el-button-group>
  650. <el-button :size="size" @click="handleOtherRefresh"
  651. >刷新</el-button
  652. >
  653. </el-button-group>
  654. </el-col>
  655. <el-col :span="1.5" v-else>
  656. <el-button-group>
  657. <el-button :size="size" @click="handleOtherSave"
  658. >保存</el-button
  659. >
  660. <el-button :size="size" @click="handleOtherCancel"
  661. >取消</el-button
  662. >
  663. </el-button-group>
  664. </el-col>
  665. </el-row>
  666. <el-collapse v-model="collapseActive" @change="handleCollapseChange">
  667. <el-collapse-item title="物料基本信息" name="basic">
  668. <el-form
  669. :inline="true"
  670. label-position="right"
  671. :model="basicData.value"
  672. >
  673. <el-form-item label="物料编码">
  674. <el-input
  675. v-model="basicData.value.code"
  676. :size="size"
  677. readonly
  678. ></el-input>
  679. </el-form-item>
  680. <el-form-item label="物料名称">
  681. <el-input
  682. v-model="basicData.value.name"
  683. :size="size"
  684. readonly
  685. ></el-input>
  686. </el-form-item>
  687. <el-form-item label="英文名称">
  688. <el-input
  689. v-model="basicData.value.enName"
  690. :size="size"
  691. readonly
  692. ></el-input>
  693. </el-form-item>
  694. </el-form>
  695. </el-collapse-item>
  696. <el-collapse-item :title="otherDeatils.title" :name="activeMainTab">
  697. <div class="od-msg">
  698. <!-- 展示表单 -->
  699. <el-form
  700. :inline="true"
  701. label-position="right"
  702. :key="refer"
  703. :size="size"
  704. :hide-required-asterisk="true"
  705. :model="otherDeatils.value"
  706. >
  707. <el-row :gutter="10">
  708. <el-col
  709. :span="8"
  710. v-for="f in otherDeatils.form"
  711. style="text-align: right"
  712. >
  713. <template v-if="f.show">
  714. <!-- 多选框 -->
  715. <el-form-item
  716. v-if="f.attribute == 'checkbox'"
  717. style="text-align: left"
  718. class="od-msg-checkedbx"
  719. >
  720. <el-checkbox
  721. :label="f.name"
  722. name="type"
  723. v-model="otherDeatils.value[f.prop]"
  724. true-label="0"
  725. false-label="2"
  726. :disabled="!(otherDeatils.isEdit && f.edit)"
  727. >
  728. </el-checkbox>
  729. </el-form-item>
  730. <!-- 下拉框 - 弹窗参照 -->
  731. <el-form-item
  732. v-else-if="f.attribute == 'select'"
  733. :label="f.name"
  734. >
  735. <el-select
  736. v-if="f.apiUrl"
  737. v-model="otherDeatils.value[`${f.prop}Name`]"
  738. placeholder="请选择"
  739. :key="otherDeatils.value[f.prop]"
  740. :disabled="!(otherDeatils.isEdit && f.edit)"
  741. @focus="
  742. f.apiUrl &&
  743. handleQueryMore(f, '', {
  744. name: 'otherDeatils',
  745. prop: f.prop,
  746. })
  747. "
  748. >
  749. <div slot="empty"></div>
  750. </el-select>
  751. <!-- 字典-下拉 -->
  752. <el-select
  753. v-if="f.dictId"
  754. v-model="otherDeatils.value[f.prop]"
  755. placeholder="请选择"
  756. :key="otherDeatils.value[f.prop]"
  757. :disabled="!(otherDeatils.isEdit && f.edit)"
  758. >
  759. <el-option
  760. v-if="f.dictId"
  761. v-for="d in f.dictValue"
  762. :key="d.dictValue"
  763. :label="d.dictLabel"
  764. :value="d.dictValue"
  765. >
  766. </el-option>
  767. </el-select>
  768. </el-form-item>
  769. <el-form-item
  770. v-else-if="f.attribute == 'image'"
  771. :label="f.name"
  772. >
  773. <el-image
  774. :src="otherDeatils.value[f.prop]"
  775. fit="contain"
  776. >
  777. </el-image>
  778. </el-form-item>
  779. <!--attribute 文本 数字 文本域 为null -->
  780. <el-form-item v-else :label="f.name">
  781. <el-input
  782. :size="size"
  783. v-model="otherDeatils.value[f.prop]"
  784. :type="f.attribute || 'text'"
  785. :readonly="!(otherDeatils.isEdit && f.edit)"
  786. >
  787. </el-input>
  788. </el-form-item>
  789. </template>
  790. </el-col>
  791. </el-row>
  792. </el-form>
  793. </div>
  794. </el-collapse-item>
  795. <el-collapse-item title="审计信息" name="auditInfo">
  796. <!-- 基本信息 - 审计信息 -->
  797. <div class="md-auditInfo">
  798. <el-form
  799. :size="size"
  800. :inline="true"
  801. label-position="right"
  802. :model="basicData.value"
  803. >
  804. <el-form-item label="创建人">
  805. <el-input
  806. v-model="basicData.value.createByName"
  807. readonly
  808. ></el-input>
  809. </el-form-item>
  810. <el-form-item label="创建时间">
  811. <el-input
  812. v-model="basicData.value.createTime"
  813. readonly
  814. ></el-input>
  815. </el-form-item>
  816. <el-form-item label="最后修改人">
  817. <el-input
  818. v-model="basicData.value.updateByName"
  819. readonly
  820. ></el-input>
  821. </el-form-item>
  822. <el-form-item label="最后修改时间">
  823. <el-input
  824. v-model="basicData.value.updateTime"
  825. readonly
  826. ></el-input>
  827. </el-form-item>
  828. </el-form>
  829. </div>
  830. </el-collapse-item>
  831. </el-collapse>
  832. </div>
  833. </el-dialog>
  834. <!-- 参照弹窗 -->
  835. <el-dialog
  836. :title="MoreDataDialog.msg.name"
  837. :visible.sync="MoreDataDialog.show"
  838. width="70%"
  839. custom-class="MoreDataDialog"
  840. :close-on-press-escape="false"
  841. :close-on-click-modal="false"
  842. :before-close="handleCloseRefer"
  843. append-to-body
  844. >
  845. <div>
  846. <el-row :gutter="20">
  847. <el-col :span="6">
  848. <el-input
  849. v-model="MoreDataDialog.key"
  850. placeholder="过滤"
  851. :size="size"
  852. clearable
  853. @clear="handleClear"
  854. @keyup.enter.native="handleFilterRefer"
  855. />
  856. </el-col>
  857. <el-col :span="6">
  858. <el-button
  859. type="primary"
  860. :size="size"
  861. @click.stop="handleFilterRefer"
  862. >搜索</el-button
  863. >
  864. </el-col>
  865. </el-row>
  866. <!-- 树形 -->
  867. <el-tree
  868. v-if="MoreDataDialog.type == 'tree'"
  869. v-loading="MoreDataDialog.loading"
  870. :key="refer"
  871. node-key="id"
  872. class="referTree"
  873. :data="MoreDataDialog.list"
  874. @node-click="handleNodeClick"
  875. :props="
  876. MoreDataDialog.msg.apiUrl == 'queryMedcineItemDrug' ||
  877. MoreDataDialog.msg.apiUrl == 'queryMaterialClassify'
  878. ? drugProps
  879. : defaultProps
  880. "
  881. >
  882. </el-tree>
  883. <!-- queryMedcineItemDrug -->
  884. <!-- 列表 -->
  885. <div v-else>
  886. <el-table
  887. :data="MoreDataDialog.list"
  888. v-loading="MoreDataDialog.loading"
  889. style="width: 100%"
  890. @row-click="handleCurentRow"
  891. @row-dblclick="handleDbClick"
  892. highlight-current-row
  893. >
  894. <el-table-column
  895. type="index"
  896. label="序号"
  897. width="55"
  898. align="center"
  899. />
  900. <el-table-column
  901. v-for="m in MoreDataDialog.form"
  902. v-if="m.show"
  903. :prop="m.prop"
  904. :label="m.name"
  905. />
  906. </el-table>
  907. <el-pagination
  908. @size-change="handleSizeChange"
  909. @current-change="handleCurrentChange"
  910. :current-page="queryParams.pageNum"
  911. :page-sizes="[10, 20, 50, 100]"
  912. layout="total, sizes, prev, pager, next, jumper"
  913. :total="queryParams.total"
  914. >
  915. </el-pagination>
  916. </div>
  917. <!-- 按钮 -->
  918. <el-row class="more-button">
  919. <el-button
  920. round
  921. :size="size"
  922. type="primary"
  923. @click="handleConfirmRefer"
  924. >确认</el-button
  925. >
  926. <el-button round :size="size" @click="handleConcalRefer"
  927. >取消</el-button
  928. >
  929. </el-row>
  930. </div>
  931. </el-dialog>
  932. </div>
  933. </el-drawer>
  934. </template>
  935. <script>
  936. import detailsTabs from "../config/detailsTabs";
  937. import materialApi from "@/api/material/basic";
  938. import { getDicts as getDicts } from "@/api/system/dict/data";
  939. import arrayUtils from "../tools/arrayUtils";
  940. import { initRules, initParams } from "./init/index";
  941. import { getDetail } from "@/api/classify/basic";
  942. export default {
  943. name: "material-details",
  944. // dicts: [],
  945. props: {
  946. selectData: {
  947. type: Array,
  948. required: true,
  949. },
  950. },
  951. components: {
  952. drTabs: () => import("../components/dr-tabs.vue"),
  953. IsUsing: () => import("./isUsing/index.vue"),
  954. whlbButton: () => import("./wei-hu-lei-bie/index.vue"),
  955. },
  956. data() {
  957. return {
  958. visible: false,
  959. size: "mini",
  960. count: 1,
  961. refer: 1,
  962. loading: false,
  963. rules: {},
  964. medcineRules: {},
  965. // 维护新版本
  966. maintainNewVersion: false,
  967. // 详情固定标签页
  968. detailsTabs,
  969. defaultProps: {
  970. children: "childrens",
  971. label: "name",
  972. },
  973. drugProps: {
  974. children: "childrens",
  975. label: function (data, node) {
  976. return data.code + " " + data.name;
  977. },
  978. // 'name'
  979. },
  980. // 标签页当前激活状态
  981. activeMainTab: "material",
  982. activeViceTab: "material_medcine",
  983. materialId: this.$route.params.id,
  984. collapseActive: ["basic", ""],
  985. // 修改按钮 是否激活
  986. updateButtonGroup: false,
  987. // 基本信息下的页签
  988. basicMessage: [
  989. {
  990. label: "医药行业",
  991. code: "material_medcine",
  992. isShow: true,
  993. },
  994. {
  995. label: "辅计量管理",
  996. code: "material_unit",
  997. isShow: true,
  998. },
  999. {
  1000. label: "辅助属性",
  1001. code: "material_property",
  1002. isShow: true,
  1003. },
  1004. ],
  1005. // 基本信息
  1006. basicData: {
  1007. value: {},
  1008. form: [],
  1009. },
  1010. // 医药行业
  1011. medcineData: {
  1012. value: {},
  1013. form: [],
  1014. },
  1015. // 辅助属性
  1016. propertyDetail: {
  1017. value: [],
  1018. form: [],
  1019. },
  1020. // 辅计量管理
  1021. unitDetails: {
  1022. value: [],
  1023. form: [],
  1024. },
  1025. // 主标签信息
  1026. mainMsg: {
  1027. form: [],
  1028. value: [],
  1029. checkedList: [],
  1030. },
  1031. // 副信息
  1032. viceMsg: {
  1033. form: [],
  1034. value: [],
  1035. },
  1036. // 操作弹窗
  1037. optionDialog: {
  1038. show: false,
  1039. op: "",
  1040. },
  1041. // 其他页签操作弹窗
  1042. otherDeatils: {
  1043. loading: false,
  1044. show: false,
  1045. title: "",
  1046. // 查询关键字-物料id
  1047. queryKey: "",
  1048. isEdit: false,
  1049. // 详情表头
  1050. from: [],
  1051. // 详情值
  1052. value: {},
  1053. },
  1054. // 编辑-更多数据展示弹窗_ 参照
  1055. MoreDataDialog: {
  1056. loading: false,
  1057. show: false,
  1058. // 查询关键字
  1059. key: "",
  1060. // 需要查看参照的表单头信息
  1061. msg: "",
  1062. type: "table",
  1063. // 查询出的参照数据
  1064. list: [],
  1065. // 查询出的参照表头
  1066. form: [],
  1067. // 选中的参照数据
  1068. value: "",
  1069. // 参照最后应该赋值的地方
  1070. target: {
  1071. name: "",
  1072. prop: "",
  1073. },
  1074. },
  1075. // 参照分页参数
  1076. queryParams: {
  1077. pageNum: 1,
  1078. total: 0,
  1079. pageSize: 10,
  1080. },
  1081. };
  1082. },
  1083. computed: {
  1084. innerValue: {
  1085. get() {
  1086. return this.$props.selectData[0];
  1087. },
  1088. set(value) {
  1089. this.materialId = value.id;
  1090. },
  1091. },
  1092. },
  1093. methods: {
  1094. setVisible(prop) {
  1095. this.visible = prop;
  1096. },
  1097. onHide() {
  1098. this.medcineData.value = initParams(this.medcineData.form, "prop");
  1099. this.basicData.value = initParams(this.basicData.form, "prop");
  1100. this.activeMainTab = "material";
  1101. this.activeViceTab = "material_medcine";
  1102. this.$emit("success");
  1103. },
  1104. onOpen() {
  1105. this.materialId = this.$props.selectData[0].id;
  1106. this.handleRest();
  1107. },
  1108. judgeMaxLength(prop) {
  1109. // 规格
  1110. if (prop === "specification") {
  1111. return 150;
  1112. }
  1113. return Infinity;
  1114. },
  1115. // 判断效期管理
  1116. handleJudge(attribute) {
  1117. // 维护新版本才能修改:批号及库存状态管理(isInventoryStatus)、
  1118. if (attribute.prop == "isInventoryStatus") {
  1119. return !(this.maintainNewVersion && attribute.edit);
  1120. }
  1121. // 序列号管理(serialNoManager):维护新版本 && 批号及库存状态管理
  1122. else if (attribute.prop == "serialNoManager") {
  1123. if (this.basicData.value["isInventoryStatus"] == "2")
  1124. this.basicData.value["serialNoManager"] = "2";
  1125. return !(
  1126. this.maintainNewVersion &&
  1127. attribute.edit &&
  1128. this.basicData.value["isInventoryStatus"] == "0"
  1129. );
  1130. }
  1131. // 批号及库存状态管理(isInventoryStatus) 控制 效期管理是否展示(expiryDateManagerment)
  1132. else if (attribute.prop == "expiryDateManagerment") {
  1133. if (this.basicData.value["isInventoryStatus"] == "2")
  1134. this.basicData.value["expiryDateManagerment"] = "2";
  1135. return !(
  1136. this.updateButtonGroup &&
  1137. attribute.edit &&
  1138. this.basicData.value["isInventoryStatus"] == "0"
  1139. );
  1140. }
  1141. // 效期管理(expiryDateManagerment):控制一下几个是否可编辑
  1142. // expiryUnitId 效期单位 usefulLife 有效期 usefulLifeUnitId 有效期至单位
  1143. else if (
  1144. attribute.prop == "expiryUnitId" ||
  1145. attribute.prop == "usefulLife" ||
  1146. attribute.prop == "usefulLifeUnitId" ||
  1147. attribute.prop == "recentWarningPeriod"
  1148. ) {
  1149. if (this.basicData.value["expiryDateManagerment"] == "2") {
  1150. this.basicData.value["expiryUnitId"] = "";
  1151. this.basicData.value["usefulLife"] = "";
  1152. this.basicData.value["usefulLifeUnitId"] = "";
  1153. this.basicData.value["recentWarningPeriod"] = "";
  1154. }
  1155. return !(
  1156. this.updateButtonGroup &&
  1157. attribute.edit &&
  1158. this.basicData.value["expiryDateManagerment"] == "0"
  1159. );
  1160. }
  1161. // 默认采购组织:purchasingOrganization 业务部门:businessDepartment
  1162. else if (attribute.prop == "businessDepartment") {
  1163. return !(
  1164. this.updateButtonGroup &&
  1165. attribute.edit &&
  1166. this.basicData.value["purchasingOrganization"]
  1167. );
  1168. } else {
  1169. // 其他属性是否可编辑
  1170. return !(this.updateButtonGroup && attribute.edit);
  1171. }
  1172. },
  1173. // 返回
  1174. handleBack() {
  1175. this.visible = false;
  1176. // this.$store.dispatch("tagsView/delView", this.$route);
  1177. // this.$router.go(-1);
  1178. },
  1179. // 切换主信息标签
  1180. handleMainTabClick(e) {
  1181. this.activeMainTab = detailsTabs[e.index].code;
  1182. this.collapseActive.splice(1, 1, this.activeMainTab);
  1183. console.log(this.collapseActive, "this.collapseActive");
  1184. this.handleOtherListRefresh();
  1185. },
  1186. // 切换副表信息
  1187. handleViceTabClick(e) {
  1188. this.activeViceTab = this.basicMessage[e.index].code;
  1189. switch (this.activeViceTab) {
  1190. // 医药行业
  1191. case "material_medcine":
  1192. this.getTagList("material_medcine", (form) => {
  1193. this.medcineData.form = [...form];
  1194. this.medcineData.value = initParams(this.medcineData.form, "prop");
  1195. this.medcineRules = initRules(form);
  1196. this.getMedcineDetails(this.materialId, "material_medcine");
  1197. });
  1198. break;
  1199. // 辅计量管理
  1200. case "material_unit":
  1201. this.getTagList("material_unit", (form) => {
  1202. console.log(form, "form");
  1203. this.unitDetails.form = form;
  1204. this.getUnitList(this.materialId);
  1205. });
  1206. break;
  1207. // 辅助属性
  1208. case "material_property":
  1209. this.getTagList("material_property", (form) => {
  1210. this.propertyDetail.form = form;
  1211. this.getPropertyList(this.materialId);
  1212. });
  1213. break;
  1214. default:
  1215. break;
  1216. }
  1217. },
  1218. // 主标签页 列表双击
  1219. handleMaindbClick(e) {
  1220. this.otherDeatils.queryKey = e.id;
  1221. this.otherDeatils.show = true;
  1222. let activeTab = this.detailsTabs.filter(
  1223. (item) => item.code == this.activeMainTab
  1224. )[0];
  1225. this.otherDeatils.title = activeTab.label;
  1226. this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
  1227. },
  1228. // 主页签 列表数据选择
  1229. handleMainChange(e) {
  1230. this.mainMsg.checkedList = e;
  1231. },
  1232. // 上传图片
  1233. handleUpImage() {},
  1234. // 编辑状态下,参照弹窗显示查询数据
  1235. handleQueryMore(msg, val, target) {
  1236. this.MoreDataDialog.loading = true;
  1237. let _this = this;
  1238. console.log("编辑状态下,弹窗显示查询数据", msg, "val", val, target);
  1239. this.MoreDataDialog.show = true;
  1240. this.MoreDataDialog.msg = msg;
  1241. this.MoreDataDialog.target = target;
  1242. let par = { param: this.MoreDataDialog.key };
  1243. this[target.name].form.map((t) => {
  1244. if (t.relevance && t.relevance != "") {
  1245. let reList = t.relevance.split(",");
  1246. console.log(reList, "reList-------------------");
  1247. reList.forEach((i) => {
  1248. par[i] = this.basicData.value[i];
  1249. });
  1250. console.log(par, "par/////////////////////////");
  1251. }
  1252. });
  1253. this.getExecuteMethods(msg.apiUrl, par, (data) => {
  1254. _this.MoreDataDialog.type = data.type;
  1255. if (data.type == "tree") {
  1256. _this.MoreDataDialog.list = arrayUtils.filterTreeData(data.tableBody);
  1257. } else {
  1258. _this.MoreDataDialog.list = data.tableBody;
  1259. _this.MoreDataDialog.form = data.tableHeader;
  1260. }
  1261. this.refer++;
  1262. // this.count++;
  1263. });
  1264. },
  1265. // 参照改变分页大小
  1266. handleSizeChange(e) {
  1267. this.queryParams.pageSize = e;
  1268. this.handleQueryMore(
  1269. this.MoreDataDialog.msg,
  1270. this.MoreDataDialog.key,
  1271. this.MoreDataDialog.target
  1272. );
  1273. },
  1274. // 参照改变当前页
  1275. handleCurrentChange(e) {
  1276. this.queryParams.pageNum = e;
  1277. this.handleQueryMore(
  1278. this.MoreDataDialog.msg,
  1279. this.MoreDataDialog.key,
  1280. this.MoreDataDialog.target
  1281. );
  1282. },
  1283. // 根据apiUrl获取对应参照的值
  1284. getExecuteMethods(methodName, param, cb) {
  1285. let page = {
  1286. pageSize: this.queryParams.pageSize,
  1287. pageNum: this.queryParams.pageNum,
  1288. };
  1289. let params = { ...param };
  1290. // 业务部门需要 依据默认采购组组织查询
  1291. if (methodName == "queryOperatingDepptTree") {
  1292. params["puOrgId"] = this.basicData.value["purchasingOrganization"];
  1293. }
  1294. materialApi.executeMethods(methodName, params, page).then((res) => {
  1295. this.MoreDataDialog.loading = false;
  1296. if (res.code == 200) {
  1297. this.queryParams.total = res.data.total;
  1298. cb(res.data);
  1299. }
  1300. });
  1301. },
  1302. // 获取物料基本信息详细信息
  1303. async getMaterialDetails(id, templateCode) {
  1304. let _this = this;
  1305. await materialApi.materialDetails(id, templateCode).then((res) => {
  1306. this.loading = false;
  1307. console.log(res, "物料基本信息");
  1308. let { code, data } = res;
  1309. if (code == 200) {
  1310. _this.basicData.value = { ..._this.basicData.value, ...data.data };
  1311. for (const key in data.data) {
  1312. _this.basicData.value[key] =
  1313. typeof data.data[key] === "number"
  1314. ? String(data.data[key])
  1315. : data.data[key];
  1316. }
  1317. // _this.handleAddReferLabel('basicData');
  1318. this.count++;
  1319. }
  1320. });
  1321. },
  1322. // 查询财务信息列表
  1323. async getFinanceList(materialId) {
  1324. try {
  1325. this.loading = true;
  1326. let { code, data } = await materialApi.financeList({ materialId });
  1327. if (code == 200) {
  1328. this.mainMsg.value = data.tableBody.rows;
  1329. }
  1330. } catch (error) {
  1331. } finally {
  1332. this.loading = false;
  1333. }
  1334. },
  1335. // 查询计划信息列表
  1336. async getPlanList(materialId) {
  1337. try {
  1338. this.loading = true;
  1339. let { code, data } = await materialApi.planList({ materialId });
  1340. if (code == 200) {
  1341. this.mainMsg.value = data.tableBody.rows;
  1342. }
  1343. } catch (error) {
  1344. } finally {
  1345. this.loading = false;
  1346. }
  1347. },
  1348. // 查询成本信息列表
  1349. async getCostList(materialId) {
  1350. try {
  1351. this.loading = true;
  1352. let { code, data } = await materialApi.costList({ materialId });
  1353. if (code == 200) {
  1354. this.mainMsg.value = data.tableBody.rows;
  1355. }
  1356. } catch (error) {
  1357. } finally {
  1358. this.loading = false;
  1359. }
  1360. },
  1361. // 查询利润中心列表
  1362. async getCenterList(materialId) {
  1363. try {
  1364. this.loading = true;
  1365. let { code, data } = await materialApi.centerList({ materialId });
  1366. if (code == 200) {
  1367. this.mainMsg.value = data.tableBody.rows;
  1368. }
  1369. } catch (error) {
  1370. } finally {
  1371. this.loading = false;
  1372. }
  1373. },
  1374. // 查询采购中心列表
  1375. async getPurchaseList(materialId) {
  1376. try {
  1377. this.loading = true;
  1378. let { code, data } = await materialApi.purchaseList({ materialId });
  1379. if (code == 200) {
  1380. this.mainMsg.value = data.tableBody.rows;
  1381. }
  1382. } catch (error) {
  1383. } finally {
  1384. this.loading = false;
  1385. }
  1386. },
  1387. // 获取库存信息列表
  1388. async getInventoryList(materialId) {
  1389. try {
  1390. this.loading = true;
  1391. let { code, data } = await materialApi.inventoryList({ materialId });
  1392. if (code == 200) {
  1393. this.mainMsg.value = data.tableBody.rows;
  1394. }
  1395. } catch (error) {
  1396. } finally {
  1397. this.loading = false;
  1398. }
  1399. },
  1400. // 查询其他标签页列表详情
  1401. getOtherListDetails(type, id) {
  1402. console.log(type, id, "查询其他标签页列表详情");
  1403. this.otherDeatils.form = this.mainMsg.form;
  1404. console.log(this.otherDeatils.form, "this.otherDeatils.form");
  1405. switch (type) {
  1406. // 财物信息
  1407. case "material_finance":
  1408. this.getFinanceDetails(id);
  1409. break;
  1410. // 利润中心信息
  1411. case "profit_center":
  1412. this.getCenterDetails(id);
  1413. break;
  1414. // 采购信息
  1415. case "material_purchase":
  1416. this.getPurchaseDetails(id);
  1417. break;
  1418. // 库存信息
  1419. case "material_inventory":
  1420. this.getInventoryDetails(id);
  1421. break;
  1422. // 计划信息
  1423. case "material_plan":
  1424. this.getPlanDetails(id);
  1425. break;
  1426. // 成本信息
  1427. case "material_cost":
  1428. this.getCostDetails(id);
  1429. break;
  1430. default:
  1431. break;
  1432. }
  1433. },
  1434. // 查询财务信息详情
  1435. async getFinanceDetails(id) {
  1436. try {
  1437. this.otherDeatils.loading = true;
  1438. let { code, data } = await materialApi.financeDetails(id);
  1439. if (code == 200) {
  1440. this.otherDeatils.value = data.data;
  1441. }
  1442. } catch (error) {
  1443. } finally {
  1444. setTimeout(() => {
  1445. this.otherDeatils.loading = false;
  1446. }, 200);
  1447. }
  1448. },
  1449. // 获取利润中心详情
  1450. async getCenterDetails(id) {
  1451. try {
  1452. this.otherDeatils.loading = true;
  1453. let { code, data } = await materialApi.centerDetails(id);
  1454. if (code == 200) {
  1455. this.otherDeatils.value = data.data;
  1456. }
  1457. } catch (error) {
  1458. } finally {
  1459. setTimeout(() => {
  1460. this.otherDeatils.loading = false;
  1461. }, 200);
  1462. }
  1463. },
  1464. // 获取采购详细信息详情
  1465. async getPurchaseDetails(id) {
  1466. try {
  1467. this.otherDeatils.loading = true;
  1468. let { code, data } = await materialApi.purchaseDetails(id);
  1469. if (code == 200) {
  1470. this.otherDeatils.value = data.data;
  1471. }
  1472. } catch (error) {
  1473. } finally {
  1474. setTimeout(() => {
  1475. this.otherDeatils.loading = false;
  1476. }, 200);
  1477. }
  1478. },
  1479. // 获取成本信息详情
  1480. async getCostDetails(id) {
  1481. try {
  1482. this.otherDeatils.loading = true;
  1483. let { code, data } = await materialApi.costDetails(id);
  1484. if (code == 200) {
  1485. this.otherDeatils.value = data.data;
  1486. }
  1487. } catch (error) {
  1488. } finally {
  1489. setTimeout(() => {
  1490. this.otherDeatils.loading = false;
  1491. }, 200);
  1492. }
  1493. },
  1494. // 获取计划信息详情
  1495. async getPlanDetails(id) {
  1496. try {
  1497. this.otherDeatils.loading = true;
  1498. let { code, data } = await materialApi.planDetails(id);
  1499. if (code == 200) {
  1500. this.otherDeatils.value = data.data;
  1501. }
  1502. } catch (error) {
  1503. } finally {
  1504. setTimeout(() => {
  1505. this.otherDeatils.loading = false;
  1506. }, 200);
  1507. }
  1508. },
  1509. //
  1510. async getInventoryDetails(id) {
  1511. try {
  1512. this.otherDeatils.loading = true;
  1513. let { code, data } = await materialApi.inventoryDetails(id);
  1514. if (code == 200) {
  1515. this.otherDeatils.value = data.data;
  1516. }
  1517. } catch (error) {
  1518. } finally {
  1519. setTimeout(() => {
  1520. this.otherDeatils.loading = false;
  1521. }, 200);
  1522. }
  1523. },
  1524. /* 二级标签页 */
  1525. // 根据物料id获取医药行业信息详细信息
  1526. async getMedcineDetails(id) {
  1527. let _this = this;
  1528. console.log(id);
  1529. await materialApi.medcineDetailsInfo(id).then((res) => {
  1530. this.loading = false;
  1531. console.log(res, "医药行业");
  1532. let { code, data } = res;
  1533. if (code == 200) {
  1534. _this.medcineData.value = data.data || {};
  1535. // this.medcineData.form = data.form;
  1536. // _this.handleAddReferLabel('medcineData');
  1537. console.log(" _this.medcineData", _this.medcineData, res);
  1538. this.count++;
  1539. }
  1540. });
  1541. },
  1542. // 获取物料辅助属性详细信息+表单列段属性
  1543. getPropertyDetails(id) {
  1544. materialApi.propertyDetails(id).then((res) => {
  1545. console.log(res, "物料辅助属性详细信息");
  1546. if (res.code == 200) {
  1547. this.propertyDetail.value = res.data.data || [];
  1548. }
  1549. });
  1550. },
  1551. // 查询物料辅助属性列表+表头字段
  1552. getPropertyList(materialId) {
  1553. materialApi.propertyList({ materialId }).then((res) => {
  1554. console.log(res, "料辅助属性列表");
  1555. if (res.code == 200) {
  1556. this.propertyDetail.value = res.data.data || [];
  1557. }
  1558. });
  1559. },
  1560. //获取辅助计量单位基本信息+表单列段属性
  1561. getUnitDetails(materialId) {
  1562. materialApi.unitDetails(materialId).then((res) => {
  1563. console.log(res, "辅助计量单位基本信息");
  1564. if (res.code == 200) {
  1565. this.unitDetails.value = res.data.tableBody.rows || [];
  1566. }
  1567. });
  1568. },
  1569. //获取辅计量管理列表信息
  1570. getUnitList(materialId) {
  1571. materialApi.unitList({ materialId }).then((res) => {
  1572. console.log(res, "辅计量管理列表信息");
  1573. if (res.code == 200) {
  1574. this.unitDetails.value = res.data.tableBody.rows || [];
  1575. }
  1576. });
  1577. },
  1578. // 获取物料列表表头
  1579. async getTagList(templateCode, cb) {
  1580. let dictIdList = [];
  1581. try {
  1582. let { code, data } = await materialApi.tagList({ templateCode });
  1583. if (code == 200) {
  1584. dictIdList = _.cloneDeep(data);
  1585. let promiseArray = data.map((item, index) => {
  1586. return new Promise((resolve, reject) => {
  1587. if (item.dictId && item.dictId != "") {
  1588. getDicts(item.dictId).then((dict) => {
  1589. if (dict.data) {
  1590. dictIdList[index]["dictValue"] = dict.data;
  1591. resolve();
  1592. }
  1593. });
  1594. } else {
  1595. resolve();
  1596. }
  1597. });
  1598. });
  1599. Promise.all(promiseArray)
  1600. .then(async () => {
  1601. return cb(dictIdList);
  1602. })
  1603. .catch(() => {
  1604. console.log("promise.all执行失败");
  1605. });
  1606. }
  1607. } catch (error) {
  1608. } finally {
  1609. }
  1610. // await materialApi.tagList({ templateCode }).then(async (res) => {
  1611. // console.log(res, `获取${templateCode}表头`);
  1612. // let dictIdList = [];
  1613. // if (res.code == 200) {
  1614. // res.data.map(async (item) => {
  1615. // // 查字典
  1616. // if (item.dictId && item.dictId != "") {
  1617. // // 通过接口获取有dict的对应的数据
  1618. // await getDicts(item.dictId).then((dict) => {
  1619. // if (dict.data) {
  1620. // item["dictValue"] = dict.data;
  1621. // }
  1622. // });
  1623. // }
  1624. // });
  1625. // return cb(res.data);
  1626. },
  1627. // 新增
  1628. handleInster() {
  1629. this.$notify.warning({
  1630. message: "物料只能通过申请审批增加,不能在节点直接录入!",
  1631. });
  1632. },
  1633. // 除基本信息之后的修改
  1634. handleOtherEdit(type) {
  1635. // debugger
  1636. console.log("除基本信息之后的修改", type);
  1637. if ("table" === type) {
  1638. if (this.mainMsg.checkedList.length == 1) {
  1639. this.otherDeatils.show = true;
  1640. this.otherDeatils.isEdit = true;
  1641. let activeTab = this.detailsTabs.filter(
  1642. (item) => item.code == this.activeMainTab
  1643. )[0];
  1644. this.otherDeatils.title = activeTab.label;
  1645. this.otherDeatils.queryKey = this.mainMsg.checkedList[0].id;
  1646. console.log(this.otherDeatils, "this.otherDeatils");
  1647. // 查询其他标签页列表详情
  1648. this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
  1649. } else {
  1650. this.$notify.warning({
  1651. message: "修改请选择单个数据!",
  1652. });
  1653. }
  1654. } else if ("form" === type) {
  1655. if (this.otherDeatils.queryKey) {
  1656. this.otherDeatils.show = true;
  1657. this.otherDeatils.isEdit = true;
  1658. let activeTab = this.detailsTabs.filter(
  1659. (item) => item.code == this.activeMainTab
  1660. )[0];
  1661. this.otherDeatils.title = activeTab.label;
  1662. // 查询其他标签页列表详情
  1663. this.getOtherListDetails(activeTab.code, this.otherDeatils.queryKey);
  1664. }
  1665. }
  1666. },
  1667. // 其他标签详情弹窗-刷新
  1668. handleOtherRefresh() {
  1669. this.getOtherListDetails(this.activeMainTab, this.otherDeatils.queryKey);
  1670. },
  1671. // 其他标签详情弹窗-删除
  1672. handleOtherDel() {
  1673. let ids = this.mainMsg.checkedList.map((i) => i.id);
  1674. console.log(`${this.activeMainTab}其他标签详情弹窗-删除---id合集`, ids);
  1675. if (ids.length) {
  1676. switch (this.activeMainTab) {
  1677. // 财物信息
  1678. case "material_finance":
  1679. this.handleDelFinance(ids);
  1680. break;
  1681. // 利润中心信息
  1682. case "profit_center":
  1683. this.handledDelCenter(ids);
  1684. break;
  1685. // 采购信息
  1686. case "material_purchase":
  1687. this.handledelPurchase(ids);
  1688. break;
  1689. // 库存信息
  1690. case "material_inventory":
  1691. this.handleDelInventory(ids);
  1692. break;
  1693. // 计划信息
  1694. case "material_plan":
  1695. this.handleDelPlan(ids);
  1696. break;
  1697. // 成本信息
  1698. case "material_cost":
  1699. this.handleDelCost(ids);
  1700. default:
  1701. break;
  1702. }
  1703. } else {
  1704. this.$notify.warning({
  1705. message: "请选择需要删除的数据!",
  1706. });
  1707. }
  1708. },
  1709. // 其他标签页刷新
  1710. async handleOtherListRefresh() {
  1711. switch (this.activeMainTab) {
  1712. // 基本信息
  1713. case "material":
  1714. await this.getTagList("material", async (form) => {
  1715. // this.basicData.form = [...form];
  1716. this.basicData.form = [...form];
  1717. this.rules = initRules(form);
  1718. this.basicData.value = initParams(this.basicData.form, "prop");
  1719. await this.getMaterialDetails(this.materialId, "material");
  1720. });
  1721. break;
  1722. // 财物信息
  1723. case "material_finance":
  1724. await this.getTagList("material_finance", async (form) => {
  1725. this.mainMsg.form = [...form];
  1726. await this.getFinanceList(this.materialId);
  1727. });
  1728. break;
  1729. // 利润中心信息
  1730. case "profit_center":
  1731. await this.getTagList("profit_center", async (form) => {
  1732. this.mainMsg.form = [...form];
  1733. await this.getCenterList(this.materialId);
  1734. });
  1735. break;
  1736. // 采购信息
  1737. case "material_purchase":
  1738. await this.getTagList("material_purchase", async (form) => {
  1739. this.mainMsg.form = [...form];
  1740. await this.getPurchaseList(this.materialId);
  1741. });
  1742. break;
  1743. // 库存信息
  1744. case "material_inventory":
  1745. await this.getTagList("material_inventory", async (form) => {
  1746. this.mainMsg.form = [...form];
  1747. await this.getInventoryList(this.materialId);
  1748. });
  1749. break;
  1750. // 计划信息
  1751. case "material_plan":
  1752. await this.getTagList("material_plan", async (form) => {
  1753. this.mainMsg.form = [...form];
  1754. await this.getPlanList(this.materialId);
  1755. });
  1756. break;
  1757. // 成本信息
  1758. case "material_cost":
  1759. await this.getTagList("material_cost", async (form) => {
  1760. this.mainMsg.form = [...form];
  1761. await this.getCostList(this.materialId);
  1762. });
  1763. break;
  1764. default:
  1765. break;
  1766. }
  1767. },
  1768. // 修改
  1769. handleBasicEdit() {
  1770. this.updateButtonGroup = true;
  1771. // this.count++;
  1772. //需要禁止点击其他标签
  1773. // this.detailsTabs = this.detailsTabs.map(item => {
  1774. // item['disabled'] = true;
  1775. // return item
  1776. // })
  1777. console.log(this.detailsTabs, "this.detailsTabs ");
  1778. },
  1779. // 刷新
  1780. handleRefresh() {
  1781. this.$refs.basicMessageRef && this.$refs.basicMessageRef.clearValidate();
  1782. this.$refs.medcineRef && this.$refs.medcineRef.clearValidate();
  1783. this.handleRest();
  1784. },
  1785. // 维护新版本
  1786. handleNewVersion() {
  1787. let _this = this;
  1788. let data = {
  1789. // 物料编码
  1790. code: this.basicData.value.code,
  1791. };
  1792. materialApi.versions(data).then((res) => {
  1793. if (res.code == 200) {
  1794. _this.maintainNewVersion = res.data.result;
  1795. // 维护版本消息展示 by shiy 2023/05/31
  1796. if (!res.data.result) {
  1797. this.$notify.warning({
  1798. message: res.data.msg,
  1799. });
  1800. }
  1801. }
  1802. });
  1803. },
  1804. // 维护物料保存
  1805. handleSaveNewVersion(cb) {
  1806. let data = {
  1807. // 物料编码
  1808. materialCode: this.basicData.value.code,
  1809. //序列号管理; 2= 否,0= 是
  1810. serialNoManager: this.basicData.value.serialNoManager,
  1811. // 批号及库存状态管理;2=否,0=是
  1812. isInventoryStatus: this.basicData.value.isInventoryStatus,
  1813. };
  1814. materialApi
  1815. .saveVersions(data)
  1816. .then((res) => {
  1817. console.log(res, "维护物料保存");
  1818. if (res.code == 200) {
  1819. cb();
  1820. }
  1821. })
  1822. .catch((error) => {
  1823. this.loading = false;
  1824. });
  1825. },
  1826. // 取消保存
  1827. handleCancel() {
  1828. console.log("取消保存");
  1829. this.optionDialog.op = "取消";
  1830. this.optionDialog.show = true;
  1831. },
  1832. // 保存修改
  1833. handleSave() {
  1834. console.log("保存修改");
  1835. this.loading = true;
  1836. // 普通保存修改
  1837. this.updateButtonGroup &&
  1838. this.handleSaveMaterial(() => {
  1839. this.updateButtonGroup = false;
  1840. this.handleRefresh();
  1841. });
  1842. // 维护新版本保存修改
  1843. this.maintainNewVersion &&
  1844. this.handleSaveNewVersion(() => {
  1845. this.maintainNewVersion = false;
  1846. this.handleRefresh();
  1847. });
  1848. },
  1849. // 其他标签页弹窗取消操作
  1850. handleOtherCancel() {
  1851. this.optionDialog.show = true;
  1852. this.optionDialog.op = "修改";
  1853. },
  1854. // 其他标签页弹窗保存
  1855. async handleOtherSave() {
  1856. let data = this.otherDeatils.value;
  1857. console.log(data, "params");
  1858. switch (this.activeMainTab) {
  1859. // 财物信息
  1860. case "material_finance":
  1861. await this.handleSaveFinance(data);
  1862. break;
  1863. // 利润中心信息
  1864. case "profit_center":
  1865. await this.handleSaveCenter(data);
  1866. break;
  1867. // 采购信息
  1868. case "material_purchase":
  1869. await this.handleSavePurchase(data);
  1870. break;
  1871. // 库存信息
  1872. case "material_inventory":
  1873. await this.handleSaveInventoryEdit(data);
  1874. break;
  1875. // 计划信息
  1876. case "material_plan":
  1877. await this.handleSavePlan(data);
  1878. break;
  1879. // 成本信息
  1880. case "material_cost":
  1881. await this.handleSaveCost(data);
  1882. break;
  1883. default:
  1884. break;
  1885. }
  1886. // this.handleOtherRefresh();
  1887. },
  1888. // 其他页签详情弹窗关闭事件
  1889. handleCloseOtherDetails(done) {
  1890. // 处于编辑状态
  1891. if (this.otherDeatils.isEdit) {
  1892. this.$notify.warning({
  1893. message: "请先退出编辑操作",
  1894. });
  1895. } else {
  1896. this.handleOtherListRefresh();
  1897. done();
  1898. }
  1899. },
  1900. // 折叠菜单改变
  1901. handleCollapseChange(val) {
  1902. console.log(val, "折叠菜单改变");
  1903. },
  1904. // 确认弹窗操作
  1905. async handleComfirmOption() {
  1906. console.log("确认弹窗操作");
  1907. this.optionDialog.show = false;
  1908. // 取消基本信息修改
  1909. if (this.updateButtonGroup) {
  1910. this.updateButtonGroup = false;
  1911. // this.handleRest();
  1912. await this.getMaterialDetails(this.materialId, "material");
  1913. await this.getMedcineDetails(this.materialId, "material_medcine");
  1914. this.$refs.basicMessageRef.clearValidate();
  1915. this.$refs.medcineRef.clearValidate();
  1916. }
  1917. // 取消其他主页签详情弹窗修改
  1918. if (this.otherDeatils.isEdit) {
  1919. this.otherDeatils.isEdit = false;
  1920. this.handleOtherRefresh();
  1921. }
  1922. // 取消维护新版本修改
  1923. if (this.maintainNewVersion) {
  1924. console.log("取消维护新版本修改");
  1925. this.maintainNewVersion = false;
  1926. this.handleRefresh();
  1927. }
  1928. },
  1929. handleClear() {
  1930. this.MoreDataDialog.key = "";
  1931. this.handleFilterRefer();
  1932. },
  1933. // 参照弹窗过滤
  1934. handleFilterRefer() {
  1935. // this.MoreDataDialog.key =
  1936. console.log(
  1937. this.MoreDataDialog.key,
  1938. "查询关键字",
  1939. this.MoreDataDialog.target
  1940. );
  1941. this.handleQueryMore(
  1942. this.MoreDataDialog.msg,
  1943. this.MoreDataDialog.key,
  1944. this.MoreDataDialog.target
  1945. );
  1946. },
  1947. // 操作提示弹窗关闭
  1948. handleOptionCancal() {
  1949. this.optionDialog.show = false;
  1950. this.otherDeatils.isEdit = true;
  1951. },
  1952. // 树形节点选择
  1953. handleNodeClick(e) {
  1954. console.log(e, "树形节点选择", this.MoreDataDialog.target);
  1955. // let node = { ...e, name: e.label }
  1956. this.MoreDataDialog.value = e;
  1957. },
  1958. // 修改-更多数据表格——选择行
  1959. handleCurentRow(row) {
  1960. console.log(row, "修改-更多数据表格——选择行");
  1961. this.MoreDataDialog.value = row;
  1962. },
  1963. handleDbClick(row) {
  1964. this.MoreDataDialog.value = row;
  1965. this.handleConfirmRefer();
  1966. },
  1967. // 参照弹窗确认
  1968. handleConfirmRefer() {
  1969. let _this = this;
  1970. console.log(
  1971. "确认参照弹窗",
  1972. `{this.${this.MoreDataDialog.target.name}:${this.MoreDataDialog.value.id}}`
  1973. );
  1974. let confirm = true;
  1975. if (this.MoreDataDialog.target.name == "basicData") {
  1976. // 四级分类
  1977. if (this.MoreDataDialog.target.prop == "classifyId") {
  1978. if (this.MoreDataDialog.value.childrens.length > 0) {
  1979. return this.$modal.notifyWarning("请选择最末级!");
  1980. }
  1981. }
  1982. // 基本信息
  1983. this.basicData.value[this.MoreDataDialog.target.prop] =
  1984. this.MoreDataDialog.value.id;
  1985. this.basicData.value[`${this.MoreDataDialog.target.prop}Name`] =
  1986. this.MoreDataDialog.value.name;
  1987. console.log(
  1988. this.MoreDataDialog.target.prop,
  1989. "props-----------------",
  1990. this.MoreDataDialog.value
  1991. );
  1992. console.log(
  1993. this.basicData.value[`${this.MoreDataDialog.target.prop}`],
  1994. "值",
  1995. this.basicData.value[`${this.MoreDataDialog.target.prop}Name`],
  1996. "//////////基本信息///////////"
  1997. );
  1998. // 默认采购组织:purchasingOrganization 业务部门:businessDepartment
  1999. if (this.MoreDataDialog.target.prop == "purchasingOrganization") {
  2000. this.basicData.value["businessDepartment"] = "";
  2001. this.basicData.value["businessDepartmentName"] = "";
  2002. }
  2003. // 物料税类materialRate
  2004. if (this.MoreDataDialog.target.prop == "materialRate") {
  2005. this.basicData.value["rateCode"] = this.MoreDataDialog.value.code;
  2006. }
  2007. } else if (this.MoreDataDialog.target.name == "medcineData") {
  2008. // 医药信息
  2009. this.medcineData.value[this.MoreDataDialog.target.prop] =
  2010. this.MoreDataDialog.value.id;
  2011. this.medcineData.value[`${this.MoreDataDialog.target.prop}Name`] =
  2012. this.MoreDataDialog.value.name;
  2013. console.log(
  2014. this.MoreDataDialog.target.prop,
  2015. "props-----------------",
  2016. this.MoreDataDialog.value
  2017. );
  2018. console.log(
  2019. this.medcineData.value[`${this.MoreDataDialog.target.prop}Name`],
  2020. "//////医药信息//////////"
  2021. );
  2022. } else if (this.MoreDataDialog.target.name == "otherDeatils") {
  2023. // 其他页签
  2024. this.otherDeatils.value[this.MoreDataDialog.target.prop] =
  2025. this.MoreDataDialog.value.id;
  2026. this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Name`] =
  2027. this.MoreDataDialog.value.name;
  2028. console.log(
  2029. this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Name`],
  2030. "/////////其他页签///////"
  2031. );
  2032. }
  2033. if (confirm) {
  2034. // this.count++;
  2035. this.refer++;
  2036. this.MoreDataDialog.show = false;
  2037. this.MoreDataDialog.key = "";
  2038. this.MoreDataDialog.value = {};
  2039. }
  2040. },
  2041. // 取消-关闭参照弹窗
  2042. handleConcalRefer() {
  2043. this.MoreDataDialog.show = false;
  2044. this.MoreDataDialog.key = "";
  2045. },
  2046. // 关闭参照弹窗前
  2047. handleCloseRefer(done) {
  2048. this.MoreDataDialog.key = "";
  2049. done();
  2050. },
  2051. // 删除利润中心信息
  2052. handledDelCenter(ids) {
  2053. console.log("删除利润中心信息");
  2054. materialApi.delCenter(ids).then((res) => {
  2055. if (res.code == 200) {
  2056. this.handleOtherListRefresh();
  2057. }
  2058. });
  2059. },
  2060. // 删除库存信息
  2061. handleDelInventory(ids) {
  2062. console.log("删除库存信息");
  2063. materialApi.delInventory(ids).then((res) => {
  2064. if (res.code == 200) {
  2065. this.handleOtherListRefresh();
  2066. }
  2067. });
  2068. },
  2069. // 删除成本信息
  2070. handleDelCost(ids) {
  2071. console.log("删除成本信息");
  2072. materialApi.delCost(ids).then((res) => {
  2073. if (res.code == 200) {
  2074. this.handleOtherListRefresh();
  2075. }
  2076. });
  2077. },
  2078. // 删除计划信息
  2079. handleDelPlan(ids) {
  2080. console.log("删除计划信息");
  2081. materialApi.delPlan(ids).then((res) => {
  2082. if (res.code == 200) {
  2083. this.handleOtherListRefresh();
  2084. }
  2085. });
  2086. },
  2087. // 删除财物信息
  2088. handleDelFinance(ids) {
  2089. console.log("删除财物信息");
  2090. materialApi.delFinance(ids).then((res) => {
  2091. if (res.code == 200) {
  2092. this.handleOtherListRefresh();
  2093. }
  2094. });
  2095. },
  2096. // 删除采购信息
  2097. handledelPurchase(ids) {
  2098. console.log("删除采购信息");
  2099. materialApi.delPurchase(ids).then((res) => {
  2100. if (res.code == 200) {
  2101. this.handleOtherListRefresh();
  2102. }
  2103. });
  2104. },
  2105. // 保存物料以及相关页签
  2106. handleSaveMaterial(cb) {
  2107. let param = {
  2108. ...this.basicData.value,
  2109. materialMedcine: this.medcineData.value,
  2110. materialMedcineItem: {},
  2111. };
  2112. // diCode
  2113. param.diCode = param.diCode && param.diCode.replace(/ /g, "");
  2114. console.log(param, "保存物料以及相关页签param");
  2115. materialApi
  2116. .insertMaterialInfo(param)
  2117. .then((res) => {
  2118. console.log(res, "保存物料以及相关页签");
  2119. if (res.code == 200) cb();
  2120. })
  2121. .catch((error) => {
  2122. this.loading = false;
  2123. });
  2124. },
  2125. // 保存财务信息——单个数据
  2126. async handleSaveFinance(data) {
  2127. console.log(data, "保存财务信息——单个数据");
  2128. try {
  2129. this.otherDeatils.loading = true;
  2130. let { code, msg } = await materialApi.financeEdit(data);
  2131. if (code == 200) {
  2132. this.otherDeatils.isEdit = false;
  2133. this.handleOtherRefresh();
  2134. this.$notify.success({
  2135. message: msg,
  2136. });
  2137. }
  2138. } catch (error) {
  2139. } finally {
  2140. this.otherDeatils.loading = false;
  2141. }
  2142. // this.otherDeatils.loading = true;
  2143. // materialApi.financeEdit(data).then(res => {
  2144. // if (res.code == 200) {
  2145. // this.otherDeatils.isEdit = false;
  2146. // this.handleOtherRefresh();
  2147. // }
  2148. // this.otherDeatils.loading = false;
  2149. // })
  2150. },
  2151. // 保存利润中心信息
  2152. async handleSaveCenter(data) {
  2153. console.log(data, "保存利润中心信息");
  2154. try {
  2155. this.otherDeatils.loading = true;
  2156. let { code, msg } = await materialApi.centerEdit(data);
  2157. if (code == 200) {
  2158. this.otherDeatils.isEdit = false;
  2159. this.handleOtherRefresh();
  2160. this.$notify.success({
  2161. message: msg,
  2162. });
  2163. }
  2164. } catch (error) {
  2165. } finally {
  2166. this.otherDeatils.loading = false;
  2167. }
  2168. // materialApi.centerEdit(data).then(res => {
  2169. // if (res.code == 200) {
  2170. // this.otherDeatils.isEdit = false;
  2171. // this.handleOtherRefresh();
  2172. // }
  2173. // })
  2174. },
  2175. // 保存采购信息
  2176. async handleSavePurchase(data) {
  2177. console.log(data, "保存采购信息");
  2178. try {
  2179. this.otherDeatils.loading = true;
  2180. let { code, msg } = await materialApi.purchaseEdit(data);
  2181. if (code == 200) {
  2182. this.otherDeatils.isEdit = false;
  2183. this.handleOtherRefresh();
  2184. this.$notify.success({
  2185. message: msg,
  2186. });
  2187. }
  2188. } catch (error) {
  2189. } finally {
  2190. this.otherDeatils.loading = false;
  2191. }
  2192. // materialApi.purchaseEdit(data).then(res => {
  2193. // if (res.code == 200) {
  2194. // this.otherDeatils.isEdit = false;
  2195. // this.handleOtherRefresh();
  2196. // }
  2197. // })
  2198. },
  2199. // 保存库存信息
  2200. async handleSaveInventoryEdit(data) {
  2201. console.log(data, "保存库存信息");
  2202. try {
  2203. this.otherDeatils.loading = true;
  2204. let { code, msg } = await materialApi.inventoryEdit(data);
  2205. if (code == 200) {
  2206. this.otherDeatils.isEdit = false;
  2207. this.handleOtherRefresh();
  2208. this.$notify.success({
  2209. message: msg,
  2210. });
  2211. }
  2212. } catch (error) {
  2213. } finally {
  2214. this.otherDeatils.loading = false;
  2215. }
  2216. // materialApi.inventoryEdit(data).then(res => {
  2217. // if (res.code == 200) {
  2218. // this.otherDeatils.isEdit = false;
  2219. // this.handleOtherRefresh();
  2220. // }
  2221. // })
  2222. },
  2223. // 保存计划信息
  2224. async handleSavePlan(data) {
  2225. console.log(data, "保存计划信息");
  2226. try {
  2227. this.otherDeatils.loading = true;
  2228. let { code, msg } = await materialApi.planEdit(data);
  2229. if (code == 200) {
  2230. this.otherDeatils.isEdit = false;
  2231. this.handleOtherRefresh();
  2232. this.$notify.success({
  2233. message: msg,
  2234. });
  2235. }
  2236. } catch (error) {
  2237. } finally {
  2238. this.otherDeatils.loading = false;
  2239. }
  2240. // materialApi.planEdit(data).then(res => {
  2241. // if (res.code == 200) {
  2242. // this.otherDeatils.isEdit = false;
  2243. // this.handleOtherRefresh();
  2244. // }
  2245. // })
  2246. },
  2247. // 保存成本信息
  2248. async handleSaveCost(data) {
  2249. console.log(data, "保存成本信息");
  2250. try {
  2251. this.otherDeatils.loading = true;
  2252. let { code, msg } = await materialApi.costEdit(data);
  2253. if (code == 200) {
  2254. this.otherDeatils.isEdit = false;
  2255. this.handleOtherRefresh();
  2256. this.$notify.success({
  2257. message: msg,
  2258. });
  2259. }
  2260. } catch (error) {
  2261. } finally {
  2262. this.otherDeatils.loading = false;
  2263. }
  2264. // materialApi.costEdit(data).then(res => {
  2265. // if (res.code == 200) {
  2266. // this.otherDeatils.isEdit = false;
  2267. // this.handleOtherRefresh();
  2268. // }
  2269. // })
  2270. },
  2271. judgeIsRequriedByProps(message) {
  2272. // condiition:条件,tergetNames:目标porps数组,formName:表单,formRef:表单ref名,
  2273. this[message.formName].form.forEach((formItem) => {
  2274. let target = message.tergetNames.filter((t) => t === formItem.prop);
  2275. if (target && target.length) {
  2276. formItem.required = message.condiition ? false : true;
  2277. }
  2278. });
  2279. this.rules = initRules(this[message.formName].form);
  2280. this.$nextTick(() => {
  2281. message.condiition &&
  2282. this.$refs[message.formRef].clearValidate(message.tergetNames);
  2283. });
  2284. },
  2285. // 重新加载
  2286. async handleRest() {
  2287. this.loading = true;
  2288. // 基本信息
  2289. await this.getTagList("material", async (form) => {
  2290. this.basicData.form = [...form];
  2291. this.rules = initRules(form);
  2292. this.basicData.value = initParams(this.basicData.form, "prop");
  2293. await this.getMaterialDetails(this.materialId, "material");
  2294. });
  2295. // 医疗行业
  2296. await this.getTagList("material_medcine", async (form) => {
  2297. this.medcineData.form = [...form];
  2298. this.medcineData.value = initParams(this.medcineData.form, "prop");
  2299. this.medcineRules = initRules(form);
  2300. await this.getMedcineDetails(this.materialId, "material_medcine");
  2301. });
  2302. },
  2303. },
  2304. watch: {
  2305. // 监听主标签修改标识,控制其他标签是否禁止点击
  2306. updateButtonGroup: function (nVal, oVal) {
  2307. console.log(nVal, "nVal", oVal, "oVal");
  2308. this.detailsTabs = this.detailsTabs.map((item) => {
  2309. item["disabled"] = nVal;
  2310. return item;
  2311. });
  2312. },
  2313. maintainNewVersion: function (nVal, oVal) {
  2314. console.log(nVal, "nVal", oVal, "oVal");
  2315. this.detailsTabs = this.detailsTabs.map((item) => {
  2316. item["disabled"] = nVal;
  2317. return item;
  2318. });
  2319. },
  2320. "basicData.value.isMedicine": {
  2321. handler(nVal, oVal) {
  2322. this.basicData.form = this.basicData.form.map((formItem) => {
  2323. if (formItem.prop === "productionPermit") {
  2324. formItem.required = nVal == "0" ? true : false;
  2325. }
  2326. return formItem;
  2327. });
  2328. },
  2329. deep: true,
  2330. },
  2331. // 物料分类改变同时改变一二三级分类
  2332. "basicData.value.classifyId": {
  2333. async handler(nVal, oVal) {
  2334. if (nVal !== oVal) {
  2335. try {
  2336. let { code, data } = await getDetail(nVal);
  2337. if (code == 200) {
  2338. let { oneClass, twoClass, threeClass } = data;
  2339. this.basicData.value["oneClass"] = oneClass;
  2340. this.basicData.value["twoClass"] = twoClass;
  2341. this.basicData.value["threeClass"] = threeClass;
  2342. }
  2343. } catch (error) {}
  2344. }
  2345. },
  2346. deep: true,
  2347. },
  2348. // 效期管理 expiryDateManagerment 控制 expiryUnitId 效期单位 usefulLife 有效期 usefulLifeUnitId 有效期至单位 必填
  2349. "basicData.value.expiryDateManagerment": {
  2350. handler(nVal, oVal) {
  2351. this.judgeIsRequriedByProps({
  2352. condiition: nVal === "2",
  2353. tergetNames: [
  2354. "expiryUnitId",
  2355. "usefulLife",
  2356. "usefulLifeUnitId",
  2357. "recentWarningPeriod",
  2358. ],
  2359. formName: "basicData",
  2360. formRef: "basicMessageRef",
  2361. });
  2362. },
  2363. deep: true,
  2364. },
  2365. },
  2366. created() {
  2367. // 基本信息
  2368. // this.handleRest();
  2369. // if (window.name === "") {
  2370. // this.$route.query.isEdit && this.handleBasicEdit();
  2371. // } else {
  2372. // console.log("页面被刷新");
  2373. // }
  2374. },
  2375. };
  2376. </script>
  2377. <style lang="scss" scoped>
  2378. .material-details {
  2379. padding: 12px;
  2380. height: 100%;
  2381. // height: calc(100vh - 158px);
  2382. box-sizing: border-box;
  2383. .el-card__body {
  2384. height: calc(100vh - 40px);
  2385. // height: 100%;
  2386. box-sizing: border-box;
  2387. padding: 12px;
  2388. overflow-y: auto;
  2389. overflow-x: auto;
  2390. .el-select {
  2391. width: 100%;
  2392. }
  2393. }
  2394. .md-content {
  2395. // height: calc(100vh - 200px);
  2396. box-sizing: border-box;
  2397. .md-basic {
  2398. overflow: auto;
  2399. .md-main {
  2400. margin-bottom: 10px;
  2401. .el-form {
  2402. max-height: 430px;
  2403. overflow-y: auto;
  2404. overflow-x: hidden;
  2405. .redSpan::before {
  2406. content: "* ";
  2407. color: red;
  2408. }
  2409. .el-checkbox {
  2410. padding: 0 58%;
  2411. }
  2412. }
  2413. }
  2414. .md-vice-content {
  2415. height: 140px;
  2416. overflow-y: auto;
  2417. overflow-x: hidden;
  2418. }
  2419. }
  2420. .md-auditInfo {
  2421. .el-divider--horizontal {
  2422. margin: 20px 0px 15px;
  2423. }
  2424. }
  2425. }
  2426. }
  2427. </style>
  2428. <style scoped>
  2429. >>> .el-drawer__header {
  2430. display: none;
  2431. }
  2432. >>> .el-dialog__header {
  2433. background-color: rgb(244, 244, 244);
  2434. }
  2435. >>> .MoreDataDialog .el-table__body-wrapper {
  2436. height: 300px;
  2437. overflow-y: auto;
  2438. overflow-x: hidden;
  2439. }
  2440. >>> .MoreDataDialog .more-button {
  2441. margin-top: 10px;
  2442. text-align: right;
  2443. }
  2444. >>> .MoreDataDialog .referTree {
  2445. height: 390px;
  2446. overflow-x: hidden;
  2447. overflow-y: auto;
  2448. }
  2449. >>> .MoreDataDialog .el-table {
  2450. margin-top: 10px;
  2451. }
  2452. >>> .MoreDataDialog .el-pagination {
  2453. text-align: right;
  2454. margin-top: 5px;
  2455. }
  2456. >>> .MoreDataDialog .el-dialog__body {
  2457. height: 500px;
  2458. padding: 20px 15px;
  2459. }
  2460. .md-content >>> .el-form-item,
  2461. .otherDialog >>> .el-form-item {
  2462. margin-bottom: 0px;
  2463. }
  2464. .otherDialog >>> .el-collapse-item__content {
  2465. padding-bottom: 12px;
  2466. }
  2467. .otherDialog >>> .el-checkbox {
  2468. width: 100%;
  2469. padding: 0 10%;
  2470. }
  2471. .otherDialog >>> .el-dialog__body {
  2472. padding: 12px 20px;
  2473. height: 80%;
  2474. overflow: auto;
  2475. }
  2476. .otherDialog >>> .od-msg {
  2477. max-height: 220px;
  2478. box-sizing: border-box;
  2479. overflow-y: auto;
  2480. overflow-x: hidden;
  2481. }
  2482. .md-content >>> .el-tabs--border-card > .el-tabs__content {
  2483. padding-bottom: 8px;
  2484. }
  2485. .md-content .md-auditInfo >>> .el-form-item {
  2486. margin-bottom: 0px;
  2487. }
  2488. .md-main >>> .el-form-item,
  2489. .md-vice >>> .el-form-item,
  2490. .od-msg >>> .el-form-item {
  2491. width: 100%;
  2492. box-sizing: border-box;
  2493. }
  2494. .md-main >>> .el-form-item__label,
  2495. .md-vice >>> .el-form-item__label,
  2496. .od-msg >>> .el-form-item__label {
  2497. width: 40%;
  2498. }
  2499. .od-msg >>> .el-checkbox__input {
  2500. width: 15%;
  2501. }
  2502. .md-main >>> .el-form-item__content,
  2503. .md-vice >>> .el-form-item__content,
  2504. .od-msg >>> .el-form-item__content {
  2505. width: 60%;
  2506. box-sizing: border-box;
  2507. height: 36px;
  2508. }
  2509. .od-msg >>> .el-checkbox__label {
  2510. width: 85%;
  2511. box-sizing: border-box;
  2512. font-size: 12px;
  2513. }
  2514. .od-msg-checkedbx >>> .el-form-item__content {
  2515. width: 80%;
  2516. box-sizing: border-box;
  2517. }
  2518. .od-msg-checkedbx >>> .el-checkbox {
  2519. width: 75%;
  2520. box-sizing: border-box;
  2521. }
  2522. .md-content >>> .el-form-item__label,
  2523. .otherDialog >>> .el-form-item__label,
  2524. .od-msg >>> .el-form-item__label,
  2525. .od-msg >>> .el-checkbox__label {
  2526. font-weight: normal;
  2527. /* text-align: left;
  2528. width: 28%; */
  2529. white-space: nowrap;
  2530. /* IE6 需要定义宽度 */
  2531. overflow: hidden;
  2532. -o-text-overflow: ellipsis;
  2533. /* Opera */
  2534. text-overflow: ellipsis;
  2535. /* IE, Safari (WebKit) */
  2536. /* -moz-binding: url('ellipsis.xml#ellipsis'); */
  2537. /* Firefox */
  2538. }
  2539. .otherDialog >>> .el-form-item__label {
  2540. font-size: 12px;
  2541. }
  2542. .md-main >>> .material-table {
  2543. height: 100%;
  2544. }
  2545. .md-vice >>> .material-table {
  2546. height: 140px;
  2547. overflow-y: auto;
  2548. overflow-x: auto;
  2549. }
  2550. >>> .referTree {
  2551. margin-top: 10px;
  2552. }
  2553. </style>