Commit 74e9e55a authored by Mac's avatar Mac

1

parent 9d30a91a
...@@ -206,6 +206,31 @@ class customerService { ...@@ -206,6 +206,31 @@ class customerService {
data data
}) })
} }
// 保存客户阶段流程
static async setCustomerStageFlowInfo(data: {
Id:number,
FlowName:string,
DeptEmpList:Array<{Id:number,Name:string,Type:number}>,
UseStage:string,
LoseCause:string,
InvalidCause:string,
}): Promise<HttpResponse> {
return Axios('/QYCustomer/SetCustomerStageFlowInfo', {
method: 'post',
responseType: 'json',
data
})
}
// 获取客户阶段流程详情
static async getCustomerStageFlowInfo(data: {
FlowId:number,
}): Promise<HttpResponse> {
return Axios('/QYCustomer/GetCustomerStageFlowInfo', {
method: 'post',
responseType: 'json',
data
})
}
} }
export default customerService export default customerService
...@@ -57,12 +57,12 @@ ...@@ -57,12 +57,12 @@
<q-icon <q-icon
name="work" name="work"
color="primary" color="primary"
v-if="item.Id.slice(0, 1) == 1" v-if="item.Id.slice(0, 1) == '1'"
/> />
<q-icon <q-icon
name="person" name="person"
color="accent" color="accent"
v-if="item.Id.slice(0, 1) == 2" v-if="item.Id.slice(0, 1) == '2'"
/> />
<span class="q-ml-sm">{{ item.Name }}</span> <span class="q-ml-sm">{{ item.Name }}</span>
</div> </div>
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<q-card-actions align="right" class="bg-white text-teal"> <q-card-actions align="right" class="bg-white text-teal">
<q-btn flat label="取消" v-close-popup /> <q-btn flat label="取消" v-close-popup />
<q-btn color="primary" v-close-popup label="确定" /> <q-btn color="primary" @click="goback" label="确定" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
...@@ -88,7 +88,8 @@ interface parmas { ...@@ -88,7 +88,8 @@ interface parmas {
} }
interface SelectParams { interface SelectParams {
Id: string, Id: string,
Name: string Name: string,
Type:number
} }
export default { export default {
props: { props: {
...@@ -162,9 +163,11 @@ export default { ...@@ -162,9 +163,11 @@ export default {
if (e.slice(0, 1) == 1) { if (e.slice(0, 1) == 1) {
const node = tree.value.getNodeByKey(e) const node = tree.value.getNodeByKey(e)
if (node[props.childrenKey] && node[props.childrenKey].length > 0) { if (node[props.childrenKey] && node[props.childrenKey].length > 0) {
// eslint-disable-next-line vue/no-mutating-props
props.defaultArray.splice(i, 1) props.defaultArray.splice(i, 1)
findChild(node[props.childrenKey]) findChild(node[props.childrenKey])
} else { } else {
// eslint-disable-next-line vue/no-mutating-props
props.defaultArray.push(node.DataType + '-' + node.DeptId) props.defaultArray.push(node.DataType + '-' + node.DeptId)
} }
} }
...@@ -178,10 +181,12 @@ export default { ...@@ -178,10 +181,12 @@ export default {
if (e[props.childrenKey] && e[props.childrenKey].length > 0) { if (e[props.childrenKey] && e[props.childrenKey].length > 0) {
findChild(e[props.childrenKey]) findChild(e[props.childrenKey])
} else { } else {
// eslint-disable-next-line vue/no-mutating-props
props.defaultArray.push(e.DataType + '-' + e.DeptId) props.defaultArray.push(e.DataType + '-' + e.DeptId)
} }
}) })
} }
let showDialog = () => { let showDialog = () => {
initDefault() initDefault()
getselectArray(props.treeData) getselectArray(props.treeData)
...@@ -191,7 +196,7 @@ export default { ...@@ -191,7 +196,7 @@ export default {
let j = arr[i] let j = arr[i]
let flag = tree.value.isTicked(j[props.nodeKey]) let flag = tree.value.isTicked(j[props.nodeKey])
if (flag == true) { if (flag == true) {
selectArray.value.push({ Id: j[props.nodeKey], Name: j.DeptName }) selectArray.value.push({ Id: j[props.nodeKey], Name: j.DeptName ,Type: j.DataType})
} else { } else {
if (j[props.childrenKey] && j[props.childrenKey].length > 0) { if (j[props.childrenKey] && j[props.childrenKey].length > 0) {
getselectArray(j[props.childrenKey]) getselectArray(j[props.childrenKey])
...@@ -244,6 +249,10 @@ export default { ...@@ -244,6 +249,10 @@ export default {
watch(() => [...selectArray.value], (val) => { watch(() => [...selectArray.value], (val) => {
ctx.emit('select', [...val]) ctx.emit('select', [...val])
}, { deep: true }) }, { deep: true })
let goback =()=>{
ctx.emit('select_t', selectArray.value)
// eslint-disable-next-line vue/no-mutating-props
}
return { return {
myFilterMethod, myFilterMethod,
filter, filter,
...@@ -257,7 +266,8 @@ export default { ...@@ -257,7 +266,8 @@ export default {
selectArray, selectArray,
delItemArray, delItemArray,
delItemitem, delItemitem,
showDialog showDialog,
goback
} }
} }
......
...@@ -2,11 +2,28 @@ ...@@ -2,11 +2,28 @@
<div class="customerPhase page-body"> <div class="customerPhase page-body">
<div style="display: flex;align-items: center;justify-content: space-between;"> <div style="display: flex;align-items: center;justify-content: space-between;">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<q-btn v-if="state.data.length<20" color="accent" style="margin-bottom: 10px;" class="q-mr-md" label="创建阶段流程" @click="jumpPage('/editor/createStageRange')" size="sm"></q-btn> <q-btn
<span style="margin-left: 20px;color: rgb(133, 133, 152);">已添加:{{state.data.length}}/20</span> v-if="state.data.length < 20"
color="accent"
style="margin-bottom: 10px;"
class="q-mr-md"
label="创建阶段流程"
@click="jumpPage('/editor/createStageRange')"
size="sm"
></q-btn>
<span
style="margin-left: 20px;color: rgb(133, 133, 152);"
>已添加:{{ state.data.length }}/20</span>
</div> </div>
<q-btn color="white" text-color="black" style="margin-bottom: 10px;" class="q-mr-md" label="阶段管理" size="sm" <q-btn
@click="jumpPage('/editor/manageStageRange')"></q-btn> color="white"
text-color="black"
style="margin-bottom: 10px;"
class="q-mr-md"
label="阶段管理"
size="sm"
@click="jumpPage('/editor/manageStageRange')"
></q-btn>
</div> </div>
<table class="payTable"> <table class="payTable">
<thead> <thead>
...@@ -19,65 +36,102 @@ ...@@ -19,65 +36,102 @@
<th width="12%">操作</th> <th width="12%">操作</th>
</tr> </tr>
</thead> </thead>
<tr v-if="state.data.length==0"> <tr v-if="state.data.length == 0">
<td :colspan="6" align="center">暂无数据</td> <td :colspan="6" align="center">暂无数据</td>
</tr> </tr>
<tr v-for="(item,index) in state.data" :key="index"> <tr v-for="(item,index) in state.data" :key="index">
<td><span>{{item.FlowName}}</span></td>
<td> <td>
<div v-if='item.DeptEmpList && item.DeptEmpList.length>0' > <span>{{ item.FlowName }}</span>
<span v-for="(x,y) in item.DeptEmpList" :key='y'> </td>
<q-chip color="blue-1" text-color="blue" icon="folder" size="sm" v-if="x.Type==1"> <td>
{{x.Name}} <div v-if="item.DeptEmpList && item.DeptEmpList.length > 0">
</q-chip> <span v-for="(x,y) in item.DeptEmpList" :key="y">
<q-chip color="green-1" text-color="green" icon="person" size="sm" v-if="x.Type==2"> <q-chip
{{x.Name}} color="blue-1"
</q-chip> text-color="blue"
icon="folder"
size="sm"
v-if="x.Type == 1"
>{{ x.Name }}</q-chip>
<q-chip
color="green-1"
text-color="green"
icon="person"
size="sm"
v-if="x.Type == 2"
>{{ x.Name }}</q-chip>
</span> </span>
</div> </div>
<span v-else>未适配其他规则的阶段</span> <span v-else>未适配其他规则的阶段</span>
</td> </td>
<td> <td>
<q-toggle v-if="item.IsDefault==1" v-model="item.Enable" :true-value="1" :false-value="2" <q-toggle
icon="lock" disable /> v-if="item.IsDefault == 1"
<q-toggle v-else v-model="item.Enable" :true-value="1" :false-value="2" v-model="item.Enable"
@update:model-value="setFiledState(item.Id,1)" /> :true-value="1"
:false-value="2"
icon="lock"
disable
/>
<q-toggle
v-else
v-model="item.Enable"
:true-value="1"
:false-value="2"
@update:model-value="setFiledState(item.Id, 1)"
/>
</td> </td>
<td> <td>
<span v-for="(x,y) in item.StageList" :key='y'> <span
{{x}}{{item.StageList.length!=y+1?'->':''}} v-for="(x,y) in item.StageList"
</span> :key="y"
>{{ x }}{{ item.StageList.length != y + 1 ? '->' : '' }}</span>
</td> </td>
<td> <td>
<div>{{item.UpdateByName}}</div> <div>{{ item.UpdateByName }}</div>
<div>{{item.UpdateTime}}</div> <div>{{ item.UpdateTime }}</div>
</td> </td>
<td> <td>
<q-btn v-if='item.IsDefault!=1' flat size="xs" icon="edit" style="font-weight:400;color: #3FC4FF" class="q-mr-xs" <q-btn
label="编辑" @click="goedit(item)" /> v-if="item.IsDefault != 1"
<q-btn v-if='item.IsDefault!=1' flat size="xs" icon="delete" color="negative" class="q-mr-xs" flat
label="删除" @click="godelete(item.Id)" /> size="xs"
icon="edit"
style="font-weight:400;color: #3FC4FF"
class="q-mr-xs"
label="编辑"
@click="goedit(item.Id)"
/>
<q-btn
v-if="item.IsDefault != 1"
flat
size="xs"
icon="delete"
color="negative"
class="q-mr-xs"
label="删除"
@click="godelete(item.Id)"
/>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, onMounted,reactive } from 'vue' import { defineComponent, onMounted, reactive } from 'vue'
import customerService from '@/api/customer' import customerService from '@/api/customer'
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import router from '@/router/index' import router from '@/router/index'
export default defineComponent({ export default defineComponent({
setup(){ setup() {
const $q = useQuasar() const $q = useQuasar()
const state = reactive({ const state = reactive({
data:[], data: [],
}) })
const getList = () =>{ const getList = () => {
customerService.getCustomerStageFlowList({Enable:0}).then((res) => { customerService.getCustomerStageFlowList({ Enable: 0 }).then((res) => {
if (res.data.Code == 1) { if (res.data.Code == 1) {
state.data = res.data.Data state.data = res.data.Data
} else {//如果移动失败 重新获取列表 } else {//如果移动失败 重新获取列表
...@@ -85,7 +139,7 @@ ...@@ -85,7 +139,7 @@
} }
}) })
} }
const godelete = (Id:number)=>{ const godelete = (Id: number) => {
$q.dialog({ $q.dialog({
title: "提示信息", title: "提示信息",
message: '是否删除该阶段流程', message: '是否删除该阶段流程',
...@@ -98,11 +152,11 @@ ...@@ -98,11 +152,11 @@
flat: true, flat: true,
} }
}).onOk(() => { }).onOk(() => {
setFiledState(Id,2) setFiledState(Id, 2)
}); });
} }
const setFiledState = (Id:number,Type:number) =>{ const setFiledState = (Id: number, Type: number) => {
console.log(Id,Type) console.log(Id, Type)
let msg = { let msg = {
Type: Type, Type: Type,
FlowId: Id, FlowId: Id,
...@@ -122,54 +176,64 @@ ...@@ -122,54 +176,64 @@
} }
}) })
} }
const jumpPage=(url:string)=>{ const jumpPage = (url: string) => {
router.push({ router.push({
path:url, path: url,
query:{ query: {
} }
}) })
} }
const goedit = (Id: number) => {
router.push({
path: '/editor/createStageRange',
query: {
FlowId:Id
}
})
}
onMounted(() => { onMounted(() => {
getList() getList()
}) })
return{ return {
getList, getList,
state, state,
setFiledState, setFiledState,
godelete, godelete,
jumpPage jumpPage,
goedit
} }
} }
}) })
</script> </script>
<style> <style>
.customerPhase .payTable { .customerPhase .payTable {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
} }
.customerPhase .payTable tr th { .customerPhase .payTable tr th {
background: #fff; background: #fff;
height: 40px; height: 40px;
font-size: 12px; font-size: 12px;
font-weight: bold; font-weight: bold;
color: #2D2D2D; color: #2d2d2d;
background: #f5f5fa; background: #f5f5fa;
} }
.customerPhase .payTable tr { .customerPhase .payTable tr {
background: #fff; background: #fff;
text-align: center; text-align: center;
height: 40px; height: 40px;
} }
.customerPhase .payTable tr td { .customerPhase .payTable tr td {
font-size: 13px; font-size: 13px;
text-align: center; text-align: center;
color: #2D2D2D; color: #2d2d2d;
padding: 10px 0; padding: 10px 0;
font-weight: bold; font-weight: bold;
border-bottom: 1px solid #E5E5E5; border-bottom: 1px solid #e5e5e5;
} }
</style> </style>
\ No newline at end of file
...@@ -26,6 +26,27 @@ ...@@ -26,6 +26,27 @@
<div class="bold">阶段适用范围</div> <div class="bold">阶段适用范围</div>
<q-btn color="accent" label="选择部门/成员" @click="choicemember" /> <q-btn color="accent" label="选择部门/成员" @click="choicemember" />
<div
class="user_lists"
v-if="state.addMsg.DeptEmpList && state.addMsg.DeptEmpList.length > 0"
>
<div v-for="(x,y) in state.addMsg.DeptEmpList" :key="y">
<q-chip
color="primary"
v-if="x.Id.slice(0, 1) == '1'"
text-color="white"
icon="work"
:label="x.Name"
></q-chip>
<q-chip
color="primary"
v-if="x.Id.slice(0, 1) == '2'"
text-color="white"
icon="person"
:label="x.Name"
></q-chip>
</div>
</div>
</div> </div>
<div class="content-block"> <div class="content-block">
<div class="bold"> <div class="bold">
...@@ -53,7 +74,7 @@ ...@@ -53,7 +74,7 @@
</div> </div>
</div> </div>
<div class="right-arrow"> <div class="right-arrow">
<i class="el-icon-arrow-right"></i> <i class="arrow_forward_ios"></i>
</div> </div>
<div class="all-stage" :style="{ height: state.getheight + 'px' }"> <div class="all-stage" :style="{ height: state.getheight + 'px' }">
<p class="select-item-title">已选阶段</p> <p class="select-item-title">已选阶段</p>
...@@ -132,6 +153,7 @@ ...@@ -132,6 +153,7 @@
childrenKey="ChildList" childrenKey="ChildList"
strategy="leaf" strategy="leaf"
:treeData="state.dataTree" :treeData="state.dataTree"
@select_t="getdpt"
/> />
</div> </div>
</template> </template>
...@@ -143,6 +165,7 @@ import departmentStaff from '@/components/common/departmentStaff.vue' ...@@ -143,6 +165,7 @@ import departmentStaff from '@/components/common/departmentStaff.vue'
import customerService2 from '@/api/customer2' import customerService2 from '@/api/customer2'
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import { xorWith } from 'lodash'
export default defineComponent({ export default defineComponent({
...@@ -168,6 +191,7 @@ export default defineComponent({ ...@@ -168,6 +191,7 @@ export default defineComponent({
showDialog: false, showDialog: false,
defaultArray: [], defaultArray: [],
dataTree: [], dataTree: [],
FlowId: 0,//编辑上个页面带过来的
}) })
const jumpBeforePage = () => { const jumpBeforePage = () => {
router.push({ router.push({
...@@ -233,11 +257,65 @@ export default defineComponent({ ...@@ -233,11 +257,65 @@ export default defineComponent({
}) })
} }
const savemove = () => { const savemove = () => {
let data = JSON.parse(JSON.stringify(state.addMsg))
if (data.FlowName == '') {
$q.notify({
type: 'negative',
message: '请填写名称',
position: 'top'
})
return
}
if (data.DeptEmpList.length == 0) {//判断部门
$q.notify({ $q.notify({
type: 'negative', type: 'negative',
message: '不能删除', message: '请选择阶段适用范围',
position: 'top'
})
return
} else {
data.DeptEmpList = [];
if (state.addMsg.DeptEmpList && state.addMsg.DeptEmpList.length > 0) {
state.addMsg.DeptEmpList.forEach(x => {
let obj = {
Id: x.Id.split('-')[1],
Name: x.Name,
Type: x.Type,
}
data.DeptEmpList.push(obj)
})
}
}
if (data.UseStage.length > 0) {
data.UseStage = data.UseStage.join(',')
} else {
data.UseStage = ''
}
if (data.LoseCause.length > 0) {
data.LoseCause = data.LoseCause.join(',')
} else {
data.LoseCause = ''
}
if (data.InvalidCause.length > 0) {
data.InvalidCause = data.InvalidCause.join(',')
} else {
data.InvalidCause = ''
}
customerService.setCustomerStageFlowInfo(data).then(res => {
if (res.data.Code == 1) {
$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: res.data.Message,
position: 'top' position: 'top'
}) })
jumpBeforePage()
}
})
} }
let choicemember = () => { let choicemember = () => {
state.showDialog = true state.showDialog = true
...@@ -264,9 +342,44 @@ export default defineComponent({ ...@@ -264,9 +342,44 @@ export default defineComponent({
} }
}) })
} }
let getdpt = (val) => {
state.addMsg.DeptEmpList = val
state.showDialog = false
}
let getdetails = (Id: number) => {
customerService.getCustomerStageFlowInfo({ FlowId: Id }).then(res => {
if (res.data.Code == 1) {
state.addMsg = res.data.Data
if (state.addMsg.UseStage.length != '') {
state.addMsg.UseStage = state.addMsg.UseStage.split(',').map(Number)
} else {
state.addMsg.UseStage = []
}
if (state.addMsg.LoseCause.length != '') {
state.addMsg.LoseCause = state.addMsg.LoseCause.split(',').map(Number)
} else {
state.addMsg.LoseCause = []
}
if (state.addMsg.InvalidCause.length != '') {
state.addMsg.InvalidCause = state.addMsg.InvalidCause.split(',').map(Number)
} else {
state.addMsg.InvalidCause = []
}
state.defaultArray= []
state.addMsg.DeptEmpList.forEach(x => {
x.Id = x.Id+'-'+x.Type
state.defaultArray.push(x.Id+'-'+x.Type)
})
}
})
}
onMounted(() => { onMounted(() => {
getList() getList()
getEmployeeData() getEmployeeData()
if (router.currentRoute.value.query && router.currentRoute.value.query.FlowId) {
state.FlowId = router.currentRoute.value.query.FlowId as string
getdetails(state.FlowId)
}
}) })
return { return {
state, state,
...@@ -278,7 +391,9 @@ export default defineComponent({ ...@@ -278,7 +391,9 @@ export default defineComponent({
savemove, savemove,
choicemember, choicemember,
getEmployeeData, getEmployeeData,
getChildList getChildList,
getdpt,
getdetails
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment