tab-price.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <HcCard>
  3. <template #header>
  4. <span class="mr-2">岗位单价:</span>
  5. <el-button _icon hc-btn size="small" type="primary" @click="positionEdit(1)">
  6. <HcIcon name="add"/>
  7. </el-button>
  8. </template>
  9. <HcTable :column="positiontableColumn" :datas="positiontableData">
  10. <template #action="{row, index}">
  11. <el-button size="small" type="primary" @click="positionEdit(2)">编辑</el-button>
  12. <el-button size="small" type="primary" @click="delTaskposition">删除</el-button>
  13. </template>
  14. </HcTable>
  15. <template #action>
  16. <HcPages :pages="searchForm" @change="pageChange"></HcPages>
  17. </template>
  18. <HcDialog bgColor="#ffffff" isToBody widths="24rem" :show="positonModal" :title="positonModalTitle" @close="positonModalClose">
  19. <el-form label-position="top" label-width="auto" :model="formposition" size="large">
  20. <el-form-item label="岗位类型名称:">
  21. <el-input v-model="formposition.name"/>
  22. </el-form-item>
  23. <el-form-item label="日单价:">
  24. <el-input v-model="formposition.price"/>
  25. </el-form-item>
  26. </el-form>
  27. </HcDialog>
  28. </HcCard>
  29. </template>
  30. <script setup>
  31. import {ref, watch} from "vue";
  32. const props = defineProps({
  33. cur: {
  34. type: [String,Number],
  35. default: ''
  36. },
  37. })
  38. const tabsKey = ref(props.cur)
  39. //监听
  40. watch(() => [
  41. props.cur,
  42. ], ([key]) => {
  43. tabsKey.value = key
  44. console.log(key)
  45. })
  46. const searchForm = ref({
  47. postType: '', name: '',
  48. current: 1, size: 20, total: 0
  49. })
  50. //分页被点击
  51. const pageChange = ({current, size}) => {
  52. searchForm.value.current = current
  53. searchForm.value.size = size
  54. }
  55. const positiontableColumn = [
  56. {key: 'name', name: '岗位类型名称'},
  57. {key: 'text', name: '日单价'},
  58. {key: 'action', name: '操作', width: 200}
  59. ]
  60. const positiontableData = ref([
  61. {name: '名称1', text: '文本1', color: 'red'},
  62. {name: '名称2', text: '文本2', color: 'blue'},
  63. {name: '名称3', text: '文本3', color: '无'}
  64. ])
  65. const positonModal = ref(false)
  66. const positonModalTitle = ref('')
  67. const positionEdit = (type) => {
  68. if (type === 1) {
  69. positonModalTitle.value = '新增岗位类型'
  70. } else {
  71. positonModalTitle.value = '编辑岗位类型'
  72. }
  73. positonModal.value = true
  74. }
  75. const positonModalClose = () => {
  76. positonModal.value = false
  77. }
  78. const formposition = ref({})
  79. const delTaskposition = () => {
  80. window?.$messageBox?.alert('您确定要删除该岗位单价吗? 一旦注销数据将彻底清除,请谨慎操作?', '删除提醒', {
  81. showCancelButton: true,
  82. confirmButtonText: '确认注销',
  83. cancelButtonText: '取消',
  84. type: 'warning',
  85. callback: (action) => {
  86. if (action === 'confirm') {
  87. console.log(11111);
  88. }
  89. }
  90. })
  91. }
  92. </script>
  93. <style scoped lang="scss">
  94. </style>