Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

consumables.vue 56KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589
  1. <template>
  2. <div class="page_consumables">
  3. <div style="display:flex;justify-content: space-between;width:100%;margin-bottom:20px;">
  4. <div class="cell clearfix" style="margin-bottom:0;">
  5. <el-input style="width: 180px;margin-right:10px;" @keyup.enter.native='searchAction' v-model="keywords"
  6. class="filter-item"/>
  7. <el-button style="margin-right:10px;" class="filter-item" type="primary" icon="el-icon-search"
  8. @click="searchAction">搜索
  9. </el-button>
  10. <label class="title"><span class="name">是否停用</span> : </label>
  11. <el-select v-model="is_use" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeUser">
  12. <el-option
  13. v-for="(item,z) in options"
  14. :key="z"
  15. :label="item.label"
  16. :value="item.value">
  17. </el-option>
  18. </el-select>
  19. <label class="title"><span class="name">生产厂商</span> : </label>
  20. <el-select v-model="manufacturer" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeManufacture">
  21. <el-option
  22. v-for="(item,y) in manufacturers"
  23. :key="y"
  24. :label="item.manufacturer_name"
  25. :value="item.id">
  26. </el-option>
  27. </el-select>
  28. <span style="color: #909399;font-size:14px;">备案 : &nbsp;</span>
  29. <el-select v-model="is_record" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeRecord">
  30. <el-option
  31. v-for="(item,index) in optionOne"
  32. :key="index"
  33. :label="item.label"
  34. :value="item.value">
  35. </el-option>
  36. </el-select>
  37. <span style="color: #909399;font-size:14px;">耗材类型 : &nbsp;</span>
  38. <el-select v-model="is_type" style="width:140px;margin-right:10px;" placeholder="请选择" @change="changeTypeList">
  39. <el-option
  40. v-for="(item,index) in goodTypeList"
  41. :key="index"
  42. :label="item.type_name"
  43. :value="item.id">
  44. </el-option>
  45. </el-select>
  46. </div>
  47. <div>
  48. <el-button type="primary" @click="openForm()">新增</el-button>
  49. </div>
  50. </div>
  51. <div style="display:flex; align-items:center;margin-bottom:10px;">
  52. <!--<el-button type="primary" size="mini" @click="BatchDelete()" v-if="$store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10028 || $store.getters.xt_user.org_id == 10138">批量备案</el-button>-->
  53. <!--<el-button type="primary" size="mini">批量备案</el-button>-->
  54. <el-link target="_blank" href="https://kuyi.shengws.com/stockTemplate.xlsx" :underline="false"
  55. style="margin-left:15px">
  56. <el-button
  57. class="filter-item"
  58. type="primary"
  59. size="small"
  60. >下载模版
  61. </el-button>
  62. </el-link>
  63. <good-excel :on-success='handleSuccess'></good-excel>
  64. <el-button
  65. style="margin-left:10px;"
  66. @click="generateLog()"
  67. class="filter-item"
  68. type="primary"
  69. size="small"
  70. >下载日志
  71. </el-button>
  72. <el-button
  73. style="margin-left:10px;"
  74. @click="exportList()"
  75. class="filter-item"
  76. type="primary"
  77. size="small"
  78. >点击导出
  79. </el-button>
  80. </div>
  81. <el-table
  82. border style="width: 100%" :row-style="{ color: '#303133' }"
  83. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)', color: '#606266'}"
  84. :data="goodInfo.goodInfoData"
  85. v-loading="goodInfo.loading"
  86. @selection-change="handleSelectionChange"
  87. >
  88. <el-table-column
  89. align="center"
  90. type="selection"
  91. width="55">
  92. </el-table-column>
  93. <el-table-column type="index" label="序号" width="60px" align="center"></el-table-column>
  94. <el-table-column label="耗材名称" align="center">
  95. <template slot-scope="scope">
  96. {{ scope.row.good_name }}
  97. </template>
  98. </el-table-column>
  99. <el-table-column prop="date" label="规格型号" align="center">
  100. <template slot-scope="scope">
  101. {{ scope.row.specification_name }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column prop="date" label="耗材类型" width="140" align="center">
  105. <template slot-scope="scope">
  106. {{ getGoodTypeByID(scope.row.good_type_id) }}
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="注册编码" width="140" align="center">
  110. <template slot-scope="scope">
  111. {{ scope.row.register_number }}
  112. </template>
  113. </el-table-column>
  114. <!-- <el-table-column label="最小单位" width="60" align="center">
  115. <template slot-scope="scope">
  116. {{ getGoodUnit(scope.row.good_unit) }}
  117. </template>
  118. </el-table-column> -->
  119. <el-table-column label="零售价" width="100" align="center">
  120. <template slot-scope="scope">
  121. {{ scope.row.packing_price }}
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="国家编码" width="110" align="center">
  125. <template slot-scope="scope">
  126. {{ scope.row.social_security_directory_code }}
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="状态" width="60" align="center">
  130. <template slot-scope="scope">
  131. <!--{{ scope.row.good_status}}-->
  132. <div>{{scope.row.good_status.indexOf('停用') == -1 ? '启用':'停用' }}</div>
  133. </template>
  134. </el-table-column>
  135. <el-table-column prop="date" label="操作" width="320" align="center">
  136. <template slot-scope="scope">
  137. <el-button @click="handleGoodInfoEdit(scope.$index, scope.row)" type="primary" size="small">编辑</el-button>
  138. <!--<el-button type="primary" size="small" @click="clickSelfPayment(scope.row.id)">自付比例</el-button>-->
  139. <el-button type="danger" size="small" @click="handleGoodInfoDelete(scope.$index, scope.row)">删除</el-button>
  140. <!--<el-button type="primary" size="small" @click="toReturn(scope.row.id,scope.row.is_mark)" v-if="$store.getters.xt_user.org_id == 9504 || $store.getters.xt_user.org_id == 10028 || $store.getters.xt_user.org_id == 10138">-->
  141. <!--<span v-if="scope.row.is_mark == 0">备案</span>-->
  142. <!--<span v-if="scope.row.is_mark == 1">撤销</span>-->
  143. <!--</el-button>-->
  144. <el-button type="primary" size="small" >
  145. <span v-if="scope.row.is_mark == 0 || scope.row.is_mark == 2" @click="putOnRecord(scope.row.id)" >目录对照</span>
  146. <span v-if="scope.row.is_mark == 1" @click="putOnUnRecord(scope.row.id)" >撤消对照</span>
  147. </el-button>
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. <el-pagination
  152. @size-change="handleSizeChange"
  153. @current-change="handleCurrentChange"
  154. :page-sizes="[10, 50, 100,500,1000]"
  155. :page-size="10"
  156. background
  157. align="right"
  158. style="margin-top:20px;"
  159. layout="total, sizes, prev, pager, next, jumper"
  160. :total="total"
  161. >
  162. </el-pagination>
  163. <good-info-dailog ref="addConsumable"
  164. :titles="goodInfo.goodInfoDialog.goodInfoTitle"
  165. :formValue="goodInfo.goodInfoDialog.formValue"
  166. :visibility="goodInfo.goodInfoDialog.isVisibility"
  167. :isCreated="goodInfo.goodInfoDialog.isCreated"
  168. v-on:dialog-comfirm="goodInfoDialogComfirm"
  169. v-on:dialog-cancle="goodInfoDialogCancle"
  170. ></good-info-dailog>
  171. <self-payment ref='selfPayment'></self-payment>
  172. <el-dialog
  173. title="提示"
  174. :visible.sync="dialogVisible"
  175. width="40%"
  176. >
  177. <span>您提交的文档不是系统标准导入模板,请检查您的文档或重新 </span>
  178. <span slot="footer" class="dialog-footer">
  179. <el-button @click="dialogVisible = false">取 消</el-button>
  180. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  181. </span>
  182. </el-dialog>
  183. <el-dialog
  184. title="提示"
  185. :visible.sync="exportLogVisible"
  186. width="40%"
  187. >
  188. <div v-for="(item,i) in logs" :key="i">
  189. <span> {{ item.export_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
  190. <br/>
  191. <br/>
  192. <span>{{getContent(item)}}</span>
  193. <span >点击</span>
  194. <span style="color:blue" @click="generateTxt(item)">查看详情</span>
  195. <br/>
  196. <br/>
  197. </div>
  198. <span slot="footer" class="dialog-footer">
  199. <el-button @click="exportLogVisible = false">取 消</el-button>
  200. <el-button type="primary" @click="exportLogVisible = false">确 定</el-button>
  201. </span>
  202. </el-dialog>
  203. </div>
  204. </template>
  205. <script>
  206. import GoodInfoDailog from '../../stock/Dialog/goodInfoDailog'
  207. import { getDictionaryDataConfig } from "@/utils/data";
  208. import selfPayment from './selfPayment'
  209. import axios from 'axios'
  210. import {
  211. createGoodInfo,
  212. deleteGoodInfo,
  213. GetAllDeals,
  214. GetAllGoodType,
  215. GetAllManufacturer,
  216. GetGoodInfo,
  217. GetGoodInfoByGoodId,
  218. getGoodInfoList,
  219. modifyGoodInfo,
  220. postGoodInformation,
  221. getInitializtion
  222. } from '@/api/stock'
  223. import UploadExcel from '@/xt_pages/components/UploadExcel'
  224. import GoodExcel from '@/xt_pages/components/GoodExcel'
  225. import { generateLog } from '@/api/config'
  226. export default {
  227. components: {
  228. GoodInfoDailog,
  229. selfPayment,
  230. UploadExcel,
  231. GoodExcel
  232. },
  233. data() {
  234. return {
  235. good_kind:'',
  236. is_use:'',
  237. is_charge:'',
  238. search_input: '',
  239. options: [{
  240. value: '0',
  241. label: '全部'
  242. },{
  243. value: '1',
  244. label: '是'
  245. }, {
  246. value: '2',
  247. label: '否'
  248. }],
  249. value: '',
  250. total: 0,
  251. pageTotal: 0,
  252. pageSelect: 0,
  253. page: 1,
  254. limit: 10,
  255. keywords: '',
  256. goodInfo: {
  257. loading: false,
  258. goodInfoData: [],
  259. good_code: '',
  260. editGoodId: '',
  261. editGoodIndex: '',
  262. goodInfoDialog: {
  263. goodInfoTitle: '新增商品信息',
  264. isCreated: 1, //1.创建 2.编辑 3.查看详情
  265. formValue: {
  266. good_id: '',
  267. specification_name: '',
  268. buy_price: '',
  269. sell_price: '',
  270. remark: '',
  271. manufacturer: '',
  272. good_type_id: '',
  273. dealer: '',
  274. expiry_date_warn_day_count: '',
  275. stock_warn_count: '',
  276. is_reuse: '2',
  277. dealers: [],
  278. manufacturers: [],
  279. goodType: [],
  280. goodUnit: [],
  281. good_name:'',
  282. pinyin:"",
  283. wubi:"",
  284. good_kind:'',
  285. medical_insurance_level:'',
  286. good_unit:'',
  287. retail_price:'',
  288. medical_insurance_number:'',
  289. provinces_code:'',
  290. is_special_diseases:'',
  291. is_record:'',
  292. statistics_category:'',
  293. agent:'',
  294. good_status:'',
  295. default_count:'',
  296. sign:'',
  297. is_default:'',
  298. is_charge_use:'',
  299. is_charge_predict:'',
  300. is_statistics_work:'',
  301. sort:'',
  302. is_doctor_use:'',
  303. good_number:'',
  304. social_security_directory_code:"",
  305. special_medical:"",
  306. production_type:"",
  307. min_number:"",
  308. packing_unit:"",
  309. packing_price:'',
  310. default_count_unit:"",
  311. min_unit:"",
  312. total:"",
  313. register_number:"",
  314. },
  315. isVisibility: false,
  316. }
  317. },
  318. selectDrug:[],
  319. manufacturers:[],
  320. optionOne: [
  321. {
  322. value: '0',
  323. label: '全部'
  324. }, {
  325. value: '1',
  326. label: '已备案'
  327. }, {
  328. value: '2',
  329. label: '未备案'
  330. }],
  331. is_record:"",
  332. manufacturer:"",
  333. dialogVisible:false,
  334. goodType:[],
  335. dealers:[],
  336. exportLogVisible:false,
  337. logs: [],
  338. goodKindList:[],
  339. goodTypeList:[{id:0,type_name:"全部"}],
  340. is_type:0,
  341. medicalInsuranceLevelList:[]
  342. }
  343. },
  344. methods: {
  345. putOnUnRecord(id){
  346. var that = this;
  347. let params = {
  348. ids:id.toString(),
  349. record_type: 2,
  350. admin_user_id:this.$store.getters.xt_user.user.id
  351. };
  352. axios.get('http://127.0.0.1:9532/api/uncheckcode/get',{params:params}).then(function(response) {
  353. if (response.data.state == 0) {
  354. that.$message.error(response.data.data.msg);
  355. return false
  356. } else {
  357. if(response.data.data.failed_code == -10){
  358. // that.$message.error(response.data.data.msg)
  359. that.$confirm(response.data.data.msg, '医保错误信息', {
  360. confirmButtonText: '确 定',
  361. type: 'warning'
  362. }).then(() => {
  363. }).catch(() => {
  364. })
  365. }else{
  366. // for (let i = 0; i < that.tableData.length; i++) {
  367. // if (that.tableData[i].id == that.currentObject.id) {
  368. // that.tableData[i].record.is_cancel == 1
  369. // }
  370. // }
  371. }
  372. }
  373. }).catch(function(error) {
  374. })
  375. },
  376. putOnRecord(id){
  377. var that = this;
  378. let params = {
  379. ids:id.toString(),
  380. record_type: 2,
  381. admin_user_id:this.$store.getters.xt_user.user.id
  382. };
  383. axios.get('http://127.0.0.1:9532/api/checkcode/get',{params:params}).then(function(response) {
  384. if (response.data.state == 0) {
  385. that.$message.error(response.data.data.msg);
  386. return false
  387. } else {
  388. if(response.data.data.failed_code == -10){
  389. // that.$message.error(response.data.data.msg)
  390. that.$confirm(response.data.data.msg, '医保错误信息', {
  391. confirmButtonText: '确 定',
  392. type: 'warning'
  393. }).then(() => {
  394. }).catch(() => {
  395. })
  396. }else{
  397. }
  398. }
  399. }).catch(function(error) {
  400. })
  401. },
  402. GDYBBatchPutOnRecord(){
  403. var that = this;
  404. var ids = [];
  405. var idMap = {};
  406. for (const index in this.selectDrug) {
  407. ids.push(this.selectDrug[index].id);
  408. idMap[this.selectDrug[index].id] = this.selectDrug[index].id;
  409. }
  410. let params = {
  411. ids:ids.join(','),
  412. record_type: 2,
  413. admin_user_id:this.$store.getters.xt_user.user.id
  414. };
  415. axios.get('http://127.0.0.1:9532/api/checkcode/get',{params:params}).then(function(response) {
  416. if (response.data.state == 0) {
  417. that.$message.error(response.data.data.msg);
  418. return false
  419. } else {
  420. if(response.data.data.failed_code == -10){
  421. // that.$message.error(response.data.data.msg)
  422. that.$confirm(response.data.data.msg, '医保错误信息', {
  423. confirmButtonText: '确 定',
  424. type: 'warning'
  425. }).then(() => {
  426. }).catch(() => {
  427. })
  428. }else{
  429. }
  430. }
  431. }).catch(function(error) {
  432. })
  433. },
  434. changeKind(val){
  435. this.getList()
  436. },
  437. changeCharge(val){
  438. this.getList()
  439. },
  440. changeUser(val){
  441. this.getList()
  442. },
  443. getGoodUnit(id){
  444. for (let i = 0; i <this.$store.getters.good_unit.length; i++ ){
  445. if(id == this.$store.getters.good_unit[i].id){
  446. return this.$store.getters.good_unit[i].name
  447. }
  448. }
  449. return ""
  450. },
  451. getGoodKind(id){
  452. // var data = this.getDictionaryDataConfig('system','good_kind')
  453. var data = this.goodKindList;
  454. var name = "";
  455. for(let i = 0; i < data.length; i++){
  456. if(id == data[i].value){
  457. name = data[i].name
  458. }
  459. }
  460. return name
  461. },
  462. getDictionaryDataConfig(module,filed_name){
  463. return getDictionaryDataConfig(module,filed_name)
  464. },
  465. search: function() {
  466. this.getList()
  467. },
  468. handleGoodInfoEdit: function(index, row) {
  469. this.getAllDealer();
  470. this.getAllManufacturer();
  471. this.getAllGoodType();
  472. this.goodInfo.editGoodId = row.id;
  473. this.goodInfo.editGoodIndex = index;
  474. let params = {
  475. id: row.id
  476. };
  477. GetGoodInfo(params).then(response => {
  478. if (response.data.state == 0) {
  479. this.$message.error(response.data.msg);
  480. return false
  481. } else {
  482. if (response.data.data.goodInfo.good_unit <= 0) {
  483. this.goodInfo.goodInfoDialog.formValue.good_unit = ''
  484. } else {
  485. this.goodInfo.goodInfoDialog.formValue.good_unit =
  486. response.data.data.goodInfo.good_unit
  487. }
  488. if (response.data.data.goodInfo.manufacturer <= 0) {
  489. this.goodInfo.goodInfoDialog.formValue.manufacturer = ''
  490. } else {
  491. this.goodInfo.goodInfoDialog.formValue.manufacturer = response.data.data.goodInfo.manufacturer
  492. }
  493. if (response.data.data.goodInfo.dealer <= 0) {
  494. this.goodInfo.goodInfoDialog.formValue.dealer = ''
  495. } else {
  496. this.goodInfo.goodInfoDialog.formValue.dealer =
  497. response.data.data.goodInfo.dealer
  498. }
  499. this.goodInfo.goodInfoDialog.formValue.specification_name =
  500. response.data.data.goodInfo.specification_name;
  501. this.goodInfo.goodInfoDialog.formValue.buy_price =
  502. response.data.data.goodInfo.buy_price;
  503. this.goodInfo.goodInfoDialog.formValue.sell_price =
  504. response.data.data.goodInfo.sell_price;
  505. this.goodInfo.goodInfoDialog.formValue.expiry_date_warn_day_count =
  506. response.data.data.goodInfo.expiry_date_warn_day_count;
  507. this.goodInfo.goodInfoDialog.formValue.stock_warn_count =
  508. response.data.data.goodInfo.stock_warn_count;
  509. this.goodInfo.goodInfoDialog.formValue.is_reuse = response.data.data.goodInfo.is_reuse.toString();
  510. this.goodInfo.goodInfoDialog.formValue.remark =
  511. response.data.data.goodInfo.remark;
  512. this.goodInfo.goodInfoDialog.isCreated = 2;
  513. this.goodInfo.good_code = response.data.data.goodInfo.good_code;
  514. this.goodInfo.goodInfoDialog.formValue.good_type_id =
  515. response.data.data.goodInfo.good_type_id;
  516. this.goodInfo.goodInfoDialog.formValue.good_name =
  517. response.data.data.goodInfo.good_name;
  518. this.goodInfo.goodInfoDialog.formValue.pinyin =
  519. response.data.data.goodInfo.pinyin;
  520. this.goodInfo.goodInfoDialog.formValue.wubi =
  521. response.data.data.goodInfo.wubi;
  522. if (response.data.data.goodInfo.good_kind <= 0) {
  523. this.goodInfo.goodInfoDialog.formValue.good_kind = ''
  524. } else {
  525. this.goodInfo.goodInfoDialog.formValue.good_kind =
  526. response.data.data.goodInfo.good_kind
  527. }
  528. if (response.data.data.goodInfo.medical_insurance_level <= 0) {
  529. this.goodInfo.goodInfoDialog.formValue.medical_insurance_level = ''
  530. } else {
  531. this.goodInfo.goodInfoDialog.formValue.medical_insurance_level =
  532. response.data.data.goodInfo.medical_insurance_level
  533. }
  534. this.goodInfo.goodInfoDialog.formValue.retail_price =
  535. response.data.data.goodInfo.retail_price;
  536. this.goodInfo.goodInfoDialog.formValue.medical_insurance_number =
  537. response.data.data.goodInfo.medical_insurance_number;
  538. this.goodInfo.goodInfoDialog.formValue.provinces_code =
  539. response.data.data.goodInfo.provinces_code;
  540. if (response.data.data.goodInfo.is_special_diseases <= 0) {
  541. this.goodInfo.goodInfoDialog.formValue.is_special_diseases = ''
  542. } else {
  543. this.goodInfo.goodInfoDialog.formValue.is_special_diseases =
  544. response.data.data.goodInfo.is_special_diseases.toString()
  545. }
  546. if (response.data.data.goodInfo.is_record <= 0) {
  547. this.goodInfo.goodInfoDialog.formValue.is_record = ''
  548. } else {
  549. this.goodInfo.goodInfoDialog.formValue.is_record =
  550. response.data.data.goodInfo.is_record.toString()
  551. }
  552. if (response.data.data.goodInfo.statistics_category <= 0) {
  553. this.goodInfo.goodInfoDialog.formValue.statistics_category = ''
  554. } else {
  555. this.goodInfo.goodInfoDialog.formValue.statistics_category =
  556. response.data.data.goodInfo.statistics_category
  557. }
  558. if (response.data.data.goodInfo.good_status <= 0) {
  559. this.goodInfo.goodInfoDialog.formValue.good_status = ''
  560. } else {
  561. this.goodInfo.goodInfoDialog.formValue.good_status =
  562. response.data.data.goodInfo.good_status
  563. }
  564. if (response.data.data.goodInfo.default_count <= 0) {
  565. this.goodInfo.goodInfoDialog.formValue.default_count = ''
  566. } else {
  567. this.goodInfo.goodInfoDialog.formValue.default_count =
  568. response.data.data.goodInfo.default_count
  569. }
  570. if (response.data.data.goodInfo.sign <= 0) {
  571. this.goodInfo.goodInfoDialog.formValue.sign = ''
  572. } else {
  573. this.goodInfo.goodInfoDialog.formValue.sign =
  574. response.data.data.goodInfo.sign
  575. }
  576. if (response.data.data.goodInfo.is_default <= 0) {
  577. this.goodInfo.goodInfoDialog.formValue.is_default = ''
  578. } else {
  579. this.goodInfo.goodInfoDialog.formValue.is_default =
  580. response.data.data.goodInfo.is_default.toString()
  581. }
  582. if (response.data.data.goodInfo.is_charge_use <= 0) {
  583. this.goodInfo.goodInfoDialog.formValue.is_charge_use = ''
  584. } else {
  585. this.goodInfo.goodInfoDialog.formValue.is_charge_use =
  586. response.data.data.goodInfo.is_charge_use.toString()
  587. }
  588. if (response.data.data.goodInfo.is_charge_predict <= 0) {
  589. this.goodInfo.goodInfoDialog.formValue.is_charge_predict = ''
  590. } else {
  591. this.goodInfo.goodInfoDialog.formValue.is_charge_predict =
  592. response.data.data.goodInfo.is_charge_predict.toString()
  593. }
  594. if (response.data.data.goodInfo.is_statistics_work <= 0) {
  595. this.goodInfo.goodInfoDialog.formValue.is_statistics_work = ''
  596. } else {
  597. this.goodInfo.goodInfoDialog.formValue.is_statistics_work =
  598. response.data.data.goodInfo.is_statistics_work.toString()
  599. }
  600. if (response.data.data.goodInfo.sort <= 0) {
  601. this.goodInfo.goodInfoDialog.formValue.sort = ''
  602. } else {
  603. this.goodInfo.goodInfoDialog.formValue.sort =
  604. response.data.data.goodInfo.sort.toString()
  605. }
  606. if (response.data.data.goodInfo.total <= 0) {
  607. this.goodInfo.goodInfoDialog.formValue.total = ''
  608. } else {
  609. this.goodInfo.goodInfoDialog.formValue.total =
  610. response.data.data.goodInfo.total
  611. }
  612. if (response.data.data.goodInfo.is_doctor_use <= 0) {
  613. this.goodInfo.goodInfoDialog.formValue.is_doctor_use = ''
  614. } else {
  615. this.goodInfo.goodInfoDialog.formValue.is_doctor_use =
  616. response.data.data.goodInfo.is_doctor_use.toString()
  617. }
  618. this.goodInfo.goodInfoDialog.formValue.agent =response.data.data.goodInfo.agent;
  619. this.goodInfo.goodInfoDialog.formValue.good_number = response.data.data.goodInfo.good_number;
  620. this.goodInfo.goodInfoDialog.formValue.social_security_directory_code = response.data.data.goodInfo.social_security_directory_code;
  621. if(response.data.data.production_type<=0){
  622. this.goodInfo.goodInfoDialog.production_type = ''
  623. }else{
  624. this.goodInfo.goodInfoDialog.formValue.production_type = response.data.data.goodInfo.production_type.toString()
  625. }
  626. if(response.data.data.special_medical<=0){
  627. this.goodInfo.goodInfoDialog.special_medical = ''
  628. }else{
  629. this.goodInfo.goodInfoDialog.formValue.special_medical = response.data.data.goodInfo.special_medical.toString()
  630. }
  631. this.goodInfo.goodInfoDialog.formValue.min_unit = response.data.data.goodInfo.min_unit
  632. this.goodInfo.goodInfoDialog.formValue.min_number = response.data.data.goodInfo.min_number
  633. this.goodInfo.goodInfoDialog.formValue.packing_unit = response.data.data.goodInfo.packing_unit
  634. this.goodInfo.goodInfoDialog.formValue.packing_price = response.data.data.goodInfo.packing_price
  635. this.goodInfo.goodInfoDialog.formValue.default_count_unit = response.data.data.goodInfo.default_count_unit
  636. this.goodInfo.goodInfoDialog.formValue.register_number = response.data.data.goodInfo.register_number
  637. this.$refs.addConsumable.show(row.id, this.goodInfo.goodInfoDialog.formValue)
  638. }
  639. })
  640. },
  641. handleGoodInfoDelete: function(index, row) {
  642. this.$confirm('确认删除这条商品信息?', '删除商品信息', {
  643. confirmButtonText: '确定',
  644. cancelButtonText: '取消',
  645. type: 'warning'
  646. })
  647. .then(() => {
  648. let params = {
  649. id: row.id
  650. };
  651. deleteGoodInfo(params).then(response => {
  652. if (response.data.state == 0) {
  653. this.$message.error(response.data.msg);
  654. return false
  655. } else {
  656. this.goodInfo.goodInfoData.splice(index, 1);
  657. this.$message.success('删除成功')
  658. }
  659. })
  660. })
  661. .catch(() => {
  662. })
  663. },
  664. getList() {
  665. this.goodInfo.loading = true;
  666. let params = {
  667. page: this.page,
  668. limit: this.limit,
  669. keyword: this.keywords,
  670. is_use:this.is_use,
  671. good_kind:this.good_kind,
  672. is_charge: this.is_charge,
  673. is_mark:this.is_record,
  674. manufacturer:this.manufacturer,
  675. is_type:this.is_type,
  676. };
  677. getGoodInfoList(params).then(response => {
  678. if (response.data.state == 0) {
  679. this.goodInfo.loading = false;
  680. this.$message.error(response.data.msg);
  681. return false
  682. } else {
  683. this.goodInfo.loading = false;
  684. this.total = response.data.data.total;
  685. this.goodInfo.goodInfoData = [];
  686. for (let i = 0; i < response.data.data.list.length; i++) {
  687. this.goodInfo.goodInfoData.push(response.data.data.list[i])
  688. }
  689. }
  690. })
  691. },
  692. tableRowClassName({ row, rowIndex }) {
  693. //把每一行的索引放进row
  694. row.index = rowIndex
  695. },
  696. onRowClick(row, event, column) {
  697. this.goodInfo.goodInfoData = [];
  698. this.goodType.tableCurrentIndex = row.index;
  699. this.goodInfo.goodInfoDialog.formValue.good_id = row.id;
  700. let params = {
  701. id: row.id
  702. };
  703. this.goodInfo.loading = true;
  704. GetGoodInfoByGoodId(params).then(response => {
  705. if (response.data.state == 0) {
  706. this.goodInfo.loading = false;
  707. this.$message.error(response.data.msg);
  708. return false
  709. } else {
  710. this.goodInfo.loading = false;
  711. this.getList()
  712. // for (let i = 0; i < response.data.data.list.length; i++) {
  713. // this.goodInfo.goodInfoData.push(response.data.data.list[i])
  714. // }
  715. }
  716. })
  717. },
  718. goodInfoDialogComfirm: function(val) {
  719. if (val.isCreated == 2) {
  720. //修改
  721. val['id'] = this.goodInfo.editGoodId;
  722. val['good_code'] = this.goodInfo.good_code;
  723. modifyGoodInfo(val).then(response => {
  724. if (response.data.state == 0) {
  725. // this.$message.error(response.data.msg)
  726. this.$message.error("同一耗材类型同一规格名称不能重复录入!");
  727. return false
  728. } else {
  729. this.$refs.addConsumable.hide();
  730. this.getList();
  731. // this.goodInfo.goodInfoData[
  732. // this.goodInfo.editGoodIndex
  733. // ].specification_name =
  734. // response.data.data.goodInfo.specification_name
  735. // this.goodInfo.goodInfoData[this.goodInfo.editGoodIndex].good_unit =
  736. // response.data.data.goodInfo.good_unit
  737. // this.goodInfo.goodInfoData[
  738. // this.goodInfo.editGoodIndex
  739. // ].buy_price = response.data.data.goodInfo.buy_price.toString()
  740. // this.goodInfo.goodInfoData[
  741. // this.goodInfo.editGoodIndex
  742. // ].sell_price = response.data.data.goodInfo.sell_price.toString()
  743. // this.goodInfo.goodInfoData[
  744. // this.goodInfo.editGoodIndex
  745. // ].expiry_date_warn_day_count = response.data.data.goodInfo.expiry_date_warn_day_count.toString()
  746. // this.goodInfo.goodInfoData[
  747. // this.goodInfo.editGoodIndex
  748. // ].stock_warn_count = response.data.data.goodInfo.stock_warn_count.toString()
  749. this.$message.success('修改成功')
  750. }
  751. })
  752. } else if (val.isCreated == 1) {
  753. if(val.is_reuse == ""){
  754. val.is_reuse = 0
  755. }else{
  756. val.is_reuse = parseInt(val.is_reuse)
  757. }
  758. if(val.stock_warn_count == ""){
  759. val.stock_warn_count = 0
  760. }else{
  761. val.stock_warn_count = parseInt(val.stock_warn_count)
  762. }
  763. //新增
  764. createGoodInfo(val).then(response => {
  765. if (response.data.state == 0) {
  766. // this.$message.error(response.data.msg)
  767. // return false
  768. this.$message.error("同一耗材类型同一规格名称不能重复录入!")
  769. } else {
  770. this.$refs.addConsumable.hide();
  771. this.getList();
  772. // this.goodInfo.goodInfoData.unshift(response.data.data.goodInfo)
  773. this.$message.success('新增成功')
  774. }
  775. })
  776. }
  777. },
  778. goodInfoDialogCancle: function() {
  779. this.$refs.addConsumable.hide()
  780. },
  781. getGoodTypeByID(id){
  782. let name = ""
  783. for(let i = 0; i < this.goodInfo.goodInfoDialog.formValue.goodType.length;i++){
  784. if(this.goodInfo.goodInfoDialog.formValue.goodType[i].id == id){
  785. name = this.goodType[i].type_name
  786. }
  787. }
  788. return name
  789. },
  790. showInfoDialog: function() {
  791. this.getAllDealer();
  792. this.getAllManufacturer();
  793. this.goodInfo.goodInfoDialog.formValue.goodType = [];
  794. GetAllGoodType().then(response => {
  795. if (response.data.state == 0) {
  796. this.$message.error(response.data.msg);
  797. return false
  798. } else {
  799. for (let i = 0; i < response.data.data.goodType.length; i++) {
  800. if (response.data.data.goodType[i].type == 1) {
  801. response.data.data.goodType[i].type_name = response.data.data.goodType[i].type_name + '(系统设定)'
  802. }
  803. this.goodInfo.goodInfoDialog.formValue.goodType.push(response.data.data.goodType[i])
  804. }
  805. if (this.goodInfo.goodInfoDialog.formValue.goodType.length <= 0) {
  806. this.$message.error('请先新增商品类型');
  807. } else {
  808. this.goodInfo.goodInfoDialog.isVisibility = true;
  809. this.goodInfo.goodInfoDialog.isCreated = 1
  810. }
  811. }
  812. });
  813. this.$refs.addConsumable.show()
  814. },
  815. getAllDealer: function() {
  816. this.goodInfo.goodInfoDialog.formValue.dealers = [];
  817. GetAllDeals().then(response => {
  818. if (response.data.state == 0) {
  819. this.$message.error(response.data.msg);
  820. return false
  821. } else {
  822. for (let i = 0; i < response.data.data.dealer.length; i++) {
  823. this.goodInfo.goodInfoDialog.formValue.dealers.push(
  824. response.data.data.dealer[i]
  825. );
  826. this.dealers.push(response.data.data.dealer[i])
  827. }
  828. }
  829. })
  830. },
  831. getAllManufacturer: function() {
  832. this.goodInfo.goodInfoDialog.formValue.manufacturers = [];
  833. GetAllManufacturer().then(response => {
  834. if (response.data.state == 0) {
  835. this.$message.error(response.data.msg);
  836. return false
  837. } else {
  838. var obj = {id:0,manufacturer_name:"全部"};
  839. this.manufacturers.push(obj);
  840. for (let i = 0; i < response.data.data.manufacturer.length; i++) {
  841. this.goodInfo.goodInfoDialog.formValue.manufacturers.push(
  842. response.data.data.manufacturer[i]
  843. );
  844. this.manufacturers.push(response.data.data.manufacturer[i])
  845. }
  846. }
  847. })
  848. },
  849. getAllGoodType: function() {
  850. this.goodInfo.goodInfoDialog.formValue.goodType = [];
  851. GetAllGoodType().then(response => {
  852. if (response.data.state == 0) {
  853. this.$message.error(response.data.msg);
  854. return false
  855. } else {
  856. for(let i=0;i<response.data.data.goodType.length;i++){
  857. this.goodTypeList.push(response.data.data.goodType[i])
  858. }
  859. for (let i = 0; i < response.data.data.goodType.length; i++) {
  860. if (response.data.data.goodType[i].type == 1) {
  861. response.data.data.goodType[i].type_name = response.data.data.goodType[i].type_name + '(系统设定)'
  862. }
  863. this.goodInfo.goodInfoDialog.formValue.goodType.push(response.data.data.goodType[i]);
  864. this.goodType.push(response.data.data.goodType[i])
  865. }
  866. this.getList();
  867. }
  868. })
  869. },
  870. handleSizeChange(val) {
  871. this.limit = val;
  872. this.getList()
  873. },
  874. handleCurrentChange(val) {
  875. this.page = val;
  876. this.getList()
  877. },
  878. searchAction() {
  879. this.is_use = "";
  880. this.is_charge = "";
  881. this.good_kind = "";
  882. this.getList()
  883. },clickSelfPayment(id){
  884. this.$refs.selfPayment.show(id,2)
  885. },
  886. openForm() {
  887. this.getAllDealer();
  888. this.getAllManufacturer();
  889. this.goodInfo.goodInfoDialog.formValue.goodType = [];
  890. GetAllGoodType().then(response => {
  891. if (response.data.state == 0) {
  892. this.$message.error(response.data.msg);
  893. return false
  894. } else {
  895. for (let i = 0; i < response.data.data.goodType.length; i++) {
  896. if (response.data.data.goodType[i].type == 1) {
  897. response.data.data.goodType[i].type_name = response.data.data.goodType[i].type_name + '(系统设定)'
  898. }
  899. this.goodInfo.goodInfoDialog.formValue.goodType.push(
  900. response.data.data.goodType[i]
  901. )
  902. }
  903. if (this.goodInfo.goodInfoDialog.formValue.goodType.length <= 0) {
  904. this.$message.error('请先新增商品类型');
  905. } else {
  906. this.goodInfo.goodInfoDialog.isVisibility = true;
  907. this.goodInfo.goodInfoDialog.isCreated = 1
  908. }
  909. }
  910. });
  911. this.goodInfo.goodInfoDialog.formValue.good_id = '';
  912. this.goodInfo.goodInfoDialog.formValue.specification_name = '';
  913. this.goodInfo.goodInfoDialog.formValue.buy_price = '';
  914. this.goodInfo.goodInfoDialog.formValue.sell_price = '';
  915. this.goodInfo.goodInfoDialog.formValue.remark = '';
  916. this.goodInfo.goodInfoDialog.formValue.manufacturer = '';
  917. this.goodInfo.goodInfoDialog.formValue.good_type_id = '';
  918. this.goodInfo.goodInfoDialog.formValue.dealer = '';
  919. this.goodInfo.goodInfoDialog.formValue.expiry_date_warn_day_count = '';
  920. this.goodInfo.goodInfoDialog.formValue.stock_warn_count = '';
  921. this.goodInfo.goodInfoDialog.formValue.is_reuse = '2';
  922. this.goodInfo.goodInfoDialog.formValue.good_name = '';
  923. this.goodInfo.goodInfoDialog.formValue.pinyin = '';
  924. this.goodInfo.goodInfoDialog.formValue.wubi = '';
  925. this.goodInfo.goodInfoDialog.formValue.good_kind = '';
  926. this.goodInfo.goodInfoDialog.formValue.medical_insurance_level = '';
  927. this.goodInfo.goodInfoDialog.formValue.retail_price = '';
  928. this.goodInfo.goodInfoDialog.formValue.medical_insurance_number = '';
  929. this.goodInfo.goodInfoDialog.formValue.provinces_code = '';
  930. this.goodInfo.goodInfoDialog.formValue.is_special_diseases = '';
  931. this.goodInfo.goodInfoDialog.formValue.is_record = '';
  932. this.goodInfo.goodInfoDialog.formValue.statistics_category = '';
  933. this.goodInfo.goodInfoDialog.formValue.good_status = '';
  934. this.goodInfo.goodInfoDialog.formValue.default_count = '';
  935. this.goodInfo.goodInfoDialog.formValue.sign = '';
  936. this.goodInfo.goodInfoDialog.formValue.is_default = '';
  937. this.goodInfo.goodInfoDialog.formValue.is_charge_use = '';
  938. this.goodInfo.goodInfoDialog.formValue.is_charge_predict = '';
  939. this.goodInfo.goodInfoDialog.formValue.is_statistics_work = '';
  940. this.goodInfo.goodInfoDialog.formValue.sort = '';
  941. this.goodInfo.goodInfoDialog.formValue.is_doctor_use = '';
  942. this.goodInfo.goodInfoDialog.formValue.agent = '';
  943. this.goodInfo.goodInfoDialog.formValue.good_number = '';
  944. this.goodInfo.goodInfoDialog.formValue.register_number = '';
  945. this.$refs.addConsumable.show(0)
  946. },
  947. handleSelectionChange(val) {
  948. this.selectDrug = val;
  949. },
  950. // toRecord(){
  951. // var that = this
  952. // axios.get('http://127.0.0.1:9532/sz/api/goods/get').then(function(response) {
  953. // if (response.data.state == 0) {
  954. // that.$message.error(response.data.msg)
  955. // return false
  956. // } else {
  957. // that.$message({ message: '备案成功', type: 'success' })
  958. // }
  959. // }).catch(function(error) {
  960. // })
  961. // },
  962. BatchDelete() {
  963. if (this.selectDrug.length == 0) {
  964. this.$message.error("请选择要备案的信息");
  965. return false;
  966. }
  967. this.$confirm(
  968. "确认要备案所选记录吗? <br>",
  969. "备案提示",
  970. {
  971. dangerouslyUseHTMLString: true,
  972. confirmButtonText: "确定",
  973. cancelButtonText: "取消",
  974. type: "warning"
  975. }
  976. ).then(() => {
  977. var ids = [];
  978. var idMap = {};
  979. for (const index in this.selectDrug) {
  980. ids.push(this.selectDrug[index].id);
  981. idMap[this.selectDrug[index].id] = this.selectDrug[index].id;
  982. }
  983. var idss = ids.join(',');
  984. let params = {
  985. ids:idss,
  986. admin_user_id:this.$store.getters.xt_user.user.id
  987. };
  988. var that = this;
  989. axios.get('http://127.0.0.1:9532/sz/api/goods/get',{ params: params }).then(function(response) {
  990. if (response.data.state == 0) {
  991. that.$message.error(response.data.data.msg);
  992. return false
  993. } else {
  994. if(response.data.data.msg == ""){
  995. that.$message.success("备案成功!");
  996. that.getList()
  997. }
  998. if(response.data.data.msg!=""){
  999. that.$message.error(response.data.data.msg);
  1000. that.getList()
  1001. }
  1002. }
  1003. }).catch(function(error) {
  1004. })
  1005. });
  1006. },
  1007. toReturn(id,isMark){
  1008. var that = this;
  1009. let params = {
  1010. 'id':id,
  1011. 'type_id':3,
  1012. 'is_mark':isMark,
  1013. 'admin_user_id':this.$store.getters.xt_user.user.id,
  1014. };
  1015. axios.get('http://127.0.0.1:9532/sz/api/revocation/get',{params:params}).then(function(response) {
  1016. if (response.data.state == 0) {
  1017. that.$message.error(response.data.data.msg);
  1018. return false
  1019. } else {
  1020. if(response.data.data.msg == ""){
  1021. that.$message.success("备案成功!");
  1022. that.getList()
  1023. }
  1024. if(response.data.data.msg!=""){
  1025. that.$message.error(response.data.data.msg);
  1026. that.getList()
  1027. }
  1028. }
  1029. }).catch(function(error) {
  1030. })
  1031. },
  1032. changeManufacture(){
  1033. this.getList()
  1034. },
  1035. changeRecord(){
  1036. this.getList()
  1037. },
  1038. changeTypeList(){
  1039. this.getList()
  1040. },
  1041. handleSuccess({ results, header }) {
  1042. if (header != undefined && header.length > 0) {
  1043. var isHasMedicalInsuranceLevel = header.includes('*医保等级');
  1044. var isHasGoodUnit = header.includes('*单位');
  1045. var isHasStockWarnCount = header.includes('*库存警戒');
  1046. var isHasManuFacturer = header.includes('*生产厂商');
  1047. var isHasGoodName = header.includes('*耗材名称');
  1048. var isHasGoodKand = header.includes('*耗材种类');
  1049. var isHasSpecificationName = header.includes('*规格型号');
  1050. var isHasBuyPrice = header.includes('*零价');
  1051. if (!(isHasMedicalInsuranceLevel && isHasGoodUnit && isHasStockWarnCount && isHasManuFacturer && isHasGoodName && isHasGoodKand && isHasSpecificationName && isHasBuyPrice)) {
  1052. this.dialogVisible = true;
  1053. return
  1054. }
  1055. }else {
  1056. this.dialogVisible = true;
  1057. return
  1058. }
  1059. var tableData = [];
  1060. for(let i=1;i<results.length;i++){
  1061. let obj = {"good_kind_id":0,"good_type_id":0,"medical_insurance_id":0,"dealer_id":0,"statistic_id":0,"manufacturer_id":0,"unit_id":0};
  1062. for (var key in results[i]) {
  1063. if (results[i]['*耗材名称'] === undefined) {
  1064. obj['good_name'] = ''
  1065. } else {
  1066. if (key == '*耗材名称') {
  1067. obj['good_name'] = results[i][key].replace(/\s/g,"")
  1068. }
  1069. }
  1070. if (results[i]['*耗材种类'] === undefined) {
  1071. obj['good_kind'] = ''
  1072. } else {
  1073. if (key == '*耗材种类') {
  1074. obj['good_kind'] = results[i][key].replace(/\s/g,"")
  1075. }
  1076. }
  1077. if (results[i]['*耗材类型'] === undefined) {
  1078. obj['type_name'] = ''
  1079. } else {
  1080. if (key == '*耗材类型') {
  1081. obj['type_name'] = results[i][key].replace(/\s/g,"")
  1082. }
  1083. }
  1084. if (results[i]['*医保等级'] === undefined) {
  1085. obj['medical_insurance_level'] = ''
  1086. } else {
  1087. if (key == '*医保等级') {
  1088. obj['medical_insurance_level'] = results[i][key].replace(/\s/g,"")
  1089. }
  1090. }
  1091. if (results[i]['*规格型号'] === undefined) {
  1092. obj['specification_name'] = ''
  1093. } else {
  1094. if (key == '*规格型号') {
  1095. obj['specification_name'] = results[i][key].replace(/\s/g,"")
  1096. }
  1097. }
  1098. if (results[i]['*生产厂商'] === undefined) {
  1099. obj['manufacturer'] = ''
  1100. } else {
  1101. if (key == '*生产厂商') {
  1102. obj['manufacturer'] = results[i][key].replace(/\s/g,"")
  1103. }
  1104. }
  1105. if (results[i]['*单位'] === undefined) {
  1106. obj['good_unit'] = ''
  1107. } else {
  1108. if (key == '*单位') {
  1109. obj['good_unit'] = results[i][key].replace(/\s/g,"")
  1110. }
  1111. }
  1112. if (results[i]['*零价'] === undefined) {
  1113. obj['retail_price'] = ''
  1114. } else {
  1115. if (key == '*零价') {
  1116. obj['retail_price'] = results[i][key].replace(/\s/g,"")
  1117. }
  1118. }
  1119. if (results[i]['*库存警戒'] === undefined) {
  1120. obj['stock_warn_count'] = ''
  1121. } else {
  1122. if (key == '*库存警戒') {
  1123. obj['stock_warn_count'] = results[i][key].replace(/\s/g,"")
  1124. }
  1125. }
  1126. if (results[i]['经销商'] === undefined) {
  1127. obj['dealer'] = ''
  1128. } else {
  1129. if (key == '经销商') {
  1130. obj['dealer'] = results[i][key].replace(/\s/g,"")
  1131. }
  1132. }
  1133. if (results[i]['拼音'] === undefined) {
  1134. obj['pinyin'] = ''
  1135. } else {
  1136. if (key == '拼音') {
  1137. obj['pinyin'] = results[i][key].replace(/\s/g,"")
  1138. }
  1139. }
  1140. if (results[i]['五笔'] === undefined) {
  1141. obj['wubi'] = ''
  1142. } else {
  1143. if (key == '五笔') {
  1144. obj['wubi'] = results[i][key].replace(/\s/g,"")
  1145. }
  1146. }
  1147. if (results[i]['最新进价'] === undefined) {
  1148. obj['buy_price'] = ''
  1149. } else {
  1150. if (key == '最新进价') {
  1151. obj['buy_price'] = results[i][key].replace(/\s/g,"")
  1152. }
  1153. }
  1154. if (results[i]['医保编码'] === undefined) {
  1155. obj['medical_insurance_number'] = ''
  1156. } else {
  1157. if (key == '医保编码') {
  1158. obj['medical_insurance_number'] = results[i][key].replace(/\s/g,"")
  1159. }
  1160. }
  1161. if (results[i]['省编码'] === undefined) {
  1162. obj['provinces_code'] = ''
  1163. } else {
  1164. if (key == '省编码') {
  1165. obj['provinces_code'] = results[i][key].replace(/\s/g,"")
  1166. }
  1167. }
  1168. if (results[i]['是否特病目录'] === undefined) {
  1169. obj['is_special_diseases'] = ''
  1170. } else {
  1171. if (key == '是否特病目录') {
  1172. obj['is_special_diseases'] = results[i][key].replace(/\s/g,"")
  1173. }
  1174. }
  1175. if (results[i]['是否备案'] === undefined) {
  1176. obj['is_record'] = ''
  1177. } else {
  1178. if (key == '是否备案') {
  1179. obj['is_record'] = results[i][key].replace(/\s/g,"")
  1180. }
  1181. }
  1182. if (results[i]['统计分类'] === undefined) {
  1183. obj['statistics_category'] = ''
  1184. } else {
  1185. if (key == '统计分类') {
  1186. obj['statistics_category'] = results[i][key].replace(/\s/g,"")
  1187. }
  1188. }
  1189. if (results[i]['状态'] === undefined) {
  1190. obj['good_status'] = ''
  1191. } else {
  1192. if (key == '状态') {
  1193. obj['good_status'] = results[i][key].replace(/\s/g,"")
  1194. }
  1195. }
  1196. if (results[i]['社保目录编码'] === undefined) {
  1197. obj['social_security_directory_code'] = ''
  1198. } else {
  1199. if (key == '社保目录编码') {
  1200. obj['social_security_directory_code'] = results[i][key].replace(/\s/g,"")
  1201. }
  1202. }
  1203. if (results[i]['生产地类别'] === undefined) {
  1204. obj['production_type'] = ''
  1205. } else {
  1206. if (key == '生产地类别') {
  1207. obj['production_type'] = results[i][key].replace(/\s/g,"")
  1208. }
  1209. }
  1210. if (results[i]['特殊医用材料标志'] === undefined) {
  1211. obj['special_medical'] = ''
  1212. } else {
  1213. if (key == '特殊医用材料标志') {
  1214. obj['special_medical'] = results[i][key].replace(/\s/g,"")
  1215. }
  1216. }
  1217. if (results[i]['备注'] === undefined) {
  1218. obj['remark'] = ''
  1219. } else {
  1220. if (key == '备注') {
  1221. obj['remark'] = results[i][key].replace(/\s/g,"")
  1222. }
  1223. }
  1224. }
  1225. tableData.push(obj);
  1226. var goodUnit = this.$store.getters.good_unit;
  1227. for(let i=0;i<tableData.length;i++){
  1228. for(let c=0;c<goodUnit.length;c++){
  1229. if(tableData[i].good_unit == goodUnit[c].name){
  1230. tableData[i].unit_id = goodUnit[c].id
  1231. }
  1232. }
  1233. }
  1234. }
  1235. for(let i=0;i<tableData.length;i++){
  1236. tableData[i].stock_warn_count = parseInt(tableData[i].stock_warn_count);
  1237. if(tableData[i].is_special_diseases == "是"){
  1238. tableData[i].is_special_diseases = 1
  1239. }
  1240. if(tableData[i].is_special_diseases == "否"){
  1241. tableData[i].is_special_diseases = 2
  1242. }
  1243. if(tableData[i].is_record == "是"){
  1244. tableData[i].is_record = 1
  1245. }
  1246. if(tableData[i].is_record == "否"){
  1247. tableData[i].is_record = 2
  1248. }
  1249. if(tableData[i].special_medical == "是"){
  1250. tableData[i].special_medical = "1"
  1251. }
  1252. if(tableData[i].special_medical == "否"){
  1253. tableData[i].special_medical = "2"
  1254. }
  1255. }
  1256. for(let i=0;i<tableData.length;i++){
  1257. if(tableData[i].is_special_diseases == ""){
  1258. tableData[i].is_special_diseases = 0
  1259. }else{
  1260. tableData[i].is_special_diseases = parseInt(tableData[i].is_special_diseases)
  1261. }
  1262. if(tableData[i].is_record == ""){
  1263. tableData[i].is_record = 0
  1264. }else{
  1265. tableData[i].is_record = parseInt(tableData[i].is_record)
  1266. }
  1267. }
  1268. let params = {
  1269. 'goods':tableData
  1270. };
  1271. postGoodInformation(params).then(response=>{
  1272. if(response.data.state == 1){
  1273. var msg = response.data.data.msg;
  1274. this.$message.success("导入成功!");
  1275. this.getList();
  1276. this.getInitializtion()
  1277. }else{
  1278. this.$message.error("导入失败,请下载日志查看")
  1279. }
  1280. })
  1281. },
  1282. generateTxt: function(log) {
  1283. var content = '';
  1284. var errlog = log.err_logs;
  1285. content = this.getContent(log);
  1286. for (let i = 0; i < errlog.length; i++) {
  1287. if (content.length == 0) {
  1288. content = errlog[i].err_msg
  1289. } else {
  1290. content = content + '\n' + errlog[i].err_msg
  1291. }
  1292. }
  1293. var url = new Blob(['\ufeff' + content], { type: 'text/txt,charset=UTF-8' });
  1294. if (typeof url === 'object' && url instanceof Blob) {
  1295. url = URL.createObjectURL(url) // 创建blob地址
  1296. }
  1297. const aLink = document.createElement('a');
  1298. aLink.href = url;
  1299. aLink.download = this.timestampToTime(log.export_time) + '患者导入日志' + '.txt';
  1300. aLink.click()
  1301. },
  1302. getContent(log) {
  1303. return '您导入的文档共' + log.total_num + '条患者数据' + ',' + '已成功导入' + log.success_num + '条,导入失败' + log.fail_num + '条,'
  1304. },
  1305. timestampToTime(timestamp) {
  1306. var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  1307. var Y = date.getFullYear() + '年';
  1308. var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
  1309. var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 ';
  1310. var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时';
  1311. var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分';
  1312. var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + '秒';
  1313. return Y + M + D + h + m + s
  1314. },
  1315. generateLog() {
  1316. let params = {
  1317. 'log_type': 5
  1318. };
  1319. generateLog(params).then(
  1320. response => {
  1321. if (response.data.state === 1) {
  1322. this.logs = response.data.data.logs;
  1323. this.exportLogVisible = true
  1324. } else {
  1325. this.$message.error(response.data.msg)
  1326. }
  1327. }
  1328. )
  1329. },
  1330. getInitializtion(){
  1331. getInitializtion().then(response=>{
  1332. if(response.data.state == 1){
  1333. var goodKindList = response.data.data.goodKindList;
  1334. this.goodKindList = goodKindList
  1335. var medicalInsuranceLevelList = response.data.data.medicalInsuranceLevelList
  1336. console.log("医保等级",medicalInsuranceLevelList)
  1337. this.medicalInsuranceLevelList = medicalInsuranceLevelList
  1338. }
  1339. })
  1340. },
  1341. exportList(){
  1342. import('@/vendor/Export2Excel').then(excel => {
  1343. console.log("this.table",this.goodInfo.goodInfoDialog.formValue.goodType)
  1344. for(let i=0;i<this.goodInfo.goodInfoData.length;i++){
  1345. for(let j=0;j<this.goodKindList.length;j++){
  1346. if(this.goodInfo.goodInfoData[i].good_kind == this.goodKindList[j].value){
  1347. this.goodInfo.goodInfoData[i].good_kind_name = this.goodKindList[j].name
  1348. }
  1349. }
  1350. for(let z=0;z<this.goodInfo.goodInfoDialog.formValue.goodType.length;z++){
  1351. if(this.goodInfo.goodInfoData[i].good_type_id == this.goodInfo.goodInfoDialog.formValue.goodType[z].id){
  1352. this.goodInfo.goodInfoData[i].good_type_name = this.goodInfo.goodInfoDialog.formValue.goodType[z].type_name
  1353. }
  1354. }
  1355. for(let y=0;y<this.medicalInsuranceLevelList.length;y++){
  1356. if(this.goodInfo.goodInfoData[i].medical_insurance_level == this.medicalInsuranceLevelList[y].value){
  1357. this.goodInfo.goodInfoData[i].medical_insurance_level_name = this.medicalInsuranceLevelList[y].name
  1358. }
  1359. }
  1360. for(let s=0;s<this.manufacturers.length;s++){
  1361. if(this.manufacturers[s].id == this.goodInfo.goodInfoData[i].manufacturer){
  1362. this.goodInfo.goodInfoData[i].manufacturer_name = this.manufacturers[s].manufacturer_name
  1363. }
  1364. }
  1365. for(let a=0;a<this.dealers.length;a++){
  1366. if(this.dealers[a].id == this.goodInfo.goodInfoData[i].dealer){
  1367. this.goodInfo.goodInfoData[i].dealer_name = this.dealers[a].dealer_name
  1368. }
  1369. }
  1370. }
  1371. console.log("hhhadhh233323232",this.goodInfo.goodInfoData)
  1372. const tHeader = ['耗材名称','耗材种类','耗材类型','医保等级','规格型号','生产厂商','单位','零价','库存警戒','经销商','最新进价','医保编码','社保目录编码']
  1373. const filterVal = ['good_name', 'good_kind_name','good_type_name','medical_insurance_level_name','specification_name','manufacturer_name','packing_unit','packing_price','stock_warn_count','dealer_name','buy_price','medical_insurance_number','social_security_directory_code']
  1374. const data = this.formatJson(filterVal,this.goodInfo.goodInfoData)
  1375. excel.export_json_to_excel({
  1376. header: tHeader,
  1377. data,
  1378. filename: '耗材信息'
  1379. })
  1380. this.downloadLoading = false
  1381. })
  1382. },
  1383. formatJson(filterVal, jsonData) {
  1384. return jsonData.map(v => filterVal.map(j => v[j]))
  1385. },
  1386. },
  1387. created() {
  1388. this.getAllGoodType();
  1389. this.getAllDealer();
  1390. this.getAllManufacturer();
  1391. this.goodInfo.goodInfoDialog.formValue.goodUnit = this.$store.getters.good_unit;
  1392. this.getInitializtion()
  1393. }
  1394. }
  1395. </script>