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.

369 lines
13 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
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
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
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
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="customerOrg.orgDetailStyle">
  4. <div :style="'width:'+(window.pageWidth - 200 - 120 - 70)+'px;'">
  5. <el-table
  6. :data="customerOrg.contactPersonList"
  7. border
  8. :height="Math.floor(customerOrg.orgDetailHeight/2)"
  9. size="small"
  10. highlight-current-row
  11. @row-click="rowClick"
  12. ref="customerOrg.contactPersonList"
  13. >
  14. <el-table-column prop="displayName" label="姓名" />
  15. <el-table-column prop="title" label="职务" />
  16. <el-table-column prop="remark" label="备注" />
  17. <el-table-column prop="creatorName" label="创建者" width="" />
  18. <el-table-column prop="creationTime" label="创建时间" width="200">
  19. <template slot-scope="scope">
  20. {{ scope.row.creationTime | dateFormat }}
  21. </template>
  22. </el-table-column>
  23. <el-table-column prop="lastModifierName" label="修改者" />
  24. <el-table-column
  25. prop="lastModificationTime"
  26. label="修改时间"
  27. width="200"
  28. >
  29. <template slot-scope="scope">
  30. {{ scope.row.lastModificationTime | dateFormat }}
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. <el-table
  35. :data="customerOrg.contactMethodList"
  36. border
  37. :height="Math.floor(customerOrg.orgDetailHeight/2)"
  38. size="small"
  39. highlight-current-row
  40. @row-click="rowClickMethod"
  41. ref="customerOrg.contactMethodList"
  42. >
  43. <el-table-column prop="contactMethodType" label="类型">
  44. <template slot-scope="scope">
  45. <div>
  46. {{ scope.row.contactMethodType === "0" ? "手机" : "邮箱" }}
  47. </div>
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="contactMethodValue" label="联系方式" />
  51. <el-table-column prop="creatorName" label="创建者" width="" />
  52. <el-table-column prop="creationTime" label="创建时间" width="200">
  53. <template slot-scope="scope">
  54. {{ scope.row.creationTime | dateFormat }}
  55. </template>
  56. </el-table-column>
  57. <el-table-column prop="lastModifierName" label="修改者" />
  58. <el-table-column
  59. prop="lastModificationTime"
  60. label="修改时间"
  61. width="200"
  62. >
  63. <template slot-scope="scope">
  64. {{ scope.row.lastModificationTime | dateFormat }}
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </div>
  69. <div style="margin-left: 10px; margin-top: 40px">
  70. <div style="margin-top: 10px">
  71. <el-button type="primary" @click="add" class="btnClass">新增</el-button>
  72. </div>
  73. <div style="margin-top: 10px">
  74. <el-button type="success" @click="edit" class="btnClass">编辑</el-button>
  75. </div>
  76. <div style="margin-top: 10px">
  77. <el-button type="danger" @click="del" class="btnClass">删除</el-button>
  78. </div>
  79. </div>
  80. </div>
  81. <!-- 联系人 -->
  82. <el-dialog :title="formTitle" :visible.sync="dialogContactPerson" width="800px">
  83. <el-form :model="form" ref="form" label-width="100px" :rules="rules">
  84. <el-row>
  85. <el-col :span="12">
  86. <el-form-item prop="displayName" label="联系人">
  87. <el-input v-model="form.displayName" size="small" ></el-input>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="12">
  91. <el-form-item label="职务">
  92. <el-input v-model="form.title" size="small" ></el-input>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="24">
  96. <el-form-item label="备注">
  97. <el-input type="textarea" v-model="form.remark" size="small" maxlength="50" show-word-limit></el-input>
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. <el-row>
  102. <el-col :span="5">
  103. <el-form-item label="创建者">
  104. <el-input v-model="form.creatorName" disabled size="small" ></el-input>
  105. </el-form-item>
  106. </el-col>
  107. <el-col :span="7">
  108. <el-form-item label="创建时间" style="margin-left: -5%">
  109. <el-input
  110. :value="form.creationTime | dateFormat"
  111. disabled
  112. style="width: 90%"
  113. size="small" ></el-input>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="5">
  117. <el-form-item label="修改者" style="margin-left: -25%">
  118. <el-input v-model="form.creatorName" disabled size="small" ></el-input>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="7">
  122. <el-form-item label="修改时间" style="margin-left: -5%">
  123. <el-input
  124. :value="form.lastModificationTime | dateFormat"
  125. disabled
  126. style="width: 90%"
  127. size="small" ></el-input>
  128. </el-form-item>
  129. </el-col>
  130. </el-row>
  131. <el-divider />
  132. <el-table
  133. :data="customerOrg.contactMethodList"
  134. border
  135. height="300"
  136. row-key="id"
  137. size="small"
  138. highlight-current-row
  139. ref="contactMethod"
  140. >
  141. <el-table-column prop="contactMethodType" label="类型">
  142. <template slot-scope="scope">
  143. <el-select v-model="scope.row.contactMethodType" size="small" >
  144. <el-option v-for="item in Methodtypes" :key="item.value" :label="item.label" :value="item.value" />
  145. </el-select>
  146. </template>
  147. </el-table-column>
  148. <el-table-column prop="contactMethodValue" label="联系方式">
  149. <template slot-scope="scope">
  150. <el-input v-model="scope.row.contactMethodValue" required size="small" />
  151. </template>
  152. </el-table-column>
  153. <el-table-column fixed="right" label="操作" width="60">
  154. <template slot-scope="scope">
  155. <i class="el-icon-delete" @click="deleteRow(scope.$index)" style="font-size: 24px;color: red;cursor:pointer;" ></i>
  156. </template>
  157. </el-table-column>
  158. </el-table>
  159. </el-form>
  160. <span slot="footer" class="dialog-footer">
  161. <el-button @click="dialogContactPerson = false"> </el-button>
  162. <el-button type="success" @click="addMethod">新增联系方式</el-button>
  163. <el-button type="primary" @click="submit('form')"> </el-button>
  164. </span>
  165. </el-dialog>
  166. </div>
  167. </template>
  168. <script>
  169. import { mapState } from "vuex";
  170. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  171. import { objCopy } from "../../utlis/proFunc";
  172. export default {
  173. components: {},
  174. data() {
  175. return {
  176. personId: "",
  177. form: {}, //联系人表单信息
  178. formTitle: "新增",
  179. dialogContactPerson: false, //联系人弹窗 显示控制
  180. Methodtypes: [
  181. //{ value: '',label: '所有订单状态' },
  182. { value: "0", label: "电话" },
  183. { value: "1", label: "邮箱" },
  184. ],
  185. rules: {
  186. displayName: [
  187. { required: true, message: "请输入名称", trigger: "blur" },
  188. ],
  189. },
  190. };
  191. },
  192. created() {},
  193. //挂载完成
  194. mounted() {},
  195. computed: {
  196. ...mapState(["window","customerOrg"]),
  197. },
  198. methods: {
  199. //获取联系人列表
  200. getContactPersonList(customerOrgId) {
  201. getapi(
  202. `/api/app/contact-person/in-customer-org-id/${customerOrgId}`
  203. ).then((res) => {
  204. //console.log('res.data',res.data)
  205. this.customerOrg.contactPersonList = res.data;
  206. });
  207. },
  208. //获取联系方式列表
  209. //api/app/contact-method/in-contact-person-id?ContactPersonId=3a0c08ad-4304-138b-d9e6-a7338739dfc4' \
  210. getContactMethodList(ContactPersonId) {
  211. getapi("/api/app/contact-method/in-contact-person-id", {
  212. ContactPersonId,
  213. }).then((res) => {
  214. //console.log('res.data',res.data)
  215. this.customerOrg.contactMethodList = res.data;
  216. });
  217. },
  218. //联系人 相关操作
  219. add() {
  220. //this.$message.success("新增 addContactPerson");
  221. if (!this.customerOrg.customerOrgId) {
  222. alert("没有体检单位信息");
  223. return;
  224. }
  225. this.form = { customerOrgId: this.customerOrg.customerOrgId };
  226. this.dialogContactPerson = true;
  227. this.formTitle = "新增";
  228. this.personId = "";
  229. this.customerOrg.contactMethodList = [];
  230. },
  231. edit() {
  232. //this.$message.success("编辑 editContactPerson");
  233. if (!this.customerOrg.customerOrgId) {
  234. alert("没有体检单位信息");
  235. return;
  236. } else if (!this.personId) {
  237. alert("请先选择要编辑的联系人");
  238. return;
  239. }
  240. this.dialogContactPerson = true;
  241. this.formTitle = "编辑";
  242. },
  243. //删除联系人行
  244. del() {
  245. //this.$message.success("删除 delContactPerson");
  246. if (!this.personId) {
  247. alert("请先选择要编辑的联系人");
  248. return;
  249. }
  250. deletapi(`/api/app/contact-person/${this.personId}`).then((res) => {
  251. this.personId = "";
  252. this.getContactPersonList(this.customerOrg.customerOrgId);
  253. this.customerOrg.contactMethodList = [];
  254. this.$message.success("操作成功!");
  255. });
  256. },
  257. //删除联系方式行
  258. deleteRow(index) {
  259. this.customerOrg.contactMethodList.splice(index, 1);
  260. },
  261. //联系人信息提交
  262. submit(formName) {
  263. let body = {
  264. customerOrgId: "",
  265. displayName: "",
  266. title: "",
  267. remark: "",
  268. };
  269. this.$refs[formName].validate((valid,failField) => {
  270. if (valid) {
  271. objCopy(this.form, body);
  272. console.log("body", body);
  273. if (this.formTitle === "新增") {
  274. postapi("/api/app/contact-person", body)
  275. .then((res) => {
  276. //console.log('api/app/contact-person')
  277. this.personId = res.data.id;
  278. this.formTitle = "编辑";
  279. return deletapi(`/api/app/contact-method/many/${this.personId}`);
  280. })
  281. .then((res) => {
  282. //console.log(`deletapi api/app/contact-method/${this.personId}`)
  283. let contactMethod = []; //联系方式form表单数据
  284. this.customerOrg.contactMethodList.forEach((item, index) => {
  285. contactMethod.push({
  286. contactMethodValue: item.contactMethodValue,
  287. contactMethodType: item.contactMethodType,
  288. contactPersonId: this.personId,
  289. });
  290. });
  291. return postapi("/api/app/contact-method/many", contactMethod);
  292. })
  293. .then((res) => {
  294. //console.log('api/app/contact-method/many')
  295. this.getContactPersonList(this.customerOrg.customerOrgId);
  296. this.$message.success("操作成功!");
  297. });
  298. } else {
  299. putapi(`/api/app/contact-person/${this.personId}`, body)
  300. .then((res) => {
  301. //console.log(`/api/app/contact-person/${this.personId}`)
  302. return deletapi(`/api/app/contact-method/many/${this.personId}`);
  303. })
  304. .then((res) => {
  305. console.log(`deletapi api/app/contact-method/${this.personId}`);
  306. let contactMethod = []; //联系方式form表单数据
  307. this.customerOrg.contactMethodList.forEach((item, index) => {
  308. contactMethod.push({
  309. contactMethodValue: item.contactMethodValue,
  310. contactMethodType: item.contactMethodType,
  311. contactPersonId: this.personId,
  312. });
  313. });
  314. return postapi("/api/app/contact-method/many", contactMethod);
  315. })
  316. .then((res) => {
  317. //console.log('api/app/contact-method/many')
  318. this.getContactPersonList(this.customerOrg.customerOrgId);
  319. this.$message.success("操作成功!");
  320. });
  321. }
  322. }else{
  323. //console.log('failField',failField)
  324. this.$message.warning("未通过数据校验!");
  325. return false;
  326. }
  327. })
  328. },
  329. //新增联系方式
  330. addMethod() {
  331. this.customerOrg.contactMethodList.push({
  332. contactMethodValue: "",
  333. contactMethodType: "0",
  334. contactPersonId: this.personId,
  335. });
  336. },
  337. rowClick(row) {
  338. console.log("row", row);
  339. // this.$message.success("rowClick");
  340. this.form = row;
  341. this.personId = row.id;
  342. this.getContactMethodList(row.id);
  343. },
  344. rowClickMethod(row) {
  345. this.$message.success("rowClickMethod");
  346. },
  347. },
  348. };
  349. </script>
  350. <style scoped>
  351. .btnClass{
  352. width:110px;
  353. }
  354. </style>