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

consumables.vue 51KB

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