123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <template>
- <div id="CustomersResponsiblePerson" class="app-container">
- <el-form ref="form" :model="form" :rules="rules" label-width="auto">
- <el-divider content-position="left">负责人信息</el-divider>
- <el-row type="flex" class="row-bg" justify="space-around">
- <el-col :span="6">
- <el-form-item label="人员姓名" prop="personName">
- <el-popover-select-v2 v-model="form.personName" title="负责人" valueKey="name" referName="CONTACTS_PARAM"
- :dataMapping="{person: 'id', personName: 'name'}" :source.sync="form" placeholder="请选择负责人"
- :disabled="disable" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="客户名称" prop="customersName">
- <el-input v-model="form.customersName" :disabled="true" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="关系类型" prop="relationshipType">
- <el-select clearable v-model="form.relationshipType" :disabled="disable">
- <el-option v-for="dict in dict.type.mk_cm_relationship_type" :key="dict.value" :label="dict.label"
- :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row type="flex" class="row-bg" justify="space-around">
- <el-col :span="6">
- <el-form-item label="产线" prop="productionLine">
- <el-select clearable v-model="form.productionLine" :disabled="disable">
- <el-option v-for="dict in dict.type.mk_cm_production_line" :key="dict.value" :label="dict.label"
- :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="开始日期" prop="startDate">
- <el-date-picker v-model="form.startDate" align="right" type="date" placeholder="请选择开始日期"
- :disabled="disable" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="结束日期" prop="endDate">
- <el-date-picker v-model="form.endDate" align="right" type="date" placeholder="请选择结束日期"
- :disabled="disable" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" style="margin-left: 88%; margin-top: 1%">
- <el-button type="primary" @click="submitForm" :disabled="disable">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </div>
- </template>
- <script>
- import {
- listCustomersResponsiblePerson,
- getCustomersResponsiblePerson,
- delCustomersResponsiblePerson,
- addCustomersResponsiblePerson,
- updateCustomersResponsiblePerson
- } from "@/api/business/spd/cm/customersResponsiblePerson";
- // 参照弹出框
- import ElPopoverSelectV2 from "@/components/popover-select-v2";
- export default {
- name: "CustomersResponsiblePerson",
- props: ['pageStu', 'row', 'disable', 'customersId', 'customersName'],
- model: {
- prop: 'isAdd1',
- event: 'jugislist'
- },
- dicts: ['mk_cm_relationship_type', 'mk_cm_production_line'],
- components: {
- ElPopoverSelectV2,
- },
- data() {
- return {
- // 不能直接改变props传来的值
- sonPageStu: this.pageStu,
- sonDisable: this.disable,
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 客户负责人表格数据
- customersResponsiblePersonList: [],
- // 表单参数
- form: {
- id: null,
- person: null,
- personName: null,
- customersName: this.customersName,
- relationshipType: null,
- productionLine: null,
- startDate: null,
- endDate: null,
- customersId: null,
- tenantId: null,
- revision: null,
- createBy: null,
- createTime: null,
- updateBy: null,
- updateTime: null,
- delFlag: null
- },
- // 表单校验
- rules: {
- personName: [{
- required: true,
- message: '人员名称不能为空',
- trigger: 'blur'
- }],
- relationshipType: [{
- required: true,
- message: '关系类型不能为空',
- trigger: 'blur'
- }],
- startDate: [{
- required: true,
- message: '开始日期不能为空',
- trigger: 'blur'
- }],
- productionLine: [{
- required: true,
- message: '产线不能为空',
- trigger: 'blur'
- }],
- },
- };
- },
- created() {
- // 客户主键赋值
- this.form.customersId = this.customersId;
- if (this.pageStu == 'check' || this.pageStu == 'update') {
- this.getDetails(this.row);
- }
- },
- methods: {
- // 取消按钮
- cancel() {
- this.$emit('jugislist', false);
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- updateCustomersResponsiblePerson(this.form).then(response => {
- this.$modal.msgSuccess("修改成功");
- this.cancel();
- this.$parent.handleCheck(this.form.customersId);
- });
- } else {
- addCustomersResponsiblePerson(this.form).then(response => {
- this.$modal.msgSuccess("新增成功");
- this.cancel();
- this.$parent.handleCheck(this.form.customersId);
- });
- }
- }
- });
- },
- /** 获取详情 */
- getDetails(row) {
- getCustomersResponsiblePerson(row.id).then(res => {
- if (res.code == 200) {
- this.form = res.data;
- }
- })
- },
- }
- }
- </script>
|