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

consumables.vue 55KB

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