Commit a30afbdd by 刘泽志

3:21

parent 6e782b7d
...@@ -60,11 +60,11 @@ export function deleteField(fieldId) { ...@@ -60,11 +60,11 @@ export function deleteField(fieldId) {
* @param excelId * @param excelId
* @returns {*} * @returns {*}
*/ */
export function resetField(excelId){ export function resetField(excelId,year){
return request({ return request({
url: `${prefix}/reset`, url: `${prefix}/reset`,
method: 'get', method: 'get',
params:{excelId} params:{excelId,year}
}) })
} }
......
...@@ -118,3 +118,18 @@ export function bindRule(data) { ...@@ -118,3 +118,18 @@ export function bindRule(data) {
data data
}) })
} }
/**
* 根据年份同步规则
* @param templateId
* @param year
* @returns {*}
*/
export function syncRuleByYear(templateId,year) {
return request({
url: `${prefix}/sync/year`,
method: 'get',
params:{templateId,year}
})
}
...@@ -120,3 +120,16 @@ export function deleteRuleByTemplate(ruleId,templateId) { ...@@ -120,3 +120,16 @@ export function deleteRuleByTemplate(ruleId,templateId) {
params:{ruleId,templateId} params:{ruleId,templateId}
}) })
} }
/**
* 查询此类型模板的其它年份列表
* @param data
* @returns {*}
*/
export function queryOtherYears(data) {
return request({
url: `${prefix}/otherYears`,
method: 'post',
data
})
}
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
<el-input-number v-model="fieldDialog.data.sort" :min="0" :precision="0"/> <el-input-number v-model="fieldDialog.data.sort" :min="0" :precision="0"/>
</el-form-item> </el-form-item>
<el-form-item label="数据库字段" prop="field"> <el-form-item label="数据库字段" prop="field">
<el-select v-model="fieldDialog.data.field" :popper-append-to-body="false" filterable> <el-select v-model="fieldDialog.data.field" :popper-append-to-body="false" filterable clearable>
<el-option v-for="item in metaFieldDict" :key="item.value" :label="item.label" :value="item.value" <el-option v-for="item in metaFieldDict" :key="item.value" :label="item.label" :value="item.value"
></el-option> ></el-option>
</el-select> </el-select>
...@@ -250,10 +250,8 @@ ...@@ -250,10 +250,8 @@
</el-button> </el-button>
<el-button type="success" @click="openFieldDialog">新增</el-button> <el-button type="success" @click="openFieldDialog">新增</el-button>
<el-button type="warning" @click="openQuicklyBind">快速绑定</el-button> <el-button type="warning" @click="openQuicklyBind">快速绑定</el-button>
<el-button type="warning" @click="resetField" :loading="fieldDrawer.resetFieldLoading" <el-button type="warning" @click="openSwitchYear('template')" :disabled="!fieldDrawer.template.excelId">模板初始化</el-button>
:disabled="!fieldDrawer.template.excelId" <el-button type="warning" @click="openSwitchYear('rule')">规则同步</el-button>
>模板初始化
</el-button>
<el-button type="info" @click="createTable">物理表生成 <el-button type="info" @click="createTable">物理表生成
</el-button> </el-button>
</el-form-item> </el-form-item>
...@@ -466,6 +464,17 @@ ...@@ -466,6 +464,17 @@
<el-button @click="orgListDialog.show = false">取 消</el-button> <el-button @click="orgListDialog.show = false">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!--选择初始化年份-->
<el-dialog title="请选择同步年份" :visible.sync="otherYearDialog.show"
append-to-body width="300px" v-loading="otherYearDialog.loading"
>
<el-select v-model="otherYearDialog.year" >
<el-option v-for="item in otherYearDialog.list" :key="item" :value="item" :label="item"></el-option>
</el-select>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitOtherYear">确 定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
...@@ -539,8 +548,7 @@ export default { ...@@ -539,8 +548,7 @@ export default {
pageSize: 10, pageSize: 10,
total: 0 total: 0
}, },
queryFieldLoading: false, queryFieldLoading: false
resetFieldLoading: false
}, },
quicklyBindDialog: { // 字段dialog quicklyBindDialog: { // 字段dialog
show: false, show: false,
...@@ -576,6 +584,13 @@ export default { ...@@ -576,6 +584,13 @@ export default {
title: '', title: '',
data: {} data: {}
}, },
otherYearDialog:{ // 模板重置选择年份数据
year: '',
show: false,
loading: false,
list:[],
type: ''
},
importLoading: false, // 导入数据loading importLoading: false, // 导入数据loading
queryTemplateLoading: false, // 模板查询loading queryTemplateLoading: false, // 模板查询loading
queryTableLoading: false, // 查询数据表loading queryTableLoading: false, // 查询数据表loading
...@@ -1107,21 +1122,40 @@ export default { ...@@ -1107,21 +1122,40 @@ export default {
} }
}).finally(_ => this.initTemplateDialog.loading = false) }).finally(_ => this.initTemplateDialog.loading = false)
}, },
// 重置字段信息 // 打开年份选择框
resetField() { openSwitchYear(type){
this.$confirm('此操作将覆盖原来设置的字段信息重新生成, 是否继续?', '提示', { this.otherYearDialog.show = true
confirmButtonText: '确定', this.otherYearDialog.type = type
cancelButtonText: '取消', this.otherYearDialog.year = null
type: 'warning' DataTemplate.queryOtherYears(this.fieldDrawer.template)
}).then(() => { .then(res=>{
this.fieldDrawer.resetFieldLoading = true this.otherYearDialog.list = res.data
DataField.resetField(this.fieldDrawer.template.excelId).then(res => { })
},
// 提交同步年份信息
submitOtherYear() {
if (this.otherYearDialog.type === 'template'){
this.otherYearDialog.loading = true
DataField.resetField(this.fieldDrawer.template.excelId,
this.otherYearDialog.year).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.$message.success('字段初始化成功') this.$message.success('字段初始化成功')
this.otherYearDialog.show = false
this.queryFieldList() this.queryFieldList()
} }
}).finally(_ => this.fieldDrawer.resetFieldLoading = false) }).finally(_ => this.otherYearDialog.loading = false)
}) }else {
if (this.otherYearDialog.year){
this.otherYearDialog.loading = true
DataRule.syncRuleByYear(this.fieldDrawer.template.id, this.otherYearDialog.year).then(res => {
if (res.code === 200) {
this.$message.success('规则同步成功')
this.otherYearDialog.show = false
this.queryFieldList()
}
}).finally(_ => this.otherYearDialog.loading = false)
}
}
}, },
// 模板下载 // 模板下载
downloadTemplate(row) { downloadTemplate(row) {
...@@ -1269,7 +1303,8 @@ export default { ...@@ -1269,7 +1303,8 @@ export default {
// 打开规则新增框框 // 打开规则新增框框
openRuleAddDialog() { openRuleAddDialog() {
this.ruleDialog.data = { this.ruleDialog.data = {
type: '模板规则' type: '模板规则',
remarks: '0'
} }
this.ruleDialog.title = '新增规则' this.ruleDialog.title = '新增规则'
this.ruleDialog.show = true this.ruleDialog.show = true
...@@ -1307,7 +1342,7 @@ export default { ...@@ -1307,7 +1342,7 @@ export default {
} else { } else {
return item return item
} }
}) }).join('+')
} }
}, },
// 删除模板规则 // 删除模板规则
......
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