|
@@ -0,0 +1,578 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <ag-grid-layout
|
|
|
+ toolbar
|
|
|
+ theme="ag-theme-alpine"
|
|
|
+ :column-defs="columnDefs"
|
|
|
+ :row-data="rowData"
|
|
|
+ :locale-text="localeText"
|
|
|
+ :grid-options="gridOptions"
|
|
|
+ :debounce-vertical-scrollbar="true"
|
|
|
+ :default-col-def="defaultColDef"
|
|
|
+ :animate-rows="true"
|
|
|
+ :row-selection="rowSelection"
|
|
|
+ :framework-components="frameworkComponents"
|
|
|
+ @filterChanged="filterModifed"
|
|
|
+ @sortChanged="gridSortChange"
|
|
|
+ >
|
|
|
+ <div slot="toolbar" class="inner-toolbar">
|
|
|
+ <div class="toolbar-search">
|
|
|
+ <en-table-search :placeholder="this.$t('action.keywords')" @search="handlerSearch" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="toolbar-btns">
|
|
|
+ <el-button type="primary" size="mini" @click="handleAdd">{{ this.$t('action.add') }}</el-button>
|
|
|
+ <el-button type="danger" size="mini" @click="batchDelete">{{ this.$t('action.deleteList') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-pagination
|
|
|
+ v-if="pageData"
|
|
|
+ slot="pagination"
|
|
|
+ :current-page="pageData.page_no"
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
+ :page-size="pageData.page_size"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="pageData.data_total"
|
|
|
+ @size-change="handlePageSizeChange"
|
|
|
+ @current-change="handlePageCurrentChange"
|
|
|
+ />
|
|
|
+ </ag-grid-layout>
|
|
|
+
|
|
|
+ <!--添加医嘱 dialog-->
|
|
|
+ <el-dialog :title="adviceEditTitle" :visible.sync="dialogAddVisible"
|
|
|
+ width="50%" :close-on-click-modal="false" :close-on-press-escape="false"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-form ref="addAdviceForm" :model="addAdviceForm" :rules="addAdviceRules" label-width="80px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="医嘱类型" prop="type">
|
|
|
+ <el-select v-model="addAdviceForm.type" placeholder="医嘱类型" clearable>
|
|
|
+ <el-option v-for="(item, index) in Object.keys(adviceTypeEnum)" :key="index" :label="adviceTypeEnum[item]" :value="item" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="状态" prop="status">
|
|
|
+ <el-radio v-model="addAdviceForm.status" :label="0">失效</el-radio>
|
|
|
+ <el-radio v-model="addAdviceForm.status" :label="1">生效</el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="开始时间" prop="start_time">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="addAdviceForm.start_time"
|
|
|
+ type="date"
|
|
|
+ :editable="false"
|
|
|
+ value-format="timestamp"
|
|
|
+ :default-value="new Date()"
|
|
|
+ :placeholder="this.$t('customerManage.choiceDate')"
|
|
|
+ :picker-options="{disabledDate(time) { return time.getTime() > Date.now() }}"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="结束时间" prop="end_time">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="addAdviceForm.end_time"
|
|
|
+ type="date"
|
|
|
+ :editable="false"
|
|
|
+ value-format="timestamp"
|
|
|
+ :default-value="new Date()"
|
|
|
+ :placeholder="this.$t('customerManage.choiceDate')"
|
|
|
+ :picker-options="{disabledDate(time) { return time.getTime() > Date.now() }}"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="内容" prop="content">
|
|
|
+ <el-input
|
|
|
+ v-model="addAdviceForm.content"
|
|
|
+ type="textarea"
|
|
|
+ :autosize="{ minRows: 2, maxRows: 4}"
|
|
|
+ :minlength="2"
|
|
|
+ :maxlength="50"
|
|
|
+ :placeholder="this.$t('customerManage.inputAdvice')"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-form-item
|
|
|
+ v-for="(detail, index) in detailForm"
|
|
|
+ label="参数"
|
|
|
+ :key="detail.key"
|
|
|
+ :rules="{
|
|
|
+ required: false, message: '参数不能为空', trigger: 'blur'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-input v-model="detailForm[index].name" placeholder="请输入参数名"></el-input>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="1">
|
|
|
+ <span style="margin-left: 10px">-</span>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-input v-model="detailForm[index].value" placeholder="请输入参数值"></el-input>
|
|
|
+ </el-col>
|
|
|
+ <el-button style="margin-left: 20px" @click.prevent="removeDetail(detailForm[index])">删除</el-button>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click="addDetail">新增参数</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogAddVisible = false">{{ this.$t('action.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" @click="handlerFormSubmit('addAdviceForm')">{{ this.$t('action.yes') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {AG_GRID_LOCALE_CN} from "@/utils/AgGridVueLocaleCn";
|
|
|
+import * as API_Advice from "@/api/ncs_advice";
|
|
|
+import {unix2Date, unixToDate} from "@/utils/Foundation";
|
|
|
+import ButtonCellRender from "@/components/AgGridCellRender/ButtonCellRender";
|
|
|
+import ListFilter from "@/components/AgGridCustomFilter/ListFilter";
|
|
|
+import RadioFilter from "@/components/AgGridCustomFilter/RadioFilter";
|
|
|
+import {ADVICE_TYPE} from "@/utils/enum/AdviceTypeEnym";
|
|
|
+import {ADVICE_STATUS_TYPE} from "@/utils/enum/AdviceStatusTypeEnum";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "Advice",
|
|
|
+ components: {ButtonCellRender, ListFilter, RadioFilter},
|
|
|
+ props: {
|
|
|
+ customerId: {
|
|
|
+ type: Number,
|
|
|
+ default: null
|
|
|
+ },
|
|
|
+ partId: {
|
|
|
+ type: Number,
|
|
|
+ default: null
|
|
|
+ },
|
|
|
+ activeName: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ /** ag-grid参数 **/
|
|
|
+ pageData: {}, // 翻页数据
|
|
|
+ errorId: null,
|
|
|
+ shopVisible: false,
|
|
|
+ columnDefs: null,
|
|
|
+ rowData: [],
|
|
|
+ defaultColDef: null,
|
|
|
+ gridOptions: null,
|
|
|
+ gridApi: null,
|
|
|
+ columnApi: null,
|
|
|
+ localeText: AG_GRID_LOCALE_CN,
|
|
|
+ filterState: null,
|
|
|
+ rowSelection: null,
|
|
|
+ frameworkComponents: null,
|
|
|
+ adviceEditTitle: this.$t('adviceManage.adviceEdit'),
|
|
|
+ /** 添加会员弹出框指示 */
|
|
|
+ dialogAddVisible: false,
|
|
|
+ /** 添加医嘱 表单数据 */
|
|
|
+ addAdviceForm: {},
|
|
|
+ /** 添加医嘱 表单规则 */
|
|
|
+ addAdviceRules: {
|
|
|
+ type: [
|
|
|
+ { required: true, message: '', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ content: [
|
|
|
+ { required: true, message: '', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ detailForm: [
|
|
|
+ {
|
|
|
+ name: '',
|
|
|
+ value: ''
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ /** 列表参数 */
|
|
|
+ params: {
|
|
|
+ page_size: 20,
|
|
|
+ page_no: 1,
|
|
|
+ fixedCondition: ' customer_id = ' + this.customerId,
|
|
|
+ sort: 'id',
|
|
|
+ dir: 'desc'
|
|
|
+ },
|
|
|
+ adviceTypeEnum: ADVICE_TYPE.getValueList(),
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+ beforeMount() {
|
|
|
+ this.gridOptions = {}
|
|
|
+ this.columnDefs = [
|
|
|
+ {
|
|
|
+ headerName: '#',
|
|
|
+ headerCheckboxSelection: true,
|
|
|
+ headerCheckboxSelectionFilteredOnly: true,
|
|
|
+ checkboxSelection: true,
|
|
|
+ sortable: false, filter: false,
|
|
|
+ width: 80,
|
|
|
+ resizable: false,
|
|
|
+ valueGetter: this.hashValueGetter
|
|
|
+ },
|
|
|
+ {headerName: "医嘱类型", field: 'type', sortable: true, filter: 'agTextColumnFilter',
|
|
|
+ valueGetter: this.adviceTypeGetter,
|
|
|
+ width: 120,
|
|
|
+ },
|
|
|
+ {headerName: "状态", field: 'status', sortable: true, filter: 'agNumberColumnFilter',
|
|
|
+ valueGetter: this.adviceStatusGetter,
|
|
|
+ width: 100,},
|
|
|
+ {
|
|
|
+ headerName: "开始时间",
|
|
|
+ field: 'start_time',
|
|
|
+ sortable: true,
|
|
|
+ filter: 'agDateColumnFilter',
|
|
|
+ valueFormatter: this.unixDateFormatter,
|
|
|
+ filterParams: {
|
|
|
+ comparator: (filterLocalDateAtMidnight, cellValue) => { // 所有数据都由服务器端过滤,此处只需返回0 即可
|
|
|
+ const celldate = unixToDate(cellValue, 'yyyy-MM-dd')
|
|
|
+ return (new Date(celldate).getTime() / 1000) - (filterLocalDateAtMidnight.getTime() / 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: "结束时间",
|
|
|
+ field: 'end_time',
|
|
|
+ sortable: true,
|
|
|
+ filter: 'agDateColumnFilter',
|
|
|
+ valueFormatter: this.unixDateFormatter,
|
|
|
+ filterParams: {
|
|
|
+ comparator: (filterLocalDateAtMidnight, cellValue) => { // 所有数据都由服务器端过滤,此处只需返回0 即可
|
|
|
+ const celldate = unixToDate(cellValue, 'yyyy-MM-dd')
|
|
|
+ return (new Date(celldate).getTime() / 1000) - (filterLocalDateAtMidnight.getTime() / 1000)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {headerName: "内容", field: 'content', sortable: true, filter: 'agTextColumnFilter'},
|
|
|
+ {headerName: "规格", field: 'detail', sortable: true, filter: 'agTextColumnFilter'},
|
|
|
+ {
|
|
|
+ headerName: this.$t('action.edit'), field: 'id',
|
|
|
+ cellRendererFramework: 'ButtonCellRender',
|
|
|
+ cellRendererParams: {
|
|
|
+ onClick: this.handleEdit,
|
|
|
+ label: this.$t('action.edit'),
|
|
|
+ buttonType: 'primary',
|
|
|
+ buttonSize: 'mini'
|
|
|
+ },
|
|
|
+ filter: false,
|
|
|
+ pinned: 'right',
|
|
|
+ lockPinned: true,
|
|
|
+ width: 90,
|
|
|
+ resizable: false,
|
|
|
+ sortable: false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headerName: this.$t('action.delete'), field: 'id',
|
|
|
+ cellRendererFramework: 'ButtonCellRender',
|
|
|
+ cellRendererParams: param => {
|
|
|
+ return {
|
|
|
+ onClick: this.deleteSingle,
|
|
|
+ label: this.$t('action.delete'),
|
|
|
+ buttonType: 'danger',
|
|
|
+ buttonSize: 'mini',
|
|
|
+ disabled: param.data['member_name'] === 'superadmin'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ pinned: 'right',
|
|
|
+ lockPinned: true,
|
|
|
+ width: 90,
|
|
|
+ resizable: false,
|
|
|
+ filter: false,
|
|
|
+ sortable: false
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ this.defaultColDef = {
|
|
|
+ // filter: 'agTextColumnFilter',
|
|
|
+ sortable: true,
|
|
|
+ resizable: true,
|
|
|
+ enableValue: true,
|
|
|
+ filter: true,
|
|
|
+ // comparator: this.dateCustomComparator,
|
|
|
+ filterParams: {
|
|
|
+ debounceMs: 500,
|
|
|
+ newRowsAction: 'keep',
|
|
|
+ textCustomComparator: this.textCustomComparator
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.rowSelection = 'multiple'
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ window.onresize = this.windowResize
|
|
|
+ this.gridApi = this.gridOptions.api
|
|
|
+ // this.gridColumnApi = this.gridOptions.columnApi
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ windowResize() {
|
|
|
+ this.$set(this, 'mainAreaHeight', Number(document.documentElement.clientHeight) - 84)
|
|
|
+ },
|
|
|
+ /** 加载列表数据 */
|
|
|
+ getList() {
|
|
|
+ const param = this.MixinClone(this.params)
|
|
|
+ this.gridApi.showLoadingOverlay()
|
|
|
+ API_Advice.getList(param).then(response => {
|
|
|
+ this.rowData = response.data
|
|
|
+ this.pageData = {
|
|
|
+ page_no: response.page_no,
|
|
|
+ page_size: response.page_size,
|
|
|
+ data_total: response.data_total
|
|
|
+ }
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const node = this.gridApi.getDisplayedRowAtIndex(0)
|
|
|
+ if (node !== null && node !== undefined) {
|
|
|
+ node.setSelected(true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 过滤状态发生变化,发送到服务器检索数据
|
|
|
+ */
|
|
|
+ filterModifed(param) {
|
|
|
+ var model = param.api.getFilterModel()
|
|
|
+ // 连接状态不经过服务器过滤
|
|
|
+ delete model.online_state
|
|
|
+ this.params.filter = JSON.stringify(model)
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ gridSortChange(param) {
|
|
|
+ const columnState = param.columnApi.getColumnState()
|
|
|
+ // 排序状态
|
|
|
+ const sortState = columnState.filter(function (s) {
|
|
|
+ return s.sort != null
|
|
|
+ }).map(function (s) {
|
|
|
+ return {
|
|
|
+ colId: s.colId,
|
|
|
+ sort: s.sort,
|
|
|
+ sortIndex: s.sortIndex
|
|
|
+ }
|
|
|
+ }).sort(function (a, b) {
|
|
|
+ return a.sortIndex - b.sortIndex
|
|
|
+ })
|
|
|
+ if (sortState.length > 0) {
|
|
|
+ if (sortState.length === 1) {
|
|
|
+ this.params.sort = sortState[0].colId
|
|
|
+ this.params.dir = sortState[0].sort
|
|
|
+ } else {
|
|
|
+ let sortstring = ''
|
|
|
+ sortState.forEach(function (item) {
|
|
|
+ sortstring += item.colId + ' ' + item.sort + ','
|
|
|
+ })
|
|
|
+ this.params.sort = sortstring.substring(0, sortstring.length - 1)
|
|
|
+ this.params.dir = ' '
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ delete this.params.sort
|
|
|
+ delete this.params.dir
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ /** 处理搜索 */
|
|
|
+ handlerSearch(keywords) {
|
|
|
+ this.params.query = keywords
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ /** 格式化时间函数 */
|
|
|
+ unixDateFormatter(param) {
|
|
|
+ if (!param.value) return ''
|
|
|
+ return unix2Date(param.value * 1000, 'yyyy-MM-dd')
|
|
|
+ },
|
|
|
+ /** 分页大小发生改变 */
|
|
|
+ handlePageSizeChange(size) {
|
|
|
+ this.params.page_size = size
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ /** 分页页数发生改变 */
|
|
|
+ handlePageCurrentChange(page) {
|
|
|
+ this.params.page_no = page
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ formatterDate(params) {
|
|
|
+ return unixToDate(params.value)
|
|
|
+ },
|
|
|
+ /** 删除医嘱 **/
|
|
|
+ deleteSingle(row) {
|
|
|
+ this.handlerDelete(row.id)
|
|
|
+ },
|
|
|
+ /** 单条数据删除处理 */
|
|
|
+ handlerDelete(ids) {
|
|
|
+ this.$confirm(this.$t('action.sureDelete'), this.$t('action.waring'), {
|
|
|
+ confirmButtonText: this.$t('action.yes'),
|
|
|
+ cancelButtonText: this.$t('action.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ API_Advice.remove(ids).then(
|
|
|
+ response => {
|
|
|
+ this.getList()
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: this.$t('action.deleted')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ ).catch(response => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: response.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }).catch((response) => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: this.$t('action.cancelDelete')
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 批量数据删除处理(删除选中的行) */
|
|
|
+ batchDelete: function() {
|
|
|
+ const rows = this.gridApi.getSelectedRows()
|
|
|
+ if (rows.length === 0) {
|
|
|
+ this.$message({ type: 'info', message: this.$t('action.pleaseChoiceDelete') })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const ids = []
|
|
|
+ const uids = []
|
|
|
+ let isFounder = 0
|
|
|
+ rows.forEach(function(item) {
|
|
|
+ if (item.founder === 1) {
|
|
|
+ isFounder = 1
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ids.push(item.clerk_id)
|
|
|
+ uids.push(item.member_id)
|
|
|
+ })
|
|
|
+ if (isFounder === 1) {
|
|
|
+ this.$message({ type: 'info', message: this.$t('action.cannotDeleteAdmin') })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.handlerDelete(ids.join(','))
|
|
|
+ },
|
|
|
+ /** 添加医嘱事件 **/
|
|
|
+ handleAdd() {
|
|
|
+ this.adviceEditTitle = '新增医嘱'
|
|
|
+ this.dialogAddVisible = true
|
|
|
+ this.addAdviceForm = {
|
|
|
+ status: 1,
|
|
|
+ customer_id: this.customerId,
|
|
|
+ part_id: this.partId
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 修改医嘱 **/
|
|
|
+ handleEdit(params) {
|
|
|
+ this.addAdviceForm = {
|
|
|
+ ...params
|
|
|
+ }
|
|
|
+ this.adviceEditTitle = this.$t('adviceManage.adviceEdit')
|
|
|
+ this.dialogAddVisible = true
|
|
|
+ if (this.addAdviceForm.start_time) {
|
|
|
+ this.$set(this.addAdviceForm, 'start_time', this.addAdviceForm.start_time * 1000)
|
|
|
+ }
|
|
|
+ if (this.addAdviceForm.end_time) {
|
|
|
+ this.$set(this.addAdviceForm, 'end_time', this.addAdviceForm.end_time * 1000)
|
|
|
+ }
|
|
|
+ if (this.addAdviceForm.detail) {
|
|
|
+ this.detailForm = this.addAdviceForm.detail
|
|
|
+ } else {
|
|
|
+ this.detailForm = [
|
|
|
+ {
|
|
|
+ name: '',
|
|
|
+ value: ''
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 新增 提交表单 */
|
|
|
+ handlerFormSubmit(formName) {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ const _this = this
|
|
|
+
|
|
|
+ // 判断是否存在参数,如果存在参数,就将值赋给this.addAdviceForm.detail
|
|
|
+ const detail = []
|
|
|
+ this.detailForm.forEach(v => {
|
|
|
+ if (v.name && v.name !== "") {
|
|
|
+ detail.push(v)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (detail.length > 0) {
|
|
|
+ this.addAdviceForm.detail = detail
|
|
|
+ }
|
|
|
+ if (this.addAdviceForm.start_time) {
|
|
|
+ this.$set(this.addAdviceForm, 'start_time', this.addAdviceForm.start_time / 1000) // 将毫秒数转换成秒
|
|
|
+ }
|
|
|
+ if (this.addAdviceForm.end_time) {
|
|
|
+ this.$set(this.addAdviceForm, 'end_time', this.addAdviceForm.end_time / 1000) // 将毫秒数转换成秒
|
|
|
+ }
|
|
|
+ console.log('this.addAdviceForm', this.addAdviceForm)
|
|
|
+ /** 新增 */
|
|
|
+ if (!this.addAdviceForm.id) {
|
|
|
+ API_Advice.add(this.addAdviceForm).then(r => {
|
|
|
+ this.$message.success(this.$t('action.saveSuccess'))
|
|
|
+ this.dialogAddVisible = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ /** 修改 */
|
|
|
+ API_Advice.update(this.addAdviceForm.id, this.addAdviceForm).then(() => {
|
|
|
+ this.$message.success(this.$t('action.editSuccess'))
|
|
|
+ this.dialogAddVisible = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 获取医嘱类型模式 */
|
|
|
+ adviceTypeGetter(params) {
|
|
|
+ const gridVal = params.data.type
|
|
|
+ return ADVICE_TYPE.getDescFromValue(gridVal)
|
|
|
+ },
|
|
|
+ adviceStatusGetter(params) {
|
|
|
+ const gridVal = params.data.status
|
|
|
+ return ADVICE_STATUS_TYPE.getDescFromValue(gridVal)
|
|
|
+ },
|
|
|
+ removeDetail(item) {
|
|
|
+ var index = this.detailForm.indexOf(item)
|
|
|
+ if (index !== -1) {
|
|
|
+ this.detailForm.splice(index, 1)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addDetail() {
|
|
|
+ this.detailForm.push({
|
|
|
+ name: '',
|
|
|
+ value: ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.el-input .el-button {
|
|
|
+ margin-left: 120px;
|
|
|
+}
|
|
|
+</style>
|