consumables.vue 51KB

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