客户档案的合同添加、复制健康调查链接
This commit is contained in:
180
stdiet-ui/src/components/ContractAdd/index.vue
Normal file
180
stdiet-ui/src/components/ContractAdd/index.vue
Normal file
@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<!-- 添加或修改合同对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="调理项目" prop="projectId">
|
||||
<el-select v-model="form.projectId" placeholder="请选择调理项目" filterable clearable size="small">
|
||||
<el-option v-for="dict in conditioningProjectIdOption"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!--<el-form-item label="客户姓名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
|
||||
</el-form-item>-->
|
||||
<el-form-item label="金额" prop="amount" style="width: 300px;">
|
||||
<el-input v-model="form.amount" placeholder="请输入金额"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="服务承诺" prop="servePromise" v-show="form.projectId == 0" >
|
||||
<el-input style="width: 200px;" v-model="form.servePromise" placeholder="请输入服务承诺"/><span style="margin-left: 5px;">斤</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师" prop="nutritionistId">
|
||||
<el-select v-model="form.nutritionistId" placeholder="请选择营养师" clearable size="small">
|
||||
<el-option v-for="dict in nutritionistIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="服务时间" prop="serveTime">
|
||||
<el-select v-model="form.serveTime" placeholder="请选择服务时间">
|
||||
<el-option
|
||||
v-for="dict in serveTimeOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import {addContract} from "@/api/custom/contract";
|
||||
import {getOptions} from "@/api/custom/order";
|
||||
|
||||
export default {
|
||||
name: "ContractAdd",
|
||||
components: {
|
||||
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
const checkServePromise = (rule, value, callback) => {
|
||||
if (this.form.projectId == 0 && !value) {
|
||||
return callback(new Error('请输入服务承诺'))
|
||||
}
|
||||
callback();
|
||||
};
|
||||
return {
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
callback: undefined,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
projectId:[
|
||||
{required: true, message: "请选择调理项目", trigger: "blur"}
|
||||
],
|
||||
/*name: [
|
||||
{required: true, message: "请输入客户姓名", trigger: "blur"}
|
||||
],*/
|
||||
amount: [
|
||||
{required: true, message: "请输入签订金额", trigger: "blur"},
|
||||
{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
pattern: /^[1-9]\d*$/,
|
||||
message: "签订金额格式不正确",
|
||||
},
|
||||
],
|
||||
servePromise: [
|
||||
{required: true, trigger: "blur", validator: checkServePromise}
|
||||
],
|
||||
serveTime: [
|
||||
{required: true, message: "请选择服务时间", trigger: "blur"}
|
||||
],
|
||||
nutritionistId: [
|
||||
{required: true, message: "请选择营养师", trigger: "blur"}
|
||||
]
|
||||
},
|
||||
conditioningProjectIdOption:[],
|
||||
serveTimeOptions:[],
|
||||
nutritionistIdOptions:[]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
getOptions().then(response => {
|
||||
const options = response.data.reduce((opts, cur) => {
|
||||
if (!opts[cur.postCode]) {
|
||||
opts[cur.postCode] = [];
|
||||
}
|
||||
opts[cur.postCode].push({dictValue: cur.userId, dictLabel: cur.userName, remark: cur.remark})
|
||||
return opts;
|
||||
}, {})
|
||||
this.nutritionistIdOptions = options['nutri'] || [];
|
||||
})
|
||||
this.getDicts("cus_serve_time").then(response => {
|
||||
this.serveTimeOptions = response.data;
|
||||
});
|
||||
this.getDicts("conditioning_project").then(response => {
|
||||
this.conditioningProjectIdOption = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
showDialog(data, callback) {
|
||||
this.callback = callback;
|
||||
this.reset(data);
|
||||
this.title = "新增"+`「${data.customer}」客户合同`;
|
||||
this.open = true;
|
||||
},
|
||||
// 表单重置
|
||||
reset(obj) {
|
||||
const defaultNutritionist = this.nutritionistIdOptions.find(opt => opt.dictValue === obj.nutritionistId);
|
||||
const defaultProjectIdOption = this.conditioningProjectIdOption.find(opt => opt.remark === 'default');
|
||||
|
||||
this.form = {
|
||||
id: null,
|
||||
customerId: obj.customerId,
|
||||
projectId: defaultProjectIdOption ? parseInt(defaultProjectIdOption.dictValue) : null,
|
||||
name: obj.customer,
|
||||
phone: null,
|
||||
serveTime: null,
|
||||
amount: null,
|
||||
path: null,
|
||||
createBy: null,
|
||||
nutritionistId: defaultNutritionist ? parseInt(defaultNutritionist.dictValue) : null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.tutor = this.selectDictLabel(this.nutritionistIdOptions, this.form.nutritionistId)
|
||||
if(this.form.projectId != 0){
|
||||
this.form.servePromise = null;
|
||||
}
|
||||
addContract(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.callback && this.callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -8,17 +8,18 @@
|
||||
size="40%"
|
||||
>
|
||||
<div class="app-container">
|
||||
<!--<el-row :gutter="10" class="mb8">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
v-hasPermi="['custom:contract:add']"
|
||||
@click="handleAdd"
|
||||
>创建合同
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>-->
|
||||
</el-row>
|
||||
|
||||
<el-table :data="contractList">
|
||||
<el-table-column label="合同编号" align="center" prop="id" width="150"/>
|
||||
@ -71,7 +72,7 @@
|
||||
</div>
|
||||
</el-drawer>
|
||||
|
||||
<!--<create-order-dialog ref="cusCreateOrderDialogRef" />-->
|
||||
<add-contract ref="cusAddContractDialogRef" />
|
||||
|
||||
<contract-detail ref="contractDetailRef" />
|
||||
</div>
|
||||
@ -80,11 +81,13 @@
|
||||
import {delContract, listContract} from "@/api/custom/contract";
|
||||
import ContractDetail from "@/components/ContractDetail";
|
||||
import Clipboard from 'clipboard';
|
||||
import ContractAdd from "@/components/ContractAdd";
|
||||
|
||||
export default {
|
||||
name: "CustomerContractDrawer",
|
||||
components: {
|
||||
'contract-detail': ContractDetail
|
||||
'contract-detail': ContractDetail,
|
||||
'add-contract':ContractAdd
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -111,17 +114,14 @@ export default {
|
||||
});
|
||||
},
|
||||
handleAdd() {
|
||||
this.$refs.cusCreateOrderDialogRef.showDialog(
|
||||
this.$refs.cusAddContractDialogRef.showDialog(
|
||||
{
|
||||
customer: this.data.name,
|
||||
cusId: this.data.id,
|
||||
preSaleId: this.data.salesman,
|
||||
afterSaleId: this.data.afterDietitian,
|
||||
nutritionistId: this.data.mainDietitian,
|
||||
nutriAssisId: this.data.assistantDietitian,
|
||||
customerId: this.data.id,
|
||||
nutritionistId: this.data.mainDietitian
|
||||
},
|
||||
() => {
|
||||
this.fetchOrderList(this.data.id);
|
||||
this.fetchContractList(this.data.id);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
@ -14,6 +14,7 @@
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
v-hasPermi="['custom:order:add']"
|
||||
@click="handleAdd"
|
||||
>创建订单
|
||||
</el-button>
|
||||
@ -73,12 +74,14 @@
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleOnEditClick(scope.row)"
|
||||
v-hasPermi="['custom:order:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="scope.row.orderType === 'main'"
|
||||
size="mini"
|
||||
type="text"
|
||||
v-hasPermi="['custom:order:remove']"
|
||||
@click="handleOnDeleteClick(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
|
@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<el-dialog :visible.sync="visible" :title="title" append-to-body @closed="onClosed">
|
||||
<div style="float:right;margin-top:-10px;margin-bottom: 10px;" v-show="dataList.length > 0">
|
||||
<!--<el-button v-hasPermi="['custom:healthy:edit']" @click="" plain>修改信息</el-button>-->
|
||||
<el-button type="danger" v-hasPermi="['custom:healthy:remove']" @click="handleDelete()" plain>删除信息</el-button>
|
||||
</div>
|
||||
<!-- 客户健康评估 -->
|
||||
<div v-if="dataList.length > 0 && dataType == 0">
|
||||
<!-- 基础信息 -->
|
||||
@ -46,15 +50,18 @@
|
||||
<!-- 客户体征 -->
|
||||
<div v-else>
|
||||
<table-detail-message v-show="dataList.length > 0" :data="dataList" ></table-detail-message>
|
||||
<p v-show="dataList.length == 0" style="font-size: 20px;text-align:center">暂无数据!</p>
|
||||
<p v-show="dataList.length == 0" style="font-size: 20px;text-align:center;">暂无数据!
|
||||
<el-button icon="el-icon-share" size="small" title="点击复制链接" class="copyBtn" type="primary" :data-clipboard-text="copyValue" @click="handleCopy()">健康评估表链接</el-button>
|
||||
</p>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
|
||||
import { getCustomerPhysicalSignsByCusId,delCustomerHealthy } from "@/api/custom/customer";
|
||||
import TableDetailMessage from "@/components/TableDetailMessage";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import * as healthyData from "@/utils/healthyData";
|
||||
import Clipboard from 'clipboard';
|
||||
|
||||
export default {
|
||||
name: "PhysicalSignsDialog",
|
||||
@ -66,6 +73,7 @@ export default {
|
||||
return {
|
||||
visible: false,
|
||||
title: "",
|
||||
data: null,
|
||||
dataList: [],
|
||||
dataType: 0,
|
||||
// 体征标题
|
||||
@ -171,8 +179,9 @@ export default {
|
||||
[
|
||||
["medicalReport_one","medicalReport_two","medicalReport_three"]
|
||||
]
|
||||
]
|
||||
|
||||
],
|
||||
copyValue: "",
|
||||
enc_id: ""
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -186,6 +195,7 @@ export default {
|
||||
}
|
||||
},
|
||||
showDialog(data) {
|
||||
this.data = data;
|
||||
this.title = `「${data.name}」`;
|
||||
getCustomerPhysicalSignsByCusId(data.id).then((res) => {
|
||||
if (res.data.customerHealthy) {
|
||||
@ -198,11 +208,15 @@ export default {
|
||||
}
|
||||
}
|
||||
this.title += (this.dataType == 0 ? "客户健康评估信息" : "客户体征信息");
|
||||
this.enc_id = res.data.enc_id;
|
||||
this.visible = true;
|
||||
});
|
||||
},
|
||||
onClosed() {
|
||||
this.dataList = [];
|
||||
this.data = null;
|
||||
this.enc_id = "";
|
||||
this.copyValue = "";
|
||||
},
|
||||
//对体征信息进行处理
|
||||
getDataListBySignMessage(sign){
|
||||
@ -383,8 +397,34 @@ export default {
|
||||
str = str.substring(0,str.length-1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
},
|
||||
handleCopy() {
|
||||
this.copyValue = window.location.origin.replace('manage', 'sign') + "/subhealthyInvestigation/"+this.enc_id;
|
||||
const btnCopy = new Clipboard('.copyBtn');
|
||||
this.$message({
|
||||
message: '拷贝成功',
|
||||
type: 'success'
|
||||
});
|
||||
},
|
||||
/** 删除健康信息操作 */
|
||||
handleDelete() {
|
||||
const ids = this.data.id;
|
||||
this.$confirm(
|
||||
'是否确认删除客户姓名为为"' + this.data.name + '"的体征信息?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}
|
||||
).then(function () {
|
||||
return delCustomerHealthy(ids);
|
||||
}).then(() => {
|
||||
this.dataList = [];
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(function () {});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user