| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- let _Http = getApp().globalData.http,
- count = null;
- Page({
- data: {
- loading: false,
- showAll: false,
- repetitionShow: false,
- repetitionList: [],
- content: {
- sa_doctorid: 0
- },
- disabled: true,
- },
- onLoad(options) {
- let form = [{
- label: "是否科室负责人",
- error: false,
- errMsg: "",
- hint: "",
- type: "radio",
- value: "0",
- radioList: [{
- id: '1',
- name: '是'
- }, {
- id: '0',
- name: '否'
- }],
- valueName: "isleader", //绑定的字段名称
- required: true, //必填
- direction: "horizontal",
- interrupt: true
- }, {
- label: "医生名称",
- error: false,
- errMsg: "",
- type: "textarea",
- value: "",
- placeholder: "医生名称",
- valueName: "doctorname",
- checking: "base",
- required: true
- }, {
- label: "联系方式",
- error: false,
- errMsg: "",
- type: "number",
- value: "",
- placeholder: "联系方式",
- valueName: "phonenumber",
- required: true,
- checking: "phone"
- }, {
- label: "职称",
- error: false,
- errMsg: "",
- type: "option",
- optionNmae: "careertitle",
- optionType: "radio", //复选 radio 单选
- value: "",
- placeholder: "职称",
- valueName: "professional",
- checking: "base",
- required: true
- }, {
- label: "所属科室",
- error: false,
- errMsg: "",
- type: "route",
- url: "/prsx/select/department/index",
- value: "",
- placeholder: "所属科室",
- valueName: "sa_hospitaldepid",
- checking: "base",
- required: true,
- params: {
- "content": {
- "pageNumber": 1,
- "pageSize": 20,
- "where": {
- "condition": ""
- }
- },
- "id": 2025102208540702,
- },
- query: "&radio=true",
- required: true
- }, {
- label: "备注",
- error: false,
- errMsg: "",
- type: "textarea",
- value: "",
- placeholder: "备注",
- valueName: "remarks",
- checking: "base",
- required: false
- }]
- if (options.data) {
- let data = JSON.parse(options.data);
- data.isleader = data.isleader + '';
- data.sa_hospitaldepid = [data.hospitaldepname, [data.sa_hospitaldepid]]
- form = form.map(v => {
- v.value = data[v.valueName] || "";
- return v
- })
- this.setData({
- disabled: false,
- content: {
- sa_doctorid: data.sa_doctorid,
- },
- form
- })
- }
- if (options.department) {
- let department = JSON.parse(options.department);
- let item = form.find(v => v.valueName == 'sa_hospitaldepid')
- item.value = department;
- item.disabled = true;
- }
- this.setData({
- form
- })
- getApp().globalData.Language.getLanguagePackage(this, options.data ? '编辑医生' : '新建医生');
- },
- /* 表单必填项是否完成 */
- onConfirm({
- detail
- }) {
- this.setData({
- disabled: detail
- })
- },
- // 是否显示全部
- onChange({
- detail
- }) {
- this.setData({
- showAll: detail
- })
- },
- async submit() {
- this.setData({
- loading: true
- })
- let data = this.selectComponent("#Form").submit(),
- content = this.data.content
- data.sa_hospitaldepid = data.sa_hospitaldepid.length ? data.sa_hospitaldepid[1][0] : 0
- _Http.basic({
- "id": 2025102116461002,
- "content": {
- ...content,
- ...data,
- }
- }).then(res => {
- this.setData({
- loading: false
- })
- wx.showToast({
- title: res.code != '1' ? res.msg : '保存成功',
- icon: "none",
- mask: res.code == '1'
- })
- if (res.code != '1') return;
- getCurrentPages().forEach(v => {
- if (v.route == 'prsx/doctors/detail') v.getDetail()
- })
- setTimeout(() => {
- if (content.sa_doctorid == 0) {
- wx.redirectTo({
- url: '/prsx/doctors/detail?id=' + res.data.sa_doctorid,
- })
- } else {
- wx.navigateBack()
- }
- }, 300)
- })
- },
- })
|