enterpriseInformation.vue 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490
  1. <template>
  2. <div class="layout_display_flex_y">
  3. <div class="obviousBox">
  4. <searchArea :searchData="searchData" @submit="searchByForm"></searchArea>
  5. </div>
  6. <div class="layout_display_flex_y">
  7. <el-tabs class="el-tabs__fill" v-model="editableTabsValue" type="border-card" @tab-click="handleClick">
  8. <div style="padding: 6px; background-color: #fff;">
  9. <el-button type="primary" icon="Plus" @click="onAddItem" style="margin-left: 5px">新增</el-button>
  10. </div>
  11. <el-tab-pane key="ypClass" label="供应商字典" name="ypClass" style="height: 90%;">
  12. <div class="layout_display_flex_y">
  13. <div class="layout_flex_1-y">
  14. <el-table
  15. :data="ypClassData.slice(pageSizeClass * (currentPageClass - 1), pageSizeClass * currentPageClass)"
  16. border style="width: 100%" height="100%" stripe highlight-current-row
  17. class="ypClassTable normal-size">
  18. <el-table-column prop="code" label="供应商编码" width="80">
  19. <template v-slot="scope">
  20. <el-input v-if="scope.row.isEdit" size="small"
  21. v-model="scope.row.code"></el-input>
  22. <span v-else>{{ scope.row.code }}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="name" label="供应商名称" width="200">
  26. <template v-slot="scope">
  27. <el-input v-if="scope.row.isEdit" size="small"
  28. v-model="scope.row.name"></el-input>
  29. <span v-else>{{ scope.row.name }}</span>
  30. </template>
  31. </el-table-column>
  32. <el-table-column prop="pyCode" label="拼音码" width="140" />
  33. <el-table-column prop="dcode" label="五笔码" width="140" />
  34. <el-table-column prop="name" label="厂商类型" width="200">
  35. <template v-slot="scope">
  36. <el-input v-if="scope.row.isEdit" size="small"
  37. v-model="scope.row.name"></el-input>
  38. <span v-else>{{ scope.row.name }}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="name" label="地址" width="200">
  42. <template v-slot="scope">
  43. <el-input v-if="scope.row.isEdit" size="small"
  44. v-model="scope.row.name"></el-input>
  45. <span v-else>{{ scope.row.name }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="name" label="电话" width="140">
  49. <template v-slot="scope">
  50. <el-input v-if="scope.row.isEdit" size="small"
  51. v-model="scope.row.name"></el-input>
  52. <span v-else>{{ scope.row.name }}</span>
  53. </template>
  54. </el-table-column>
  55. =<el-table-column prop="name" label="账号" width="140">
  56. <template v-slot="scope">
  57. <el-input v-if="scope.row.isEdit" size="small"
  58. v-model="scope.row.name"></el-input>
  59. <span v-else>{{ scope.row.name }}</span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column prop="name" label="开户银行" width="140">
  63. <template v-slot="scope">
  64. <el-input v-if="scope.row.isEdit" size="small"
  65. v-model="scope.row.name"></el-input>
  66. <span v-else>{{ scope.row.name }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="delFlag" label="是否停用" width="100">
  70. <template v-slot="scope">
  71. <div v-if="scope.row.isEdit">
  72. <el-select v-model="scope.row.delFlag" clearable placeholder="请选择是否停用">
  73. <el-option v-for="option in delFlagOptions" :key="option.code"
  74. :label="option.name" :value="option.code"></el-option>
  75. </el-select>
  76. </div>
  77. <div v-else>
  78. <el-select v-model="scope.row.delFlag" disabled placeholder="请选择是否无效">
  79. <el-option v-for="option in delFlagOptions" :key="option.code"
  80. :label="option.name" :value="option.code"></el-option>
  81. </el-select>
  82. </div>
  83. </template>
  84. </el-table-column>
  85. <el-table-column fixed="right" label="操作" min-width="180" width="180" center>
  86. <template #default="scope">
  87. <el-button type="primary" size="small" v-if="!scope.row.isEdit"
  88. @click="editYpClass(scope.row)">编辑</el-button>
  89. <el-button type="primary" size="small" v-if="scope.row.isEdit"
  90. @click="updateYpClass(scope.row)">保存</el-button>
  91. <el-button type="primary" size="small" v-if="scope.row.isEdit"
  92. @click="cancelYpClass(scope.row)">取消
  93. </el-button>
  94. <el-button type="danger" size="small"
  95. @click.prevent="deleteYpClass(scope.$index, scope.row)">
  96. 删除
  97. </el-button>
  98. <el-button type="success" size="small"
  99. v-if="!scope.row.isEdit && scope.row.delFlag === '1'"
  100. @click.prevent="deleteYpClass(scope.$index, scope.row)">
  101. 启用
  102. </el-button>
  103. <el-button type="info" size="small"
  104. v-if="!scope.row.isEdit && scope.row.delFlag === '0'"
  105. @click.prevent="deleteYpClass(scope.$index, scope.row)">
  106. 停用
  107. </el-button>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. </div>
  112. <div>
  113. <el-pagination :current-page="currentPageClass" :page-size="pageSizeClass"
  114. :page-sizes="[10, 15, 20, 25]" :total="ypClassData.length"
  115. layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
  116. @size-change="handleSizeChangeClass" @current-change="handleCurrentChangeClass">
  117. </el-pagination>
  118. </div>
  119. </div>
  120. </el-tab-pane>
  121. <el-tab-pane key="drugKind" label="生产厂家字典" name="drugKind" style="height: 90%;">
  122. <div class="layout_display_flex_y">
  123. <div class="layout_flex_1-y">
  124. <el-table
  125. :data="drugKindData.slice(pageSizeKind * (currentPageKind - 1), pageSizeKind * currentPageKind)"
  126. border style="width: 100%" height="100%" stripe highlight-current-row
  127. class="drugKindTable normal-size">
  128. <el-table-column prop="code" label="厂家编码" width="80">
  129. <template v-slot="scope">
  130. <el-input v-if="scope.row.isEdit" size="small"
  131. v-model="scope.row.code"></el-input>
  132. <span v-else>{{ scope.row.code }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column prop="name" label="厂家名称" width="200">
  136. <template v-slot="scope">
  137. <el-input v-if="scope.row.isEdit" size="small"
  138. v-model="scope.row.name"></el-input>
  139. <span v-else>{{ scope.row.name }}</span>
  140. </template>
  141. </el-table-column>
  142. <el-table-column prop="pyCode" label="拼音码" width="140" />
  143. <el-table-column prop="dcode" label="五笔码" width="140" />
  144. <el-table-column prop="name" label="厂商类型" width="200">
  145. <template v-slot="scope">
  146. <el-input v-if="scope.row.isEdit" size="small"
  147. v-model="scope.row.name"></el-input>
  148. <span v-else>{{ scope.row.name }}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column prop="name" label="地址" width="200">
  152. <template v-slot="scope">
  153. <el-input v-if="scope.row.isEdit" size="small"
  154. v-model="scope.row.name"></el-input>
  155. <span v-else>{{ scope.row.name }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column prop="name" label="电话" width="140">
  159. <template v-slot="scope">
  160. <el-input v-if="scope.row.isEdit" size="small"
  161. v-model="scope.row.name"></el-input>
  162. <span v-else>{{ scope.row.name }}</span>
  163. </template>
  164. </el-table-column>
  165. =<el-table-column prop="name" label="账号" width="140">
  166. <template v-slot="scope">
  167. <el-input v-if="scope.row.isEdit" size="small"
  168. v-model="scope.row.name"></el-input>
  169. <span v-else>{{ scope.row.name }}</span>
  170. </template>
  171. </el-table-column>
  172. <el-table-column prop="name" label="开户银行" width="140">
  173. <template v-slot="scope">
  174. <el-input v-if="scope.row.isEdit" size="small"
  175. v-model="scope.row.name"></el-input>
  176. <span v-else>{{ scope.row.name }}</span>
  177. </template>
  178. </el-table-column>
  179. <el-table-column prop="delFlag" label="是否停用" width="100">
  180. <template v-slot="scope">
  181. <div v-if="scope.row.isEdit">
  182. <el-select v-model="scope.row.delFlag" clearable placeholder="请选择是否停用">
  183. <el-option v-for="option in delFlagOptions" :key="option.code"
  184. :label="option.name" :value="option.code"></el-option>
  185. </el-select>
  186. </div>
  187. <div v-else>
  188. <el-select v-model="scope.row.delFlag" disabled placeholder="请选择是否无效">
  189. <el-option v-for="option in delFlagOptions" :key="option.code"
  190. :label="option.name" :value="option.code"></el-option>
  191. </el-select>
  192. </div>
  193. </template>
  194. </el-table-column>
  195. <el-table-column fixed="right" label="操作" min-width="180" width="180" center>
  196. <template #default="scope">
  197. <el-button type="primary" size="small" v-if="!scope.row.isEdit"
  198. @click="editYpClass(scope.row)">编辑</el-button>
  199. <el-button type="primary" size="small" v-if="scope.row.isEdit"
  200. @click="updateYpClass(scope.row)">保存</el-button>
  201. <el-button type="primary" size="small" v-if="scope.row.isEdit"
  202. @click="cancelYpClass(scope.row)">取消
  203. </el-button>
  204. <el-button type="danger" size="small"
  205. @click.prevent="deleteYpClass(scope.$index, scope.row)">
  206. 删除
  207. </el-button>
  208. <el-button type="success" size="small"
  209. v-if="!scope.row.isEdit && scope.row.delFlag === '1'"
  210. @click.prevent="deleteYpClass(scope.$index, scope.row)">
  211. 启用
  212. </el-button>
  213. <el-button type="info" size="small"
  214. v-if="!scope.row.isEdit && scope.row.delFlag === '0'"
  215. @click.prevent="deleteYpClass(scope.$index, scope.row)">
  216. 停用
  217. </el-button>
  218. </template>
  219. </el-table-column>
  220. </el-table>
  221. </div>
  222. <div>
  223. <el-pagination :current-page="currentPageKind" :page-size="pageSizeKind"
  224. :page-sizes="[10, 15, 20, 25]" :total="drugKindData.length"
  225. layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
  226. @size-change="handleSizeChangeKind" @current-change="handleCurrentChangeKind">
  227. </el-pagination>
  228. </div>
  229. </div>
  230. </el-tab-pane>
  231. </el-tabs>
  232. </div>
  233. <el-dialog v-model="centerDialogVisible" :title="'新增' + currentTabLabel" width="500" center>
  234. <template #footer>
  235. <el-form :model="addItemForm" label-width="auto" style="max-width: 600px">
  236. <el-row type="flex" justify="center" :gutter="0">
  237. <el-col :span="colSize">
  238. <el-form-item label="供应商名称">
  239. <el-input v-model="addItemForm.name" />
  240. </el-form-item>
  241. </el-col>
  242. <el-col :span="colSize">
  243. <el-form-item label="厂商类型">
  244. <el-select v-model="addItemForm.region" placeholder="please select your zone">
  245. <el-option label="Zone one" value="shanghai" />
  246. <el-option label="Zone two" value="beijing" />
  247. </el-select>
  248. </el-form-item>
  249. </el-col>
  250. </el-row>
  251. <el-row type="flex" justify="center" :gutter="0">
  252. <el-col :span="colSize">
  253. <el-form-item label="地址">
  254. <el-input v-model="addItemForm.name" />
  255. </el-form-item>
  256. </el-col>
  257. <el-col :span="colSize">
  258. <el-form-item label="电话">
  259. <el-input v-model="addItemForm.name" />
  260. </el-form-item>
  261. </el-col>
  262. </el-row>
  263. <el-row type="flex" justify="center" :gutter="0">
  264. <el-col :span="colSize">
  265. <el-form-item label="账号">
  266. <el-input v-model="addItemForm.name" />
  267. </el-form-item>
  268. </el-col>
  269. <el-col :span="colSize">
  270. <el-form-item label="开户银行">
  271. <el-input v-model="addItemForm.name" />
  272. </el-form-item>
  273. </el-col>
  274. </el-row>
  275. <el-row type="flex" justify="center" :gutter="0">
  276. <el-col :span="colSize">
  277. <el-form-item label="是否停用">
  278. <el-select v-model="addItemForm.region" placeholder="please select your zone">
  279. <el-option label="停用" value="1" />
  280. <el-option label="启用" value="0" />
  281. </el-select>
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="colSize">
  285. </el-col>
  286. </el-row>
  287. </el-form>
  288. <div class="dialog-footer">
  289. <el-button @click="centerDialogVisible = false">Cancel</el-button>
  290. <el-button type="primary" @click="centerDialogVisible = false">
  291. Confirm
  292. </el-button>
  293. </div>
  294. </template>
  295. </el-dialog>
  296. </div>
  297. </template>
  298. <script setup name="YpDict">
  299. import { ref, onMounted, nextTick } from 'vue'
  300. import { ElMessage, ElMessageBox } from 'element-plus'
  301. import {
  302. selectYpClass, saveYpClass, delYpClassByCode,
  303. selectDrugKind, saveDrugKind, delDrugKindByCode,
  304. selectYpDosage, saveYpDosage, delYpDosageByCode,
  305. selectYpUnit, saveYpUnit, delYpUnitByCode,
  306. selectYpChargeGroup, saveYpChargeGroup, delYpChargeGroupByCode,
  307. selectYpVisibleFlag, updateYpVisibleFlag,
  308. selectYpSupply, saveYpSupply, delYpSupplyByCode,
  309. selectYpManuFactory, saveYpManuFactory, delYpManuFactoryByCode
  310. } from '@/api/yp-dict/yp-dict-base.js'
  311. import searchArea from '@/components/searchArea/index.vue';
  312. const editableTabsValue = ref('ypClass')
  313. const msgTip = '分类编码(code)有变更,原始字典记录存在关联,请谨慎做更改,是否确认!!!'
  314. const delFlagOptions = [{ code: '0', name: '启用' }, { code: '1', name: '停用' }]
  315. const searchData = ref([
  316. {
  317. label: '企业名称',
  318. key: 'vehicleName',
  319. type: 'input',
  320. value: '',
  321. clearable: true,
  322. },
  323. ])
  324. let addItemForm = reactive({})
  325. let centerDialogVisible = ref(false)
  326. let currentTabLabel = ref('供应商')
  327. const colSize = ref(12)
  328. const pageSizeClass = ref(20)
  329. const currentPageClass = ref(1)
  330. const handleSizeChangeClass = (val) => {
  331. pageSizeClass.value = val
  332. }
  333. const handleCurrentChangeClass = (val) => {
  334. currentPageClass.value = val
  335. }
  336. const pageSizeKind = ref(20)
  337. const currentPageKind = ref(1)
  338. const handleSizeChangeKind = (val) => {
  339. pageSizeKind.value = val
  340. }
  341. const handleCurrentChangeKind = (val) => {
  342. currentPageKind.value = val
  343. }
  344. const pageSizeDosage = ref(20)
  345. const currentPageDosage = ref(1)
  346. const pageSizeUnit = ref(20)
  347. const currentPageUnit = ref(1)
  348. const pageSize = ref(20)
  349. const currentPage = ref(1)
  350. const pageSizeSupply = ref(20)
  351. const currentPageSupply = ref(1)
  352. const pageSizeManuFactory = ref(20)
  353. const currentPageManuFactory = ref(1)
  354. const ypClassData = ref([])
  355. const drugKindData = ref([])
  356. const ypDosageData = ref([])
  357. const ypUnitData = ref([])
  358. const ypChargeGroupData = ref([])
  359. const visibleFlagData = ref([])
  360. const ypSupplyData = ref([])
  361. const ypManuFactoryData = ref([])
  362. const text = ref('')
  363. onMounted(() => {
  364. nextTick(() => {
  365. queryYpClass()
  366. })
  367. })
  368. //搜索表单方法
  369. const searchByForm = (form) => {
  370. console.log("search", form)
  371. }
  372. // 查询药品字典-药性字典
  373. const queryYpClass = () => {
  374. selectYpClass(text.value)
  375. .then((res) => {
  376. res.forEach(row => {
  377. // 是否标记
  378. row['isEdit'] = false
  379. // 是否新增
  380. row['isAdd'] = false
  381. })
  382. ypClassData.value = res
  383. })
  384. .catch(() => {
  385. ypClassData.value = []
  386. })
  387. }
  388. // 查询药品字典-药品分类字典
  389. const queryDrugKind = () => {
  390. selectDrugKind(text.value)
  391. .then((res) => {
  392. res.forEach(row => {
  393. // 是否标记
  394. row['isEdit'] = false
  395. // 是否新增
  396. row['isAdd'] = false
  397. })
  398. drugKindData.value = res
  399. })
  400. .catch(() => {
  401. drugKindData.value = []
  402. })
  403. }
  404. // 查询药房药品停用情况
  405. const flagFilter = ref('')
  406. const queryVisibleFlag = () => {
  407. selectYpVisibleFlag(text.value, flagFilter.value)
  408. .then((res) => {
  409. res.forEach(row => {
  410. // 是否标记
  411. row['isEdit'] = false
  412. // 是否新增
  413. row['isAdd'] = false
  414. })
  415. visibleFlagData.value = res
  416. })
  417. .catch(() => {
  418. visibleFlagData.value = []
  419. })
  420. }
  421. // 查询
  422. const queryItem = () => {
  423. if (editableTabsValue.value === 'ypClass') {
  424. queryYpClass()
  425. } else if (editableTabsValue.value === 'drugKind') {
  426. queryDrugKind()
  427. }
  428. }
  429. // 新增行
  430. const onAddItem = () => {
  431. console.log('onAddItem')
  432. centerDialogVisible.value = true
  433. return
  434. if (editableTabsValue.value === 'ypClass') {
  435. let count
  436. if (ypClassData.value.length % pageSizeClass.value === 0) {
  437. count = Math.ceil(ypClassData.value.length / pageSizeClass.value) + 1
  438. } else {
  439. count = Math.ceil(ypClassData.value.length / pageSizeClass.value)
  440. }
  441. currentPageClass.value = count
  442. ypClassData.value.push({
  443. code: '',
  444. name: '',
  445. pyCode: '',
  446. dcode: '',
  447. delFlag: '',
  448. isEdit: true,
  449. isAdd: true,
  450. })
  451. const el = document.querySelector('.ypClassTable .el-scrollbar__wrap')
  452. const el2 = document.querySelector('.ypClassTable .el-table__body tbody')
  453. setTimeout(() => {
  454. const height = el2.clientHeight - el.clientHeight
  455. if (height > 0) {
  456. el.scrollTop = height
  457. }
  458. }, 100)
  459. } else if (editableTabsValue.value === 'drugKind') {
  460. let count
  461. if (drugKindData.value.length % pageSizeKind.value === 0) {
  462. count = Math.ceil(drugKindData.value.length / pageSizeKind.value) + 1
  463. } else {
  464. count = Math.ceil(drugKindData.value.length / pageSizeKind.value)
  465. }
  466. currentPageKind.value = count
  467. drugKindData.value.push({
  468. code: '',
  469. name: '',
  470. pyCode: '',
  471. dcode: '',
  472. ypType: '',
  473. mzBillCode: '',
  474. zyBillCode: '',
  475. isEdit: true,
  476. isAdd: true,
  477. })
  478. const el = document.querySelector('.drugKindTable .el-scrollbar__wrap')
  479. const el2 = document.querySelector('.drugKindTable .el-table__body tbody')
  480. setTimeout(() => {
  481. const height = el2.clientHeight - el.clientHeight
  482. if (height > 0) {
  483. el.scrollTop = height
  484. }
  485. }, 100)
  486. }
  487. }
  488. // 药品字典-药性字典增删改存开始
  489. // 编辑
  490. const editYpClass = (row) => {
  491. // 备份原始数据
  492. row['oldRow'] = JSON.parse(JSON.stringify(row))
  493. row.isEdit = true
  494. }
  495. // 取消
  496. const cancelYpClass = (row) => {
  497. // 如果是新增的数据
  498. if (row.isAdd) {
  499. ypClassData.value.splice(ypClassData.value.length - 1, 1)
  500. } else {
  501. // 不是新增的数据 还原数据
  502. for (const i in row.oldRow) {
  503. row[i] = row.oldRow[i]
  504. }
  505. }
  506. }
  507. // 保存
  508. const updateYpClass = (row) => {
  509. if (!row.code || !row.name) {
  510. ElMessage({
  511. type: "warning",
  512. message: "药性字典编码或名称不存在,请检查!",
  513. duration: 2500,
  514. showClose: true,
  515. });
  516. return
  517. }
  518. if (row.isAdd) {
  519. let fe = 0
  520. for (let num in ypClassData.value) {
  521. if (ypClassData.value[num].code === row.code) {
  522. fe++
  523. }
  524. }
  525. if (fe === 2) {
  526. ElMessage({
  527. type: "warning",
  528. message: "存在重复的药性字典,请核对!",
  529. duration: 2500,
  530. showClose: true,
  531. });
  532. } else {
  533. callSaveYpClass(row, null)
  534. }
  535. } else {
  536. let oldCode = row.oldRow.code
  537. if (oldCode !== row.code) {
  538. ElMessageBox.confirm(msgTip, {
  539. cancelButtonText: '取消',
  540. confirmButtonText: '确定',
  541. type: 'warning',
  542. distinguishCancelAndClose: true,
  543. dangerouslyUseHTMLString: true
  544. }).then(() => {
  545. callSaveYpClass(row, oldCode)
  546. }).catch((action) => {
  547. if (action === 'cancel') {
  548. queryYpClass()
  549. }
  550. })
  551. } else {
  552. callSaveYpClass(row, oldCode)
  553. }
  554. }
  555. }
  556. const callSaveYpClass = (row, oldCode) => {
  557. let title = '请确认是否保存<span style="color:#d12020;">' + row.name + '</span>?'
  558. ElMessageBox.confirm(title, {
  559. cancelButtonText: '取消',
  560. confirmButtonText: '确定',
  561. type: 'warning',
  562. distinguishCancelAndClose: true,
  563. dangerouslyUseHTMLString: true
  564. }).then(() => {
  565. saveYpClass(row).then((res) => {
  566. ElMessage({
  567. type: "success",
  568. message: res.cg,
  569. duration: 2500,
  570. showClose: true,
  571. });
  572. if (oldCode !== null && oldCode !== row.code) {
  573. // 删除原始数据
  574. delYpClassByCode(oldCode).then((res) => {
  575. queryYpClass()
  576. })
  577. } else {
  578. queryYpClass()
  579. }
  580. })
  581. }).catch((action) => {
  582. if (action === 'cancel') {
  583. queryYpClass()
  584. }
  585. })
  586. }
  587. const deleteYpClass = (index, row) => {
  588. let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
  589. ElMessageBox.confirm(title, {
  590. cancelButtonText: '取消',
  591. confirmButtonText: '确定',
  592. type: 'warning',
  593. distinguishCancelAndClose: true,
  594. dangerouslyUseHTMLString: true
  595. }).then(() => {
  596. delYpClassByCode(row.code).then((res) => {
  597. ElMessage({
  598. type: "success",
  599. message: res.cg,
  600. duration: 2500,
  601. showClose: true,
  602. });
  603. queryYpClass()
  604. })
  605. }).catch((action) => {
  606. if (action === 'cancel') {
  607. queryYpClass()
  608. }
  609. })
  610. }
  611. const callSaveDrugKind = (row, oldCode) => {
  612. let title = '请确认是否保存<span style="color:#d12020;">' + row.name + '</span>?'
  613. ElMessageBox.confirm(title, {
  614. cancelButtonText: '取消',
  615. confirmButtonText: '确定',
  616. type: 'warning',
  617. distinguishCancelAndClose: true,
  618. dangerouslyUseHTMLString: true
  619. }).then(() => {
  620. saveDrugKind(row).then((res) => {
  621. ElMessage({
  622. type: "success",
  623. message: res.cg,
  624. duration: 2500,
  625. showClose: true,
  626. });
  627. if (oldCode !== null && oldCode !== row.code) {
  628. // 删除原始数据
  629. delDrugKindByCode(oldCode).then((res) => {
  630. queryDrugKind()
  631. })
  632. } else {
  633. queryDrugKind()
  634. }
  635. })
  636. }).catch((action) => {
  637. if (action === 'cancel') {
  638. queryDrugKind()
  639. }
  640. })
  641. }
  642. const deleteDrugKind = (index, row) => {
  643. let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
  644. ElMessageBox.confirm(title, {
  645. cancelButtonText: '取消',
  646. confirmButtonText: '确定',
  647. type: 'warning',
  648. distinguishCancelAndClose: true,
  649. dangerouslyUseHTMLString: true
  650. }).then(() => {
  651. delDrugKindByCode(row.code).then((res) => {
  652. ElMessage({
  653. type: "success",
  654. message: res.cg,
  655. duration: 2500,
  656. showClose: true,
  657. });
  658. queryDrugKind()
  659. })
  660. }).catch((action) => {
  661. if (action === 'cancel') {
  662. queryDrugKind()
  663. }
  664. })
  665. }
  666. // 药品字典-药品分类字典增删改存结束
  667. // 药品字典-药品剂型字典增删改存开始
  668. // 编辑
  669. const editYpDosage = (row) => {
  670. // 备份原始数据
  671. row['oldRow'] = JSON.parse(JSON.stringify(row))
  672. row.isEdit = true
  673. }
  674. // 取消
  675. const cancelYpDosage = (row) => {
  676. // 如果是新增的数据
  677. if (row.isAdd) {
  678. ypDosageData.value.splice(ypDosageData.value.length - 1, 1)
  679. } else {
  680. // 不是新增的数据 还原数据
  681. for (const i in row.oldRow) {
  682. row[i] = row.oldRow[i]
  683. }
  684. }
  685. }
  686. // 保存
  687. const updateYpDosage = (row) => {
  688. if (!row.code || !row.name) {
  689. ElMessage({
  690. type: "warning",
  691. message: "药品剂型字典编码或名称不存在,请检查!",
  692. duration: 2500,
  693. showClose: true,
  694. });
  695. return
  696. }
  697. if (row.isAdd) {
  698. let fe = 0
  699. for (let num in ypDosageData.value) {
  700. if (ypDosageData.value[num].code === row.code) {
  701. fe++
  702. }
  703. }
  704. if (fe === 2) {
  705. ElMessage({
  706. type: "warning",
  707. message: "存在重复的药品剂型字典,请核对!",
  708. duration: 2500,
  709. showClose: true,
  710. });
  711. } else {
  712. callSaveYpDosage(row, null)
  713. }
  714. } else {
  715. let oldCode = row.oldRow.code
  716. if (oldCode !== row.code) {
  717. ElMessageBox.confirm(msgTip, {
  718. cancelButtonText: '取消',
  719. confirmButtonText: '确定',
  720. type: 'warning',
  721. distinguishCancelAndClose: true,
  722. dangerouslyUseHTMLString: true
  723. }).then(() => {
  724. callSaveYpDosage(row, oldCode)
  725. }).catch((action) => {
  726. if (action === 'cancel') {
  727. queryYpDosage()
  728. }
  729. })
  730. } else {
  731. callSaveYpDosage(row, oldCode)
  732. }
  733. }
  734. }
  735. const callSaveYpDosage = (row, oldCode) => {
  736. let title = '请确认是否保存<span style="color:#d12020;">' + row.name + '</span>?'
  737. ElMessageBox.confirm(title, {
  738. cancelButtonText: '取消',
  739. confirmButtonText: '确定',
  740. type: 'warning',
  741. distinguishCancelAndClose: true,
  742. dangerouslyUseHTMLString: true
  743. }).then(() => {
  744. saveYpDosage(row).then((res) => {
  745. ElMessage({
  746. type: "success",
  747. message: res.cg,
  748. duration: 2500,
  749. showClose: true,
  750. });
  751. if (oldCode !== null && oldCode !== row.code) {
  752. // 删除原始数据
  753. delYpDosageByCode(oldCode).then((res) => {
  754. queryYpDosage()
  755. })
  756. } else {
  757. queryYpDosage()
  758. }
  759. })
  760. }).catch((action) => {
  761. if (action === 'cancel') {
  762. queryYpDosage()
  763. }
  764. })
  765. }
  766. const deleteYpDosage = (index, row) => {
  767. let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
  768. ElMessageBox.confirm(title, {
  769. cancelButtonText: '取消',
  770. confirmButtonText: '确定',
  771. type: 'warning',
  772. distinguishCancelAndClose: true,
  773. dangerouslyUseHTMLString: true
  774. }).then(() => {
  775. delYpDosageByCode(row.code).then((res) => {
  776. ElMessage({
  777. type: "success",
  778. message: res.cg,
  779. duration: 2500,
  780. showClose: true,
  781. });
  782. queryYpDosage()
  783. })
  784. }).catch((action) => {
  785. if (action === 'cancel') {
  786. queryYpDosage()
  787. }
  788. })
  789. }
  790. // 药品字典-药品剂型字典增删改存结束
  791. // 药品字典-药品单位字典增删改存开始
  792. // 编辑
  793. const editYpUnit = (row) => {
  794. // 备份原始数据
  795. row['oldRow'] = JSON.parse(JSON.stringify(row))
  796. row.isEdit = true
  797. }
  798. // 取消
  799. const cancelYpUnit = (row) => {
  800. // 如果是新增的数据
  801. if (row.isAdd) {
  802. ypUnitData.value.splice(ypUnitData.value.length - 1, 1)
  803. } else {
  804. // 不是新增的数据 还原数据
  805. for (const i in row.oldRow) {
  806. row[i] = row.oldRow[i]
  807. }
  808. }
  809. }
  810. // 保存
  811. const updateYpUnit = (row) => {
  812. if (!row.code || !row.name) {
  813. ElMessage({
  814. type: "warning",
  815. message: "药品单位字典编码或名称不存在,请检查!",
  816. duration: 2500,
  817. showClose: true,
  818. });
  819. return
  820. }
  821. if (row.isAdd) {
  822. let fe = 0
  823. for (let num in ypUnitData.value) {
  824. if (ypUnitData.value[num].code === row.code) {
  825. fe++
  826. }
  827. }
  828. if (fe === 2) {
  829. ElMessage({
  830. type: "warning",
  831. message: "存在重复的药品单位字典,请核对!",
  832. duration: 2500,
  833. showClose: true,
  834. });
  835. } else {
  836. callSaveYpUnit(row, null)
  837. }
  838. } else {
  839. let oldCode = row.oldRow.code
  840. if (oldCode !== row.code) {
  841. ElMessageBox.confirm(msgTip, {
  842. cancelButtonText: '取消',
  843. confirmButtonText: '确定',
  844. type: 'warning',
  845. distinguishCancelAndClose: true,
  846. dangerouslyUseHTMLString: true
  847. }).then(() => {
  848. callSaveYpUnit(row, oldCode)
  849. }).catch((action) => {
  850. if (action === 'cancel') {
  851. queryYpUnit()
  852. }
  853. })
  854. } else {
  855. callSaveYpUnit(row, oldCode)
  856. }
  857. }
  858. }
  859. const callSaveYpUnit = (row, oldCode) => {
  860. let title = '请确认是否保存<span style="color:#d12020;">' + row.name + '</span>?'
  861. ElMessageBox.confirm(title, {
  862. cancelButtonText: '取消',
  863. confirmButtonText: '确定',
  864. type: 'warning',
  865. distinguishCancelAndClose: true,
  866. dangerouslyUseHTMLString: true
  867. }).then(() => {
  868. saveYpUnit(row).then((res) => {
  869. ElMessage({
  870. type: "success",
  871. message: res.cg,
  872. duration: 2500,
  873. showClose: true,
  874. });
  875. // 若修改了主键code,则需要删除原来的记录
  876. if (oldCode !== null && oldCode !== row.code) {
  877. // 删除原始数据
  878. delYpUnitByCode(oldCode).then((res) => {
  879. queryYpUnit()
  880. })
  881. } else {
  882. queryYpUnit()
  883. }
  884. })
  885. }).catch((action) => {
  886. if (action === 'cancel') {
  887. queryYpUnit()
  888. }
  889. })
  890. }
  891. const deleteYpUnit = (index, row) => {
  892. let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
  893. ElMessageBox.confirm(title, {
  894. cancelButtonText: '取消',
  895. confirmButtonText: '确定',
  896. type: 'warning',
  897. distinguishCancelAndClose: true,
  898. dangerouslyUseHTMLString: true
  899. }).then(() => {
  900. delYpUnitByCode(row.code).then((res) => {
  901. ElMessage({
  902. type: "success",
  903. message: res.cg,
  904. duration: 2500,
  905. showClose: true,
  906. });
  907. queryYpUnit()
  908. })
  909. }).catch((action) => {
  910. if (action === 'cancel') {
  911. queryYpUnit()
  912. }
  913. })
  914. }
  915. // 药品字典-药品单位字典增删改存结束
  916. // 药品字典-药品费别字典增删改存开始
  917. // 编辑
  918. const editYpChargeGroup = (row) => {
  919. // 备份原始数据
  920. row['oldRow'] = JSON.parse(JSON.stringify(row))
  921. row.isEdit = true
  922. }
  923. // 取消
  924. const cancelYpChargeGroup = (row, index) => {
  925. // 如果是新增的数据
  926. if (row.isAdd) {
  927. ypChargeGroupData.value.splice(index, 1)
  928. } else {
  929. // 不是新增的数据 还原数据
  930. for (const i in row.oldRow) {
  931. row[i] = row.oldRow[i]
  932. }
  933. }
  934. }
  935. // 保存
  936. const updateYpChargeGroup = (row) => {
  937. if (!row.code || !row.name) {
  938. ElMessage({
  939. type: "warning",
  940. message: "药品费别字典编码或名称不存在,请检查!",
  941. duration: 2500,
  942. showClose: true,
  943. });
  944. return
  945. }
  946. if (row.isAdd) {
  947. let fe = 0
  948. for (let num in ypChargeGroupData.value) {
  949. if (ypChargeGroupData.value[num].code === row.code) {
  950. fe++
  951. }
  952. }
  953. if (fe === 2) {
  954. ElMessage({
  955. type: "warning",
  956. message: "存在重复的药品费别字典,请核对!",
  957. duration: 2500,
  958. showClose: true,
  959. });
  960. } else {
  961. callSaveYpChargeGroup(row, null)
  962. }
  963. } else {
  964. let oldCode = row.oldRow.code
  965. if (oldCode !== row.code) {
  966. ElMessageBox.confirm(msgTip, {
  967. cancelButtonText: '取消',
  968. confirmButtonText: '确定',
  969. type: 'warning',
  970. distinguishCancelAndClose: true,
  971. dangerouslyUseHTMLString: true
  972. }).then(() => {
  973. callSaveYpChargeGroup(row, oldCode)
  974. }).catch((action) => {
  975. if (action === 'cancel') {
  976. queryYpChargeGroup()
  977. }
  978. })
  979. } else {
  980. callSaveYpChargeGroup(row, oldCode)
  981. }
  982. }
  983. }
  984. const callSaveYpChargeGroup = (row, oldCode) => {
  985. let title = '请确认是否保存<span style="color:#d12020;">' + row.name + '</span>?'
  986. ElMessageBox.confirm(title, {
  987. cancelButtonText: '取消',
  988. confirmButtonText: '确定',
  989. type: 'warning',
  990. distinguishCancelAndClose: true,
  991. dangerouslyUseHTMLString: true
  992. }).then(() => {
  993. saveYpChargeGroup(row).then((res) => {
  994. ElMessage({
  995. type: "success",
  996. message: res.cg,
  997. duration: 2500,
  998. showClose: true,
  999. });
  1000. if (oldCode !== null && oldCode !== row.code) {
  1001. // 删除原始数据
  1002. delYpChargeGroupByCode(oldCode).then((res) => {
  1003. queryYpChargeGroup()
  1004. })
  1005. } else {
  1006. queryYpChargeGroup()
  1007. }
  1008. })
  1009. }).catch((action) => {
  1010. if (action === 'cancel') {
  1011. queryYpChargeGroup()
  1012. }
  1013. })
  1014. }
  1015. const deleteYpChargeGroup = (index, row) => {
  1016. let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
  1017. ElMessageBox.confirm(title, {
  1018. cancelButtonText: '取消',
  1019. confirmButtonText: '确定',
  1020. type: 'warning',
  1021. distinguishCancelAndClose: true,
  1022. dangerouslyUseHTMLString: true
  1023. }).then(() => {
  1024. delYpChargeGroupByCode(row.code).then((res) => {
  1025. ElMessage({
  1026. type: "success",
  1027. message: res.cg,
  1028. duration: 2500,
  1029. showClose: true,
  1030. });
  1031. queryYpChargeGroup()
  1032. })
  1033. }).catch((action) => {
  1034. if (action === 'cancel') {
  1035. queryYpChargeGroup()
  1036. }
  1037. })
  1038. }
  1039. // 药品字典-药品费别字典增删改存结束
  1040. // 药房药品住院停用增删改存开始
  1041. // 编辑
  1042. const editVisibleFlag = (row) => {
  1043. // 备份原始数据
  1044. row['oldRow'] = JSON.parse(JSON.stringify(row))
  1045. row.isEdit = true
  1046. }
  1047. // 取消
  1048. const cancelVisibleFlag = (row, index) => {
  1049. // 如果是新增的数据
  1050. if (row.isAdd) {
  1051. visibleFlagData.value.splice(index, 1)
  1052. } else {
  1053. // 不是新增的数据 还原数据
  1054. for (const i in row.oldRow) {
  1055. row[i] = row.oldRow[i]
  1056. }
  1057. }
  1058. }
  1059. // 保存
  1060. const updateVisibleFlag = (row) => {
  1061. if (!row.chargeCode || !row.groupNo) {
  1062. ElMessage({
  1063. type: "warning",
  1064. message: "药房药品停用的药品编码或药房编码不存在,请检查!",
  1065. duration: 2500,
  1066. showClose: true,
  1067. });
  1068. return
  1069. }
  1070. if (row.isAdd) {
  1071. ElMessage({
  1072. type: "warning",
  1073. message: "不能新增药房药品停用,需先维护药品信息!",
  1074. duration: 2500,
  1075. showClose: true,
  1076. });
  1077. } else {
  1078. callSaveVisibleFlag(row)
  1079. }
  1080. }
  1081. const callSaveVisibleFlag = (row) => {
  1082. let title = '请确认是否保存<span style="color:#d12020;">' + row.drug + '</span>?'
  1083. ElMessageBox.confirm(title, {
  1084. cancelButtonText: '取消',
  1085. confirmButtonText: '确定',
  1086. type: 'warning',
  1087. distinguishCancelAndClose: true,
  1088. dangerouslyUseHTMLString: true
  1089. }).then(() => {
  1090. updateYpVisibleFlag(row).then((res) => {
  1091. ElMessage({
  1092. type: "success",
  1093. message: res.cg,
  1094. duration: 2500,
  1095. showClose: true,
  1096. });
  1097. queryVisibleFlag()
  1098. })
  1099. }).catch((action) => {
  1100. if (action === 'cancel') {
  1101. queryVisibleFlag()
  1102. }
  1103. })
  1104. }
  1105. // 药房药品住院停用增删改存结束
  1106. // 药品字典-药品供应商字典增删改存开始
  1107. // 编辑
  1108. const editYpSupply = (row) => {
  1109. // 备份原始数据
  1110. row['oldRow'] = JSON.parse(JSON.stringify(row))
  1111. row.isEdit = true
  1112. }
  1113. // 取消
  1114. const cancelYpSupply = (row, index) => {
  1115. // 如果是新增的数据
  1116. if (row.isAdd) {
  1117. ypSupplyData.value.splice(ypSupplyData.value.length - 1, 1)
  1118. } else {
  1119. // 不是新增的数据 还原数据
  1120. for (const i in row.oldRow) {
  1121. row[i] = row.oldRow[i]
  1122. }
  1123. }
  1124. }
  1125. // 保存
  1126. const updateYpSupply = (row) => {
  1127. if (!row.code || !row.name) {
  1128. ElMessage({
  1129. type: "warning",
  1130. message: "药品供应商字典编码或名称不存在,请检查!",
  1131. duration: 2500,
  1132. showClose: true,
  1133. });
  1134. return
  1135. }
  1136. if (row.isAdd) {
  1137. let fe = 0
  1138. for (let num in ypSupplyData.value) {
  1139. if (ypSupplyData.value[num].code === row.code) {
  1140. fe++
  1141. }
  1142. }
  1143. if (fe === 2) {
  1144. ElMessage({
  1145. type: "warning",
  1146. message: "存在重复的药品供应商字典,请核对!",
  1147. duration: 2500,
  1148. showClose: true,
  1149. });
  1150. } else {
  1151. callSaveYpSupply(row, null)
  1152. }
  1153. } else {
  1154. let oldCode = row.oldRow.code
  1155. if (oldCode !== row.code) {
  1156. ElMessageBox.confirm(msgTip, {
  1157. cancelButtonText: '取消',
  1158. confirmButtonText: '确定',
  1159. type: 'warning',
  1160. distinguishCancelAndClose: true,
  1161. dangerouslyUseHTMLString: true
  1162. }).then(() => {
  1163. callSaveYpSupply(row, oldCode)
  1164. }).catch((action) => {
  1165. if (action === 'cancel') {
  1166. queryYpSupply()
  1167. }
  1168. })
  1169. } else {
  1170. callSaveYpSupply(row, oldCode)
  1171. }
  1172. }
  1173. }
  1174. const callSaveYpSupply = (row, oldCode) => {
  1175. let title = '请确认是否保存<span style="color:#d12020;">' + row.name + '</span>?'
  1176. ElMessageBox.confirm(title, {
  1177. cancelButtonText: '取消',
  1178. confirmButtonText: '确定',
  1179. type: 'warning',
  1180. distinguishCancelAndClose: true,
  1181. dangerouslyUseHTMLString: true
  1182. }).then(() => {
  1183. saveYpSupply(row).then((res) => {
  1184. ElMessage({
  1185. type: "success",
  1186. message: res.cg,
  1187. duration: 2500,
  1188. showClose: true,
  1189. });
  1190. if (oldCode !== null && oldCode !== row.code) {
  1191. // 删除原始数据
  1192. delYpSupplyByCode(oldCode).then((res) => {
  1193. queryYpSupply()
  1194. })
  1195. } else {
  1196. queryYpSupply()
  1197. }
  1198. })
  1199. }).catch((action) => {
  1200. if (action === 'cancel') {
  1201. queryYpSupply()
  1202. }
  1203. })
  1204. }
  1205. const deleteYpSupply = (index, row) => {
  1206. let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
  1207. ElMessageBox.confirm(title, {
  1208. cancelButtonText: '取消',
  1209. confirmButtonText: '确定',
  1210. type: 'warning',
  1211. distinguishCancelAndClose: true,
  1212. dangerouslyUseHTMLString: true
  1213. }).then(() => {
  1214. delYpSupplyByCode(row.code).then((res) => {
  1215. ElMessage({
  1216. type: "success",
  1217. message: res.cg,
  1218. duration: 2500,
  1219. showClose: true,
  1220. });
  1221. queryYpSupply()
  1222. })
  1223. }).catch((action) => {
  1224. if (action === 'cancel') {
  1225. queryYpSupply()
  1226. }
  1227. })
  1228. }
  1229. // 药品字典-药品供应商字典增删改存结束
  1230. // 药品字典-生产厂家字典增删改存开始
  1231. // 编辑
  1232. const editYpManuFactory = (row) => {
  1233. // 备份原始数据
  1234. row['oldRow'] = JSON.parse(JSON.stringify(row))
  1235. row.isEdit = true
  1236. }
  1237. // 取消
  1238. const cancelYpManuFactory = (row) => {
  1239. // 如果是新增的数据
  1240. if (row.isAdd) {
  1241. ypManuFactoryData.value.splice(ypManuFactoryData.value.length - 1, 1)
  1242. } else {
  1243. // 不是新增的数据 还原数据
  1244. for (const i in row.oldRow) {
  1245. row[i] = row.oldRow[i]
  1246. }
  1247. }
  1248. }
  1249. // 保存
  1250. const updateYpManuFactory = (row) => {
  1251. if (!row.code || !row.name) {
  1252. ElMessage({
  1253. type: "warning",
  1254. message: "生产厂家字典编码或名称不存在,请检查!",
  1255. duration: 2500,
  1256. showClose: true,
  1257. });
  1258. return
  1259. }
  1260. if (row.isAdd) {
  1261. let fe = 0
  1262. for (let num in ypManuFactoryData.value) {
  1263. if (ypManuFactoryData.value[num].code === row.code) {
  1264. fe++
  1265. }
  1266. }
  1267. if (fe === 2) {
  1268. ElMessage({
  1269. type: "warning",
  1270. message: "存在重复的生产厂家字典,请核对!",
  1271. duration: 2500,
  1272. showClose: true,
  1273. });
  1274. } else {
  1275. callSaveYpManuFactory(row, null)
  1276. }
  1277. } else {
  1278. let oldCode = row.oldRow.code
  1279. if (oldCode !== row.code) {
  1280. ElMessageBox.confirm(msgTip, {
  1281. cancelButtonText: '取消',
  1282. confirmButtonText: '确定',
  1283. type: 'warning',
  1284. distinguishCancelAndClose: true,
  1285. dangerouslyUseHTMLString: true
  1286. }).then(() => {
  1287. callSaveYpManuFactory(row, oldCode)
  1288. }).catch((action) => {
  1289. if (action === 'cancel') {
  1290. queryYpManuFactory()
  1291. }
  1292. })
  1293. } else {
  1294. callSaveYpManuFactory(row, oldCode)
  1295. }
  1296. }
  1297. }
  1298. const callSaveYpManuFactory = (row, oldCode) => {
  1299. let title = '请确认是否保存<span style="color:#d12020;">' + row.name + '</span>?'
  1300. ElMessageBox.confirm(title, {
  1301. cancelButtonText: '取消',
  1302. confirmButtonText: '确定',
  1303. type: 'warning',
  1304. distinguishCancelAndClose: true,
  1305. dangerouslyUseHTMLString: true
  1306. }).then(() => {
  1307. saveYpManuFactory(row).then((res) => {
  1308. ElMessage({
  1309. type: "success",
  1310. message: res.cg,
  1311. duration: 2500,
  1312. showClose: true,
  1313. });
  1314. if (oldCode !== null && oldCode !== row.code) {
  1315. // 删除原始数据
  1316. delYpManuFactoryByCode(oldCode).then((res) => {
  1317. queryYpManuFactory()
  1318. })
  1319. } else {
  1320. queryYpManuFactory()
  1321. }
  1322. })
  1323. }).catch((action) => {
  1324. if (action === 'cancel') {
  1325. queryYpManuFactory()
  1326. }
  1327. })
  1328. }
  1329. const deleteYpManuFactory = (index, row) => {
  1330. let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
  1331. ElMessageBox.confirm(title, {
  1332. cancelButtonText: '取消',
  1333. confirmButtonText: '确定',
  1334. type: 'warning',
  1335. distinguishCancelAndClose: true,
  1336. dangerouslyUseHTMLString: true
  1337. }).then(() => {
  1338. delYpManuFactoryByCode(row.code).then((res) => {
  1339. ElMessage({
  1340. type: "success",
  1341. message: res.cg,
  1342. duration: 2500,
  1343. showClose: true,
  1344. });
  1345. queryYpManuFactory()
  1346. })
  1347. }).catch((action) => {
  1348. if (action === 'cancel') {
  1349. queryYpManuFactory()
  1350. }
  1351. })
  1352. }
  1353. // 药品字典-生产厂家字典增删改存结束
  1354. const exportData = () => {
  1355. alert("功能建设中。。。")
  1356. }
  1357. const handleClick = (tab, event) => {
  1358. // 查询哪个tab页面
  1359. editableTabsValue.value = tab.props.name
  1360. if (editableTabsValue.value === 'ypClass') {
  1361. currentTabLabel.value = '供应商'
  1362. queryYpClass()
  1363. currentPageClass.value = 1
  1364. } else if (editableTabsValue.value === 'drugKind') {
  1365. currentTabLabel.value = '生产厂家'
  1366. queryDrugKind()
  1367. currentPageKind.value = 1
  1368. } else if (editableTabsValue.value === 'ypDosage') {
  1369. queryYpDosage()
  1370. currentPageDosage.value = 1
  1371. } else if (editableTabsValue.value === 'ypUnit') {
  1372. queryYpUnit()
  1373. currentPageUnit.value = 1
  1374. } else if (editableTabsValue.value === 'ypChargeGroup') {
  1375. queryYpChargeGroup()
  1376. } else if (editableTabsValue.value === 'visibleFlag') {
  1377. queryVisibleFlag()
  1378. currentPage.value = 1
  1379. } else if (editableTabsValue.value === 'ypSupply') {
  1380. queryYpSupply()
  1381. currentPageSupply.value = 1
  1382. } else if (editableTabsValue.value === 'ypManuFactory') {
  1383. queryYpManuFactory()
  1384. currentPageManuFactory.value = 1
  1385. }
  1386. }
  1387. const tableRowClassName = ({
  1388. row,
  1389. rowIndex,
  1390. }) => {
  1391. if (row.delFlag === '1') {
  1392. return 'warning-row'
  1393. }
  1394. }
  1395. </script>
  1396. <style lang="scss" deep>
  1397. .el-dialog__body {
  1398. padding: 0 16px;
  1399. height: calc(100% - 25px);
  1400. }
  1401. .el-tabs {
  1402. height: calc(100% - 27px);
  1403. .el-tabs__content {
  1404. padding: 5px;
  1405. height: calc(100% - 27px);
  1406. }
  1407. .el-tab-pane {
  1408. height: calc(100% - 27px);
  1409. overflow: auto;
  1410. }
  1411. .el-table__inner-wrapper {
  1412. height: calc(100% - 10px) !important;
  1413. }
  1414. }
  1415. .el-table .warning-row {
  1416. --el-table-tr-bg-color: #dd7694;
  1417. }
  1418. </style>