123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <el-dialog title="设置" :visible.sync="visibility" :close-on-click-modal="isClose"
- :close-on-press-escape="isClose">
- <div style="text-align: center;">
-
- <div>
- <el-button type="primary" v-if="!is_open" @click="changeOpen(1)">启用自动扣减</el-button>
- <el-button type="danger" v-if="is_open" @click="changeOpen(2)">关闭自动扣减</el-button>
- <div style="margin-top: 40px;"><p style="color:#909399;text-align: center;">
- 启用“药品管理”后,在开透析医嘱时,医生可以选择药品后将自动产生出库单</p></div>
- </div>
- </div>
-
- <span slot="footer" class="dialog-footer">
- <el-button @click="hide()">取 消</el-button>
- </span>
- </el-dialog>
-
- </template>
-
- <script>
- import { createDrugStockAutomaticReduceConfig, getDrugStockAutomaticReduceConfig } from '@/api/drug/drug_stock'
-
- export default {
- name: 'settingDialog',
- data() {
- return {
- is_open: false,
- visibility: false,
- isClose: false
- }
- },
- props: {
- propForm: {
- type: Object
- }
- },
- methods: {
- hide: function() {
- this.visibility = false
- },
- show: function() {
- this.getConfig()
- this.visibility = true
-
- }, changeOpen(val) {
- var message = ''
- if (val == 1) {
- message = '启用药品自动扣减功能'
- } else {
- message = '关闭药品自动扣减功能'
- }
-
- this.$confirm(message, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'info'
- }).then(() => {
- createDrugStockAutomaticReduceConfig(val).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- if (response.data.data.is_open == 1) {
- this.is_open = true
- this.$message({
- type: 'success',
- message: '已启用'
- })
- } else {
- this.is_open = false
- this.$message({
- type: 'success',
- message: '已关闭'
- })
- }
- }
- })
- }).catch(() => {
-
- })
-
- },
- getConfig() {
- getDrugStockAutomaticReduceConfig().then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- var config = response.data.data.config
- if (config.is_open == 1) {
- this.is_open = true
- } else {
- this.is_open = false
- }
- }
- })
- }
- }
-
- }
-
- </script>
-
- <style scoped>
-
- </style>
|