123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- <template>
- <div class="mainContentBox">
- <avue-crud
- ref="crudRef"
- v-model:search="search"
- v-model="form"
- :data="data"
- :option="option"
- v-model:page="page"
- @row-save="createRow"
- @row-update="updateRow"
- @row-del="deleteRow"
- @search-change="searchChange"
- @search-reset="resetChange"
- @size-change="dataList"
- @current-change="dataList"
- @selection-change="selectionChange"
- >
- <template #menu="{ size, row, index }">
- <el-button
- icon="el-icon-edit"
- text
- v-if="row.state === '-1' || row.state === '0'"
- @click="handleEdit(row, index)"
- type="primary"
- :size="size"
- >编辑</el-button
- >
- <!-- <el-button
- icon="el-icon-right"
- text
- v-if="row.state === '-1' || row.state === '0' || row.state === '1'"
- @click="doEdit(row, index)"
- type="primary"
- :size="size"
- >派工</el-button
- >-->
- </template>
- <template #menu-left>
- <div id="charts"></div>
- </template>
- </avue-crud>
- </div>
- </template>
- <script setup>
- import { ref } from "vue";
- import { useCrud } from "@/hooks/userCrud";
- import dictDataUtil from "@/common/configs/dictDataUtil";
- import { queryShopList } from "@/api/workShop";
- import { getUserList } from "@/api/system/user";
- import { useDictionaryStore } from "@/store";
- import { getStatistics } from "@/api/order/index";
- import * as echarts from "echarts";
- // 数据字典相关
- const { dicts } = useDictionaryStore();
- // 传入一个url,后面不带/
- const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
- useCrud({
- src: "/api/v1/plan/task",
- });
- const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
- Methords; //增删改查
- const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
- const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
- const crudRef = ref(null); //crudRef.value 获取avue-crud对象
- const stationList = ref([]);
- const shopList = ref([]);
- const userList = ref([]);
- const charts = shallowRef(null);
- const handleEdit = (row, index) => {
- /* queryStationByLineId(row.productLineId).then((data) => {
- stationList.value = data.data;
- });*/
- option.value.column[0].display = true;
- option.value.column[1].display = true;
- option.value.column[3].display = true;
- option.value.column[4].display = true;
- option.value.column[5].display = true;
- option.value.column[6].display = true;
- option.value.column[7].display = true;
- option.value.column[8].display = true;
- option.value.column[9].display = true;
- option.value.column[10].display = true;
- crudRef.value && crudRef.value.rowEdit(row, index);
- };
- const doEdit = (row, index) => {
- getUserList({}).then((data) => {
- userList.value = data.data;
- });
- option.value.column[0].display = false;
- option.value.column[1].display = false;
- option.value.column[2].display = false;
- option.value.column[3].display = true;
- option.value.column[9].display = true;
- option.value.column[4].display = false;
- option.value.column[5].display = false;
- option.value.column[6].display = false;
- option.value.column[7].display = false;
- option.value.column[8].display = false;
- option.value.column[10].display = false;
- option.value.column[11].display = false;
- option.value.column[12].display = false;
- option.value.column[13].display = false;
- crudRef.value && crudRef.value.rowEdit(row, index);
- };
- onMounted(() => {
- charts.value = echarts.init(document.getElementById("charts"));
- dataList();
- queryShopList().then((data) => {
- shopList.value = data.data;
- });
- getStatistics(search.value).then((res) => {
- const { data } = res;
- const { value, key } = data;
- charts.value.setOption({
- title: {
- text: "任务状态统计图",
- left: "center",
- },
- tooltip: {
- trigger: "item",
- },
- xAxis: {
- data: key,
- },
- yAxis: {},
- series: [
- {
- type: "bar",
- data: value,
- itemStyle: {
- barBorderRadius: 5,
- borderWidth: 1,
- borderType: "solid",
- borderColor: "#73c0de",
- shadowColor: "#5470c6",
- shadowBlur: 3,
- },
- },
- ],
- });
- });
- });
- // 设置表格列或者其他自定义的option
- option.value = Object.assign(option.value, {
- selection: true,
- menu: true,
- menuWidth: 160,
- addBtn: false,
- filterBtn: false,
- searchShowBtn: false,
- columnBtn: false,
- gridBtn: false,
- editBtn: false,
- viewBtn: false,
- delBtn: false,
- column: [
- {
- label: "WIN码",
- prop: "seqNo",
- editDisabled: true,
- search: true,
- },
- /* {
- label: "工位名称",
- prop: "stationName",
- search: true,
- display: false,
- },*/
- /*{
- label: "工位名称",
- hide: true,
- editDisabled: false,
- type: "select",
- dicData: stationList,
- filterable: true,
- prop: "stationId",
- props: { label: "name", value: "id" },
- rules: [
- {
- required: true,
- message: "请选择工位名称",
- trigger: "blur",
- },
- ],
- },
- {
- label: "派工人员",
- editDisabled: false,
- type: "select",
- display: false,
- dicData: userList,
- filterable: true,
- prop: "allocationUser",
- props: { label: "userName", value: "userName" },
- },*/
- {
- label: "工单编码",
- prop: "workOrderCode",
- search: true,
- width: 125,
- editDisabled: true,
- },
- /* {
- label: "产线名称",
- prop: "productLineName",
- editDisabled: true,
- },*/
- {
- label: "车间",
- prop: "workshopCode",
- type: "select",
- dicData: shopList,
- filterable: true,
- props: { label: "name", value: "code" },
- rules: [
- {
- required: true,
- message: "请选择车间名称",
- trigger: "blur",
- },
- ],
- },
- {
- label: "工艺路线",
- prop: "routeName",
- editDisabled: true,
- },
- {
- label: "物料编号",
- prop: "materialCode",
- search: true,
- editDisabled: true,
- },
- {
- label: "工序编码",
- prop: "operationCode",
- editDisabled: true,
- search: true,
- },
- {
- label: "工序名称",
- prop: "operationName",
- editDisabled: true,
- },
- {
- label: "排序",
- prop: "operationSort",
- editDisabled: true,
- width: 60,
- },
- {
- label: "状态",
- prop: "state",
- type: "select",
- search: true,
- width: 80,
- editDisabled: true,
- dicUrl:
- dictDataUtil.request_url + dictDataUtil.TYPE_CODE.station_task_state,
- props: {
- label: "dictLabel",
- value: "dictValue",
- },
- },
- {
- label: "预计开始",
- prop: "planStartWhen",
- type: "datetime",
- valueFormat: "YYYY-MM-DD HH:mm:ss",
- },
- {
- label: "预计结束",
- prop: "planStartEnd",
- type: "datetime",
- valueFormat: "YYYY-MM-DD HH:mm:ss",
- },
- ],
- });
- </script>
- <style lang="scss" scoped>
- :deep(.avue-crud__left) {
- width: 100%;
- }
- #charts {
- width: 100%;
- height: 300px;
- border: 1px solid #ccc;
- }
- </style>
|