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.

320 lines
11 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div style="display:flex">
  3. <div>
  4. <el-form ref="form" :model="customerOrg.customerOrgRd" label-width="110px" :rules="rules" size="medium">
  5. <el-row>
  6. <el-col :span="8">
  7. <el-form-item label="单位名称" prop="displayName">
  8. <el-input v-model="customerOrg.customerOrgRd.displayName"></el-input>
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="8">
  12. <el-form-item label="简称" prop="shortName">
  13. <el-input v-model="customerOrg.customerOrgRd.shortName"></el-input>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="8">
  17. <el-form-item label="发票抬头" prop="invoiceName">
  18. <el-input v-model="customerOrg.customerOrgRd.invoiceName"></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="8">
  22. <el-form-item label="上级单位" prop="parentId">
  23. <el-cascader v-model="customerOrg.customerOrgRd.parentId" :options="customerOrg.customerOrgTree" :props="{ checkStrictly: true ,expandTrigger: 'hover',...customerOrg.treeprops}"
  24. :show-all-levels="false" clearable filterable>
  25. </el-cascader>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="8">
  29. <el-form-item label="联系电话" prop="telephone">
  30. <el-input v-model="customerOrg.customerOrgRd.telephone"></el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="8">
  34. <el-form-item label="传真" prop="fax">
  35. <el-input v-model="customerOrg.customerOrgRd.fax"></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="8">
  39. <el-form-item label="邮政编码" prop="postalCode">
  40. <el-input v-model="customerOrg.customerOrgRd.postalCode"></el-input>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="8">
  44. <el-form-item label="地址" prop="address">
  45. <el-input v-model="customerOrg.customerOrgRd.address"></el-input>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="8">
  49. <el-form-item label="开户银行" prop="bank">
  50. <el-input v-model="customerOrg.customerOrgRd.bank"></el-input>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="8">
  54. <el-form-item label="银行账号" prop="accounts">
  55. <el-input v-model="customerOrg.customerOrgRd.accounts"></el-input>
  56. </el-form-item>
  57. </el-col>
  58. <el-col :span="8">
  59. <el-form-item label="单位性质" prop="orgTypeId">
  60. <el-select v-model="customerOrg.customerOrgRd.orgTypeId" placeholder="请选择" filterable>
  61. <el-option v-for="item in data.customerOrgType" :key="item.id" :label="item.displayName" :value="item.id">
  62. </el-option>
  63. </el-select>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="8">
  67. <el-form-item label="单位简码" prop="simpleCode">
  68. <el-input v-model="customerOrg.customerOrgRd.simpleCode" placeholder="由系统自动生成" disabled></el-input>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="8">
  72. <el-form-item label="体检中心" prop="organizationUnitId">
  73. <el-select v-model="customerOrg.customerOrgRd.organizationUnitId" placeholder="请选择" filterable>
  74. <el-option v-for="item in data.organizationdata" :key="item.id" :label="item.displayName" :value="item.id">
  75. </el-option>
  76. </el-select>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span="8">
  80. <el-form-item label="备注" prop="remark">
  81. <el-input v-model="customerOrg.customerOrgRd.remark"></el-input>
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="8">
  85. <el-form-item label="加锁" prop="isLock">
  86. <el-radio v-model="customerOrg.customerOrgRd.isLock" label="Y"></el-radio>
  87. <el-radio v-model="customerOrg.customerOrgRd.isLock" label="N"></el-radio>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="8">
  91. <el-form-item label="状态" prop="isActive">
  92. <el-radio v-model="customerOrg.customerOrgRd.isActive" label="Y">启用</el-radio>
  93. <el-radio v-model="customerOrg.customerOrgRd.isActive" label="N">停用</el-radio>
  94. </el-form-item>
  95. </el-col>
  96. <el-col :span="8">
  97. <el-form-item label="显示顺序" prop="displayOrder">
  98. <el-input v-model="customerOrg.customerOrgRd.displayOrder"></el-input>
  99. </el-form-item>
  100. </el-col>
  101. </el-row>
  102. <!-- -->
  103. <el-divider/>
  104. <el-row>
  105. <el-col :span="5">
  106. <el-form-item label="创建者">
  107. <el-input v-model="customerOrg.customerOrgRd.creatorName" disabled></el-input>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="7">
  111. <el-form-item label="创建时间" style="margin-left: -5%">
  112. <el-input :value="customerOrg.customerOrgRd.creationTime | dateFormat" disabled style="width: 90%"></el-input>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="5">
  116. <el-form-item label="修改者" style="margin-left: -25%">
  117. <el-input v-model="customerOrg.customerOrgRd.creatorName" disabled></el-input>
  118. </el-form-item>
  119. </el-col>
  120. <el-col :span="7">
  121. <el-form-item label="修改时间" style="margin-left: -5%">
  122. <el-input :value="customerOrg.customerOrgRd.lastModificationTime | dateFormat" disabled style="width: 90%"></el-input>
  123. </el-form-item>
  124. </el-col>
  125. </el-row>
  126. </el-form>
  127. </div>
  128. <!-- 按钮区域 -->
  129. <div style="margin-left: 10px; margin-top: 5%" width="150px">
  130. <el-button type="primary" @click="add">新增</el-button>
  131. <el-button type="primary" @click="Onsubmit('form')" style="margin-left: 0; margin-top: 10px">保存</el-button>
  132. <div style="margin-top: 10px">
  133. <el-button type="danger" @click="del">删除</el-button>
  134. </div>
  135. </div>
  136. </div>
  137. </template>
  138. <script>
  139. import { mapState,mapMutations } from 'vuex'
  140. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  141. import { tcdate,objCopy } from '../../utlis/proFunc'
  142. export default {
  143. components: {
  144. },
  145. data() {
  146. return {
  147. data: {
  148. organizationdata: [], //体检中心数据
  149. customerOrgType:[], //单位类别
  150. },
  151. pojo:{
  152. displayName: "string",
  153. shortName: "string",
  154. invoiceName: "string",
  155. parentId: null,
  156. telephone: "string",
  157. fax: "string",
  158. postalCode: "string",
  159. address: "string",
  160. bank: "string",
  161. accounts: "string",
  162. orgTypeId: null,
  163. remark: "string",
  164. isLock: "N",
  165. isActive: "Y",
  166. organizationUnitId: null
  167. }, //单位 记录 目前新增与更新是一致
  168. rules: {
  169. displayName: [
  170. { required: true, message: "请输入名称", trigger: "blur" },
  171. ],
  172. shortName: [
  173. { required: true, message: "请输入简写", trigger: "blur" },
  174. ],
  175. orgTypeId:[
  176. { required: true, message: "请输入单位性质"},
  177. ],
  178. organizationUnitId: [
  179. { required: true, message: "请输入体检中心", trigger: "blur" },
  180. ],
  181. displayOrder: [
  182. { required: true, message: "请输入显示顺序", trigger: "blur" },
  183. ],
  184. },
  185. isshow: false,
  186. };
  187. },
  188. created() {
  189. },
  190. //挂载完成
  191. mounted() {
  192. //获取体中心字典数据
  193. this.getoraniztion();
  194. //获取单位类别列表
  195. this.getOrgType()
  196. },
  197. computed:{
  198. ...mapState(['customerOrg']),
  199. },
  200. methods: {
  201. ...mapMutations(['setData']),
  202. //获取组织体检中心数据
  203. getoraniztion() {
  204. getapi("/api/app/organization-units/organization-unit-by-is-peis").then(
  205. (res) => {
  206. this.data.organizationdata = res.data;
  207. }
  208. );
  209. },
  210. //获取单位类别列表
  211. getOrgType() {
  212. getapi("/api/app/customer-org-type/in-filter").then((res) => {
  213. this.data.customerOrgType = res.data.items;
  214. });
  215. },
  216. //更新获取单位树节点数据
  217. getCustomerOrgTree(){
  218. getapi("/api/app/customer-org/by-code-all").then(
  219. (res) => {
  220. //customerOrgTree = res.data;
  221. console.log('res.data',res.data)
  222. this.setData({ key: 'customerOrg.customerOrgTree', value: res.data})
  223. tcdate(this.customerOrg.customerOrgTree)
  224. }
  225. );
  226. },
  227. //提交
  228. Onsubmit(formName) {
  229. console.log('vuex data',this.customerOrg.customerOrgRd)
  230. this.$refs[formName].validate((valid) => {
  231. if (valid) {
  232. //赋值
  233. objCopy(this.customerOrg.customerOrgRd,this.pojo)
  234. if(typeof this.pojo.parentId === "string"){
  235. if(!this.pojo.parentId || this.pojo.parentId.length < 1){
  236. this.pojo.parentId = null
  237. }
  238. }else{
  239. if(this.pojo.parentId && this.pojo.parentId.length > 0){
  240. this.pojo.parentId = this.pojo.parentId[this.pojo.parentId.length - 1]
  241. }else{
  242. this.pojo.parentId = null
  243. }
  244. }
  245. console.log('pojo',this.pojo,'this.customerOrg.customerOrgRd',this.customerOrg.customerOrgRd)
  246. if(this.customerOrg.customerOrgRd.id.length < 1){
  247. //id为空则新增
  248. postapi(`/api/app/customer-org`, this.pojo).then(
  249. (res) => {
  250. if(res.code == 1){
  251. this.$message.success("创健 操作成功");
  252. this.setData({ key: 'customerOrg.customerOrgRd', value: res})
  253. this.customerOrg.customerOrgId = res.id
  254. this.customerOrg.customerOrgRd = res
  255. this.getCustomerOrgTree()
  256. }
  257. }
  258. );
  259. }else{
  260. //id不为空则编辑
  261. putapi(`/api/app/customer-org/${this.customerOrg.customerOrgRd.id}`, this.pojo).then(
  262. (res) => {
  263. if(res.code == 1){
  264. this.$message.success("更新 操作成功");
  265. this.getCustomerOrgTree()
  266. }
  267. }
  268. );
  269. }
  270. } else {
  271. alert('未通过数据校验');
  272. return false;
  273. }
  274. });
  275. },
  276. //新增弹框
  277. add() {
  278. this.customerOrg.customerOrgId = ''
  279. this.customerOrg.customerOrgRd = {id:'',isLock: 'N',
  280. isActive: 'Y'}
  281. },
  282. //删除
  283. del(){
  284. deletapi(`/api/app/customer-org/${this.customerOrg.customerOrgRd.id}`).then(
  285. (res) => {
  286. this.$message.success("删除 操作成功");
  287. this.setData({ key: 'customerOrg.customerOrgRd', value:{id:''}})
  288. this.getCustomerOrgTree()
  289. }
  290. );
  291. }
  292. },
  293. };
  294. </script>
  295. <style scoped>
  296. </style>