consumables.vue 57KB

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