xy 2 years ago
parent 9690a77b77
commit bdaba001b0

@ -9,11 +9,12 @@ export function getList(params,isLoading=true){
})
}
export function getForm(id,params){
export function getForm(id,params,isLoading=true){
return request({
method:'get',
url:`/api/admin/nurse/get-form/${id}`,
params
params,
isLoading
})
}

@ -147,13 +147,14 @@
>录入</Button
>
<Button
v-if="scope.row.nurse_customer_links.length > 0"
size="small"
type="primary"
@click=""
@click="unBind(scope.row)"
>解绑</Button
>
<el-select
style="margin-top: 4px"
style="margin-top: 4px;width: 94px;"
size="mini"
v-model="scope.row.status"
placeholder="状态标识"
@ -198,6 +199,7 @@
</template>
<script>
import { getForm, save as saveWorker } from "@/api/worker";
import { getList, destroy, save } from "@/api/customer";
import { getparameter } from "@/api/system/dictionary";
import { getList as getUnit } from "@/api/payUnit";
@ -509,7 +511,19 @@ export default {
});
},
async unBind (row) {
const { nurse_customer_links } = row;
const nurseDatas = await Promise.all(nurse_customer_links.map(i => getForm(i.nurse_id,{},false)))
console.log(nurseDatas)
await Promise.all(nurseDatas.map(item => {
item.nurse_customer_links = item.nurse_customer_links.filter(i => i.customer_id !== row.id)
return saveWorker(item)
}))
await this.getCustomers()
}
},
created() {
this.getDisabilityLevel();

@ -18,14 +18,17 @@
</template>
<script>
import { getList } from "@/api/customer"
import { save } from "@/api/worker";
import { getList } from "@/api/customer";
import { deepCopy } from "@/utils";
export default {
data() {
return {
nurseId: "",
drawer: false,
value: [],
data: []
data: [],
row: {},
}
},
methods: {
@ -35,6 +38,10 @@ export default {
hide () {
this.drawer = false;
},
setRow (row) {
this.row = deepCopy(row)
this.value = this.row.nurse_customer_links.map(i => i.customer_id)
},
setNurseId (id) {
this.nurseId = id
},
@ -49,7 +56,14 @@ export default {
}))
},
submit () {
console.log(this.value)
this.row.nurse_customer_links = this.value.map(i => ({ customer_id: i }))
save(this.row).then(res => {
this.$message({
type: "success",
message: "保存成功"
})
this.$emit('refresh')
})
}
},
computed: {},

@ -27,13 +27,16 @@
</template>
<script>
import { getList } from "@/api/sku"
import { save } from "@/api/worker";
import { getList } from "@/api/sku";
import { deepCopy } from "@/utils";
export default {
data() {
return {
nurseId: "",
drawer: false,
skus: []
skus: [],
row: {}
}
},
methods: {
@ -46,6 +49,10 @@ export default {
setNurseId (id) {
this.nurseId = id
},
setRow (row) {
this.row = deepCopy(row)
console.log(this.row)
},
async getSkus () {
const res = (await getList({ page: 1,page_size: 9999 },false)).data;
let arr = [];
@ -57,10 +64,29 @@ export default {
this.skus = arr;
},
submit () {
console.log(this.$refs['elTree'].getCheckedNodes().filter(i => !i.hasOwnProperty("children")))
}
this.row.nurse_sku_links = this.$refs['elTree'].getCheckedNodes().filter(i => !i.hasOwnProperty("children")).map(i => ({ sku_id: i.id }))
save(this.row).then(res => {
this.$message({
type: "success",
message: "保存成功"
})
this.$emit('refresh')
})
},
},
computed: {},
watch: {
drawer (newVal) {
this.$nextTick(() => {
if (newVal) {
if (this.row.nurse_sku_links) {
this.row.nurse_sku_links.map(i => i.sku_id)
this.$refs['elTree'].setCheckedKeys(this.row.nurse_sku_links.map(i => i.sku_id))
}
}
})
}
},
created() {
this.getSkus()
}

@ -57,13 +57,13 @@
<Button
size="small"
type="primary"
@click="$refs['peopleBind'].setNurseId(scope.row.id),$refs['peopleBind'].show();"
@click="$refs['peopleBind'].setRow(scope.row),$refs['peopleBind'].show();"
style="margin-right: 6px"
>人员结对</Button>
<Button
size="small"
type="primary"
@click="$refs['skuBind'].setNurseId(scope.row.id),$refs['skuBind'].show();"
@click="$refs['skuBind'].setRow(scope.row),$refs['skuBind'].show();"
style="margin-right: 6px"
>项目绑定</Button>
</template>
@ -76,8 +76,8 @@
:product-type="productType"
:serve-area="serveArea"
@refresh="getWorkers"></add-worker>
<peopleBind ref="peopleBind"></peopleBind>
<skuBind ref="skuBind"></skuBind>
<peopleBind ref="peopleBind" @refresh="getWorkers"></peopleBind>
<skuBind ref="skuBind" @refresh="getWorkers"></skuBind>
</div>
</template>

Loading…
Cancel
Save