Form.vue 15.9 KB
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 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
<template>
	<el-dialog :title="!dataForm.id ? '新建' :  isDetail ? '详情':'编辑'" :close-on-click-modal="false" :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px">
		<el-row :gutter="15" class="" >
				<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules">
					<el-col :span="24" v-if="false" >
						<el-form-item label="主键" prop="id">
							<el-input v-model="dataForm.id" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="项目编号" prop="xmbh">
							<el-input v-model="dataForm.xmbh" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="项目名称" prop="xmmc">
							<el-input v-model="dataForm.xmmc" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="标准价格" prop="bzjg">
							<el-input type="number" v-model="dataForm.bzjg" placeholder="请输入标准价格" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<!-- <el-col :span="24">
						<el-form-item label="手工费" prop="sgf">
							<el-input type="number" v-model="dataForm.sgf" placeholder="请输入手工费" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col> -->
					<el-col :span="24">
						<el-form-item label="时长(分)" prop="xmsc">
							<el-input type="number" v-model="dataForm.xmsc" placeholder="请输入时长" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<!-- <el-col :span="24">
						<el-form-item label="基础服务提成" prop="jcfwtc">
							<el-input v-model="dataForm.jcfwtc" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col> -->
					<el-col :span="24">
						<el-form-item label="归类" prop="beautyType">
							<!-- <el-input v-model="dataForm.beautyType" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input> -->
							<el-select allow-create filterable v-model="dataForm.beautyType" placeholder="请选择">
								<el-option
								v-for="item in options8"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="分类1汇总表" prop="fl1">
							<!-- <el-input v-model="dataForm.fl1" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input> -->
							<el-select allow-create filterable v-model="dataForm.fl1" placeholder="请选择">
								<el-option
								v-for="item in options1"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="分类2汇总表" prop="fl2">
							<!-- <el-input v-model="dataForm.fl2" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input> -->
							<el-select allow-create filterable v-model="dataForm.fl2" placeholder="请选择">
								<el-option
								v-for="item in options2"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="分类3工资用" prop="fl3">
							<!-- <el-input v-model="dataForm.fl3" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input> -->
							<el-select allow-create filterable v-model="dataForm.fl3" placeholder="请选择">
								<el-option
								v-for="item in options3"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="分类4品项用" prop="fl4">
							<!-- <el-input v-model="dataForm.fl4" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input> -->
							<el-select allow-create filterable v-model="dataForm.fl4" placeholder="请选择">
								<el-option
								v-for="item in options4"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<!-- <el-col :span="24">
						<el-form-item label="统计类别" prop="tjlb">
							<el-input v-model="dataForm.tjlb" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="折扣类别" prop="zklb">
							<el-input v-model="dataForm.zklb" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col> -->
					<el-col :span="24">
						<el-form-item label="分类" prop="fl">
							<!-- <el-input v-model="dataForm.fl" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input> -->
							<el-select allow-create filterable v-model="dataForm.fl" placeholder="请选择">
								<el-option
								v-for="item in options5"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="其它1" prop="qt1">
							<!-- <el-input v-model="dataForm.qt1" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input> -->
							<el-select allow-create filterable v-model="dataForm.qt1" placeholder="请选择">
								<el-option
								v-for="item in options6"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="其它2" prop="qt2">
							<!-- <el-input v-model="dataForm.qt2" placeholder="请输入" clearable :style='{"width":"100%"}' >
							</el-input> -->
							<el-select allow-create filterable v-model="dataForm.qt2" placeholder="请选择">
								<el-option
								v-for="item in options7"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="是否有效" prop="isEffective">
							<el-select v-model="dataForm.isEffective" placeholder="请选择">
								<el-option
								v-for="item in effectiveOptions"
								:key="item.value"
								:label="item.label"
								:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="医美手工费" prop="medicalBeautyLaborCost">
							<el-input type="number" v-model="dataForm.medicalBeautyLaborCost" placeholder="请输入医美手工费" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="科美手工费" prop="techBeautyLaborCost">
							<el-input type="number" v-model="dataForm.techBeautyLaborCost" placeholder="请输入科美手工费" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="生美手工费" prop="lifeBeautyLaborCost">
							<el-input type="number" v-model="dataForm.lifeBeautyLaborCost" placeholder="请输入生美手工费" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="健康师手工费" prop="healthCoachLaborCost">
							<el-input type="number" v-model="dataForm.healthCoachLaborCost" placeholder="请输入健康师手工费" clearable :style='{"width":"100%"}' >
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="是否允许陪同" prop="isAllowAccompanied">
							<el-select v-model="dataForm.isAllowAccompanied" placeholder="请选择">
								<el-option label="否" :value="0"></el-option>
								<el-option label="是" :value="1"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
				</el-form>
		</el-row>
		<span slot="footer" class="dialog-footer">
			<el-button @click="visible = false">取 消</el-button>
			<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button>
		</span>
	</el-dialog>
</template>
<script>
	import request from '@/utils/request'
	import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
	import { previewDataInterface } from '@/api/systemData/dataInterface'
