|
@@ -1,369 +1,477 @@
|
1
|
1
|
<template>
|
2
|
|
- <el-dialog
|
3
|
|
- :title="formTitle"
|
4
|
|
- width="900px"
|
5
|
|
- :visible.sync="visible"
|
6
|
|
- :before-close="_close"
|
7
|
|
- >
|
8
|
|
- <div>
|
9
|
|
- <el-form :model="form" :rules="rules" ref="form" label-width="100px"
|
10
|
|
- style="display: flex;flex-wrap: wrap;justify-content: space-between;">
|
11
|
|
- <el-form-item label="组套名称 : " prop="project_team" style="width:100%">
|
12
|
|
- <el-input v-model="form.project_team" placeholder="" maxlength="30"></el-input>
|
13
|
|
- </el-form-item>
|
14
|
|
- <el-form-item label="组套价格 : " prop="price" style="width:100%">
|
15
|
|
- <el-input v-model="form.price" placeholder="" maxlength="30"></el-input>
|
16
|
|
- </el-form-item>
|
17
|
|
- <el-form-item label="拼音 : " prop="pinyin" style="width:50%">
|
18
|
|
- <el-input v-model="form.pinyin" placeholder="" maxlength="30"></el-input>
|
19
|
|
- </el-form-item>
|
20
|
|
- <el-form-item label="五笔 : " prop="wubi" style="width:50%">
|
21
|
|
- <el-input v-model="form.wubi" placeholder="" maxlength="30"></el-input>
|
22
|
|
- </el-form-item>
|
|
2
|
+ <el-dialog
|
|
3
|
+ :title="formTitle"
|
|
4
|
+ width="900px"
|
|
5
|
+ :visible.sync="visible"
|
|
6
|
+ :before-close="_close"
|
|
7
|
+ >
|
|
8
|
+ <div>
|
|
9
|
+ <el-form
|
|
10
|
+ :model="form"
|
|
11
|
+ :rules="rules"
|
|
12
|
+ ref="form"
|
|
13
|
+ label-width="100px"
|
|
14
|
+ style="display: flex; flex-wrap: wrap; justify-content: space-between"
|
|
15
|
+ >
|
|
16
|
+ <el-form-item
|
|
17
|
+ label="组套名称 : "
|
|
18
|
+ prop="project_team"
|
|
19
|
+ style="width: 100%"
|
|
20
|
+ >
|
|
21
|
+ <el-input
|
|
22
|
+ v-model="form.project_team"
|
|
23
|
+ placeholder=""
|
|
24
|
+ maxlength="30"
|
|
25
|
+ ></el-input>
|
|
26
|
+ </el-form-item>
|
|
27
|
+ <el-form-item label="组套价格 : " prop="price" style="width: 100%">
|
|
28
|
+ <el-input
|
|
29
|
+ v-model="form.price"
|
|
30
|
+ placeholder=""
|
|
31
|
+ maxlength="30"
|
|
32
|
+ ></el-input>
|
|
33
|
+ </el-form-item>
|
|
34
|
+ <el-form-item label="拼音 : " prop="pinyin" style="width: 50%">
|
|
35
|
+ <el-input
|
|
36
|
+ v-model="form.pinyin"
|
|
37
|
+ placeholder=""
|
|
38
|
+ maxlength="30"
|
|
39
|
+ ></el-input>
|
|
40
|
+ </el-form-item>
|
|
41
|
+ <el-form-item label="五笔 : " prop="wubi" style="width: 50%">
|
|
42
|
+ <el-input
|
|
43
|
+ v-model="form.wubi"
|
|
44
|
+ placeholder=""
|
|
45
|
+ maxlength="30"
|
|
46
|
+ ></el-input>
|
|
47
|
+ </el-form-item>
|
23
|
48
|
|
24
|
|
- <el-form-item label="试管颜色 : " prop="tube_color" style="width:50%">
|
25
|
|
- <el-select v-model="form.tube_color" style="width:160px;" placeholder="请选择">
|
26
|
|
- <el-option
|
27
|
|
- v-for="(item,index) in getDictionaryDataConfig('system','tube_color')"
|
28
|
|
- :key="index"
|
29
|
|
- :label="item.name"
|
30
|
|
- :value="item.id">
|
31
|
|
- </el-option>
|
32
|
|
- </el-select>
|
33
|
|
- </el-form-item>
|
34
|
|
- <el-form-item label="组套类型 : " prop="team_type" style="width:50%">
|
35
|
|
- <el-select v-model="form.team_type" style="width:100%;" placeholder="请选择">
|
36
|
|
- <el-option
|
37
|
|
- v-for="item in options"
|
38
|
|
- :key="item.value"
|
39
|
|
- :label="item.label"
|
40
|
|
- :value="item.value">
|
41
|
|
- </el-option>
|
42
|
|
- </el-select>
|
43
|
|
- </el-form-item>
|
44
|
|
- <el-form-item label="备注 : " prop="name" style="width:100%;">
|
45
|
|
- <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.remark"></el-input>
|
46
|
|
- </el-form-item>
|
|
49
|
+ <el-form-item label="试管颜色 : " prop="tube_color" style="width: 50%">
|
|
50
|
+ <el-select
|
|
51
|
+ v-model="form.tube_color"
|
|
52
|
+ style="width: 160px"
|
|
53
|
+ placeholder="请选择"
|
|
54
|
+ >
|
|
55
|
+ <el-option
|
|
56
|
+ v-for="(item, index) in getDictionaryDataConfig(
|
|
57
|
+ 'system',
|
|
58
|
+ 'tube_color'
|
|
59
|
+ )"
|
|
60
|
+ :key="index"
|
|
61
|
+ :label="item.name"
|
|
62
|
+ :value="item.id"
|
|
63
|
+ >
|
|
64
|
+ </el-option>
|
|
65
|
+ </el-select>
|
|
66
|
+ </el-form-item>
|
|
67
|
+ <el-form-item label="组套类型 : " prop="team_type" style="width: 50%">
|
|
68
|
+ <el-select
|
|
69
|
+ v-model="form.team_type"
|
|
70
|
+ style="width: 100%"
|
|
71
|
+ placeholder="请选择"
|
|
72
|
+ >
|
|
73
|
+ <el-option
|
|
74
|
+ v-for="item in options"
|
|
75
|
+ :key="item.value"
|
|
76
|
+ :label="item.label"
|
|
77
|
+ :value="item.value"
|
|
78
|
+ >
|
|
79
|
+ </el-option>
|
|
80
|
+ </el-select>
|
|
81
|
+ </el-form-item>
|
|
82
|
+ <el-form-item label="备注 : " prop="name" style="width: 100%">
|
|
83
|
+ <el-input
|
|
84
|
+ type="textarea"
|
|
85
|
+ :rows="2"
|
|
86
|
+ placeholder="请输入内容"
|
|
87
|
+ v-model="form.remark"
|
|
88
|
+ ></el-input>
|
|
89
|
+ </el-form-item>
|
47
|
90
|
|
48
|
|
- <el-form-item label="组套明细" style="width:50%;">
|
49
|
|
- <el-select v-model="form.project_detail" filterable placeholder="请选择" @change="changeProject">
|
50
|
|
- <el-option
|
51
|
|
- v-for="item in projectList"
|
52
|
|
- :key="item.new_id"
|
53
|
|
- :label="item.project_name"
|
54
|
|
- :value="item.new_id">
|
55
|
|
- </el-option>
|
56
|
|
- </el-select>
|
57
|
|
- </el-form-item>
|
|
91
|
+ <el-form-item label="组套明细" style="width: 50%">
|
|
92
|
+ <el-select
|
|
93
|
+ v-model="form.project_detail"
|
|
94
|
+ filterable
|
|
95
|
+ placeholder="请选择"
|
|
96
|
+ @change="changeProject"
|
|
97
|
+ >
|
|
98
|
+ <el-option
|
|
99
|
+ v-for="item in projectList"
|
|
100
|
+ :key="item.new_id"
|
|
101
|
+ :label="item.project_name"
|
|
102
|
+ :value="item.new_id"
|
|
103
|
+ >
|
|
104
|
+ </el-option>
|
|
105
|
+ </el-select>
|
|
106
|
+ </el-form-item>
|
58
|
107
|
|
59
|
|
- <el-form-item label="数量" style="width:50%;">
|
60
|
|
- <div style="display:flex;">
|
61
|
|
- <el-input v-model="form.number" style="margin-right:10px;"></el-input>
|
62
|
|
- <el-button type="primary" @click="addProjectList">添加</el-button>
|
63
|
|
- </div>
|
64
|
|
- </el-form-item>
|
65
|
|
- </el-form>
|
66
|
|
- <el-form>
|
67
|
|
- <el-table :data="tableData" border style="100%" :row-style="{ color: '#303133' }"
|
68
|
|
- :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
|
69
|
|
- highlight-current-row ref="tab">
|
70
|
|
- <el-table-column align="center" prop="name" label="分类" width="120">
|
71
|
|
- <template slot-scope="scope">
|
72
|
|
- <div>{{scope.row.type == 2?getId(scope.row.statistical_classification):'耗材'}}</div>
|
73
|
|
- </template>
|
74
|
|
- </el-table-column>
|
75
|
|
- <el-table-column align="center" prop="name" label="组套明细" width="120">
|
76
|
|
- <template slot-scope="scope">{{scope.row.project_name}}</template>
|
77
|
|
- </el-table-column>
|
78
|
|
- <el-table-column align="center" prop="name" label="数量" width="120">
|
79
|
|
- <template slot-scope="scope">{{scope.row.number}}</template>
|
80
|
|
- </el-table-column>
|
81
|
|
- <el-table-column align="center" prop="name" label="单位" width="120">
|
82
|
|
- <template slot-scope="scope">
|
83
|
|
- <div v-if="scope.row.type == 2">{{scope.row.unit}}</div>
|
84
|
|
- <div v-if="scope.row.type == 3">{{getUnit(scope.row.unit)}}</div>
|
|
108
|
+ <el-form-item label="数量" style="width: 50%">
|
|
109
|
+ <div style="display: flex">
|
|
110
|
+ <el-input
|
|
111
|
+ v-model="form.number"
|
|
112
|
+ style="margin-right: 10px"
|
|
113
|
+ ></el-input>
|
|
114
|
+ <el-button type="primary" @click="addProjectList">添加</el-button>
|
|
115
|
+ </div>
|
|
116
|
+ </el-form-item>
|
|
117
|
+ </el-form>
|
|
118
|
+ <el-form>
|
|
119
|
+ <el-table
|
|
120
|
+ :data="tableData"
|
|
121
|
+ border
|
|
122
|
+ style="100%"
|
|
123
|
+ :row-style="{ color: '#303133' }"
|
|
124
|
+ :header-cell-style="{
|
|
125
|
+ backgroundColor: 'rgb(245, 247, 250)',
|
|
126
|
+ color: '#606266',
|
|
127
|
+ }"
|
|
128
|
+ highlight-current-row
|
|
129
|
+ ref="tab"
|
|
130
|
+ >
|
|
131
|
+ <el-table-column align="center" prop="name" label="分类" width="120">
|
|
132
|
+ <template slot-scope="scope">
|
|
133
|
+ <div>
|
|
134
|
+ {{
|
|
135
|
+ scope.row.type == 2
|
|
136
|
+ ? getId(scope.row.statistical_classification)
|
|
137
|
+ : "耗材"
|
|
138
|
+ }}
|
|
139
|
+ </div>
|
|
140
|
+ </template>
|
|
141
|
+ </el-table-column>
|
|
142
|
+ <el-table-column
|
|
143
|
+ align="center"
|
|
144
|
+ prop="name"
|
|
145
|
+ label="组套明细"
|
|
146
|
+ width="120"
|
|
147
|
+ >
|
|
148
|
+ <template slot-scope="scope">{{ scope.row.project_name }}</template>
|
|
149
|
+ </el-table-column>
|
|
150
|
+ <el-table-column align="center" prop="name" label="数量" width="120">
|
|
151
|
+ <template slot-scope="scope">{{ scope.row.number }}</template>
|
|
152
|
+ </el-table-column>
|
|
153
|
+ <el-table-column align="center" prop="name" label="单位" width="120">
|
|
154
|
+ <template slot-scope="scope">
|
|
155
|
+ <div v-if="scope.row.type == 2">{{ scope.row.unit }}</div>
|
|
156
|
+ <div v-if="scope.row.type == 3">
|
|
157
|
+ {{ getUnit(scope.row.unit) }}
|
|
158
|
+ </div>
|
|
159
|
+ </template>
|
|
160
|
+ </el-table-column>
|
|
161
|
+ <el-table-column align="center" prop="name" label="单价" width="120">
|
|
162
|
+ <template slot-scope="scope">{{ scope.row.price }}</template>
|
|
163
|
+ </el-table-column>
|
|
164
|
+ <el-table-column align="center" prop="name" label="操作">
|
|
165
|
+ <template slot-scope="scope">
|
|
166
|
+ <el-tooltip
|
|
167
|
+ class="item"
|
|
168
|
+ effect="dark"
|
|
169
|
+ content="删除"
|
|
170
|
+ placement="top"
|
|
171
|
+ >
|
|
172
|
+ <el-button
|
|
173
|
+ type="danger"
|
|
174
|
+ icon="el-icon-delete"
|
|
175
|
+ size="small"
|
|
176
|
+ @click="DeleteProject(scope.row.id, scope.$index)"
|
|
177
|
+ ></el-button>
|
|
178
|
+ </el-tooltip>
|
|
179
|
+ </template>
|
|
180
|
+ </el-table-column>
|
|
181
|
+ </el-table>
|
|
182
|
+ </el-form>
|
|
183
|
+ </div>
|
85
|
184
|
|
86
|
|
- </template>
|
87
|
|
- </el-table-column>
|
88
|
|
- <el-table-column align="center" prop="name" label="单价" width="120">
|
89
|
|
- <template slot-scope="scope">{{scope.row.price}}</template>
|
90
|
|
- </el-table-column>
|
91
|
|
- <el-table-column align="center" prop="name" label="操作">
|
92
|
|
- <template slot-scope="scope">
|
93
|
|
- <el-tooltip
|
94
|
|
- class="item"
|
95
|
|
- effect="dark"
|
96
|
|
- content="删除"
|
97
|
|
- placement="top"
|
98
|
|
- >
|
99
|
|
- <el-button
|
100
|
|
- type="danger"
|
101
|
|
- icon="el-icon-delete"
|
102
|
|
- size="small"
|
103
|
|
- @click="DeleteProject(scope.row.id,scope.$index)"
|
104
|
|
- ></el-button>
|
105
|
|
- </el-tooltip>
|
106
|
|
- </template>
|
107
|
|
- </el-table-column>
|
108
|
|
- </el-table>
|
109
|
|
- </el-form>
|
110
|
|
- </div>
|
111
|
|
-
|
112
|
|
-
|
113
|
|
- <div slot="footer" class="dialog-footer">
|
114
|
|
- <el-button @click="hide">取 消</el-button>
|
115
|
|
- <el-button type="primary" @click="submitAction('form')">保 存</el-button>
|
116
|
|
- </div>
|
117
|
|
- </el-dialog>
|
|
185
|
+ <div slot="footer" class="dialog-footer">
|
|
186
|
+ <el-button @click="hide">取 消</el-button>
|
|
187
|
+ <el-button type="primary" @click="submitAction('form')">保 存</el-button>
|
|
188
|
+ </div>
|
|
189
|
+ </el-dialog>
|
118
|
190
|
</template>
|
119
|
191
|
|
120
|
192
|
<script>
|
121
|
|
- import { getDataConfig, getDictionaryDataConfig } from '@/utils/data'
|
122
|
|
- import {
|
123
|
|
- addProjectList,
|
124
|
|
- DeleteProject,
|
125
|
|
- getAllProjectList,
|
126
|
|
- getProjectDetail,
|
127
|
|
- saveProjectTeam
|
128
|
|
- } from '@/api/project/project'
|
|
193
|
+import { getDataConfig, getDictionaryDataConfig } from "@/utils/data";
|
|
194
|
+import {
|
|
195
|
+ addProjectList,
|
|
196
|
+ DeleteProject,
|
|
197
|
+ getAllProjectList,
|
|
198
|
+ getProjectDetail,
|
|
199
|
+ saveProjectTeam,
|
|
200
|
+} from "@/api/project/project";
|
129
|
201
|
|
130
|
|
- import { saveTeam } from '@/api/his/his'
|
|
202
|
+import { saveTeam } from "@/api/his/his";
|
131
|
203
|
|
132
|
|
- export default {
|
133
|
|
- data() {
|
134
|
|
- return {
|
135
|
|
- project_name: '',
|
136
|
|
- visible: false,
|
137
|
|
- formTitle: '',
|
138
|
|
- activeName: 'first',
|
139
|
|
- form: {
|
140
|
|
- project_team: '',
|
141
|
|
- price: 0,
|
142
|
|
- pinyin: '',
|
143
|
|
- wubi: '',
|
144
|
|
- tube_color: '',
|
145
|
|
- team_type: '',
|
146
|
|
- remark: '',
|
147
|
|
- project_detail: '',
|
148
|
|
- number: '1'
|
149
|
|
- },
|
150
|
|
- options: [
|
151
|
|
- { value: 1, label: '是' },
|
152
|
|
- { value: 2, label: '否' }
|
|
204
|
+export default {
|
|
205
|
+ data() {
|
|
206
|
+ return {
|
|
207
|
+ project_name: "",
|
|
208
|
+ visible: false,
|
|
209
|
+ formTitle: "",
|
|
210
|
+ activeName: "first",
|
|
211
|
+ form: {
|
|
212
|
+ project_team: "",
|
|
213
|
+ price: 0,
|
|
214
|
+ pinyin: "",
|
|
215
|
+ wubi: "",
|
|
216
|
+ tube_color: "",
|
|
217
|
+ team_type: "",
|
|
218
|
+ remark: "",
|
|
219
|
+ project_detail: "",
|
|
220
|
+ number: "1",
|
|
221
|
+ },
|
|
222
|
+ options: [
|
|
223
|
+ { value: 1, label: "是" },
|
|
224
|
+ { value: 2, label: "否" },
|
|
225
|
+ ],
|
|
226
|
+ value: "",
|
|
227
|
+ radio: "1",
|
|
228
|
+ rules: {
|
|
229
|
+ project_team: [
|
|
230
|
+ { required: true, message: "请填写组套名称", trigger: "blur" },
|
153
|
231
|
],
|
154
|
|
- value: '',
|
155
|
|
- radio: '1',
|
156
|
|
- rules: {
|
157
|
|
- project_team: [{ required: true, message: '请填写组套名称', trigger: 'blur' }],
|
158
|
|
- // pinyin: [{ required: true, message: '请填写拼音' , trigger: 'blur' }],
|
159
|
|
- // wubi: [{ required: true, message: '请填写五笔' , trigger: 'blur' }],
|
160
|
|
- price: [{ required: true, message: '请填写价格', trigger: 'change' }],
|
161
|
|
- //team_type: [{ required: true, message: '请填写组套类型', trigger: 'change' }]
|
162
|
|
- },
|
163
|
|
- tableData: [],
|
164
|
|
- projectList: [],
|
165
|
|
- tabList: [],
|
166
|
|
- itemList: []
|
|
232
|
+ // pinyin: [{ required: true, message: '请填写拼音' , trigger: 'blur' }],
|
|
233
|
+ // wubi: [{ required: true, message: '请填写五笔' , trigger: 'blur' }],
|
|
234
|
+ price: [{ required: true, message: "请填写价格", trigger: "change" }],
|
|
235
|
+ //team_type: [{ required: true, message: '请填写组套类型', trigger: 'change' }]
|
|
236
|
+ },
|
|
237
|
+ tableData: [],
|
|
238
|
+ projectList: [],
|
|
239
|
+ tabList: [],
|
|
240
|
+ itemList: [],
|
|
241
|
+ };
|
|
242
|
+ },
|
|
243
|
+ methods: {
|
|
244
|
+ getUnit(id) {
|
|
245
|
+ var arr = getDataConfig("hemodialysis", "units");
|
|
246
|
+ for (let i = 0; i < arr.length; i++) {
|
|
247
|
+ if (id == arr[i].id) {
|
|
248
|
+ return arr[i].name;
|
|
249
|
+ }
|
167
|
250
|
}
|
168
|
251
|
},
|
169
|
|
- methods: {
|
170
|
|
- getUnit(id){
|
171
|
|
- var arr = getDataConfig('hemodialysis','units')
|
172
|
|
- for(let i = 0;i < arr.length; i++){
|
173
|
|
- if(id == arr[i].id){
|
174
|
|
- return arr[i].name
|
|
252
|
+ changeProject() {
|
|
253
|
+ this.form.number = 1;
|
|
254
|
+ },
|
|
255
|
+ querySearch(queryString, cb) {
|
|
256
|
+ var restaurants = this.projectList;
|
|
257
|
+ var results = queryString
|
|
258
|
+ ? restaurants.filter(this.createFilter(queryString))
|
|
259
|
+ : restaurants;
|
|
260
|
+ // 调用 callback 返回建议列表的数据
|
|
261
|
+ cb(results);
|
|
262
|
+ },
|
|
263
|
+ createFilter(queryString) {
|
|
264
|
+ return (restaurant) => {
|
|
265
|
+ return (
|
|
266
|
+ restaurant.project_name
|
|
267
|
+ .toLowerCase()
|
|
268
|
+ .indexOf(queryString.toLowerCase()) === 0
|
|
269
|
+ );
|
|
270
|
+ };
|
|
271
|
+ },
|
|
272
|
+ handleSelect(val) {
|
|
273
|
+ this.project_name = val.project_name;
|
|
274
|
+ this.form.project_detail = val.id;
|
|
275
|
+ },
|
|
276
|
+ getDataConfig(module, filed_name) {
|
|
277
|
+ return getDataConfig(module, filed_name);
|
|
278
|
+ },
|
|
279
|
+ getDictionaryDataConfig(module, filed_name) {
|
|
280
|
+ return getDictionaryDataConfig(module, filed_name);
|
|
281
|
+ },
|
|
282
|
+ _close: function (done) {
|
|
283
|
+ done();
|
|
284
|
+ },
|
|
285
|
+ clear: function () {
|
|
286
|
+ this.form.id = 0;
|
|
287
|
+ this.form.name = "";
|
|
288
|
+ this.form.intro = "";
|
|
289
|
+ },
|
|
290
|
+ show(id) {
|
|
291
|
+ this.visible = true;
|
|
292
|
+ this.formTitle = "新增";
|
|
293
|
+ },
|
|
294
|
+ hide() {
|
|
295
|
+ this.visible = false;
|
|
296
|
+ },
|
|
297
|
+ submitAction(formName) {
|
|
298
|
+ this.$refs[formName].validate((valid) => {
|
|
299
|
+ var params = {
|
|
300
|
+ project_team: this.form.project_team,
|
|
301
|
+ price: this.form.price,
|
|
302
|
+ pinyin: this.form.pinyin,
|
|
303
|
+ wubi: this.form.wubi,
|
|
304
|
+ tube_color: this.form.tube_color,
|
|
305
|
+ team_type: this.form.team_type,
|
|
306
|
+ remark: this.form.remark,
|
|
307
|
+ };
|
|
308
|
+ let data = {
|
|
309
|
+ info: this.tableData,
|
|
310
|
+ };
|
|
311
|
+ saveTeam(data, params).then((response) => {
|
|
312
|
+ if (response.data.state == 1) {
|
|
313
|
+ var projectTeam = response.data.data.projectTeam;
|
|
314
|
+ // console.log('projectTeam', projectTeam)
|
|
315
|
+ this.$message.success("保存成功");
|
|
316
|
+ this.visible = false;
|
|
317
|
+ (this.form.project_team = ""),
|
|
318
|
+ (this.form.price = ""),
|
|
319
|
+ (this.form.pinyin = ""),
|
|
320
|
+ (this.form.wubi = ""),
|
|
321
|
+ (this.form.tube_color = ""),
|
|
322
|
+ (this.form.team_type = ""),
|
|
323
|
+ (this.form.remark = "");
|
|
324
|
+ this.tableData = [];
|
|
325
|
+ this.form.number = "";
|
|
326
|
+ this.$parent.getlist();
|
|
327
|
+ } else {
|
|
328
|
+ this.$message.error("项目组套名称已存在!");
|
175
|
329
|
}
|
176
|
|
- }
|
177
|
|
- },
|
178
|
|
- changeProject() {
|
179
|
|
- this.form.number = 1
|
180
|
|
-
|
181
|
|
- },
|
182
|
|
- querySearch(queryString, cb) {
|
183
|
|
- var restaurants = this.projectList
|
184
|
|
- var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
|
185
|
|
- // 调用 callback 返回建议列表的数据
|
186
|
|
- cb(results)
|
|
330
|
+ });
|
|
331
|
+ });
|
|
332
|
+ },
|
|
333
|
+ getlist() {
|
|
334
|
+ let params = {
|
|
335
|
+ keyword: "",
|
|
336
|
+ };
|
|
337
|
+ getAllProjectList(params).then((response) => {
|
|
338
|
+ if (response.data.state == 1) {
|
|
339
|
+ var projectList = response.data.data.projectList;
|
|
340
|
+ var goodInfos = response.data.data.good_info;
|
187
|
341
|
|
188
|
|
- }, createFilter(queryString) {
|
189
|
|
- return (restaurant) => {
|
190
|
|
- return (restaurant.project_name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
|
191
|
|
- }
|
192
|
|
- },
|
193
|
|
- handleSelect(val) {
|
194
|
|
- this.project_name = val.project_name
|
195
|
|
- this.form.project_detail = val.id
|
196
|
|
- },
|
197
|
|
- getDataConfig(module, filed_name) {
|
198
|
|
- return getDataConfig(module, filed_name)
|
199
|
|
- },
|
200
|
|
- getDictionaryDataConfig(module, filed_name) {
|
201
|
|
- return getDictionaryDataConfig(module, filed_name)
|
202
|
|
- },
|
203
|
|
- _close: function(done) {
|
204
|
|
- done()
|
205
|
|
- },
|
206
|
|
- clear: function() {
|
207
|
|
- this.form.id = 0
|
208
|
|
- this.form.name = ''
|
209
|
|
- this.form.intro = ''
|
210
|
|
- },
|
211
|
|
- show(id) {
|
212
|
|
- this.visible = true
|
213
|
|
- this.formTitle = '新增'
|
214
|
|
- },
|
215
|
|
- hide() {
|
216
|
|
- this.visible = false
|
217
|
|
- },
|
218
|
|
- submitAction(formName) {
|
219
|
|
- this.$refs[formName].validate((valid) => {
|
220
|
|
- var params = {
|
221
|
|
- project_team: this.form.project_team,
|
222
|
|
- price: this.form.price,
|
223
|
|
- pinyin: this.form.pinyin,
|
224
|
|
- wubi: this.form.wubi,
|
225
|
|
- tube_color: this.form.tube_color,
|
226
|
|
- team_type: this.form.team_type,
|
227
|
|
- remark: this.form.remark
|
|
342
|
+ for (let i = 0; i < projectList.length; i++) {
|
|
343
|
+ let obj = {
|
|
344
|
+ id: projectList[i].id,
|
|
345
|
+ statistical_classification:
|
|
346
|
+ projectList[i].statistical_classification,
|
|
347
|
+ number: "1",
|
|
348
|
+ project_name: projectList[i].project_name,
|
|
349
|
+ unit: projectList[i].unit,
|
|
350
|
+ price: projectList[i].price,
|
|
351
|
+ type: 2,
|
|
352
|
+ new_id: Math.floor(
|
|
353
|
+ (Math.random() + Math.floor(Math.random() * 9 + 1)) *
|
|
354
|
+ Math.pow(10, 10 - 1)
|
|
355
|
+ ),
|
|
356
|
+ };
|
|
357
|
+ this.projectList.push(obj);
|
228
|
358
|
}
|
229
|
|
- let data = {
|
230
|
|
- 'info': this.tableData
|
231
|
|
- }
|
232
|
|
- saveTeam(data, params).then(response => {
|
233
|
|
- if (response.data.state == 1) {
|
234
|
|
- var projectTeam = response.data.data.projectTeam
|
235
|
|
- // console.log('projectTeam', projectTeam)
|
236
|
|
- this.$message.success('保存成功')
|
237
|
|
- this.visible = false
|
238
|
|
- this.form.project_team = '',
|
239
|
|
- this.form.price = '',
|
240
|
|
- this.form.pinyin = '',
|
241
|
|
- this.form.wubi = '',
|
242
|
|
- this.form.tube_color = '',
|
243
|
|
- this.form.team_type = '',
|
244
|
|
- this.form.remark = ''
|
245
|
|
- this.tableData = []
|
246
|
|
- this.form.number = ''
|
247
|
|
- this.$parent.getlist()
|
248
|
|
- } else {
|
249
|
|
- this.$message.error('项目组套名称已存在!')
|
250
|
|
- }
|
251
|
|
- })
|
252
|
|
- })
|
253
|
|
- },
|
254
|
|
- getlist() {
|
255
|
|
- let params = {
|
256
|
|
- keyword: ''
|
257
|
|
- }
|
258
|
|
- getAllProjectList(params).then(response => {
|
259
|
|
- if (response.data.state == 1) {
|
260
|
|
- var projectList = response.data.data.projectList
|
261
|
|
- var goodInfos = response.data.data.good_info
|
262
|
|
-
|
263
|
|
- for (let i = 0; i < projectList.length; i++) {
|
264
|
359
|
|
265
|
|
- let obj = {
|
266
|
|
- id: projectList[i].id,
|
267
|
|
- statistical_classification: projectList[i].statistical_classification,
|
268
|
|
- number: '1',
|
269
|
|
- project_name: projectList[i].project_name,
|
270
|
|
- unit: projectList[i].unit,
|
271
|
|
- price: projectList[i].price,
|
272
|
|
- type: 2,
|
273
|
|
- new_id: Math.floor((Math.random() + Math.floor(Math.random() * 9 + 1)) * Math.pow(10, 10 - 1)),
|
274
|
|
- }
|
275
|
|
- this.projectList.push(obj)
|
276
|
|
-
|
277
|
|
- }
|
|
360
|
+ for (let i = 0; i < goodInfos.length; i++) {
|
|
361
|
+ let obj = {
|
|
362
|
+ id: goodInfos[i].id,
|
|
363
|
+ statistical_classification:
|
|
364
|
+ goodInfos[i].statistical_classification,
|
|
365
|
+ number: "1",
|
|
366
|
+ project_name:
|
|
367
|
+ goodInfos[i].good_name + " " + goodInfos[i].specification_name,
|
|
368
|
+ unit: goodInfos[i].good_unit,
|
|
369
|
+ price: goodInfos[i].retail_price,
|
|
370
|
+ type: 3,
|
|
371
|
+ new_id: Math.floor(
|
|
372
|
+ (Math.random() + Math.floor(Math.random() * 9 + 1)) *
|
|
373
|
+ Math.pow(10, 10 - 1)
|
|
374
|
+ ),
|
|
375
|
+ };
|
|
376
|
+ this.projectList.push(obj);
|
|
377
|
+ }
|
278
|
378
|
|
279
|
|
- for (let i = 0; i < goodInfos.length; i++) {
|
280
|
|
- let obj = {
|
281
|
|
- id: goodInfos[i].id,
|
282
|
|
- statistical_classification: goodInfos[i].statistical_classification,
|
283
|
|
- number: '1',
|
284
|
|
- project_name: goodInfos[i].good_name + " " + goodInfos[i].specification_name,
|
285
|
|
- unit: goodInfos[i].good_unit,
|
286
|
|
- price: goodInfos[i].retail_price,
|
287
|
|
- type: 3,
|
288
|
|
- new_id: Math.floor((Math.random() + Math.floor(Math.random() * 9 + 1)) * Math.pow(10, 10 - 1)),
|
289
|
|
- }
|
290
|
|
- this.projectList.push(obj)
|
291
|
|
-
|
292
|
|
- }
|
|
379
|
+ console.log("项目2323332", this.projectList);
|
|
380
|
+ }
|
|
381
|
+ });
|
|
382
|
+ },
|
293
|
383
|
|
294
|
|
- console.log("项目2323332",this.projectList)
|
|
384
|
+ getId(id) {
|
|
385
|
+ var name = "";
|
|
386
|
+ var statistics_category = getDictionaryDataConfig(
|
|
387
|
+ "system",
|
|
388
|
+ "statistics_category"
|
|
389
|
+ );
|
295
|
390
|
|
296
|
|
- }
|
297
|
|
- })
|
298
|
|
- },
|
|
391
|
+ for (let i = 0; i < statistics_category.length; i++) {
|
|
392
|
+ if (id == statistics_category[i].id) {
|
|
393
|
+ name = statistics_category[i].name;
|
|
394
|
+ }
|
|
395
|
+ }
|
|
396
|
+ return name;
|
|
397
|
+ },
|
|
398
|
+ chagneInspection(id) {
|
|
399
|
+ getProjectDetail(id).then((response) => {
|
|
400
|
+ if (response.data.state == 1) {
|
|
401
|
+ var projectdetail = response.data.data.projecDetail;
|
299
|
402
|
|
300
|
|
- getId(id) {
|
301
|
|
- var name = ''
|
302
|
|
- var statistics_category = getDictionaryDataConfig('system', 'statistics_category')
|
303
|
|
-
|
304
|
|
- for (let i = 0; i < statistics_category.length; i++) {
|
305
|
|
- if (id == statistics_category[i].id) {
|
306
|
|
- name = statistics_category[i].name
|
307
|
|
- }
|
|
403
|
+ this.tableData.push(projectdetail);
|
308
|
404
|
}
|
309
|
|
- return name
|
310
|
|
- },
|
311
|
|
- chagneInspection(id) {
|
312
|
|
- getProjectDetail(id).then(response => {
|
313
|
|
- if (response.data.state == 1) {
|
314
|
|
- var projectdetail = response.data.data.projecDetail
|
315
|
|
-
|
316
|
|
- this.tableData.push(projectdetail)
|
317
|
|
- }
|
318
|
|
- })
|
319
|
|
- },
|
320
|
|
- addProjectList() {
|
321
|
|
-
|
|
405
|
+ });
|
|
406
|
+ },
|
|
407
|
+ addProjectList() {
|
|
408
|
+ console.log(this.tableData, "this.tableData");
|
|
409
|
+ console.log(this.form.project_detail, "form.project_detail");
|
|
410
|
+ let obj = {new_id:this.form.project_detail}
|
|
411
|
+ if (this.tableData.length <= 0) {
|
322
|
412
|
for (let i = 0; i < this.projectList.length; i++) {
|
323
|
413
|
if (this.form.project_detail == this.projectList[i].new_id) {
|
324
|
|
- this.projectList[i].number = this.form.number
|
325
|
|
- this.projectList[i].number = this.projectList[i].number.toString()
|
326
|
|
-
|
327
|
|
- this.tableData.push(this.projectList[i])
|
328
|
|
- this.form.project_detail = ''
|
329
|
|
- this.form.number = 1
|
|
414
|
+ this.projectList[i].number = this.form.number;
|
|
415
|
+ this.projectList[i].number = this.projectList[i].number.toString();
|
|
416
|
+
|
|
417
|
+ this.tableData.push(this.projectList[i]);
|
|
418
|
+ this.form.project_detail = "";
|
|
419
|
+ this.form.number = 1;
|
330
|
420
|
}
|
331
|
421
|
}
|
332
|
|
-
|
333
|
|
- },
|
334
|
|
- DeleteProject(id, index) {
|
335
|
|
- this.$confirm('确认删除此项目吗?', '删除', {
|
336
|
|
- confirmButtonText: '确 定',
|
337
|
|
- cancelButtonText: '取 消',
|
338
|
|
- type: 'warning'
|
339
|
|
- }).then(() => {
|
340
|
|
- this.tableData.splice(index, 1)
|
341
|
|
- })
|
342
|
|
- .catch(() => {
|
343
|
|
- })
|
344
|
|
- },
|
345
|
|
-
|
346
|
|
- },
|
347
|
|
- created() {
|
348
|
|
- //获取所以的项目
|
349
|
|
- this.getlist()
|
|
422
|
+ } else {
|
|
423
|
+ console.log(obj,'obj')
|
|
424
|
+ this.tableData.forEach((el) => {
|
|
425
|
+ if (this.form.project_detail == el.new_id) {
|
|
426
|
+ this.$message.error("已存在!");
|
|
427
|
+ return;
|
|
428
|
+ } else {
|
|
429
|
+ console.log("oo");
|
350
|
430
|
|
351
|
|
- }, watch: {
|
352
|
|
- 'tableData': function() {
|
353
|
|
- let c = 0
|
354
|
|
- this.form.price = 0
|
355
|
|
- for (let i = 0; i < this.tableData.length; i++) {
|
356
|
|
- let a = parseFloat(this.tableData[i].number).toFixed(2)
|
357
|
|
- let b = parseFloat(this.tableData[i].price).toFixed(2)
|
358
|
|
-
|
|
431
|
+ // for (let i = 0; i < this.projectList.length; i++) {
|
|
432
|
+ // if (this.form.project_detail == this.projectList[i].new_id) {
|
|
433
|
+ // this.projectList[i].number = this.form.number;
|
|
434
|
+ // this.projectList[i].number =
|
|
435
|
+ // this.projectList[i].number.toString();
|
359
|
436
|
|
|
437
|
+ // this.tableData.push(this.projectList[i]);
|
|
438
|
+ // this.form.project_detail = "";
|
|
439
|
+ // this.form.number = 1;
|
|
440
|
+ // }
|
|
441
|
+ // }
|
|
442
|
+ }
|
|
443
|
+ });
|
360
|
444
|
|
361
|
|
- c = c + this.form.price + (a * b)
|
362
|
|
-
|
363
|
|
- }
|
364
|
|
- this.form.price = c.toFixed(2)
|
365
|
445
|
}
|
|
446
|
+ },
|
|
447
|
+ DeleteProject(id, index) {
|
|
448
|
+ this.$confirm("确认删除此项目吗?", "删除", {
|
|
449
|
+ confirmButtonText: "确 定",
|
|
450
|
+ cancelButtonText: "取 消",
|
|
451
|
+ type: "warning",
|
|
452
|
+ })
|
|
453
|
+ .then(() => {
|
|
454
|
+ this.tableData.splice(index, 1);
|
|
455
|
+ })
|
|
456
|
+ .catch(() => {});
|
|
457
|
+ },
|
|
458
|
+ },
|
|
459
|
+ created() {
|
|
460
|
+ //获取所以的项目
|
|
461
|
+ this.getlist();
|
|
462
|
+ },
|
|
463
|
+ watch: {
|
|
464
|
+ tableData: function () {
|
|
465
|
+ let c = 0;
|
|
466
|
+ this.form.price = 0;
|
|
467
|
+ for (let i = 0; i < this.tableData.length; i++) {
|
|
468
|
+ let a = parseFloat(this.tableData[i].number).toFixed(2);
|
|
469
|
+ let b = parseFloat(this.tableData[i].price).toFixed(2);
|
366
|
470
|
|
367
|
|
- }
|
368
|
|
- }
|
|
471
|
+ c = c + this.form.price + a * b;
|
|
472
|
+ }
|
|
473
|
+ this.form.price = c.toFixed(2);
|
|
474
|
+ },
|
|
475
|
+ },
|
|
476
|
+};
|
369
|
477
|
</script>
|