index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div id="CustomersResponsiblePerson" class="app-container">
  3. <el-form ref="form" :model="form" :rules="rules" label-width="auto">
  4. <el-divider content-position="left">负责人信息</el-divider>
  5. <el-row type="flex" class="row-bg" justify="space-around">
  6. <el-col :span="6">
  7. <el-form-item label="人员姓名" prop="personName">
  8. <el-popover-select-v2 v-model="form.personName" title="负责人" valueKey="name" referName="CONTACTS_PARAM"
  9. :dataMapping="{person: 'id', personName: 'name'}" :source.sync="form" placeholder="请选择负责人"
  10. :disabled="disable" />
  11. </el-form-item>
  12. </el-col>
  13. <el-col :span="6">
  14. <el-form-item label="客户名称" prop="customersName">
  15. <el-input v-model="form.customersName" :disabled="true" />
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="6">
  19. <el-form-item label="关系类型" prop="relationshipType">
  20. <el-select clearable v-model="form.relationshipType" :disabled="disable">
  21. <el-option v-for="dict in dict.type.mk_cm_relationship_type" :key="dict.value" :label="dict.label"
  22. :value="dict.value" />
  23. </el-select>
  24. </el-form-item>
  25. </el-col>
  26. </el-row>
  27. <el-row type="flex" class="row-bg" justify="space-around">
  28. <el-col :span="6">
  29. <el-form-item label="产线" prop="productionLine">
  30. <el-select clearable v-model="form.productionLine" :disabled="disable">
  31. <el-option v-for="dict in dict.type.mk_cm_production_line" :key="dict.value" :label="dict.label"
  32. :value="dict.value" />
  33. </el-select>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="6">
  37. <el-form-item label="开始日期" prop="startDate">
  38. <el-date-picker v-model="form.startDate" align="right" type="date" placeholder="请选择开始日期"
  39. :disabled="disable" />
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="6">
  43. <el-form-item label="结束日期" prop="endDate">
  44. <el-date-picker v-model="form.endDate" align="right" type="date" placeholder="请选择结束日期"
  45. :disabled="disable" />
  46. </el-form-item>
  47. </el-col>
  48. </el-row>
  49. </el-form>
  50. <div slot="footer" style="margin-left: 88%; margin-top: 1%">
  51. <el-button type="primary" @click="submitForm" :disabled="disable">确 定</el-button>
  52. <el-button @click="cancel">取 消</el-button>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import {
  58. listCustomersResponsiblePerson,
  59. getCustomersResponsiblePerson,
  60. delCustomersResponsiblePerson,
  61. addCustomersResponsiblePerson,
  62. updateCustomersResponsiblePerson
  63. } from "@/api/business/spd/cm/customersResponsiblePerson";
  64. // 参照弹出框
  65. import ElPopoverSelectV2 from "@/components/popover-select-v2";
  66. export default {
  67. name: "CustomersResponsiblePerson",
  68. props: ['pageStu', 'row', 'disable', 'customersId', 'customersName'],
  69. model: {
  70. prop: 'isAdd1',
  71. event: 'jugislist'
  72. },
  73. dicts: ['mk_cm_relationship_type', 'mk_cm_production_line'],
  74. components: {
  75. ElPopoverSelectV2,
  76. },
  77. data() {
  78. return {
  79. // 遮罩层
  80. loading: true,
  81. // 选中数组
  82. ids: [],
  83. // 非单个禁用
  84. single: true,
  85. // 非多个禁用
  86. multiple: true,
  87. // 显示搜索条件
  88. showSearch: true,
  89. // 总条数
  90. total: 0,
  91. // 客户负责人表格数据
  92. customersResponsiblePersonList: [],
  93. // 表单参数
  94. form: {
  95. id: null,
  96. person: null,
  97. personName: null,
  98. customersName: this.customersName,
  99. relationshipType: null,
  100. productionLine: null,
  101. startDate: null,
  102. endDate: null,
  103. customersId: null,
  104. tenantId: null,
  105. revision: null,
  106. createBy: null,
  107. createTime: null,
  108. updateBy: null,
  109. updateTime: null,
  110. delFlag: null
  111. },
  112. // 表单校验
  113. rules: {
  114. personName: [{
  115. required: true,
  116. message: '人员名称不能为空',
  117. trigger: 'blur'
  118. }],
  119. relationshipType: [{
  120. required: true,
  121. message: '关系类型不能为空',
  122. trigger: 'blur'
  123. }],
  124. startDate: [{
  125. required: true,
  126. message: '开始日期不能为空',
  127. trigger: 'blur'
  128. }],
  129. productionLine: [{
  130. required: true,
  131. message: '产线不能为空',
  132. trigger: 'blur'
  133. }],
  134. },
  135. };
  136. },
  137. created() {
  138. // 客户主键赋值
  139. this.form.customersId = this.customersId;
  140. if (this.pageStu == 'check' || this.pageStu == 'update') {
  141. this.getDetails(this.row);
  142. }
  143. },
  144. methods: {
  145. // 取消按钮
  146. cancel() {
  147. this.$emit('jugislist', false);
  148. },
  149. /** 提交按钮 */
  150. submitForm() {
  151. this.$refs["form"].validate(valid => {
  152. if (valid) {
  153. if (this.form.id != null) {
  154. updateCustomersResponsiblePerson(this.form).then(response => {
  155. this.$modal.msgSuccess("修改成功");
  156. this.cancel();
  157. this.$parent.handleCheck(this.form.customersId);
  158. });
  159. } else {
  160. addCustomersResponsiblePerson(this.form).then(response => {
  161. this.$modal.msgSuccess("新增成功");
  162. this.cancel();
  163. this.$parent.handleCheck(this.form.customersId);
  164. });
  165. }
  166. }
  167. });
  168. },
  169. /** 获取详情 */
  170. getDetails(row) {
  171. getCustomersResponsiblePerson(row.id).then(res => {
  172. if (res.code == 200) {
  173. this.form = res.data;
  174. }
  175. })
  176. },
  177. }
  178. }
  179. </script>