|
@@ -2,7 +2,7 @@
|
|
|
<div>
|
|
|
<el-dialog
|
|
|
title="剂型选择"
|
|
|
- width="1000px"
|
|
|
+ width="500px"
|
|
|
:close-on-click-modal="false"
|
|
|
:append-to-body="true"
|
|
|
v-dialogDrag
|
|
@@ -11,121 +11,27 @@
|
|
|
>
|
|
|
<el-container style="height: 500px">
|
|
|
<el-container>
|
|
|
- <el-header style="text-align: left; font-size: 12px; height: 30px">
|
|
|
- <el-form
|
|
|
- size="small"
|
|
|
- :inline="true"
|
|
|
- ref="searchForm"
|
|
|
- :model="searchForm"
|
|
|
- @keyup.enter.native="refreshList()"
|
|
|
- @submit.native.prevent
|
|
|
- >
|
|
|
- <el-form-item prop="code">
|
|
|
- <el-input
|
|
|
- size="small"
|
|
|
- v-model="searchForm.code"
|
|
|
- placeholder="编号"
|
|
|
- clearable
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="name">
|
|
|
+ <el-main>
|
|
|
+ <el-row :gutter="10" class="content">
|
|
|
+ <el-col :span="12">
|
|
|
<el-input
|
|
|
+ placeholder="输入关键字进行过滤"
|
|
|
size="small"
|
|
|
- v-model="searchForm.name"
|
|
|
- placeholder="名称"
|
|
|
- clearable
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="refreshList()"
|
|
|
- size="small"
|
|
|
- icon="el-icon-search"
|
|
|
- >查询</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- @click="resetSearch()"
|
|
|
- size="small"
|
|
|
- icon="el-icon-refresh-right"
|
|
|
- >重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </el-header>
|
|
|
- <el-main>
|
|
|
- <el-table
|
|
|
- :data="dataList"
|
|
|
- v-loading="loading"
|
|
|
- size="small"
|
|
|
- border
|
|
|
- ref="contractTable"
|
|
|
- @select="handleSelectionChange"
|
|
|
- height="calc(100% - 40px)"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- type="selection"
|
|
|
- header-align="center"
|
|
|
- align="center"
|
|
|
- width="50"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="id"
|
|
|
- header-align="center"
|
|
|
- align="left"
|
|
|
- sortable="custom"
|
|
|
- min-width="90"
|
|
|
- label="id"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="name"
|
|
|
- header-align="center"
|
|
|
- align="left"
|
|
|
- sortable="custom"
|
|
|
- min-width="90"
|
|
|
- label="名称"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <!-- <el-table-column
|
|
|
- prop="contractAmount"
|
|
|
- header-align="center"
|
|
|
- align="left"
|
|
|
- sortable="custom"
|
|
|
- min-width="110"
|
|
|
- label="合同金额"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="oppositeCompany"
|
|
|
- header-align="center"
|
|
|
- align="center"
|
|
|
- sortable="custom"
|
|
|
- min-width="110"
|
|
|
- label="对方单位"
|
|
|
- >
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="signDate"
|
|
|
- header-align="center"
|
|
|
- align="left"
|
|
|
- sortable="custom"
|
|
|
- min-width="110"
|
|
|
- label="签订时间"
|
|
|
- >
|
|
|
- </el-table-column> -->
|
|
|
- </el-table>
|
|
|
- <el-pagination
|
|
|
- @size-change="sizeChangeHandle"
|
|
|
- @current-change="currentChangeHandle"
|
|
|
- :current-page="pageNo"
|
|
|
- :page-sizes="[5, 10, 15, 20]"
|
|
|
- :page-size="pageSize"
|
|
|
- :total="total"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- >
|
|
|
- </el-pagination>
|
|
|
+ v-model="filterText">
|
|
|
+ </el-input>
|
|
|
+
|
|
|
+ <el-tree
|
|
|
+ class="filter-tree"
|
|
|
+ :data="threedata"
|
|
|
+ :props="defaultProps"
|
|
|
+ node-key="id"
|
|
|
+ highlight-current
|
|
|
+ @node-click="clickTree"
|
|
|
+ :filter-node-method="filterNode"
|
|
|
+ ref="tree">
|
|
|
+ </el-tree>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-main>
|
|
|
</el-container>
|
|
|
</el-container>
|
|
@@ -153,100 +59,65 @@ import { getDose } from '@/api/requisition/basic'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- searchForm: {
|
|
|
- code: '',
|
|
|
- name: ''
|
|
|
- },
|
|
|
- dataListAllSelections: [], // 所有选中的数据包含跨页数据
|
|
|
- idKey: "id", // 标识列表数据中每一行的唯一键的名称(需要按自己的数据改一下)
|
|
|
- dataList: [],
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 10,
|
|
|
- total: 0,
|
|
|
- orders: [],
|
|
|
loading: false,
|
|
|
visible: false,
|
|
|
- };
|
|
|
- },
|
|
|
- props: {
|
|
|
- selectData: {
|
|
|
- type: Array,
|
|
|
- default: () => {
|
|
|
- return [];
|
|
|
+ filterText: '',
|
|
|
+ threedata: [],
|
|
|
+ defaultProps: {
|
|
|
+ children: 'childrens',
|
|
|
+ label: 'name'
|
|
|
},
|
|
|
- },
|
|
|
- // 是否启用单选
|
|
|
- single: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- }
|
|
|
+ // 判断是否为最末级节点
|
|
|
+ isLast: false,
|
|
|
+ // 选中的节点
|
|
|
+ choosePoint: {}
|
|
|
+ };
|
|
|
},
|
|
|
+ props: {},
|
|
|
methods: {
|
|
|
init() {
|
|
|
this.visible = true;
|
|
|
this.$nextTick(() => {
|
|
|
- this.dataListAllSelections = JSON.parse(JSON.stringify(this.selectData));
|
|
|
- this.resetSearch();
|
|
|
+ this.refreshList()
|
|
|
});
|
|
|
},
|
|
|
// 获取数据列表
|
|
|
- refreshList() {
|
|
|
+ refreshList(data) {
|
|
|
this.loading = true;
|
|
|
- getDose({
|
|
|
- pageNo: 1,
|
|
|
- size: this.pageSize
|
|
|
- }).then(({ data }) => {
|
|
|
- console.log('data',data)
|
|
|
- this.dataList = data.tableBody;
|
|
|
- this.total = data.tableBody.length;
|
|
|
- this.pageNo = data.current;
|
|
|
+ getDose({}).then(res => {
|
|
|
+ console.log('res',res)
|
|
|
+ if(res.code === 200) {
|
|
|
+ this.threedata = res.data.tableBody
|
|
|
+ }
|
|
|
this.loading = false;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.setSelectRow();
|
|
|
- });
|
|
|
});
|
|
|
},
|
|
|
- // 每页数
|
|
|
- sizeChangeHandle(val) {
|
|
|
- this.pageSize = val;
|
|
|
- this.pageNo = 1;
|
|
|
- this.refreshList();
|
|
|
- },
|
|
|
- // 当前页
|
|
|
- currentChangeHandle(val) {
|
|
|
- this.pageNo = val;
|
|
|
- this.refreshList();
|
|
|
- },
|
|
|
- // 排序
|
|
|
- resetSearch() {
|
|
|
- this.$refs.searchForm.resetFields();
|
|
|
- this.refreshList();
|
|
|
- },
|
|
|
- // 选中数据
|
|
|
- handleSelectionChange(selection, row) {
|
|
|
- if (this.single && selection.length > 1) {
|
|
|
- this.$refs.contractTable.clearSelection();
|
|
|
- this.$refs.contractTable.toggleRowSelection(row);
|
|
|
+ clickTree(data) {
|
|
|
+ console.log('树形节点信息:',data)
|
|
|
+ if (data.childrens.length == 0) {
|
|
|
+ this.isLast = true
|
|
|
+ } else {
|
|
|
+ this.isLast = false
|
|
|
}
|
|
|
- this.dataListAllSelections = this.single ? [row] : selection
|
|
|
+ this.choosePoint = data
|
|
|
},
|
|
|
- // 设置选中的方法
|
|
|
- setSelectRow() {
|
|
|
- this.$refs.contractTable.clearSelection();
|
|
|
- if (!this.dataListAllSelections || this.dataListAllSelections.length <= 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- for (let i = 0; i < this.dataList.length; i++) {
|
|
|
- if (this.dataListAllSelections.some(item => item[this.idKey] == this.dataList[i][this.idKey])) {
|
|
|
- // 设置选中,记住table组件需要使用ref="table"
|
|
|
- this.$refs.contractTable.toggleRowSelection(this.dataList[i], true);
|
|
|
- }
|
|
|
- }
|
|
|
+ filterNode(value, data) {
|
|
|
+ console.log('value', value)
|
|
|
+ console.log('data', data)
|
|
|
+ if (!value) return true;
|
|
|
+ return data.label.indexOf(value) !== -1;
|
|
|
},
|
|
|
doSubmit() {
|
|
|
- this.visible = false;
|
|
|
- console.log('选择的数据?',this.dataListAllSelections)
|
|
|
- this.$emit("doSubmit", this.dataListAllSelections);
|
|
|
+ if(this.isLast == false) {
|
|
|
+ this.$message({
|
|
|
+ message: '请选择最末级节点',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log('子组件选择的数据',this.choosePoint)
|
|
|
+ this.$emit("doSubmit", this.choosePoint);
|
|
|
+ this.visible = false;
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|