123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <template>
- <My_listbox ref="List" @getlist="getList">
- <view style="height: 10px;" />
- <user-list :list="list" @onClick="onClick" />
- </My_listbox>
- </template>
- <script>
- import userList from "../../components/userList"
- export default {
- components: { userList },
- data() {
- return {
- list: [],
- "content": {
- "sa_storeid": 0,
- "pageNumber": 1,
- "pageSize": 20
- }
- }
- },
- onLoad(options) {
- uni.setNavigationBarTitle({
- title: options.title || '添加门店成员',
- });
- this.content.sa_storeid = options.id;
- this.getList(true);
- },
- onUnload() {
- this.$Http.uploadUserList && this.$Http.uploadUserList()
- },
- methods: {
- getList(init = false) {
- if (this.paging(this.content, init)) return;
- this.$Http.basic({
- "id": "20240410142002",
- content: this.content
- }).then(res => {
- this.$refs.List.RefreshToComplete()
- console.log("获取可添加人员列表", res)
- if (this.cutoff(res.msg)) return;
- this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
- this.content = this.$refs.List.paging(this.content, res)
- })
- },
- onClick(item) {
- let that = this;
- uni.showModal({
- title: "提示",
- content: `是否确定添加“${item.name}”至门店人员中?`,
- success: ({ confirm }) => {
- if (confirm) that.$Http.basic({
- "id": "20240410153502",
- "content": {
- "sa_storeid": that.content.sa_storeid,
- "sys_enterprise_hrids": [item.sys_enterprise_hrid]
- }
- }).then(res => {
- console.log("添加成员", res)
- if (that.cutoff(res.msg, '添加成功!')) return;
- that.onInsert()
- })
- },
- })
- },
- onInsert() {
- if (this.content.pageNumber && this.content.pageNumber >= 2) {
- let content = this.paging(this.content, true, true)
- this.$Http.basic({
- "id": "20240410142002",
- content
- }).then(res => {
- console.log("更新人员列表", res)
- if (this.cutoff(res.msg)) return;
- this.list = res.data;
- this.$refs.List.paging(content, res, true)
- })
- }
- },
- },
- }
- </script>
- <style lang="scss"></style>
|