qx
qx
2 天以前 de9ec81f888e006f3168fc8ea439a83696c891f7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<template>
    <div class="app-container">
      <el-row :gutter="18">
        <el-col :span="6" :xs="18" style="max-height: 700px;
  overflow-y:auto;
  flex-direction: column;">
          <div class="head-container">
            <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search"
              style="margin-bottom: 15px" />
          </div>
          <div class="head-container">
            <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId" highlight-current
              @node-click="handleNodeClick" />
          </div>
        </el-col>
        <el-col :span="18" :xs="18">
          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
            <!-- <el-form-item label="项目名称" prop="proName">
              <el-input v-model="queryParams.proName" placeholder="请输入项目名称" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="检查类别" prop="checkType">
              <el-input v-model="queryParams.checkType" placeholder="请输入检查类别" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item> -->
          </el-form>
  
          <el-table v-if="refreshTable" v-loading="loading" :data="projectList" ref="tableRef" border row-key="proId"
            :expand-row-keys="ListId" :row-class-name="selectSingleRow"
            :tree-props="{ children: 'tjProjectList', hasChildren: 'tjProjectList.length>0', }">
            <el-table-column label="项目名称" align="center" prop="deptName"  />
            <el-table-column label="已检人数" align="center" prop="yijianNum"  />
            <el-table-column label="未检人数" align="center" prop="weijianNum"  />
            <el-table-column label="延期人数" align="center" prop="yanqiNum"  />
            <el-table-column label="弃检人数" align="center" prop="qijianNum" />
          </el-table>
        </el-col>
      </el-row>
    </div>
  </template>
  
  <script>
  import {
    ProjectTree,
    deptTree,
    getChartByDeptId
  } from "@/api/hosp/project";
  import { listDept } from "@/api/system/dept";
  import Treeselect from "@riophae/vue-treeselect";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  import IconSelect from "@/components/IconSelect";
  
  export default {
    name: "Project",
    dicts: ["sys_normal_disable", "dict_personnel_type", "sys_user_sex", "tj_result_type", "dis_sampling_tab", "sys_dict_specimen", "sys_dict_position", "tj_result_type","sys_yes_no"],
    components: { Treeselect, IconSelect },
    data() {
      let checkPhoneNum = (rule, value, callback) => {
         console.log( value)
      let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
      if (value == "" && value == undefined && !value) {
        return callback('');
      }  else if(value != undefined && value != ""){
        return callback();
      }else if (!patter.test(value)) {
        return callback('');
      }
    };
      return {
        // 部门树选项
        deptOptions: undefined,
        dialogTableVisible: false,
        sfxmList: [],
        deptOptionstree: [],
        defaultPropstree: {
          children: "dictSfxms",
          label: "xmmc",
        },
        xmmc: "",
        chargeId: [],
        List: false,
        // 部门名称
        deptName: "",
        deptOption: [],
        ChangeList: [],
        // 遮罩层
        loading: true,
        key: "",
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        treeId: [],
        ListId: [],
        // 体检耗材表格数据
        consumableList: [],
        tjStandardList: [],
        // 表格树数据
        deptList: [],
        sfxmId:null,
        // 体检项目表格数据
        projectList: [],
        // 菜单树选项
        projectOptions: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 是否展开,默认全部折叠
        isExpandAll: false,
        showPrise: false,
        showRentPrise: false,
        defaultProps: {
          children: "children",
          label: "label",
        },
        id:"",
        // 重新渲染表格状态
        refreshTable: true,
        // 查询参数
        queryParams: {
          // pageNum: 1,
          // pageSize: 10,
          proName: null,
          proEngName: null,
          checkType: null,
          deptId: undefined,
        },
        querycharge: {
          pageNum: 1,
          pageSize: 50,
          xmmc: null,
          pym: null,
        },
        queryParam: {
          page: 1,
          pageSize: 10,
          id: null,
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
          createTime: [
            { required: true, validator: checkPhoneNum,  trigger: "blur" },
          ],
          updateTime: [
            { required: true, validator: checkPhoneNum,  trigger: "blur" },
          ],
          deleted: [
            { required: true, validator: checkPhoneNum,  trigger: "blur" },
          ],
          proName: [
            { required: true, validator: checkPhoneNum,  trigger: "blur" },
          ],
          proPrice: [
            { required: true, validator: checkPhoneNum,  trigger: "blur" },
          ],
          deptName: [
            { required: true, validator: checkPhoneNum,  trigger: "blur" },
          ],
          // proStandard: [
          //   { required: true, message: "项目标准值不能为空", trigger: "blur" },
          // ],
        },
      };
    },
    watch: {
      // 根据名称筛选部门树
      deptName(val) {
        this.$refs.tree.filter(val);
      },
      treeId(newVal, oldVal) {
        if (newVal) {
          this.$nextTick(() => {
            document
              .querySelector('.el-tree-node__children .el-tree-node__content')
              .click();
          });
        }
      },
      // 根据名称筛选部门树
      xmmc(val) {
        this.$refs.tree.filter(val);
      },
      chargeId(newVal, oldVal) {
        if (newVal) {
          this.$nextTick(() => {
            // document.getElementById("changtree").click();;
            document
              .querySelector('#changtree .el-tree-node__children .el-tree-node.is-focusable .el-tree-node__content')
              .click();
          });
        }
      }
    },
  
    created() {
      this.getDeptTree();
    },
    methods: {
      /** 查询部门下拉树结构 */
      getDeptTree() {
        deptTree().then((response) => {
          console.log(response,11111)
          this.deptOptions = response.data;
          this.treeId.push(this.deptOptions[0].id)
          let data = {
            deptId : this.deptOptions[0].id
          }
        
          getChartByDeptId(data).then(res => {
            this.projectList = res.data
          })
        });
      
      },
 
      // 筛选节点
      filterNode(value, data) {
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      },
      // 节点单击事件
      handleNodeClick(date) {
        this.id = date.id;
        this.queryParams.deptId = date.id;
        let data = {
          deptId: this.queryParams.deptId,
        };
        getChartByDeptId(data).then((response) => {
          this.projectList = response.data;
          this.loading = false;
        });
      },
      selectSingleRow({ row, rowIndex }) {
        if (rowIndex === 1) {
          return 'warning-row';
        }
        return '';
      },
 
 
      // 表单重置
      reset() {
        this.form = {
          proParentId: null,
          proName: null,
          proEngName: null,
          proPrice: "0.00",
          proRemark: null,
          createBy: null,
          createTime: null,
          updateBy: null,
          updateTime: null,
          deleted: null,
          proCheckType: null,
          proMeaning: null,
          proCheckMethod: null,
          proStandard: null,
          proScope: null,
          proType: null,
          deptId: null,
          deptName: null,
          consumablesList: [],
          tjStandardList: [],
          proStatus: "启用",
        };
        this.resetForm("form");
      },
     
 
    },
  }
  
  </script>
  <style scoped>
  .el-table__header-wrapper .el-checkbox {
    display: none;
  }
  
  .pag {
    display: flex;
    justify-content: center;
  }
  
  .pag1 {
    width: 40%;
  }
  
  .dialog-footer {
    position: absolute;
    left: 40%;
    bottom: 3%;
  }
  
  .el-table .warning-row {
    background: #e5f3ff;
  }
  
  .el-tree-node.is-current>.el-tree-node__content {
    background-color: #e5f3ff !important;
    color: #333 !important
  }
  </style>