tab-price.vue 3.3 KB

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