|
|
@@ -4,188 +4,179 @@
|
|
|
<!-- 搜索表单 -->
|
|
|
<user-search @search="reload" />
|
|
|
<!-- 数据表格 -->
|
|
|
- <ele-pro-table
|
|
|
- ref="table"
|
|
|
- :columns="columns"
|
|
|
- :datasource="datasource"
|
|
|
- :selection.sync="selection"
|
|
|
- row-key="id"
|
|
|
- >
|
|
|
+
|
|
|
+ <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
|
|
|
<!-- 状态列 -->
|
|
|
|
|
|
<!-- 操作列 -->
|
|
|
</ele-pro-table>
|
|
|
</el-card>
|
|
|
<!-- 编辑弹窗 -->
|
|
|
- <user-edit
|
|
|
- :visible.sync="showEdit"
|
|
|
- :data="current"
|
|
|
- @done="reload"
|
|
|
- ref="userEdit"
|
|
|
- />
|
|
|
+ <user-edit :visible.sync="showEdit" :data="current" @done="reload" ref="userEdit" />
|
|
|
<!-- 配置工艺参数 -->
|
|
|
- <user-setting
|
|
|
- :visible.sync="showSetting"
|
|
|
- :data="current"
|
|
|
- ref="userSetting"
|
|
|
- />
|
|
|
+ <user-setting :visible.sync="showSetting" :data="current" ref="userSetting" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import UserSearch from './components/user-search.vue';
|
|
|
- import UserEdit from './components/user-edit.vue';
|
|
|
- import UserSetting from './components/user-setting.vue';
|
|
|
+import UserSearch from './components/user-search.vue';
|
|
|
+import UserEdit from './components/user-edit.vue';
|
|
|
+import UserSetting from './components/user-setting.vue';
|
|
|
|
|
|
- import producetask from '@/api/technology/production';
|
|
|
+import producetask from '@/api/technology/production';
|
|
|
|
|
|
- export default {
|
|
|
- name: 'technologyProduction',
|
|
|
- components: {
|
|
|
- UserSearch,
|
|
|
- UserEdit,
|
|
|
- UserSetting
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 表格列配置
|
|
|
- columns: [
|
|
|
- {
|
|
|
- columnKey: 'selection',
|
|
|
- type: 'selection',
|
|
|
- width: 45,
|
|
|
- align: 'center',
|
|
|
- selectable: (row, index) => {
|
|
|
- return !this.data.some((it) => it.code == row.code);
|
|
|
- // return row.id < 3; // 这里是让 id < 3 的禁用,根据自己业务修改
|
|
|
- },
|
|
|
- reserveSelection: true,
|
|
|
- fixed: 'left'
|
|
|
+export default {
|
|
|
+ name: 'technologyProduction',
|
|
|
+ components: {
|
|
|
+ UserSearch,
|
|
|
+ UserEdit,
|
|
|
+ UserSetting
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ tableData: {
|
|
|
+ type: Array
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 45,
|
|
|
+ align: 'center',
|
|
|
+ selectable: (row, index) => {
|
|
|
+ return !this.tableData.some((it) => it.sourceTaskId == row.id);
|
|
|
},
|
|
|
|
|
|
- {
|
|
|
- prop: 'code',
|
|
|
- label: '工序编码',
|
|
|
- // sortable: 'custom',
|
|
|
- showOverflowTooltip: true,
|
|
|
- align: 'center',
|
|
|
+ reserveSelection: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '工序名称',
|
|
|
- showOverflowTooltip: true,
|
|
|
- align: 'center',
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- align: 'center',
|
|
|
- prop: 'controlName',
|
|
|
- label: '工序控制码',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'workCenterName',
|
|
|
- label: '所属工作中心',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- }
|
|
|
- ],
|
|
|
- // 表格选中数据
|
|
|
- selection: [],
|
|
|
- // 当前编辑数据
|
|
|
- current: null,
|
|
|
- // 是否显示编辑弹窗
|
|
|
- showEdit: false,
|
|
|
- // 是否显示参数弹窗
|
|
|
- showSetting: false
|
|
|
- };
|
|
|
+
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'id',
|
|
|
+ label: '工序编码',
|
|
|
+ // sortable: 'custom',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '工序名称',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ prop: 'controlName',
|
|
|
+ label: '工序控制码',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'workCenterName',
|
|
|
+ label: '所属工作中心',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // 表格选中数据
|
|
|
+ selection: [],
|
|
|
+ // 当前编辑数据
|
|
|
+ current: null,
|
|
|
+ // 是否显示编辑弹窗
|
|
|
+ showEdit: false,
|
|
|
+ // 是否显示参数弹窗
|
|
|
+ showSetting: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ /*配置工艺参数 */
|
|
|
+ openSetting(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.showSetting = true;
|
|
|
},
|
|
|
- props: {
|
|
|
- data: Array
|
|
|
+ /* 表格数据源 */
|
|
|
+ async datasource({ page, limit, where, order }) {
|
|
|
+ const res = await producetask.list({
|
|
|
+ ...where,
|
|
|
+ ...order,
|
|
|
+ pageNum: page,
|
|
|
+ isDetail: true,
|
|
|
+ size: limit
|
|
|
+ });
|
|
|
+ return res;
|
|
|
},
|
|
|
- methods: {
|
|
|
- /*配置工艺参数 */
|
|
|
- openSetting(row) {
|
|
|
- this.current = row;
|
|
|
- this.showSetting = true;
|
|
|
- },
|
|
|
- /* 表格数据源 */
|
|
|
- async datasource({ page, limit, where, order }) {
|
|
|
- const res = await producetask.list({
|
|
|
- ...where,
|
|
|
- ...order,
|
|
|
- pageNum: page,
|
|
|
- isDetail: true,
|
|
|
- size: limit
|
|
|
- });
|
|
|
- return res;
|
|
|
- },
|
|
|
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where: where });
|
|
|
- },
|
|
|
- /* 打开编辑弹窗 */
|
|
|
- openEdit(row) {
|
|
|
- this.current = row;
|
|
|
- this.showEdit = true;
|
|
|
- this.$refs.userEdit.$refs.form &&
|
|
|
- this.$refs.userEdit.$refs.form.clearValidate();
|
|
|
- },
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({ page: 1, where: where });
|
|
|
+ },
|
|
|
+ /* 打开编辑弹窗 */
|
|
|
+ openEdit(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.showEdit = true;
|
|
|
+ this.$refs.userEdit.$refs.form &&
|
|
|
+ this.$refs.userEdit.$refs.form.clearValidate();
|
|
|
+ },
|
|
|
|
|
|
- /* 删除 */
|
|
|
- remove(row) {
|
|
|
- const loading = this.$loading({ lock: true });
|
|
|
+ /* 删除 */
|
|
|
+ remove(row) {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
|
|
|
- producetask
|
|
|
- .delete([row.id])
|
|
|
- .then((msg) => {
|
|
|
- loading.close();
|
|
|
- this.$message.success('删除' + msg);
|
|
|
- this.reload();
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- loading.close();
|
|
|
- // this.$message.error(e.message);
|
|
|
- });
|
|
|
- },
|
|
|
- /* 批量删除 */
|
|
|
- removeBatch() {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message.error('请至少选择一条数据');
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$confirm('确定要删除选中的工序吗?', '提示', {
|
|
|
- type: 'warning'
|
|
|
+ producetask
|
|
|
+ .delete([row.id])
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success('删除' + msg);
|
|
|
+ this.reload();
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- const loading = this.$loading({ lock: true });
|
|
|
- producetask
|
|
|
- .delete(this.selection.map((d) => d.id))
|
|
|
- .then((msg) => {
|
|
|
- loading.close();
|
|
|
- this.$message.success('删除' + msg);
|
|
|
- this.reload();
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- loading.close();
|
|
|
- // this.$message.error(e.message);
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ // this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 批量删除 */
|
|
|
+ removeBatch() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message.error('请至少选择一条数据');
|
|
|
+ return;
|
|
|
}
|
|
|
+ this.$confirm('确定要删除选中的工序吗?', '提示', {
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const loading = this.$loading({ lock: true });
|
|
|
+ producetask
|
|
|
+ .delete(this.selection.map((d) => d.id))
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success('删除' + msg);
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ // this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => { });
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- :deep(.el-checkbox__input.is-disabled) {
|
|
|
- .el-checkbox__inner {
|
|
|
- background-color: rgba(142, 128, 128, 0.584) !important;
|
|
|
- }
|
|
|
+:deep(.el-checkbox__input.is-disabled) {
|
|
|
+ .el-checkbox__inner {
|
|
|
+ background-color: rgba(142, 128, 128, 0.584) !important;
|
|
|
}
|
|
|
+}
|
|
|
</style>
|