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({ return request({
method:'get', method:'get',
url:`/api/admin/nurse/get-form/${id}`, url:`/api/admin/nurse/get-form/${id}`,
params params,
isLoading
}) })
} }

@ -147,13 +147,14 @@
>录入</Button >录入</Button
> >
<Button <Button
v-if="scope.row.nurse_customer_links.length > 0"
size="small" size="small"
type="primary" type="primary"
@click="" @click="unBind(scope.row)"
>解绑</Button >解绑</Button
> >
<el-select <el-select
style="margin-top: 4px" style="margin-top: 4px;width: 94px;"
size="mini" size="mini"
v-model="scope.row.status" v-model="scope.row.status"
placeholder="状态标识" placeholder="状态标识"
@ -198,6 +199,7 @@
</template> </template>
<script> <script>
import { getForm, save as saveWorker } from "@/api/worker";
import { getList, destroy, save } from "@/api/customer"; import { getList, destroy, save } from "@/api/customer";
import { getparameter } from "@/api/system/dictionary"; import { getparameter } from "@/api/system/dictionary";
import { getList as getUnit } from "@/api/payUnit"; 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() { created() {
this.getDisabilityLevel(); this.getDisabilityLevel();

@ -18,14 +18,17 @@
</template> </template>
<script> <script>
import { getList } from "@/api/customer" import { save } from "@/api/worker";
import { getList } from "@/api/customer";
import { deepCopy } from "@/utils";
export default { export default {
data() { data() {
return { return {
nurseId: "", nurseId: "",
drawer: false, drawer: false,
value: [], value: [],
data: [] data: [],
row: {},
} }
}, },
methods: { methods: {
@ -35,6 +38,10 @@ export default {
hide () { hide () {
this.drawer = false; this.drawer = false;
}, },
setRow (row) {
this.row = deepCopy(row)
this.value = this.row.nurse_customer_links.map(i => i.customer_id)
},
setNurseId (id) { setNurseId (id) {
this.nurseId = id this.nurseId = id
}, },
@ -49,7 +56,14 @@ export default {
})) }))
}, },
submit () { 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: {}, computed: {},

@ -27,13 +27,16 @@
</template> </template>
<script> <script>
import { getList } from "@/api/sku" import { save } from "@/api/worker";
import { getList } from "@/api/sku";
import { deepCopy } from "@/utils";
export default { export default {
data() { data() {
return { return {
nurseId: "", nurseId: "",
drawer: false, drawer: false,
skus: [] skus: [],
row: {}
} }
}, },
methods: { methods: {
@ -46,6 +49,10 @@ export default {
setNurseId (id) { setNurseId (id) {
this.nurseId = id this.nurseId = id
}, },
setRow (row) {
this.row = deepCopy(row)
console.log(this.row)
},
async getSkus () { async getSkus () {
const res = (await getList({ page: 1,page_size: 9999 },false)).data; const res = (await getList({ page: 1,page_size: 9999 },false)).data;
let arr = []; let arr = [];
@ -57,10 +64,29 @@ export default {
this.skus = arr; this.skus = arr;
}, },
submit () { 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: {}, 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() { created() {
this.getSkus() this.getSkus()
} }

@ -57,13 +57,13 @@
<Button <Button
size="small" size="small"
type="primary" 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" style="margin-right: 6px"
>人员结对</Button> >人员结对</Button>
<Button <Button
size="small" size="small"
type="primary" 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" style="margin-right: 6px"
>项目绑定</Button> >项目绑定</Button>
</template> </template>
@ -76,8 +76,8 @@
:product-type="productType" :product-type="productType"
:serve-area="serveArea" :serve-area="serveArea"
@refresh="getWorkers"></add-worker> @refresh="getWorkers"></add-worker>
<peopleBind ref="peopleBind"></peopleBind> <peopleBind ref="peopleBind" @refresh="getWorkers"></peopleBind>
<skuBind ref="skuBind"></skuBind> <skuBind ref="skuBind" @refresh="getWorkers"></skuBind>
</div> </div>
</template> </template>

Loading…
Cancel
Save