Browse Source

修改切换分组时重置参数逻辑

pull/1/head
zq 2 weeks ago
parent
commit
fe01224f0e
  1. 17
      src/components/BatchProject.vue
  2. 4
      src/components/GuipTextarea.vue
  3. 10
      src/views/AddNewTreatment.vue
  4. 13
      src/views/HosInformation.vue

17
src/components/BatchProject.vue

@ -4,7 +4,7 @@
录入格式1.请按照 项目名称 空格 单次价格 格式输入2.每行一条数据 回车 确认</p> 录入格式1.请按照 项目名称 空格 单次价格 格式输入2.每行一条数据 回车 确认</p>
<div class="content-wrap"> <div class="content-wrap">
<el-form :model="form" :rules="formRules"> <el-form :model="form" :rules="formRules">
<GuipRadio v-model="form.groupType" class="radio-form" :options="groupOptions" label="分组形式" prop="language" /> <GuipRadio v-model="form.groupType" class="radio-form" :options="groupOptions" @change="radioChange" label="分组形式" prop="language" />
<GuipFormItem class="mb24 mt24" v-if="form.groupType==1" label="已有分组"> <GuipFormItem class="mb24 mt24" v-if="form.groupType==1" label="已有分组">
<div class="tabProject tabProject1 flex" slot="formDom" > <div class="tabProject tabProject1 flex" slot="formDom" >
<div :class="['tab-item point', form.classify_id == item.id ? 'active' : '']" @click="selectTag(item)" <div :class="['tab-item point', form.classify_id == item.id ? 'active' : '']" @click="selectTag(item)"
@ -16,8 +16,8 @@
prop="classify_name" placeholder="请填写新增分组名称"/> prop="classify_name" placeholder="请填写新增分组名称"/>
</GuipFormItem> </GuipFormItem>
<GuipFormItem class=" form-special" label="录入项目"> <GuipFormItem class=" form-special" label="录入项目">
<GuipTextarea slot="formDom" v-model="form.project_contents" prop="description" width="100%" height="262px" <GuipTextarea slot="formDom" v-model="form.project_contents" prop="project_contents" :rules="[{ required: true, message: '请填写项目信息', trigger: 'blur' }]" width="100%" height="262px"
autosize :placeholder="'例如:\n推拿 168\n针灸 100'" @change="getNotice"/> autosize :placeholder="'例如:\n推拿 168\n针灸 100'" />
</GuipFormItem> </GuipFormItem>
</el-form> </el-form>
</div> </div>
@ -44,6 +44,9 @@ export default {
classify_name: [ classify_name: [
{ required: true, message: '请输入', trigger: 'blur' } { required: true, message: '请输入', trigger: 'blur' }
], ],
project_contents: [
{ required: true, message: '请填写活动形式', trigger: 'blur' }
]
}, },
form:{ form:{
classify_name:'', classify_name:'',
@ -59,10 +62,14 @@ export default {
} }
}, },
methods: { methods: {
radioChange(){
//
this.$set(this.form,'classify_name','')
this.$set(this.form,'classify_id','')
},
getNotice(e){ getNotice(e){
// \n // \n
let str = e.replace('\n','') console.log(e,'输入内容');
this.form.project_contents = str;
}, },
selectTag(item){ selectTag(item){
this.form.classify_id = item.id this.form.classify_id = item.id

4
src/components/GuipTextarea.vue

@ -9,6 +9,7 @@
:rows="rows" :rows="rows"
@input="handleInput" @input="handleInput"
@change="handleChange" @change="handleChange"
@blur="handleBlur"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</template> </template>
@ -82,6 +83,9 @@ export default {
handleInput(value) { handleInput(value) {
this.$emit('input', value) this.$emit('input', value)
}, },
handleBlur(value) {
this.$emit('blur', value)
},
handleChange(value) { handleChange(value) {
this.$emit('change', value) this.$emit('change', value)
} }

10
src/views/AddNewTreatment.vue

@ -321,7 +321,7 @@ export default {
this.selectAll = allSelected; this.selectAll = allSelected;
this.isIndeterminate = !noneSelected && !allSelected; this.isIndeterminate = !noneSelected && !allSelected;
console.log(this.sortedProjectRows,'sortedProjectRows=='); // console.log(this.sortedProjectRows,'sortedProjectRows==');
this.selectedCount = this.sortedProjectRows.length; this.selectedCount = this.sortedProjectRows.length;
}, },
@ -329,13 +329,11 @@ export default {
// console.log(':', row); // console.log(':', row);
// console.log(':', selection); // console.log(':', selection);
if (this.sortedProjectRows.includes(row)) { if (this.sortedProjectRows.includes(row)) {
// console.log('',this.sortedProjectRows);
let index = this.sortedProjectRows.findIndex((item) => item.id === row.id); let index = this.sortedProjectRows.findIndex((item) => item.id === row.id);
if (index > -1) { if (index > -1) {
this.sortedProjectRows.splice(index, 1) this.sortedProjectRows.splice(index, 1)
} }
} else { } else {
console.log('zoudaolezheli ');
this.sortedProjectRows.push(row) this.sortedProjectRows.push(row)
} }
this.updateSelectionState() this.updateSelectionState()
@ -448,7 +446,7 @@ export default {
}, },
handleConfirm() { handleConfirm() {
let project_infos = []; let project_infos = [];
this.selectedRows.forEach(item => { this.sortedProjectRows.forEach(item => {
project_infos.push({ project_id: item.id, num: item.num || item.unit_num }) project_infos.push({ project_id: item.id, num: item.num || item.unit_num })
}) })
let props = { let props = {
@ -494,8 +492,8 @@ export default {
}) })
}, },
confirmClick() { confirmClick() {
console.log(this.sortedProjectList, 'sortedProjectList=='); // console.log(this.sortedProjectList, 'sortedProjectList==');
console.log(this.sortedProjectRows, 'sortedProjectRows=='); // console.log(this.sortedProjectRows, 'sortedProjectRows==');
// // // //
this.$refs['siteForm1'].validate((valid) => { this.$refs['siteForm1'].validate((valid) => {
if (valid) { if (valid) {

13
src/views/HosInformation.vue

@ -217,13 +217,13 @@
</GuipSwitch> </GuipSwitch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" min-width="100px"> <!-- <el-table-column label="操作" fixed="right" min-width="100px">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="flex"> <div class="flex">
<el-button type="text" @click="handleClick(scope.row)">编辑</el-button> <el-button type="text" @click="handleClick(scope.row)">编辑</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column> -->
</GuipTable> </GuipTable>
<el-pagination background @size-change='handleSizeChange' @current-change='handleCurrentChange' <el-pagination background @size-change='handleSizeChange' @current-change='handleCurrentChange'
:current-page="currentPage" :page-size=pageSize layout="prev, pager, next,jumper" :current-page="currentPage" :page-size=pageSize layout="prev, pager, next,jumper"
@ -789,11 +789,14 @@ export default {
return false; return false;
} }
}); });
} else if (this.dialogVisible) { } else if (this.dialogVisible) {//
let data = this.$refs.channelProject.form; let data = JSON.parse(JSON.stringify(this.$refs.channelProject.form));
let str = data.project_contents;
data.project_contents = str.replace(/\n/g, ' ').trim();
if(!data.project_contents || (data.groupType == '1' && !data.classify_id) || (data.groupType == '2' && !data.classify_name)){ if(!data.project_contents || (data.groupType == '1' && !data.classify_id) || (data.groupType == '2' && !data.classify_name)){
this.$Message.info('请填写完整信息!') this.$Message.info('请填写完整信息!')
}else{ }
else{
this.$http('POST', '/api/admin/mitil_add_project', { this.$http('POST', '/api/admin/mitil_add_project', {
depart_id: this.depart_id, depart_id: this.depart_id,
doctor_id: this.doctor_id, doctor_id: this.doctor_id,

Loading…
Cancel
Save