index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. // 不能直接改变props传来的值
  80. sonPageStu: this.pageStu,
  81. sonDisable: this.disable,
  82. // 遮罩层
  83. loading: true,
  84. // 选中数组
  85. ids: [],
  86. // 非单个禁用
  87. single: true,
  88. // 非多个禁用
  89. multiple: true,
  90. // 显示搜索条件
  91. showSearch: true,
  92. // 总条数
  93. total: 0,
  94. // 客户负责人表格数据
  95. customersResponsiblePersonList: [],
  96. // 表单参数
  97. form: {
  98. id: null,
  99. person: null,
  100. personName: null,
  101. customersName: this.customersName,
  102. relationshipType: null,
  103. productionLine: null,
  104. startDate: null,
  105. endDate: null,
  106. customersId: null,
  107. tenantId: null,
  108. revision: null,
  109. createBy: null,
  110. createTime: null,
  111. updateBy: null,
  112. updateTime: null,
  113. delFlag: null
  114. },
  115. // 表单校验
  116. rules: {
  117. personName: [{
  118. required: true,
  119. message: '人员名称不能为空',
  120. trigger: 'blur'
  121. }],
  122. relationshipType: [{
  123. required: true,
  124. message: '关系类型不能为空',
  125. trigger: 'blur'
  126. }],
  127. startDate: [{
  128. required: true,
  129. message: '开始日期不能为空',
  130. trigger: 'blur'
  131. }],
  132. productionLine: [{
  133. required: true,
  134. message: '产线不能为空',
  135. trigger: 'blur'
  136. }],
  137. },
  138. };
  139. },
  140. created() {
  141. // 客户主键赋值
  142. this.form.customersId = this.customersId;
  143. if (this.pageStu == 'check' || this.pageStu == 'update') {
  144. this.getDetails(this.row);
  145. }
  146. },
  147. methods: {
  148. // 取消按钮
  149. cancel() {
  150. this.$emit('jugislist', false);
  151. },
  152. /** 提交按钮 */
  153. submitForm() {
  154. this.$refs["form"].validate(valid => {
  155. if (valid) {
  156. if (this.form.id != null) {
  157. updateCustomersResponsiblePerson(this.form).then(response => {
  158. this.$modal.msgSuccess("修改成功");
  159. this.cancel();
  160. this.$parent.handleCheck(this.form.customersId);
  161. });
  162. } else {
  163. addCustomersResponsiblePerson(this.form).then(response => {
  164. this.$modal.msgSuccess("新增成功");
  165. this.cancel();
  166. this.$parent.handleCheck(this.form.customersId);
  167. });
  168. }
  169. }
  170. });
  171. },
  172. /** 获取详情 */
  173. getDetails(row) {
  174. getCustomersResponsiblePerson(row.id).then(res => {
  175. if (res.code == 200) {
  176. this.form = res.data;
  177. }
  178. })
  179. },
  180. }
  181. }
  182. </script>