|
|
@@ -1,109 +1,181 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
|
|
|
Component({
|
|
|
- properties: {
|
|
|
- disabled: {
|
|
|
- type: Boolean,
|
|
|
- value: true
|
|
|
- }
|
|
|
- },
|
|
|
- options: {
|
|
|
- addGlobalClass: true
|
|
|
- },
|
|
|
- data: {
|
|
|
- sa_agentsid: 0,
|
|
|
- content: {
|
|
|
- nocache: true,
|
|
|
- pageNumber: 1,
|
|
|
- pageSize: 10,
|
|
|
- pageTotal: 1,
|
|
|
- total: null,
|
|
|
- where: {
|
|
|
- condition: ""
|
|
|
- }
|
|
|
- },
|
|
|
- list: [],
|
|
|
- showSearch: false,
|
|
|
- focus: false,
|
|
|
+ properties: {
|
|
|
+ disabled: {
|
|
|
+ type: Boolean,
|
|
|
+ value: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ options: {
|
|
|
+ addGlobalClass: true
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ sa_agentsid: 0,
|
|
|
+ content: {
|
|
|
+ nocache: true,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ pageTotal: 1,
|
|
|
+ total: null,
|
|
|
+ where: {
|
|
|
condition: ""
|
|
|
+ }
|
|
|
},
|
|
|
- lifetimes: {
|
|
|
- attached: function () {
|
|
|
- getApp().globalData.Language.getLanguagePackage(this)
|
|
|
- }
|
|
|
+ list: [],
|
|
|
+ showSearch: false,
|
|
|
+ focus: false,
|
|
|
+ condition: "",
|
|
|
+ },
|
|
|
+ lifetimes: {
|
|
|
+ attached: function () {
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getList(id, init = false) {
|
|
|
+ let content = {
|
|
|
+ ...this.data.content,
|
|
|
+ sa_agentsid: id || this.data.sa_agentsid
|
|
|
+ };
|
|
|
+ if (init) {
|
|
|
+ content.pageNumber = 1
|
|
|
+ content.pageTotal = 1
|
|
|
+ }
|
|
|
+ _Http.basic({
|
|
|
+ "id": 2025111909582402,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("科室", res)
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ let list = res.data.map(v => {
|
|
|
+ v.totalstage = v.stages.length
|
|
|
+ v.stage = v.stages.findIndex(s => s.stagename == v.stagename) + 1
|
|
|
+ v.progress = v.stage / v.totalstage * 100;
|
|
|
+ return v
|
|
|
+ })
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ "content.pageNumber": res.pageNumber + 1,
|
|
|
+ "content.pageTotal": res.pageTotal,
|
|
|
+ "content.total": res.total,
|
|
|
+ list: res.pageNumber == 1 ? list : this.data.list.concat(list),
|
|
|
+ sa_agentsid: content.sa_agentsid
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
- methods: {
|
|
|
- getList(id, init = false) {
|
|
|
- let content = {
|
|
|
- ...this.data.content,
|
|
|
- sa_agentsid: id || this.data.sa_agentsid
|
|
|
- };
|
|
|
- if (init) {
|
|
|
- content.pageNumber = 1
|
|
|
- content.pageTotal = 1
|
|
|
- }
|
|
|
- _Http.basic({
|
|
|
- "id": 2025111909582402,
|
|
|
- content
|
|
|
+ insetr() {
|
|
|
+ let params = {
|
|
|
+ "id": 2025111914425902,
|
|
|
+ "content": {
|
|
|
+ "sa_agentsid": this.data.sa_agentsid,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/prsx/select/department/index?params=' + JSON.stringify(params),
|
|
|
+ })
|
|
|
+ let that = this;
|
|
|
+ getApp().globalData.handleSelect = function ({
|
|
|
+ result
|
|
|
+ }) {
|
|
|
+ wx.showModal({
|
|
|
+ content: `是否确定添加`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ console.log(result, '数据')
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "id": 2025111914313002,
|
|
|
+ "content": {
|
|
|
+ "sa_agentsid": that.data.sa_agentsid,
|
|
|
+ "sa_hospitaldepids": result
|
|
|
+ },
|
|
|
}).then(res => {
|
|
|
- console.log("科室", res)
|
|
|
- if (res.code != '1') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- let list = res.data.map(v => {
|
|
|
- v.totalstage = v.stages.length
|
|
|
- v.stage = v.stages.findIndex(s => s.stagename == v.stagename) + 1
|
|
|
- v.progress = v.stage / v.totalstage * 100;
|
|
|
- return v
|
|
|
- })
|
|
|
-
|
|
|
- this.setData({
|
|
|
- "content.pageNumber": res.pageNumber + 1,
|
|
|
- "content.pageTotal": res.pageTotal,
|
|
|
- "content.total": res.total,
|
|
|
- list: res.pageNumber == 1 ? list : this.data.list.concat(list),
|
|
|
- sa_agentsid: content.sa_agentsid
|
|
|
- })
|
|
|
+ console.log("添加科室", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.code == 1 ? '添加成功' : res.data,
|
|
|
+ icon: 'none',
|
|
|
+ mask: res.code == 1
|
|
|
+ })
|
|
|
+ if (res.code == 1) {
|
|
|
+ that.getList("", true)
|
|
|
+ getCurrentPages().find(v => v.__route__ == 'prsx/dealer/detail').getDetail()
|
|
|
+ wx.navigateBack()
|
|
|
+ }
|
|
|
})
|
|
|
- },
|
|
|
- insetr() {
|
|
|
- const page = getCurrentPages().find(v => v.__route__ == 'prsx/dealer/detail'),
|
|
|
- detail = page.data.detail;
|
|
|
- wx.navigateTo({
|
|
|
- url: `/prsx/department/insert?sa_customersid=${detail.sa_customersid}&name=${detail.name}`
|
|
|
- })
|
|
|
- },
|
|
|
- toSearch() {
|
|
|
- if (this.data.showSearch && this.data.content.where.condition) {
|
|
|
- this.data.content.where.condition = '';
|
|
|
- this.getList("", true);
|
|
|
- } else if (this.data.condition) {
|
|
|
- this.data.content.where.condition = this.data.condition;
|
|
|
- this.setData({
|
|
|
- condition: this.data.condition
|
|
|
- })
|
|
|
- this.getList("", true);
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- showSearch: !this.data.showSearch
|
|
|
- })
|
|
|
- setTimeout(() => {
|
|
|
- this.setData({
|
|
|
- focus: this.data.showSearch
|
|
|
- })
|
|
|
- }, 300)
|
|
|
- },
|
|
|
- onChange({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- this.data.condition = detail;
|
|
|
- },
|
|
|
- onSearch({
|
|
|
- detail
|
|
|
- }) {
|
|
|
- this.data.content.where.condition = detail;
|
|
|
- this.getList("", true)
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(result)
|
|
|
+ }.bind(this)
|
|
|
+ },
|
|
|
+ deleteItem(e) {
|
|
|
+ console.log(e)
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset,
|
|
|
+ that = this;
|
|
|
+
|
|
|
+ wx.showModal({
|
|
|
+ content: `是否确定删除“${item.hospitaldepname}”`,
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "id": 2025102713243702,
|
|
|
+ "content": {
|
|
|
+ sa_agents_hospitalid: item.sa_agents_hospitalid
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("删除科室", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.code == 1 ? '删除成功' : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.code == 1) that.getList("", true)
|
|
|
+ })
|
|
|
}
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toSearch() {
|
|
|
+ if (this.data.showSearch && this.data.content.where.condition) {
|
|
|
+ this.data.content.where.condition = '';
|
|
|
+ this.getList("", true);
|
|
|
+ } else if (this.data.condition) {
|
|
|
+ this.data.content.where.condition = this.data.condition;
|
|
|
+ this.setData({
|
|
|
+ condition: this.data.condition
|
|
|
+ })
|
|
|
+ this.getList("", true);
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ showSearch: !this.data.showSearch
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ this.setData({
|
|
|
+ focus: this.data.showSearch
|
|
|
+ })
|
|
|
+ }, 300)
|
|
|
+ },
|
|
|
+ onChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.data.condition = detail;
|
|
|
+ },
|
|
|
+ onSearch({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.data.content.where.condition = detail;
|
|
|
+ this.getList("", true)
|
|
|
}
|
|
|
+ }
|
|
|
})
|