|
@@ -8,20 +8,18 @@
|
|
|
</template>
|
|
|
<HcTable :column="positiontableColumn" :datas="positiontableData">
|
|
|
<template #action="{row, index}">
|
|
|
- <el-button size="small" type="primary" @click="positionEdit(2)">编辑</el-button>
|
|
|
- <el-button size="small" type="primary" @click="delTaskposition">删除</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="positionEdit(2,row)">编辑</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="delTaskposition(row)">删除</el-button>
|
|
|
</template>
|
|
|
</HcTable>
|
|
|
- <template #action>
|
|
|
- <HcPages :pages="searchForm" @change="pageChange"></HcPages>
|
|
|
- </template>
|
|
|
- <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="positonModal" :title="positonModalTitle" @close="positonModalClose">
|
|
|
+
|
|
|
+ <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="positonModal" :title="positonModalTitle" @close="positonModalClose" @save="savepositionClick">
|
|
|
<el-form label-position="top" label-width="auto" :model="formposition" size="large">
|
|
|
<el-form-item label="岗位类型名称:">
|
|
|
- <el-input v-model="formposition.name"/>
|
|
|
+ <el-input v-model="formposition.dictName"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="日单价:">
|
|
|
- <el-input v-model="formposition.price"/>
|
|
|
+ <el-input v-model="formposition.dictValue" oninput="value=value.replace(/[^\d]/g,'')"/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</HcDialog>
|
|
@@ -29,57 +27,78 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {ref, watch} from "vue";
|
|
|
-
|
|
|
+import {ref, watch,onMounted} from "vue";
|
|
|
+import {submitDictionary,removeDictionary,getParentList,getChildList} from '~api/system/parameter.js';
|
|
|
+import {getArrValue} from "js-fast-way"
|
|
|
const props = defineProps({
|
|
|
cur: {
|
|
|
type: [String,Number],
|
|
|
default: ''
|
|
|
},
|
|
|
+ type:{
|
|
|
+ type: [String,Number],
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
const tabsKey = ref(props.cur)
|
|
|
+const tabsType = ref(props.type)
|
|
|
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
props.cur,
|
|
|
-], ([key]) => {
|
|
|
+ props.type,
|
|
|
+], ([key,type]) => {
|
|
|
tabsKey.value = key
|
|
|
- console.log(key)
|
|
|
+ tabsType.value = type
|
|
|
})
|
|
|
|
|
|
-
|
|
|
-const searchForm = ref({
|
|
|
- postType: '', name: '',
|
|
|
- current: 1, size: 20, total: 0
|
|
|
+onMounted(() => {
|
|
|
+ getParentListData()
|
|
|
+
|
|
|
})
|
|
|
-//分页被点击
|
|
|
-const pageChange = ({current, size}) => {
|
|
|
- searchForm.value.current = current
|
|
|
- searchForm.value.size = size
|
|
|
+const tableLoaing=ref(false)
|
|
|
+const getParentListData=async()=>{
|
|
|
+ tableLoaing.value=true
|
|
|
+ const { error, code, data,msg } = await getParentList({
|
|
|
+ type:tabsType.value,
|
|
|
+ })
|
|
|
+ tableLoaing.value=false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ positiontableData.value = getArrValue(data['records'])
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ positiontableData.value=[]
|
|
|
+ window.$message?.warning(msg)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
const positiontableColumn = [
|
|
|
- {key: 'name', name: '岗位类型名称'},
|
|
|
- {key: 'text', name: '日单价'},
|
|
|
+ {key: 'dictName', name: '岗位类型名称'},
|
|
|
+ {key: 'dictValue', name: '日单价'},
|
|
|
{key: 'action', name: '操作', width: 200}
|
|
|
]
|
|
|
|
|
|
|
|
|
-const positiontableData = ref([
|
|
|
- {name: '名称1', text: '文本1', color: 'red'},
|
|
|
- {name: '名称2', text: '文本2', color: 'blue'},
|
|
|
- {name: '名称3', text: '文本3', color: '无'}
|
|
|
-])
|
|
|
+const positiontableData = ref([])
|
|
|
|
|
|
const positonModal = ref(false)
|
|
|
const positonModalTitle = ref('')
|
|
|
-
|
|
|
-const positionEdit = (type) => {
|
|
|
+const editItem=ref({})
|
|
|
+const positionEdit = (type,row) => {
|
|
|
if (type === 1) {
|
|
|
positonModalTitle.value = '新增岗位类型'
|
|
|
+ formposition.value={}
|
|
|
+ editItem.value={}
|
|
|
} else {
|
|
|
positonModalTitle.value = '编辑岗位类型'
|
|
|
+ editItem.value=row
|
|
|
+ formposition.value=row
|
|
|
}
|
|
|
positonModal.value = true
|
|
|
}
|
|
@@ -89,18 +108,43 @@ const positonModalClose = () => {
|
|
|
}
|
|
|
|
|
|
const formposition = ref({})
|
|
|
-
|
|
|
-const delTaskposition = () => {
|
|
|
- window?.$messageBox?.alert('您确定要删除该岗位单价吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
|
|
|
- showCancelButton: true,
|
|
|
- confirmButtonText: '确认注销',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- callback: (action) => {
|
|
|
- if (action === 'confirm') {
|
|
|
- console.log(11111);
|
|
|
+//新增编辑提交
|
|
|
+const savepositionClick=async()=>{
|
|
|
+ const { error, code, data,msg } = await submitDictionary({
|
|
|
+ type:tabsType.value,
|
|
|
+ dictValue:formposition.value?.dictValue,
|
|
|
+ dictName:formposition.value?.dictName,
|
|
|
+ id:editItem.value.id||null
|
|
|
+
|
|
|
+ })
|
|
|
+ positonModal.value=false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success(msg)
|
|
|
+ getParentListData()
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ window.$message?.warning(msg)
|
|
|
+ }
|
|
|
+}
|
|
|
+const delTaskposition = (row) => {
|
|
|
+ window?.$messageBox?.alert('您确定要删除该信息吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: '确认注销',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ callback: async(action) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ const {error, code, msg} = await removeDictionary({
|
|
|
+ ids: row?.id,
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window?.$message?.success('删除成功')
|
|
|
+ getParentListData()
|
|
|
+ } else {
|
|
|
+ window?.$message?.warning(msg)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
})
|
|
|
}
|
|
|
</script>
|