Commit 6ed7bda4 by test

活码调整

1 parent 52f42204
...@@ -24,13 +24,13 @@ const service = '/wecom/category' ...@@ -24,13 +24,13 @@ const service = '/wecom/category'
}] }]
} }
*/ */
export function update (data) { // export function update (data) {
return request({ // return request({
url: service + '/update', // url: service + '/update',
method: 'put', // method: 'put',
data // data
}) // })
} // }
/** /**
...@@ -138,6 +138,14 @@ export function add (data) { ...@@ -138,6 +138,14 @@ export function add (data) {
}) })
} }
export function update (data) {
return request({
url: '/wecom/qr/update',
method: 'put',
data
})
}
// 活码详情 // 活码详情
export function getDetail (id) { export function getDetail (id) {
return request({ return request({
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<div v-if="codeForm.weEmpleCodeUseScops.length > 0"> <div v-if="codeForm.weEmpleCodeUseScops.length > 0">
<el-tag size="medium" v-for="(item, index) in codeForm.weEmpleCodeUseScops" :key="index">{{ item.businessName }}</el-tag> <el-tag size="medium" v-for="(item, index) in codeForm.weEmpleCodeUseScops" :key="index">{{ item.businessName }}</el-tag>
</div> </div>
<el-button type="primary" plain size="mini" @click="onSelectUser">{{ codeForm.weEmpleCodeUseScops.length ? '修改' : '选择' }}员工</el-button> <el-button style="margin-left:10px;" type="primary" plain size="mini" @click="onSelectUser">{{ codeForm.weEmpleCodeUseScops.length ? '修改' : '选择' }}员工</el-button>
<div class="sub-des">单人活码只能选择一个员工,多人活码支持选择多个员工</div> <div class="sub-des">单人活码只能选择一个员工,多人活码支持选择多个员工</div>
</el-form-item> </el-form-item>
<el-form-item v-if="codeForm.qrRuleType == 2" label="活码排班" prop="empleCodeRosterDto"> <el-form-item v-if="codeForm.qrRuleType == 2" label="活码排班" prop="empleCodeRosterDto">
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<el-card class="box-card roster-card" :key="item.id"> <el-card class="box-card roster-card" :key="item.id">
<el-form-item label="排班员工"> <el-form-item label="排班员工">
<el-tag size="medium" v-for="(tag, key) in item.weEmpleCodeUseScops" :key="key">{{tag.businessName}}</el-tag> <el-tag size="medium" v-for="(tag, key) in item.weEmpleCodeUseScops" :key="key">{{tag.businessName}}</el-tag>
<el-button size="mini" type="primary" plain @click="onSelectUser(index)">{{ item.weEmpleCodeUseScops.length ? '修改' : '选择' }}员工</el-button> <el-button style="margin-left:10px;" size="mini" type="primary" plain @click="onSelectUser(index)">{{ item.weEmpleCodeUseScops.length ? '修改' : '选择' }}员工</el-button>
</el-form-item> </el-form-item>
<el-form-item label="工作周期"> <el-form-item label="工作周期">
<el-checkbox-group v-model="item.weekday" @change="checkStartEnd($event, index)"> <el-checkbox-group v-model="item.weekday" @change="checkStartEnd($event, index)">
...@@ -288,7 +288,6 @@ ...@@ -288,7 +288,6 @@
} }
}) })
}) })
// 重复人员下的时间校验 // 重复人员下的时间校验
let repeatWeek = [] let repeatWeek = []
let currentWeekday = this.codeForm.empleCodeRosterDto[this.operationIndex].weekday let currentWeekday = this.codeForm.empleCodeRosterDto[this.operationIndex].weekday
...@@ -457,26 +456,69 @@ ...@@ -457,26 +456,69 @@
this.formTemp = res.data this.formTemp = res.data
let base = JSON.parse(JSON.stringify(res.data)) let base = JSON.parse(JSON.stringify(res.data))
this.baseForm = { this.baseForm = {
qrName: base.qrName, qrName: base.name,
qrGroupId: base.qrGroupId, qrGroupId: base.groupId,
qrAutoAdd: base.qrAutoAdd, // 自动通过 qrAutoAdd: base.autoAdd, // 自动通过
weEmpleCodeTags: base.qrTags, // 标签 weEmpleCodeTags: base.qrTags, // 标签
} }
this.codeForm.qrType = base.qrType this.codeForm.qrType = base.type
this.codeForm.qrRuleType = base.qrRuleType this.codeForm.qrRuleType = base.ruleType
if (base.qrRuleType === 1) {
this.codeForm.weEmpleCodeUseScops = base.weEmpleCodeUseScops // if (this.codeForm.qrRuleType === 1) {
// let obj = {
// type: 1,
// userIds: this.codeForm.weEmpleCodeUseScops.map(dd => dd.businessId)
// }
// this.codeForm.qrUserInfos = [obj]
// } else {
// this.codeForm.qrUserInfos = []
// this.codeForm.empleCodeRosterDto.forEach(fff => {
// let obj = {
// type: fff.type,
// beginTime: fff.startDate,
// endTime: fff.endDate,
// userIds: fff.weEmpleCodeUseScops.map(dd => dd.businessId),
// workCycle: fff.weekday
// }
// this.codeForm.qrUserInfos.push(obj)
// })
// }
if (base.ruleType === 1) {
let arr = []
base.qrUserInfos[0].weQrUserList.forEach(dd => {
let obj = {
scopeId: base.qrUserInfos[0].scopeId,
businessId: dd.userId,
businessName: dd.userName
}
arr.push(obj)
})
this.codeForm.weEmpleCodeUseScops = arr
} else { } else {
this.codeForm.empleCodeRosterDto = base.empleCodeRosterDto let arr = []
base.qrUserInfos.forEach(dd => {
let obj = {
type: dd.type,
startDate: dd.beginTime,
endDate: dd.endTime,
weekday: dd.workCycle ? dd.workCycle.split(',').map(i => parseInt(i, 0)) : [],
scopeId: dd.scopeId,
weEmpleCodeUseScops: dd.weQrUserList.map(ff => { return { businessId: ff.userId, businessName: ff.userName } })
}
arr.push(obj)
console.log(obj)
})
this.codeForm.empleCodeRosterDto = arr
} }
this.materialData = { this.materialData = {
welcomeMsg: base.welcomeMsg, welcomeMsg: base.qrAttachments ? base.qrAttachments[0].content : '',
mediaId: base.mediaId, materialMsgList: base.qrAttachments ? base.qrAttachments.slice(1) : []
materialMsgList: base.materialMsgList ? base.materialMsgList : []
} }
this.materialData.materialMsgList.forEach(ddd => { // this.materialData.materialMsgList.forEach(ddd => {
ddd.msgType = Number(ddd.msgType) // ddd.msgType = Number(ddd.msgType)
}) // })
this.loading = false this.loading = false
}) })
}, },
...@@ -591,6 +633,7 @@ ...@@ -591,6 +633,7 @@
console.log(this.codeForm) console.log(this.codeForm)
let obj = { let obj = {
type: 1, type: 1,
scopeId: this.codeForm.weEmpleCodeUseScops[0].scopeId ? this.codeForm.weEmpleCodeUseScops[0].scopeId : '',
userIds: this.codeForm.weEmpleCodeUseScops.map(dd => dd.businessId) userIds: this.codeForm.weEmpleCodeUseScops.map(dd => dd.businessId)
} }
this.codeForm.qrUserInfos = [obj] this.codeForm.qrUserInfos = [obj]
...@@ -598,6 +641,7 @@ ...@@ -598,6 +641,7 @@
this.codeForm.qrUserInfos = [] this.codeForm.qrUserInfos = []
this.codeForm.empleCodeRosterDto.forEach(fff => { this.codeForm.empleCodeRosterDto.forEach(fff => {
let obj = { let obj = {
scopeId: fff.scopeId ? fff.scopeId : '',
type: fff.type, type: fff.type,
beginTime: fff.startDate, beginTime: fff.startDate,
endTime: fff.endDate, endTime: fff.endDate,
...@@ -613,7 +657,8 @@ ...@@ -613,7 +657,8 @@
delete obj.weEmpleCodeUseScops delete obj.weEmpleCodeUseScops
delete obj.empleCodeRosterDto delete obj.empleCodeRosterDto
if (this.formTemp.id) { if (this.formTemp.id) {
obj.id = this.formTemp.id obj.qrId = this.formTemp.id
obj.configId = this.formTemp.configId
} }
(this.formTemp.id ? update : add)(obj) (this.formTemp.id ? update : add)(obj)
.then(({ .then(({
......
...@@ -79,10 +79,16 @@ ...@@ -79,10 +79,16 @@
<el-checkbox label="7" disabled>周日</el-checkbox> <el-checkbox label="7" disabled>周日</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item style="margin-bottom: 10px" label="在线时间"> <el-form-item v-if="unit.type === 1" v-model="checkList" style="margin-bottom: 10px" label="在线时间">
<el-time-select disabled value="00:00" placeholder="任意时间点"> <el-time-select disabled value="00:00" placeholder="任意时间点">
</el-time-select> </el-time-select>
<el-time-select arrow-control disabled value="23:59" placeholder="任意时间点"> <el-time-select disabled value="23:59" placeholder="任意时间点">
</el-time-select>
</el-form-item>
<el-form-item v-else style="margin-bottom: 10px" label="在线时间">
<el-time-select disabled :value="unit.beginTime" placeholder="任意时间点">
</el-time-select>
<el-time-select disabled :value="unit.endTime" placeholder="任意时间点">
</el-time-select> </el-time-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -235,10 +241,13 @@ ...@@ -235,10 +241,13 @@
this.loading = true this.loading = true
getDetail(id).then(res => { getDetail(id).then(res => {
this.form = res.data this.form = res.data
if (this.form.qrAttachments) { if (this.form.qrAttachments && this.form.qrAttachments.length) {
this.form.welcomeMsg = this.form.qrAttachments[0].content this.form.welcomeMsg = this.form.qrAttachments[0].content
this.form.materialMsgList = this.form.qrAttachments.slice(1) this.form.materialMsgList = this.form.qrAttachments.slice(1)
} }
this.form.qrUserInfos.forEach(dd => {
dd.weekday = dd.workCycle.split(',')
})
this.loading = false this.loading = false
this.setTime(7) this.setTime(7)
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!