diff --git a/src/api/model/hfnf.js b/src/api/model/hfnf.js index 1e12772b..dab1212d 100644 --- a/src/api/model/hfnf.js +++ b/src/api/model/hfnf.js @@ -6,8 +6,8 @@ export default { name: "列表", req: async function(data){ return await http.post( - `${config.HOST_URL}/hfnf_api/mplogx/`, - // "http://10.0.11.52:5800/mplogx/", + // `${config.HOST_URL}/hfnf_api/mplogx/`, + "http://10.0.11.52:5800/mplogx/", data ); } diff --git a/src/config/route.js b/src/config/route.js index 6ee83b9d..5e652bc8 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -123,6 +123,14 @@ const routes = [ }, component: "bigScreen/track", }, + { + name: "cement_data_template", + path: "/cement_data_template", + meta: { + title: "数据模板", + }, + component: "home/cement_data_template", + }, { name: "userCenter", path: "/usercenter", diff --git a/src/views/fac_cal/cement_data_template.vue b/src/views/fac_cal/cement_data_template.vue new file mode 100644 index 00000000..0bd2f1f7 --- /dev/null +++ b/src/views/fac_cal/cement_data_template.vue @@ -0,0 +1,275 @@ + + + + + diff --git a/src/views/fac_cal/hfnf_index.vue b/src/views/fac_cal/hfnf_index.vue index 3d880f26..70c3417a 100644 --- a/src/views/fac_cal/hfnf_index.vue +++ b/src/views/fac_cal/hfnf_index.vue @@ -1,31 +1,605 @@ + \ No newline at end of file + +const goDetail = () => { + router.push('/hfnf_mplogx') +} + +const goStandard = () => { + router.push('/cement_data_template') +} + +const initBarChart = () => { + if (!barChartRef.value) return + barChart = echarts.init(barChartRef.value) + barChart.setOption({ + tooltip: { + trigger: 'axis', + formatter: (params) => { + const p = params[0] + return `${p.name}
数据量:${formatNumber(p.value)} 条` + }, + }, + grid: { left: 20, right: 30, top: 20, bottom: 30, containLabel: true }, + xAxis: { + type: 'category', + data: factories.value.map((f) => f.name), + axisLabel: { color: '#666', fontSize: 13 }, + axisLine: { lineStyle: { color: '#e4e7ed' } }, + axisTick: { show: false }, + }, + yAxis: { + type: 'value', + axisLabel: { + color: '#999', + formatter: (v) => (v >= 1e8 ? (v / 1e8).toFixed(1) + '亿' : (v / 1e4).toFixed(0) + '万'), + }, + splitLine: { lineStyle: { color: '#f0f0f0' } }, + }, + series: [ + { + type: 'bar', + data: factories.value.map((f) => ({ + value: f.count, + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: f.color }, + { offset: 1, color: f.bgColor }, + ]), + borderRadius: [6, 6, 0, 0], + }, + })), + barWidth: '45%', + label: { + show: true, + position: 'top', + formatter: (p) => (p.value / 1e8).toFixed(2) + '亿', + color: '#333', + fontSize: 13, + fontWeight: 600, + }, + }, + ], + }) +} + +const initPieChart = () => { + if (!pieChartRef.value) return + pieChart = echarts.init(pieChartRef.value) + pieChart.setOption({ + tooltip: { + trigger: 'item', + formatter: (p) => `${p.name}
数据量:${formatNumber(p.value)}
占比:${p.percent}%`, + }, + legend: { + orient: 'vertical', + right: 10, + top: 'center', + textStyle: { fontSize: 13, color: '#666' }, + }, + series: [ + { + type: 'pie', + radius: ['42%', '70%'], + center: ['40%', '50%'], + avoidLabelOverlap: true, + itemStyle: { borderRadius: 6, borderColor: '#fff', borderWidth: 3 }, + label: { + show: true, + formatter: '{b}\n{d}%', + fontSize: 12, + lineHeight: 18, + }, + labelLine: { length: 15, length2: 10 }, + emphasis: { + itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.2)' }, + }, + data: factories.value.map((f) => ({ + value: f.count, + name: f.name, + itemStyle: { color: f.color }, + })), + }, + ], + }) +} + +const handleResize = () => { + barChart?.resize() + pieChart?.resize() +} + +onMounted(() => { + API.hfnf.mplogx.list.req({ page: 1, page_size: 1 }).then(res => { + totalCount.value = res.count + nextTick(() => { + initBarChart() + initPieChart() + }) + }) + window.addEventListener('resize', handleResize) +}) + +onBeforeUnmount(() => { + window.removeEventListener('resize', handleResize) + barChart?.dispose() + pieChart?.dispose() +}) + + + diff --git a/src/views/hrm/empjoin_form.vue b/src/views/hrm/empjoin_form.vue index 9df17526..3ac84a7f 100644 --- a/src/views/hrm/empjoin_form.vue +++ b/src/views/hrm/empjoin_form.vue @@ -188,15 +188,22 @@ export default { }) }, deep: true, + }, + t_id: { + handler(val) { + this.localMode = this.mode; + if (val) { + this.getTid(); + } else { + this.formData = { person: [] }; + this.localMode = "add"; + } + }, + immediate: true, } }, mounted() { this.getGroup(); - if (this.t_id) { - this.getTid(); - } else { - this.localMode = "add"; - } }, methods: { async getTid() { @@ -204,18 +211,22 @@ export default { let res = await this.$API.hrm.empjoin.item.req(this.t_id); // 获取岗位列表,填充 post_name if (res.person && res.person.length > 0) { - const postRes = await this.$API.system.post.list.req({ page: 0 }); - const postList = Array.isArray(postRes) ? postRes : (postRes.results || postRes.data || []); - const postMap = {}; - postList.forEach(p => { postMap[p.id] = p.name; }); - res.person.forEach(p => { - if (p.post && !p.post_name) { - p.post_name = postMap[p.post] || ''; - } - }); + try { + const postRes = await this.$API.system.post.list.req({ page: 0 }); + const postList = Array.isArray(postRes) ? postRes : (postRes.results || postRes.data || []); + const postMap = {}; + postList.forEach(p => { postMap[p.id] = p.name; }); + res.person.forEach(p => { + if (p.post && !p.post_name) { + p.post_name = postMap[p.post] || ''; + } + }); + } catch (postErr) { + console.error('获取岗位列表失败:', postErr); + } } this.formData = res; - if (res.ticket_ && res.ticket_.state_.type == 1 && res.create_by == this.$TOOL.data.get("USER_INFO").id) { + if (res.ticket_ && res.ticket_.state_ && res.ticket_.state_.type == 1 && res.create_by == this.$TOOL.data.get("USER_INFO").id) { this.localMode = "edit"; } } catch (error) { diff --git a/src/views/hrm/resignation_form.vue b/src/views/hrm/resignation_form.vue index 274c5b40..c86e4af5 100644 --- a/src/views/hrm/resignation_form.vue +++ b/src/views/hrm/resignation_form.vue @@ -34,6 +34,15 @@ :readonly="localMode === 'show'" > + + + up.post_ && up.post_.name === "部门负责人"); + } catch (e) { + console.error("获取用户岗位失败:", e); + } + const restrictedKeys = { wf_leave: isDeptHead }; const groups = {}; this.$API.wf.workflow.list.req({ page: 0 }).then((res) => { res.forEach((item) => { if(item.key && permissions.includes(item.key)) { + if (item.key in restrictedKeys && !restrictedKeys[item.key]) { + return; + } let cate = item.cate; if (!cate){cate="未分组"} if (!groups[cate]) { diff --git a/src/views/wf/ticketd_b.vue b/src/views/wf/ticketd_b.vue index 0078a9de..54f3eaed 100644 --- a/src/views/wf/ticketd_b.vue +++ b/src/views/wf/ticketd_b.vue @@ -34,18 +34,27 @@ const props = defineProps({ const workflow = ref(null); const transitions = ref([]); -onMounted(async () => { - setTimeout(()=>{init()}, 1000) - // watch( - // () => props.ticket_, - // async (newVal) => { - // if (newVal && Object.keys(newVal).length > 0) { - // init(); - // } - // }, - // { deep: true } - // ) -}) +let lastInitTicketId = null; +const tryInit = () => { + // 优先用 ticket_ 分支:等到 ticket_.id 出现再调 + if (props.ticket_ && props.ticket_.id) { + if (lastInitTicketId !== props.ticket_.id) { + lastInitTicketId = props.ticket_.id; + init(); + } + return; + } + // 没有 ticket_,退化到 workflow_key 分支(创建工单场景) + if (props.workflow_key) { + if (lastInitTicketId !== '__wf_key__:' + props.workflow_key) { + lastInitTicketId = '__wf_key__:' + props.workflow_key; + init(); + } + } +}; +onMounted(() => { tryInit(); }); +watch(() => props.ticket_, () => { tryInit(); }, { deep: true }); +watch(() => props.workflow_key, () => { tryInit(); }); const ticketId = ref(null); const actionShow = ref(false);