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.

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