浏览代码

质控字典、规则配置

zdl 1 年之前
父节点
当前提交
5fbfddc940

+ 124 - 0
src/views/dict/qc/components/CreateDialog.vue

@@ -0,0 +1,124 @@
+<template>
+  <el-dialog
+    :title="titleStr"
+    :visible.sync="data.bSwitch"
+    width="40%"
+  >
+    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="140px" class="demo-ruleForm">
+      <el-form-item label="手术操作编码" prop="ssbm">
+        <el-input v-model="ruleForm.ssbm" placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="手术操作名称" prop="ssmc">
+        <el-input v-model="ruleForm.ssmc" placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="操作类型" prop="sslb">
+        <el-select v-model="ruleForm.sslb" filterable clearable placeholder="请选择">
+          <el-option label="介入治疗" value="介入治疗" />
+          <el-option label="手术" value="手术" />
+          <el-option label="治疗性操作" value="治疗性操作" />
+          <el-option label="诊断性操作" value="诊断性操作" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="录入选项" prop="lrxx">
+        <el-select v-model="ruleForm.lrxx" filterable clearable placeholder="请选择">
+          <el-option label="选择性" value="选择性" />
+          <el-option label="必选" value="必选" />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="data.bSwitch = false">取 消</el-button>
+      <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { ssczAdd, ssczSave } from '@/api/dict'
+export default {
+  props: {
+    data: {
+      type: Object,
+      default() {
+        return {
+          bSwitch: false,
+          row: {}
+        }
+      }
+    }
+  },
+  data() {
+    return {
+      ruleForm: {
+        ssbm: '',
+        ssmc: '',
+        sslb: '',
+        lrxx: ''
+      },
+      rules: {
+        ssbm: [
+          { required: true, message: '请输入', trigger: 'blur' }
+        ],
+        ssmc: [
+          { required: true, message: '请输入', trigger: 'blur' }
+        ],
+        sslb: [
+          { required: true, message: '请选择', trigger: 'blur' }
+        ],
+        lrxx: [
+          { required: true, message: '请选择', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  computed: {
+    titleStr() {
+      return this.data.row.id ? '编辑' : '新增'
+    }
+  },
+  created() {
+    if (this.data.row.id) {
+      const {
+        SSBM,
+        SSMC,
+        SSLB,
+        LRXX,
+        id } = this.data.row
+      this.ruleForm.ssbm = SSBM
+      this.ruleForm.ssmc = SSMC
+      this.ruleForm.id = id
+      this.ruleForm.sslb = SSLB
+      this.ruleForm.lrxx = LRXX
+    }
+  },
+  methods: {
+    submitForm(formName) {
+      this.$refs[formName].validate(async(valid) => {
+        if (valid) {
+          if (this.ruleForm.id) {
+            ssczSave(this.ruleForm).then(res => {
+              this.data.bSwitch = false
+              this.$emit('refresh')
+              this.$message.success(res.m || '操作成功')
+            })
+          } else {
+            ssczAdd(this.ruleForm).then(res => {
+              this.data.bSwitch = false
+              this.$emit('refresh')
+              this.$message.success(res.m || '操作成功')
+            })
+          }
+        } else {
+          return false
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.demo-ruleForm {
+  width: 80%;
+}
+</style>

+ 44 - 0
src/views/dict/qc/components/SearchBox.vue

@@ -0,0 +1,44 @@
+<template>
+  <div class="app-container">
+    <el-form :inline="true" :model="data" class="demo-form-inline">
+      <el-form-item label="">
+        <el-input v-model="data.ssbm" clearable placeholder="字典名称" />
+      </el-form-item>
+      <el-form-item label="">
+        <el-input v-model="data.ssmc" clearable placeholder="映射名称" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="onSubmit">查询</el-button>
+        <el-button @click="onReset">重置</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    data: {
+      type: Object,
+      default() {
+        return {
+          ssbm: '',
+          ssmc: ''
+        }
+      }
+    }
+  },
+  methods: {
+    onSubmit() {
+      this.$emit('search')
+    },
+    onReset() {
+      this.$emit('reset')
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 98 - 0
src/views/dict/qc/components/TableBox.vue

@@ -0,0 +1,98 @@
+<template>
+  <div>
+    <div class="btn-box">
+      <el-button type="primary" icon="el-icon-plus" @click="onCreate">新增</el-button>
+    </div>
+    <el-table
+      v-loading="loading"
+      :data="data"
+      border
+      style="width: 100%"
+    >
+      <el-table-column
+        type="index"
+        label="序号"
+        width="80"
+        fixed="left"
+        align="center"
+      />
+      <el-table-column
+        prop="SSBM"
+        label="字典名称"
+        align="center"
+        width="200"
+      />
+      <el-table-column
+        prop="SSMC"
+        label="映射名称"
+        align="center"
+      />
+      <el-table-column
+        prop=""
+        label="操作"
+        align="center"
+        fixed="right"
+        width="200"
+      >
+        <template slot-scope="scope">
+          <el-button type="text" @click="onEdit(scope.row)">修改</el-button>
+          <el-button type="text" style="color: #F56C6C;">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 新增、编辑 -->
+    <CreateDialog v-if="createData.bSwitch" :data="createData" @refresh="handleRefresh" />
+  </div>
+</template>
+
+<script>
+import CreateDialog from './CreateDialog.vue'
+
+export default {
+  components: {
+    CreateDialog
+  },
+  props: {
+    data: {
+      type: Array,
+      default() {
+        return []
+      }
+    },
+    loading: {
+      type: Boolean,
+      default() {
+        return false
+      }
+    }
+  },
+  data() {
+    return {
+      createData: {
+        bSwitch: false,
+        row: {}
+      }
+    }
+  },
+  methods: {
+    onCreate() {
+      this.createData.row = {}
+      this.createData.bSwitch = true
+    },
+    onEdit(row) {
+      this.createData.row = row
+      this.createData.bSwitch = true
+    },
+    handleRefresh() {
+      this.$emit('refresh')
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.btn-box {
+  text-align: right;
+  margin-bottom: 15px;
+}
+</style>

+ 95 - 0
src/views/dict/qc/index.vue

@@ -0,0 +1,95 @@
+<template>
+  <div class="app-container">
+    <SearchBoxVue :data="searchData" @search="handleSearch" @reset="handleReset" />
+    <TableBoxVue :loading="loading" :data="tableData" style="margin-top: -40px;" @refresh="handleRefresh" />
+    <pagination
+      :auto-scroll="false"
+      :total="paginationData.total"
+      :page="paginationData.page"
+      :limit="paginationData.limit"
+      @pagination="handlePagination"
+    />
+  </div>
+</template>
+
+<script>
+import SearchBoxVue from './components/SearchBox.vue'
+import TableBoxVue from './components/TableBox.vue'
+import { getSsczList } from '@/api/dict'
+
+export default {
+  components: {
+    SearchBoxVue,
+    TableBoxVue
+  },
+  data() {
+    return {
+      loading: false,
+      searchData: {
+        ssbm: '',
+        ssmc: ''
+      },
+      tableData: [],
+      paginationData: {
+        total: 0,
+        page: 1,
+        limit: 10
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    handleReset() {
+      this.searchData = {
+        ssbm: '',
+        ssmc: ''
+      }
+    },
+    handleRefresh() {
+      this.getList()
+    },
+    async getList() {
+      const {
+        ssbm,
+        ssmc,
+        sslb,
+        lrxx
+      } = this.searchData
+      const { page, limit } = this.paginationData
+      const params = {
+        ssbm,
+        ssmc,
+        sslb,
+        lrxx,
+        page,
+        page_size: limit
+      }
+      this.loading = true
+      getSsczList(params).then(res => {
+        const { p } = res
+        this.paginationData.total = p.count
+        this.tableData = p.list
+      }).catch(error => {
+        console.log(error)
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+    handlePagination(param) {
+      this.paginationData.page = param.page
+      this.paginationData.limit = param.limit
+      this.getList()
+    },
+    handleSearch() {
+      this.paginationData.page = 1
+      this.getList()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 124 - 0
src/views/rule/config/components/CreateDialog.vue

@@ -0,0 +1,124 @@
+<template>
+  <el-dialog
+    :title="titleStr"
+    :visible.sync="data.bSwitch"
+    width="40%"
+  >
+    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="140px" class="demo-ruleForm">
+      <el-form-item label="手术操作编码" prop="ssbm">
+        <el-input v-model="ruleForm.ssbm" placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="手术操作名称" prop="ssmc">
+        <el-input v-model="ruleForm.ssmc" placeholder="请输入" />
+      </el-form-item>
+      <el-form-item label="操作类型" prop="sslb">
+        <el-select v-model="ruleForm.sslb" filterable clearable placeholder="请选择">
+          <el-option label="介入治疗" value="介入治疗" />
+          <el-option label="手术" value="手术" />
+          <el-option label="治疗性操作" value="治疗性操作" />
+          <el-option label="诊断性操作" value="诊断性操作" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="录入选项" prop="lrxx">
+        <el-select v-model="ruleForm.lrxx" filterable clearable placeholder="请选择">
+          <el-option label="选择性" value="选择性" />
+          <el-option label="必选" value="必选" />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="data.bSwitch = false">取 消</el-button>
+      <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { ssczAdd, ssczSave } from '@/api/dict'
+export default {
+  props: {
+    data: {
+      type: Object,
+      default() {
+        return {
+          bSwitch: false,
+          row: {}
+        }
+      }
+    }
+  },
+  data() {
+    return {
+      ruleForm: {
+        ssbm: '',
+        ssmc: '',
+        sslb: '',
+        lrxx: ''
+      },
+      rules: {
+        ssbm: [
+          { required: true, message: '请输入', trigger: 'blur' }
+        ],
+        ssmc: [
+          { required: true, message: '请输入', trigger: 'blur' }
+        ],
+        sslb: [
+          { required: true, message: '请选择', trigger: 'blur' }
+        ],
+        lrxx: [
+          { required: true, message: '请选择', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  computed: {
+    titleStr() {
+      return this.data.row.id ? '编辑' : '新增'
+    }
+  },
+  created() {
+    if (this.data.row.id) {
+      const {
+        SSBM,
+        SSMC,
+        SSLB,
+        LRXX,
+        id } = this.data.row
+      this.ruleForm.ssbm = SSBM
+      this.ruleForm.ssmc = SSMC
+      this.ruleForm.id = id
+      this.ruleForm.sslb = SSLB
+      this.ruleForm.lrxx = LRXX
+    }
+  },
+  methods: {
+    submitForm(formName) {
+      this.$refs[formName].validate(async(valid) => {
+        if (valid) {
+          if (this.ruleForm.id) {
+            ssczSave(this.ruleForm).then(res => {
+              this.data.bSwitch = false
+              this.$emit('refresh')
+              this.$message.success(res.m || '操作成功')
+            })
+          } else {
+            ssczAdd(this.ruleForm).then(res => {
+              this.data.bSwitch = false
+              this.$emit('refresh')
+              this.$message.success(res.m || '操作成功')
+            })
+          }
+        } else {
+          return false
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.demo-ruleForm {
+  width: 80%;
+}
+</style>

+ 56 - 0
src/views/rule/config/components/SearchBox.vue

@@ -0,0 +1,56 @@
+<template>
+  <div class="app-container">
+    <el-form :inline="true" :model="data" class="demo-form-inline">
+      <el-form-item label="">
+        <el-input v-model="data.ssbm" clearable placeholder="手术操作编码" />
+      </el-form-item>
+      <el-form-item label="">
+        <el-input v-model="data.ssmc" clearable placeholder="手术操作名称" />
+      </el-form-item>
+      <el-form-item label="">
+        <el-select v-model="data.sslb" filterable clearable placeholder="操作类型">
+          <el-option label="介入治疗" value="介入治疗" />
+          <el-option label="手术" value="手术" />
+          <el-option label="治疗性操作" value="治疗性操作" />
+          <el-option label="诊断性操作" value="诊断性操作" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="">
+        <el-select v-model="data.lrxx" filterable clearable placeholder="录入选项">
+          <el-option label="选择性" value="选择性" />
+          <el-option label="必选" value="必选" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="onSubmit">查询</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    data: {
+      type: Object,
+      default() {
+        return {
+          ssbm: '',
+          ssmc: '',
+          sslb: '',
+          lrxx: ''
+        }
+      }
+    }
+  },
+  methods: {
+    onSubmit() {
+      this.$emit('search')
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 109 - 0
src/views/rule/config/components/TableBox.vue

@@ -0,0 +1,109 @@
+<template>
+  <div>
+    <div class="btn-box">
+      <el-button type="primary" icon="el-icon-plus" @click="onCreate">新增</el-button>
+      <el-button type="primary" icon="el-icon-download" @click="onExport">导出</el-button>
+    </div>
+    <el-table
+      v-loading="loading"
+      :data="data"
+      border
+      style="width: 100%"
+    >
+      <el-table-column
+        type="index"
+        label="序号"
+        width="80"
+        fixed="left"
+        align="center"
+      />
+      <el-table-column
+        prop="SSBM"
+        label="手术操作代码"
+        align="center"
+      />
+      <el-table-column
+        prop="SSMC"
+        label="手术操作名称"
+        align="center"
+      />
+      <el-table-column
+        prop="SSLB"
+        label="操作类型"
+        align="center"
+      />
+      <el-table-column
+        prop="LRXX"
+        label="录入选项"
+        align="center"
+      />
+      <el-table-column
+        prop=""
+        label="操作"
+        align="center"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button type="text" @click="onEdit(scope.row)">修改</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 新增、编辑 -->
+    <CreateDialog v-if="createData.bSwitch" :data="createData" @refresh="handleRefresh" />
+  </div>
+</template>
+
+<script>
+import CreateDialog from './CreateDialog.vue'
+
+export default {
+  components: {
+    CreateDialog
+  },
+  props: {
+    data: {
+      type: Array,
+      default() {
+        return []
+      }
+    },
+    loading: {
+      type: Boolean,
+      default() {
+        return false
+      }
+    }
+  },
+  data() {
+    return {
+      createData: {
+        bSwitch: false,
+        row: {}
+      }
+    }
+  },
+  methods: {
+    onCreate() {
+      this.createData.row = {}
+      this.createData.bSwitch = true
+    },
+    onEdit(row) {
+      this.createData.row = row
+      this.createData.bSwitch = true
+    },
+    handleRefresh() {
+      this.$emit('refresh')
+    },
+    onExport() {
+      this.$emit('export')
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.btn-box {
+  text-align: right;
+  margin-bottom: 15px;
+}
+</style>

+ 113 - 0
src/views/rule/config/index.vue

@@ -0,0 +1,113 @@
+<template>
+  <div class="app-container">
+    <SearchBoxVue :data="searchData" @search="handleSearch" />
+    <TableBoxVue :loading="loading" :data="tableData" style="margin-top: -40px;" @refresh="handleRefresh" @export="handleExport" />
+    <pagination
+      :auto-scroll="false"
+      :total="paginationData.total"
+      :page="paginationData.page"
+      :limit="paginationData.limit"
+      @pagination="handlePagination"
+    />
+  </div>
+</template>
+
+<script>
+import SearchBoxVue from './components/SearchBox.vue'
+import TableBoxVue from './components/TableBox.vue'
+import { getSsczList } from '@/api/dict'
+import { ssczExport } from '@/api/excel'
+
+export default {
+  components: {
+    SearchBoxVue,
+    TableBoxVue
+  },
+  data() {
+    return {
+      loading: false,
+      searchData: {
+        ssbm: '',
+        ssmc: '',
+        sslb: '',
+        lrxx: ''
+      },
+      tableData: [],
+      paginationData: {
+        total: 0,
+        page: 1,
+        limit: 10
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    handleRefresh() {
+      this.getList()
+    },
+    async getList() {
+      const {
+        ssbm,
+        ssmc,
+        sslb,
+        lrxx
+      } = this.searchData
+      const { page, limit } = this.paginationData
+      const params = {
+        ssbm,
+        ssmc,
+        sslb,
+        lrxx,
+        page,
+        page_size: limit
+      }
+      this.loading = true
+      getSsczList(params).then(res => {
+        const { p } = res
+        this.paginationData.total = p.count
+        this.tableData = p.list
+      }).catch(error => {
+        console.log(error)
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+    handlePagination(param) {
+      this.paginationData.page = param.page
+      this.paginationData.limit = param.limit
+      this.getList()
+    },
+    handleSearch() {
+      this.paginationData.page = 1
+      this.getList()
+    },
+    handleExport() {
+      ssczExport(this.searchData).then((res) => {
+        const content = res.data // 后台返回二进制数据
+        const blob = new Blob([content])
+        const fileName = `手术类别.csv`
+        if ('download' in document.createElement('a')) {
+          // 非IE下载
+          const elink = document.createElement('a')
+          elink.download = fileName
+          elink.style.display = 'none'
+          elink.href = URL.createObjectURL(blob)
+          document.body.appendChild(elink)
+          elink.click()
+          URL.revokeObjectURL(elink.href) // 释放URL 对象
+          document.body.removeChild(elink)
+        } else {
+          // IE10+下载
+          navigator.msSaveBlob(blob, fileName)
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>