import { init } from 'echarts/lib/echarts';
	export default {
		components: {},
		props: [],
		data() {
			return {
				loading: false,
				visible: false,
				isDetail: false,
				dataForm: {
					id:'',
					sgf:undefined,
					id:undefined,
					xmbh:undefined,
					xmmc:undefined,
					bzjg:undefined,
					xmsc:undefined,
					jcfwtc:undefined,
					fl1:undefined,
					fl2:undefined,
					fl3:undefined,
					fl4:undefined,
					tjlb:undefined,
					zklb:undefined,
					fl:undefined,
					qt1:undefined,
					qt2:undefined,
					beautyType:undefined,
					isEffective: 1, // 默认有效
					medicalBeautyLaborCost: 0, // 医美手工费
					techBeautyLaborCost: 0, // 科美手工费
					lifeBeautyLaborCost: 0, // 生美手工费
					healthCoachLaborCost: 0, // 健康师手工费
					isAllowAccompanied: 0, // 是否允许陪同 0否 1是
				},
				rules: {
				},
				options1:[],
				options2:[],
				options3:[],
				options4:[],
				options5:[],
				options6:[],
				options7:[],
				options8:[],
				effectiveOptions: [],
			}
		},
		computed: {},
        watch: {},
        created() {
		
		},
		mounted() {
			
        },
		methods: {
			getoptions(){
				request({
					url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=fl1',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data && res.data.values) {
						this.options1 = res.data.values.map(item => ({
							label: item,
							value: item
						}));
					}else {
						this.options1 = []
					}
				})
				request({
					url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=fl2',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data && res.data.values) {
						this.options2 = res.data.values.map(item => ({
							label: item,
							value: item
						}));
					}else {
						this.options2 = []
					}
				})
				request({
					url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=fl3',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data && res.data.values) {
						this.options3 = res.data.values.map(item => ({
							label: item,
							value: item
						}));
					}else {
						this.options3 = []
					}
				})
				request({
					url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=fl4',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data && res.data.values) {
						this.options4 = res.data.values.map(item => ({
							label: item,
							value: item
						}));
					}else {
						this.options4 = []
					}
				})
				request({
					url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=fl',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data && res.data.values) {
						this.options5 = res.data.values.map(item => ({
							label: item,
							value: item
						}));
					}else {
						this.options5 = []
					}
				})
				request({
					url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=qt1',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data && res.data.values) {
						this.options6 = res.data.values.map(item => ({
							label: item,
							value: item
						}));
					}else {
						this.options6 = []
					}
				})
				request({
					url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=qt2',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data && res.data.values) {
						this.options7 = res.data.values.map(item => ({
							label: item,
							value: item
						}));
					}else {
						this.options7 = []
					}
				})
				request({
					url: '/api/Extend/lqxmzl/GetDistinctFieldData?fieldName=beautyType',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data && res.data.values) {
						this.options8 = res.data.values.map(item => ({
							label: item,
							value: item
						}));
					}else {
						this.options8 = []
					}
				})
				// 获取状态枚举数据
				request({
					url: '/api/Extend/lqkdkdjlb/status-enum',
					method: 'get',
				}).then(res => {
					if (res.code == 200 && res.data) {
						this.effectiveOptions = res.data.map(item => ({
							label: item.Name,
							value: item.Value
						}));
					} else {
						this.effectiveOptions = []
					}
				})
			},
			goBack() {
                this.$emit('refresh')
            },
			init(id, isDetail) {
				this.dataForm.id = id || 0;
                this.visible = true;
                this.isDetail = isDetail || false;
				this.$nextTick(() => {
					this.$refs['elForm'].resetFields();
					if (this.dataForm.id) {
						request({
							url: '/api/Extend/LqXmzl/' + this.dataForm.id,
							method: 'get'
						}).then(res =>{
							this.dataForm = res.data;
							this.dataForm.isEffective = res.data.isEffective?res.data.isEffective:1;
							this.dataForm.medicalBeautyLaborCost = res.data.medicalBeautyLaborCost !== undefined ? res.data.medicalBeautyLaborCost : 0;
							this.dataForm.techBeautyLaborCost = res.data.techBeautyLaborCost !== undefined ? res.data.techBeautyLaborCost : 0;
							this.dataForm.lifeBeautyLaborCost = res.data.lifeBeautyLaborCost !== undefined ? res.data.lifeBeautyLaborCost : 0;
							this.dataForm.healthCoachLaborCost = res.data.healthCoachLaborCost !== undefined ? res.data.healthCoachLaborCost : 0;
							this.dataForm.isAllowAccompanied = res.data.isAllowAccompanied !== undefined ? res.data.isAllowAccompanied : 0;
						})
					}
				})
				this.getoptions()
			},
			dataFormSubmit() {
				this.$refs['elForm'].validate((valid) => {
                    if (valid) {
                        if (!this.dataForm.id) {
                            request({
                                url: `/api/Extend/LqXmzl`,
                                method: 'post',
                                data: this.dataForm,
                            }).then((res) => {
                                this.$message({
                                    message: res.msg,
                                    type: 'success',
                                    duration: 1000,
                                    onClose: () => {
                                        this.visible = false,
                                            this.$emit('refresh', true)
                                    }
                                })
                            })
                        } else {
                            request({
                                url: '/api/Extend/LqXmzl/' + this.dataForm.id,
                                method: 'PUT',
                                data: this.dataForm
                            }).then((res) => {
                                this.$message({
                                    message: res.msg,
                                    type: 'success',
                                    duration: 1000,
                                    onClose: () => {
                                        this.visible = false
                                        this.$emit('refresh', true)
                                    }
                                })
                            })
                        }
                    }
                })
			},
		}
	}
</script>