You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

288 lines
9.8 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <div style="display:flex">
  4. <div style="width: 95%;">
  5. <el-table :data="customerOrg.contactPersonList" border height="150" row-key="id" size="small"
  6. class="el-table__body-wrapper tbody" highlight-current-row @row-click="rowClick"
  7. ref="customerOrg.contactPersonList">
  8. <el-table-column prop="displayName" label="姓名" />
  9. <el-table-column prop="title" label="职务" />
  10. <el-table-column prop="remark" label="备注" />
  11. <el-table-column prop="creatorName" label="创建者" width="" />
  12. <el-table-column prop="creationTime" label="创建时间" width="200">
  13. <template slot-scope="scope">
  14. {{ scope.row.creationTime | dateFormat }}
  15. </template>
  16. </el-table-column>
  17. <el-table-column prop="lastModifierName" label="修改者" />
  18. <el-table-column prop="lastModificationTime" label="修改时间" width="200">
  19. <template slot-scope="scope">
  20. {{ scope.row.lastModificationTime | dateFormat }}
  21. </template>
  22. </el-table-column>
  23. </el-table>
  24. <el-table :data="customerOrg.contactMethodList" border height="150" row-key="id" size="small"
  25. class="el-table__body-wrapper tbody" highlight-current-row @row-click="rowClickMethod"
  26. ref="customerOrg.contactMethodList">
  27. <el-table-column prop="contactMethodType" label="类型">
  28. <template slot-scope="scope">
  29. <div>{{scope.row.contactMethodType==='0' ? '手机':'邮箱'}}</div>
  30. </template>
  31. </el-table-column>
  32. <el-table-column prop="contactMethodValue" label="联系方式" />
  33. <el-table-column prop="creatorName" label="创建者" width="" />
  34. <el-table-column prop="creationTime" label="创建时间" width="200">
  35. <template slot-scope="scope">
  36. {{ scope.row.creationTime | dateFormat }}
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="lastModifierName" label="修改者" />
  40. <el-table-column prop="lastModificationTime" label="修改时间" width="200">
  41. <template slot-scope="scope">
  42. {{ scope.row.lastModificationTime | dateFormat }}
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. </div>
  47. <div style="margin-left: 10px; margin-top: 5%">
  48. <div style="margin-top: 10px">
  49. <el-button type="primary" @click="add">新增</el-button>
  50. </div>
  51. <div style="margin-top: 10px">
  52. <el-button type="success" @click="edit">编辑</el-button>
  53. </div>
  54. <div style="margin-top: 10px">
  55. <el-button type="danger" @click="del">删除</el-button>
  56. </div>
  57. </div>
  58. </div>
  59. <!-- 联系人 -->
  60. <el-dialog :title="formTitle" :visible.sync="dialogContactPerson" width="480">
  61. <el-form :model="form" ref="form" label-width="100px" :rules="rules">
  62. <el-row>
  63. <el-col :span="8">
  64. <el-form-item label="联系人">
  65. <el-input v-model="form.displayName"></el-input>
  66. </el-form-item>
  67. </el-col>
  68. <el-col :span="8">
  69. <el-form-item label="职务">
  70. <el-input v-model="form.title"></el-input>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="8">
  74. <el-form-item label="备注">
  75. <el-input v-model="form.remark"></el-input>
  76. </el-form-item>
  77. </el-col>
  78. </el-row>
  79. <el-row>
  80. <el-col :span="5">
  81. <el-form-item label="创建者">
  82. <el-input v-model="customerOrg.customerOrgRd.creatorName" disabled></el-input>
  83. </el-form-item>
  84. </el-col>
  85. <el-col :span="7">
  86. <el-form-item label="创建时间" style="margin-left: -5%">
  87. <el-input :value="customerOrg.customerOrgRd.creationTime | dateFormat" disabled style="width: 90%"></el-input>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="5">
  91. <el-form-item label="修改者" style="margin-left: -25%">
  92. <el-input v-model="customerOrg.customerOrgRd.creatorName" disabled></el-input>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="7">
  96. <el-form-item label="修改时间" style="margin-left: -5%">
  97. <el-input :value="customerOrg.customerOrgRd.lastModificationTime | dateFormat" disabled style="width: 90%"></el-input>
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. <el-divider/>
  102. <el-table :data="customerOrg.contactMethodList" border height="300" row-key="id" size="small"
  103. class="el-table__body-wrapper tbody" highlight-current-row ref="contactMethod">
  104. <el-table-column prop="contactMethodType" label="类型">
  105. <template slot-scope="scope">
  106. <el-select v-model="customerOrg.contactMethodList[scope.$index].contactMethodType">
  107. <el-option
  108. v-for="item in Methodtypes"
  109. :key="item.value"
  110. :label="item.label"
  111. :value="item.value"
  112. />
  113. </el-select>
  114. </template>
  115. </el-table-column>
  116. <el-table-column prop="contactMethodValue" label="联系方式">
  117. <template slot-scope="scope">
  118. <el-input v-model="customerOrg.contactMethodList[scope.$index].contactMethodValue" required/>
  119. </template>
  120. </el-table-column>
  121. <el-table-column fixed="right" label="操作" width="60">
  122. <template slot-scope="scope">
  123. <i class="el-icon-delete" @click="deleteRow(scope.$index)" size="medium"></i>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. </el-form>
  128. <span slot="footer" class="dialog-footer">
  129. <el-button @click="dialogContactPerson = false"> </el-button>
  130. <el-button type="success" @click="addMethod">新增联系方式</el-button>
  131. <el-button type="primary" @click="submit"> </el-button>
  132. </span>
  133. </el-dialog>
  134. </div>
  135. </template>
  136. <script>
  137. import { mapState } from 'vuex'
  138. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  139. export default {
  140. components: {
  141. },
  142. data() {
  143. return {
  144. personId:'',
  145. form: {
  146. customerOrgId:'',
  147. displayName: "",
  148. title: "",
  149. remark: "",
  150. },
  151. formTitle:'新增',
  152. dialogContactPerson: false, //联系人弹窗 显示控制
  153. Methodtypes:[
  154. //{ value: '',label: '所有订单状态' },
  155. { value: '0',label: '电话' },
  156. { value: '1',label: '邮箱' },
  157. ],
  158. contactMethod: [], //联系方式form表单数据
  159. rules: {
  160. displayName: [
  161. { required: true, message: "请输入名称", trigger: "blur" },
  162. ],
  163. },
  164. };
  165. },
  166. created() {
  167. },
  168. //挂载完成
  169. mounted() {
  170. },
  171. computed:{
  172. ...mapState(['customerOrg']),
  173. },
  174. methods: {
  175. //获取联系人列表
  176. getContactPersonList(customerOrgId){
  177. getapi(`/api/app/contact-person/in-customer-org-id/${customerOrgId}`).then(
  178. (res) => {
  179. //console.log('res.data',res.data)
  180. this.customerOrg.contactPersonList = res.data
  181. }
  182. );
  183. },
  184. //获取联系方式列表
  185. //api/app/contact-method/in-contact-person-id?ContactPersonId=3a0c08ad-4304-138b-d9e6-a7338739dfc4' \
  186. getContactMethodList(ContactPersonId){
  187. getapi('/api/app/contact-method/in-contact-person-id',{ContactPersonId}).then(
  188. (res) => {
  189. //console.log('res.data',res.data)
  190. this.customerOrg.contactMethodList = res.data
  191. }
  192. );
  193. },
  194. //联系人 相关操作
  195. add() {
  196. //this.$message.success("新增 addContactPerson");
  197. this.dialogContactPerson = true
  198. this.formTitle = "新增"
  199. this.personId = ''
  200. },
  201. edit() {
  202. //this.$message.success("编辑 editContactPerson");
  203. if(!this.personId || !this.customerOrg.customerOrgId){
  204. alert("请先选择要编辑的联系人")
  205. return
  206. }
  207. this.dialogContactPerson = true
  208. this.formTitle = "编辑"
  209. },
  210. del() {
  211. this.$message.success("删除 delContactPerson");
  212. },
  213. deleteRow (index){
  214. this.customerOrg.contactMethodList.splice(index, 1)
  215. },
  216. //联系人信息提交
  217. submit(){
  218. if(this.formTitle === '新增'){
  219. postapi('api/app/contact-person',form).then(
  220. (res) => {
  221. //console.log('res.data',res.data)
  222. this.personId = res.data.id
  223. return deletapi(`api/app/contact-method/${this.personId}`)
  224. }
  225. ).then(
  226. (res) => {
  227. //console.log('res.data',res.data)
  228. this.personId = res.data.id
  229. return postapi('api/app/contact-method/many',contactMethod)
  230. }
  231. ).then(
  232. (res) => {
  233. this.getContactPersonList(this.customerOrg.customerOrgId)
  234. this.$message.success("操作成功!");
  235. }
  236. );
  237. }else{
  238. }
  239. },
  240. //新增联系方式
  241. addMethod(){
  242. this.customerOrg.contactMethodList.push({
  243. contactMethodValue: "",
  244. contactMethodType: "0",
  245. contactPersonId: this.personId
  246. })
  247. },
  248. rowClick(row){
  249. // console.log('row',row)
  250. // this.$message.success("rowClick");
  251. this.personId = row.id
  252. this.getContactMethodList(row.id)
  253. },
  254. rowClickMethod(row){
  255. this.$message.success("rowClickMethod");
  256. }
  257. },
  258. };
  259. </script>
  260. <style scoped>
  261. </style>