consumables.vue 59KB

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