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.

635 lines
23 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
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 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
3 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
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 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
3 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
3 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
3 years ago
2 years ago
2 years ago
2 years ago
3 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
3 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 style="display: flex">
  3. <div :style="'margin-left: 5px;width:' + (window.pageWidth - 200 - 110 - 20) + 'px;'">
  4. <!--overflow-y: scroll;height:200px;-->
  5. <el-form ref="form" :model="form" label-width="85px" :rules="rules" size="medium">
  6. <el-row>
  7. <el-col :span="8">
  8. <el-form-item label="上级单位" prop="parentId">
  9. <el-cascader v-model="form.parentId" :options="customerOrg.customerOrgTree"
  10. :props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }"
  11. :show-all-levels="false" clearable filterable disabled
  12. :style="'width:' + Math.floor((window.pageWidth - 585) / 3) + 'px;'">
  13. </el-cascader>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="8">
  17. <el-form-item label="单位名称" prop="displayName">
  18. <el-input class="enterToTab" v-model="form.displayName" placeholder="请输入单位名称"
  19. :disabled="customerOrg.oprStatus ? false : true" />
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="8">
  23. <el-form-item label="简称/别名" prop="shortName">
  24. <el-input class="enterToTab" v-model="form.shortName" placeholder="请输入单位简称/别名"
  25. :disabled="customerOrg.oprStatus ? false : true" />
  26. </el-form-item>
  27. </el-col>
  28. </el-row>
  29. <el-row>
  30. <el-col :span="8">
  31. <el-form-item label="体检中心" prop="medicalCenterId">
  32. <el-select v-model="form.medicalCenterId" placeholder="请选择" filterable :disabled="peisid ? true : false"
  33. :style="'width:' + Math.floor((window.pageWidth - 585) / 3) + 'px;'">
  34. <el-option v-for="item in data.organizationdata" :key="item.id" :label="item.displayName"
  35. :value="item.id" />
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="8">
  40. <el-form-item label="单位性质" prop="orgTypeId">
  41. <el-select class="enterToTab" v-model="form.orgTypeId" placeholder="请选择" filterable
  42. :style="'width:' + Math.floor((window.pageWidth - 585) / 3) + 'px;'">
  43. <el-option v-for="item in data.customerOrgType" :key="item.id" :label="item.displayName"
  44. :value="item.id" />
  45. </el-select>
  46. </el-form-item>
  47. </el-col>
  48. <!--
  49. <el-form-item label="显示顺序" prop="displayOrder">
  50. <el-input type="number" v-model="form.displayOrder" />
  51. </el-form-item>
  52. -->
  53. <!--
  54. <el-form-item label="单位简码" prop="simpleCode">
  55. <el-input v-model="form.simpleCode" placeholder="由系统自动生成" disabled />
  56. </el-form-item>
  57. -->
  58. <el-col :span="8">
  59. <el-form-item label="联系电话" prop="telephone">
  60. <el-input class="enterToTab" v-model="form.telephone" placeholder="请输入联系电话" />
  61. </el-form-item>
  62. </el-col>
  63. </el-row>
  64. <el-row>
  65. <el-col :span="8">
  66. <el-form-item label="传真" prop="fax">
  67. <el-input class="enterToTab" v-model="form.fax" placeholder="请输入传真" />
  68. </el-form-item>
  69. </el-col>
  70. <el-col :span="8">
  71. <el-form-item label="邮政编码" prop="postalCode">
  72. <el-input class="enterToTab" v-model="form.postalCode" placeholder="请输入邮政编码" />
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="4">
  76. <el-form-item label="加锁" prop="isLock" label-width="56px">
  77. <!--
  78. <el-radio v-model="form.isLock" label="Y" ></el-radio>
  79. <el-radio v-model="form.isLock" label="N" ></el-radio>
  80. -->
  81. <el-checkbox v-model="form.isLockBox" @change="changeBox" />
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="4">
  85. <el-form-item label="启用" prop="isActive" label-width="56px">
  86. <!--
  87. <el-radio v-model="form.isActive" label="Y">启用</el-radio>
  88. <el-radio v-model="form.isActive" label="N">停用</el-radio>
  89. -->
  90. <el-checkbox v-model="form.isActiveBox" @change="changeBox('isActive')" />
  91. </el-form-item>
  92. </el-col>
  93. </el-row>
  94. <el-row>
  95. <el-col :span="8">
  96. <el-form-item label="发票抬头" prop="invoiceName">
  97. <el-input class="enterToTab" v-model="form.invoiceName" placeholder="请输入发票抬头" />
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="8">
  101. <el-form-item label="开户银行" prop="bank">
  102. <el-input class="enterToTab" v-model="form.bank" placeholder="请输入开户银行" />
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="8">
  106. <el-form-item label="银行账号" prop="accounts">
  107. <el-input class="enterToTab" v-model="form.accounts" placeholder="请输入银行账号" />
  108. </el-form-item>
  109. </el-col>
  110. </el-row>
  111. <el-row>
  112. <el-col :span="8">
  113. <el-form-item label="地址" prop="address">
  114. <el-input class="enterToTab" v-model="form.address" placeholder="请输入地址" maxlength="50" show-word-limit />
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="8">
  118. <el-form-item label="税号" prop="countryOrgCode">
  119. <el-input v-model="form.countryOrgCode" />
  120. </el-form-item>
  121. </el-col>
  122. <el-col :span="8">
  123. <el-form-item label="备注" prop="remark">
  124. <el-input class="enterToTab" v-model="form.remark" maxlength="100" show-word-limit />
  125. </el-form-item>
  126. </el-col>
  127. </el-row>
  128. <el-row>
  129. <el-col :span="8">
  130. <el-form-item label="编号" prop="id">
  131. <el-input v-model="form.id" disabled />
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="8">
  135. <el-form-item label="介绍人" prop="salesPerson">
  136. <el-input v-model="form.salesPerson" />
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="8">
  140. <el-form-item label="介绍人电话" prop="salesPersonPhone">
  141. <el-input v-model="form.salesPersonPhone" />
  142. </el-form-item>
  143. </el-col>
  144. </el-row>
  145. <el-row>
  146. <el-col :span="5">
  147. <el-form-item label="创建人员">
  148. <el-input v-model="form.creatorName" size="small" disabled />
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="7">
  152. <el-form-item label="创建时间">
  153. <el-date-picker v-model="form.creationTime" type="datetime" size="small" style="width: 100%" disabled />
  154. </el-form-item>
  155. </el-col>
  156. <el-col :span="5">
  157. <el-form-item label="修改人员">
  158. <el-input v-model="form.lastModifierName" size="small" disabled />
  159. </el-form-item>
  160. </el-col>
  161. <el-col :span="7">
  162. <el-form-item label="修改时间">
  163. <el-date-picker v-model="form.lastModificationTime" type="datetime" size="small" style="width: 100%"
  164. disabled />
  165. </el-form-item>
  166. </el-col>
  167. </el-row>
  168. </el-form>
  169. </div>
  170. <!-- 按钮区域 -->
  171. <div style="width: 110px; margin-left: 10px; margin-top: 3%">
  172. <div v-show="checkPagePriv(pagePriv.privs, '新增单位')" class="btnList">
  173. <el-button type="primary" @click="btnAdd('form', '')" class="commonbutton">新增单位</el-button>
  174. </div>
  175. <div v-show="checkPagePriv(pagePriv.privs, '新增子单位')" class="btnList">
  176. <el-button type="primary" @click="btnAdd('form', 'child')" class="commonbutton">新增子单位</el-button>
  177. </div>
  178. <div v-show="checkPagePriv(pagePriv.privs, '保存')" class="btnList">
  179. <el-button type="success" @click="btnSubmit('form')" class="commonbutton"><i
  180. class="el-icon-check"></i>保存</el-button>
  181. </div>
  182. <div v-show="checkPagePriv(pagePriv.privs, '删除')" class="btnList">
  183. <el-button type="danger" @click="btnDel('form')" class="deleteButton">
  184. <i class="el-icon-delete"></i>删除
  185. </el-button>
  186. </div>
  187. </div>
  188. </div>
  189. </template>
  190. <script>
  191. import { mapState, mapMutations } from "vuex";
  192. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  193. import { getPagePriv, checkPagePriv, tcdate, objCopy, deepCopy, arrayExistObj } from "../../utlis/proFunc";
  194. import { getTreeNode, getTreePids } from "../../utlis/tree";
  195. export default {
  196. components: {},
  197. props: ["id"],
  198. data() {
  199. return {
  200. pagePriv: {
  201. routeUrlorPageName: 'customerOrg', //当前页面归属路由或归属页面权限名称
  202. privs: [] // 页面权限
  203. },
  204. isActiveBox: false,
  205. customerOrgEditStyle: "height:400px;",
  206. data: {
  207. organizationdata: [], //体检中心数据
  208. customerOrgType: [], //单位类别
  209. },
  210. peisid: null,
  211. form: {
  212. id: "",
  213. displayName: "",
  214. shortName: "",
  215. invoiceName: "",
  216. parentId: null,
  217. telephone: "",
  218. fax: "",
  219. postalCode: "",
  220. address: "",
  221. bank: "",
  222. countryOrgCode: "",
  223. accounts: "",
  224. orgTypeId: null,
  225. remark: "",
  226. isLock: "N",
  227. isActive: "Y",
  228. isLockBox: false,
  229. isActiveBox: true,
  230. medicalCenterId: null,
  231. creatorName: "",
  232. creationTime: null,
  233. lastModifierName: "",
  234. lastModificationTime: null,
  235. salesPerson:"",
  236. salesPersonPhone:""
  237. }, //初始化 单位 记录 目前新增与更新是一致
  238. formInit: {},
  239. rules: {
  240. displayName: [{ required: true, message: "请输入单位名称", trigger: "blur" }],
  241. shortName: [{ required: true, message: "请输入单位简写", trigger: "blur" }],
  242. orgTypeId: [{ required: true, message: "请输入单位性质", trigger: "blur" }],
  243. medicalCenterId: [
  244. { required: true, message: "请输入体检中心", trigger: "blur" },
  245. ],
  246. },
  247. isshow: false,
  248. };
  249. },
  250. created() {
  251. //获取用户当前页面的权限
  252. let userPriv = window.sessionStorage.getItem('userPriv')
  253. if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))
  254. this.peisid = window.sessionStorage.getItem("peisid");
  255. if (!this.form.id) {
  256. this.form.medicalCenterId = this.peisid;
  257. }
  258. this.formInit = deepCopy(this.form)
  259. },
  260. //挂载完成
  261. mounted() {
  262. // 表单中 回车 代替 tab
  263. this.enterToTab();
  264. // 初始化 字典数据
  265. this.dictInit()
  266. this.getCustomerOrgRd(this.dataTransOpts.tableS.customer_org.id);
  267. },
  268. computed: {
  269. ...mapState(["customerOrg", "window", "dataTransOpts"]),
  270. },
  271. methods: {
  272. ...mapMutations(["setData"]), checkPagePriv,
  273. changeBox(type) {
  274. //赋值
  275. if (this.form[type + "Box"]) {
  276. this.form[type] = "Y";
  277. } else {
  278. this.form[type] = "N";
  279. }
  280. },
  281. //获取单位信息
  282. getCustomerOrgRd(id) {
  283. if (!id) {
  284. this.form = deepCopy(this.formInit)
  285. return;
  286. }
  287. getapi(`/api/app/customer-org/${id}`).then((res) => {
  288. if (res.code != -1) {
  289. this.dataTransOpts.tableS.customer_org.id = res.data.id
  290. objCopy(res.data, this.form);
  291. if (res.data.isActive == "Y") {
  292. this.form.isActiveBox = true;
  293. } else {
  294. this.form.isActiveBox = false;
  295. }
  296. if (res.data.isLock == "Y") {
  297. this.form.isLockBox = true;
  298. } else {
  299. this.form.isLockBox = false;
  300. }
  301. }
  302. });
  303. },
  304. // 初始化 字典数据
  305. dictInit() {
  306. //获取组织体检中心数据
  307. getapi("/api/app/organization-units/organization-unit-by-is-peis").then((res) => {
  308. this.data.organizationdata = res.data;
  309. });
  310. //获取单位类别列表
  311. getapi("/api/app/customer-org-type/get-all").then((res) => {
  312. this.data.customerOrgType = res.data;
  313. });
  314. },
  315. //更新获取单位树节点数据(局部刷新)
  316. getCustomerOrgTree(oprType, body) {
  317. // getapi("/api/app/customerorg/getbycodeall").then((res) => {
  318. // //customerOrgTree = res.data;
  319. // console.log("res.data", res.data);
  320. // this.setData({ key: "customerOrg.customerOrgTree", value: res.data });
  321. // tcdate(this.customerOrg.customerOrgTree);
  322. // });
  323. switch (oprType) {
  324. case "insert":
  325. let node = {
  326. id: body.id,
  327. displayName: body.displayName,
  328. label:(body.shortName ? body.shortName + '--':'') + body.displayName,
  329. parentId: body.parentId,
  330. };
  331. if (body.parentId) {
  332. let pNode = getTreeNode(this.customerOrg.customerOrgTree, "treeChildren", "id", body.parentId);
  333. if (!pNode.treeChildren) this.$set(pNode, 'treeChildren', []);
  334. //pNode.treeChildren = []
  335. pNode.treeChildren.push(node);
  336. } else {
  337. this.customerOrg.customerOrgTree.push(node);
  338. }
  339. this.customerOrg.defaultExpandedKeys = []
  340. if (body.parentId) {
  341. this.customerOrg.defaultExpandedKeys.push(body.parentId)
  342. }
  343. this.customerOrg.defaultExpandedKeys.push(body.id)
  344. this.customerOrg.treeCurrentNodekey = body.id;
  345. //console.log("this.customerOrg.treeCurrentNodekey",this.customerOrg.treeCurrentNodekey);
  346. break;
  347. // "id": "3a0c5101-a6a6-e48a-36ec-33e7567a99e6",
  348. // "displayName": "神豚集团",
  349. // "parentId": null,
  350. // "code": "00001",
  351. // "treeChildren": [
  352. case "update":
  353. let node2 = getTreeNode(
  354. this.customerOrg.customerOrgTree,
  355. "treeChildren",
  356. "id",
  357. body.id
  358. );
  359. node2.displayName = body.displayName;
  360. node2.label = (body.shortName ? body.shortName + '--':'') + body.displayName
  361. break;
  362. case "delete":
  363. let lfind = -1;
  364. let pids = getTreePids(
  365. this.customerOrg.customerOrgTree,
  366. "treeChildren",
  367. "parentId",
  368. "id",
  369. body
  370. );
  371. //tree, childNodeName, pidName, idName, idVal getTreeNode(this.customerOrg.customerOrgTree, "treeChildren", "id", body);
  372. console.log('pids', pids, body)
  373. if (!pids || pids.length < 2) {
  374. lfind = arrayExistObj(this.customerOrg.customerOrgTree, "id", body);
  375. if (lfind > -1) this.customerOrg.customerOrgTree.splice(lfind, 1);
  376. } else {
  377. let node3 = getTreeNode(
  378. this.customerOrg.customerOrgTree,
  379. "treeChildren",
  380. "id",
  381. pids[0]
  382. );
  383. //console.log('node3',node3)
  384. lfind = arrayExistObj(node3.treeChildren, "id", body);
  385. if (lfind > -1) node3.treeChildren.splice(lfind, 1);
  386. }
  387. break;
  388. default:
  389. break;
  390. }
  391. },
  392. onkeyup(e) {
  393. console.log('onkeyup e', e)
  394. },
  395. //提交
  396. btnSubmit(formName) {
  397. let body = {};
  398. console.log("vuex data", this.customerOrg.customerOrgRd);
  399. this.$refs[formName].validate((valid, fields) => {
  400. if (!valid) {
  401. this.$message.warning({ showClose: true, message: fields[Object.keys(fields)[0]][0].message });
  402. return false;
  403. }
  404. body = deepCopy(this.form);
  405. delete body.isActiveBox;
  406. delete body.isLockBox;
  407. delete body.creatorName;
  408. delete body.creationTime;
  409. delete body.lastModifierName;
  410. delete body.lastModificationTime;
  411. if (typeof body.parentId === "string") {
  412. if (!body.parentId || body.parentId.length < 1) {
  413. body.parentId = null;
  414. }
  415. } else {
  416. if (body.parentId && body.parentId.length > 0) {
  417. body.parentId = body.parentId[body.parentId.length - 1];
  418. } else {
  419. body.parentId = null;
  420. }
  421. }
  422. console.log("body", body, "this.form", this.form);
  423. if (!this.form.id) {
  424. //id为空则新增
  425. postapi(`/api/app/customerorg/create`, body).then(async (res) => {
  426. if (res.code == 1) {
  427. console.log("创健 操作成功");
  428. //this.setData({ key: "customerOrg.customerOrgRd", value: res });
  429. this.form = res.data
  430. this.dataTransOpts.tableS.customer_org = res.data
  431. // this.customerOrg.customerOrgId = res.data.id;
  432. this.customerOrg.customerOrgRd = res.data;
  433. this.getCustomerOrgTree("insert", res.data);
  434. this.customerOrg.oprStatus = 'edit'
  435. this.dataTransOpts.tableS.customer_org.parent_id = await this.getParentCustomerOrgId(res.data.id)
  436. this.dataTransOpts.refresh.customer_org.S++
  437. this.dataTransOpts.refresh.customer_org_register.M++
  438. this.dataTransOpts.refresh.contact_person.M++
  439. }
  440. });
  441. } else {
  442. //id不为空则编辑
  443. putapi(`/api/app/customer-org/${this.form.id}`, body).then(
  444. (res) => {
  445. if (res.code == 1) {
  446. console.log("更新 操作成功");
  447. let lbody = { ...deepCopy(body), id: this.form.id };
  448. this.getCustomerOrgTree("update", lbody);
  449. this.customerOrg.oprStatus = 'edit'
  450. this.dataTransOpts.refresh.customer_org.S++
  451. this.dataTransOpts.refresh.customer_org_register.M++
  452. this.dataTransOpts.refresh.contact_person.M++
  453. }
  454. }
  455. );
  456. }
  457. });
  458. },
  459. // 获取顶级单位ID
  460. async getParentCustomerOrgId(customerOrgId) {
  461. let customerOrgParentId = null
  462. if (!customerOrgId) return customerOrgParentId
  463. if (typeof customerOrgId == 'string') {
  464. try {
  465. let res = await getapi(`/api/app/customer-org/parent/${customerOrgId}`)
  466. if (res.code != -1) customerOrgParentId = res.data
  467. } catch (error) {
  468. console.log('获取顶级单位ID出错:', error)
  469. }
  470. } else if (customerOrgId.length > 0) {
  471. customerOrgParentId = customerOrgId[0]
  472. }
  473. return customerOrgParentId
  474. },
  475. //新增弹框
  476. async btnAdd(formName, child) {
  477. await this.$refs[formName].resetFields();
  478. //console.log('this.peisid',this.peisid)
  479. if (!this.peisid || this.peisid == 'null') {
  480. this.$message.warning({ showClose: true, message: "该用户未选归属体检中心,不能执行此操作!" });
  481. return
  482. }
  483. this.form = deepCopy(this.formInit)
  484. if (child) {
  485. if (!this.dataTransOpts.tableS.customer_org.id) {
  486. this.$message.warning({ showClose: true, message: "请先选择上级单位" });
  487. this.customerOrg.oprStatus = ''
  488. return;
  489. }
  490. this.form.parentId = this.dataTransOpts.tableS.customer_org.id
  491. } else {
  492. // 新增一级单位时,清除 vuex 一级单位ID
  493. this.dataTransOpts.tableS.customer_org.parent_id = ''
  494. }
  495. this.customerOrg.oprStatus = 'add'
  496. // this.customerOrg.customerOrgId = "";
  497. this.dataTransOpts.tableS.customer_org.id = ''
  498. setTimeout(() => {
  499. this.dataTransOpts.refresh.customer_org_register.M++
  500. this.dataTransOpts.refresh.contact_person.M++
  501. }, 20);
  502. },
  503. //删除
  504. btnDel(formName) {
  505. if (!this.dataTransOpts.tableS.customer_org.id) {
  506. this.$message.warning({ showClose: true, message: "请先选中要删除的节点" })
  507. return
  508. }
  509. //复制待删除的节点
  510. //let node = deepCopy(getTreeNode(this.customerOrg.customerOrgTree,"treeChildren","id",this.customerOrg.customerOrgRd.id));
  511. this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
  512. confirmButtonText: "是",
  513. cancelButtonText: "否",
  514. type: "warning",
  515. }).then(() => {
  516. //console.log('{patientRegisterIds}',{patientRegisterIds})
  517. return deletapi(`/api/app/customer-org/${this.dataTransOpts.tableS.customer_org.id}`);
  518. }).then((res) => {
  519. if (res.code != -1) {
  520. console.log("删除 操作成功");
  521. this.getCustomerOrgTree("delete", this.dataTransOpts.tableS.customer_org.id);
  522. this.customerOrg.customerOrgRegisterList = []
  523. this.customerOrg.contactPersonList = []
  524. this.customerOrg.contactMethodList = []
  525. this.setData({ key: "customerOrg.customerOrgRd", value: { id: "" } });
  526. this.$refs[formName].resetFields();
  527. this.customerOrg.oprStatus = ''
  528. // this.customerOrg.customerOrgId = ''
  529. this.dataTransOpts.tableS.customer_org.id = ''
  530. }
  531. }).catch((err) => {
  532. if (err == "cancel") {
  533. this.$message.info({ showClose: true, message: "已取消删除" });
  534. } else {
  535. this.$message.error({ showClose: true, message: "操作失败,原因:" + err });
  536. }
  537. });
  538. },
  539. //回车替代tab键
  540. enterToTab() {
  541. this.$nextTick(() => {
  542. let inputs = document.querySelectorAll("form input"); //用数组可以读取多个标签的元素 //.inline-input
  543. //console.log('inputs',inputs);
  544. // 为每个输入框添加键盘事件监听器
  545. inputs.forEach((input, i) => {
  546. input.addEventListener('keydown', (event) => {
  547. // 如果按下的是回车键
  548. // console.log('data-ismultiline',input.getAttribute('data-ismultiline'));
  549. if (event.keyCode === 13) {
  550. // 阻止回车键的默认行为(换行)
  551. event.preventDefault();
  552. // 跳至下一个输入框
  553. for (let j = i + 1; j < inputs.length; j++) {
  554. if (inputs[j].getAttribute('disabled') != "disabled") {
  555. inputs[j].focus();
  556. break;
  557. }
  558. }
  559. }
  560. });
  561. });
  562. });
  563. },
  564. },
  565. watch: {
  566. // 单位id未变时,强制刷新
  567. "dataTransOpts.refresh.customer_org.S": {
  568. // immediate: true,
  569. handler(newVal, oldVal) {
  570. console.log(`watch 体检单位 newVal:${newVal} oldVal:${oldVal} customerOrgId: ${this.dataTransOpts.tableS.customer_org.id}`);
  571. this.getCustomerOrgRd(this.dataTransOpts.tableS.customer_org.id);
  572. }
  573. },
  574. },
  575. };
  576. </script>
  577. <style scoped>
  578. @import "../../assets/css/global_form.css";
  579. @import "../../assets/css/global_button.css";
  580. .btnList {
  581. margin-bottom: 10px;
  582. }
  583. .btnClass {
  584. width: 110px;
  585. }
  586. </style>