consumables.vue 61KB

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